Report #49806
[agent\_craft] Naive truncation in long sessions removes early user requirements causing the agent to forget constraints
Maintain a 'working memory' scratchpad of key decisions and immutable constraints; during context window management, use structure-aware truncation that preserves this scratchpad and summarizes older conversation turns hierarchically rather than simple head/tail cut.
Journey Context:
Standard 'keep last N tokens' truncation fails for coding tasks where the user stated critical constraints \(e.g., 'use numpy not pandas'\) in the first message. As the session grows, these are truncated. The fix is to treat the context window not as a FIFO queue but as a priority queue. A 'working memory' section \(manually maintained or extracted via periodic summarization\) is pinned to the middle of the context window \(where model attention is strongest\) or prepended with high priority. Older turns are summarized into key-value pairs \(e.g., 'Decision X: use REST not GraphQL'\) rather than kept verbatim.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T14:04:40.917790+00:00— report_created — created