About
AI agents now move money on their own, and someone has to answer why. Blackbox records every decision an agent makes (what it saw, what it did and its reasoning) and seals it with ML-KEM-1024 to the auditors' encryption keys from QoreChain's on-chain registry. It then anchors the record's hash on QoreChain in a hybrid ML-DSA-87 transaction. Auditors replay the trail in a console that decrypts in the browser and flags any record that was edited, deleted, reordered or skipped. The reasoning stays private, the history stays public, and neither breaks after Q-Day.
How it's made
Blackbox is a flight recorder for AI agents. When an agent does something, like paying an invoice, it writes down what it decided and why. That note is encrypted for the auditors and stored, and its fingerprint goes on QoreChain so nobody can change it later.
How it fits together
It's a pnpm monorepo with three parts:
- packages/recorder: the core library. It defines the record format, encrypts and decrypts records, writes the on-chain anchor and checks a whole trail.
- apps/web: the console and the website. I started it with create-qorechain-dapp (fullstack-web template) and kept that folder. It also holds two small Netlify functions that store encrypted records and auditor cards.
- apps/agent: a demo treasury agent and a CLI. It pays invoices on testnet, holds back when a payment would break its reserve, and records each decision.
What happens on each decision
1. The agent builds a record: intent, reasoning, inputs and the transaction hash of what it did. Each record carries the hash of the one before it, so they form a chain.
2. QoreSeal encrypts it with ML-KEM-1024 (plus X25519) once for each auditor. Before encrypting for an auditor, the agent checks that auditor's recipient card against the keys they registered on chain. The record's agent address and sequence number are bound into the encryption, so a record can't be moved to another place in the trail.
3. The encrypted record is stored under its SHA-256. The store only holds ciphertext and refuses anything that doesn't match its hash.
4. The agent sends 1 uqor to itself with the memo "bbx1:<seq>:<hash>". The QoreChain SDK signs it hybrid (secp256k1 + ML-DSA-87), and the chain shows pqc_hybrid_verify = verified.
5. An auditor opens the console, which reads the anchors from the chain, downloads the records, re-checks every hash and decrypts in the browser. Anything edited, missing, skipped, duplicated or out of order gets flagged by name.
Kits and network features
- QoreChain SDK: hybrid transactions, ensurePqcRegistered (ML-DSA-87 key with proof of possession), and msg.pqc.registerKemKey for the encryption key registry.
- QoreSeal: ML-KEM-1024 envelopes, recipient cards, and checking a recipient against the chain.
- QoreSign: canonical ML-DSA-87 keys, and signing the recipient card.
- QoreX: auditors fund their keyring from the wallet with signAndBroadcast, so that send is hybrid-signed too. The QoreX wallet mock runs in the Playwright tests.
- create-qorechain-dapp: scaffolded the web app.
What was hard
- QoreX can't register an encryption key from a website yet, so auditors get a small keyring in the browser that they fund from QoreX. That keeps the PQ key registration on chain without the wallet doing it.
- The key lookup endpoints return HTTP 200 even when no key exists ({"found": false}). My first version trusted the status code, the live test failed, and I fixed it and added a test.
- Netlify couldn't load the workspace package as raw TypeScript, so I turned the recorder into a properly built package and pre-bundled the functions with esbuild.
- Making a judge see it work in seconds. The demo agent also encrypts for a public demo key (the standard BIP-39 test phrase), so the homepage decrypts the real testnet trail right in the browser. A "Rewrite a record" button flips one byte so you can watch it get caught.
Testing
30 unit tests on the core (including every tamper case), 11 on the store, and 12 Playwright runs in Chrome on desktop and phone using the QoreX wallet mock. On testnet, the demo agent has anchored 6 decisions. The auditor check reports the trail intact, and every anchor carries the hybrid signature.