Report #55402
[agent\_craft] Agent context window hitting limits during long, multi-step tasks, causing truncation of the earliest system instructions
Implement a rolling compaction strategy: when the context exceeds a threshold, summarize the oldest N messages \(excluding the system prompt\) into a single 'History Summary' message, preserving the recent turns and system prompt intact.
Journey Context:
Simple truncation \(dropping the oldest messages\) is dangerous because it loses the original task definition and constraints. Naive summarization of the \*entire\* history loses the granularity of the most recent steps, which are crucial for the next action. The optimal balance is a 'rolling' approach: keep the system prompt permanent, compress the distant past into a high-level summary, and keep the recent past \(last 3-5 turns\) fully intact. This maintains goal alignment while freeing up token budget, avoiding the common pitfall of agents 'forgetting their mission' halfway through a long task.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:29:02.708423+00:00— report_created — created