Skip to content

feat: compact conversation (/compact) — summarise history to save context #31

@VforVitorio

Description

@VforVitorio

Problem

Long sessions accumulate tokens in the chat history until the model's
context window is full and quality degrades or responses are cut off.

Proposed behaviour — /compact

/compact

  summarising conversation…
  ✓ compressed 42 messages → 1 summary (saved ~3.2k tokens)

The command:

  1. Sends the current chat history to the model asking it to produce
    a compact summary of what has been discussed and decided
  2. Replaces Agent._chat with a new Chat containing only the
    system prompt + one assistant message with the summary
  3. Prints how many messages were compressed and estimated token savings

UI for context fullness (separate sub-feature)

Show context usage next to the stats line after each response:

↑ 1.2k  ↓ 384  ·  45 tok/s  ·  2.3s   [████░░░░░░ 38% ctx]

Implementation note

Token counting for the context bar uses the accumulated
_session_prompt_tok + _session_pred_tok from issue #29 divided
by the model's get_context_length() (from issue #2 implementation).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions