Long tasks hit context limits, and the compaction or handoff that
follows is where instructions quietly die. I wanted to know which
kinds of instruction survive the squeeze and which vanish, so I
started checking resumed sessions against their configs. The pattern
is consistent enough to write down.
The test
Nothing fancy. After a handoff (compaction, subagent spawn, or
session fork), I ask the working agent to state, without reading
files:
1. What are you building and what's done so far?
2. Which rules from the config are you following?
3. What approaches were rejected and why?
Then I compare against the config and the pre-handoff transcript.
Dozens of handoffs, same categories of loss every time.
What dies first
Rejected alternatives. The "don't use X, we tried it" knowledge
is the first casualty. Post-handoff, agents re-propose the exact
library or pattern that was ruled out an hour earlier. This is the
most expensive loss: it re-runs debates you already finished.
Reasons behind rules. The rule "no moment.js" survives; the
reason (bundle size, already migrated to dayjs) does not. Without
the reason, the agent treats the rule as arbitrary, and arbitrary
rules are the first to get rationalized away in edge cases.
Preference phrasings. "Keep error messages calm and technical"
becomes generic. Anything that was a judgment call regresses toward
the model's default.
Task-adjacent state. Which of three similar files is the real
one, what the TODO comment meant, why the branch exists. Anything
that lived in your head or in transit is gone.
What survives
- Explicit, file-backed rules. If it is in CLAUDE.md or a scoped rule that reloads, it survives. Files re-read; memory does not.
- Commands. The test command, the build command. Probably because they appear in recent transcript turns.
- Recent work. The last few exchanges before compaction are represented in the summary. The further back, the thinner.
- Anything written to a file mid-task. A NOTES.md or TODO.md updated as you go survives perfectly, because it reloads as data.
What to do with this
1. Rules live in files, never in conversation. If you have told
the agent a rule three messages ago and the task will run long, it
does not know the rule anymore. Move it to config or accept the
loss.
2. Decisions get a ledger. A DECISIONS.md, append-only, dated,
one line per decision with the rejected alternative:
## 2026-09-19: validation in zod, not joi
- joi rejected: team has zod experience, schema reuse with API layer
When a resumed agent proposes joi, the answer is a file read, not a
meeting.
3. Handoffs get a written brief. Before spawning a subagent or
expecting compaction, write the brief to a file: goal, done-so-far,
constraints, rejected approaches. Two minutes of writing beats an
hour of the agent re-deriving what you already decided.
4. Point-of-use comments. A comment at the weird workaround
explaining why survives every compaction for the rest of the repo's
life. It is the cheapest compaction insurance that exists.
The honest limit
No amount of config fixes this completely. Compaction is lossy by
design, and the summary keeps what is recent and salient, not what
is important. The realistic goal is: rules and decisions survive via
files, and the losses that remain are ones you can afford, like
transit state you would restate anyway.
Related reading
- Your CLAUDE.md is probably too long: files reload, so what earns a place in them matters.
- Config files vs hooks: guarantees belong below prose, partly because prose is what compaction eats.
- Running 4 agents in parallel: handoff discipline at fleet scale.
Config that survives handoffs is a design goal of our kits: AgentConfig Studio. Free Next.js sample (MIT).
Top comments (0)