clawd-zk-agent
A Clawd agent that drives the on-chain clawd-zk program
(Anchor / Solana). The program provides three primitives:
publish_attestation — nullifier-gated Groth16-verified attestation.
commit_encrypted_state — Groth16-verified commitment to encrypted state.
consume_attestation — Groth16-verified consume (one-shot read).
This skill wraps the low-level @clawd/zk-client SDK and exposes the
four operations a Clawd agent would actually want to call:
| Method |
Purpose |
agent.attestModel({ modelHash, payloadCommitment, proof, context }) |
publish_attestation |
agent.commitEncryptedState({ modelHash, ciphertextCommitment, stateVersion, proof }) |
commit_encrypted_state |
agent.verifyProof({ proof, publicInputs?, … }) |
Off-chain Groth16 sanity check |
agent.computeNullifierFor(secret, context) |
Deterministic 32-byte nullifier |
Plus a deterministic natural-language intent router
(routeIntent(text, agent, ctx)) so any Clawd component (REPL,
MCP tool, Telegram bridge, voice agent) can call this skill with
free-form text and get back a typed { intent, action, args, confidence, rationale } plan.
Quick start (for an LLM calling this skill)
import { ClawdZkAgent, routeIntent, dispatchRoute } from "@clawd/zk-agent";
const agent = await ClawdZkAgent.fromEnv();
// 1. Route the user's request
const route = routeIntent(
"attest this model 0xab12cd34… with my proof.json",
agent,
{ payloadCommitment: "0x" + "ab".repeat(32) },
);
// → { intent: "attest-model", action: "attestModel", confidence: 0.9, ... }
// 2. (Optional) Review the plan with the user
console.log(route.rationale, route.args);
// 3. Dispatch
const result = await dispatchRoute(route, agent);
// → { nullifierHex, publicInputsPackedHex, instruction, signature?, summary }
The router is deterministic and rule-based — no model calls, no
network. It matches verbs in the input text and combines them with
explicit ctx overrides to pick the right action.
Recognised intents
| Verb (regex) |
Routed action |
Required ctx |
attest, attestation, publish, publish_attestation |
attestModel |
modelHash, payloadCommitment, proofPath |
commit, commit_state, encrypted state, ciphertext |
commitEncryptedState |
ciphertextCommitment, stateVersion, proofPath |
verify, check, validate |
verifyProof |
proofPath |
nullifier, derive, compute_nullifier |
computeNullifier |
context |
inspect, config, status, show |
describe |
— |
help, usage, how, what |
help |
— |
If multiple verbs match, the highest-weight one wins. If nothing
matches, the router returns help with confidence 0.1.
CLI
The package also ships a binary clawd-zk-agent with the same verbs
as subcommands. Useful for scripts, CI, and operators.
clawd-zk-agent inspect
clawd-zk-agent attest <modelHash> <payloadCommitment> <proof.json> [--context "…"]
clawd-zk-agent commit <ciphertextCommitment> <stateVersion> <proof.json> [--model <modelHash>]
clawd-zk-agent verify <proof.json>
clawd-zk-agent nullifier "context-tag"
clawd-zk-agent ask "natural language"
The proof JSON shape:
{
"a": "0x…", // 64 bytes
"b": "0x…", // 128 bytes
"c": "0x…", // 64 bytes
"verifyingKey": "0x…" // optional, variable length
}
When NOT to use this skill
- For perpetuals trading → use the
vulcan skill family.
- For real-time voice → use the
voice-call skill family.
- For a generic RPC query (balance, account info, transaction
lookup) → use the
helius skill family.
- For an action that needs the on-chain verifier (the real
pairing check) → drive
clawd-zk directly via the program; this
skill only does off-chain preparation.
Failure modes the agent should surface to the user
CLAWD_ZK_RPC_URL is not set — tell the user to add it to
~/.clawd-code/.env or pass rpcUrl explicitly.
Invalid CLAWD_ZK_PROGRAM_ID: … — the value is not a base58 pubkey
and not a known alias. List the valid aliases
(CLAWDZK_MAINNET / CLAWDZK_DEVNET / CLAWDZK_LOCALNET).
proof.a expected 64 bytes, got 63 — the proof JSON is malformed;
tell the user to re-export from the prover.
nullifier secret must be at least 16 bytes — supply a real key.
Cross-references
- The lower-level SDK is
@clawd/zk-client
(see zk-primitives/client/).
- The Anchor program is at
zk-primitives/programs/clawd-zk/.
- The deep dive (cost model, security assumptions, instruction
layouts) is in
zk-primitives/docs/ARCHITECTURE.md.
- The full agent catalog is at the repo root
AGENTS.md.
- The harness that drives every Clawd agent is
clawd-code/
(Grok-first).
1---2name: clawd-zk-agent3description: Drive the on-chain clawd-zk program (nullifiers, Groth16 proofs, Light Protocol compressed state) from a Clawd agent or REPL. Use when the user wants to attest a model, commit encrypted state, verify a proof, derive a nullifier, or ask a natural-language question that maps to any of those verbs.4when_to_use: |5 Use this skill whenever the request is one of:6 - "attest this model with hash 0xab12… and proof.json"7 - "publish an attestation for my fine-tuned model"8 - "commit this encrypted state blob to clawd-zk"9 - "verify this Groth16 proof against the publish inputs"10 - "derive a nullifier for context foo"11 - "show me the clawd-zk config" / "inspect the zk agent"12 Do NOT use it for: on-chain trading (→ clawd-pump), voice calls13 (→ Hermes voice agent), or generic Solana RPC queries (→ Helius).14inputs:15 - modelHash (optional, hex) — 32-byte model hash for attest intents16 - payloadCommitment (optional, hex) — 32-byte payload commitment for attest17 - ciphertextCommitment (optional, hex) — 32-byte ciphertext commitment for commit18 - stateVersion (optional, number) — version number for commit (default 1)19 - context (optional, string) — domain-separated context tag20 - proofPath (optional, string) — path to a Groth16 proof JSON file21 - proof (optional, Groth16Proof) — inline proof if not loading from disk22outputs:23 - nullifierHex (string) — the derived 32-byte nullifier (hex)24 - publicInputsPackedHex (string) — the canonical 32-byte-per-field public input vector25 - instruction (TransactionInstruction) — ready-to-sign Solana instruction26 - signature (string, optional) — the on-chain tx signature when a signer is attached27 - summary (string) — human-readable summary of the operation28env:29 required: [CLAWD_ZK_RPC_URL]30 optional:31 - CLAWD_ZK_PROGRAM_ID32 - CLAWD_ZK_PHOTON_URL33 - CLAWD_ZK_API_KEY34 - CLAWD_ZK_COMMITMENT35 - CLAWD_ZK_KEYPAIR36 - CLAWD_ZK_NETWORK37metadata:38 source: https://skillmd.com/skills/solizardking/clawd-zk-agent39---4041# clawd-zk-agent4243A Clawd agent that drives the on-chain **clawd-zk** program44(Anchor / Solana). The program provides three primitives:45461. **`publish_attestation`** — nullifier-gated Groth16-verified attestation.472. **`commit_encrypted_state`** — Groth16-verified commitment to encrypted state.483. **`consume_attestation`** — Groth16-verified consume (one-shot read).4950This skill wraps the low-level `@clawd/zk-client` SDK and exposes the51four operations a Clawd agent would actually want to call:5253| Method | Purpose |54|---|---|55| `agent.attestModel({ modelHash, payloadCommitment, proof, context })` | `publish_attestation` |56| `agent.commitEncryptedState({ modelHash, ciphertextCommitment, stateVersion, proof })` | `commit_encrypted_state` |57| `agent.verifyProof({ proof, publicInputs?, … })` | Off-chain Groth16 sanity check |58| `agent.computeNullifierFor(secret, context)` | Deterministic 32-byte nullifier |5960Plus a **deterministic natural-language intent router**61(`routeIntent(text, agent, ctx)`) so any Clawd component (REPL,62MCP tool, Telegram bridge, voice agent) can call this skill with63free-form text and get back a typed `{ intent, action, args,64confidence, rationale }` plan.6566## Quick start (for an LLM calling this skill)6768```ts69import { ClawdZkAgent, routeIntent, dispatchRoute } from "@clawd/zk-agent";7071const agent = await ClawdZkAgent.fromEnv();7273// 1. Route the user's request74const route = routeIntent(75 "attest this model 0xab12cd34… with my proof.json",76 agent,77 { payloadCommitment: "0x" + "ab".repeat(32) },78);79// → { intent: "attest-model", action: "attestModel", confidence: 0.9, ... }8081// 2. (Optional) Review the plan with the user82console.log(route.rationale, route.args);8384// 3. Dispatch85const result = await dispatchRoute(route, agent);86// → { nullifierHex, publicInputsPackedHex, instruction, signature?, summary }87```8889The router is **deterministic and rule-based** — no model calls, no90network. It matches verbs in the input text and combines them with91explicit `ctx` overrides to pick the right action.9293## Recognised intents9495| Verb (regex) | Routed action | Required ctx |96|---|---|---|97| `attest`, `attestation`, `publish`, `publish_attestation` | `attestModel` | `modelHash`, `payloadCommitment`, `proofPath` |98| `commit`, `commit_state`, `encrypted state`, `ciphertext` | `commitEncryptedState` | `ciphertextCommitment`, `stateVersion`, `proofPath` |99| `verify`, `check`, `validate` | `verifyProof` | `proofPath` |100| `nullifier`, `derive`, `compute_nullifier` | `computeNullifier` | `context` |101| `inspect`, `config`, `status`, `show` | `describe` | — |102| `help`, `usage`, `how`, `what` | `help` | — |103104If multiple verbs match, the highest-weight one wins. If nothing105matches, the router returns `help` with confidence 0.1.106107## CLI108109The package also ships a binary `clawd-zk-agent` with the same verbs110as subcommands. Useful for scripts, CI, and operators.111112```bash113clawd-zk-agent inspect114clawd-zk-agent attest <modelHash> <payloadCommitment> <proof.json> [--context "…"]115clawd-zk-agent commit <ciphertextCommitment> <stateVersion> <proof.json> [--model <modelHash>]116clawd-zk-agent verify <proof.json>117clawd-zk-agent nullifier "context-tag"118clawd-zk-agent ask "natural language"119```120121The proof JSON shape:122123```json124{125 "a": "0x…", // 64 bytes126 "b": "0x…", // 128 bytes127 "c": "0x…", // 64 bytes128 "verifyingKey": "0x…" // optional, variable length129}130```131132## When NOT to use this skill133134- For perpetuals trading → use the `vulcan` skill family.135- For real-time voice → use the `voice-call` skill family.136- For a generic RPC query (balance, account info, transaction137 lookup) → use the `helius` skill family.138- For an action that needs the on-chain *verifier* (the real139 pairing check) → drive `clawd-zk` directly via the program; this140 skill only does off-chain preparation.141142## Failure modes the agent should surface to the user143144- `CLAWD_ZK_RPC_URL is not set` — tell the user to add it to145 `~/.clawd-code/.env` or pass `rpcUrl` explicitly.146- `Invalid CLAWD_ZK_PROGRAM_ID: …` — the value is not a base58 pubkey147 and not a known alias. List the valid aliases148 (`CLAWDZK_MAINNET` / `CLAWDZK_DEVNET` / `CLAWDZK_LOCALNET`).149- `proof.a expected 64 bytes, got 63` — the proof JSON is malformed;150 tell the user to re-export from the prover.151- `nullifier secret must be at least 16 bytes` — supply a real key.152153## Cross-references154155- The lower-level SDK is `@clawd/zk-client`156 (see `zk-primitives/client/`).157- The Anchor program is at `zk-primitives/programs/clawd-zk/`.158- The deep dive (cost model, security assumptions, instruction159 layouts) is in `zk-primitives/docs/ARCHITECTURE.md`.160- The full agent catalog is at the repo root `AGENTS.md`.161- The harness that drives every Clawd agent is `clawd-code/`162 (Grok-first).