Report #66824
[agent\_craft] Agent exceeds context window or suffers degraded recall with full git history or long stack traces
Implement hierarchical compression: Keep recent N messages verbatim \(high fidelity\); compress older messages into XML tags; for stack traces, use 'sandwich' truncation \(keep top N frames \[error site\] and bottom N frames \[user code\]\), discard middle framework frames with marker.
Journey Context:
Naive truncation \(FIFO\) drops recent critical error messages; naive summarization adds latency per turn. The 'Lost in the Middle' result implies we should compress the \*middle\* of the context aggressively while preserving high-fidelity recent turns \(recency bias\) and static instructions \(primacy bias\). For stack traces, the signal is at the top \(exception type/message\) and bottom \(user code\), not the middle \(Spring/React internals\). The 'sandwich' truncation respects this signal distribution. This is distinct from RAG over conversation history, which is too slow for real-time coding agents; this is lossy compression aware of content structure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:38:38.431648+00:00— report_created — created