By abhisekjha
Reduces Claude Code token usage by compressing tool output 40–60%, auto-compacting context at 70% capacity, and displaying a live token meter. Structures project knowledge in a persistent wiki (Markdown), generates one-shot plans, code reviews, commit messages, and debug reports, and visualizes wiki links as an interactive graph.
Set a hard token ceiling per response (e.g. /budget 100) or clear it (/budget off)
Load only the sections of a file relevant to the current question, reducing context noise
Run the Pith wiki graph generator for the current project. Scans wiki/ for .md files, extracts [[wikilinks]], and opens an interactive force-directed graph in the browser as wiki-graph.html.
Control Pith token compression modes and access structured output formats, wiki, and status
Pith onboarding conversation. Runs on first session in a new project. Introduces Pith, offers wiki setup, guides through initialization. Injected by session-start.js when no prior setup detected.
Interactive guided tour of Pith. Walks the user through each feature experientially — one step at a time, hands-on, using their actual project. Resumable. Skippable. State tracked via tour.py.
One-shot architecture decision format. Use for technology choices, design decisions, system design questions. Format: Decision / Options table / Choice / Risks / Next. Does not persist.
One-shot commit message generator. Conventional Commits format, subject ≤50 chars. Use when writing a git commit message for staged changes. Does not persist.
One-shot structured debug format. Use when diagnosing errors, unexpected behavior, crashes, or failures. Format: Problem / Cause / Fix / Verify — 4 fields, no prose. Does not persist.
Matches all tools
Hooks run on every tool call, not just specific ones
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
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)
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 contextUserPromptSubmit — runs /pith commands, enforces token ceiling if setSessionStart — restores compression mode, injects cache-locked rulesStop — records token usage for status and reportThe 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 |
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%)
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
/pith status → ASCII flow chart — baseline vs compressed vs output + plain-English savings
/pith report → interactive HTML dashboard (auto-refreshes every 30s)

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.
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
# 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
All present and functional. Not the daily workflow, but there when you need them.
| Feature | Command | What it does |
|---|---|---|
| Project wiki | /pith ingest <file> | Extract entities, claims, decisions into wiki/ |
| URL ingestion | /pith ingest --url <url> | Fetch and ingest a web page |
| Wiki query | /pith wiki "question" | Search wiki with citations |
| Wiki synthesis | /pith compile | Re-synthesize all sources into wiki pages |
| Wiki lint | /pith lint | Find contradictions, gaps, missing pages |
| Knowledge graph | /pith-graph | Visual graph of wiki entities in browser |
| jCodeMunch | auto on code files | Structure-aware ingest — skeleton not full source |
| Token ceiling | /budget 150 | Hard token cap, enforced every prompt |
| Structured formats | /pith debug / review / arch / plan / commit | Output templates |
| Tour | /pith tour | 7-step interactive walkthrough |
| Health check | /pith health | Diagnose hook and config issues |
| Evals | python evals/harness.py | Run compression benchmark (needs API key) |
Estimates against real usage — not against "no system prompt."
Before Pith: Read large-service.ts → 1,800 tokens
After Pith: Read large-service.ts → 210 tokens (−88%)
Before Pith: npm install output → 940 tokens
After Pith: errors + summary → 80 tokens (−91%)
npx claudepluginhub abhisekjha/pith --plugin pithOpen-source, local-first Claude Code plugin for token reduction, context compression, and cost optimization using hybrid RAG retrieval (BM25 + vector search), reranking, AST-aware chunking, and compact context packets.
Claude Code context optimizer. Builds a local static repo graph, injects ranked file:line candidates through a UserPromptSubmit hook, and adds a SessionStart prewarm brief. No embeddings, no server, no telemetry. Measured live A/B: 40.9% aggregate token reduction across 36 Claude Code calls. v2.10 structural slicing: a PreToolUse hook intercepts whole-file reads and hands Claude the file's outline (symbols + exact line ranges from the graph) so it reads the 40 lines it needs, not 800 that get re-sent every turn. Receipts (/savings) measure both sources — searches avoided and big reads sliced — causally from your transcript.
45% cost reduction measured. Cache expiry prevention, SubTask auto-delegation, zero-cost context restoration, real-time cost dashboard. The only Claude Code plugin built from CC source analysis.
AST-powered code compression for LLMs. Send 89% fewer tokens, get the same understanding. Parses your code with tree-sitter, keeps the signal, drops the noise.
Evaluate and optimize .claude/ directory token efficiency. Reduce cost, improve response quality.
Governor: always-on compact professional output, telemetry, context slimming, tool-output filtering, prompt guidance, and drift guardrails for Claude Code Max users.