Skip to content

The /compact Command

/compact is a built-in slash command that immediately summarizes the current conversation history. It is useful when you want to free up context window space without starting a new task. Add optional instructions after the command when the checkpoint should emphasize something specific, such as /compact focus on the API tradeoffs.

See also Auto-Compact, which describes how Kodik does this automatically as the context limit approaches.

When you type /compact in the chat input:

  1. The command is handled directly in the request loop; the literal /compact text is not sent as a normal chat turn.
  2. If you add text after /compact, Kodik appends it to the structured compaction prompt under Additional User Instructions.
  3. Kodik sends only the selected older provider history—including completed tool-call/result evidence—to the chat’s active model in a separate non-streaming request with no tools. The retained recent tail is not included in that inference.
  4. A recent tail stays verbatim within a token budget — always at least the exchange in progress. The decision is purely size-based; the number of messages never matters.
  5. Future provider context starts with a “What did we do so far?” question and checkpoint, followed by that recent tail. The visible transcript remains available.

The summary is generated using the same structured template as automatic summarization (Goal, Progress, Key Decisions, Relevant Files, etc.).

If the whole conversation still fits inside that kept recent tail, Kodik shows a notification saying there is nothing to compact yet and leaves the conversation unchanged.

Picking /compact from the slash-command menu inserts the command into the input rather than running it immediately, so you can add instructions before pressing Enter.

Everything you type after /compact becomes plain-language guidance for the checkpoint:

/compact focus on the API decisions, unresolved risks, and exact error messages
  • The instructions are appended to the fixed compaction template under an Additional User Instructions heading — the checkpoint still covers all the standard sections (Goal, Progress, Key Decisions, …), but emphasizes and preserves what you asked for.
  • They steer what the summary keeps; they don’t replace the template, and content from the conversation itself can’t override them (conversation text is treated as untrusted evidence).
  • They work when /compact is queued during an active turn too: the queued command runs at the next turn boundary and carries your focus into the compaction prompt.
  • Instructions too large to fit the compaction request’s budget fail with an error rather than being silently dropped or truncated — shorten them and retry.

If the conversation has accumulated many intermediate steps, failed attempts, or exploratory context, type /compact. Kodik will collapse all of that into a compact summary and you can continue working with the freed-up space. To preserve a particular thread, add an instruction like the one above.

This is more useful than /newtask when you want to stay in the same conversation and continue the current task rather than starting a fresh one.