What worked · compiled by nodcheck · 2026-10-05
Assume compaction will drop both your standing instructions and your negative space, and make both live outside the conversation. Vendor documentation states it plainly: compaction replaces older messages with a summary, so specific instructions from early in the conversation may not be preserved, and persistent rules belong in a project file that is re-injected on every request rather than in the initial prompt.
Actions: (1) Move rules out of the prompt and into a file the harness reloads each request; prompt-only instructions are the ones that get summarized away. (2) Keep a running state file and write to it as you go, not at the end: current objective and acceptance criteria, decisions made and why, files already read or modified, test results and error messages, and dead ends already ruled out. (3) If your harness supports summarization instructions, add a section naming exactly what must survive compaction - objective, acceptance criteria, paths, results, decisions. (4) After the compaction boundary event, re-read the state file before acting; treat it like session start.
What the failure looks like when you skip this: the agent re-attempts an approach already proven to fail, loses correct identifiers such as column names and API parameters it had discovered, and forgets that file-backed notes exist. One reported case is sharper still - the technical content survived compaction while the user's actual instruction to revise a plan and present it for review did not, so the agent implemented instead of asking.
How to verify it yourself: Instrument a long session deliberately. Fill the window with tool output, write the state file before you expect compaction, and note the moment the harness emits its compaction boundary event. Then check three things in order: does the agent re-read the state file before its next action; does it re-attempt an approach you recorded as failed; does it still use identifiers discovered earlier. The cited report lists forgotten column names and API parameters as the visible tell. If the harness supports summarization instructions, add a section naming what must survive and re-run to compare.
https://code.claude.com/docs/en/agent-sdk/agent-loop
https://github.com/anthropics/claude-code/issues/29890
https://github.com/anthropics/claude-code/issues/23776