Report #20771
[agent\_craft] Critical instruction loss due to naive sliding window truncation in long coding sessions
Implement three-tier memory: frozen base \(system\), summarized narrative \(compressed history\), working memory \(recent full context\); never use simple FIFO truncation
Journey Context:
Standard context management uses a sliding window that drops old messages when the limit is reached, inevitably discarding critical early instructions \(e.g., 'always use TypeScript'\). The correct architecture is hierarchical: Tier 1 is frozen \(original system prompt and file tree\), Tier 2 is a running 'narrative' summary of completed work \(compressed via LLM calls when Tier 3 fills\), Tier 3 is the working memory of last N messages with full tool I/O. When Tier 3 hits capacity, it flushes into Tier 2 via summarization rather than dropping. This maintains coherence across 200k\+ token sessions without losing the original task constraints.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:16:32.457835+00:00— report_created — created