К основному содержанию
плагин

pith — плагин для Claude Code: что делает и как установить

pith сжимает вывод инструментов, показывает расход токенов и переключает режимы ответа. Он пригодится в длинных сессиях Claude Code.

Установить в Claude Code · Через маркетплейс плагинов Все способы и платформы ↓
/plugin marketplace add anthropics/claude-plugins-community
/plugin install pith@claude-community
Открыть на GitHub

Что делает pith

pith подключает четыре хука Claude Code. PostToolUse сокращает чтение файлов, вывод bash и результаты grep; UserPromptSubmit обрабатывает команды /pith; SessionStart восстанавливает режим сжатия, а Stop записывает расход токенов. Большие данные выносятся в ~/.pith/tmp/, а в контексте остаётся указатель.

Плагин умеет показывать статистику через /pith status и HTML-отчёт через /pith report, выделять релевантные части файла командой /focus и извлекать символы через /pith symbol. Режимы LEAN, ULTRA и PRECISE меняют формат ответа, а проектную вики можно собирать командами /pith ingest, /pith wiki и /pith compile.

Хуки устанавливаются глобально в ~/.claude/hooks/, поэтому настройки действуют в каждой сессии и каждом проекте. Для запуска оценочного скрипта python evals/harness.py нужен API-ключ; сам плагин ставится через маркетплейс Claude Code.

Какие задачи решает

  • сократить вывод чтения больших файлов
  • отфильтровать длинные логи сборки
  • ограничить результаты grep
  • показать расход токенов сессии
  • извлечь символ из файла без полного чтения

Примеры запросов агенту

  • Покажи расход токенов текущей сессии через /pith status.
  • Извлеки определение handleLogin из src/auth.ts командой /pith symbol src/auth.ts handleLogin.
  • Собери вики из README.md командой /pith ingest README.md.

Как установить pith

Через маркетплейс плагинов

/plugin marketplace add anthropics/claude-plugins-community
/plugin install pith@claude-community

По шагам, с командами для каждой платформы: Плагины Claude Code: маркетплейсы, установка и как собрать свой

Вопросы о pith

Как установить pith в Claude Code?

Добавьте маркетплейс командой /plugin marketplace add anthropics/claude-plugins-community, затем установите плагин: /plugin install pith@claude-community.

Что делает pith?

Плагин сжимает вывод чтения файлов, bash и grep, управляет режимами ответа и ведёт статистику токенов. Также он умеет работать с проектной вики и извлекать символы из файлов.

Где pith устанавливает хуки?

Хуки устанавливаются глобально в ~/.claude/hooks/ и работают в каждой сессии Claude Code.

Исходный текст

SKILL.md · MIT
# Pith

[![GitHub Stars](https://img.shields.io/github/stars/abhisekjha/pith?style=social)](https://github.com/abhisekjha/pith/stargazers)

> **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
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)
```

![/pith status — token flow chart, compression ratio, cost breakdown](assets/status-screenshot-v1.2.png)

### 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

```bash
# 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.

| 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) |

---

## Honest numbers

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%)
```

Session from real use:
- 19.9k input tokens (237.9k baseline without Pith)
- 218k tokens saved — 92% compression ratio
- $0.07 actual vs $3.33 without Pith — **47× cost ROI**

See [BENCHMARKS.md](BENCHMARKS.md) for methodology and raw numbers.

---

## Multi-model pricing

Pith detects the model automatically and applies correct rates. No config needed.

| Model | Input ($/MTok) | Output ($/MTok) |
|-------|---------------|----------------|
| Claude Opus 4.7 / 4.6 / 4.5 | $5.00 | $25.00 |
| Claude Sonnet 4.6 / 4.5 / 4 | $3.00 | $15.00 |
| Claude Haiku 4.5 | $1.00 | $5.00 |
| Claude Haiku 3.5 | $0.80 | $4.00 |

Falls back to Sonnet 4.6 rates if model can't be determined.

---

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=abhisekjha/pith&type=Date)](https://star-history.com/#abhisekjha/pith&Date)

---

## License

MIT

© abhisekjha · MIT · abhisekjha/pith

Похожие плагины

Все плагины по теме «Настройка агента: память, контекст, субагенты» →
token-saver ppgranger Сжимает длинный вывод терминала в сессиях Claude Code, убирая лишние логи и индикаторы прогресса. Освобождает контекст под код без сетевых запросов. ★ 161звёзд репо token-optimizer-mcp ooples MCP-сервер сжимает содержимое запросов к агенту и может выносить несжимаемые блоки в файл. Пригодится, когда контекст разрастается из-за логов, результатов поиска или повторных чтений. CX Codex +1 ★ 563звёзд репо caveman-token-optimizer reason-machines Скилл заставляет ИИ-агента отвечать в стиле пещерного человека: без вводных фраз и вежливости. Экономит примерно 65% выходных токенов, код и термины остаются точными. CX Codex +1 842установок cost-compact-context ruvnet Скилл оборачивает getTokenOptimizer().getCompactContext() для анализа затрат на токены. Извлекает сжатый контекст из ReasoningBank, показывает, сколько токенов удалось сэкономить, и выясняет, доступен ли agent-booster. CX Codex +1 726установок rtk akillness Ставит и настраивает RTK (Rust Token Killer), чтобы вывод shell-команд доходил до агента в укороченном виде. Пригодится, когда контекст забивается логами и диффами. CX Codex +1 671установок token-optimizer D4kooo Набор процедур для агентов OpenClaw: изоляция фоновых задач, локальный RAG и протокол Reset & Summarize, чтобы контекст не разрастался. CX Codex +1 495установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой