Skip to content

Repository files navigation

ClawMind

ClawMind runs multi-agent Web3 due diligence and anchors the final report on 0G Chain, so audit results can be checked later instead of silently rewritten.

Live Links

Surface URL
Demo video https://youtu.be/ddJx034yrJw
Live app https://clawmind-puce.vercel.app
Run analysis https://clawmind-puce.vercel.app/analysis
Receipt example https://clawmind-puce.vercel.app/receipt/19
Judge mode https://clawmind-puce.vercel.app/judge
Public stats https://clawmind-puce.vercel.app/stats
Judge API https://clawmind-puce.vercel.app/api/judge
MCP server https://clawmind-mcp.vercel.app/mcp
OpenClaw manifest https://clawmind-puce.vercel.app/api/openclaw/manifest?format=json
0G contract https://chainscan.0g.ai/address/0x24bAAC6720ae5B01A1CC90eCC1C15AFcb903E121
Docs https://clawmind.mintlify.app

Live Proof Snapshot

Current live evidence is exposed at /stats and /api/judge: signed registry writes, recent on-chain analyses, runtime memory growth, critic effectiveness, and MCP usage are all available as public UI and JSON.

Traction

Early usage is visible on the public dashboard and Judge API. Latest observed live stats after the v4 signed-registry migration:

Signal Current evidence
0G Chain registry entries 2 analyses recorded in the current v4 registry
Signed registry writes 100% of current registry metrics are EIP-712 operator verified
Memory index records 29 total memory records after the expanded Web3 seed set
Runtime-generated memory 16 records generated by live analyses
MCP usage 1 signed analysis initiated through the MCP surface
Critic activity 104 challenges across 28 tracked runs

These numbers are intentionally exposed in /stats and /api/judge so judges can verify the project is not a static demo. The dashboard also keeps historical local run metrics, so older critic and memory history can appear next to the current v4 on-chain count.

Problem

DAO contributors, protocol teams, and Web3 investors often review projects through scattered notes, subjective risk calls, and reports that are hard to reproduce later. That makes it difficult to explain why a protocol was approved, rejected, or sent back for more work. ClawMind turns that process into an auditable pipeline: multiple agents analyze the task, a Critic challenges weak assumptions, and the final result is stored with verifiable 0G receipts.

How It Works

flowchart LR
  User[User task] --> Memory[Memory retrieval]
  Memory --> Planner[Planner]
  Planner --> Researcher[Researcher]
  Researcher --> Risk[Risk agent]
  Risk --> Architect[Architect]
  Architect --> Critic[Critic]
  Risk --> Critic
  Researcher --> Critic
  Critic --> Final[Final agent]
  Final --> ReportStorage[Report Storage: 0G report]
  ReportStorage --> Chain[On-chain Registry: EIP-712 + 0G Chain]
  ReportStorage --> MemoryIndex[Memory Index: 0G memory index]
Loading

The OpenClaw cognitive pipeline has 8 steps: memory retrieval, planner, researcher, risk agent, architect, critic, final agent, and memory writer. In the live runtime this is shown as 7 reasoning agents plus 3 proof steps: Report Storage, Memory Index, and On-chain Registry. The Final Agent applies explicit score anchors and critic penalties, so a high-risk custody task can become NO_GO, a mature audited protocol can become GO, and ambiguous protocol evidence can stay INVESTIGATE_MORE.

The Critic is not cosmetic. Its unresolved challenges are counted by severity and reflected in the final report:

Challenge severity Score adjustment
High -15
Medium -7
Low -3

The UI shows how many challenges were raised, how many were resolved, and how the final score changed.

0G Integration

Component Use in ClawMind Proof
0G Compute Routes agent inference through 0G Router using deepseek/deepseek-chat-v3-0324. Judge API: integration.compute.active
0G Storage - reports Stores final report JSON and returns a root hash plus 0g:// URI. In-app decision receipt
0G Storage - memory Stores the persistent memory index used by future runs. Memory index receipt
0G Chain Records task hash, report hash, score, recommendation, storage URI, timestamp, and the EIP-712 operator signature in AnalysisRegistry.sol. Contract 0x24bAAC6720ae5B01A1CC90eCC1C15AFcb903E121
OpenClaw manifest Describes the 8-step cognitive agent pipeline, artifacts, and security policies. /api/openclaw/manifest?format=json

Contract History

The Judge API and production app always point to the current signed registry.

Version Address Status Purpose
v4 current 0x24bAAC6720ae5B01A1CC90eCC1C15AFcb903E121 Active Signed production registry; EIP-712 v4 binds task hash, root hash, score, storage URI, recommendation, and timestamp
v3 0x08a9c275f5d0764a32f9dda4f50ba6f9a828e2b1 Historical Earlier signed registry before expanded typed-data binding
v2 0x01c9d988cbC2c369CB18B952C01a5Da05bF034D2 Historical Earlier open-write registry used before operator authentication
v1 0x8d53153a8a25c81701954eed66154b3ebba8b8c7 Historical Earliest registry prototype

Only the v4 registry is used by /api/judge, /stats, /analysis, and the MCP flow. Production is configured with ZERO_G_ALLOW_LEGACY_REGISTRY_WRITES=false.

Current v4 deployment:

Field Value
Deploy block 34500039
Deploy tx 0xb8c14d110aa5496e4a4d83891bea0ea0670161d92161c58b886c1823a98b9e48
Deployer / first operator 0x9A0C8040A8C6aB9F65F544578b891Fba599799F8

Verification Checklist

Check How to verify
Contract address is consistent Open the 0G explorer link above and compare it with /api/judge and production env.
OpenClaw pipeline is declared Open /api/judge and check integration.openClaw.pipelineSteps: 8.
Runtime proof tail is visible Run /analysis and check the final proof steps: Report Storage, Memory Index, and On-chain Registry.
Scores are calibrated Run the example test tasks and inspect /api/judge for varied scores and recommendations.
Semantic memory is active Open /api/judge and check memory.semanticRetrievalActive: true.
Reports are persisted Run an analysis and check the decision receipt for provider: "0G_STORAGE" and a 0g:// URI.
On-chain anchoring works Run an analysis and open the transaction from the on-chain receipt.
Submitter is authenticated In the on-chain receipt or Judge Mode, check for SIGNED_OPERATOR and a verified operator signature.
Integrity is checkable Compare the report hash in the UI with the hash stored on 0G Chain.
Critic affects the result Run a high-risk custody task and inspect the Adversarial Panel plus final score adjustment.

Example Test Tasks

Use these to check that scoring is not collapsing to one value:

Task Expected result
Review a read-only Web3 analytics dashboard for Uniswap pools. It uses public indexed data only, has no wallet connection, no transaction signing, no custody, no admin keys, and no ability to move funds. GO, score around 75-90
Self-custodial agent that auto-trades user funds with no withdrawal guards and a private key in an env var. NO_GO, score around 10-25
New AMM with novel TWAP oracle, audited by 1 firm, $5M TVL, anonymous team. INVESTIGATE_MORE, score around 35-60
asdf qwerty Refusal or very low score
Upgradeable cross-chain bridge with admin key rotation, delayed oracle fallback, and $20M planned TVL. Edge case requiring investigation

Safety Model

ClawMind reviews Web3 projects; it does not execute transactions, manage user funds, or replace a human security audit. The LLM pipeline produces structured due diligence, while storage receipts and on-chain hashes make the result easier to verify later. Any deployment that touches custody, signing keys, protocol upgrades, or automated execution should still require deterministic policy gates and human approval outside the model.

Limitations

  • ClawMind is a due-diligence aid, not a formal audit or exploit detector.
  • Public task text is weaker than source code, docs, tests, and deployment config.
  • On-chain integrity proves the report hash was recorded; it does not prove the report is correct.
  • If the registry address changes, production must keep ZERO_G_ANALYSIS_REGISTRY_ADDRESS pointed at a signed registry before claiming operator-authenticated writes.

Setup

git clone https://github.com/ILYUTKICK/clawmind.git
cd clawmind
npm install
cp .env.example .env
npm run dev

Required production variables:

ZERO_G_NETWORK=mainnet
ZERO_G_COMPUTE_ENDPOINT=https://router-api.0g.ai/v1/chat/completions
ZERO_G_COMPUTE_API_KEY=your_0g_mainnet_router_api_key
ZERO_G_COMPUTE_MODEL=deepseek/deepseek-chat-v3-0324
ZERO_G_STORAGE_ENABLED=true
ZERO_G_STORAGE_PRIVATE_KEY=your_mainnet_wallet_private_key
ZERO_G_ANALYSIS_REGISTRY_ADDRESS=0x24bAAC6720ae5B01A1CC90eCC1C15AFcb903E121
ZERO_G_ANALYSIS_REGISTRY_DEPLOY_BLOCK=34500039
ZERO_G_ALLOW_LEGACY_REGISTRY_WRITES=false
CLAWMIND_ANALYZE_RATE_LIMIT_SECONDS=60
CLAWMIND_MEMORY_LIMIT=200

Deploy the signed registry after installing Foundry:

git submodule update --init --recursive
node scripts/deploy-registry.mjs

The deployed address should replace ZERO_G_ANALYSIS_REGISTRY_ADDRESS, and ZERO_G_ANALYSIS_REGISTRY_DEPLOY_BLOCK should be set to the deployment block. The deployer wallet is authorized as the first EIP-712 operator.

Docker

Docker runs the Next.js app locally. Live 0G Compute, Storage, Chain, and Redis-backed metrics still require the environment variables above.

docker build -t clawmind .
docker run --env-file .env -p 3000:3000 clawmind

Then open http://localhost:3000.

Verification Commands

npm run ci
npm run ci:mcp
npm run audit:contracts

The main app is checked with ESLint, a production Next.js build, typecheck, unit tests, and Foundry tests. The MCP server has its own lint, typecheck, and build command. The signed registry has Foundry tests in contracts/test/AnalysisRegistry.t.sol, a Slither audit runner, and GitHub Actions coverage in .github/workflows/foundry-tests.yml.

Contract Audit

The v4 signed registry has an internal static-analysis pass documented in docs/audits/analysis-registry-audit-notes.md and docs/audits/analysis-registry-slither.md.

npm run audit:contracts

This runs Slither through uvx, allows only the documented accepted findings, and then runs the Foundry contract tests.

Memory Warm-Up

Use curated runs instead of random prompts when expanding semantic memory. The warm-up script starts one analysis at a time, waits for /api/status completion, then moves to the next task.

npm run warm-memory
npm run warm-memory -- --limit 10
npm run warm-memory -- --prod --limit 5

--prod writes through the live app and can spend real 0G Compute, Storage, and Chain resources. Keep batches small when warming production memory. The script waits 65 seconds between tasks by default so it respects the public /api/analyze rate limit.

API

curl https://clawmind-puce.vercel.app/api/judge
curl https://clawmind-puce.vercel.app/api/openclaw/manifest?format=json
curl -X POST https://clawmind-puce.vercel.app/api/analyze \
  -H "Content-Type: application/json" \
  -d '{"task":"Self-custodial agent that auto-trades user funds with no withdrawal guards and a private key in an env var."}'
Endpoint Purpose
POST /api/analyze Runs 7 reasoning agents plus report storage, memory index, and on-chain registry proof steps.
GET /api/judge Returns judge-ready proof: contract, pipeline, memory, and recent analyses.
GET /receipt/[analysisId] Shows a public proof page for a signed on-chain analysis receipt.
GET /api/openclaw/manifest Returns the OpenClaw manifest as YAML.
GET /api/openclaw/manifest?format=json Returns parsed manifest plus live 0G evidence.
POST /api/report/retrieve Retrieves a report by 0g:// URI or root hash.

MCP Server

ClawMind also runs as a remote MCP server for Claude Desktop, Cursor, and other MCP-compatible clients.

MCP requests require X-MCP-Client-Id; tool calls are rate-limited to one request per 60 seconds per client.

{
  "mcpServers": {
    "clawmind": {
      "url": "https://clawmind-mcp.vercel.app/mcp",
      "headers": {
        "X-MCP-Client-Id": "demo-client"
      }
    }
  }
}

Tools:

Tool Purpose
analyze_web3_project(task) Runs the same signed ClawMind analysis with 7 reasoning agents and 3 proof steps.
get_recent_analyses(limit) Reads recent signed analyses from /api/judge.

Project Structure

app/
  api/analyze/route.ts
  api/judge/route.ts
  api/openclaw/manifest/route.ts
  judge/page.tsx
  receipt/[analysisId]/page.tsx
components/
  AdversarialPanel.tsx
  AgentPipeline.tsx
  IntegrityPanel.tsx
  ReportView.tsx
contracts/
  AnalysisRegistry.sol
  test/AnalysisRegistry.t.sol
lib/
  agents/
  compute/
  contracts/
  embeddings/
  orchestrator/
  storage/
Dockerfile
DEMO_SCRIPT.md
openclaw.yaml

Releases

Packages

Contributors

Languages