# How I Stopped Hitting Claude Code Usage Limits

> Source: <https://dev.to/md_ayanbag_03a42545b17ac/how-i-stopped-hitting-claude-code-usage-limits-3cfc>
> Published: 2026-10-24 18:37:04+00:00

"You've hit your usage limit." I saw that message three times in one week, every time in the middle of a task, with half-written code open in front of me.

So I stopped guessing and measured. I wrote a small script that reads Claude Code's own session logs on my Mac. The result was embarrassing: **my median session peaked at 252,696 tokens.** 160 of my 230 sessions that week went past 150k. My largest hit 967k.

*Note: I used Claude Code to help build the audit script and draft this post. The numbers and screenshots are from my own machine.*

Here is what was actually eating my limit, and the nine fixes that work. Most of them are free and take five minutes.

Claude Code re-sends the whole conversation to the model on every turn.

Your CLAUDE.md, every MCP tool definition, every file it opened, every test log it printed, every message you sent. Turn 80 pays for turns 1 to 79 again.

So your limit isn't eaten by your questions. It's eaten by **context size times number of turns**. A session sitting at 200k tokens carries ten times more per turn than one at 20k.

Every fix below shrinks one of those two numbers.

You can't manage what you only see when it's too late. Claude Code's status line receives your context percentage and, on Pro and Max, your 5-hour and weekly limit usage. Most people never turn it on.

Save this as `~/.claude/gauge.py`:

``` python
import json, sys
d = json.load(sys.stdin)
ctx = (d.get("context_window") or {}).get("used_percentage") or 0
rl = d.get("rate_limits") or {}
five = (rl.get("five_hour") or {}).get("used_percentage")
week = (rl.get("seven_day") or {}).get("used_percentage")
print(f"ctx {ctx:.0f}% | 5h {five or 0:.0f}% | week {week or 0:.0f}%")
```

Then add this to `~/.claude/settings.json` and restart:

```
"statusLine": {"type": "command", "command": "python3 ~/.claude/gauge.py"}
```

Now you see the problem building instead of meeting it at 100%.

This was my biggest leak. 137 of my sessions ran 80+ model turns, because I kept working in the same window all afternoon.

Finished a feature? Run `/clear` before the next one. Mid-task and context is above 60%? Ask Claude to write a short handoff note to a file (goal, what's done, next steps, key files), then `/clear` and point the new session at that note.

**/compact vs /clear:** compacting keeps a summary in the same session. It's fine once. Do it four times and you're dragging a blurry, still-heavy history around. A 40-line handoff plus a clear is cheaper, and you decide what survives.

One accidental read of a lockfile or a minified bundle can add tens of thousands of tokens that ride along for the rest of the session.

Add deny rules to your project's `.claude/settings.json`:

```
{
  "permissions": {
    "deny": [
      "Read(./node_modules/**)", "Read(./dist/**)", "Read(./build/**)",
      "Read(./package-lock.json)", "Read(./pnpm-lock.yaml)", "Read(./**/*.min.js)"
    ]
  }
}
```

And name exact places in your prompts. "Fix the null check in src/lib/auth.ts around getUser" costs a fraction of "fix the login bug".

CLAUDE.md is loaded on every single turn. So is every CLAUDE.md in parent folders, which surprised me: mine was quietly pulling in a 1,800-token file from my home folder.

Keep it to the stack, the commands, where things live, and the few gotchas that bit you before. Move long docs into a docs/ folder and reference them by path. Claude opens them only when it needs them.

Every MCP server injects its full tool list into context, on every turn. Run `/mcp` and disable what this project doesn't need. Three focused servers beat twelve "just in case" ones. The same goes for plugins you installed once and forgot.

Press Shift+Tab for plan mode on anything non-trivial. Fixing a wrong approach after 40k tokens of code costs far more than reading a 2k-token plan and saying "no, do it this way".

Batch your asks, too. One message with three clear changes beats three back-and-forth turns that each re-send everything.

Use your heaviest model for design and hard bugs, and switch with `/model` for renames, tests and docs.

Subagents can run on a lighter model too. Add `model: haiku` to an agent's frontmatter in `~/.claude/agents/` and send it the searching and boilerplate. The noise stays out of your main context.

Ponytail is a free, MIT-licensed skill that pushes Claude to reuse what exists and skip speculative abstractions, without dropping validation or security. Its published benchmark on real Claude Code tasks shows about 54% less code and about 22% fewer tokens. I've had it on for weeks.

Your feeling about usage is wrong. Mine was. Claude Code keeps every session as a JSONL file under `~/.claude/projects/`, with token counts on every response, so you can measure exactly how big your sessions get.

That's what my audit script does. It prints what your setup costs before you type a word, then your real session sizes for the week.

Doing all of this by hand on every machine got old, so I turned my setup into a kit. **Full disclosure: I built it and sell it.**

It has the full limit gauge with colours and reset timers, a hook that blocks junk reads automatically, a /handoff command that saves the note and reloads it after /clear, the audit script, a local cost dashboard, a lean CLAUDE.md template and a 3-page playbook. It installs with one command and uninstalls with one command.

Everything in this article works without it. If you'd rather have it set up in two minutes, it's here: [Claude Code Limit Saver Kit](https://mdayan.gumroad.com/l/claude-limit-saver?utm_source=devto&utm_campaign=usage-limits).

Your limit isn't spent on your questions. It's spent on carrying context. Watch the gauge, clear between tasks, block junk reads, keep CLAUDE.md lean, and measure.

What's your worst session? Run the numbers and tell me in the comments. I read every one.

*Originally published on [Medium](https://medium.com/@mdayan8/how-i-stopped-hitting-claude-code-usage-limits-9778e360873f).*
