ExAthena.Compactors.Snip (ExAthena v0.4.9)

Copy Markdown View Source

Second pipeline stage — drops old tool-result messages whose paired assistant turn already happened.

Rationale (from Claude Code's snipCompactIfNeeded): once the model has acted on a tool result (asked the next question, synthesised conclusions, moved on), the raw verbose tool output is mostly dead weight. Dropping those — but only the older ones, leaving recent tool turns intact — keeps narrative continuity while reclaiming significant tokens deterministically.

Heuristic:

  • a tool-role message older than :snip_age_iterations turns (default: 4) is eligible
  • only if there's a later assistant turn (so the model has already integrated the result)
  • the matching tool_calls slot on its parent assistant is replaced with a short <snipped: id> content stub so id-based pairing still parses cleanly

Memory + skill messages and the live suffix are never touched.