Code: https://github.com/tqthinh704/agent-trail (topic relate) · Live viewer: https://tqthinh704.github.io/agent-trail/viewer/ · Store: data/trail.rl (single file, committed)
Inspiration
Teams now run several AI coding agents (Codex, Claude, Copilot) in one repository. Each leaves clean commits and passing checks, yet a reviewer still has to reconstruct which check covered which change, and the next agent starts a task blind. We run that kind of multi-agent setup ourselves and wanted to go from "this file looks risky" to the commit, the agent and the test evidence in a few clicks.
What it does
Agent Trail turns Git history plus JUnit/JSON test reports into a provenance graph stored in one Relate .rl file, then answers five questions with Cypher:
- Unverified agent changes: files last changed by an agent with no later passing test that covers them.
- Blast radius of a file: tasks, agents, tests and co-changed files within N hops.
- Who to ask about a file: humans and agents ranked by recent touches and verifications.
- Handoff brief for the next agent on a task: related files, prior commits, failing tests, last contributor, as compact JSON.
- Agent trust: share of each agent's commits later verified vs. reverted.
Every CLI answer prints the Cypher it ran. A dependency-free SVG viewer highlights the evidence path behind each answer. Agents can call the same queries through a stdio MCP server backed by Relate's read-only mode, and a GitHub Action (agent_trail report --fail-on-unverified) writes the report to the job summary.
How it uses Relate
- Mode: single file (
data/trail.rl). Judges can inspect the committed store, and agents can open it read-only while CI rebuilds it. - Graph:
(:Agent)-[:AUTHORED]->(:Commit)-[:TOUCHES]->(:File),(:Commit)-[:PART_OF]->(:Task),(:Commit)-[:PARENT]->(:Commit),(:TestRun)-[:VERIFIED]->(:Commit),(:TestRun)-[:RECORDED]->(:Result)-[:COVERS]->(:File),(:Result)-[:OF_TEST]->(:Test). - Verification is a graph question: walk
PARENT*0..ancestry from the tested snapshot to the change, then follow the passing result'sCOVERSedge to the file. Ingest usesMERGE, so re-ingest is idempotent.
How we built it
Python reads NUL-delimited git log --numstat records so renames, binary files and merges keep their structure, and parses Co-Authored-By and worker trailers to attribute commits to agents. Parameterized Cypher builds the graph with the relate-db Python package. A deterministic demo repo (3 agents, 1 human, a revert, failing-then-passing tests) is generated by a script so the bundled store is reproducible. 19 pytest tests cover parsing edge cases, idempotent ingest, each query, the MCP handshake and write refusal, and the CI report.
Challenges
A passing test somewhere in the repo is easy to find. Deciding whether it backs a particular change means checking which snapshot ran, how it relates to the change, and which files the passing case covers. We model each result separately so evidence from a newer test or another branch cannot silently inherit the wrong coverage.
What's next
Import measured coverage from CI alongside JUnit, flag conflicting file changes across branches, and post an evidence-backed review brief on pull requests.
Built With
- cypher
- git
- github-actions
- javascript
- mcp
- neo4j
- python
- relate
- svg
