Claude Code hook

Claude Code Tips

Token-optimisation stack for Claude Code — CBM + context-mode + RTK + Headroom + Caveman + enforcement hooks

92 stars 19 forksHooks Source

Install

From source
git clone https://github.com/sgaabdu4/claude-code-tips.git

From the README

Claude Code Token-Optimisation Stack

Configs + hooks + scripts for Medium post: "How I Cut Claude Code Token Usage by 90%+".

This repo is intentionally a power-user default: it assumes you want aggressive token control, enforcement hooks, and a local shell wrapper. If you want the full stack, run the default installer. If you want less global surface area, use the opt-out flags below.

Post: claude-code-tips.md

Stack: CBM (code graph) + context-mode (output sandbox) + RTK (shell compression) + Headroom (API-layer) + Caveman (Claude output) + enforcement hooks. ~30min → 3h+ sessions, same 200K window.

Platforms

Every push runs the full installer end to end on macOS, Linux and Windows, then asserts the binaries it claims to have installed are actually resolvable. Badge above.

On Windows the installer rewrites every hook command to an absolute bash.exe plus an absolute script path, because a native Claude Code is a Node process and can spawn hooks through cmd.exe, which expands neither ~ nor a shebang. CI asserts all 18 installed commands resolve under cmd.exe and Git Bash alike. It pins the full path rather than a bare bash on purpose: C:\Windows\System32\bash.exe is the WSL launcher and often sits ahead of Git's on PATH, which would run your hooks against a different filesystem.

One caveat left. The shell wrapper is only exercised as --no-shell-wrapper in CI, so aliasing claude on Windows is still unverified.

Install

Sanity-checks git/curl/jq/python3 upfront. Installs Headroom (pipx, falling back to pip --user), RTK (Homebrew, or the rtk-ai install script), CBM binary, context-mode + Caveman plugins via claude plugin install, hooks, slash commands, statusline, settings, shell wrapper for your $SHELL. Idempotent — re-run anytime.

Power-user flags

Default stays…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
Shell
License
MIT
Last updated
31 October 2026

FAQ

What is Claude Code Tips?

Token-optimisation stack for Claude Code — CBM + context-mode + RTK + Headroom + Caveman + enforcement hooks It is a hook for Claude Code, from sgaabdu4/claude-code-tips on GitHub.

How do I install Claude Code Tips?

Clone sgaabdu4/claude-code-tips from GitHub and follow the setup steps in its README.

Is Claude Code Tips popular?

sgaabdu4/claude-code-tips has 92 GitHub stars and 19 forks. It was last updated on 31 October 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.