Claude Code & Context Engineering

Claude Code Cost Optimisation: 9 Usage Habits That Cut Spend Without Changing Your Plan

22 November 2026 · Updated 28 November 2026 · 11 min read · by Yang Kai

Cut Claude Code costs through habits, not settings: prompt shape, file scoping, session timing and model discipline — a daily checklist for cheaper finished work.

Checklist inside: Habit tracker checklist for cheaper sessions

Contents
  1. Why habits are where the money goes
  2. Habits 1–3: shape the prompt before you send it
  3. Habits 4–6: scope files and context deliberately
  4. Habits 7–9: time your sessions and pick the model on purpose
  5. Habit tracker checklist
  6. Weekly Claude Code habit tracker (tick per session)
  7. What this looks like in practice
  8. The verdict

Two people can hold the same Claude Code plan, work in similar repos, and get wildly different amounts of finished work from it. One person’s allowance lasts the week. The other’s is gone by Wednesday, spent on sessions that searched half the repo, polished past the point the task needed, or ran a flagship model on renaming work.

The difference is rarely the plan. It is the shape of the prompts, the size of the context each request drags along, and how long sessions keep running after the task is done.

This article covers the habit layer only: nine habits, grouped into prompt shape, context scoping, and session timing. No settings changes, no plan changes. The pricing mechanics underneath come from Anthropic’s published API rates and plan pages, checked November 2026 — where a number appears below, it is Anthropic’s. Where a savings figure would normally appear, we leave the space blank on purpose: the habit tracker further down is how you measure your own pattern instead of borrowing someone else’s percentage.

The short version:

Habit group Habits What it removes
Shape the prompt 1–3 The search-and-discard phase, and open-ended polishing
Scope the context 4–6 Files read “just in case”, and the fixed tax on every request
Time and route the work 7–9 Cold restarts, swollen sessions, wrong-tier spend

Why habits are where the money goes

Three mechanics from Anthropic’s pricing explain almost every habit in this article.

Output costs five times input. On every current model, output tokens are priced at five times the input rate. The API rates, checked November 2026:

Model (API, per million tokens) Input Output
Claude Opus 5.5 $4.00 $20.00
Claude Sonnet 5.5 $2.00 $10.00
Claude Haiku 5.5 (prompts up to 100K tokens) $0.10 $0.50

Output is where an agent writes code, explains itself, and retries. A session that wanders produces more of the expensive token type, not just more tokens.

Context is re-sent on every turn — but caching changes the maths. Claude Code caches the conversation prefix automatically. On the current models, reading that cached prefix costs a fraction of the fresh input rate — 0.05× on Opus 5.5 and Sonnet 5.5, 0.1× on Haiku 5.5 (checked November 2026). A warm, focused session is therefore much cheaper per turn than its raw token count suggests. Stale context still costs something on every turn, though, and it still steers the model’s attention.

On a plan, the same waste shows up as allowance. Pro ($20 a month, or $17 billed annually), Max ($100 a month) and Ultra ($200 a month) — prices checked November 2026 — meter usage in five-hour and weekly windows rather than dollars. The habits below stretch that allowance exactly the way they stretch an API budget. The plan-versus-API decision itself is a separate question, covered in the Claude Code cost ladder.

Habits 1–3: shape the prompt before you send it

Habit 1: name the files, not the feature area

“Fix the login bug in src/auth/session.ts — the refresh path around line 80” costs a fraction of “fix the login bug.” The second version pays for the agent to search, read, and discard half the repo before touching anything. You usually know roughly where the problem lives. Saying so is free.

Habit 2: state the done condition in the prompt

“…and stop when npm run test passes for the auth suite” prevents the most expensive behaviour in agent work: open-ended polishing. An agent without a stopping rule will keep finding improvements, and every improvement is billed — mostly in output tokens, the expensive kind. A done condition also makes the result checkable, which is worth as much as the saving.

Habit 3: ask for the plan on big tasks, then approve the cheap version

A one-paragraph plan costs almost nothing and routinely reveals that the agent was about to take the scenic route — a new abstraction here, a refactor on the way there. Approving the direct route in advance is the most valuable thirty seconds in a session. On large changes, this is also where a hybrid model setup earns its keep; the routing mechanics live in the settings that cut cost.

The plan does not need a special mode to be useful — asking “give me the plan before you touch anything” in the first prompt is enough. But if you do this often, plan mode exists for exactly this shape of work: the agent explores, you approve, then it builds. Either way, the economics are the same: a paragraph of plan is the cheapest output tokens you will buy all day, because they redirect every token that follows.

Habits 4–6: scope files and context deliberately

When you know a task touches one subsystem, say which one, and say what is out of bounds. Unscoped exploration is the silent line item in most heavy sessions — the agent is not wasting your money maliciously, it is being thorough in a repo where thoroughness is expensive. The context budget audit covers what loads automatically at startup; this habit covers what loads because you let the agent wander.

The out-of-bounds line matters as much as the target. “Fix the refresh bug in src/auth/ — do not touch the billing module, it is mid-migration” prevents the most expensive detour in agent work: a well-meant improvement to code that was deliberately left alone. One sentence in the prompt is cheaper than one revert afterwards, in tokens and in trust.

Habit 5: paste the error, not the investigation

The exact error message and the twenty lines around it beat “the build is broken, can you look?” every time — in cost and in fix quality. The same applies to code: paste the relevant function rather than asking the agent to fetch the file, when you already have it open. Every fetched file enters the context and stays there for the rest of the session.

Habit 6: keep CLAUDE.md lean, and turn repeats into skills

A bloated project file is a tax on every single request, including “rename this variable,” because it loads into every session. Keep it to the rules you would otherwise repeat daily — the CLAUDE.md guide covers the structure. Anything longer that only matters for one kind of task belongs in a skill, which loads only when it is relevant; how Claude Code skills work explains that loading model.

Habits 7–9: time your sessions and pick the model on purpose

Habit 7: batch small tasks together, split big tasks apart — and keep the cache warm

Session startup re-loads context, so five tiny questions in five sessions pay that overhead five times. There is a second reason to keep related work close together: on API billing, the prompt cache that makes a running session cheap has a five-minute default lifetime. Walk away for an hour and the next message re-pays full input price for the history the cache had been discounting.

The opposite failure is the marathon session: context swells, compaction kicks in, and the agent re-reads things it already knew. A useful rhythm is one session per coherent task, closed with a short written summary while the work is fresh — the same handoff habit behind keeping context across long projects.

When a task genuinely runs long, compact on your terms rather than the tool’s. Triggering compaction yourself, at a natural break and with a line about what must survive it, keeps the decisions and edge cases a generic summary tends to drop. A summary you directed costs one turn; a summary imposed mid-debugging costs the thread you were holding.

Habit 8: separate the thinking-heavy step from the typing-heavy step

Architecture questions deserve your best model and full attention. Once the approach is settled, the mechanical implementation — renaming, scaffolding, applying an agreed pattern — is where a lighter model tier often produces the same merged result. Exploration is the clearest case: send it to a subagent on a cheaper model and only the summary enters your main context, an arrangement priced out in subagents vs one long session. Decide the tier per task, not by default.

A rough routing table, to adapt rather than obey:

Task shape Tier that usually finishes it in one pass
Architecture, gnarly debugging, high-stakes review Your strongest tier
Ordinary feature work, test writing, refactors with a settled pattern The mid tier — the sensible default
Search, summarising, bulk mechanical edits, first-pass exploration The lightest tier, often inside a subagent

The failure mode the table prevents is not overspending on one hard task. It is the flagship quietly becoming the default for a hundred easy ones.

Habit 9: stop sessions that loop; do not supervise them hopefully

A looping agent converts budget into heat. The signatures are recognisable — oscillating edits, repeated retries of the same failing command, endless searching — and the loop-diagnosis checklist gives you the interventions. Restarting with a tight brief is almost always cheaper than watching a drift continue, because the drift is paid for in output tokens at five times the input rate.

Habit tracker checklist

Print this and score a week honestly. The point is not perfection; it is finding which two habits are your leak.

## Weekly Claude Code habit tracker (tick per session)
Prompt shape
[ ] I named the file(s) or subsystem in the first prompt
[ ] I stated a done condition (command/test/behaviour)
[ ] For big tasks, I reviewed a plan before code changed
Scoping
[ ] I pasted the exact error instead of describing it vaguely
[ ] I declared anything explicitly out of bounds
[ ] I did not let the agent explore the whole repo "to be safe"
Session timing
[ ] Small related questions batched into one session
[ ] Session closed with a summary/handoff, not abandoned
[ ] Looping session stopped and restarted with a brief
Model discipline
[ ] Model tier chosen for THIS task, not left on default
End of week: which unchecked box appeared most? Fix that one first.

What this looks like in practice

As an illustration — not a measurement — take a routine bug fix two ways. Unscoped, the session opens with a repo-wide search, reads a dozen files to find the right one, fixes the bug, then tidies three neighbouring functions nobody asked about. Scoped, the first prompt names the file and the failing test; the session reads two files, makes one change, and stops. The code produced is the same. The difference is the search-and-discard phase and the unrequested polish, both of which are paid for at output rates.

Priced with the checked Sonnet 5.5 rates, the shape looks like this. Say the unscoped session processes 300K tokens of fresh input across its turns and writes 60K of output: roughly $0.60 of input plus $0.60 of output, about $1.20 before caching discounts. The scoped version, at 60K fresh input and 25K output, is roughly $0.12 plus $0.25 — about $0.37. The token counts are invented for the example; the rates are not. The point is where the gap comes from: not the fix itself, which is identical, but the exploration before it and the polish after it. Your repo will differ in size, not in shape — which is why the tracker above measures your pattern rather than quoting ours.

FAQ

What is the single habit that saves the most with Claude Code? Scoping the first prompt: naming the files and the done condition. It removes the exploration phase and the open-ended polishing phase, which are the two largest avoidable costs in most sessions.

Does starting a new session save money or waste it? Both, depending on length. A fresh session re-pays the context-loading cost, and after a long pause the prompt cache has expired too — so batch small tasks together. But a very long session pays more through swollen context and compaction. One session per coherent task is the practical middle.

Should I always use the cheapest model tier available? No. Use the tier that finishes the task in one pass. A cheap tier that needs three correction rounds on a hard reasoning task can cost more than a strong tier that gets it right first time — match the tier to the task’s difficulty, not to a blanket rule.

Do these habits matter on a subscription plan, where tokens are not billed individually? Yes. Plans meter usage in five-hour and weekly windows, and a wasteful session burns the same window a productive one does. The currency is allowance instead of dollars, but the leak is identical.

The verdict

Habits are the layer no plan upgrade can fix. Shape the prompt, scope the context, and time the session, and the same plan produces more finished work — then set the ceiling properly with the settings that cut cost.

Learn more:

Category: Claude Code & Context Engineering · Tags: #claude-code #pricing #context-engineering #checklist

Next step: this article is part of Claude Code guides, which covers the full topic from first setup to advanced use.

Related guides

Claude Code & Context Engineering

How to Point Claude Code at a Free Gemini API Key (and What You Lose)

Claude Code has no official Gemini mode — but a local router can translate its requests to a free Gemini API key. The exact setup from Anthropic's env-var docs and the router's repo, what breaks in translation, and when the trade is worth it.

11 min read

Claude Code & Context Engineering

Cursor vs Claude Code: Editor Agent or Terminal Agent?

Cursor vs Claude Code compared on working surface, Tab completions, context handling, long tasks, automation and pricing — with a winner per criterion and a decision worksheet.

13 min read