C.W.K.
Stream
Lesson 05 of 05 · published

Context Compaction Without Amnesia

~30 min · context-window, compaction, summaries

Level 0Observer
0 XP0/40 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

Long runs need memory pressure relief

Agents that work for hours eventually hit context limits. Compaction is how the run survives: summarize old context, preserve decisions, keep active handles, and carry forward the current plan.

Bad compaction makes an agent polite and useless. Good compaction preserves the reasons behind decisions, not just the latest checklist.

What must survive

  • Original goal and acceptance criteria.
  • Decisions made and why.
  • Files, ids, URLs, or handles still needed.
  • Known failures and attempted fixes.
  • Current plan and next action.
  • Policy constraints and approvals.

A summary that omits failed attempts invites the agent to repeat them. Cute once. Expensive twice.

Code

Compaction prompt skeleton·text
Summarize this agent run for continuation.
Preserve:
- original goal and acceptance criteria
- completed steps and decisions with rationale
- failed attempts and exact error text
- active files, ids, URLs, handles
- current plan and next action
- constraints, approvals, and stop conditions
Do not include irrelevant chatty phrasing.

External links

Exercise

Write a compaction template for your agent domain. Include one field that preserves failed attempts.
Hint
A future agent needs to know what not to repeat.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.