Work
AgentTrace
See where two AI agent runs start behaving differently.
When an agent starts failing after a prompt, model, tool, or code change, the final output rarely tells you what happened. AgentTrace compares two execution traces and takes you to the first observable behavioral difference.
Independent project · React, TypeScript · local-first · MIT · 2026
01 Agent failures are hard to debug
A coding agent succeeds on a task. You change its system prompt and run the same task again. This time it fails.
You now have two long execution traces full of searches, file reads, tool calls, arguments, results, retries, and errors. The final outputs tell you the runs were different. They do not tell you where the execution behavior separated.
AgentTrace gives you a place to start looking.
02 What it does
Working run
- Read file
- Search codebase
- Read config
- Edit file
- Run tests
Changed run
- Read file
- Search codebase
- Read different file first observable difference
- Edit file
- Tests fail
AgentTrace aligns the two trajectories, collapses the behavior that stayed the same, and surfaces the first observable divergence. It compares tool calls, arguments, results, errors, and stopping behavior.
03 Why a normal diff is not enough
Agent runs do not line up event for event. One run searches twice where another searches once. A tool call gets inserted, skipped, or reordered. Matching event 12 in one trace to event 12 in the other stops meaning anything almost immediately.
Ids and timestamps differ on every run too, so a line diff marks nearly every line as changed even when the behavior is identical.
04 The engineering
I modeled each execution as a sequence and built deterministic weighted Needleman-Wunsch alignment to pair behaviorally similar events while leaving gaps where one run inserted or skipped an action. No model in the loop, no embeddings, no randomness.
- Normalization Every source trace becomes one representation with seven step types.
- Behavioral signatures Built only from what was observable. Ids, timestamps, and durations are kept for inspection and never compared. A slower run is not a different run.
- Weighted alignment Candidate pairs score on argument overlap, neighboring steps, and position, so a changed argument reads as a change rather than as a deletion plus an insertion.
- Field-level diffs Once two steps are paired, the comparison drops to individual fields.
- Tri-state tool status Success, failure, or unknown. Producers often omit whether a call succeeded, and unknown is never shown as success.
05 Real-agent validation
Testing on real Claude Code sessions exposed a flaw the synthetic fixtures had not. A model turn that only emits tool calls has no visible output, and every such turn carried the same signature, so a turn that ran one shell command compared as identical to a turn that ran eight searches.
I changed the behavioral signature to incorporate the tools a turn emits, and added regression tests. On the long validation pair:
- Aligned rows
- 63
- Identical rows
- 7 → 1
- Unsupported identical rows
- 7 → 0
- Difference regions
- 7 → 1
Correct pairings, the first observable difference, and existing synthetic fixture behavior were unchanged.
06 Scope
AgentTrace identifies observable behavioral differences between executions. It does not determine why an agent behaved differently or decide which run is correct.
- Claude Code JSONL adapter
- Local-first
- React + TypeScript
- 153 passing tests
- MIT licensed