Collapsed Observations

Preserve history structure while replacing old tool or command outputs with short placeholders to cut tokens and drop stale duplicate state.

Collapsed observations keep the shape of an agent trajectory — which actions ran, in what order — while replacing bulky old observation bodies with a one-line stub such as “Old output omitted (N lines).” Dual purpose: shrink tokens per step, and remove outdated duplicates (directory listings, file views, prior command dumps) that compete with current state under context engineering.

Prefer collapsing bodies, not erasing turns: the model still sees that a command happened. Do not collapse the system template or the latest observation the agent must react to. Keeping only the last few observations (SWE-agent default: last 5) beats full-history retention on resolve rate — full history costs ~3 absolute points under ACI component ablation. Expect agent trajectory phases (localize/reproduce → edit–eval → submit) when reading collapsed histories — early failures need recovery affordances, not only a longer turn budget. Pair with agent episode prompt stack next-step templates and memory summarization when even placeholders accumulate past budget. Unlike blind FIFO context eviction, collapse targets redundant environment feedback first.


Sources

  • SWE-agent (Yang et al.), pp. 31–45