Apply to my task
arXiv:2610.36153 ★ 92 Oct 26, 2026

STRATUM: Repository Memory for a Coding Agent — Notes on Bug Causes and Dead Ends That Outlive the Session

Key result

A new agent session starts from zero and walks right back into the dead ends that cost two hours yesterday. STRATUM lets you carry experience across sessions: at the end of its work the agent writes the bug's cause and its failed attempts into a file next to the code, and the next session reads it before searching. The trick: a context window isn't memory, it's a single-run cache. Even a different, weaker model with these notes finds the right file noticeably more often and spends noticeably fewer tokens.

An agent that, at the end of its work, writes down the root cause it found and the approaches that failed into persistent storage next to the code — and a new session (even a different, weaker model) that reads those notes before searching — finds the right file noticeably more often and burns noticeably fewer tokens. STRATUM is a sketch of that kind of memory: a store living next to the repository plus nine tools the agent uses to read and write it. The key idea: a context window is not memory. The window is a single-run cache; memory has to survive between sessions.

The familiar pain: you open a fresh agent session and it starts from scratch. It rereads the same files, walks into the same dead end, and forgets the cause it spent two hours digging up yesterday. The problem isn't that the window is small: no matter how big you make it, it gets wiped along with the session. Code search (RAG, text search) shows you what's in the repo, but it doesn't keep what the agent learned about it and where it already got burned.

The method comes in three moves. In the first session the agent investigates the task and at the end writes two kinds of notes: the root cause (root cause analysis, RCA) and the failed attempts, with an explanation of why they didn't work. The store links the notes to the files they touch. In the second session the agent checks the notes first, so the search starts with a hint.

02

Method Blueprint

STEP 1 (session 1): The agent investigates the task → at the end it writes "root cause (rca)" and "failed attempt (failure)" notes linked to files
STEP 2: Context resets (new session, possibly a different model)
STEP 3 (session 2): The agent searches the repo + reads the notes → reaches the right file faster
STEP 4: Every tool response reports what was returned, how much is left, and what it cost (pagination and budget)
STEP 5: At the end of the task the agent appends new notes again

In the paper this is a code prototype (SQLite, tools exposed over the MCP protocol). But the gist of steps 1–3 works with a plain file of notes and a couple of lines in the agent's instructions.

03

Example Application

First, the boundaries. The method shines where the agent keeps coming back to the same project and where sneaky bugs with non-obvious causes show up. On one-off scripts and small projects that fit entirely in the window, the payoff will be modest.

Task: You run a small Django online store that takes payments through Stripe. On Tuesday Claude Code spent two hours figuring out why payment confirmations sometimes never arrive. Turns out Stripe resends the webhook and the handler isn't idempotent. On Thursday the same thing pops up with FedEx shipping updates, and the new session heads off to check the firewall, nginx and environment variables again — the exact same loop it already walked.

Prompt (at the end of work, session 1):

The task is closed. Before you finish, append two entries to docs/agent-notes.md.

1. ROOT CAUSE (rca): what exactly is broken, in which file and function, how to recognize it, and how it was confirmed.
2. DEAD ENDS (failure): what was checked and didn't pan out; one line per attempt: "checked what — why it missed".

For each entry list the files it concerns and the date. Keep it short and factual, no retelling of how the work went.

Prompt (at the start of a new session):

Before searching the code, read docs/agent-notes.md. Pick the entries that concern the files or symptoms of this task. Tell me which entries you found and which of them you'll use. Don't repeat checks from the "dead ends" section unless there's new data.

Result: In the first session the agent appends two structured entries to the file. In the second session it first lists the notes it found and says which ones it's using, then goes straight to the suspicious files, skipping the dead ends that were already checked.

04

Why It Works

The model's weakness. An agent has no memory between sessions. Everything it figured out stays in the window that's about to close. If you hand it the entire repository up front, it pays for that on every call and still saves nothing.

The strength. An agent reads short notes well and knows how to use them as a hint: "the cause is usually here, don't bother going there". Choosing where to look is the real bottleneck in bug hunting, not the amount of code.

How the method uses this. Notes are the compressed output of an investigation you've already paid for. They're cheap to read and high-value: they narrow the search. The paper's second finding: code structure reveals only half the connections — files that change together often aren't linked by imports. So knowledge of "what breaks together" has to come from history and experience, not just from the code.

Control levers: - What to record: keep the cause and the dead ends; drop the play-by-play of the work, it just bloats the file. - Linking to files → a note is found by location, not by guessing the right keywords. - Date and version → a month later you can tell the entry is stale. - The "don't repeat dead ends without new data" rule → saves attempts, but add a caveat for when the code has changed a lot. - Paged reading: asking the agent to report "what I got, what's left" helps it decide for itself when to stop.

05

Prompt Template

<Role>You are working on the {project} repository. You have a notes log at {log_path}.</Role>

<At_start_of_work>
1. Read the log. Pick the entries related to the files or symptoms of task {task}.
2. Name the entries you found and explain how they change your search plan.
3. Don't repeat checks from the "dead ends" section without new data.
</At_start_of_work>

<At_end_of_work>
Append to the log:
- rca: the cause, file and function, symptoms, how it was confirmed
- failure: what was checked and why it didn't fit, one line per attempt
- files: {file_list}, date: {date}
Facts only. If you're not sure about the cause, mark it "hypothesis".
</At_end_of_work>

<Report>
When reading the log and the code, report: what you got, what's still unread, and what it cost.
</Report>

Fill in {project}, {log_path} (for example, docs/agent-notes.md) and {task}. The "hypothesis" tag is there so that a wrong entry doesn't poison future sessions — the authors call this out as the main risk.

🚀 Quick start — paste into the chat:

Here's a template for an agent notes log. Adapt it to my project: [your project and stack].
Ask me questions to fill in the fields.

[paste the template above]

The LLM will ask where the log lives, which files in your project are the most tangled, and how you separate hypotheses from confirmed facts — because the method rests on tying notes to files and on trusting the entries. It will take the structure from the template and tune the instructions to your repository.

06

Limitations

⚠️ The experiment is small: eight bugs from two libraries, and the answer counted was the name of the file containing the cause. That doesn't prove the same will happen on a new task: in the test the agent re-diagnosed the same symptom rather than solving a new problem.

⚠️ Notes can backfire: a wrong entry poisons the following sessions. The authors flag the risk separately and haven't measured it yet. Content from the web that gets written into memory can carry hidden instructions.

⚠️ Note quality wasn't controlled: the outcome depends on how good the notes are. What happens with sloppy notes wasn't tested.

⚠️ No comparison with a simple summary: a plain recap of the previous session as a baseline wasn't tried. There's no telling how much of the gain comes specifically from the "cause + dead ends" structure.

⚠️ The paper is a sketch: most of the system (eviction management, the nine tools, importance scoring) hasn't been built or tested; the authors call the scoring formula a hypothesis.

07

How They Researched It

The researchers first measured the repositories themselves across six popular projects (Django, Flask, Redis, requests, scikit-learn, Vue core). The result: Django alone takes up 6.2 million tokens — six times more than the largest window. Storing knowledge as indexed text is 10,000–100,000 times cheaper than keeping it inside the model as a cache.

Then they took apart 752 real bug fixes. A typical fix touches two files, and those files together with their direct import neighbors make up 2.7% to 9.9% of the code. Takeaway: the bottleneck isn't volume, it's picking the right part. But 47% of file pairs changed together have no static link at all, meaning half the "map" is invisible if you just parse the code.

The main experiment: Claude Sonnet investigates a bug and writes notes; then a different, smaller model (Claude Haiku) tackles the same symptom from scratch. Without notes it found the file with the cause in 6 of 24 cases; with notes, in 21 of 24, with 4.5 times lower median input-token usage. When 26 notes about different bugs were dumped into the store, the result held at 8 of 8. For comparison, putting the whole repository into the window gave 14 of 16 successes, but a single call cost 3.8 times more than an entire session with memory, and nothing was saved.

The surprise wasn't that notes help, but that one model wrote them and another read them, and it worked. That means the log outlives any session and any model.

08

Adaptations and Extrapolations

🔧 Technique: store dead ends separately → the agent stops going in circles

Keep a "dead ends" section separate from "causes". At the start of a session add: "If you're about to repeat a check from the dead ends section, say what has changed since then."

🔧 Technique: add a "confidence" field → protection against log poisoning

Tag every entry "confirmed / hypothesis". The agent uses hypotheses as hints, not facts, and ranks confirmed entries higher.

Extrapolation to an instructions file (CLAUDE.md): add one line at the end — "Before finishing a task, append the cause and dead ends to docs/agent-notes.md using the template." That way the log keeps growing without you having to nag.

09

Resources

STRATUM: Repository Memory for Coding Agents Beyond the Context Window. Authors: Naser Ezzati-Jivan, Yuvraj Sehgal (Brock University, Canada), Mahsa Panahandeh (University of Ottawa). Replication package: https://doi.org/10.5281/zenodo.23615180. Related work: MemGPT, Model Context Protocol, SWE-bench, the idea of mining co-changed files from version history (Zimmermann et al., 2005).

Research digest

Key result

A new agent session starts from zero and walks right back into the dead ends that cost two hours yesterday. STRATUM lets you carry experience across sessions: at the end of its work the agent writes the bug's cause and its failed attempts into a file next to the code, and the next session reads it before searching. The trick: a context window isn't memory, it's a single-run cache. Even a different, weaker model with these notes finds the right file noticeably more often and spends noticeably fewer tokens.

Principle

Two entries at the end of a task: cause (what's broken, where, how to recognize it, how it was confirmed) and dead ends (what was checked and why it missed). Each is tied to files and a date. It's like the notes from the previous on-call shift: you start your shift and first read where people already looked. At the start of a new session the agent reads the notes before going into the code. Uncertain conclusions get tagged "hypothesis".

Why it works

The hardest part of bug hunting is choosing where to look, not the amount of code. A note is the compressed result of an investigation you've already paid for. It's cheap to read, and it cuts the search: "the cause is usually here, don't go there." Second fact: code reveals only some of the connections. Files that break together often don't import each other. Knowing "what breaks with what" lives in experience, not in the import graph. Caveat: only eight bugs from two libraries were tested, and the agent was hunting the cause of the same symptom, not solving a new task.

When to apply

Development → debugging in a project the agent returns to again and again, especially when bugs are sneaky and the cause isn't obvious (duplicate webhooks, race conditions, environment settings). NOT a fit for one-off scripts and small projects that fit entirely in the window. Careful: a wrong entry poisons future sessions.

Mini recipe

1. Create a file: e.g. docs/agent-notes.md in the project root 2. At the end of a task: ask the agent to append a "cause" entry (what's broken, file, function, symptoms, how it was confirmed) 3. Dead ends separately: one line per attempt, "checked what — why it missed" 4. Tie it to files: list the files and the date in every entry 5. Not sure? Write "hypothesis": otherwise a false cause turns into fact 6. At the start of a new session: read the log first, then go into the code. Name which entries you found and how they change the plan 7. Don't repeat dead ends without new data, but if the code has changed a lot, recheck

Examples

[BAD]: `FedEx delivery confirmations aren't coming through again, look into it` [GOOD]: `Before searching the code, read docs/agent-notes.md. Pick the entries about shipping and webhooks. Tell me which ones you found and how they change the plan. Don't repeat checks from the "dead ends" section unless there's new data.` And at the end of the session: `The task is closed. Append two entries to docs/agent-notes.md. Cause: what's broken, file and function, symptoms, how it was confirmed. Dead ends: one line each, what was checked and why it missed. List the files and the date. Tag anything uncertain as "hypothesis".`

In plain words

Today's AI coders have a fatal flaw: they have zero long-term memory. Every new agent run on a project starts with a blank slate, because everything it understood before goes up in smoke the moment the context window closes. Stuffing the whole repo into the prompt at every step is expensive self-deception: the model drowns in tokens, blows the budget and still remembers nothing for next time.

It's like hiring a sharp junior dev with goldfish memory: every morning they reread the company's entire codebase, spend hours warming up, and by evening completely forget the workarounds they found. Stratum ends the circus — it gives the agent repository memory, turning a one-shot contractor into a teammate with a permanent notebook.

Instead of inflating the context window, the system moves knowledge into an external structure. The agent records architectural links, module logic and edit history, so that on the next request it pulls targeted slices of data instead of digesting the whole project. The model no longer pays in tokens for reading the same code on every call — it goes straight for the target using its old notes.

Naturally, using this everywhere is pointless: for five-line scripts and microservices the gain is zero, since everything fits in the prompt just fine. But on hefty codebases with tons of legacy and nasty bugs, where the agent works for weeks, the method is a must-have. The principle holds for any complex system: accumulated experience always beats dumb brute-force compute.

Bottom line: endlessly widening the context window and paying for thin air is a dead end. Stop wiping the agent's brain after every commit — the future belongs to external structured memory. Whoever adopts it first gets an autonomous senior-level developer, while everyone else keeps burning money rereading the same files in circles.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on STRATUM: Repository Memory for a Coding Agent — Notes on Bug Causes and Dead Ends That Outlive the Session arXiv:2610.36153

Sign in to apply this study New accounts get 50 free credits.