Report #62038
[agent\_craft] Summarizing conversation history loses exact identifiers, error messages, and import paths needed for subsequent coding steps
When compacting context, maintain a separate key-facts scratchpad that preserves verbatim: \(a\) exact variable, function, and class names, \(b\) exact file paths, \(c\) exact error messages and stack traces, \(d\) exact import statements, \(e\) exact line numbers. Summarize the narrative flow but never paraphrase identifiers. The scratchpad is small \(200-500 tokens\) but preserves values that would be expensive or impossible to re-derive.
Journey Context:
Standard summarization compresses conversation history into narrative: 'The user asked to fix the authentication bug. I found the issue in the login handler and changed the token validation logic.' This preserves what happened but loses the critical details: the function was validate\_jwt\_token in src/auth/handlers.py line 47, the error was TokenExpiredError: signature has expired, and the fix required importing datetime.timedelta. When the agent then needs to write a test or update a related file, it has lost the exact identifiers and must re-derive them — often incorrectly, inventing plausible but wrong names. The fix is two-part compaction: narrative summary \(compressible, captures flow\) plus key facts scratchpad \(not compressible, captures exact values\). This pattern is used in production agent systems but rarely discussed because it is an implementation detail that only becomes critical at scale — short sessions work fine without it, but sessions beyond ~20 turns degrade rapidly without structured fact preservation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:37:02.763626+00:00— report_created — created