Claude Code
authorKRIATIZ
04 · In practice / lesson 2 of 2

Costs and context

20 minIntermediate5 steps

Every agent step reads the whole current context. So costs depend less on the number of requests and more on how much the agent drags along at each step. Here are the techniques that actually save.

data and requestsproblem
Lesson stepsstep 1 of 5
  1. Every step
  2. History
  3. Files
  4. CLAUDE.md
  5. Summary
step 1 / 5problem

Every step reads the whole context

Costs depend on how much the agent drags along: history, files, logs.

Key point

Bigger context = more expensive steps.

← → steps · space pause · R restart · ⌘K search
You will learn 5
Lesson notes

What drives costs

  • Input context at every step: system instructions, CLAUDE.md, history, files read, command output.
  • Model output: reasoning and code.
  • The model: more capable models cost more per token.

On a Pro or Max subscription you pay a fixed price but have usage limits. On the API you pay per token. Either way, saving context means more work for the same money.

Techniques that work

TechniqueWhy it saves
/clear between unrelated tasksthe agent doesn’t carry the previous task’s history
/compact in a long taskcompresses history while keeping the essence
@file referencesno steps spent on searching
Subagents for explorationhundreds of files stay in the subagent’s context
A short CLAUDE.mdit loads into every request
A simpler model for simple tasksrenames and formatting don’t need the strongest model
Unused MCP servers turned offtool descriptions take up context

What wastes limits

  • One session all day for a dozen different tasks.
  • "Read the whole project" when it isn’t needed.
  • Pasting long logs and dumps in full. Paste the relevant lines.
  • Vague tasks that make the agent do and redo.

How to watch costs

/context shows what fills the context. On the API, the Anthropic Console shows spend by day and key. For teams, split keys by project to see where money goes.

The biggest saving usually comes from a clear task, not a cheaper model: an agent that understood the task the first time takes half the steps.

Course summary

You went from installation to hooks. The next step is to apply it all on one real project: CLAUDE.md, permissions, one skill, a reviewer subagent, a formatter hook. After that the agent works in your repository like a team member who knows the rules.

Today's task

For one day use /clear between tasks and @ references. In the evening compare how much of your limits is left versus the day before.

Want to cut your team’s Claude Code costs?

I will analyse how your team uses the agent and set up rules, models and subagents to save.

Let’s talk
Vladyslav Koshelyev
Vladyslav Koshelyev

Developer at KRIATIZ. I build chatbots, websites and automation for businesses. Author of the course.

About the author · Telegram