Skip to content

Pith

Pith is the hook that makes Claude Code sessions last 3x longer.

Install

$npm install output → 940 tokens baseline → 80 tokens compressed (−91%)

Install command taken from the project's README or registry entry. Always review code before running it.

Pith

Status: stable — not actively adding features. Bug fixes welcome via issues.

Token compression hooks for Claude Code. Install once, works in every session, zero config.

bash <(curl -s https://raw.githubusercontent.com/abhisekjha/pith/main/install.sh)

How it works

Four hooks attach to Claude Code's lifecycle. Every session, every project, automatically.

  • PostToolUse — compresses file reads, bash output, and grep results before they hit context
  • UserPromptSubmit — runs /pith commands, enforces token ceiling if set
  • SessionStart — restores compression mode, injects cache-locked rules
  • Stop — records token usage for status and report

The PostToolUse hook is where most savings happen — file reads alone account for 30–50% of context in a typical coding session.

Tool output What happens Typical saving
File reads skeleton only — imports, signatures, types −88% per read
Bash / build errors + summary, verbose logs discarded −91% per run
Grep results capped at 25 matches prevents runaway searches
Large payloads offloaded to ~/.pith/tmp/, pointer left in context prevents bloat

Core features

1 — Auto compression (zero config)

Runs automatically. No commands needed. Every file read, bash run, and grep gets compressed on the way back to Claude.

Real session numbers:

Read large-service.ts  →  1,800 tokens baseline  →  210 tokens compressed  (−88%)
npm install output     →    940 tokens baseline  →   80 tokens compressed  (−91%)

2 — Output modes

Control how Claude writes back to you.

/pith           → lean: drop filler, short synonyms, fragments OK
/pith ultra     → maximum: abbreviate, arrows, tables
/pith precise   → tight but full sentences
/pith off       → disable output compression

Auto-escalation kicks in as context fills — no manual switching needed:

50% fill → LEAN
70% fill → ULTRA
85% fill → dynamic token ceiling

3 — Token status

/pith status    → ASCII flow chart — baseline vs compressed vs output + plain-English savings
/pith report    → interactive HTML dashboard (auto-refreshes every 30s)

4 — Smart file focus

Load only the sections of a file relevant to your current question. Saves re-reading large files.

/focus src/services/auth.ts

Returns the 5 most relevant sections with a structure overview. Works on any file type.

5 — Symbol extraction

Pull exact function or class definitions without reading the whole file.

/pith symbol src/auth.ts handleLogin      → exact 30–50 lines (~95% vs full file)
/pith symbol --list src/auth.ts           → all symbols with line numbers

Install

# One-liner
bash <(curl -s https://raw.githubusercontent.com/abhisekjha/pith/main/install.sh)

# From source
git clone https://github.com/abhisekjha/pith
bash pith/install.sh

Hooks install globally into ~/.claude/hooks/. Active in every session from that point on.

Update:

/pith update    → git pull + re-sync hooks, commands, settings

Uninstall:

/pith uninstall

Advanced features

All present and functional. Not the daily workflow, but there when you need them.

Similar plugs

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies

Documented system prompts from Anthropic - Claude Fable 5.1, Opus 5.5, Claude Design, Claude Code. OpenAI - ChatGPT GPT-6-Astra, Codex. Google - Gemini 3.8 Flash, 3.1 Pro,…

Wrap Antigravity, ChatGPT Codex, Claude Code, Grok Build, Muse Code, Devin as an OpenAI/Gemini/Claude/Codex compatible API service, allowing you to enjoy the free Gemini…