Axiom Lift

Claude Code · Codex · OpenCode · compaction

Your agent forgot what was agreed after compaction. Here's how to fix it

Real reports from the Claude Code, Codex and OpenCode trackers, why compaction drops decisions and progress, the steps that fix it today, and what those steps don't cover.

30 September 2026

A timeline: a decision made in chat, then a compaction, then the decision gone

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

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

Re-readthe project-root CLAUDE.md, rules without a paths: filter, auto memory, and the plan written in plan mode
Partialup to five recently modified files it had read, and invoked skills, capped at 5,000 tokens each and 25,000 in total
Summarisedcontext added by earlier hooks, and anything said only in conversation
On re-readnested CLAUDE.md files and path-scoped rules come back only when a matching file is read again

Codex 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.

Two lanes through a compaction: files on disk are re-read; what lived only in chat goes through the summary
Files on disk are re-read after a compaction. Decisions, reasons and progress that lived only in the conversation depend on the summary.

How to fix it today

These steps use only documented features. Each moves something that matters out of the conversation and onto disk.

  1. 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 a paths: 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, use AGENTS.md in the repository root or ~/.codex/AGENTS.md; Codex builds its instructions from it when it starts (Codex AGENTS.md guide). OpenCode includes AGENTS.md in the model's context (OpenCode rules).

  2. 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.md or AGENTS.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
  3. Re-inject the file after every compaction (Claude Code)

    A SessionStart hook with the compact matcher 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" }] }
        ]
      }
    }
  4. 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
  5. Compact at a natural break, not mid-task

    In Claude Code, /autocompact with a token count sets how full the window gets before the automatic pass, /clear starts fresh between unrelated tasks, and sub-agents keep large reads out of the main context. In Codex and OpenCode, run /compact yourself when a piece of work is finished (in OpenCode also /summarize, or ctrl+x c).

What the fix doesn't cover

The conversation itself stays hard to reach

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.

Three stages: every line saved before and at compaction, decisions filed with their reasons, and what is true now handed back to the next session
What Axiom keeps through a compaction, and what the AI gets back afterwards.

The free fix

  • Rules in CLAUDE.md or AGENTS.md, re-read after the summary
  • A PROGRESS.md the 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.

Keep every decision through every compaction

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.