Docs The agent
Saving tokens
How Quad Harness shapes every request to spend fewer tokens without losing anything, the three profiles, the per-session limit and the Token saving page.
Every request to a model carries the whole conversation. Whatever sits in history is paid for again on every step, and most of it is tool output: build logs, file listings, whole files read once and never needed again. Quad Harness decides what the model is shown in place of that.
The rule it follows: send the model less without making it know less. Nothing here changes what is recorded. The session log keeps every byte, the window shows every byte, and anything shortened can be fetched again whole.
What it does
In the order a tool result meets it:
1. Cleans the noise
Colour codes, progress bars that redraw one line, and runs of identical lines are removed from what the model is shown. A cargo build or npm install log shrinks a lot and loses nothing the model needs.
2. Points at repeats
An output identical to an earlier one (running the same test twice with the same failure, reading the same file again) is replaced by a note that says where the first one is.
3. Caps enormous output
A huge output keeps its start and its end. The model is told how much was left out.
4. Retires old results
Results from many steps ago become short notes. Long text in old calls’ arguments (a whole file the agent wrote) is shortened too. The model can ask for any of them again, whole, with the tool_output tool. The note in place of a result names the call to ask for.
5. Keeps the prompt steady
Providers cache the start of a prompt and charge much less for the cached part, but only when it is byte for byte the same as last time. So:
- The point where old results are retired moves forward in jumps of a few steps, not every step. Between jumps, the start of every request is identical.
- The system prompt does not change from one request to the next. The clock in it is to the hour.
- Instruction files are the same text until a file changes.
- When the Mac is strained, the line added to the prompt contains no numbers, so it changes only when the level changes.
6. Summarises sooner
A long conversation is summarised (compacted) at a sensible size instead of waiting for a huge window to fill, because every token in it is paid for on every step. The full history stays in the session log.
7. Thinks less when it can
In the Lean profile, plain questions get a low reasoning effort when the model offers one, and answers are kept short: no preamble, no recap.
The three profiles
Choose one in Settings → Usage and cost → Token saving, under How hard to save.
| Off | Balanced (recommended) | Lean | |
|---|---|---|---|
| In short | Send everything exactly as recorded | Safe savings. Nothing is lost. | Everything in Balanced, sooner, plus shorter answers and less thinking |
| Clean noise | No | Yes | Yes |
| Point at repeats | No | Yes | Yes |
| Longest output shown whole | No limit | 30,000 characters | 14,000 characters |
| Results always shown whole | All | The last 10 steps | The last 5 steps |
| Summarise the conversation at | Three quarters of the context window | About 160,000 tokens | About 90,000 tokens |
| Short answers, low effort for plain questions | No | No | Yes |
Balanced is the default. Off is useful to compare, or when you want the model to see every byte again.
The summary point is the smaller of the profile’s number and three quarters of the model’s context window.
A limit per session
Under Limit per session, set the most tokens one session may use, in and out, as the provider counts them. Choose 250k, 1M, 5M or 20M, or type a number. Leave it empty for No limit.
When a session reaches its limit, the next turn stops. It is a safety net for long unattended runs, such as automations or a hand-off you left running.
The Token saving page
Settings → Usage and cost → Token saving shows, for the open session:
- What token saving kept out of the requests, and how much that is as a share.
- Served from cache: how much the provider served from its prompt cache. Providers report this when they cache.
- Estimated cost: what the session has cost and what saving spared, using the model’s list price when the app knows one.
Below that are How hard to save, Limit per session, and What it does, which lists each step above.
Note. Savings and costs are estimates: about four characters to a token, and list prices that may not match your bill. They are labelled as estimates on the page.
The Context map window
The Context map window (key 9) shows what is in the model’s context right now, largest first: files read, command output, tools from connectors. It shows how much room is left before the earlier part is summarised, the room kept free so a long answer fits, and a Summarise button to compact now. Connector tools cost tokens on every turn, so the window offers to Switch off ones you are not using.
The context ring in the top bar shows how full the context is. Choose it for details.
Compacting by hand
- Type
/compactin the composer. - Choose the summarise button in the Context map window.
The transcript shows Context compacted with the number of messages summarised and the tokens before and after.
Agent providers
Claude Code, Codex and Antigravity do their own saving and their own compaction. Quad’s token saving applies to models the engine talks to directly.
Other things that keep tokens down
- Tools load on demand. Only a core set of tool descriptions is sent with every request. See Tools.
- Switched-off features cost nothing. Their tools are left out of every request. See Feature switches.
- Subagents keep long investigations out of the main context. See Subagents and sessions.