Part 7 of 16 · 1 min read
The six strategies compared, and what the Sim class does on every step
One class, six methods of reducing the same request, scored on the same task.
Every strategy in the table below is a method of the class Sim, in compact.py. ingest(turns) appends the step's turns to the buffer and then calls compact(), which dispatches to the right reduction (Part 1's snippet is that dispatch). The immutable event log lives in a separate Task object; Sim never mutates it, which a test pins directly.
| Strategy | Mechanism | Model call | Reversible | What it can lose |
|---|---|---|---|---|
keep_all |
no reduction; the request is refused above the limit | none | n/a | nothing, until the limit |
truncate |
sliding window: evict the oldest turns first (FIFO) | none | yes (log) | everything old, including decisions |
rolling |
recursive summarisation: fold the oldest 40% of the budget plus the old summary into a new summary capped at 25% of the budget | yes, per round | no | any line the summariser omits or corrupts, compounding per round |
clear_tool |
tool-output clearing: replace tool results older than the last 6 turns with a stub; then FIFO if still over | none | yes (re-run) | user and assistant turns, once FIFO reaches them |
structured |
structured state: at ingestion, extract decisions, constraints and entities into keyed slots, carry them verbatim, FIFO the raw turns | none (patterns here; a model in production) | n/a | anything the extractor does not recognise |
hybrid |
clear_tool plus structured |
none | partly | as above |
Part 4 defines structured state itself; this table is about where each strategy sits on cost and reversibility, which the result table in Part 5 then measures.