Skip to content
Back to search

pith

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

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/abhisekjha--pith/badge.svg)](/listings/abhisekjha--pith)

HTML

<a href="/listings/abhisekjha--pith"><img src="/api/listings/abhisekjha--pith/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

# 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

---

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 16 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "name": "pith",
  3. "owner": {
  4. "name": "Abhisek Jha",
  5. "url": "https://github.com/abhisekjha/pith"
  6. },
  7. "plugins": [
  8. {
  9. "name": "pith",
  10. "description": "Token optimization for Claude Code. Automatic tool output compression (40-60% token reduction), token meter in statusline, auto-compact at 70% context, structured output formats, and a self-building project wiki.",
  11. "category": "productivity",
  12. "source": "./",
  13. "homepage": "https://github.com/abhisekjha/pith"
  14. }
  15. ]
  16. }
README.md · README · 185 lines · 2 findings marked

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Pith
  2. [![GitHub Stars](https://img.shields.io/github/stars/abhisekjha/pith?style=social)](https://github.com/abhisekjha/pith/stargazers)
  3. > **Status: stable — not actively adding features.** Bug fixes welcome via issues.
  4. Token compression hooks for Claude Code. Install once, works in every session, zero config.
  5. ```bash
  6. bash <(curl -s https://raw.githubusercontent.com/abhisekjha/pith/main/install.sh)
    • Note: Runs a downloaded script through process substitution (bash <(curl …))
    • Line 10 on GitHub
  7. ```
  8. ---
  9. ## How it works
  10. Four hooks attach to Claude Code's lifecycle. Every session, every project, automatically.
  11. - **`PostToolUse`** — compresses file reads, bash output, and grep results before they hit context
  12. - **`UserPromptSubmit`** — runs `/pith` commands, enforces token ceiling if set
  13. - **`SessionStart`** — restores compression mode, injects cache-locked rules
  14. - **`Stop`** — records token usage for `status` and `report`
  15. The `PostToolUse` hook is where most savings happen — file reads alone account for 30–50% of context in a typical coding session.
  16. | Tool output | What happens | Typical saving |
  17. |-------------|-------------|----------------|
  18. | File reads | skeleton only — imports, signatures, types | −88% per read |
  19. | Bash / build | errors + summary, verbose logs discarded | −91% per run |
  20. | Grep results | capped at 25 matches | prevents runaway searches |
  21. | Large payloads | offloaded to `~/.pith/tmp/`, pointer left in context | prevents bloat |
  22. ---
  23. ## Core features
  24. ### 1 — Auto compression (zero config)
  25. Runs automatically. No commands needed. Every file read, bash run, and grep gets compressed on the way back to Claude.
  26. Real session numbers:
  27. ```
  28. Read large-service.ts → 1,800 tokens baseline → 210 tokens compressed (−88%)
  29. npm install output → 940 tokens baseline → 80 tokens compressed (−91%)
  30. ```
  31. ### 2 — Output modes
  32. Control how Claude writes back to you.
  33. ```
  34. /pith → lean: drop filler, short synonyms, fragments OK
  35. /pith ultra → maximum: abbreviate, arrows, tables
  36. /pith precise → tight but full sentences
  37. /pith off → disable output compression
  38. ```
  39. Auto-escalation kicks in as context fills — no manual switching needed:
  40. ```
  41. 50% fill → LEAN
  42. 70% fill → ULTRA
  43. 85% fill → dynamic token ceiling
  44. ```
  45. ### 3 — Token status
  46. ```
  47. /pith status → ASCII flow chart — baseline vs compressed vs output + plain-English savings
  48. /pith report → interactive HTML dashboard (auto-refreshes every 30s)
  49. ```
  50. ![/pith status — token flow chart, compression ratio, cost breakdown](assets/status-screenshot-v1.2.png)
  51. ### 4 — Smart file focus
  52. Load only the sections of a file relevant to your current question. Saves re-reading large files.
  53. ```
  54. /focus src/services/auth.ts
  55. ```
  56. Returns the 5 most relevant sections with a structure overview. Works on any file type.
  57. ### 5 — Symbol extraction
  58. Pull exact function or class definitions without reading the whole file.
  59. ```
  60. /pith symbol src/auth.ts handleLogin → exact 30–50 lines (~95% vs full file)
  61. /pith symbol --list src/auth.ts → all symbols with line numbers
  62. ```
  63. ---
  64. ## Install
  65. ```bash
  66. # One-liner
  67. bash <(curl -s https://raw.githubusercontent.com/abhisekjha/pith/main/install.sh)
    • Note: Runs a downloaded script through process substitution (bash <(curl …))
    • Line 99 on GitHub
  68. # From source
  69. git clone https://github.com/abhisekjha/pith
  70. bash pith/install.sh
  71. ```
  72. Hooks install globally into `~/.claude/hooks/`. Active in every session from that point on.
  73. **Update:**
  74. ```
  75. /pith update → git pull + re-sync hooks, commands, settings
  76. ```
  77. **Uninstall:**
  78. ```
  79. /pith uninstall
  80. ```
  81. ---
  82. ## Advanced features
  83. All present and functional. Not the daily workflow, but there when you need them.
  84. | Feature | Command | What it does |
  85. |---------|---------|-------------|
  86. | Project wiki | `/pith ingest <file>` | Extract entities, claims, decisions into `wiki/` |
  87. | URL ingestion | `/pith ingest --url <url>` | Fetch and ingest a web page |
  88. | Wiki query | `/pith wiki "question"` | Search wiki with citations |
  89. | Wiki synthesis | `/pith compile` | Re-synthesize all sources into wiki pages |
  90. | Wiki lint | `/pith lint` | Find contradictions, gaps, missing pages |
  91. | Knowledge graph | `/pith-graph` | Visual graph of wiki entities in browser |
  92. | jCodeMunch | auto on code files | Structure-aware ingest — skeleton not full source |
  93. | Token ceiling | `/budget 150` | Hard token cap, enforced every prompt |
  94. | Structured formats | `/pith debug` / `review` / `arch` / `plan` / `commit` | Output templates |
  95. | Tour | `/pith tour` | 7-step interactive walkthrough |
  96. | Health check | `/pith health` | Diagnose hook and config issues |
  97. | Evals | `python evals/harness.py` | Run compression benchmark (needs API key) |
  98. ---
  99. ## Honest numbers
  100. Estimates against real usage — not against "no system prompt."
  101. ```
  102. Before Pith: Read large-service.ts → 1,800 tokens
  103. After Pith: Read large-service.ts → 210 tokens (−88%)
  104. Before Pith: npm install output → 940 tokens
  105. After Pith: errors + summary → 80 tokens (−91%)
  106. ```
  107. Session from real use:
  108. - 19.9k input tokens (237.9k baseline without Pith)
  109. - 218k tokens saved — 92% compression ratio
  110. - $0.07 actual vs $3.33 without Pith — **47× cost ROI**
  111. See [BENCHMARKS.md](BENCHMARKS.md) for methodology and raw numbers.
  112. ---
  113. ## Multi-model pricing
  114. Pith detects the model automatically and applies correct rates. No config needed.
  115. | Model | Input ($/MTok) | Output ($/MTok) |
  116. |-------|---------------|----------------|
  117. | Claude Opus 4.7 / 4.6 / 4.5 | $5.00 | $25.00 |
  118. | Claude Sonnet 4.6 / 4.5 / 4 | $3.00 | $15.00 |
  119. | Claude Haiku 4.5 | $1.00 | $5.00 |
  120. | Claude Haiku 3.5 | $0.80 | $4.00 |
  121. Falls back to Sonnet 4.6 rates if model can't be determined.
  122. ---
  123. ## Star History
  124. [![Star History Chart](https://api.star-history.com/svg?repos=abhisekjha/pith&type=Date)](https://star-history.com/#abhisekjha/pith&Date)
  125. ---
  126. ## License
  127. MIT
hooks/prompt-submit.js · Bundled script · 621 lines · 1 finding marked
  1. #!/usr/bin/env node
  2. 'use strict';
  3. // Pith — UserPromptSubmit hook
  4. // Parses /pith commands, tracks token estimates, injects per-message context.
  5. const fs = require('fs');
  6. const path = require('path');
  7. const { execFileSync } = require('child_process');
  8. const { loadConfig, loadProjectState, saveProjectState, pluginRoot } = require('./config');
  9. const OUTPUT_MODES = new Set(['lean', 'precise', 'ultra', 'off']);
  10. // Subcommands handled entirely by Claude Code skill files — hook just skips them
  11. const SKILL_CMDS = new Set(['debug', 'review', 'arch', 'plan', 'commit', 'install', 'uninstall']);
  12. // Read actual token counts from the current session's transcript JSONL.
  13. // transcript_path may be provided by Claude Code; if not, we derive it from session_id + cwd.
  14. function syncTranscriptTokens(data) {
  15. try {
  16. const os = require('os');
  17. let transcriptPath = data.transcript_path;
  18. if (!transcriptPath && data.session_id) {
  19. const cwd = data.cwd || process.env.CLAUDE_CWD || process.cwd();
  20. const slug = cwd.replace(/\//g, '-');
  21. const dir = path.join(os.homedir(), '.claude', 'projects', slug);
  22. const file = path.join(dir, `${data.session_id}.jsonl`);
  23. if (fs.existsSync(file)) transcriptPath = file;
  24. }
  25. if (!transcriptPath || !fs.existsSync(transcriptPath)) return;
  26. // Output: sum all turns (each turn's output is independent)
  27. // Input: use ONLY the latest assistant entry — each turn's input already
  28. // includes full conversation history, so summing causes massive double-count
  29. let outputTokens = 0, latestInputTokens = 0;
  30. const lines = fs.readFileSync(transcriptPath, 'utf8').split('\n');
  31. for (const line of lines) {
  32. if (!line.trim()) continue;
  33. try {
  34. const d = JSON.parse(line);
  35. if (d.type === 'assistant' && d.message && d.message.usage) {
  36. const u = d.message.usage;
  37. outputTokens += u.output_tokens || 0;
  38. // Overwrite each time — last entry wins (= current context size)
  39. latestInputTokens = (u.input_tokens || 0)
  40. + (u.cache_read_input_tokens || 0)
  41. + (u.cache_creation_input_tokens || 0);
  42. }
  43. } catch (_) { /* skip malformed line */ }
  44. }
  45. if (outputTokens > 0 || latestInputTokens > 0) {
  46. saveProjectState({
  47. output_tokens_est: outputTokens,
  48. output_tokens_actual: outputTokens,
  49. // input = current context window size (latest turn only)
  50. ...(latestInputTokens > 0 ? { input_tokens_est: latestInputTokens } : {}),
  51. });
  52. }
  53. } catch (_) { /* silent — never block a session */ }
  54. }
  55. // Parse optional --slash <prefix> flag. When set, stdin is treated as the
  56. // raw argument text (not JSON), and the prompt is built internally as
  57. // `${prefix} ${stdin}`. This lets slash-command .md files pipe user arguments
  58. // in via a heredoc instead of embedding them into a shell-quoted JSON string,
  59. // which eliminates shell-injection via quotes/$()/backticks in user input.
  60. const argv = process.argv.slice(2);
  61. let slashPrefix = null;
  62. for (let i = 0; i < argv.length; i++) {
  63. if (argv[i] === '--slash' && i + 1 < argv.length) {
  64. slashPrefix = argv[i + 1];
  65. if (!/^\/[A-Za-z0-9_-]+$/.test(slashPrefix)) {
  66. process.stderr.write('[PITH: --slash prefix must match /[A-Za-z0-9_-]+]\n');
  67. process.exit(2);
  68. }
  69. i++;
  70. }
  71. }
  72. let raw = '';
  73. process.stdin.on('data', c => { raw += c; });
  74. process.stdin.on('end', () => {
  75. try {
  76. let data;
  77. if (slashPrefix) {
  78. // stdin is raw user-typed argument text; strip one trailing newline
  79. const args = raw.replace(/\n$/, '');
  80. data = { prompt: args ? `${slashPrefix} ${args}` : slashPrefix };
  81. } else {
  82. data = JSON.parse(raw);
  83. }
  84. const prompt = (data.prompt || '').trim();
  85. const lower = prompt.toLowerCase();
  86. const config = loadConfig();
  87. // Sync real output/input token counts from transcript before reading state
  88. syncTranscriptTokens(data);
  89. const proj = loadProjectState();
  90. const root = pluginRoot();
  91. const out = [];
  92. // ── /pith <arg> ────────────────────────────────────────────────────────
  93. if (lower.startsWith('/pith')) {
  94. const parts = prompt.trim().split(/\s+/);
  95. const arg = (parts[1] || '').toLowerCase();
  96. const rest = parts.slice(2).join(' ');
  97. if (OUTPUT_MODES.has(arg)) {
  98. saveProjectState({ mode: arg });
  99. out.push(arg === 'off'
  100. ? 'PITH OUTPUT COMPRESSION: deactivated.'
  101. : modeRules(arg, root));
  102. } else if (arg === '' || arg === 'on') {
  103. const m = proj.mode && proj.mode !== 'off' ? proj.mode : (config.default_mode !== 'off' ? config.default_mode : 'lean');
  104. saveProjectState({ mode: m });
  105. out.push(modeRules(m, root));
  106. } else if (arg === 'wiki') {
  107. if (rest) {
  108. // /pith wiki "question" — query the wiki
  109. out.push(wikiQuery(rest, root));
  110. } else {
  111. // /pith wiki — toggle wiki mode.
  112. // Debounce: UserPromptSubmit hook fires before the slash command
  113. // re-calls this script. If the toggle happened within the last 2s,
  114. // skip re-toggling and just echo current state.
  115. const now = Date.now();
  116. const lastToggle = proj._wiki_toggle_ms || 0;
  117. if (now - lastToggle < 2000) {
  118. // Already toggled — confirm state without mutating
  119. out.push(proj.wiki_mode
  120. ? 'PITH WIKI MODE: active. I will maintain the project wiki as we work.\n\n' + wikiModeRules(root)
  121. : 'PITH WIKI MODE: deactivated.');
  122. } else {
  123. const next = !proj.wiki_mode;
  124. saveProjectState({ wiki_mode: next, _wiki_toggle_ms: now });
  125. out.push(next
  126. ? 'PITH WIKI MODE: active. I will maintain the project wiki as we work.\n\n' + wikiModeRules(root)
  127. : 'PITH WIKI MODE: deactivated.');
  128. }
  129. }
  130. } else if (arg === 'ingest') {
  131. // /pith ingest <file>
  132. const filePath = rest.trim();
  133. if (!filePath) {
  134. out.push('[PITH: /pith ingest requires a file path. Example: /pith ingest raw/sources/article.md]');
  135. } else {
  136. out.push(runTool('ingest.py', [filePath], root));
  137. }
  138. } else if (arg === 'lint') {
  139. // wiki_guard.py is the lint tool (not wiki_lint.py)
  140. out.push(runTool('wiki_guard.py', [], root));
  141. } else if (arg === 'status') {
  142. out.push(runTool('health.py', [], root));
  143. } else if (arg === 'update') {
  144. out.push(buildUpdateInstructions(root));
  145. } else if (arg === 'recall') {
  146. // /pith recall — restore last session's mode, wiki, and budget
  147. const saved = { mode: proj.mode, wiki_mode: proj.wiki_mode, budget: proj.budget };
  148. const parts2 = [];
  149. if (saved.mode && saved.mode !== 'off') parts2.push(`mode=${saved.mode.toUpperCase()}`);
  150. if (saved.wiki_mode) parts2.push('wiki=ON');
  151. if (saved.budget) parts2.push(`budget=${saved.budget}`);
  152. if (parts2.length === 0) {
  153. out.push('PITH RECALL: no saved state found for this project.');
  154. } else {
  155. const injections = [];
  156. if (saved.mode && saved.mode !== 'off') injections.push(modeRules(saved.mode, root));
  157. if (saved.wiki_mode) injections.push('PITH WIKI MODE: active. I will maintain the project wiki as we work.\n\n' + wikiModeRules(root));
  158. if (saved.budget) injections.push(`HARD TOKEN LIMIT: ≤${saved.budget} tokens this response. Count as you write. Stop when done.`);
  159. out.push(`PITH RECALL: restored ${parts2.join(', ')}.`);
  160. injections.forEach(i => out.push(i));
  161. }
  162. } else if (arg === 'configure') {
  163. // /pith configure — interactive config wizard
  164. const cur = {
  165. mode: proj.mode || config.default_mode || 'off',
  166. wiki: proj.wiki_mode ? 'ON' : 'OFF',
  167. budget: proj.budget ? String(proj.budget) : 'none',
  168. autoCompact: config.auto_compact ? 'ON' : 'OFF',
  169. };
  170. out.push(
  171. `PITH CONFIGURE WIZARD\n\n` +
  172. `Current settings:\n` +
  173. ` mode = ${cur.mode}\n` +
  174. ` wiki mode = ${cur.wiki}\n` +
  175. ` token budget = ${cur.budget}\n` +
  176. ` auto-compact = ${cur.autoCompact}\n\n` +
  177. `Walk the user through each setting one at a time:\n` +
  178. `1. Output mode? [lean / precise / ultra / off]\n` +
  179. `2. Enable wiki mode? [yes / no]\n` +
  180. `3. Token budget? [number or skip]\n` +
  181. `4. Auto-compact at 70%? [yes / no]\n\n` +
  182. `Apply each answer immediately via saveProjectState. End with a one-line summary.`
  183. );
  184. } else if (arg === 'tour') {
  185. // /pith tour [step-number] — interactive guided tour
  186. const stepArg = rest ? parseInt(rest, 10) : null;
  187. const tourAction = (!isNaN(stepArg) && stepArg >= 1 && stepArg <= 7)
  188. ? ['--step', String(stepArg), '--action', 'set']
  189. : ['--action', 'get'];
  190. out.push(runTool('tour.py', tourAction, root) + '\n\n' + loadTourSkill(root));
  191. } else if (arg === 'setup') {
  192. // Re-run onboarding
  193. saveProjectState({ setup_done: false });
  194. out.push('PITH SETUP: resetting onboarding. On next message I will guide you through setup again.');
  195. } else if (arg === 'optimize-cache') {
  196. out.push(optimizeCache(root));
  197. } else if (arg === 'help' || arg === 'commands') {
  198. out.push(
  199. `PITH COMMAND REFERENCE
  200. ── Output Compression ──────────────────────────────────────────
  201. /pith lean Fragment-style responses, drop articles
  202. /pith precise Full sentences, drop filler/hedging
  203. /pith ultra Max compression, abbreviate, use tables
  204. /pith off Deactivate compression
  205. /pith on Restore last saved mode
  206. ── Structured Formats ──────────────────────────────────────────
  207. /pith debug Structured bug diagnosis format
  208. /pith review Code review format
  209. /pith arch Architecture discussion format
  210. /pith plan Step-by-step planning format
  211. /pith commit Commit message generation format
  212. ── Wiki ────────────────────────────────────────────────────────
  213. /pith wiki Toggle wiki mode on/off
  214. /pith wiki "<q>" Query the project wiki
  215. /pith ingest <file> Add a file/source to the wiki
  216. /pith lint Run wiki guard/lint check
  217. ── Token & Focus ───────────────────────────────────────────────
  218. /pith budget <n> Set hard token limit for responses
  219. /pith budget off Clear token budget
  220. /pith focus <file> Focus context on a specific file
  221. /pith symbol <f> <n> Extract exact lines for a symbol (~95% token saving)
  222. /pith symbol --list <f> List all symbols in a file
  223. ── Session & Config ────────────────────────────────────────────
  224. /pith status Token usage health report (with ASCII flow chart)
  225. /pith report Generate interactive HTML dashboard (opens in browser)
  226. /pith hindsight Identify stale tool results consuming context — recommends /compact
  227. /pith escalate Show auto-escalation status and thresholds
  228. /pith escalate on|off Enable/disable SWEzze auto-escalation
  229. /pith recall Restore last session's mode/wiki/budget
  230. /pith configure Interactive config wizard
  231. /pith tour 7-step interactive guided tour
  232. /pith tour <1-7> Jump to a specific tour step
  233. /pith setup Reset and re-run onboarding
  234. /pith optimize-cache Restructure CLAUDE.md for prompt caching
  235. ── Integrations ────────────────────────────────────────────────
  236. /pith grepai Show GrepAI semantic search status
  237. /pith grepai skip Dismiss "install GrepAI" nudge permanently
  238. /pith grepai enable Re-enable the nudge
  239. ── Install ─────────────────────────────────────────────────────
  240. /pith install Install Pith into this project
  241. /pith uninstall Remove Pith from this project
  242. Display this reference any time with: /pith help`
  243. );
  244. } else if (arg === 'budget') {
  245. // /pith budget <n|off> — alias for /budget
  246. const budgetArg = (rest || '').toLowerCase();
  247. if (budgetArg === 'off' || budgetArg === '0') {
  248. saveProjectState({ budget: null });
  249. out.push('TOKEN BUDGET: cleared.');
  250. } else {
  251. const n = parseInt(budgetArg, 10);
  252. if (!isNaN(n) && n > 0) {
  253. saveProjectState({ budget: n });
  254. out.push(`HARD TOKEN LIMIT: ≤${n} tokens this response. Count as you write. Stop when done. No apology for brevity.`);
  255. } else {
  256. out.push('[PITH: /pith budget requires a number or "off". Example: /pith budget 150]');
  257. }
  258. }
  259. } else if (arg === 'focus') {
  260. // /pith focus <file> — alias for /focus
  261. if (!rest) {
  262. out.push('[PITH: /pith focus requires a file path. Example: /pith focus src/main.js]');
  263. } else {
  264. out.push(runTool('focus.py', [rest, '--question', data.prompt || ''], root));
  265. }
  266. } else if (arg === 'symbol' || arg === 'sym') {
  267. // /pith symbol <file> <name> — extract exact lines for one symbol
  268. // /pith symbol --list <file> — list all symbols in a file
  269. const subParts = rest.trim().split(/\s+/);
  270. if (rest.startsWith('--list') || rest.startsWith('-l')) {
  271. const file = subParts[1] || subParts[0];
  272. out.push(file ? runTool('symbols.py', [file, '--list'], root)
  273. : '[PITH: /pith symbol --list <file>]');
  274. } else if (subParts.length >= 2) {
  275. const [file, ...nameParts] = subParts;
  276. out.push(runTool('symbols.py', [file, nameParts.join(' ')], root));
  277. } else {
  278. out.push('[PITH: /pith symbol <file> <symbol_name> or /pith symbol --list <file>]');
  279. }
  280. } else if (arg === 'grepai') {
  281. // /pith grepai skip — permanently dismiss the "install GrepAI" nudge
  282. // /pith grepai enable — re-enable it (undo skip)
  283. // /pith grepai status — show current state
  284. const sub = (rest || '').toLowerCase().trim();
  285. if (sub === 'skip' || sub === 'dismiss') {
  286. saveProjectState({ grepai_skip: true });
  287. out.push(
  288. 'PITH: GrepAI nudge dismissed. Wiki will use keyword search without ' +
  289. 'further prompts.\n' +
  290. 'To re-enable the nudge later: /pith grepai enable\n' +
  291. 'To install GrepAI: https://github.com/yoanbernabeu/grepai'
  292. );
  293. } else if (sub === 'enable') {
  294. saveProjectState({ grepai_skip: false, grepai_nudge_session: null });
  295. out.push(
  296. 'PITH: GrepAI nudge re-enabled. Install GrepAI to upgrade wiki search ' +
  297. 'from keyword to semantic.\n' +
  298. 'Install: https://github.com/yoanbernabeu/grepai'
  299. );
  300. } else {
  301. // /pith grepai — show status
  302. const proj2 = loadProjectState();
  303. const skipped = proj2.grepai_skip ? 'dismissed (run /pith grepai enable to restore)' : 'active';
  304. out.push(
  305. `PITH GREPAI STATUS\n` +
  306. ` Nudge: ${skipped}\n` +
  307. ` Install: https://github.com/yoanbernabeu/grepai\n` +
  308. ` Commands:\n` +
  309. ` /pith grepai skip — stop showing install nudge\n` +
  310. ` /pith grepai enable — restore nudge`
  311. );
  312. }
  313. } else if (arg === 'reset-cache') {
  314. // /pith reset-cache — force full session-start injection next session
  315. saveProjectState({ session_injection_hash: null });
  316. out.push('PITH: session cache cleared. Full rules will be injected on next session start.');
  317. } else if (arg === 'report') {
  318. // /pith report — generate HTML dashboard and open in browser
  319. out.push(runTool('report.py', [], root));
  320. } else if (arg === 'hindsight') {
  321. // /pith hindsight — retrospective stale context analysis
  322. out.push(runTool('hindsight.py', [], root));
  323. // Mark as shown so the auto-nudge doesn't fire this turn
  324. saveProjectState({ hindsight_nudged: true });
  325. } else if (arg === 'escalate') {
  326. // /pith escalate on|off — toggle SWEzze auto-escalation
  327. const sub = (rest || '').toLowerCase().trim();
  328. if (sub === 'off' || sub === 'disable') {
  329. saveProjectState({ auto_escalate_disabled: true });
  330. out.push('PITH: auto-escalation disabled. Output mode will not change automatically as context fills.');
  331. } else if (sub === 'on' || sub === 'enable') {
  332. saveProjectState({ auto_escalate_disabled: false });
  333. out.push('PITH: auto-escalation enabled. Mode will ratchet to LEAN at 50% context, ULTRA at 70%.');
  334. } else {
  335. const disabled = loadProjectState().auto_escalate_disabled;
  336. const fill = Math.round((proj.input_tokens_est || 0) / (config.context_limit || 200000) * 100);
  337. out.push(
  338. `PITH AUTO-ESCALATION\n` +
  339. ` Status: ${disabled ? 'disabled' : 'enabled'}\n` +
  340. ` Context fill: ${fill}%\n` +
  341. ` Lean at: ${Math.round((config.escalate_lean_at ?? 0.50) * 100)}%\n` +
  342. ` Ultra at: ${Math.round((config.escalate_ultra_at ?? 0.70) * 100)}%\n` +
  343. ` /pith escalate on|off — toggle`
  344. );
  345. }
  346. } else if (SKILL_CMDS.has(arg)) {
  347. // /pith debug, /pith review, /pith install, etc. — handled by Claude Code skill system
  348. // No injection needed; skill file provides instructions.
  349. }
  350. }
  351. // ── /budget <n|off> ────────────────────────────────────────────────────
  352. if (lower.startsWith('/budget')) {
  353. const parts = prompt.trim().split(/\s+/);
  354. const arg = (parts[1] || '').toLowerCase();
  355. if (arg === 'off' || arg === '0') {
  356. saveProjectState({ budget: null });
  357. out.push('TOKEN BUDGET: cleared.');
  358. } else {
  359. const n = parseInt(arg, 10);
  360. if (!isNaN(n) && n > 0) {
  361. saveProjectState({ budget: n });
  362. out.push(`HARD TOKEN LIMIT: ≤${n} tokens this response. Count as you write. Stop when done. No apology for brevity.`);
  363. }
  364. }
  365. }
  366. // ── /focus <file> ──────────────────────────────────────────────────────
  367. if (lower.startsWith('/focus ')) {
  368. const filePath = prompt.slice('/focus '.length).trim();
  369. out.push(runTool('focus.py', [filePath, '--question', data.prompt || ''], root));
  370. }
  371. // ── SWEzze auto-escalation ─────────────────────────────────────────────
  372. // Inspired by OCD/SWEzze (arXiv:2603.28119): ratchet output compression
  373. // as context fills to prevent responses from eating the remaining headroom.
  374. {
  375. const esc_proj = loadProjectState();
  376. if (config.auto_escalate !== false && !esc_proj.auto_escalate_disabled && !lower.startsWith('/pith')) {
  377. const limit = config.context_limit || 200000;
  378. const used = esc_proj.input_tokens_est || 0;
  379. const fill = used / limit;
  380. const curMode = esc_proj.mode || config.default_mode || 'off';
  381. const LEAN_AT = config.escalate_lean_at ?? 0.50;
  382. const ULTRA_AT = config.escalate_ultra_at ?? 0.70;
  383. const CEIL_AT = 0.85;
  384. if (fill >= ULTRA_AT && curMode !== 'ultra') {
  385. saveProjectState({
  386. mode: 'ultra',
  387. _escalated_from: curMode,
  388. escalation_count_session: (esc_proj.escalation_count_session || 0) + 1,
  389. });
  390. out.push(
  391. `[PITH AUTO-ESCALATED: context ${Math.round(fill * 100)}% full → ULTRA compression active.\n` +
  392. ` Previous mode: ${curMode}. Run /pith escalate off to disable.]\n\n` +
  393. modeRules('ultra', root)
  394. );
  395. } else if (fill >= LEAN_AT && (curMode === 'off' || !curMode)) {
  396. saveProjectState({
  397. mode: 'lean',
  398. _escalated_from: curMode,
  399. escalation_count_session: (esc_proj.escalation_count_session || 0) + 1,
  400. });
  401. out.push(
  402. `[PITH AUTO-ESCALATED: context ${Math.round(fill * 100)}% full → LEAN compression active.\n` +
  403. ` Run /pith escalate off to disable.]\n\n` +
  404. modeRules('lean', root)
  405. );
  406. }
  407. // Dynamic response ceiling at 85%+ — cap response to 8% of remaining headroom
  408. if (fill >= CEIL_AT) {
  409. const remaining = limit - used;
  410. const ceiling = Math.max(80, Math.floor(remaining * 0.08));
  411. out.push(
  412. `[PITH: context ${Math.round(fill * 100)}% full — ` +
  413. `keep this response under ${ceiling} tokens to preserve headroom]`
  414. );
  415. }
  416. }
  417. }
  418. // ── Per-message: inject active budget ──────────────────────────────────
  419. const budget = loadProjectState().budget;
  420. if (budget && !lower.startsWith('/pith') && !lower.startsWith('/budget') && !lower.startsWith('/focus')) {
  421. out.push(`[TOKEN LIMIT: ≤${budget} tokens this response]`);
  422. }
  423. // ── Token estimate tracking ────────────────────────────────────────────
  424. const est = Math.ceil(prompt.length / 4);
  425. const newTurn = (proj.turn_count || 0) + 1;
  426. saveProjectState({ input_tokens_est: (proj.input_tokens_est || 0) + est, turn_count: newTurn });
  427. // ── Stale result notice ────────────────────────────────────────────────
  428. // After N turns, remind Claude that large offloaded results are in history
  429. // but no longer needed — it can ignore them without re-reading.
  430. const STALE_TURNS = config.offload_stale_turns || 5;
  431. const staleResults = (proj.stale_results || []);
  432. const nowStale = staleResults.filter(r => (newTurn - r.turn) >= STALE_TURNS);
  433. if (nowStale.length && !lower.startsWith('/pith')) {
  434. const list = nowStale.map(r => ` · ${r.label} (${r.tokens}t, turn ${r.turn})`).join('\n');
  435. out.push(
  436. `[PITH: ${nowStale.length} old tool result(s) are in your history but offloaded — ` +
  437. `safe to ignore unless you need them:\n${list}\n` +
  438. `Use Read("<path>") from the PITH OFFLOAD notice to access if needed]`
  439. );
  440. }
  441. // ── Hindsight auto-nudge ──────────────────────────────────────────────
  442. // Once per session when context fill > 60%: run hindsight --nudge.
  443. // Only fires once (hindsight_nudged flag), not on /pith commands.
  444. {
  445. const hn_proj = loadProjectState();
  446. const fill = (hn_proj.input_tokens_est || 0) / (config.context_limit || 200000);
  447. if (!hn_proj.hindsight_nudged && fill > 0.60 && !lower.startsWith('/pith')) {
  448. const nudge = runTool('hindsight.py', ['--nudge'], root);
  449. if (nudge) {
  450. out.push(nudge);
  451. saveProjectState({ hindsight_nudged: true });
  452. }
  453. }
  454. }
  455. if (out.length) process.stdout.write(out.filter(Boolean).join('\n\n'));
  456. } catch (e) { /* silent */ }
  457. process.exit(0);
  458. });
  459. // ── Helpers ──────────────────────────────────────────────────────────────────
  460. function modeRules(mode, root) {
  461. try {
  462. let content = fs.readFileSync(path.join(root, 'skills', 'pith', 'SKILL.md'), 'utf8')
  463. .replace(/^---[\s\S]*?---\s*/, '');
  464. content = content.split('\n').filter(l => {
  465. const m = l.match(/^\|\s*\*\*(\w+)\*\*\s*\|/);
  466. return !m || m[1] === mode;
  467. }).join('\n');
  468. return `PITH MODE: ${mode.toUpperCase()}\n\n${content}`;
  469. } catch (e) {
  470. const rules = { precise: 'Drop filler/hedging. Full sentences.', lean: 'Drop articles. Fragments OK.', ultra: 'Max compression. Abbreviate. Tables.' };
  471. return `PITH MODE: ${mode.toUpperCase()}. ${rules[mode] || rules.lean} Technical terms exact. Code unchanged. ACTIVE EVERY RESPONSE.`;
  472. }
  473. }
  474. function wikiModeRules(root) {
  475. try {
  476. return fs.readFileSync(path.join(root, 'skills', 'pith-wiki', 'SKILL.md'), 'utf8')
  477. .replace(/^---[\s\S]*?---\s*/, '');
  478. } catch (e) {
  479. return 'Maintain wiki pages as we work. After decisions, bugs solved, or architecture discussions, offer to save to wiki/. Keep pages concise and cross-linked.';
  480. }
  481. }
  482. function wikiQuery(question, root) {
  483. return runTool('wiki.py', ['--question', question], root);
  484. }
  485. function optimizeCache(root) {
  486. try {
  487. const claudeMd = path.join(process.env.CLAUDE_CWD || process.cwd(), 'CLAUDE.md');
  488. if (!fs.existsSync(claudeMd)) return '[PITH: No CLAUDE.md found in current directory]';
  489. const content = fs.readFileSync(claudeMd, 'utf8');
  490. return `PITH CACHE OPTIMIZATION TASK:\n\nRead CLAUDE.md (${content.split('\n').length} lines).\n` +
  491. 'Restructure it so stable sections (project overview, file structure, conventions) come FIRST, ' +
  492. 'and volatile sections (current tasks, recent changes) come LAST. ' +
  493. 'The first ~80% should never change session-to-session. ' +
  494. 'Write the restructured version back to CLAUDE.md. ' +
  495. 'Then confirm how many tokens are now in the stable prefix.';
  496. } catch (e) {
  497. return `[PITH: cache optimization failed — ${e.message}]`;
  498. }
  499. }
  500. // Runs a bundled Python tool via execFile (no shell) so user-controlled
  501. // arguments can never be interpreted as shell syntax. `extraArgs` may be an
  502. // array of argv strings or a whitespace-delimited string; both are treated as
  503. // literal argv tokens, never evaluated by a shell.
  504. function runTool(script, args, root, extraArgs) {
  505. try {
  506. const toolPath = path.join(root, 'tools', script);
  507. if (!fs.existsSync(toolPath)) return `[PITH: tool ${script} not found]`;
  508. const argv = [toolPath, ...args.map(a => String(a))];
  509. if (extraArgs) {
  510. const extras = Array.isArray(extraArgs)
  511. ? extraArgs.map(String)
  512. : String(extraArgs).split(/\s+/).filter(Boolean);
  513. argv.push(...extras);
  514. }
  515. return execFileSync('python3', argv, {
  516. timeout: 30000,
  517. encoding: 'utf8',
  518. cwd: process.env.CLAUDE_CWD || process.cwd(),
  519. stdio: ['ignore', 'pipe', 'pipe'],
  520. maxBuffer: 8 * 1024 * 1024,
  521. }).trim();
  522. } catch (e) {
  523. const msg = (e.stderr && e.stderr.toString ? e.stderr.toString() : '') || e.message || '';
  524. return `[PITH: ${script} failed — ${msg.slice(0, 200)}]`;
  525. }
  526. }
  527. function buildUpdateInstructions(root) {
  528. // Detect install source: if root contains a .git dir it's the live repo; otherwise ~/.local/share/pith
  529. const installDir = fs.existsSync(path.join(root, '.git'))
  530. ? root
  531. : path.join(require('os').homedir(), '.local', 'share', 'pith');
  532. const hasGit = fs.existsSync(path.join(installDir, '.git'));
  533. if (!hasGit) {
  534. return (
  535. 'PITH UPDATE\n\n' +
  536. 'No git repo found at install location. Re-install to get the latest version:\n\n' +
  537. ' bash <(curl -s https://raw.githubusercontent.com/abhisekjha/pith/main/install.sh)\n\n' +
    • Note: Runs a downloaded script through process substitution (bash <(curl …))
    • Line 597 on GitHub
  538. 'This will pull the latest version and re-register all hooks.'
  539. );
  540. }
  541. return (
  542. 'PITH UPDATE — run these commands to pull the latest version:\n\n' +
  543. '```bash\n' +
  544. `git -C "${installDir}" pull --ff-only\n` +
  545. `bash "${installDir}/install.sh"\n` +
  546. '```\n\n' +
  547. `Install dir: ${installDir}\n` +
  548. 'This pulls the latest commit, re-copies hooks to ~/.claude/hooks/pith/, and re-registers commands.\n\n' +
  549. 'After update, restart Claude Code (or open a new session) for changes to take effect.'
  550. );
  551. }
  552. function loadTourSkill(root) {
  553. try {
  554. return fs.readFileSync(path.join(root, 'skills', 'pith-tour', 'SKILL.md'), 'utf8')
  555. .replace(/^---[\s\S]*?---\s*/, '');
  556. } catch (e) {
  557. return 'PITH TOUR: run the interactive 7-step tour. Guide the user through each Pith feature hands-on.';
  558. }
  559. }
install.sh · Bundled script · 239 lines · 1 finding marked
  1. #!/usr/bin/env bash
  2. set -e
  3. # Pinned version — installer clones this exact tag, not a moving branch.
  4. # Update this when cutting a release; callers get a consistent SHA.
  5. PITH_VERSION="${PITH_VERSION:-main}"
  6. # ── Self-clone when piped via curl ────────────────────────────────────────────
  7. # bash <(curl -s ...) sets BASH_SOURCE[0] to /dev/fd/<n> — there are no
    • Note: Runs a downloaded script through process substitution (bash <(curl …))
    • Line 9 on GitHub
  8. # hook files there. Detect this and clone to a stable location, then re-exec.
  9. _src="${BASH_SOURCE[0]}"
  10. if [[ "$_src" == /dev/fd/* ]] || [[ "$_src" == /proc/*/fd/* ]] || [[ "$_src" == "" ]]; then
  11. INSTALL_SRC="${HOME}/.local/share/pith"
  12. echo ""
  13. echo "Detected curl-pipe install — cloning repo to ${INSTALL_SRC} (${PITH_VERSION})..."
  14. mkdir -p "$(dirname "${INSTALL_SRC}")"
  15. if [ -d "${INSTALL_SRC}/.git" ]; then
  16. git -C "${INSTALL_SRC}" fetch --quiet --tags
  17. git -C "${INSTALL_SRC}" checkout --quiet "${PITH_VERSION}"
  18. else
  19. git clone --depth=1 --branch "${PITH_VERSION}" --quiet \
  20. https://github.com/abhisekjha/pith.git "${INSTALL_SRC}"
  21. fi
  22. exec bash "${INSTALL_SRC}/install.sh"
  23. fi
  24. PLUGIN_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  25. CLAUDE_DIR="${HOME}/.claude"
  26. HOOKS_DIR="${CLAUDE_DIR}/hooks/pith"
  27. SETTINGS="${CLAUDE_DIR}/settings.json"
  28. echo ""
  29. echo "Installing Pith..."
  30. echo ""
  31. # Create dirs
  32. mkdir -p "${HOOKS_DIR}"
  33. mkdir -p "${HOME}/.pith"
  34. # Copy hooks
  35. for f in session-start.js post-tool-use.js prompt-submit.js stop.js config.js statusline.sh; do
  36. cp "${PLUGIN_ROOT}/hooks/${f}" "${HOOKS_DIR}/${f}"
  37. echo " ✓ hooks/${f}"
  38. done
  39. chmod +x "${HOOKS_DIR}/statusline.sh"
  40. # Create symlink to skills and tools so hooks can resolve paths
  41. ln -sfn "${PLUGIN_ROOT}/skills" "${HOOKS_DIR}/../pith-skills" 2>/dev/null || true
  42. ln -sfn "${PLUGIN_ROOT}/tools" "${HOOKS_DIR}/../pith-tools" 2>/dev/null || true
  43. # Patch settings.json
  44. node - "${SETTINGS}" "${HOOKS_DIR}" <<'NODESCRIPT'
  45. const fs = require('fs');
  46. const path = require('path');
  47. const settingsPath = process.argv[2];
  48. const hooksDir = process.argv[3];
  49. let settings = {};
  50. try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8')); } catch (e) {}
  51. const hook = (script, timeout, msg) => ({
  52. type: 'command',
  53. command: `node "${hooksDir}/${script}"`,
  54. ...(timeout ? { timeout } : {}),
  55. ...(msg ? { statusMessage: msg } : {}),
  56. });
  57. const hookEntry = (event, script, timeout, msg) => ({
  58. matcher: '',
  59. hooks: [hook(script, timeout, msg)],
  60. });
  61. settings.hooks = settings.hooks || {};
  62. const add = (event, script, timeout, msg) => {
  63. const list = settings.hooks[event] = settings.hooks[event] || [];
  64. const exists = list.some(h => h.hooks && h.hooks[0] && h.hooks[0].command && h.hooks[0].command.includes('pith'));
  65. if (!exists) list.push(hookEntry(event, script, timeout, msg));
  66. };
  67. add('SessionStart', 'session-start.js', 10, 'Pith: initializing...');
  68. add('UserPromptSubmit', 'prompt-submit.js', 5, null);
  69. add('PostToolUse', 'post-tool-use.js', 10, 'Pith: compressing...');
  70. add('Stop', 'stop.js', 5, null);
  71. settings.statusLine = {
  72. type: 'command',
  73. command: `bash "${hooksDir}/statusline.sh"`,
  74. };
  75. fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
  76. fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
  77. console.log(' ✓ settings.json patched');
  78. NODESCRIPT
  79. # Install slash commands into ~/.claude/commands/
  80. COMMANDS_DIR="${CLAUDE_DIR}/commands"
  81. mkdir -p "${COMMANDS_DIR}"
  82. node - "${COMMANDS_DIR}" "${HOOKS_DIR}" "${PLUGIN_ROOT}" <<'CMDSCRIPT'
  83. const fs = require('fs');
  84. const path = require('path');
  85. const cmds = process.argv[2];
  86. const hooks = process.argv[3];
  87. const root = process.argv[4];
  88. // NOTE: $ARGUMENTS is Claude Code's literal template substitution — it is NOT
  89. // shell-escaped. The only injection-safe way to forward user args into bash is
  90. // to place them inside a single-quoted heredoc whose delimiter cannot appear
  91. // in normal user input. The helper then reads stdin instead of argv.
  92. const HEREDOC_TAG = 'PITH_EOF_7f3a9c2e';
  93. const pithMd = `---
  94. allowed-tools: Bash
  95. ---
  96. Run the Pith hook for this subcommand and apply the result.
  97. **Subcommand:** $ARGUMENTS
  98. Step 1 — execute the hook. Arguments flow via a single-quoted heredoc so
  99. shell metacharacters in user input are never evaluated:
  100. \`\`\`bash
  101. node "${hooks}/prompt-submit.js" --slash /pith <<'${HEREDOC_TAG}'
  102. $ARGUMENTS
  103. ${HEREDOC_TAG}
  104. \`\`\`
  105. Step 2 — act on the output:
  106. - If the output contains compression rules (LEAN / ULTRA / PRECISE): apply them immediately and confirm the mode is active
  107. - If the output contains a token status panel: display it to the user exactly
  108. - If the output contains wiki results or tool output: display it
  109. - If the output is empty (e.g. \`/pith debug\`): confirm the structured format is active and show a one-line example of it
  110. Step 3 — confirm to the user in one line what changed or was shown.
  111. `;
  112. const budgetMd = `---
  113. allowed-tools: Bash
  114. ---
  115. Run the Pith budget hook and apply the token ceiling.
  116. **Argument:** $ARGUMENTS
  117. Step 1 — execute the hook (arguments passed via heredoc, never via shell args):
  118. \`\`\`bash
  119. node "${hooks}/prompt-submit.js" --slash /budget <<'${HEREDOC_TAG}'
  120. $ARGUMENTS
  121. ${HEREDOC_TAG}
  122. \`\`\`
  123. Step 2 — apply the result:
  124. - If a token limit was set: enforce it for every response from this point forward
  125. - If the budget was cleared: resume normal response length
  126. Step 3 — confirm in one line.
  127. `;
  128. const focusMd = `---
  129. allowed-tools: Bash
  130. ---
  131. Load only the sections of a file relevant to the current question.
  132. **File:** $ARGUMENTS
  133. The file path is delivered to focus.py via a heredoc, so metacharacters in
  134. the path cannot trigger shell evaluation:
  135. \`\`\`bash
  136. python3 "${root}/tools/focus.py" --stdin-path <<'${HEREDOC_TAG}'
  137. $ARGUMENTS
  138. ${HEREDOC_TAG}
  139. \`\`\`
  140. Show the relevant sections to the user. If no sections match, show the file structure overview.
  141. `;
  142. const graphMd = `---
  143. allowed-tools: Bash
  144. ---
  145. Run the Pith wiki graph generator for the current project.
  146. \`\`\`bash
  147. python3 "${root}/tools/graph_generator.py"
  148. \`\`\`
  149. The script will:
  150. 1. Scan \`./wiki/\` for \`.md\` files and extract \`[[wikilinks]]\`
  151. 2. Write \`wiki-graph.html\` to the current project root
  152. 3. Automatically open it in the default browser
  153. If \`wiki/\` does not exist or has no \`.md\` files, tell the user to build the wiki first with \`/pith wiki\`.
  154. `;
  155. fs.writeFileSync(path.join(cmds, 'pith.md'), pithMd);
  156. fs.writeFileSync(path.join(cmds, 'budget.md'), budgetMd);
  157. fs.writeFileSync(path.join(cmds, 'focus.md'), focusMd);
  158. fs.writeFileSync(path.join(cmds, 'pith-graph.md'), graphMd);
  159. console.log(' ✓ slash commands registered (/pith, /budget, /focus, /pith-graph)');
  160. CMDSCRIPT
  161. # Write CLAUDE_PLUGIN_ROOT to config so hooks can find skills/tools
  162. mkdir -p "${HOME}/.config/pith"
  163. node -e "
  164. const fs = require('fs');
  165. const p = '${HOME}/.config/pith/config.json';
  166. let c = {};
  167. try { c = JSON.parse(fs.readFileSync(p,'utf8')); } catch(e) {}
  168. c.plugin_root = '${PLUGIN_ROOT}';
  169. fs.writeFileSync(p, JSON.stringify(c, null, 2));
  170. "
  171. echo " ✓ plugin root recorded"
  172. echo ""
  173. echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
  174. echo " Pith installed successfully."
  175. echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
  176. echo ""
  177. echo "Automatic features (active now, zero config):"
  178. echo " • Tool output compression — large file reads, bash, grep trimmed automatically"
  179. echo " • Token meter in statusline — [PITH 12k/200k]"
  180. echo " • Auto-compact at 70% — sessions never hit context limits"
  181. echo " • First-run wiki setup — offered on your first session in a new project"
  182. echo ""
  183. echo "On-demand commands:"
  184. echo " /pith → lean output compression"
  185. echo " /pith precise|ultra → adjust compression level"
  186. echo " /pith debug → structured debug format"
  187. echo " /pith review → structured code review"
  188. echo " /pith arch → architecture decision table"
  189. echo " /pith plan → task breakdown format"
  190. echo " /pith commit → conventional commit message"
  191. echo " /pith wiki → toggle wiki mode"
  192. echo " /pith status → token usage this session"
  193. echo " /budget 150 → hard token ceiling"
  194. echo " /focus <file> → extract relevant sections"
  195. echo " /pith update → pull latest version and re-sync hooks"
  196. echo ""
  197. echo "Start Claude Code in any project to begin."
  198. echo ""

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.