DEV Community

Henry Godnick
Henry Godnick

Posted on

How to make Claude Code's usage limits last longer: 9 practical habits

Disclosure: I build TokenBar, a Mac menu bar app that tracks AI usage. It comes up once near the end. Everything else here works without it, and most of it comes straight from Anthropic's own cost docs.

If you're on a Pro or Max plan, the limit you hit isn't a dollar amount. It's a session window that resets every five hours and a weekly limit, and they're shared with everything else you do in Claude, including chats on claude.ai. When you run out halfway through a refactor, it's usually not because you asked for too much. It's because each request carried far more context than it needed.

Here's the key fact: Claude Code sends your whole conversation with every request, and every tool call sends another request carrying those results. Prompt caching makes re-reading that history cheaper, but it isn't free. A one-line question in a session that's been open all day still draws usage for the entire conversation.

Almost every habit below comes back to that.

1. /clear between unrelated tasks

This is the biggest win and the one people skip. If you've finished fixing a bug and now want to write docs, the old bug context is dead weight on every later message.

/rename auth-bugfix   # so you can find it later
/clear                # start fresh, costs nothing
/resume               # come back to the old one if you need it
Enter fullscreen mode Exit fullscreen mode

The docs say it plainly: stale context wastes tokens on every message that follows, and /clear costs nothing.

2. Compact on purpose, and tell it what to keep

/compact summarizes the conversation so far to free up space, but compacting is itself a large request, because it has to read everything it's summarizing. So don't compact out of habit. Do it when you want to keep going on the same task, and give it instructions:

/compact Keep the failing test names, the final schema, and the files we changed
Enter fullscreen mode Exit fullscreen mode

You can also set default instructions in CLAUDE.md:

# Compact instructions

When you are using compact, please focus on test output and code changes
Enter fullscreen mode Exit fullscreen mode

If you don't need continuity, /clear is cheaper than /compact.

3. Mind the cache after a break

Prompt caching is why long sessions are affordable at all. On a subscription, the cache lasts an hour (it drops to five minutes once you're drawing on usage credits). Your first message after a longer break misses the cache and reprocesses your full context.

In practice, if you're coming back to a huge session after lunch, it's often cheaper to /clear and restate the task in a few lines than to type "ok, continue" into a cold 200k-token conversation. /usage now shows a prompt cache line with your hit rate and whether the cache is warm, so you can check before you decide.

4. Match the model to the job

Anthropic's own advice: Sonnet handles most coding tasks well and costs less than Opus, so save Opus for complex architecture decisions and multi-step reasoning. Switch mid-session with /model, or set a default in /config.

Two details worth knowing:

  • Switching to Opus also applies to subagents that inherit your session's model. For simple subagent work, set model: haiku in the subagent config.
  • If you hit a model-specific limit ("You've hit your Opus limit"), switching to another model family keeps you working. If you hit your session or weekly limit, switching models won't help, because those are shared across models.

5. Turn thinking down for easy tasks

Extended thinking is on by default because it helps with planning and hard reasoning, but thinking tokens are billed as output tokens, and the default budget can be tens of thousands of tokens per request. Renaming a variable doesn't need that.

Lower it with /effort (or from /model) for routine work. Some models always use extended thinking, so effort level is the control that works everywhere.

6. Shrink what loads every session

Some context gets loaded before you've typed anything:

  • CLAUDE.md is loaded at session start. The docs suggest keeping it under about 200 lines. Move detailed workflow instructions (PR reviews, migrations, release steps) into skills, which only load when they're used.
  • MCP servers add overhead. Tool definitions are deferred by default, but server names and instructions still go in. Run /mcp and disable the servers you're not using. When there's a CLI for something (gh, aws, gcloud, sentry-cli), it's more context-efficient than an MCP server.

Run /context to see what's actually filling your window. It's often a surprise.

7. Be specific, and plan before you build

"Improve this codebase" makes Claude scan broadly. "Add input validation to the login function in auth.ts" lets it read a couple of files and get to work.

For bigger changes:

  • Press Shift+Tab to switch to plan mode first. Claude explores and proposes an approach, so you don't pay for an implementation going the wrong way.
  • Press Escape as soon as it heads off course, and use /rewind (or double-tap Escape) to go back to a checkpoint.
  • Give it a way to check itself: a test to pass, an expected output, a screenshot. Fewer "that's still broken" round trips means fewer tokens.

8. Keep noisy output out of the main conversation

A 10,000-line test log in your context gets re-sent with every later message. Two ways to avoid that:

  • Hooks. A PreToolUse hook can rewrite test commands to return only the failures, cutting tens of thousands of tokens down to hundreds. The cost docs include a ready-made filter-test-output.sh example for npm test, pytest and go test.
  • Subagents. Hand verbose work (running tests, reading docs, digging through logs) to a subagent so only a summary comes back. Subagent requests still count toward your usage, so pair this with a smaller model.

9. Watch what runs when you're not typing

Some usage happens in the background:

  • Scheduled tasks and /loop fire on their interval even when the session is idle, sending your full context each time.
  • Agent teams use about 7x more tokens than a normal session when teammates run in plan mode, because each one has its own context. Keep teams small and shut teammates down when they're done.
  • Long-idle sessions can wake up for cross-session messages or goal check-ins, and each of those is a full-context turn.

Then, once a week, open /usage and look at the breakdown. On paid plans it shows how your recent usage splits across skills, subagents, plugins and MCP servers, lists your heaviest loops, and flags any behavior (like long context or cache misses) that's 10% or more of your usage, with a tip to fix it. Press d or w to switch between the last day and the last week. It only counts this machine, so claude.ai chats and other computers won't show up there.

The common thread: notice before you hit the wall

Every habit above is easier when you can see your usage climbing while you work, not after you get cut off. /usage is free and official. I got tired of checking it, so I built TokenBar, which keeps Claude, Codex and other providers' usage and cost in the Mac menu bar. A free tracker or a status line works too. What matters is having the number in view.

If I had to pick just three habits: /clear between tasks, Sonnet by default, and a short CLAUDE.md. Those three cover most of the waste I've seen.

What's the habit that saved you the most? I'm collecting tips for a follow-up.

Top comments (0)