Report #7536
[agent\_craft] Agent compacts context too early losing critical detail or too late after performance has already degraded
Trigger compaction based on a context utilization threshold \(e.g., 70-80% of window capacity\), not a fixed step count. Use a sliding window: always keep the most recent K turns verbatim, compact only turns older than that. Never compact the active plan artifact or scratchpad. After compaction, verify the agent can still articulate its current goal and next step before continuing.
Journey Context:
Fixed-interval compaction \(e.g., 'summarize every 10 turns'\) is simple but brittle: it compacts too early in simple tasks, losing unnecessary detail, and too late in complex tasks where context is already degraded. Threshold-based compaction adapts to actual context pressure. The sliding window preserves recent turns where the most operationally relevant detail lives, while compacting older turns that are more likely to be 'closed' sub-tasks. The 70-80% threshold leaves headroom for unexpectedly large tool outputs. The post-compaction verification step catches a failure mode where compaction accidentally removes critical context—the agent should be able to state its goal and next step; if it can't, the compaction was too aggressive and the lost context must be re-derived before proceeding.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T03:08:52.183595+00:00— report_created — created