token-goat 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +46 -124
  2. package/dist/token-goat.mjs +1746 -188
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,7 +9,7 @@ permalink: /
9
9
 
10
10
  ![Token-Goat](assets/logo.png)
11
11
 
12
- **85%** smaller reads · **97.4%** image compression · **130+** bash output filters · **94–99%** skill overhead cut · compaction memory · **prompt injection** guard
12
+ **85%** smaller reads · **97.4%** image compression · **130+** bash output filters · **94–99%** skill overhead cut · compaction memory · **prompt injection** guard · **3.7 GB** never reached the model · **1.1 Gt** tokens saved
13
13
 
14
14
  **Reduces AI token use/costs by 40–90%, and improves its focus. Fully automated, always online.**
15
15
 
@@ -17,7 +17,7 @@ permalink: /
17
17
 
18
18
  **Your AI re-reads the same file three times. Every compaction causes amnesia. Every build log buries the one line that matters. You pay for all of it. Token-Goat fixes all of it — automatically.**
19
19
 
20
- Token-Goat sits silently between your AI and your tools. Re-read a file? It gets a one-line hint and a narrow-slice suggestion instead of the full file again. Grab a screenshot? A 100 KB copy reaches the model instead of 10 MB. Run `pytest`, `npm install`, `docker build`, or `cargo`? The thousands of progress bars and passing-test names are stripped to the failures before the output even reaches the context window. Compact a long session? It gets a clean structured manifest of edited files and key symbols so nothing important is forgotten. Sessions drop 40–90%+ in cost. You change nothing about how you work.
20
+ Token-Goat sits silently between your AI and your tools. Re-read a file? It gets a one-line hint and a narrow-slice suggestion instead of the full file again. Grab a screenshot? A 100 KB copy reaches the model instead of 10 MB. Run `pytest`, `npm install`, `docker build`, or `cargo`? The thousands of progress bars and passing-test names are stripped to the failures before the output even reaches the context window. Open a PDF, a large Markdown doc, or a CSV? The hook intercepts it — heading tree, page count, or column preview — so the model never pays for the full file. Run `gh run watch` or `next dev` a second time? Prior output is recalled rather than re-run. Compact a long session? It gets a clean structured manifest of edited files and key symbols so nothing important is forgotten. Sessions drop 40–90%+ in cost. You change nothing about how you work.
21
21
 
22
22
  Works with **Claude Code**, **Gemini CLI**, **Codex CLI**, **Aider**, **Cursor**, **Cline**, **Windsurf**, **Copilot CLI**, OpenCode, OpenClaw, and **pi** ([pi-coding-agent](https://github.com/earendil-works/pi-mono)).
23
23
 
@@ -40,9 +40,9 @@ Restart your AI sessions. Run `token-goat stats` a couple of minutes after your
40
40
  ---
41
41
 
42
42
  <p align="center">
43
- <img src="assets/stats_v180.png" alt="token-goat stats — v1.8.0" width="589">
43
+ <img src="assets/stats_v180.png" alt="token-goat stats display" width="589">
44
44
  <br>
45
- <sub><b>v1.8.0</b>with bash output compression and extended filter library</sub>
45
+ <sub>Stats display gradient bars, sparklines, and a calendar heatmap in 24-bit color</sub>
46
46
  </p>
47
47
 
48
48
  ## The problem
@@ -74,6 +74,7 @@ The fastest way to reduce AI token costs is fixing these five, not writing short
74
74
  | `rg pattern src/` or `grep -rn` run via Bash (first time) | Pre-Bash hook suggests `token-goat symbol <name>` and `token-goat semantic "<query>"` as indexed alternatives to a full directory walk |
75
75
  | `rg` or `grep` run twice with the same pattern | Pre-Bash dedup hint fires on repeated `rg`/`grep`/`ag` calls the same way it fires on the native Grep tool; repeat searches return a cached match-count hint instead of re-running |
76
76
  | Read tool targets `tool-results/<id>.txt` or `tasks/<id>.output` | Pre-Read hook suggests `token-goat bash-output <id> --tail N` / `--grep PATTERN` / `--section H`; the filename stem is the output ID |
77
+ | Repeated monitoring command run again (`gh run watch`, `next dev`, `vitest`, `docker logs`) | Pre-bash recall hint: when a prior run is cached and its output exceeds 2 KB, a pointer to `token-goat bash-output <id> --grep PATTERN` is injected instead of re-running the command |
77
78
  | `pnpm`/`yarn`/`bun` install or build dumps full output | pnpm, yarn, and bun compress filters now strip install noise and build logs the same way npm does; `pnpm run`/`yarn run` route through their own filter |
78
79
  | Surgical-read command returns a 10k-line symbol or a full section dump | Capped at ~25k tokens; marker names the truncation ratio and narrowing command (`symbol` → `file::Class.method`; `section` → sub-heading; cached → `--grep`/`--tail`) |
79
80
  | Full file read for one function or section | `token-goat read file::symbol`, about 85% smaller |
@@ -94,6 +95,10 @@ The fastest way to reduce AI token costs is fixing these five, not writing short
94
95
  | Manifest too large or unstructured after compaction | Manifest gains `### MUST_PRESERVE` sealed block, `### What Worked` (last 2 green test runs), inline git diffs, and `### TODOs` from TaskList |
95
96
  | CSV/JSON/JSONL/log file re-read when only structure changed | Pre-Read hint for structured files (CSV headers, JSON keys, log format), ~70% smaller than full read |
96
97
  | Index-only files (lockfiles, source maps, bundles) read on every session | Pre-Read suppression for read-only files (package-lock.json, *.map, dist/), skipped unless explicitly edited |
98
+ | Large markdown file read in full (README.md, CHANGELOG.md, CLAUDE.md ≥8 KB) | Heading tree intercepted instead — H1–H3 with `#2`/`#3` disambiguation; `token-goat section` shortcuts listed for well-known files; post-edit injects a re-read suggestion rather than the full file |
99
+ | PDF or Office binary (.docx, .xlsx, .pptx, .odt) opened via Read | Full read denied; PDF shows page count and outline; Office binaries redirect to `pandoc` or `docx2txt` for text extraction |
100
+ | Large CSV or TSV file (≥10 KB) read in full | Column headers, row count, and 3 sample rows shown; `duckdb` query suggestion for large tabular data |
101
+ | Large TXT or log file (≥20 KB) read in full | Line count + first/last 5 lines shown; `.log`/`.out` files bias toward `--tail 100 --grep`; general catch-all for any file ≥100 KB |
97
102
  | Subagent reads a 47–86 KB recon dump (or greps a 73 KB transcript) and overflows its window | `pre_read` denies a full Read at or above `large_read_redirect_bytes` (~45 KB default), and a `content`-mode Grep over one oversized file, redirecting both to surgical reads or a windowed `offset`/`limit` |
98
103
  | Subagent overflows at "hello" with no idea why | `token-goat baseline` attributes the fixed environmental floor — other plugins' hook dumps, both CLAUDE.md files, MEMORY.md, MCP servers — by owner, suggested fix, and fixed-vs-variable cost |
99
104
  | MCP screenshot call lands 10 MB image in context because no file path was passed | `pre_screenshot` denies chrome-devtools and playwright screenshot calls without a `filePath`/`file_path` argument; redirects the model to re-issue with one, so the saved file flows through image-shrink (~39K tokens raw → ~8K compressed) |
@@ -117,7 +122,7 @@ The fastest way to reduce AI token costs is fixing these five, not writing short
117
122
  | Skill body lost after compaction but recovery too verbose | Recovery hint deduped skills by content_sha (same skill loaded twice = one entry); inline skill checklist |
118
123
  | Recovery hints omit critical paths when space is tight | Hint budget hard caps per kind (files=5, bash=3, web=2, skills=4); skip bash snippet when recall available |
119
124
  | `token-goat map` outputs without rank context | Semantic compact mode outputs one result per line; `--full` for old format |
120
- | AVIF format not supported despite better compression | AVIF image-shrink (when Pillow has libaom); WebP fallback; codec auto-detection in docker |
125
+ | AVIF format not supported despite better compression | AVIF image-shrink via sharp (when libvips is built with libaom); WebP fallback; codec auto-detection in docker |
121
126
  | Token-savings invisible until you run `stats` | Token-savings benchmark (slow-marked test suite) locks in measured wins; `token-goat stats` reports net-positive impact |
122
127
  | Hook crash leaves agent waiting for response | Fail-soft barrier catches `BaseException`/`MemoryError`/`SystemExit`; hook always returns `{"continue": true}` |
123
128
  | Concurrent edits lose update counts mid-session | Session CAS + mtime-based retry prevent lost edits in manifest |
@@ -127,8 +132,6 @@ The fastest way to reduce AI token costs is fixing these five, not writing short
127
132
  | Compaction hook subprocess ~190 ms cold | Lazy imports of heavy modules in `hooks_session` and `compact`; compaction path ~110 ms cold (~42% faster) |
128
133
  | Pre-compact subprocess runs on every session | Compact-skip sentinel on disk: if session file is <5 min old and no edits logged, subprocess exits in <1 ms |
129
134
  | Git ops slow manifest build in non-repo dirs | `git diff` / `git log` calls skipped when `cwd` is not inside a git repo (saves 60–100 ms per hook fire) |
130
- | Test suite slow on multi-core machines | `pytest-xdist --dist=loadscope` + module-scoped fixtures for read-only groups; parallel workers cut wall time |
131
- | Flaky tests fail the whole run | `pytest-rerunfailures` auto-retries once before failing; `pytest-randomly` seeds expose order-dependent flakes |
132
135
  | `terraform init` downloads 30+ provider plugins | Provider install lines collapsed to a count note; generic progress lines head/tail compressed (5+5 kept); `Init complete!` preserved |
133
136
  | `terraform show` dumps a full resource block | Noise attributes (id, arn, timeouts, tags) stripped per resource block; high-signal fields kept with a suppression note |
134
137
  | `kubectl events` lists raw repetitive events | Events grouped by REASON with a per-group count; field-selector hint added to narrow scope |
@@ -146,15 +149,15 @@ Numbers below come from synthetic-fixture benchmarks in the test suite. Each row
146
149
 
147
150
  | Source | Improvement | Measured impact | Where |
148
151
  |--------|-------------|-----------------|-------|
149
- | Image shrink | WebP encoder beats JPEG on screenshot-shaped images | ~39% smaller than the same image at JPEG quality 85 | `image_shrink.py` (codec selection) |
150
- | Repomap output | Short labels (`f:`, `s:`, `c:`) and auto-compact mode below 6 KB | ~30–40% denser output for the same byte budget | `repomap.py` (`token-goat map --budget`) |
151
- | DB reindex | Batched single transaction + composite indexes on `(file_id, kind)` | 100 files / 10K rows: 84 s → 1 s (~80× faster) | `parser.py`, `db.py` (index migration) |
152
- | Hook cold-start | Lazy import of heavy modules; unknown events short-circuit | 86 ms → 30 ms (~65% faster); unknown-event dispatch <1 ms | `hooks_cli.py` |
153
- | Symbol start_line | TypeScript decorators captured in symbol span | One `token-goat read` returns the decorator + signature + body; no re-read | `languages/typescript.py` |
154
- | Section extraction | Setext headings, h5/h6, anchor IDs, and `__frontmatter__` | `token-goat section` resolves more headings without falling back to a full file read | `languages/markdown.py` |
155
- | Image cache | Real LRU eviction (was FIFO; old hot entries got dropped) | Higher hit rate on repeat screenshots in long sessions | `image_shrink.py` |
156
- | Monorepo defaults | Reindex batch 500 → 2000; compact `min_events` 5 → 3 | Fewer worker wakeups; compact manifests fire on shorter sessions | `config.py` defaults |
157
- | Miss suggestions | `symbol` auto-redirects on a single high-confidence close match (`--strict` opts out); `read` / `section` print "Did you mean…?" | Keeps agents on the surgical-read path instead of falling back to full-file `Read` | `read_replacement.py` |
152
+ | Image shrink | WebP encoder beats JPEG on screenshot-shaped images | ~39% smaller than the same image at JPEG quality 85 | `src/image_shrink.ts` (codec selection) |
153
+ | Repomap output | Short labels (`f:`, `s:`, `c:`) and auto-compact mode below 6 KB | ~30–40% denser output for the same byte budget | `src/repomap.ts` (`token-goat map --budget`) |
154
+ | DB reindex | Batched single transaction + composite indexes on `(file_id, kind)` | 100 files / 10K rows: 84 s → 1 s (~80× faster) | `src/parser.ts`, `src/db.ts` (index migration) |
155
+ | Hook cold-start | Lazy import of heavy modules; unknown events short-circuit | 86 ms → 30 ms (~65% faster); unknown-event dispatch <1 ms | `src/hooks_cli.ts` |
156
+ | Symbol start_line | TypeScript decorators captured in symbol span | One `token-goat read` returns the decorator + signature + body; no re-read | `src/parser.ts` (TypeScript adapter) |
157
+ | Section extraction | Setext headings, h5/h6, anchor IDs, and `__frontmatter__` | `token-goat section` resolves more headings without falling back to a full file read | `src/parser.ts` (Markdown adapter) |
158
+ | Image cache | Real LRU eviction (was FIFO; old hot entries got dropped) | Higher hit rate on repeat screenshots in long sessions | `src/image_shrink.ts` |
159
+ | Monorepo defaults | Reindex batch 500 → 2000; compact `min_events` 5 → 3 | Fewer worker wakeups; compact manifests fire on shorter sessions | `src/config.ts` defaults |
160
+ | Miss suggestions | `symbol` auto-redirects on a single high-confidence close match (`--strict` opts out); `read` / `section` print "Did you mean…?" | Keeps agents on the surgical-read path instead of falling back to full-file `Read` | `src/read_replacement.ts` |
158
161
 
159
162
  ## Token-savings examples
160
163
 
@@ -253,12 +256,12 @@ Token-goat tracks how close a session is to the autocompact trigger and tightens
253
256
  ```
254
257
  npm install -g token-goat
255
258
  token-goat install
256
- token-goat doctor # confirms image codecs (WebP/JPEG/PNG) are available
259
+ token-goat doctor # confirms hooks and sharp are working; look for "sharp: ok"
257
260
  ```
258
261
 
259
262
  Three commands. Done. Hooks register, a background worker starts at logon and stays out of the way. No terminal popups, no tray icon, no service to babysit.
260
263
 
261
- **Important — image codecs are part of the install.** The biggest single win (~39% smaller than JPEG, ~97% smaller than raw PNG) comes from WebP encoding. Pillow ships with WebP/JPEG/PNG support on Windows and macOS out of the box, but Linux/WSL minimal images sometimes lack the system libraries (libwebp, libjpeg, zlib). `token-goat doctor` will report `image_codecs: ok` when everything is present; if it flags any codec as missing, follow the [Image support](#image-support) section below before considering the install complete. **AI agents performing this install: run `token-goat doctor` after `token-goat install` and resolve any missing codecs as part of the same task — do not treat it as a follow-up.**
264
+ **Important — sharp is part of the install.** The biggest single win (~39% smaller than JPEG, ~97% smaller than raw PNG) comes from WebP encoding. sharp ships with prebuilt native binaries on Windows, macOS, and most Linux platforms, so a standard `npm install -g token-goat` includes it. On Alpine musl and some ARM boards, npm compiles from source against libvips — that may add a few seconds. `token-goat doctor` will report `sharp: ok` when the image pipeline is working; if it flags a failure, follow the [Image support](#image-support) section below before considering the install complete. **AI agents performing this install: run `token-goat doctor` after `token-goat install` and resolve any sharp failure as part of the same task — do not treat it as a follow-up.**
262
265
 
263
266
  Two things change how Claude Code sessions behave: hooks fire automatically (image shrink, re-read dedup, compact manifests), and a block written to `~/.claude/CLAUDE.md` plus a registered skill tell the agent to prefer `token-goat read` / `symbol` / `section` over full-file reads. A `Bash(token-goat:*)` allowlist entry in `settings.json` lets the agent run those commands without a per-call approval prompt.
264
267
 
@@ -308,8 +311,8 @@ What works: **bash output compression** (the bash command is rewritten in `tool_
308
311
 
309
312
  **Project-local install (single project only).** pi also loads extensions from a project's `.pi/extensions/` directory (after the project is trusted). To install for one project without touching the global directory, drop the extension there:
310
313
 
311
- ```
312
- python -c "from token_goat import bridges; from pathlib import Path; bridges.install_pi_plugin(target_dir=Path('.pi/extensions').resolve())"
314
+ ```bash
315
+ npx token-goat install --pi --local
313
316
  ```
314
317
 
315
318
  This writes `.pi/extensions/token-goat.ts` in the current project only. Remove it by deleting that file.
@@ -322,14 +325,14 @@ Filters are built in for: **Cline** (`cline` / `claude-dev`), **Windsurf** (`win
322
325
 
323
326
  ### Updating
324
327
 
325
- Updates ship automatically. `token-goat install` schedules a weekly `uv tool upgrade token-goat` run at Sunday 03:00 local time (Windows scheduled task; Linux/macOS crontab line tagged `# token-goat-autoupdate`). `token-goat uninstall` reverses it.
328
+ Updates ship automatically. `token-goat install` schedules a weekly `npm install -g token-goat@latest` run at Sunday 03:00 local time (Windows scheduled task; Linux/macOS crontab line tagged `# token-goat-autoupdate`). `token-goat uninstall` reverses it.
326
329
 
327
330
  Manual paths:
328
331
 
329
332
  | When | Command |
330
333
  |------|---------|
331
- | Update now | `uv tool upgrade token-goat` |
332
- | Reinstall from scratch (broken venv, missing image codec) | `uv tool install --reinstall --force token-goat` |
334
+ | Update now | `npm install -g token-goat@latest` |
335
+ | Reinstall from scratch (broken install, sharp failure) | `npm install -g token-goat@latest` |
333
336
  | Disable auto-updates | Delete the `token-goat-update` scheduled task (Windows) or the `# token-goat-autoupdate` crontab line (Linux/macOS) |
334
337
 
335
338
  ## CLI
@@ -447,9 +450,9 @@ To check overhead for your current skills: `token-goat skill-size`. To inspect c
447
450
  | Linux (no systemd, incl. WSL) | `~/.config/autostart/token-goat-worker.desktop`. On WSL without systemd, the SessionStart hook also starts the worker on every Claude Code session. |
448
451
  | macOS (untested) | `~/Library/LaunchAgents/com.dfkhelper.token-goat-worker.plist`, loaded via `launchctl`. |
449
452
 
450
- The autostart command is `pythonw -m token_goat.cli worker --daemon` from Token-Goat's `uv tool` venv. No PyInstaller-style launcher `.exe` is dropped; AV/EDR products do not behavior-flag this invocation pattern.
453
+ The autostart command is `node <npm-prefix>/lib/node_modules/token-goat/dist/cli.js worker --daemon`. No compiled `.exe` is dropped; AV/EDR products do not behavior-flag this invocation pattern.
451
454
 
452
- **Weekly auto-update** (Sunday 03:00 local time, runs `uv tool upgrade token-goat`)
455
+ **Weekly auto-update** (Sunday 03:00 local time, runs `npm install -g token-goat@latest`)
453
456
 
454
457
  | Platform | Entry |
455
458
  |---------|------|
@@ -513,7 +516,9 @@ token-goat stats
513
516
 
514
517
  ## Image support
515
518
 
516
- The image-shrink pipeline relies on Pillow with WebP, JPEG, and PNG codecs. Pillow ships as a binary wheel on every platform `uv` supports, so a normal `uv tool install token-goat` puts all three codecs in place without extra steps. The instructions below are only needed if `token-goat doctor` reports `Pillow codecs: WebP=MISSING` (or similar) that flag means Pillow was built from source against a system that did not ship the codec libraries.
519
+ Token-goat shrinks large images before they reach the model, cutting vision token costs by 60–90%. The pipeline uses [`sharp`](https://sharp.pixelplumbing.com/), a Node.js image processing library that ships prebuilt native binaries for Windows, macOS, Linux, and Alpine.
520
+
521
+ On most platforms, `npm install -g token-goat` installs sharp without additional steps. npm pulls a prebuilt binary keyed to your Node.js major version and OS — no C++ compiler, libvips, or system codec libraries required.
517
522
 
518
523
  Quick check (any platform):
519
524
 
@@ -521,117 +526,39 @@ Quick check (any platform):
521
526
  token-goat doctor
522
527
  ```
523
528
 
524
- If the `Pillow codecs` line reports any `MISSING` or `FAIL`, follow the platform section below.
525
-
526
- ### Image support — Windows
527
-
528
- The official Pillow wheel for Windows bundles libwebp, libjpeg-turbo, and libpng. A failing codec almost always means Pillow was reinstalled inside a stripped-down environment. Reinstall token-goat (and its bundled Pillow wheel) end-to-end:
529
+ If the `sharp` line shows `OK`, you're done.
529
530
 
530
- ```powershell
531
- uv tool install --reinstall --force token-goat
532
- token-goat doctor
533
- ```
531
+ ### Image support — troubleshooting
534
532
 
535
- ### Image support macOS
536
-
537
- Same story as Windows — the universal wheel ships every codec. Reinstall to get the wheel back:
533
+ If `token-goat doctor` reports `sharp: FAIL`, the most common cause is a cached binary built against a different Node.js version. A fresh install usually fixes it:
538
534
 
539
535
  ```bash
540
- uv tool install --reinstall --force token-goat
536
+ npm install -g token-goat@latest
541
537
  token-goat doctor
542
538
  ```
543
539
 
544
- If you previously installed Pillow via Homebrew with `--build-from-source`, install the libraries first, then reinstall:
545
-
546
- ```bash
547
- brew install webp jpeg-turbo libpng
548
- uv tool install --reinstall --force token-goat
549
- ```
550
-
551
- ### Image support — Linux / WSL
552
-
553
- Almost every Linux distro pulls the manylinux Pillow wheel, which bundles every codec. The exceptions are: musl-based distros (Alpine), some ARM boards lacking a matching wheel, and environments where the user forced `--no-binary :all:`. In those cases, install the system headers, then reinstall:
540
+ On Alpine Linux, some ARM boards, and air-gapped environments, npm can't fetch a prebuilt binary and falls back to compiling from source. That requires `libvips` and C++ build tools:
554
541
 
555
542
  ```bash
556
543
  # Debian / Ubuntu / WSL
557
- sudo apt-get update
558
- sudo apt-get install -y libwebp-dev libjpeg-turbo8-dev libpng-dev
559
- uv tool install --reinstall --force token-goat
560
- token-goat doctor
561
- ```
562
-
563
- ```bash
564
- # Fedora / RHEL / Alma
565
- sudo dnf install -y libwebp-devel libjpeg-turbo-devel libpng-devel
566
- uv tool install --reinstall --force token-goat
567
- ```
544
+ sudo apt-get install -y libvips-dev build-essential
568
545
 
569
- ```bash
570
- # Arch / Manjaro
571
- sudo pacman -S --noconfirm libwebp libjpeg-turbo libpng
572
- uv tool install --reinstall --force token-goat
573
- ```
574
-
575
- ```bash
576
546
  # Alpine
577
- sudo apk add libwebp-dev libjpeg-turbo-dev libpng-dev
578
- uv tool install --reinstall --force token-goat
579
- ```
547
+ apk add --no-cache vips-dev build-base python3
580
548
 
581
- ### Image support — AI automated setup
582
-
583
- Non-interactive snippets agents can run unattended. Each one is idempotent: it checks current state before changing anything, and re-runs `token-goat doctor` at the end so the agent can verify success from the output.
584
-
585
- #### Windows (PowerShell)
586
-
587
- ```powershell
588
- # 1. Verify token-goat is reachable; reinstall if not
589
- if (-not (Get-Command token-goat -ErrorAction SilentlyContinue)) {
590
- uv tool install token-goat
591
- }
592
-
593
- # 2. If doctor flags any image codec, reinstall the bundled Pillow wheel
594
- $doctor = token-goat doctor 2>&1 | Out-String
595
- if ($doctor -match 'Pillow codecs:.*(MISSING|FAIL)') {
596
- uv tool install --reinstall --force token-goat
597
- }
598
-
599
- # 3. Verify
600
- token-goat doctor
549
+ # Fedora / RHEL
550
+ sudo dnf install -y vips-devel gcc-c++ make
601
551
  ```
602
552
 
603
- #### macOS / Linux / WSL (bash)
553
+ After installing the system packages:
604
554
 
605
555
  ```bash
606
- set -e
607
-
608
- # 1. Verify token-goat is reachable; reinstall if not
609
- command -v token-goat >/dev/null 2>&1 || uv tool install token-goat
610
-
611
- # 2. If doctor flags any image codec, install platform packages then reinstall
612
- need_fix=$(token-goat doctor 2>&1 | grep -E 'Pillow codecs:.*(MISSING|FAIL)' || true)
613
- if [[ -n "$need_fix" ]]; then
614
- OS="$(uname -s)"
615
- if [[ "$OS" == "Darwin" ]]; then
616
- command -v brew >/dev/null 2>&1 && brew install webp jpeg-turbo libpng
617
- elif [[ "$OS" == "Linux" ]]; then
618
- if command -v apt-get >/dev/null 2>&1; then
619
- sudo apt-get update && sudo apt-get install -y libwebp-dev libjpeg-turbo8-dev libpng-dev
620
- elif command -v dnf >/dev/null 2>&1; then
621
- sudo dnf install -y libwebp-devel libjpeg-turbo-devel libpng-devel
622
- elif command -v pacman >/dev/null 2>&1; then
623
- sudo pacman -S --noconfirm libwebp libjpeg-turbo libpng
624
- elif command -v apk >/dev/null 2>&1; then
625
- sudo apk add libwebp-dev libjpeg-turbo-dev libpng-dev
626
- fi
627
- fi
628
- uv tool install --reinstall --force token-goat
629
- fi
630
-
631
- # 3. Verify
556
+ npm install -g token-goat@latest
632
557
  token-goat doctor
633
558
  ```
634
559
 
560
+ For platform-specific build details, see the [sharp installation docs](https://sharp.pixelplumbing.com/install).
561
+
635
562
  ## Stats display
636
563
 
637
564
  `token-goat stats` uses 24-bit ANSI color and Unicode block characters for gradient bars, sparklines, and the activity heatmap. In the right terminal it renders sharply. In the wrong one you get broken characters, flat gray blocks, or a "rich is not installed" error.
@@ -758,12 +685,7 @@ token-goat stats
758
685
  Run this if the stats output still looks wrong. A smooth green gradient from left to right means truecolor is active. Solid single-shade green means it isn't.
759
686
 
760
687
  ```bash
761
- python3 -c "
762
- import sys
763
- for r in range(0, 256, 32):
764
- sys.stdout.write(f'\x1b[48;2;0;{r};0m ')
765
- sys.stdout.write('\x1b[0m\n')
766
- "
688
+ node -e "for(let r=0;r<256;r+=32)process.stdout.write('\x1b[48;2;0;'+r+';0m ');process.stdout.write('\x1b[0m\n')"
767
689
  ```
768
690
 
769
691
  ## Security, privacy, and uninstall
@@ -804,7 +726,7 @@ Reverses everything in [What gets installed?](#what-gets-installed): the schedul
804
726
 
805
727
  I built this because long Claude Code and Codex sessions on my machine kept burning context in the same ways: screenshots landing at 2-3 MB, the agent re-reading a file it parsed hours earlier in the same conversation, compactions that forgot which functions were edited. Each felt preventable.
806
728
 
807
- This is a solo project. I use it daily on Windows 11. Tests run across Python 3.12 and 3.13.
729
+ This is a solo project. I use it daily on Windows 11. Tests run on Node.js 20 and 22.
808
730
 
809
731
  ## Requests and issues
810
732