Claude Code Token-Optimisation Stack workflow
An installer for a set of hooks, commands and plugins that compress tool output and save tokens in Claude Code.
- 95 ★ on the repository
- Last commit
- MIT
Broad access
Why this level
- The installer edits the global `settings.json` and `CLAUDE.md` and puts hooks on every tool call
- It downloads and runs third-party binaries and replaces the `claude` command with a wrapper
Install
- Works in
Manual install
git clone https://github.com/sgaabdu4/claude-code-tips.git && cd claude-code-tips && chmod +x install.sh && ./install.shThe first command in the README. For a smaller footprint add `--no-shell-wrapper` or `--no-caveman`.
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- The installer edits the global `settings.json` and `CLAUDE.md` and puts hooks on every tool call
- It downloads and runs third-party binaries and replaces the `claude` command with a wrapper
This is third-party code. Review the repository files before installing.
What it does
The repository collects the configuration behind an article on cutting Claude Code token use. The `install.sh` script installs five tools: the CBM code graph, the context-mode output sandbox, RTK shell output compression, the Headroom API-layer proxy and the Caveman plugin for terse Claude replies. On top sit hooks that forbid raw `grep` and `cat` in favor of the graph and intercept shell commands. The set includes the slash commands `/e2e`, `/e2e-auto`, `/unleash` and `/ship`, a statusline with context share and 5-hour and 7-day limits, and a shell wrapper that launches `claude` through Headroom. The install is idempotent: an existing `CLAUDE.md` and `settings.json` are merged and differing files get a `.bak` copy.
Who it is for. Experienced Claude Code users whose long sessions hit the context window and limits and who accept strict hooks.
Good fit when
- A 200K-token session runs dry in half an hour and you need three hours or more.
- Test and log output floods the context and you want the agent to get only the compressed version.
- You want a call graph over the code to avoid reading whole files.
- You want to verify hook wiring with `./install.sh --check` so that no hook points at a missing file.
Not a fit when
- You want a light setup without global hooks and a wrapper around `claude`: the stack is deliberately maximal.
- You do not want the installer to change `~/.claude/settings.json` and mix rules into `CLAUDE.md`.
- You need ready rules for your stack: the `rules/` folder is empty by design.
Example request
Install the token-saving set without the shell wrapper and verify the hooks with the check command.Limitations
The installer changes global Claude Code settings and adds third-party tools, each with its own license and updates. Running it requires `git`, `curl`, `jq` and `python3`. Windows is supported through Git Bash, and the `claude` wrapper on Windows is not verified in CI. The repository neither ships nor overwrites subagent definitions. The flags `--no-shell-wrapper`, `--no-caveman` and `--sonnet` narrow the scope, but the default set aims at aggressive savings and noticeably changes the setup.
How to disable. Remove the added hooks and the block between the `<!--cct-->` markers in `~/.claude/CLAUDE.md`, then restore the `.bak` copies of overwritten files. Plugins and binaries are installed separately and removed with their own commands.
FAQ
What does the installer put in place?
Headroom through `pipx`, RTK through Homebrew or its script, the CBM binary, the context-mode and Caveman plugins, hooks, commands, a statusline and a shell wrapper.
Can I leave the claude command alone?
Yes, `--no-shell-wrapper` installs Headroom and RTK and leaves `claude` untouched. API compression is then an explicit `headroom wrap claude` launch.
What happens to my settings?
`CLAUDE.md` is preserved and the set goes between markers. `settings.json` is merged with `jq` and your `model`, `permissions` and env keys stay.
Why do hooks go through run-cli-hook?
Claude Code spawns hooks without sourcing your shell, so `rtk` is not on PATH. The `hooks/run-cli-hook` shim finds the binary itself and exits quietly if it is missing.
How do I verify the install?
Run `./install.sh --check`: it validates hook paths, plugins in `enabledPlugins` and the scripts in `bin/`. Tests live in `tests/`.
Discussion
No questions or reviews yet.
Related
WorkflowsThe context-optimizer plugin shows Claude session cost, trims context and hands file reads and tests to cheap Haiku agents.
Skills, mods, subagents and hooks for Claude Code: the agent inspects your setup and installs what fits after your approval.
A Claude Code hook that translates Chinese, Japanese and Korean prompts to English and cuts 35–50% of tokens.
A local proxy and plugin for Claude Code and Codex that trims tool output, keeps the prompt cache warm and shows the savings
claude-mods adds 112 skills, 3 agents and 3 commands to Claude Code: stacks, agent operation, defense, session continuity.
A Claude Code plugin that replaces built-in file tools with lighter versions so a session spends fewer tokens
README in short
A set of configs and scripts behind an article on cutting Claude Code tokens by 90 percent or more. The README covers platforms, install flags, the hook map and the external tools.