← All recipes
  • context
  • workflow
  • cost

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 Bar is the average, dots are the individual runs.
One session$0.095Clear between$0.131

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.