# 0003 — `/compact` is the single sanctioned rewrite of a transcript **Status:** accepted ## Context ADR 0002 made sessions append-only and forbade rewriting history, because the provider's prompt cache depends on a byte-identical prefix and any edit to earlier messages invalidates it. The cost of that decision was a hard context ceiling: a long conversation could not be shortened, only abandoned. The default model accepts ~500k tokens, so the ceiling is rarely reached, but when it is, "start a new session" loses everything in the conversation. ## Decision `/compact` is an explicit, user-initiated command that: 1. asks the model for a one-paragraph summary of the conversation (a single non-streaming completion), 2. rewrites the session file to `header + system + one user message` carrying that summary, under the same session id, 3. continues in place. It is the **only** code path that truncates a transcript, and it deliberately breaks the prompt cache — an accepted cost, because the user asked for it and it happens once, not on every step. ## Consequences - A long session can now be continued instead of abandoned, at the price of the detail the summary omits. - The cache is cold after `/compact`; the next turn re-bills the whole prefix. - There is no rollback: the pre-compact messages are gone. The summary is the only record, so a bad summary loses real context. - ADR 0002 still governs everything else: no summarisation, truncation, or sliding window happens automatically.