← All Insights

KN-09 · Load and compaction map

What your agent still knows after a compaction

6 min readGuildBuild Team
AI agentsAgent memoryContext compactionContext engineeringClaude CodeCodexAgent handoffs

Two moments decide what an agent knows: the start of a session, and the moment its context is compacted. Most confusion about "it forgot my instructions" comes from not knowing what each harness reloads at those two moments. We read the docs, then tested where the docs stop.

After /compact, what does your agent keep? KN-09 separates saved information, loaded context and verified use.
Website/share card for KN-09 — Load and compaction map.

Saved, loaded and used

KN-09 overview: saved on disk, loaded into context and used in a task are different states. Root instructions can reload, notes may need retrieval, and compacted messages need verification.
Conceptual map, not a recall benchmark. Storage, loading and correct use are separate checks.

Claude Code: what loads at startup and after compaction

Compaction reduces the conversation carried forward; it does not make every saved file part of the new context. This load map follows Claude Code's memory documentation and compaction breakdown, checked on 14 October 2026.

At start it loads:

  1. Applicable CLAUDE.md files on the directory path, with their imports; nested files load when relevant work reaches them.
  2. The first 200 lines or 25 KB of the MEMORY.md index, whichever comes first, when auto memory is enabled.
  3. Available skill names and descriptions; skills disabled for model invocation are an exception.

After a compaction it reloads from disk:

  1. The project's root CLAUDE.md and its unscoped rules.
  2. The memory index.
  3. The bodies of skills already invoked, capped.
  4. Up to five recently read or edited files; a large file can return as a path reference rather than its contents.

The distinction matters: project-root CLAUDE.md reloads from disk. Nested CLAUDE.md files and path-scoped rules reload on demand, not necessarily immediately after compaction.

In our setup, other notes and reference files were routed through index lines and the model's judgment. That is where we tested.

Does a memory index trigger a file read?

  1. Asked a question, yes. A running seat was sent six questions. It opened the routed file each time, including one whose index line was written after it started. It reads the index from disk.
  2. At start, no. A fresh seat whose index carried an at-every-start section was sent only its name. It opened nothing.
  3. At the first real question, yes again. Given a remark with no keyword from any file, the fresh seat opened three notes whose triggers matched, about 9.5 KB, and placed the remark correctly. A seat started without the index answered the same remark from general knowledge.

In these tests, the index worked at question time, not on a start-only prompt. If something must be read before the first task, do not rely on an index line alone. Use an explicit startup instruction or a tested start hook, and verify the read.

One side effect is worth knowing. After reading a routed note, the seat said "I" about a cost that the note's author had paid, not the seat. A routed read can produce a false first person.

Claude Code loading map and separate field observations: a routed file opened for each of six questions; a start-only prompt opened none; a first task opened three notes, about 9.5 KB.
The load map follows current documentation. The index observations are small tests on three Sonnet 5 seats, not a population recall rate.

Codex: what nine compactions showed about handoffs

We read nine compactions in three chats, on CLI 0.159.2. These are observations from that setup, not a guarantee about every Codex release.

  1. In the observed replacement history, the human's own messages were kept, verbatim and in order.
  2. The visible replacement history held no tool output or assistant message. Beside it the record kept the last few messages in clear text; whether the model was shown those cannot be told from a log. An encrypted compaction item also carried state.
  3. A long hash, a word and a number came through two compactions exact, with nothing visible holding them. Some information survived without appearing in the readable history.
  4. A message from another agent, sent through the app's tool, landed as tool output. After the first compaction, a stub naming the sender was visible in the replacement history, but the message body was not.
  5. A message put in through the tested queue landed as a user message, and its text stayed in the observed history.

So a peer handoff can lose its visible message body. That alone does not prove its meaning was lost: OpenAI's compaction documentation describes the carried state as opaque. Test the facts the next agent needs, not just what the log displays.

Generated memory showed a separate startup issue. The summary injected at start arrived cut: about 2,500 tokens of a real store's 6,100, with the middle removed. In our case the part lost held the routing entries for the current work. This behavior is also reported in openai/codex issue 48679. That issue is a version-specific bug report, not a permanent product limit or a compaction retention rate.

We have not exhaustively checked message-retention budgets. Ours is narrower: what a handoff between agents needs to survive.

Nine Codex compactions in three chats: a peer tool-message body was absent from visible replacement history while a queued user-message text remained. A separate startup summary was about 6,100 tokens, of which about 2,500 were injected.
CLI 0.159.2 field observations. Visible absence does not establish semantic loss from opaque compacted state. Startup-memory truncation is a separate, version-specific issue.

What to do with it: preserve agent memory and handoffs

  1. Anything that must survive a compaction belongs where the harness reloads it: the root instruction file, or a file on disk the agent is told to read.
  2. Anything that must be read at start needs a hook or a line in the instruction file.
  3. Do not hand work to a Codex peer in a message and expect it to outlive a compaction. Put it in a file and send the path.
  4. Keep must-always-apply rules out of generated memory.
Four practical actions: preserve reloadable facts, make required startup reads explicit, send a durable handoff path, and keep invariant rules out of generated memory. Verify the facts after compaction.
Practical design guidance, not a measured guarantee. Suggested handoff fields add implementation detail without changing the original four recommendations.

How we know: versions, sources and limits

  1. The Claude Code load list is from the docs, read in late September 2026. The index tests are three seats on Sonnet 5. Recall depends on model and effort, so a larger model may differ.
  2. The Codex findings are from CLI 0.159.2, early October 2026. The value that survived two compactions was tested on one model.
  3. Both harnesses ship often. Every line here belongs to its release. Documentation was rechecked for this article; the original experiments were not rerun.
  4. A saved file is not proof of a completed read, and a completed read is not proof of compliance. For enforcement, see Real guards versus prose (KN-01).

Related field note: Where the tokens go in a real agent team (KN-02).