Codumentor logo Codumentor

Context Summarization Plugin

When a conversation is about to exceed the model's context window, this plugin
shrinks the prompt so the turn can still run. It keeps system prompts and the
most recent messages, and — by default — asks a model to summarize the middle
instead of dropping it silently. If summarization is off or fails, it falls
back to truncation.

It also retries after a context-window error from the model, using the same
shrink-and-retry path so a long conversation is more likely to continue than
to fail outright.

Configuration

plugins:
  - module: codumentor.plugins.context_summarization
    class: ContextSummarizationPlugin
    args:
      enabled: true
      max_context_tokens: 128000
      safety_margin: 1000
      min_recent_messages: 5
      split_ratio: 0.7
      enable_summarization: true

Parameters

args:
  model_context_limits:
    "Qwen3-235B-A22B-Instruct-2507": 262144

Aggressive truncation for small models

plugins:
  - module: codumentor.plugins.context_summarization
    class: ContextSummarizationPlugin
    args:
      enabled: true
      max_context_tokens: 16385
      safety_margin: 500
      min_recent_messages: 3
      split_ratio: 0.8

What you see

When a turn is summarized or truncated, a transcript card reports how many
messages were condensed, how many were kept, and roughly how many tokens were
saved. A pending card appears while summarization is running.

Each user can hide those cards in Settings → Extensions → Context
Summarization (Show Summarization Cards, on by default). This is a web-UI
setting; the TUI does not read it yet
(doc/core-dev/improvements/plugin-settings.md).

/compact

Type /compact at the start of the composer (or pick it from the / list)
to create or refresh the compacted context without sending a model turn.
The transcript stays the source of truth; compaction is derived state used by
later prompt assembly.

The command reuses this plugin's summarization, cache, token estimates, and
event card. If the conversation is too short, or summarization is disabled,
it returns a notice and does nothing. Disabled plugins do not advertise the
command.

Notes