HongruiLi5j

Claude Usage Saver — Development skill for Claude Code

Development community

Automatic Claude Code usage-saving kit (hooks, statu line, measurement) with a documented multi-agent opimization process.

How to install Claude Usage Saver

This entry records only its repository, not the path inside it, so there is no exact command to give. Open HongruiLi5j/claude-usage-saver and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Usage Saver does

Automatic Claude Code usage-saving kit (hooks, statu line, measurement) with a documented multi-agent opimization process.

Alternatives in Development

  • Claude Swap — Switch between multiple Claude Code accounts, with automatic rate-limit rotation, usage dashboard, and paralle 2k ★
  • Purpose — Orient yourself in pi-vs-cc — a collection of Pi coding agent extensions and agent specs that progressively de 527 ★
  • Claude Dashboard — Comprehensive status line plugin for Claude Code with context usage, API rate limits, and cost tracking 258 ★

README

claude-usage-saver

An automatic usage-saving kit for Claude Code subscription users: hooks, a status line, skills and measurement tools. The goal is to cut subscription quota consumption **without lowering answer quality** and **without asking the user to think about it**. The user's only manual step is typing `/clear` when the kit suggests it.

Why

An audit of my own local Claude Code transcripts (2026-10-21 → 11-06, about 4.1B tokens) found:

  • 98% of tokens were cache reads: every request re-sends the whole conversation history.
  • The median context per request was 113k tokens, and the most expensive sessions averaged 300k–470k.
  • Output was only 0.4%, so "write shorter replies" is not where the savings are.

The biggest lever is therefore **context length**: hand off and `/clear` early, then resume automatically.

Components

File Hook / role What it does
hooks/context_guard.py UserPromptSubmit Reads the last request's real token usage from the transcript. Past a threshold, it asks Claude to write a handoff file and tell the user to /clear. The threshold adapts to remaining weekly quota (plentiful / normal / tight) and to the project.
hooks/session_resume.py SessionStart (clear) After /clear, injects the project's HANDOFF.md plus an automatic digest of the previous transcript: owner messages, Claude's last replies, files edited. Any short follow-up like "1" or "ok" then continues the work.
hooks/test_filter.py PreToolUse (Bash) Rewrites test commands so Claude only sees failures and errors. The full log is saved to a file. Exit codes are preserved.
hooks/statusline.sh statusLine Shows context size, quota tier and a ⚠ warning before the threshold.
tools/weekly_compare.py report Weekly comparison of cost per request, split by main session vs. subagent and by model. Weights 1h cache writes at 2× and 5m cache writes at 1.25×.
tools/usage_report.py report Usage break