| Source | Typical share | Fixable by |
|---|---|---|
| Tool output in context | 60-80% (our instrumented sessions) | Compression at the tool-to-context boundary |
| System prompt + rules | 5-15% | Trim once, applies every turn |
| Conversation itself | 10-25% | History truncation, summarization |
Most cost advice targets the smallest slice. The lever is the boundary.
1. Boundary compression. Rewrite tool output before it enters context: long file interiors become elision markers (…[217 lines omitted]…) that keep the model informed about what it ISN'T seeing, so it can re-request precisely.
2. Context budgeting. Cap retained output per tool call; let the agent re-run cheaply rather than carrying everything.
3. History hygiene. Summarize old turns instead of keeping them verbatim; agents rarely need the full transcript after a few turns.
QTK (open source, npm: @qalarc/qtk-plugin) implements boundary compression — per-session savings are charted on its project page. Run your own A/B: same task with and without compression, compare context usage, confirm task completion on YOUR workload. That last part is the only test that matters.
Tasks needing exact output verbatim — precise diff application, tiny-file work, anything where an omitted line breaks correctness. Compression is for exploratory agent sessions, not surgical ones.