Do agents repeat failures they already solved?
If notes are rarely wrong, maybe the gap is elsewhere: things an agent learned the hard way and never wrote down. A command that only works with a prefix. A config file that is not where you would look. Next week, a new session trips on the same thing.
Inside a single run this is measured. A study of command-line coding agents found that agents which keep repeating one failing approach account for 15% of failed runs and 29% of the wasted steps in them. Across sessions we found stories and no number, so we wrote a small Go tool, repeat-miner, to get one from our own history.
How the counting works
The tool reads the session transcripts Claude Code already keeps on disk. It makes no model calls and prints only counts. Step through three made-up sessions from its test suite to see what it records.
What an earlier session already learned
Nothing yet.
A failure where the very same call works later is normal work, such as fixing code and running the tests again. It is not counted, because a ledger could not have prevented it.
The rule, written down before running it
Of all tool failures, what share had an earlier session in the same project already hit and already solved?
Under 10%Drop the idea
10% to 25%Unclear, read the examples
25% or moreWorth building a ledger
0%10%25%50%
Why it stopped before the run
- It exists. deja-vu, a single program with no model, already answers “what did this machine run after that same error before”, and a second plugin recalls past fixes when a command fails.
- Other people’s numbers are thin. One author hand-labelled 40 of his failed shell commands and found 6 were real mistakes by the agent. Another found the model no longer needed 30 of 35 lessons it had stored.
- The rules. Anthropic’s policy for listed software forbids reading chat history and storing conversation content to change behaviour in later sessions. A ledger does both.
- Our counter was wrong. On the first real transcript the first version found three fixes and all three were wrong. Checked against today’s transcript format, it also counted tool calls twice.
What survived is the half of the question that has a number. Inside one session, repeating a failing approach is measured at 15% of failed runs, and it needs no history at all. That became the loop breaker in the plugin.