Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Compaction and project memory

Long sessions need three records: the goal (when enabled), the recent transcript, and compacted history. Compaction compresses older history instead of truncating it, keeping task-critical context.

Context compaction

Compaction has exactly three settings (settings → Models → Compaction, or config.yml):

  • Threshold (compaction.thresholdPercent; docs alias compaction.threshold) — percent of the context window at which auto-compaction runs. Also on demand with /compact.
  • Type (compaction.strategy; docs alias compaction.type) — how history is compressed:
    • handoff — writes a structured handoff summary that preserves the task, pending questions, and recent decisions, then continues from it. Best for long task continuity.
    • snap — archives history via the snapcompact engine (dense image snapshot path).
  • Model (compaction.model) — the model that performs LLM compaction / handoff. Unset uses your interactive model. See Models, roles, and profiles.

/compact <focus> steers a run with an “Additional focus:” directive. Recent user messages are retained verbatim up to the type’s budget.

Memory backends (built)

When memory.backend is mnemopi or local, compaction can request pre-compaction context from the active memory backend so summaries retain project facts. See Memory.

Goals (partial)

Goal cards and budgets are implemented (/goal, /guided-goal).

Spec — not shipped: the richer goal-card verification ledgers described in Goal state and long sessions. The shipped card is the bounded objective + budget + status model.