Economics · Engineering 2026-11-27 5 min read

Token Economy Under the Hood: Spilling, Compaction, and Small-Model Mode

Why a single 1 MB build log kills your context window and your budget — and how Saturday spills, compacts, deduplicates, and shrinks prompts by up to 99.6% without losing a single byte on disk.

spill small-models compaction ollama
The short version
  1. 1A 1 MB log re-sent on 25 turns is a 25 MB bill.
  2. 2Saturday writes it to disk once and sends an 8 KB preview.
  3. 3The model asks for more only when it needs it.
Read the whole thing
Editorial illustration of a dense wall of raw tool log lines being compressed down to a thin, bounded preview strip.

A tool result is never paid for once. The full conversation history is re-sent on every LLM turn, so one verbose pytest run is billed over and over until compaction digests it. A 1 MB webpack log is worse. Earlier hard caps simply truncated the output, which left the model blind to everything past the limit.

A tool returns a 1 MB log. Saturday writes it to disk once and sends the model a bounded preview; when the model needs more it pages or greps the file, so 99.6 percent of those characters are never billed as tokens.build.log, straight from a tool1 MBspillwrite onceon diskthe whole filewhat the model sees8,000 chars: head and tailpage or grep itonly the slice99.6% never sent as tokens
The asymmetry that makes this work: the tool's output is 1 MB, the model sees about 8 KB of it, and the rest stays on disk where the model can page or grep it. Nothing is thrown away and nothing unused is billed.

Spill once to disk, page on demand

Saturday intercepts every oversized tool payload at one seam, fit_tool_response. That seam covers files, shell, web, MCP, adapters and subagents. Anything over 24,000 characters is written atomically to a content-addressed file under your config home, never into your repository. The prompt then gets a bounded head and tail preview:

[spill] shell output 1,048,576 chars / 13,108 lines -> ~/.saturday/spill/20261127/8f2c1d9a0b3e-shell.txt
[spill] full output kept on disk; showing first 1,600 and last 2,400 chars.
... [1,044,576 chars omitted - read the spill file for the rest] ...
[spill] next: read_file(path=..., offset=1, limit=2000) to page it, or grep(pattern=...) to search it.
Payload sizeInline beforeInline afterToken saving
200 KB~50,000 tokens~1,126 tokens97.7%
256 KB~65,536 tokens~1,126 tokens98.3%
1 MB~262,144 tokens~1,127 tokens99.6%

Compaction + history deduplication

Payloads under the 24k spill threshold can still waste thousands of tokens. Progress bars, carriage-return spinners, ANSI escape codes and repeated file reads all cost money. Saturday collapses that noise, measured at 97.7% reduction on noisy logs. It also deduplicates superseded reads across turns, measured at 75.1% history reduction, and keeps the latest ground truth intact.

Automatic small-model optimization (<= 14B)

Small local models, 4B to 14B, choke when handed 72 tool schemas and a massive system prompt. Ollama defaults like num_ctx=4096 will even truncate the tools silently, out of the middle of the prompt. So Saturday detects models of 14B or below, default auto, with no effect on frontier models. It narrows the active tool catalog from 89 to 13 core tools, switches to a compact prompt, -76.0% characters, and cuts schema characters by 54.6%. It masks old observations on the wire and coerces schema arguments. Measured live on Ollama qwen3.5:4b: -62.1% prompt tokens per step.

Questions people ask

What happens to tool output over 24,000 characters?

It is written atomically to a content-addressed file under the Saturday config directory, never your repository, and the prompt keeps a bounded head-and-tail preview with instructions to page or grep the file.

Does spilling delete the rest of the output?

No. The full payload stays on disk. Only the unused part stops being re-sent on every turn, and that repeated re-send is where the saving comes from.

How much does spilling save?

Measured inline token counts in the repository: a 200 KB payload falls from about 50,000 tokens to about 1,126, a 97.7% saving, and a 1 MB payload falls from about 262,144 tokens to about 1,127, a 99.6% saving.

Does this help small local models?

Yes. At 14B parameters and below, Saturday narrows the active tool catalog from 89 to 13, switches to a compact prompt and masks old observations. On Ollama qwen3.5:4b this measured a 62.1% cut in prompt tokens per step.

Try Saturday on your own machine

Free during the beta · 72 built-in tools · 22 providers (19 cloud, 3 local) · no account needed.

Saturday
YOUR NEXT SATURDAY STARTS HERE

Make yourself
at home.

Choose an installer for your machine.

Latest releaseRelease notes

Beta builds are not code-signed yet, so Windows SmartScreen and macOS Gatekeeper will warn before opening them. The release notes list every installer's SHA-256. Cloud model usage needs your own provider or subscription.