Claude Code costs can surprise you if you're not tracking them. Here's how I've kept mine manageable.
The main cost drivers
Long CLAUDE.md files. Your CLAUDE.md loads into context on every message. A 600-line CLAUDE.md is a per-message token tax. Keep it under 100 lines. Put project documentation elsewhere — CLAUDE.md is for rules, not reference material.
Reading large files unnecessarily. If Claude reads a 2,000-line file to change 3 lines, you paid for 2,000 lines of context. Tell Claude exactly which function or section to look at.
Long sessions on large codebases. As a session progresses, context fills with previous conversation. On large codebases, sessions go stale. Start fresh sessions more often rather than extending one session indefinitely.
Auto-reading files on startup. If you've configured Claude to automatically read many files at session start, that's an upfront cost every session regardless of task. Read only what the current task needs.
What doesn't cost much
Claude Code with a Max subscription is a flat monthly fee — no per-token charges up to the usage limit. If you're on Max, these cost concerns are about hitting the usage cap, not API spend.
On API pay-as-you-go, the costs above matter more.
The practical approach
- Keep CLAUDE.md tight. Rules only, no documentation.
- Use .claudeignore aggressively. Keep node_modules, dist, lock files, and large data files out of Claude's view.
- Scope prompts to specific files. "Look at only src/auth/login.ts" is cheaper than "read the auth module."
- End sessions when they're complete. Don't let idle sessions accumulate context.
- Use sub-agents for isolated tasks. A short focused session costs less than a long sprawling one.
Tracking your usage
Check your Anthropic dashboard weekly. If a session cost significantly more than expected, look at what you had Claude read. The token usage breakdown shows where the cost went.
Top comments (0)