~50% fewer tokens in a typical Claude Code session. Zero config. Install once — every project, forever.
bash <(curl -s https://raw.githubusercontent.com/abhisekjha/pith/main/install.sh)
git clone https://github.com/abhisekjha/pith && bash pith/install.sh
Pith intercepts Claude Code's session lifecycle at four points. Everything runs automatically — no config, no commands required.
The PostToolUse hook is where most savings happen — file reads alone account for 30–50% of context in a typical coding session. It runs on every tool call, silently, without interrupting your flow.
Pith also runs as two independent layers. The infrastructure layer is permanent — it activates on install and never turns off. The style compression layer is togglable — switch it on, off, or change modes mid-session without affecting anything else.
The biggest token sink isn't your prompts — it's tool output. Pith intercepts file reads, bash results, and grep matches before they hit the context window. Claude gets the signal, not the scroll.
Switch between modes instantly. Pith remembers your setting for the session — no flags, no config.
Pith watches your context window in real time and takes action before it causes problems — automatically ratcheting compression, flagging waste, and front-loading what future requests will need.
First session in a new project, Pith creates a wiki. Every decision, architecture choice, and bug resolution gets captured as you work — without interrupting your flow.
Architecture and technology choices with full context — why it was decided, what was rejected, and what it constrains.
Ideas, patterns, and principles — how they work, why they matter, open questions, and concrete examples.
People, tools, services, and components — key facts, connections to other entities, and source citations.
Analysis pages with a thesis, evidence, counter-evidence, and a confidence rating. For conclusions that span multiple sources.
/pith ingest <file> or --url <url>
Extracts entities, claims, contradictions from files or fetched URLs
Shows what will be created or updated — confirm before any write
Pages written, index.md updated, log.md appended
/pith compile re-synthesizes all sources into cross-linked wiki pages — one command after N ingests
/pith wiki "<question>"
Synthesizes answer with citations
/pith lint finds contradictions, gaps, missing pages, and imputable facts
After ingesting several sources, /pith compile re-reads all of them together and synthesizes cross-source wiki pages — evidence from multiple documents combined into a single, cited, cross-linked page. This is the Karpathy compile pass: raw/ in, wiki/ out.
Claude reads all raw/sources/ and identifies cross-cutting topics, synthesis opportunities, and gaps
Creates or updates wiki/concepts/ pages — each one cites every source it draws from
Topics implied by sources but not yet covered are recorded in log.md for follow-up
/pith compile --dry-run shows the full plan — topics, pages, gaps — without writing anything
/pith-graph scans every wiki page, extracts [[wikilinks]], and renders a zero-dependency interactive graph. No Obsidian, no framework. One command — browser opens instantly.
Hover any node — the entire graph dims to 10% opacity. Only the hovered node and its direct 1st-degree connections stay at full brightness. Instantly trace dependencies without visual noise.
Every node label sits on a semi-transparent dark pill that masks lines behind it. Stays legible at 50 nodes, 200 nodes, or more — no overlapping text.
One-click toggle between dark canvas and warm light mode. Pill backgrounds, text colours, and link tints all update live — no reload.
Nodes repel each other; links act as springs. Drag any node and the simulation reacts. Zoom and pan the full canvas. Ghost nodes show referenced-but-missing pages.
Emerald for decisions. Indigo for concepts. Amber for entities. Pink for syntheses. Each node has a matching glow so it pops off the dark canvas.
Output is a single standalone HTML file. D3.js from CDN. No install, no build step, no framework. Share the file with anyone — it runs anywhere.
Every wiki page Pith creates or updates carries YAML frontmatter linking back to the exact source — raw file, GitHub PR, or Claude session timestamp. If the AI hallucinates, you can trace it.
wiki/raw/sources/ are immutable — Pith never modifies them. The provenance block on derived pages always points back to the original. If a claim looks wrong, follow the chain.
/pith lint goes beyond broken links. Structural checks run instantly. The LLM pass finds semantic contradictions, missing entity pages, unlinked related pages, knowledge gaps, and facts that can be inferred from the wiki but aren't stated yet. --fix auto-creates stub pages. --quick skips the LLM.
--fix to create stub.[[rate-limiting]] to auth-middleware's Related section.One-shot formats that force Claude's output into a predictable, scannable structure. No summaries, no prose padding — just the signal.
Structured diagnosis for errors, crashes, and unexpected behaviour.
One line per issue. No summaries. Use for PRs, diffs, and file reviews.
Technology choices, design decisions, system design questions.
Feature planning, task breakdowns, sprint planning, implementation plans.
Conventional Commits format. Subject ≤50 chars. Reads staged diff automatically.
Interactive walkthrough of every Pith feature — hands-on, one step at a time, resumable.
Pith is installed once, globally. It activates automatically in every Claude Code project — no per-project setup, no CLAUDE.md edits required.
File reads return imports, signatures, and types — not every line. JSON outputs are serialised as TOON (~40% fewer tokens). Bash returns errors and a summary. Grep caps at 25 matches. Automatic, session-wide, always on.
Exact context window usage, mode, budget, and a full per-format savings breakdown — skeletons, bash/build, grep, TOON, web fetch, offload, output mode — each with a mini bar showing its share. Now includes an ASCII token flow diagram: baseline vs compressed vs output, showing exactly how much was intercepted and what arrived in context. Cost is split at the correct rate: tool compression at $3/1M, output mode savings at $15/1M. For a richer view, /pith report generates an interactive HTML dashboard.
History is summarised automatically before the context window fills. Sessions run indefinitely. No more "context limit reached" mid-task.
Four page types — Decision, Concept, Entity, Synthesis — written and maintained as you work. Cross-linked, sourced, and queryable at any time.
Force-directed D3.js graph of your entire wiki. Focus hover, pill labels, light/dark mode, zoom/pan, drag physics. Standalone HTML — zero dependencies.
Every wiki page carries a frontmatter block linking claims back to raw source files, GitHub PRs, or session timestamps. Hallucinations become traceable.
Detects contradictions between pages — not just broken links. Flags stale claims, orphan pages, missing source citations, and index mismatches.
Hard ceilings enforced by Pith — Claude won't exceed the limit without warning. Set with /budget 150, clear with /budget off.
Feed any file to the wiki with /pith ingest. Pith extracts entities, concepts, and contradictions, shows a diff, and waits for your confirmation before writing anything.
Mode, wiki state, and budget are saved on session exit — per project. Next session offers one-line restore. /pith recall restores mid-session. /pith configure walks through all settings interactively.
Install Pith without leaving Claude Code. /pith install locates the plugin, runs the installer, copies hooks, patches settings.json, registers slash commands, and verifies every step succeeded.
/pith uninstall removes hooks, slash commands, and all settings.json entries cleanly. Asks for confirmation first. Your project wikis and lifetime token history are preserved unless you explicitly request a full wipe.
Jump directly to any function, class, or method with /pith symbol <file> <name>. Returns the exact 30–50 lines of the definition — ~95% fewer tokens than reading the full file. Uses tree-sitter AST when available, regex fallback otherwise. Supports Python, TS/JS, Go, and more.
Tool outputs that exceed 300 tokens after compression are automatically written to ~/.pith/tmp/ and replaced with a 3-line pointer in context. Claude can read them on demand — nothing is lost, but large payloads never bloat the context window. Offloaded bytes tracked in /pith status.
When you /pith ingest a code file, Pith runs symbols.py --list first to extract the structural skeleton — imports, signatures, class outlines — then passes that to a code-aware analysis prompt instead of raw source lines. Creates Module and Class wiki pages with exports, key methods, and architectural dependencies rather than generic concept pages.
Scans the session's tool call telemetry for stale context: files read multiple times (only the latest matters), large bash outputs from early-session setup steps, results that are now irrelevant. Reports total stale token cost and recommends /compact. Fires automatically once when context passes 60%.
As context fills, Pith automatically ratchets the output mode up — switching to LEAN at 50% and ULTRA at 70%. At 85%, a dynamic response ceiling is injected equal to 8% of remaining headroom. Claude's responses stop growing the context window unchecked. Toggle with /pith escalate on|off.
Session-start injection is hashed (MD5, 8 chars). If settings are identical to the previous session, a single compact summary line is emitted instead of the full rules block — saving ~300 tokens per session start. Dynamic values (token counts, timestamps) are deliberately excluded from the hash, ensuring cache hits are true stability signals, not coincidences.
When /pith symbol extracts a function, it automatically scans the body for calls to other functions defined in the same file and appends their signatures — eliminating a follow-up round-trip in ~60% of lookups. Pairs with /pith report, which generates a standalone HTML dashboard (Chart.js) showing token flow, per-bucket savings, cost breakdown, and a compression event timeline.
Pith installs into ~/.claude/hooks/. Claude Code loads hooks globally — no per-project setup, no CLAUDE.md edits, no environment variables.
The curl command auto-clones Pith to ~/.local/share/pith and copies hooks into ~/.claude/hooks/pith/. Or: git clone https://github.com/abhisekjha/pith && bash pith/install.sh
Restart your Claude Code session. Pith hooks load automatically. No /enable command, no activation step.
Every tool call is now intercepted and compressed. Run /pith status to confirm. LEAN mode is active by default.
Already in a session? Run /pith install — Pith finds itself, runs the installer, verifies every step, and confirms. To remove: /pith uninstall.
Every time a session ends, Pith saves your mode, wiki state, and token budget. The next session opens with a single non-blocking offer to restore — one line, before your first message.
When a session closes, Pith writes the current mode, wiki state, and budget to a local state file. Nothing to configure — it happens on every session exit.
On the first message of a new session, Pith offers to restore — a single line before your question. Say yes, no, or just ignore it and keep working. It never delays you.
Forgot to restore at session start? /pith recall reads the saved state at any point and re-applies mode, wiki, and budget — confirmed in one line.
Shows current settings upfront. Walks through mode → wiki → budget → auto-compact, one question at a time. Each setting applies as you answer. Ends with a one-line summary.
State is saved per working directory. Your auth-service session restores ULTRA + budget=150. Your docs project restores PRECISE + no budget. They never cross.
The saved state file is plain JSON in your project root — human-readable, editable, committable to git if you want the whole team to share defaults.
Every command works inside any Claude Code session. Type it and go — no flags, no config files, no setup.
One command. Works in every Claude Code project from that point on.
bash <(curl -s https://raw.githubusercontent.com/abhisekjha/pith/main/install.sh)
git clone https://github.com/abhisekjha/pith && bash pith/install.sh