Use case · Context Saving

# I pay for 600 test results to fix 1. *Pay for the 1.*

Context Mode keeps the failing test and the summary, and folds the 599 passing tests into one line. On npm test with 600 tests, 17.0 KB becomes 1.2 KB. A Ruby minitest fix loop on Claude Opus 5.5 cost 61% less.

[Get started free](https://console.context-mode.com/login) [Read the docs](https://context-mode.com/docs/how-saving-works#compaction)

Your agent runs

npm test minitest Read back Cost

600 tests. 1 fails.

Printed **17.0 KB** Sent to the model **1.2 KB**

```
$ npm test
1 failing: the test and its assertion, as printed
… 599 passing tests folded (599 lines)
then a label: 599 passing tests folded, full output under an id, do NOT re-run the command
```

The failing test, its assertion and the summary line stay as printed.

Ruby, 401 tests. 1 fails.

Printed **16.2 KB** Sent to the model **0.7 KB**

Sent to the model

- The failing test and its error
- The summary line
- One line for the tests that passed

Kept in your archive

- All 401 results, word for word

Measured on the test fixtures of the folding A/B, Claude Haiku 4.5.

The agent needs one passing line after all. It asks your archive for it by id.

```
context-mode-search
{"docid":
 "context-mode-toolcap-<hash>-<length>"}
```

Sent to the model

- The lines it asks for

Kept in your archive

- The full output, under that id

No second test run. The label tells the agent not to run the command again.

Test fix loops, run with and without Context Mode. Cost per task.

Ruby minitest, direct **$0.157** Ruby minitest, Context Mode **$0.061**

[Ruby minitest fix loop · Claude Opus 5.5 **$0.157 → $0.061** *61% lower* 8 of 8 pairs](https://context-mode.com/docs/benchmarks) [npm test fix loop · Claude Opus 5.5 **$0.087 → $0.068** *22% lower* 15 of 16 pairs](https://context-mode.com/docs/benchmarks) [npm test fix loop · Claude Haiku 4.5 **$0.069 → $0.032** *53% lower* 12 of 12 pairs](https://context-mode.com/docs/benchmarks)

Your own Anthropic or OpenAI account pays the model. We add no fee on tokens.

The problem

## One test fails. *You pay tokens for all 600.*

**The full log goes in**

Your agent runs the tests, and the runner's output enters the conversation.

**It goes again on every call**

The agent sends the whole conversation to the model on each later call, so the passing lines are sent again and again.

**The fix loop repeats it**

Run the tests, fix the code, run them again. Each run adds one more full log.

How it works

## Keep the failure. *Fold the passes.*

1. 01 **Your agent runs the tests** As usual: `npm test`, `minitest -v` or another runner.
2. 02 **Context Mode folds the output** The failing test, its assertion and the summary line stay as printed. Passing tests fold into one counted line.
3. 03 **The full log stays in your archive** The short version names an id. The agent reads any line back with `context-mode-search`, with no second test run.

**Your agent**Runs `npm test`. The runner prints 17.0 KB: 600 tests, 1 failing.

→

**Context Mode**Folds the output the first time it goes through.

- Keeps the failing test and its assertion
- Keeps the summary line
- Folds 599 passing tests into one line
- Archives the full 17.0 KB under an id

→

**The model**Reads 1.2 KB, with the failure in full. Your own account pays for it.

Your agent sends the full test output. Context Mode, in blue, folds the passing tests before the model reads them. The full output stays in your archive.

Proof

## The same test fix loop, run twice. *Cost per task.*

**17.0 KB → 1.2 KB** npm test output, 600 tests, 1 failing

**61% lower** a Ruby minitest fix loop on Claude Opus 5.5, $0.157 to $0.061, 8 of 8 pairs

**53% lower** an npm test fix loop on Claude Haiku 4.5, $0.069 to $0.032, 12 of 12 pairs

| Test output | Context Mode | Direct |
| --- | --- | --- |
| npm test, 600 tests, 1 failing | 1.2 KB | 17.0 KB |
| Ruby minitest -v, 401 tests, 1 failing | 0.7 KB | 16.2 KB |

| Test fix loop, cost per task | Context Mode | Direct | Lower |
| --- | --- | --- | --- |
| Ruby minitest fix loop, Opus 5.5 | $0.061 | $0.157 | 61% |
| npm test fix loop, short, Opus 5.5 | $0.068 | $0.087 | 22% |
| npm test fix loop, Haiku 4.5 | $0.032 | $0.069 | 53% |

Paired runs at API list price, with the same task success with and without Context Mode. The output sizes come from the test fixtures of the folding A/B. Your own saving depends on your mix of work. [Method and sources →](https://context-mode.com/docs/benchmarks#test-debugging)

Products used

## What this *uses.*

**[Context Saving](https://context-mode.com/context-saving)**

Folds long tool output before the model reads it. Errors stay in full.

**[How saving works](https://context-mode.com/docs/how-saving-works)**

The 15 filters, the fold rules and the archive read-back.

**[Benchmarks](https://context-mode.com/docs/benchmarks)**

Every paired run, with its evidence file.

**[Plans](https://context-mode.com/pricing)**

Start free. Your own Anthropic or OpenAI account pays the model. We add no fee on tokens.

Related: [Cut agent spend](https://context-mode.com/solutions/cut-agent-spend) · [For developers](https://context-mode.com/solutions/developers) · [Long sessions](https://context-mode.com/solutions/long-sessions)

## Try it on your *next test run.*

*npx @context-mode/cli* connects your agents. 1,000 requests free, no card.

[Get started free →](https://console.context-mode.com/login) [Read the docs →](https://context-mode.com/docs/how-saving-works#compaction)
