When a long session fills the context window, Claude Code, Codex and OpenCode replace the conversation with a summary so the work can carry on. All three issue trackers have recent reports of the same failure: after the summary, the agent loses track of what was agreed and what was already done.
The issue, as reported
The most-supported report on the Codex tracker this summer, open since 17 August with 7 reactions and 9 comments, describes a read-only audit that Codex had already done coming back after compaction as its next step. The summary kept the text of the plan but not which steps were finished, and other users have since added their own reproductions.
A second Codex report, open since 24 July with 6 reactions, describes a loop: after each automatic compaction the agent kept the broad goal, lost its progress, re-read the same files and compacted again before finishing the edit. The reporter estimates it used 10-15% of their paid usage. Another user reported the same pattern a month later.
On the Claude Code tracker, one open report describes an agent that wrote backup files, then, after a mid-session compaction, could not find them and treated the work as never done; comments were still arriving on 23 September. A report opened that same day says that after continuing from a summary, the model stopped following rules from its instruction and memory files and re-derived, wrongly, an answer that was already written down. Its central complaint: nothing tells you a compaction happened.
OpenCode has the same shape in its own words: a repeated /compact can leave work that is already finished listed under the summary's "Next Move", which a second user has confirmed from a real session.
Reported in
- A completed plan comes back as active work after compaction
- Auto-compaction loop that loses progress and re-reads the same files
- The agent forgets actions it took earlier in the same session
- Instructions lost across compaction with no signal to the user
- A repeated /compact keeps finished work under "Next Move"
Why it happens
Claude Code's documentation is direct about the cost: "Your requests and key code snippets are preserved; detailed instructions from early in the conversation may be lost" (How Claude Code works).
What matters is what comes back afterwards. Claude Code's What survives compaction table lists it:
What survives a compaction in Claude Code
CLAUDE.md, rules without a paths: filter, auto memory, and the plan written in plan modeCLAUDE.md files and path-scoped rules come back only when a matching file is read againCodex works the same way in principle. Its /compact "replaces earlier turns with a concise summary, freeing context while keeping critical details" (Codex commands), and OpenAI's API guide describes its compaction item as "opaque and not intended to be human-interpretable" (OpenAI compaction guide), so you can't always read what was kept. OpenCode compacts automatically when the context is full, by default (OpenCode config).
So: files on disk come back; anything that exists only in the conversation depends on the summary. Decisions made in chat, rules given in chat, and which steps are finished all live there. That is what the reports above lost.

How to fix it today
These steps use only documented features. Each moves something that matters out of the conversation and onto disk.
- Put standing rules in the instruction file, not in chat
In Claude Code, write rules in the project-root
CLAUDE.md, which is re-read after every compaction. If a rule has apaths:filter and must persist, drop the filter or move it to the root file. Keep the file under 200 lines, as the memory docs recommend. In Codex, useAGENTS.mdin the repository root or~/.codex/AGENTS.md; Codex builds its instructions from it when it starts (Codex AGENTS.md guide). OpenCode includesAGENTS.mdin the model's context (OpenCode rules). - Keep decisions and progress in a file the agent updates
Decisions and progress change during the session, so give them a file of their own. Then add one instruction to
CLAUDE.mdorAGENTS.md: "Keep PROGRESS.md current. Add each decision with its reason when it is made, and move each step to Done when it is finished. After a compaction, read PROGRESS.md before doing anything else." The file:# PROGRESS.md ## Goal ## Decided (one line each, with the reason) ## Done ## Next - Re-inject the file after every compaction (Claude Code)
A
SessionStarthook with thecompactmatcher runs after each compaction, and whatever the command prints is added to the context (hooks guide). In Codex and OpenCode, make "read PROGRESS.md" your first message after a compaction. In Claude Code, in.claude/settings.json:{ "hooks": { "SessionStart": [ { "matcher": "compact", "hooks": [{ "type": "command", "command": "cat PROGRESS.md" }] } ] } } - Tell the summary what to keep
In Claude Code, compact by hand with a focus, or add a "Compact Instructions" section to
CLAUDE.md:/compact keep decisions with reasons, finished steps and the next step - Compact at a natural break, not mid-task
In Claude Code,
/autocompactwith a token count sets how full the window gets before the automatic pass,/clearstarts fresh between unrelated tasks, and sub-agents keep large reads out of the main context. In Codex and OpenCode, run/compactyourself when a piece of work is finished (in OpenCode also/summarize, or ctrl+x c).
What the fix doesn't cover
- The file is only as good as its last update. If the agent forgets to write a decision down, there is nothing to hand back, and it forgets most in the long sessions where compaction happens.
- The reasons rarely make it. A one-line entry records the choice. The discussion of why, and what was ruled out, usually doesn't make it into the file, so the question gets reopened later.
- Rules are context, not enforcement. Claude Code's memory docs say its instruction files are treated "as context, not enforced configuration". One of the reports above involves rules that lived in files and still weren't followed after the summary. To block an action outright, the docs point to a
PreToolUsehook.
The hook is Claude Code only, and nothing here makes the earlier conversation searchable when you need the detail the file left out.
How Axiom Lift solves it
Axiom Lift keeps the part the summary throws away, without anyone keeping a file. A small helper on your computer reads the conversations Claude Code, Codex and OpenCode already save. It has saved every line before a compaction, and captures again at the moment of compaction, so the full conversation stays in your account, searchable, with the requirements, decisions and corrections picked out automatically. There is nothing to tag and nothing to write up.
After the summary, or in the next session, the AI asks Axiom over a read-only MCP connection what was decided and why, and gets back the few lines that are true now rather than the whole history. Before each prompt, Axiom also adds a few lines about what is already decided on that subject. Because every prompt and result is kept, a question like "did we already write the backups?" has an answer to look up. If you change your mind, the old decision is struck through, not erased.

The free fix
- Rules in
CLAUDE.mdorAGENTS.md, re-read after the summary - A
PROGRESS.mdthe agent has to remember to update - One-line decisions; the reasons rarely make it
- The re-inject hook is Claude Code only
- The earlier conversation is not searchable
With Axiom
- Every line saved before and at the moment of compaction
- Decisions and their reasons picked out automatically; nothing to write up
- A changed mind is struck through, not erased
- Claude Code, Codex and OpenCode, over read-only MCP
- The full conversation searchable; the next session gets what is true now
What it doesn't do: it doesn't stop compaction, change what your tool's summary keeps, make a model follow a rule, or steer an agent that is looping inside one run. Keep your rules in CLAUDE.md or AGENTS.md; Axiom looks after the decisions and history around them.
One command in the terminal where you use Claude Code, Codex or OpenCode. Free, no card.
Try it free →Claude, Codex and OpenCode are trademarks of their owners; Axiom works alongside them and is not affiliated.
