Report #3409
[agent\_craft] Long-running agent sessions exceed the context window and earlier turns are silently dropped, losing goals and constraints
Implement a SummarizingSession: keep the last N user turns verbatim and, when the turn budget is exceeded, compress older turns into a synthetic user→assistant summary pair using a cheaper model. Trigger at ~80% of the model's window and reserve a token floor.
Journey Context:
Hard truncation causes abrupt amnesia. Simple last-N trimming is deterministic but loses long-range requirements. Summarization preserves continuity but can compound errors \('context poisoning'\) and adds latency. The OpenAI Agents SDK pattern uses a shadow user prompt and a structured summary prompt with contradiction checks, timestamps, and tool-performance notes. Eval summaries with LLM-as-judge and transcript replay.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T16:40:37.299213+00:00— report_created — created