Module: Xeno::Compaction
- Included in:
- TurnRunner
- Defined in:
- lib/xeno/compaction.rb
Overview
Summarize-and-replace compaction, run as a claimed turn (kind: "compaction") so it is exclusive, queues behind active work, and replays safely after a crash.
The system prompt and the last compaction_tail_turns turns survive verbatim; everything before
them is summarized by a throwaway model call and replaced in place.
Constant Summary collapse
- SUMMARY_PREFIX =
:nodoc:
"[Conversation summary — earlier messages were compacted]".freeze
- COMPACTION_PROMPT =
<<~PROMPT.freeze You are compacting an agent conversation to reclaim context space. Write a dense summary of the transcript below; it will REPLACE those messages permanently. Separate completed work and decisions from remaining or open work. Retain every constraint, preference, fact, identifier, amount, and reference a future turn could need. Output only the summary text. PROMPT