Mitigation
State Externalization: Files, Ledgers, and Checkpoints as Drift-Resistant Memory
Anything an agent must not forget should live outside the context window. How to externalize goals, plans, decisions, and facts into files, ledgers, and checkpoints that survive compaction and session death.

Everything an agent keeps only in its context window is on a countdown. Compaction will abridge it, a growing and noisier window will make it harder for the model to use reliably, and a crashed or restarted session will delete it outright. This is the storage-layer root of behavioral state decay: goals, plans, decisions, and hard-won facts all degrade because they live in a medium designed for conversation, not for records. State externalization is the countermeasure: anything the agent must not forget is written to durable artifacts outside the window, and the window holds only working state plus pointers.
The method
Externalize by record type, because each has a different shape and update discipline:
- Goal anchor: the objective, success criteria, and exclusions, verbatim, in one small file. This is the artifact that re-anchoring patterns re-inject; it is owned by the operator and never edited by the agent.
- Plan file: steps with per-step status, preconditions, and rationale. Makes plan decay inspectable: staleness becomes a diff between the file and fresh observation instead of a vague feeling.
- Decision ledger: append-only log of choices made and rejected, with one-line reasons. Prevents relitigating settled questions after the reasoning has been compacted away.
- Fact store: verified facts with their provenance (where each was confirmed and when). Recalled-but-unverified material stays out, or enters flagged as unverified.
- Checkpoints: periodic snapshots bundling all of the above plus a short "how to resume" note, so any session can die and be resumed by a successor at the last checkpoint.
The context window then carries the current subtask, recent turns, and pointers to these artifacts, and the agent re-reads them on demand instead of trusting its recollection. This directly counters context rot: the window stays small and curated, and durable records live where context growth cannot silently abridge them. External state is not immune to failure, though; files go stale, get corrupted or poisoned, or are retrieved wrongly, so versioning, freshness rules, integrity checks, access control, and retrieval validation are part of the pattern, not optional extras. The research literature models a related but different mechanism, episodic memory consolidation, in which the preceding 100 interactions are summarized every 50 turns; the paper's simulation projects, under its assumptions, a 51.9% drift reduction from that intervention alone (Rath, arXiv:2601.04170). It did not test the structured files, ledgers, and checkpoints described here, so the figure does not quantify this pattern.
Concrete procedure
- Step 1: create the skeleton at session start: goal anchor, empty plan file, empty decision ledger, empty fact store, all in a predictable location the agent is told about once.
- Step 2: define write rules. In pseudocode: on decision made, append to ledger; on fact verified, write fact with source and timestamp; on step completed, update plan status only after its verification passed; on operator amendment, update goal anchor immediately.
- Step 3: define read rules: re-read the goal anchor at every re-anchor point; re-read the plan file before each step; consult the fact store before acting on any remembered fact.
- Step 4: checkpoint on a cadence and before every irreversible action. Each checkpoint must be sufficient for a cold-started successor session to continue the work without the original transcript.
- Step 5: verify resumability once per project: kill a session deliberately, resume from the checkpoint in a fresh session, and confirm the successor's first actions are correct. An untested checkpoint is a hope, not a mechanism.
Pitfalls
- Stale state files. An externalized plan that is not updated is worse than no plan, because it carries false authority. Write rules must fire at the moment of the event, not in batch at session end; version the artifacts, give time-sensitive facts a freshness marker, and validate that retrieval returns the current version.
- Externalizing everything. Dumping full transcripts into the artifacts the agent reads recreates the noise problem on disk: the agent cannot find the signal. Externalize conclusions and their provenance into the working artifacts, and keep immutable raw history in a separate audit store, outside routine context retrieval, for incident analysis, reproducibility, and compliance.
- Trusting recalled facts. Agents will confidently act on remembered values instead of consulting the store, even when the store would contradict them. The read rule, consult before acting, has to be enforced by the harness, with compliance made observable (log every action taken without a preceding consult), and spot-checked by drift regression tests.
- Secrets in state files. Ledgers and checkpoints get committed, shared, and attached to handoffs. Record references to secrets (the name of the vault entry), never values.
- Unowned files. If both operator and agent edit the goal anchor, it stops being an anchor. Every artifact needs a single writer and a defined update discipline.
- No decay measurement. Externalization reduces decay but does not prove it. Pair it with longitudinal measurement such as an Agent Stability Index style composite to confirm the pattern is working in your system.
Checklist
- Goal anchor, plan file, decision ledger, and fact store exist at a known location.
- Single writer defined per artifact; agent never edits the goal anchor.
- Write rules fire on events, not in batches.
- Facts carry provenance and a verified/unverified flag; no secret values anywhere.
- Checkpoints taken on cadence and before irreversible actions.
- Cold-start resumability tested at least once.
- Decay still measured longitudinally despite the mitigation.