Context Saving
Pay for the failing test, not the 599 that passed.
Context Saving folds long tool output before the model reads it. Errors stay in full. The rest is archived, one lookup away.
Your agent runs 600 tests. 1 fails.
Sent to the model
- The failing test and its error
- The summary line
- One line for the 599 that passed
Kept in your archive
- All 600 results, word for word
Your agent reads an API response with 800 orders.
Sent to the model
- Every field name
- The first 3 orders and the last
- A line that counts the rest
Kept in your archive
- The other 796 orders
One session, 30 steps. Tokens sent on each call.
Sent to the model
- Your recent work, unchanged
- An index of older work
Kept in your archive
- Older work, word for word
17 KB printed. 1.2 KB read.
- 01Your agent runs a command
Tests, builds, logs, big JSON.
- 02Context Mode folds the output
Errors and summaries stay as printed.
- 03The model reads less
And can read the full output back by id.
The same task, run twice. Cost per task.
Test fix loop, minitest
61% lower
npm test fix loop
22% lower
One large log
22% lower
One large JSON file
21% lower
Paired runs, Claude Opus 5.5, at API list price. Method and sources →
Folded the first time the model sees it.
Failures stay, passing tests become one line.
Every key stays. Long arrays keep 3 items and the last.
Your stack frames stay; library frames fold.
A result changes once, so later requests reuse the cache.
Use cases: Failing test output · Keep the prompt cache warm
Try it on your next test run.
npx @context-mode/cli connects your agents. 1,000 requests free, no card.