← All recipes

Unrelated tasks, same answer on /clear

Our last test found staying in one session cheaper for related tasks. We repeated it with three unrelated tasks in different parts of a codebase. Staying still won on cost, with one catch.

Cost per run Each bar is the average cost of the runs, starting at $0.

See every run, check and diff →

In our first context test, staying in one session beat clearing between tasks by 28%. But all three tasks touched the same files, the best case for staying. The fair follow-up: what if the tasks have nothing to do with each other?

The setup

A small notes API: about 470 lines across 24 files (routes, services, middleware and utilities). Three tasks, each in a different part of the code:

  1. Fix a bug where dates show the wrong month, and add a test. (A utility file.)
  2. Add pagination to GET /notes with page and pageSize (default 5, max 50). (A route and its tests.)
  3. Write a new rate-limiter middleware from a spec, with tests. (A new file.)

We ran them two ways, 3 times each:

  • One session: all three tasks in one continuous conversation.
  • Clear between: a fresh session for each task, which is what /clear gives you.

What happened

One session Clear between
Month bug fixed (hidden test) 3 of 3 3 of 3
Pagination matches our spec (hidden test) 2 of 3 3 of 3
Rate limiter correct (hidden test) 3 of 3 3 of 3
Average total cost $0.145 $0.176
Cost of task 1 (same in both setups) $0.054 $0.060
Cost of task 2 $0.063 $0.074
Cost of task 3 $0.029 $0.041
Average turns 21.7 24.7

Claude Code 2.1.296, Sonnet 5.5, 3 runs per column. Every run, check and diff: run data.

What we learned

Staying was still cheaper, by less. One session averaged 17% less than clearing, down from 28% when the tasks were related. Task 1 starts fresh either way, so its small gap is run-to-run noise; the real difference is in tasks 2 and 3. That fits what cached history does: even context that doesn’t help the next task costs little to carry in a codebase this size.

The “failure” was most likely our wording, not the session. In one single-session run, Claude rejected a pageSize over 50 with an error instead of capping it at 50. Our prompt said “max 50”, which supports either reading, and our hidden test assumed capping. We count it as a miss because it doesn’t match our spec, but the lesson is about wording: write “cap at 50” or “reject above 50”, not “max 50”.

Context grew, but never got big. By the end of the single session, the conversation carried about 28,000 tokens, against 20,000 to 25,000 for a fresh one. That’s small next to the context window, which is why it stayed cheap. In a large codebase with long tasks, the numbers could flip, and we haven’t tested that yet.

The recipe

  1. In a small codebase, don’t clear just because the topic changed. It cost more here, even for unrelated tasks.
  2. Clear when the old context gets big or misleading. Run /context to see what’s in the window. A long debugging session or a pile of file dumps from a finished task is the time to clear or /compact.
  3. Say exactly what limits mean. “Max 50” got two different behaviours from the same model. Cap, reject or clamp: pick one and write it down.

Keep reading

All recipes →
  • Verified

    $0.326 → $0.204per five-feature build: a fresh session per feature vs one continued session

    One long chat or a fresh session per feature? Same pass rate, 37% cheaper in one chat

    We had Claude Code build the same five features in order, either all in one continued session or in a fresh session per feature, 3 runs each. Both setups passed all 11 checks in 2 of 3 runs, each missing once on the trickiest feature. The one long chat averaged $0.204 per five-feature build against $0.326, and finished in 76.3 seconds against 106.5. At five small features it never got near compaction.

    • context
    • workflow
    • cost
  • Verified

    14% cheaperto stay in one session on a 197-file repo; every hidden test passed both ways

    /clear on a bigger repo: one session was still cheaper

    We reran our /clear test on a 197-file codebase with 14 feature modules, up from 24 files last time. All 24 hidden-test checks passed both ways. Staying in one session cost 14% less ($0.137 vs $0.159 a run).

    • context
    • workflow
    • cost
  • Verified

    28% cheaperto stay in one session than to clear between tasks

    Is /clear worth it? Not for small, related tasks

    Three small tasks in the same files, run in one long session or with a fresh session each time. Same results, but clearing cost more, because the long session's context was cached.

    • context
    • workflow
    • cost

Compare this test with every other one on the scoreboard.