trade-audit

Mandatory audit gate for all trading and transfer decisions. Sends agent-prepared decision material to Apus deterministic inference on an NVIDIA H100 TEE and returns an attested APPROVE / REJECT / WAIT verdict. Any skill or agent that executes a buy, sell, swap, transfer, or liquidity action MUST pass through trade-audit first.

3,891 stars

Best use case

trade-audit is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Mandatory audit gate for all trading and transfer decisions. Sends agent-prepared decision material to Apus deterministic inference on an NVIDIA H100 TEE and returns an attested APPROVE / REJECT / WAIT verdict. Any skill or agent that executes a buy, sell, swap, transfer, or liquidity action MUST pass through trade-audit first.

Teams using trade-audit should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/trade-audit/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/alex-wuhu/trade-audit/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/trade-audit/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How trade-audit Compares

Feature / Agenttrade-auditStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Mandatory audit gate for all trading and transfer decisions. Sends agent-prepared decision material to Apus deterministic inference on an NVIDIA H100 TEE and returns an attested APPROVE / REJECT / WAIT verdict. Any skill or agent that executes a buy, sell, swap, transfer, or liquidity action MUST pass through trade-audit first.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Trade-Audit — Mandatory Audit Gate for Trading & Transfer Decisions

## When to use

This skill is designed for auditing financial decisions — buy, sell, swap, transfer, liquidity pool entry/exit, or any on-chain value movement. The user may ask you to run it before executing a trade or transfer, or to always use it as a pre-check for financial actions.

## What this skill does

Takes agent-prepared decision material and sends it to the Apus deterministic inference API running on an NVIDIA H100 TEE. Returns a structured, hardware-attested decision packet with:

- `Bundle Hash` — SHA-256 of the normalized decision material
- `Output Hash` — SHA-256 of the model's structured decision packet
- `TEE Nonce` — hardware attestation for that specific run
- `Verdict` — APPROVE / REJECT / WAIT
- `Confidence` — 1-100 integer, gated by `--min-confidence` (default 60)

Every run is logged to `~/.trade-audit/audit.jsonl`.

**No wallet or API key required.** This skill only reads public data and calls the Apus inference API. It does not execute any transactions.

Important boundary:

The script is at `{baseDir}/analyze.py`.

- The agent collects the page contents, address information, pool details, rules, and relevant facts.
- The agent organizes that material into either a text/markdown file or a JSON decision bundle.
- This script does not fetch pages or explorer data itself.
- Reuse the bundled templates when preparing inputs:
  - Markdown template: `{baseDir}/templates/prepared-decision-template.md`
  - JSON template: `{baseDir}/templates/prepared-bundle-template.json`

## Step 1 — Prepare the decision material

The audit model (`gemma-3-27b-it`) performs best with **concise, focused inputs**. The agent MUST distill raw data into core decision points before submitting.

**Data preparation rules:**

- Extract only: prices, thresholds, numeric values, rules/conditions, addresses, risk factors
- Strip out: page chrome, disclaimers, marketing text, navigation, repeated boilerplate
- Keep material under 4,000 characters when possible (warning at 4k, hard truncation at 12k)
- Each fact should be one short bullet — no paragraphs
- If a page has 50 data points, pick the 5-10 that directly affect the decision

Create one of these:

1. A text or markdown file containing the organized facts.
2. A JSON bundle containing the organized facts plus `decision_goal`.

For example, a prepared text file might contain:

```text
Page: https://polymarket.com/event/what-price-will-bitcoin-hit-before-2027
Decision goal: Decide whether there is a justified BTC buy level from this market page.

Collected facts:
- Market title: What price will Bitcoin hit before 2027
- Threshold ladder excerpt:
  - Below 55,000: Yes 74c / No 27c
  - Below 50,000: Yes 61c / No 40c
- Rules:
  - Market resolves yes if Binance BTC/USDT trades at or below the threshold in the specified window.
- Observation:
  - 55,000 is the strongest downside threshold shown in the collected page notes.
```

## Common data sources (no auth required)

When preparing decision material, prefer public APIs over scraping JS-rendered pages.

### Polymarket

Use the CLOB API to get market data — no wallet or login needed:

```bash
# Get market info by condition ID or slug
curl -s "https://clob.polymarket.com/markets" | python3 -c "
import sys, json
for m in json.load(sys.stdin):
    if 'KEYWORD' in m.get('question','').lower():
        print(json.dumps({'question': m['question'], 'tokens': m['tokens'], 'end_date': m.get('end_date_iso')}, indent=2))
"

# Get a specific market by condition_id
curl -s "https://clob.polymarket.com/markets/<condition_id>"
```

Key fields to extract: `question`, `tokens[].outcome` (YES/NO), `tokens[].price`, `end_date_iso`, `description` (resolution rules).

### Crypto prices

```bash
# CoinGecko — free, no API key
curl -s "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd"

# Binance public ticker
curl -s "https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT"
```

### On-chain data

```bash
# Arweave transaction
curl -s "https://arweave.net/tx/<txid>"

# AO process state (via aoconnect skill if installed, or direct)
curl -s "https://cu.ao-testnet.xyz/dry-run?process-id=<pid>" -d '{"Tags":[{"name":"Action","value":"Info"}]}'
```

The agent should fetch data from these APIs, extract the core numbers, and organize them into the decision material template. Do not pass raw API responses directly — distill to key facts first.

## Step 2 — Run the audit

No external dependencies required — the script uses only Python stdlib. Just run with `python3`:

### Standard mode (always returns exit 0 on success)

```bash
python3 {baseDir}/analyze.py \
  --input-file /tmp/prepared-decision.md \
  --decision-goal "Decide whether there is a justified BTC buy level from this market page" \
  --bundle-out /tmp/audit-bundle.json \
  --packet-out /tmp/audit-packet.json
```

### Gate mode (exit code reflects verdict)

```bash
python3 {baseDir}/analyze.py \
  --input-file /tmp/prepared-decision.md \
  --decision-goal "Decide whether there is a justified BTC buy level" \
  --gate \
  --min-confidence 60 \
  --bundle-out /tmp/audit-bundle.json \
  --packet-out /tmp/audit-packet.json
```

Exit codes in gate mode:
- `0` = APPROVE — proceed with the action
- `1` = REJECT — do NOT proceed
- `2` = WAIT — insufficient information, gather more data first

If the agent already prepared a JSON bundle:

```bash
python3 {baseDir}/analyze.py \
  --bundle-file /tmp/prepared-bundle.json \
  --gate \
  --bundle-out /tmp/audit-bundle.json \
  --packet-out /tmp/audit-packet.json
```

Print the full terminal output to the user exactly as it appears.

After the audit completes, the agent MUST include these TEE attestation fields in the response to the user:

```
Bundle Hash : <hash of the input material>
Output Hash : <hash of the decision packet>
TEE Nonce   : <hardware attestation nonce>
TEE Verified: <true/false>
GPU Model   : <e.g. NVIDIA H100>
```

These fields prove the decision was made inside a Trusted Execution Environment. Omitting them defeats the purpose of using this skill. Always show them alongside the verdict summary.

## Step 3 — Integration pattern for other skills

Any skill or agent workflow that involves a trade or transfer must use this pattern:

```bash
# 1. Agent prepares the decision material into /tmp/audit-input.md
# 2. Run trade-audit in gate mode
python3 {baseDir}/analyze.py \
  --input-file /tmp/audit-input.md \
  --decision-goal "Decide whether to transfer 10 AR from wallet A to wallet B" \
  --gate \
  --min-confidence 60

# 3. Check the exit code
if [ $? -ne 0 ]; then
  echo "Trade-audit did not approve. Aborting."
  exit 1
fi

# 4. Only now execute the actual trade / transfer
```

The `--min-confidence` flag (default 60) auto-rejects any APPROVE verdict below the threshold. Set higher for high-value transactions.

## Step 4 — Agent preparation templates

For `--input-file`, use this structure:

```text
Source URL: <original page or explorer URL>
Decision goal: <exact decision request>
Context label: <short label>

Collected facts:
- Fact 1
- Fact 2

Numeric observations:
- <value> — <context>

Rules / conditions:
- Rule 1
- Rule 2

Risks already observed by the agent:
- Risk 1

Unknowns:
- Missing item 1
```

Use the bundled file for a copyable version:

`{baseDir}/templates/prepared-decision-template.md`

For `--bundle-file`, use:

`{baseDir}/templates/prepared-bundle-template.json`

## Step 5 — Audit log

Every run automatically appends a record to `~/.trade-audit/audit.jsonl`. Each line is a JSON object:

```json
{
  "timestamp": "2026-04-01T12:00:00+00:00",
  "bundle_hash": "abc123...",
  "output_hash": "def456...",
  "tee_nonce": "...",
  "tee_verified": true,
  "verdict": "APPROVE",
  "confidence": 82,
  "decision_type": "BUY",
  "target": "BTC",
  "decision_goal": "Decide whether to buy BTC",
  "min_confidence_threshold": 60,
  "gate_mode": true
}
```

## Step 6 — Explain the attestation

After the report, add this note:

---

**Reading the hashes in the report**

| Field | Meaning |
|---|---|
| **Bundle Hash** | Hash of the normalized source bundle used as model input |
| **Output Hash** | Hash of the structured decision packet JSON |
| **TEE Nonce** | Hardware attestation proving the run came from an NVIDIA H100 TEE |

To reproduce the decision exactly, rerun the skill on the same saved bundle with the same decision goal. If the bundle is identical, the `Output Hash` should match. The `TEE Nonce` changes on each run because it is bound to that specific execution.

Related Skills

Payroll Compliance Auditor

3891
from openclaw/skills

Run a full payroll audit in under 10 minutes. Catches the errors that cost companies $845 per violation.

Payroll & HR Compliance

Export Compliance & Trade Controls

3891
from openclaw/skills

Analyze products, destinations, and end-users against US export control regulations (EAR, ITAR, OFAC sanctions). Generate classification recommendations, license requirements, and compliance checklists.

Regulatory Compliance

Energy Audit — Commercial Building Assessment

3891
from openclaw/skills

Run a full energy audit for commercial or industrial facilities. Identifies waste, models savings, and generates a prioritized retrofit roadmap with ROI timelines.

Sustainability & Efficiency

Compliance & Audit Readiness Engine

3891
from openclaw/skills

Your AI compliance officer. Guides startups and scale-ups through SOC 2, ISO 27001, GDPR, HIPAA, and PCI DSS — from zero to audit-ready. No consultants needed.

Security

Compliance Audit Generator

3891
from openclaw/skills

Run internal compliance audits against major frameworks without hiring a consultant.

Security

Cloud Cost Optimization Audit

3891
from openclaw/skills

Analyze cloud infrastructure spend across AWS, Azure, and GCP. Identify waste, rightsizing opportunities, and reserved instance savings.

AI Spend Audit

3891
from openclaw/skills

Audit your company's AI spending — find waste, measure ROI, and right-size your tool stack.

AI Safety Audit

3891
from openclaw/skills

Comprehensive AI safety and alignment audit framework for businesses deploying AI agents. Built around the UK AI Security Institute Alignment Project standards (2026), EU AI Act requirements, and NIST AI RMF.

Security

Made-in-China Trade Data Analyst

3891
from openclaw/skills

**Short Description**

SendTradeSignal

3891
from openclaw/skills

A specialized tool for sending quantitative trading signals to the FMZ platform via HTTP API.

Finance & Trading

SX-security-audit

3891
from openclaw/skills

全方位安全审计技能。检查文件权限、环境变量、依赖漏洞、配置文件、网络端口、Git 安全、Shell 安全、macOS 安全、密钥检测等。支持 CLI 参数、JSON 输出、配置文件。当用户要求"安全检查"、"漏洞扫描"、"权限检查"、"安全审计"时使用此技能。

Security

Skill Audit 🔍

3891
from openclaw/skills

扫描 OpenClaw skills 中的安全风险,防止供应链攻击。

Security