FIELD NOTE / 2026.10.024 MIN READ / 5 SOURCES

Context Compaction for Long-Horizon Goals: Preserving Progress Across Weeks and Months

Context compaction can preserve goals, decisions, milestones, and open questions across months without forcing an AI to carry every old conversation into each new turn.

Long-horizon goals create more history than any context window should carry raw

Anthropic’s context-engineering guidance describes compaction as summarizing a long interaction and beginning a new context with the important information preserved, while removing superfluous material such as stale tool results. [1] Goals that span months create exactly this problem. A dissertation, language-learning plan, rehabilitation program, or product launch can generate hundreds of conversations and events. Keeping all of them active is neither necessary nor reliably helpful. Compaction turns a growing trace into a maintained project state: objective, rationale, constraints, decisions, milestones, unresolved risks, and next actions.

Compaction is project memory maintenance

The output should read more like a disciplined handoff note than a conversational summary. It exists to support future decisions, not to recreate the past.

Hierarchical memory provides a natural place for compacted state

MemGPT demonstrated a virtual memory approach in which information moves between active context and external memory tiers. [2] For long-term motivation, a compacted project brief can occupy a high-priority tier while detailed session notes remain retrievable below it. Each major checkpoint updates the brief rather than appending a new full history. The AI begins a new session with the compact state, then fetches evidence when a particular decision requires detail. This keeps continuity without making the model reread the entire journey on every turn.

Reflection can turn many episodes into durable lessons

Generative Agents used stored experiences plus reflection to derive higher-level information that later influenced planning. [3] Long-horizon goal systems can use a similar pattern with user oversight. Ten separate scheduling failures may compact into one lesson: “weekday evening sessions repeatedly conflict with childcare; weekend mornings are more reliable.” The lesson carries more future value than ten raw transcripts. Compaction should preserve the evidence link, however, so the user can inspect or challenge the synthesis instead of being governed by an opaque conclusion.

Compression should not erase disagreement

If evidence is mixed, the compacted note should say so. “Weekend mornings worked in three of five trials” is better than a falsely certain rule.

Compaction protects the attention budget but can introduce its own distortion

Long-context research shows that simply extending prompts does not guarantee robust use of every relevant fact. [4] Compaction addresses noise, but summaries can also omit rare constraints, minority evidence, or subtle changes in intent. The solution is not to avoid compaction; it is to make it structured and testable. Important fields should have explicit slots, and high-risk items should preserve links to source material. Teams can compare decisions made from compacted state against decisions made with full evidence on benchmark cases to detect systematic loss.

Fresh synthesis is necessary because the meaning of progress changes over time

OpenAI’s 2026 memory work emphasizes freshness, continuity, relevance, and correctness in memory synthesis across long time horizons. [5] A compacted goal state should therefore be regenerated or patched as circumstances change. Early in a project, the key question may be habit formation; later it may be quality, pacing, or completion. Old milestones can move to archive. New constraints can become prominent. The compact state is a living project model, not a static summary produced once at onboarding.

Compaction needs version history

Keeping prior compacted states makes it possible to understand when a goal, plan, or interpretation changed without carrying every raw interaction into the model.

A useful compact schema separates stable, current, and unresolved state

Stable state includes the user-endorsed goal and durable constraints. Current state includes phase, recent progress, active strategy, and next action. Unresolved state includes open questions, risks, blocked decisions, and hypotheses being tested. A fourth section can hold lessons already validated by the user. This structure prevents summaries from becoming generic narratives. It also makes handoffs easier if different agents or tools work on the same goal because every participant receives the same concise operational picture.

Compaction should happen at natural boundaries rather than arbitrary token thresholds alone

Token pressure is one trigger, but motivational projects have semantic boundaries: end of week, milestone completion, plan revision, relapse recovery, phase transition, or major external change. Compaction at those points can ask what should carry forward and what should be archived. The user can review the new state when the stakes justify it. This makes compression part of reflection rather than invisible housekeeping.

A checkpoint is both technical and motivational

Reviewing what carries forward reinforces progress, clarifies the next phase, and gives the user a chance to reject a story about their journey that no longer feels accurate.

Good compaction preserves momentum without preserving clutter

The purpose of long-horizon memory is not to demonstrate that the AI can remember every detail. It is to make the next week benefit from the last week. Structured compaction does that by retaining objectives, constraints, decisions, milestones, lessons, and unresolved work while pushing raw history into retrievable storage. It reduces context pollution, improves handoffs, and gives teams a concrete artifact to test for correctness. When compaction works, months of activity become a clear current state rather than an ever-growing transcript that both the model and the user must repeatedly rediscover.

RESEARCH / PROVENANCE

Works Cited

5 SOURCES
  1. 01
  2. 02
  3. 03
  4. 04
  5. 05

CodeHistory is a living archive. Citations document the evidence used for this edition; later evidence may refine the account.

Contribute / Corrections

Improve the record.

Use this moderated submission form to suggest a correction, provide a source, challenge a priority claim or identify a missing contributor. Submissions are treated as research leads, not automatically published comments.