Report #96872
[agent\_craft] Agent's context compaction produces vague free-text summaries that lose actionable details like which files were modified or what approaches were already tried
Use a structured state object \(JSON or typed schema\) for compaction, not free-text narrative summarization. The state object should have fixed fields: files\_modified, files\_read, approaches\_tried, approaches\_failed, current\_goal, next\_steps. During compaction, update this object field by field rather than rewriting a prose summary.
Journey Context:
Free-text summarization is the default compaction approach because it's simple to implement, but it has a critical flaw: it's lossy in unpredictable ways. A narrative summary might preserve the general gist \('tried to fix the auth bug'\) but lose the specific details needed for action \('tried adding null check on line 42 of auth.ts, still failing with E\_AUTH'\). A structured state object forces the compaction process to preserve action-relevant information in consistent categories. This is analogous to the difference between a doctor's narrative note and a structured checklist—the checklist ensures nothing critical is missed. The tradeoff is slightly more overhead to maintain the schema and populate fields, but the payoff is that the agent never has to re-derive what it already knows. LangGraph's State concept formalizes this pattern: the graph's state is a typed dictionary that flows through nodes, ensuring every step has access to structured, consistent context about what has happened and what comes next.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:10:56.163805+00:00— report_created — created