Reading Agents Like Trees
Scores tell you who won. They don’t tell you that one agent spent twenty minutes rerunning a failing test without reading the error. How I draw what coding agents do with their time, their reasoning, their memory and their context.
I run Codex and Claude on the same coding task in a small terminal tool, Duo, and record every step. The judges’ scores were easy to read and nearly useless, so I rebuilt the viewer around one question: what did each agent do with its time, its reasoning and its memory?
- 1A tree per run: trunk = time, branches = tool calls, fruit = checks, roots = memory carried in. Loops, stalls and root causes are marked on it.
- 2Reasoning, memory and context: when it thinks, what it re-reads, and what fills its context window, by source.
- 3RL environments: the same pictures for rollouts, with rewards as fruit, pass^k for reliability, and reward hacking flagged on the exact step.
- 4Honesty rules: one turn is never “high confidence”, a root cause is a hypothesis until a rerun confirms it, and a trend only counts if it passes a corrected significance test.
| View | The question it answers | What it shows |
|---|---|---|
| Verdict card | Who won, why, at what cost, and how sure are we? | Five evidence-backed lines; root cause stays a hypothesis until a rerun confirms it |
| Tree | What shape did each run take? | Loops, stalls, failed and repeated calls, checks, root cause, first divergence, memory carried in |
| Long run | Where did an hour-long run go wrong? | Self-calibrated bursts, progress, regressions, the longest loop and stall, where to look first |
| Reasoning, memory & context | When does it think, what does it re-read, what fills its context? | Thought-before-action, failures reasoned about, re-reads, context by source, measured context |
| Attribution | Which model wrote which part of the final answer? | Per-sentence source: Codex, Claude, both, or new wording |
| Conversation memory | What does each chat turn still remember? | Earlier turns carried in, and how much |
| Rewards & rollouts | How reliably does a policy solve a task in an environment? | Reward curves per episode, success rate with and without flagged episodes, pass@k and pass^k, where reward comes from |
| Over time | Is either model changing? | Trends and recent shifts that survive a corrected significance test |
About the screenshots. Every screenshot below comes from a synthetic demo trace I generated to show the views: a planted retry loop, invented tool outputs, made-up scores. The numbers in the pictures are illustrations, not measurements of Codex or Claude.
1. Start with five lines
Before any chart, the page opens on a verdict card. It answers the first five questions anyone asks about a comparison: who won, why, what it cost, what to change, and how sure we are. Several of these ideas come from AgentDiff, my earlier tool for diffing two agent runs.
Two rules keep it honest. First, every line restates evidence already in the trace (the judges’ verdicts, the root-cause step, token usage), and a line with nothing to say is left out. Second, confidence uses one vocabulary everywhere. One turn is one observation, so it can never be “high”. And the root cause is a hypothesis until a rerun with the suggested fix actually changes the outcome (duo --fork TURN).
2. The run as a tree
The main view grows each run as a tree on a shared start line, so you compare shapes before you read numbers.
- Trunk = run time, with idle stretches pinched. Girth = how busy the agent was with tools.
- Branches = tool calls, coloured by phase: inspect, plan, edit, verify, run. Failed calls, and repeats of a call that already succeeded, are withered (dashed).
- Fruit = tests and checks. Green passes and red fails, and the fruit is bigger when a check newly passes. That is the only thing the tree counts as progress.
- Bark bands under the trunk show each burst of work as progress, loop, failing or quiet.
- An amber vine wraps the trunk where the agent went in circles. A bracket marks the longest stall, and a pin marks where to look first.
- A red ring marks the judges’ root cause. A dashed graft line joins the two trunks where the runs first stopped doing the same thing.
- Roots are long-term memory: one strand per playbook lesson the agent was given, plus one for the earlier conversation it carried in. The canopy is the judge score.
3. Long runs, at the scale they ran
A run that lasts an hour is mostly idle time punctuated by bursts of calls, and its loops last bursts, not steps. Drawn step by step, a three-hour run gets the same width as a three-minute one, and the loop that cost you the evening vanishes. So each run is also read at the scale it ran.
- Bursts are split by a gap the run sets itself: Otsu’s threshold on the log of the gaps between calls, clamped to 20 s–30 min. Idle of 30 minutes or more starts a new session.
- Progress is a check passing where its previous run did not, or passing more cases than ever. An edit is not progress. A check failing after it passed is a regression.
- A loop is two or more bursts in a row that each repeat at least 60% of earlier calls without progress. The stall is the longest stretch with no progress. Look first is the start of the longest loop, else of a long stall, else the first regression.
4. Reasoning, memory and context
This is the view I use most. Each model gets one card.
Reasoning rises above the action line as bars, with height showing length. A green ↺ marks a failure the model thought about before acting again. A red ! marks one where it just acted again.
Memory hangs below the line as arcs that join repeat touches of the same file or search. Orange arcs are read → edit and green arcs are edit → check. Amber arcs are re-reads with nothing changed in between: the agent looked again at something it had already seen, which usually means the earlier read fell out of working memory or wasn’t trusted.
Context is the chart underneath: what the model is holding as the run goes on, stacked by source. The sources are the request and lessons, carried conversation, tool output, and its own reasoning. Circles mark the largest single outputs. The stack is an estimate (characters ÷ 4). When the log records the real input size of each model call, as Claude Code logs do, the measured context is drawn as a line on top. On a real Claude Code session I imported, the measured line sat several times above the estimate. Most of that context was conversation and earlier tool results being carried forward, which the estimate cannot see. That gap is the reason to prefer the measured line whenever a log has it.
5. Who said what
For ordinary questions, Duo asks both models and then writes one combined answer. Attribution splits that answer into sentences and labels each one Codex, Claude, both, or new wording, using overlapping word sequences.
It is deliberately simple, and a paraphrase reads as “new wording”. But it immediately shows when a combined answer is really one model’s answer in a new coat of paint. It also flags the sentences only the synthesis step introduced, and those are the ones nobody’s answer supports.
6. Chat sessions and single agents
The same views work outside Duo. duo --import-chat reads claude.ai and ChatGPT exports, and duo --import-session reads Claude Code and Codex CLI session logs. When only one agent ran, the comparison panels step aside. For chats, the interesting picture is conversation memory:
A chat app sends the whole conversation every time, so the triangle fills in and the bar grows on every turn. Duo keeps only the last ten turns, so its triangle becomes a band and the oldest turns visibly fall out. When a model “forgets” something you said early on, this view tells you whether it was even still in memory.
7. RL environments
An RL rollout has the same skeleton as an agent turn (actions, observations, a final outcome), plus a reward on every step and many episodes per task. duo --import-rollouts reads episodes as JSON or JSONL, and every view above applies. On the tree, step rewards become fruit (green for positive, red for negative, sized by magnitude) and the canopy shows the episode’s return.
Three things this view is built to make hard to miss:
- Reliability, not capability. pass@k asks whether at least one of k attempts succeeds; pass^k asks whether all of them do. A policy that solves a task half the time has pass@8 near 100% and pass^8 near 0%, and only the second number tells you whether you can leave it running.
- Reward hacking at the step. The same detector that watches live agents runs on every imported episode: edits to tests or graders, added skips, removed asserts. A flagged episode is drawn dashed with ⚠, its offending call is marked on the tree, and the success rate is shown both with and without it.
- Where reward comes from. Reward summed by action shows whether the policy is earning its return from the work or from one lucky step.
8. Over time, honestly
Single turns are anecdotes. The last view reads every stored session and asks whether either model is changing: getting slower, scoring lower, failing more tools.
Draw a rolling average and the eye will always find a trend. So a change is stated only when it passes a test:
- Mann–Kendall for a trend over turns, with a Theil–Sen slope.
- Mann–Whitney for the last ten turns versus everything before.
- A first-half versus second-half comparison for head-to-head drift.
Every test in the view is corrected together with Benjamini–Hochberg. Each model needs at least eight turns and a change must reach q < 0.05; otherwise the page says “no clear change” and shows n. That is a result, not a gap. This is the piece that becomes a regression alarm when a vendor ships a new model version and your agent quietly gets slower.
9. What I think this is for
As agents move from minutes to hours to days, the question shifts from “can it do this?” to “can I leave it alone?” Answering that takes the things these views measure:
- Reliability across repeated runs, not one lucky success.
- Proof that what an agent claims matches what it did.
- Loops and stalls caught before they burn a night of compute.
- Drift noticed when the model underneath changes.
- A clear picture of where the context window goes.
My bet is that human oversight doesn’t disappear but moves up a level: from approving every action to setting rules, auditing samples and reading pictures like these. An agent should earn autonomy one task type at a time, from measured evidence, and lose it automatically when that evidence turns.
Try it
Everything runs locally. Traces live in a SQLite file on your machine, and imports send nothing anywhere.
duo # Codex + Claude side by side; prints the viewer URL
duo --import-session ~/.claude/projects/<project>/<session>.jsonl
duo --import-chat conversations.json # claude.ai or ChatGPT export
python3 tools/serve_viewer.py # the viewer over every stored session
Sources
Duo: Codex and Claude side by side in one terminal, github.com/sugeerth/duo. AgentDiff, github.com/sugeerth/Agenttracing.
N. Otsu (1979), a threshold selection method from gray-level histograms, IEEE Trans. Systems, Man, and Cybernetics. H. B. Mann (1945), nonparametric tests against trend, Econometrica; M. G. Kendall (1975), Rank Correlation Methods. H. Theil (1950) and P. K. Sen (1968), the Theil–Sen estimator. H. B. Mann and D. R. Whitney (1947), Annals of Mathematical Statistics. Y. Benjamini and Y. Hochberg (1995), controlling the false discovery rate, JRSS-B.