Stacking Agent Memory: Checkpoints, Status Boards, and Active Context
I love the idea of autonomous coding agents. But one of the quickest ways to hit a wall when setting them up is the infinite context problem. Your context window is finite, but the work you want the agent to do just keeps going.
Hitting that hard token limit means the system either crashes or starts evicting vital instructions. The most practical fix for this is memory compaction.
What is memory compaction?
Memory compaction isn't just asking the model to "summarize this chat." It is the process of condensing past conversational history into a dense, meaningful representation of state.
Why bother? Because it keeps your agent running autonomously without burning through massive amounts of API credits. It preserves the exact intent and state needed for an AI to actually execute over long periods.
The anatomy of the problem
When you compress context, you have to decide what survives the cut. You absolutely must preserve the overall intent, the current execution state, and historical progress.
We are fighting strict constraints here. We have hard token limits, we need low retrieval latency, and we have to balance accuracy against abstraction. You usually achieve this through a mix of entity extraction and structured state formatting.
Three timeframes of a complete system
If you look closely at how production systems handle this, you realize they rarely pick just one compaction method. Instead, they use a stacked memory architecture that operates across three distinct timeframes.
The Checkpoint Layer (Long-Term)
This is the macro layer. It holds the overall project map, the ultimate goal, and major milestones.
You don't feed this massive block of text into every prompt—it’s too expensive and distracting for the model. Instead, you only pull the checkpoint when the agent switches major tasks, starts a brand-new session, or needs to recover from a crash. It acts as an anchor to re-orient the system when it needs to see the whole board.
The Status Board Layer (Mid-Term)
Think of this as the agent's active work session, functioning essentially as a strict Kanban board. It tracks exactly what got done today and what’s currently blocking progress.
This layer is referenced constantly while the agent is working. It forms a bridge between the giant checkpoint map and the immediate task. By clearly separating "Done" from "Blocked," it forces clarity and stops the model from hallucinating progress it hasn't actually made yet.
The Active Context Layer (Short-Term)
This is the micro layer, and it is pure execution. It throws out all the historical baggage and focuses on one thing: what the agent needs to know right this second to write the next line of code.
This layer only tracks immediate constraints, active variables, and the specific file that is currently open. Because it strips away the past and the future, it’s incredibly token-efficient. It keeps the agent locked onto the immediate micro-task without getting distracted by previous mistakes or overarching project goals.