Inspiration
When several coding agents work on one problem, they share what they learn in markdown notes. One agent writes "the parser is fixed". Nothing checks that line. When the code changes, the note stays the same, and the next agent builds on it. The more agents you add, the more stale notes they trust.
Termites build mounds taller than a person with no plan. Each one reads what the others left and adds to it. That only works because what they leave is real. I wanted the same thing for agents: a shared record where every entry is something that was measured, and where an entry changes when the thing it measured changes.
What it does
Witness is a shared record for a team of AI agents. An agent cannot write an answer into it. It can only ask a question. A question has three parts:
- a probe, a small Python script that measures something and prints the numbers;
- the files the probe reads;
- a rule, one Cypher expression over those numbers, such as
$failures = 0 AND $coverage >= 0.9.
The agent sets the rule before the probe runs. Witness runs the probe on only those files, and the rule gives yes or no. A crash or a missing number gives failed, so a broken probe never looks like a real "no".
Each answer records the files it read, by hash. When a file changes, every question that read it runs again. When the file changes back, the old answer comes back.
A goal has one acceptance question, fixed in advance. The goal is complete only while that question answers yes.
The demo is a real session. Five Codex agents recover a flag from an encrypted QR code (a FortID CTF 2026 challenge) in 12 minutes. Two searches fail: 600 and 1,443 phrases, no match. The winning search reads a word list that one of those failed searches saved. You can see that link in the graph, and prove it with one Cypher query in the page.
How I built it
Everything is one Relate graph: Goal, Question, Run and File nodes, with ACCEPTED_BY, NEEDS, REPLACES, OF, READ and SAVED relationships. Relate enforces the schema in schema.cypher.
- Directory store. The hub is the only process that writes, through
bun:ffi. Other processes open the store read-only. - Rules run in Relate. After each run, the hub evaluates the rule on an empty in-memory store that refuses writes. The measurements are the query parameters, so a rule can read numbers and nothing else.
- Relate WASM in the page. The replay page loads the same graph into the browser. Every panel is a Cypher query, and the Query drawer runs yours on a throwaway copy.
- Four readers, one graph. Agents use four MCP tools:
goal,ask,queryandlook. A browser agent can use two WebMCP tools:queryandshow_question.
The stack is Bun and TypeScript for the hub and page, and uv for the probes. I built it with Claude Code and Codex. The demo session was run by five Codex agents through Witness itself.
Challenges
- Connecting to Relate from Bun. Bun blocks the install script of the usual FFI library, so I wrote the binding against Relate's C ABI with
bun:ffi. - Telling "no" from "failed". A probe that crashes has learned nothing. Keeping that apart from a real "no" changed the rule evaluator, the cache and the page.
- Answers that follow their inputs. I never store an answer. The hub works it out from the runs and the files as they are now. That makes re-runs and restores correct, but every view has to derive it the same way.
- Speed in the page. Without the unique-id constraints in the browser copy, each new record scanned a whole label. Adding them fixed it.
What I learned
Failed work is useful when other agents can find it. In the demo, a search that answered "no" supplied half of the answer. In a markdown file, that word list would have been one line that nobody read.
What's next
Paired controls: a "yes" that counts only if a control question that should answer "no" did answer "no".
Built With
- bun
- claude-code
- cypher
- mcp
- neo4j
- python
- relate
- typescript
- uv
- webassembly
- webmcp