Skip to content
QORECHAIN
Register

Post-Quantum AI Agents

Leash

Give your AI agent a leash a quantum computer can't loosen: a classical key can only stop things.

Share on X

About

Give your AI agent a leash a quantum computer can't loosen. An AI agent that pays or trades holds a key, and today that key is classical; a limit means nothing if the same key can raise it. Leash splits the power across three keys. The agent's key spends and acts only inside a mandate: caps, a recipient allowlist, an expiry, and owner-signed routes with rate floors. The owner's classical key can only freeze. The owner's ML-DSA-87 key signs every mandate, and QoreChain's pqcVerify precompile checks the signature on chain, so starting or loosening anything is something a leaked or quantum-broken classical key can never do. What it does: the agent pays, swaps, wraps and uses ERC-4626 vaults through a guard contract that measures what it actually received and enforces the owner's rate floor. The owner describes the leash in plain English and a deterministic compiler (not a model) turns it into a mandate and lists the gaps the chain does not cover. An MCP server with 15 tools and a skill let Hermes Agent, Claude Code and Cursor use it, and a monitor can freeze the guard with a stop-only key. Proof, not promises: on qorechain-diana a real ML-DSA-87 signature was accepted by pqcVerify, five adapter actions and an MCP swap ran as real transactions, the Q-Day drill passed 15 of 15, 800 random hostile calls on the live guard produced 0 violations, and the tests caught 179 of 181 deliberate contract breaks. Verify it yourself with one read-only command (pnpm verify, 22 checks) or in your browser at leash.kierkegaard.space/try. Honest limits: testnet only (pqcVerify is not on mainnet yet), unaudited, our own test router because QoreSwap's address is not published, no price oracle behind rate floors, and no bridging.

How it's made

Architecture (Solidity 0.8.28, Foundry). LeashGuard.sol (v1) handles payments: spend() is agent-only and enforces the recipient allowlist, per-payment cap, a fixed 24-hour daily bucket and the expiry; freeze() is callable by the owner's secp256k1 key or the agent and can only reduce power; applyMandate(mandate, signature) is the only way to start or loosen anything: it reads the owner's registered key with pqcKeyStatus (0x0a02), verifies the ML-DSA-87 signature with pqcVerify (0x0a01) over abi.encodePacked(domain, chainid, guard, nonce, keccak256(mandate)), then increments the nonce, so a signature cannot be replayed on another chain or guard, reused or altered. LeashGuardV2.sol adds execute(adapter, target, data, value) for swaps, wraps and ERC-4626 vaults along owner-signed routes (adapter, target, tokenIn, tokenOut, minimum output per input). The guard does not trust call data; it measures: the input is charged to the same caps as payments, the output must return to the guard, the guard's balance of the output token must rise by at least amountIn times the rate floor, no other listed token may fall, and approvals are exact and reset to zero. Three stateless adapters decode calls: V2-style routers, WETH-style wrapped native tokens, ERC-4626 vaults. Tooling (TypeScript, viem, @qorechain/sdk, @qorechain/evm): policy.ts is a deterministic plain-English grammar that reads caps and value flows ('swap A for B on 0x.. at no worse than R B per A'), refuses anything it cannot parse exactly and lists gaps; attack.ts and attack-v2.ts are the Q-Day drills; monitor.ts applies rules (unexplained outflow, bursts, expiry, cap burn) and can auto-freeze with a stop-only classical key; the MCP server (15 tools) and a skill let agent harnesses use all of it; testnet.ts registers the ML-DSA-87 keys, opens hybrid-signed scoped EVM windows, deploys, signs and applies mandates and runs the drills. Verification, eight layers (docs/VERIFICATION.md): 79 Foundry tests including fuzz tests and 8 stateful invariants (15,360 random calls each); automated mutation testing of all five contracts (tools/mutate.py): 179 of 181 mutants killed, the two survivors are equivalent changes, and the first round killed only 64.6%, which exposed real gaps we then closed; Slither static analysis with no high-severity findings; an 800-call randomized attack campaign against the live guard with an independent oracle, 0 violations; 30 TypeScript tests; the Q-Day drill (15 of 15 on the real testnet, 16 of 16 locally); pnpm verify, 22 read-only checks including that the deployed bytecode equals the source; and real transactions: a real ML-DSA-87 mandate with routes accepted by pqcVerify, five adapter actions, and an MCP client making a real swap through the guard. What was hard: the EVM lane only admits a registered account with an open window, opening a window advances the nonce, and a scoped window refuses deployment, so ordering matters. Honest limits: on testnet the blocked drill rows are simulated calls; the testnet run uses our own test router and test tokens because QoreSwap's router address is not published; rate floors have no price oracle; the native AMM cannot be called from a contract; bridging is not guarded because no bridge route is live; the guard is not audited.

Timeline

LeashPost-Quantum AI Agents

Pushed 7 commits to main

  • cc80a4d README, AI_USAGE, Apache-2.0 licence, cover image and demo script · noreply
  • c55a0fd Testnet: real ML-DSA-87 mandate accepted by pqcVerify, Q-Day drill 13/13 on qorechain-diana · noreply
  • bec2cab testnet: owner funds the agent so one faucet claim is enough · noreply
  • 035b1b9 Testnet pipeline: accounts, registration, windows, deploy, signed mandate, drill · noreply
  • 477c531 Q-Day drill: attack suite with local end-to-end run, mutation-checked, plus CLI · noreply

and 2 more commits

LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • a56a369 Use the detailed circle-line-square mark (B) for the nav, favicon, README and cover · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • 15e2309 Back to the simple circle-line-square logo; remove the lattice logo and its generator · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • 48051e0 Black by default with a theme toggle, a generated logo, and a matching cover · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • 1cdb460 New landing page: Vercel-style type and context.dev-style bezels, a live in-browser compiler hero, and a shared look for docs · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • 451cedf Fix clean-machine problems found by a fresh-clone test · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • 0f2847f Move the CI workflow out of .github/workflows (account billing lock) and add pnpm ci · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • a7b88ca Verification depth: invariants, automated mutation testing, static analysis, live attack campaign, interactive demo and CI · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • 030465f Docs for judges and auditors, a read-only verify script, and a documentation site · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • 6997dc4 Leash v2: guarded on-chain actions, a value-flow language and monitoring · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • ee9e97d README and AI_USAGE: demo video v2 (voiceover, original music, motion graphics) · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • 81d444d MCP server and agent skill: pay, check, freeze and prepare mandate changes through the guard · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • 2bdd98f AI_USAGE: credit the voiceover model · David Glitc
LeashPost-Quantum AI Agents

Pushed 1 commit to main

  • b28b861 README: link the demo video · David Glitc
LeashPost-Quantum AI Agents

New project.

Comments and questions

  • No comments yet.