{
  "markdown": "# Pith\n\n[![GitHub Stars](https://img.shields.io/github/stars/abhisekjha/pith?style=social)](https://github.com/abhisekjha/pith/stargazers)\n\n> **Status: stable — not actively adding features.** Bug fixes welcome via issues.\n\nToken compression hooks for Claude Code. Install once, works in every session, zero config.\n\n```bash\nbash <(curl -s https://raw.githubusercontent.com/abhisekjha/pith/main/install.sh)\n```\n\n---\n\n## How it works\n\nFour hooks attach to Claude Code's lifecycle. Every session, every project, automatically.\n\n- **`PostToolUse`** — compresses file reads, bash output, and grep results before they hit context\n- **`UserPromptSubmit`** — runs `/pith` commands, enforces token ceiling if set\n- **`SessionStart`** — restores compression mode, injects cache-locked rules\n- **`Stop`** — records token usage for `status` and `report`\n\nThe `PostToolUse` hook is where most savings happen — file reads alone account for 30–50% of context in a typical coding session.\n\n| Tool output | What happens | Typical saving |\n|-------------|-------------|----------------|\n| File reads | skeleton only — imports, signatures, types | −88% per read |\n| Bash / build | errors + summary, verbose logs discarded | −91% per run |\n| Grep results | capped at 25 matches | prevents runaway searches |\n| Large payloads | offloaded to `~/.pith/tmp/`, pointer left in context | prevents bloat |\n\n---\n\n## Core features\n\n### 1 — Auto compression (zero config)\n\nRuns automatically. No commands needed. Every file read, bash run, and grep gets compressed on the way back to Claude.\n\nReal session numbers:\n```\nRead large-service.ts  →  1,800 tokens baseline  →  210 tokens compressed  (−88%)\nnpm install output     →    940 tokens baseline  →   80 tokens compressed  (−91%)\n```\n\n### 2 — Output modes\n\nControl how Claude writes back to you.\n\n```\n/pith           → lean: drop filler, short synonyms, fragments OK\n/pith ultra     → maximum: abbreviate, arrows, tables\n/pith precise   → tight but full sentences\n/pith off       → disable output compression\n```\n\nAuto-escalation kicks in as context fills — no manual switching needed:\n```\n50% fill → LEAN\n70% fill → ULTRA\n85% fill → dynamic token ceiling\n```\n\n### 3 — Token status\n\n```\n/pith status    → ASCII flow chart — baseline vs compressed vs output + plain-English savings\n/pith report    → interactive HTML dashboard (auto-refreshes every 30s)\n```\n\n![/pith status — token flow chart, compression ratio, cost breakdown](assets/status-screenshot-v1.2.png)\n\n### 4 — Smart file focus\n\nLoad only the sections of a file relevant to your current question. Saves re-reading large files.\n\n```\n/focus src/services/auth.ts\n```\n\nReturns the 5 most relevant sections with a structure overview. Works on any file type.\n\n### 5 — Symbol extraction\n\nPull exact function or class definitions without reading the whole file.\n\n```\n/pith symbol src/auth.ts handleLogin      → exact 30–50 lines (~95% vs full file)\n/pith symbol --list src/auth.ts           → all symbols with line numbers\n```\n\n---\n\n## Install\n\n```bash\n# One-liner\nbash <(curl -s https://raw.githubusercontent.com/abhisekjha/pith/main/install.sh)\n\n# From source\ngit clone https://github.com/abhisekjha/pith\nbash pith/install.sh\n```\n\nHooks install globally into `~/.claude/hooks/`. Active in every session from that point on.\n\n**Update:**\n```\n/pith update    → git pull + re-sync hooks, commands, settings\n```\n\n**Uninstall:**\n```\n/pith uninstall\n```\n\n---\n\n## Advanced features\n\nAll present and functional. Not the daily workflow, but there when you need them.\n\n| Feature | Command | What it does |\n|---------|---------|-------------|\n| Project wiki | `/pith ingest <file>` | Extract entities, claims, decisions into `wiki/` |\n| URL ingestion | `/pith ingest --url <url>` | Fetch and ingest a web page |\n| Wiki query | `/pith wiki \"question\"` | Search wiki with citations |\n| Wiki synthesis | `/pith compile` | Re-synthesize all sources into wiki pages |\n| Wiki lint | `/pith lint` | Find contradictions, gaps, missing pages |\n| Knowledge graph | `/pith-graph` | Visual graph of wiki entities in browser |\n| jCodeMunch | auto on code files | Structure-aware ingest — skeleton not full source |\n| Token ceiling | `/budget 150` | Hard token cap, enforced every prompt |\n| Structured formats | `/pith debug` / `review` / `arch` / `plan` / `commit` | Output templates |\n| Tour | `/pith tour` | 7-step interactive walkthrough |\n| Health check | `/pith health` | Diagnose hook and config issues |\n| Evals | `python evals/harness.py` | Run compression benchmark (needs API key) |\n\n---\n\n## Honest numbers\n\nEstimates against real usage — not against \"no system prompt.\"\n\n```\nBefore Pith:  Read large-service.ts → 1,800 tokens\nAfter Pith:   Read large-service.ts →   210 tokens   (−88%)\n\nBefore Pith:  npm install output    →   940 tokens\nAfter Pith:   errors + summary      →    80 tokens   (−91%)\n```\n\nSession from real use:\n- 19.9k input tokens (237.9k baseline without Pith)\n- 218k tokens saved — 92% compression ratio\n- $0.07 actual vs $3.33 without Pith — **47× cost ROI**\n\nSee [BENCHMARKS.md](BENCHMARKS.md) for methodology and raw numbers.\n\n---\n\n## Multi-model pricing\n\nPith detects the model automatically and applies correct rates. No config needed.\n\n| Model | Input ($/MTok) | Output ($/MTok) |\n|-------|---------------|----------------|\n| Claude Opus 4.7 / 4.6 / 4.5 | $5.00 | $25.00 |\n| Claude Sonnet 4.6 / 4.5 / 4 | $3.00 | $15.00 |\n| Claude Haiku 4.5 | $1.00 | $5.00 |\n| Claude Haiku 3.5 | $0.80 | $4.00 |\n\nFalls back to Sonnet 4.6 rates if model can't be determined.\n\n---\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=abhisekjha/pith&type=Date)](https://star-history.com/#abhisekjha/pith&Date)\n\n---\n\n## License\n\nMIT\n",
  "bytes": 5731,
  "sha": "0bb12e3848c71c07b44d95231e25d7338135912c1d89656db5ed208a485b6b33",
  "repo_slug": "abhisekjha/pith",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_abhisekjha_pith_pith_1a8a7256/readme"
}