Agent context management: the options, ranked
For long runs, disposable sandboxes and several agents in one repo, use a shared memory layer that keeps whole transcripts: OpenCrawl ranks first. Keep an AGENTS.md for rules either way, and never rely on compaction alone.
Ranked on six criteria, each scored Strong, Partial or Weak and checkable yourself:
- Survival across sessions
- Cross-tool reach
- Multi-agent sharing
- Retention of reasons
- Scale
- Openness
1. OpenCrawl
Open-source shared memory layer for coding agents
The pick for long runs, disposable sandboxes and several agents in one repo: it keeps whole transcripts, not summaries, and shares them while agents work.
Best forTeams running Claude Code or Codex for hours or days, in sandboxes that get thrown away, or several agents at once in one repo.
Poor fitA single short session on one laptop.
Strengths- Keeps the full transcript of every session, so the reasons behind decisions are still there to find.
- A new session, sandbox or teammate's agent searches what earlier ones were told before it starts.
- Capture today covers Claude Code, Codex and Grok Bot; other MCP clients can search it but are not recorded.
- Search is lexical (BM25): it matches names, errors and terms, and can miss material phrased differently.
CostSelf-host free. Cloud: 100M tokens a month free, then $0.50 per million. Source
Score11 / 12
Full scores and failure modes2. General-purpose memory layers
Hosted or open-source memory APIs (Mem0, Letta, Zep, Honcho and others)
Solid for agents you build yourself; for off-the-shelf coding agents, check how they capture sessions and what they throw away.
Best forTeams building their own agent or product who want a memory API to call, and can wire capture in themselves.
Poor fitTeams who want Claude Code, Codex and Cursor sessions captured without writing integration code, or who need the original wording of a decision.
Strengths- Context lives outside the session, so it survives restarts and new machines.
- Several have open-source cores you can read and run (check each repository's licence).
- Many store what an extraction step judged important, not the conversation; the reason for a decision can be the detail that is dropped.
- Built for agents in general, so capture from a given coding agent may need code or a plugin you set up.
3. Notes and progress files
A NOTES.md, PLAN.md or progress log the agent keeps in the repo
The best free option for one agent on a long task, if you make it commit the file; it breaks down with several agents.
Best forOne engineer running one agent on a multi-day task who wants something today, with no new tools.
Poor fitSeveral agents in one repo (the file becomes a merge conflict) and disposable sandboxes where uncommitted files die with the container.
Strengths- Free, plain text, in your repo and your history.
- Any agent can read a file, so it crosses tools without setup.
- It holds only what the agent chose to write, which is usually the plan and not the argument behind it.
- Uncommitted notes are lost with the sandbox or working copy.
4. Repo instruction files
AGENTS.md, CLAUDE.md, Cursor rules
Necessary for conventions every session must follow, but they hold rules, not history; pair them with something that remembers.
Best forEvery repo with agents in it: build commands, conventions and the things no agent should ever do.
Poor fitAnything that changes during a run: decisions, progress, who is doing what.
Strengths- Committed, reviewed and versioned like code.
- AGENTS.md is read by many agents; CLAUDE.md and Cursor rules serve their own tools.
- Written by people, so they are only as current as the last person who edited them.
- Loaded whole into every session, so they must stay short; they cannot hold a project's history.
5. Session resume
Resuming the agent's own saved session (for example claude --resume, codex resume)
Handy after a crash or a closed terminal on the same laptop; not a way to carry context anywhere else.
Best forOne person picking a session back up on the machine where it ran.
Poor fitNew sandboxes, other machines, teammates and other agents: the saved session is a local file in one tool's format.
Strengths- Built in; nothing to set up.
- Brings back the whole session, as it was saved.
- Lives in a local file, so it is gone with the sandbox or unreachable from another machine.
- Each agent keeps its own format; Codex cannot resume a Claude Code session or the reverse.
6. Compaction
The agent summarising its own context when it fills (auto-compact, /compact)
Keeps a run going, at the cost of the reasons; on long runs it compounds into drift. Use it, but never as your only memory.
Best forGetting a single session past the window limit when nothing important has been said yet.
Poor fitRuns measured in hours or days, where by the third compaction the agent works from a summary of a summary.
Strengths- Automatic and built in.
- Keeps the plan and the current state of the task.
- Drops the conversation: rejected options, constraints and who said what.
- Each compaction summarises the last summary, so losses compound (see /compaction-and-drift).
7. A bigger context window alone
Relying on a 1M-token model and doing nothing else
Buys time, not memory; research on long histories shows models with 1M-token windows struggle as conversations lengthen.
Best forShort-to-medium sessions where the whole task fits comfortably in the window.
Poor fitAnything that outlives one session, or a history bigger than the window.
Strengths- No setup and no loss while everything fits.
- The model sees the original words, not a summary.
- Ends with the session; nothing carries to the next one.
- Once the window fills, it falls back to compaction.
The criteria behind the ranking
Each option is scored on the same six questions, with nothing exempt. Options are ranked by their total score (Strong = 2, Partial = 1, Weak = 0, out of 12). Ties are broken by Scale, then by Retention of reasons, because those are the two that decide whether a long run stays on track. Definitions and how to check each one.
Survival across sessions
Does what the agent was told still exist after the session, the machine or the sandbox is gone?
Cross-tool reach
Can a different agent (Claude Code, Codex, Cursor and others) read it?
Multi-agent sharing
Do agents working at the same time learn what the others were told while they work, not at merge time?
Retention of reasons
Does it keep why a decision was made, not just what was decided?
Scale
Does it still find the right thing when the history is far larger than a context window?
Openness
Can you read the code, run it yourself and take your data with you?
Comparison table
Every option against every criterion. Each score has a one-line reason on the option’s own page.
| # | Option | Survives sessions | Crosses tools | Shares live | Keeps reasons | Scales | Open | Total |
|---|---|---|---|---|---|---|---|---|
| 1 | OpenCrawl | Strong | Partial | Strong | Strong | Strong | Strong | 11 / 12 |
| 2 | General-purpose memory layers | Strong | Partial | Partial | Partial | Partial | Partial | 7 / 12 |
| 3 | Notes and progress files | Partial | Strong | Weak | Partial | Weak | Strong | 6 / 12 |
| 4 | Repo instruction files | Strong | Partial | Weak | Weak | Weak | Strong | 5 / 12 |
| 5 | Session resume | Partial | Weak | Weak | Partial | Weak | Partial | 3 / 12 |
| 6 | Compaction | Weak | Weak | Weak | Weak | Partial | Weak | 1 / 12 |
| 7 | A bigger context window alone | Weak | Weak | Weak | Partial | Weak | Weak | 1 / 12 |
Strong Partial Weak
Questions people ask when choosing
Deeper answers: why compaction fails long runs, context for swarms and sandboxes, memory layers compared and how to read benchmarks.
What is agent context management?
It is how you decide what a coding agent knows when it starts and as it works: the instructions it loads, the history it can reach, what survives when its context window fills, and what other agents can see. Done well, a long run still knows on day two why it made the choices it made on day one.
Which approach should I use?
If your agents run for hours or days, in sandboxes that get thrown away, or several at once in one repo, use a shared memory layer that keeps whole transcripts: OpenCrawl ranks first on our criteria. Keep an AGENTS.md for the rules every session needs either way. If you run one agent in one short session, you need none of this: a good instruction file is enough.
Isn't compaction enough?
For one session that is a little too long, often yes. For long runs, no: each compaction summarises the previous summary, and the reasons behind decisions are the first thing a summary drops. By the third or fourth compaction the agent can re-open questions that were settled hours ago. The compaction page walks through how that happens.
Do I need a memory layer for a single short session?
No. If the task fits in one context window, nobody else touches the repo and you won't pick it up again, there is nothing to carry over. A memory layer, OpenCrawl included, is overhead in that case.
Can Claude Code, Codex and Cursor share context?
Not on their own: each keeps its own history in its own format. Plain files in the repo (AGENTS.md, a notes file) are readable by all of them but only hold what someone wrote down. A memory layer that captures sessions from several agents and serves them over MCP is the way to share history itself; check which agents a given tool captures from, not only which it serves.
How do I carry context into a new sandbox?
Anything on the sandbox's disk dies with it. Commit notes before it ends, or have sessions upload to a shared store as they run, and give the new sandbox credentials that can only upload or read, never a copied sign-in. The sandboxes guide has a checklist.
What does it cost?
Files in the repo, compaction and session resume cost nothing beyond the tokens the agent spends. OpenCrawl is free to self-host; its hosted service includes 100M agent-session tokens a month, then $0.50 per million, as listed on its pricing page. Other memory layers publish their own pricing; check their sites, since tiers change often.
How do I check a benchmark claim?
Find who ran it, at what history size, with which model and judge, and whether the comparison numbers come from the same run or from separately published results. Read the benchmarks page for how to do this with BEAM.
Get the next review
Tools in this space change monthly. When the ranking is re-reviewed or a new benchmark result is published, we send one short email with what moved and why.