← All recipes

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.

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

See every run, check and diff →

The usual advice is to /clear between tasks so you stop paying for old context. We measured it, and for small related tasks the advice was wrong.

The setup

A small cart module and three tasks, all in the same couple of files:

  1. Add a discount(items, percent) function, with a test.
  2. Add an itemCount(items) function, with a test.
  3. Write a README documenting every exported function and how to run the checks.

We ran the three tasks 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
All checks pass (hidden tests, README, lint) 3 of 3 3 of 3
Average total cost $0.095 $0.131
Cost of task 1 $0.062 $0.054
Cost of task 2 $0.016 $0.038
Cost of task 3 $0.016 $0.040
Average turns 19 21.7

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

What we learned

The quality was the same. Every run passed every check, including hidden tests Claude never saw.

Old context was cheap because it was cached. Earlier messages are sent again with each request, but Claude Code caches them, and cached input is billed at a fraction of the normal rate. In the long session, tasks 2 and 3 cost about $0.016 each.

Clearing made Claude start over. Each fresh session had to read the code again before it could do anything. That re-reading cost more than carrying the cached history, so clearing came out about 38% more expensive overall.

This was a best case for staying. All three tasks touched the same files, so the old context was useful. We haven’t yet measured unrelated tasks, or very long sessions where old context crowds out the work.

The recipe

  1. Don’t clear reflexively. If the next task is in the same part of the code, staying in the session is cheaper and just as good.
  2. Clear when you switch areas. A new task in unrelated code gains nothing from the old context. /clear keeps your CLAUDE.md loaded.
  3. Check what’s filling the window. /context shows it. If most of it is a finished, unrelated task, that’s the time to clear or compact.
  4. Compact when one task runs long. /compact with a hint keeps what matters, for example /compact keep the schema decisions and the list of files still to change.
  5. Plan big changes first. Shift+Tab cycles into plan mode, where Claude reads and proposes without editing.

Unrelated tasks and compacting are next on our list to test.

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

    17% cheaperto stay in one session, even with unrelated tasks

    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.

    • context
    • workflow
    • cost

Compare this test with every other one on the scoreboard.