Codumentor logo Codumentor

Context Visualizer Plugin

Shows what actually fills the model's context window: system prompt, tool
definitions, any compaction summary, the notes the harness injects, and the
conversation turn by turn — as a stacked-bar transcript card and on demand via
/context.

The plugin does not re-assemble the prompt to answer these questions. It
caches the exact message list and tool list sent to the model (after every
prompt-rewriting plugin, such as Context Summarization,
has had its turn) and reads the real token counts the model's response
reports, so the breakdown always describes what was actually sent — not an
estimate of what would be sent next.

Configuration

plugins:
  - module: codumentor.plugins.context_visualizer
    class: ContextVisualizerPlugin
    args:
      threshold_percent: 50
      threshold_tokens: null
      cadence: each_turn

All args are optional.

ArgTypeDefaultDescription
threshold_percentfloat50Share of the model's declared context window (models.agent_context_window / a profile's context_window) that a turn's prompt must reach before a card is shown. 0 = show one on every turn. Clamped to 0–100.
threshold_tokensint \nullnull
cadenceeach_turn \crossingeach_turn

The snapshot behind the card is always computed and cached for the
conversation, whatever the threshold — only showing a card is gated. This
is what lets /context show a breakdown on a conversation that has never
crossed the configured threshold.

Each user can override threshold_percent and cadence for themselves in
Settings → Extensions → Context Visualizer; the stored per-user value wins
over the YAML default when present.

When a card appears

At most one card per turn — a turn with eight tool calls makes eight LLM
calls and used to post eight nearly identical cards.

A prompt below the threshold shows nothing at all; /context is how you look
anyway. threshold_percent: 0 (or threshold_tokens: 0) means every turn is
above the threshold, so every turn ends with a card — and there is no crossing
to report, whatever cadence says.

/context

Type /context to see the breakdown for the current conversation right now,
regardless of the threshold. It re-emits the newest cached snapshot — it does
not trigger a model turn or re-assemble the prompt. On a conversation with no
turns yet, it returns a notice instead of a card.

What you see

Closed — one line and one bar:

⊺ Context  64%  167k / 262k · +41k                                       ▸
███▐██▐████│███████│████│██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
■ System prompt 20k   ■ Tool definitions 12k   ■ Compaction summary 24k
■ Injected notes 4.4k   ■ Conversation 106k · 12 turns

The blocks stack in a fixed order, so the bar is learnable:

+41k is the growth since the previous card, which is the number that says how
many more turns the window has room for. A percentage at or above 85% reads as
a warning. When the window has not yet reached the threshold (the /context
case), a small mark under the bar shows where it sits.

Open — three tables, each carrying the row that makes it add up to the bar:

  1. What fills the window — every block with its tokens and share, then the Used total.
  2. Conversation, turn by turn — one row per turn with a fixed column for each role (user, assistant, tool calls, tool results; a role a turn never used prints a rule, so the columns stay comparable), a bar scaled against the largest turn, and the conversation total. A long conversation keeps the most expensive and the most recent turns and sums the rest into one row.
  3. Tool definitions — the largest by name, the remainder in one row, then the total.

A footnote names the model, what the reply cost, the growth since the previous
card, and the threshold this card appears from.

If the model declares no context window, the card still renders the block
breakdown but cannot show a "Free" segment or a percentage — the plugin never
guesses a window to draw against.

Notes