Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By Balance0014 Verifiedv0.1.1MITIn 2 marketplaces
Shows how much of your Claude Code usage goes to re-reading long conversations, reminds you when a session gets heavy, and writes a handoff note so /clear doesn't lose your place.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
No risk signals detected
Nothing flagged in this plugin's hooks, MCP servers or commands. Other components are not analyzed.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
2 marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Find out how much of your Claude Code usage goes to re-reading long conversations, and get told when it's time to /clear.
中文说明 · MIT · Python 3.9+, no dependencies · reads local files only · by Balance Zhao
This is a local report, a Claude Code Stop hook, and a handoff skill for people whose Claude Code usage gets eaten by long conversations. It reads the token counts already saved in your sessions, shows how much of the work happened after the context got large, reminds you when it's time to /clear, and can write a handoff note so a new session can pick up where you left off. Nothing is sent anywhere.
Install in Claude Code:
/plugin marketplace add Balance0014/claude-code-when-to-clear
/plugin install when-to-clear@when-to-clear
That adds the /clear reminder and the handoff skill. The usage report runs from a clone: python3 when_to_clear.py.
Every reply re-sends the whole conversation. Caching cuts the price of that to a tenth, but at 400k tokens even "ok, go on" re-reads 400k tokens before the model writes a word.
I ran the report on my own sessions on October 28, 2026. Over the last 7 days (93 transcripts, including subagents, and 9,981 replies):
Over 30 days, 90% of the work was past 200k, and restarting there would have saved 37%.
1. The report. Clone the repo (or download when_to_clear.py) and run:
python3 when_to_clear.py
when-to-clear · last 7 days · 93 transcripts · 9,981 replies
Tokens re-read as context: 2.9B
81% of the work happened while a conversation was over 200k tokens.
Starting fresh at 200k with a short handoff note would have saved about 27% (119 restarts).
Long conversations were re-sent from scratch 90 times, 90 of them after a break of 5+ minutes (9% of the work).
A new session holds about 71k tokens by its first reply (system prompt, tools, MCP servers, CLAUDE.md, memory, your first message).
Heaviest sessions:
...
Options: --days 30, --at 150k to try a different restart size, --dir for another transcripts folder, --json for raw numbers.
2. The reminder. A Stop hook. When a conversation passes 200k tokens, you get a short note:
when-to-clear: this conversation is at 348k tokens, and every reply re-reads all of it.
At your next stopping point, ask Claude to write a handoff note, then /clear and paste it.
With the default 200k, it reminds you again every 100k (300k, 400k and so on), once per level. It never blocks anything.
3. The handoff skill. Say "write a handoff." The agent writes HANDOFF.md: what's done (with proof), what's in progress, what's not started, the next step, what it's blocked on, the branch, and uncommitted changes, plus a few lines of context the code can't tell you. Then:
/clear
Read HANDOFF.md and continue from Next step.
Claude Code, as a plugin (reminder and handoff skill):
/plugin marketplace add Balance0014/claude-code-when-to-clear
/plugin install when-to-clear@when-to-clear
Then start a new session. The report isn't part of the plugin; run it from a clone as shown above.
Without the plugin system: add the reminder to ~/.claude/settings.json, with --at set to the size you want:
{
"hooks": {
"Stop": [{ "hooks": [{ "type": "command", "command": "python3 /path/to/when_to_clear.py hook --at 200k" }] }]
}
}
Other agents: npx skills add Balance0014/claude-code-when-to-clear installs the handoff skill.
The report reads the token counts Claude Code already saves with every reply in ~/.claude/projects. "Work" weights each token the way the API prices it, relative to a fresh input token: cache reads 0.1×, cache writes 1.25× (the 5-minute cache price), output 5×. Anthropic doesn't publish how plan limits weigh each kind, so read the percentages as shares of the work, not as exact plan usage.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
Plugins from other owners that cover similar ground
npx claudepluginhub balance0014/claude-code-when-to-clear --plugin when-to-clear