When Context Collapses: Teaching Agents to Detect and Recover from Lost Memory
AI-generated summary of reporting by Oreilly AI ML Blog. Read the original for the full story.
Why it matters
Agents silently compact their context mid-task and keep working without knowing they've forgotten things; this gives developers a concrete detect-and-recover workflow instead of fragile long sessions.
Andrew Stellman, writing on O'Reilly, describes how AI coding agents lose track of work when their 'context window', the model's short-term memory, fills up and old information gets quietly compressed away. He proposes a three-step pattern he calls externalize-recognize-rehydrate: save the agent's progress to files on disk, detect when memory has degraded, and reload from those files. Anyone using tools like Copilot for long, multi-step coding sessions runs into this problem.
Teams building multi-step agentic workflows face silent context loss: when a model's memory window (200K–2M tokens today) fills, it compacts and keeps going without knowing it forgot things, as with a Copilot bug that wiped a session built on Opus 4.6. Stellman's fix, checkpointing state to files so agents can self-recover, reduces rework risk and wasted tokens, costs nothing beyond prompt engineering, and applies to tools teams already run.
Stellman proposes the externalize-recognize-rehydrate (ERR) pattern: periodically write two state layers to disk, 'execution continuity' (current step, cursor, timestamped progress file updated per record) and 'task continuity' (stable goals and constraints), plus JSONL artifact logs. Recognition is the hard part since compaction is silent; agents reload both layers after suspected degradation. Drawn from his open-source Quality Playbook code-review skill, which splits ~15M-token reviews into six file-mediated phases. No benchmarks are given.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Copilot Opus 4.6 Quality Playbook MS-DOS 3.3 PDP-10 O'Reilly
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
A hierarchical note-taking app for building large personal knowledge bases
Trilium lets users build and navigate massive personal knowledge bases without duplicating content, saving time on organization and retrieval.
Desktop apps in Go with native UI or web frontend
Go developers can now ship cross-platform desktop and mobile apps in a single small binary without cgo or heavy runtimes, cutting build complexity and deployment size.
OpenBitFun: an agent workspace with four harness modes and phone remote control
OpenBitFun lets agents run on any machine and be controlled from a phone, eliminating the need to choose between local power and remote access, saving developers time switching contexts.
Intel One Mono: a monospaced font designed with low-vision developers
Developers with low vision or eye fatigue can read code more clearly, reducing errors and improving productivity.