token-goat 2.6.32 → 2.6.34
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.
- package/README.md +24 -1
- package/dist/{token-goat-chunk-5EXIMDHA.mjs → token-goat-chunk-7FWBSPCT.mjs} +1573 -386
- package/dist/token-goat-chunk-AEX54RUZ.mjs +11 -0
- package/dist/{token-goat-chunk-3KW5C2KQ.mjs → token-goat-chunk-AO2QD2AG.mjs} +0 -4
- package/dist/{token-goat-chunk-TBCLQTPG.mjs → token-goat-chunk-CKRATWCJ.mjs} +7 -7
- package/dist/{token-goat-chunk-X5OPORR4.mjs → token-goat-chunk-CN7GUPX6.mjs} +1258 -1769
- package/dist/{token-goat-hook-chunk-TKXOXN4J.mjs → token-goat-chunk-DG53MVNJ.mjs} +2 -98
- package/dist/{token-goat-chunk-DFBD2FFU.mjs → token-goat-chunk-FRMEOIRU.mjs} +365 -139
- package/dist/{token-goat-chunk-YWYITDOS.mjs → token-goat-chunk-G6XLWJWI.mjs} +2 -5
- package/dist/{token-goat-chunk-RD6O3PJU.mjs → token-goat-chunk-GXBPEQR2.mjs} +3699 -3341
- package/dist/{token-goat-chunk-DNEPSN3P.mjs → token-goat-chunk-I6EQH27G.mjs} +4 -7
- package/dist/{token-goat-hook-chunk-Q5URQRIF.mjs → token-goat-chunk-IYYQOPY4.mjs} +811 -79
- package/dist/{token-goat-chunk-W3MX4LQV.mjs → token-goat-chunk-L7QLEVO7.mjs} +6 -9
- package/dist/{token-goat-chunk-O7TGKV5I.mjs → token-goat-chunk-OA3GFKP2.mjs} +23 -24
- package/dist/{token-goat-chunk-GWZJ5SI2.mjs → token-goat-chunk-WA2ER6TZ.mjs} +7 -32
- package/dist/{token-goat-hook-chunk-VHZECEQD.mjs → token-goat-hook-chunk-2ISZ4AZR.mjs} +7 -32
- package/dist/{token-goat-chunk-4M7PSAO3.mjs → token-goat-hook-chunk-3QYSN4QV.mjs} +2 -98
- package/dist/{token-goat-hook-chunk-LFYT4DLB.mjs → token-goat-hook-chunk-6C5RN3CM.mjs} +23 -24
- package/dist/{token-goat-hook-chunk-WBTHUYJP.mjs → token-goat-hook-chunk-6QTWMSRO.mjs} +1221 -1730
- package/dist/token-goat-hook-chunk-ATEGFQAU.mjs +23 -0
- package/dist/{token-goat-hook-chunk-DJZGX27J.mjs → token-goat-hook-chunk-BU5OFDGQ.mjs} +363 -138
- package/dist/{token-goat-hook-chunk-J2ZK2FYW.mjs → token-goat-hook-chunk-BUOCULAM.mjs} +0 -4
- package/dist/{token-goat-hook-chunk-DHW6SRHR.mjs → token-goat-hook-chunk-CNLMPHXT.mjs} +1569 -382
- package/dist/{token-goat-hook-chunk-6NF4WM2U.mjs → token-goat-hook-chunk-I5VM5PO5.mjs} +3700 -3342
- package/dist/{token-goat-chunk-N53GXI2Z.mjs → token-goat-hook-chunk-KGLMNOGD.mjs} +811 -79
- package/dist/{token-goat-hook-chunk-TBJ5PUPQ.mjs → token-goat-hook-chunk-OQML5EMA.mjs} +6 -9
- package/dist/{token-goat-hook-chunk-UXD3B4OY.mjs → token-goat-hook-chunk-QTZ6YUMQ.mjs} +4 -7
- package/dist/token-goat-hook-chunk-RFRLWOQH.mjs +11 -0
- package/dist/{token-goat-hook-chunk-PCP4W65Z.mjs → token-goat-hook-chunk-XUMIVYEN.mjs} +2 -5
- package/dist/token-goat-hook.mjs +7 -12
- package/dist/token-goat.core.mjs +7 -10
- package/package.json +20 -40
- package/dist/token-goat-chunk-3UOG7PSZ.mjs +0 -63
- package/dist/token-goat-hook-chunk-ANFXTEQO.mjs +0 -23
- package/dist/token-goat-hook-chunk-K33JMLL7.mjs +0 -63
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@ permalink: /
|
|
|
9
9
|
|
|
10
10
|

|
|
11
11
|
|
|
12
|
+
***Give the model what it needs, not everything you have.***
|
|
13
|
+
|
|
12
14
|
**85%** smaller reads · **97.4%** image compression · **180+** filter & interception rules · **94–99%** skill overhead cut · compaction memory · **prompt injection** guard · **3.7 GB** never reached the model · **1.1 Gt** tokens saved
|
|
13
15
|
|
|
14
16
|
**Reduces AI token use/costs by 40–90%, and improves its focus. Fully automated, always online.**
|
|
@@ -19,7 +21,7 @@ permalink: /
|
|
|
19
21
|
|
|
20
22
|
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
23
|
|
|
22
|
-
Works with **Claude Code**, **Gemini CLI**, **Qwen Code**, **Codex CLI**, **Aider**, **Cursor**, **Cline**, **Windsurf**, **Copilot CLI**, **Grok CLI** (xAI Grok Build), and OpenCode, plus **pi** ([pi-coding-agent](https://github.com/earendil-works/pi-mono)).
|
|
24
|
+
Works with **Claude Code**, **Gemini CLI**, **Qwen Code**, **Codex CLI**, **Aider**, **Cursor**, **Cline**, **Windsurf**, **Copilot CLI**, **Kimi Code**, **Grok CLI** (xAI Grok Build), and OpenCode, plus **pi** ([pi-coding-agent](https://github.com/earendil-works/pi-mono)).
|
|
23
25
|
|
|
24
26
|
**Ask your AI to install it fully (give it this GitHub link), or install in one command:**
|
|
25
27
|
|
|
@@ -393,6 +395,14 @@ token-goat install --qwen
|
|
|
393
395
|
|
|
394
396
|
This writes hook entries into `~/.qwen/settings.json`. Unlike Gemini CLI (its own ancestor, with a custom `BeforeTool`/`AfterTool`/`PreCompress` event/matcher scheme), Qwen Code's hooks system diverged and now mirrors Claude Code's own natively — `PreToolUse`/`PostToolUse`/`PreCompact`/`UserPromptSubmit`/`SubagentStop` event names and snake_case stdin JSON — so token-goat wires all five events with no wire-format translation needed. Qwen Code's own tool-name taxonomy is only partially documented, so token-goat uses a catch-all matcher per event rather than an incomplete per-tool list. Image shrinking, session hints, post-edit indexing, compact assist, and bash output compression all work. This bridge was built from QwenLM/qwen-code's published docs, not dogfooded against a live Qwen Code install — if hooks aren't firing, `token-goat doctor` and the settings.json contents are the first things to check. To remove: `token-goat uninstall --qwen`.
|
|
395
397
|
|
|
398
|
+
### Kimi Code users
|
|
399
|
+
|
|
400
|
+
```
|
|
401
|
+
token-goat install --kimi
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
This writes `[[hooks]]` entries into `~/.kimi-code/config.toml` (or `$KIMI_CODE_HOME/config.toml`), covering Kimi Code's `PreToolUse`, `PostToolUse`, `PreCompact`, `UserPromptSubmit`, `SubagentStop`, and `SessionStart` events. Kimi Code sends a Claude-Code-shaped snake_case payload on stdin, but it reads a different response: only a top-level `message` and `hookSpecificOutput.permissionDecision` / `permissionDecisionReason`. So the install also writes a small shim at `~/.kimi-code/hooks/token-goat-shim.js` that translates token-goat's answer into that contract, turns a hint into `message`, and writes nothing at all for a no-op. Image shrinking, session hints, post-edit indexing, compact assist, and bash output compression all work. `Notification` and `Stop` are not wired, because token-goat has no handler for them. Input and output rewriting are not wired either: Kimi Code offers no channel to replace a tool's input or its result. This bridge was built from MoonshotAI/kimi-code's own source and docs, not dogfooded against a live Kimi Code install, so if hooks are not firing, `token-goat doctor` and the `config.toml` contents are the first things to check. To remove: `token-goat uninstall --kimi`.
|
|
405
|
+
|
|
396
406
|
### opencode users
|
|
397
407
|
|
|
398
408
|
```
|
|
@@ -522,6 +532,8 @@ token-goat pdf-extract manual.pdf --pages 12-15 --layout --head 120
|
|
|
522
532
|
| `token-goat outline "file"` | List top-level symbols with line ranges and docstring hints — one-glance file map. `--force-refresh` reparses from disk first, bypassing a stale index. `--stats` adds a per-symbol reference count and doc-coverage flag, computed live from the index. `--grep <pattern>` narrows to symbols whose name matches a regex (a literal substring when the pattern is not valid regex), which is how you skim one area of a large file without dumping its whole symbol list; `--min-lines <n>` drops symbols shorter than N lines. Both compose, and if a filter removes everything the output says so and names the filter, rather than looking like a file with no symbols. Accepts a comma-separated file list (`"a,b,c"`) to cover several files in one call, one clearly-headed block per file; extra space-separated file arguments are reported in a note naming that comma form instead of being silently dropped. With `--json`, a comma-separated list returns one merged document (rows carry their own `filePath`), not one document per file. |
|
|
523
533
|
| `token-goat yaml-outline <file>` | Structural summary of a YAML document (array shape / object key types) instead of a raw Read. Multi-document streams (`---`-separated) outline as an array of documents. |
|
|
524
534
|
| `token-goat yaml-query <file> <path>` | Extract one value or a projected/filtered subset from a YAML document by dot-path instead of a raw Read (same grammar as `json-query`: `[n]` index, `[*]` wildcard, `[field=value]` filter — e.g. `items[status=active].name`). `--head <n>` caps a projected/filtered result. |
|
|
535
|
+
| `token-goat xml-outline <file>` | Structural summary of an XML document (element tag hierarchy, attribute keys, child counts) instead of a raw Read. |
|
|
536
|
+
| `token-goat xml-query <file> <path>` | Extract one value, element text/XML, or a projected/filtered subset from an XML document by XPath-like dot-path instead of a raw Read (same grammar as `json-query`/`yaml-query`: element tags, `@attr`, `[n]` index, `[*]` wildcard, `[attr=value]` filter, `--head <n>`). |
|
|
525
537
|
| `token-goat json-outline <file>` | Structural summary of a JSON document (array shape / object key types) instead of a raw Read. |
|
|
526
538
|
| `token-goat json-query <file> <path>` | Extract one value or a projected/filtered subset from a JSON document by dot-path instead of a raw Read: dot-separated keys with optional bracket segments — `[n]` index, `[*]` wildcard (projects every element/value), `[field=value]` filter. Examples: `data.items[3].name`, `items[*].id`, `items[status=active]`. |
|
|
527
539
|
| `token-goat brief "file::symbol"` | Bundle a symbol's body, resolved callers (grouped by enclosing function), and its containing doc section into one round-trip instead of three separate `read`/`callers`/`section` calls. `--limit <n>` caps the callers shown per symbol (default 20; the true caller count is reported even when truncated). Comma-separated `"file::a,b"` fetches several symbols' bundles from one file in a single call, mirroring `read`'s `file::a,b` multi-symbol grammar. Cross-file `"a.ts::x,b.ts::y"` bundles symbols from several files in one call, mirroring `read`'s cross-file grammar — a bare segment inherits the file to its left, and once more than one file is involved each bundle is keyed by the full `file::symbol` so two files contributing the same symbol name stay distinct. Also accepts `read`'s `symbol@LINE` anchor to pick out an otherwise-ambiguous candidate. `-C, --context <n>` adds N lines of real call-site source around each entry of the caller block. `--json`'s `symbol.filePath` and `callers[].file` render root-relative when a project root resolves, absolute when none does — matching the plain-text block above. `--exclude-tests` hides callers whose call site is in a test file, matching `refs`/`callers`; the caller count and the elided tail both count the filtered set, so they never disagree with the rows shown, and when the filter empties the block it says so instead of reporting a bare zero that would read as "nothing calls this". `--json` adds `hiddenByExcludeTests` only when the filter actually hid something. `--grep <pattern>` narrows the caller block to callers whose enclosing symbol name matches this regex (literal substring if it is not valid regex), the same filter `refs --grep`/`call-chain --grep` apply to their own results — useful for a high-fanout symbol whose default 20-caller window is otherwise mostly noise; composes with `--exclude-tests`, and reports `hiddenByGrep` under `--json` only when it hid something. |
|
|
@@ -937,6 +949,15 @@ Three things follow, and they are worth knowing before you decide. It never leav
|
|
|
937
949
|
|------|------|
|
|
938
950
|
| `~/.qwen/settings.json` | Hook entries under Qwen Code's `PreToolUse`, `PostToolUse`, `PreCompact`, `UserPromptSubmit`, and `SubagentStop` events (Claude-Code-native names and payload shape, not Gemini's), using a catch-all matcher per event. Existing hooks preserved; a timestamped `.bak` is written before any change. |
|
|
939
951
|
|
|
952
|
+
**With `--kimi`** (Kimi Code integration)
|
|
953
|
+
|
|
954
|
+
| Path | What |
|
|
955
|
+
|------|------|
|
|
956
|
+
| `~/.kimi-code/config.toml` | `[[hooks]]` entries for Kimi Code's `PreToolUse`, `PostToolUse`, `PreCompact`, `UserPromptSubmit`, `SubagentStop`, and `SessionStart` events. Each entry carries only `event` and `command`, the keys Kimi Code's strict schema accepts. Existing hooks and other config keys preserved; a timestamped `.bak` is written before any change. |
|
|
957
|
+
| `~/.kimi-code/hooks/token-goat-shim.js` | The hook script those commands invoke. Rewrites a token-goat block into `hookSpecificOutput.permissionDecision` and a hint into a top-level `message`, and writes empty stdout for a no-op. Regenerated on every `install --kimi` run. |
|
|
958
|
+
| `~/.kimi-code/AGENTS.md` | A delimited block (`<!-- token-goat-kimi-begin -->` ... `<!-- token-goat-kimi-end -->`) with the routing guidance, adapted for Kimi Code tool names. |
|
|
959
|
+
| `~/.kimi-code/skills/token-goat/SKILL.md` | The same guidance as a Kimi Code skill. |
|
|
960
|
+
|
|
940
961
|
**With `--opencode`** (opencode plugin)
|
|
941
962
|
|
|
942
963
|
| Path | What |
|
|
@@ -1223,6 +1244,8 @@ Read is the exception: file content passes through to the model unfiltered, beca
|
|
|
1223
1244
|
|
|
1224
1245
|
Separately from that pass-through case: when a read hook *denies* a Read and substitutes its own message, any file bytes it embeds in that message (a markdown heading tree, a served compact or notebook sidecar, a re-read diff, a CSV header row, an HTML title) are wrapped in an `<untrusted-file-content>` fence first, so a hostile repo cannot get its own text presented to the model as token-goat speaking. That fencing is unconditional, not gated on the pattern scan.
|
|
1225
1246
|
|
|
1247
|
+
A third case needs no fence, because the danger is the line break rather than the wording. When token-goat prints its own summary of a file it prints one entry per line and takes the names and values straight out of that file: the column profile behind `csv-profile`, the key listing behind `json-outline` and `yaml-outline`, the entry listing behind `zip-list`, and any hook hint naming the file it is about. Every one of those values may legally contain a newline. A quoted CSV field spans lines by design, a JSON key is an arbitrary string, a zip entry name is whatever whoever built the archive wrote in the header, and a file name may contain a newline on Linux and macOS. So a single cell, key, entry or file name could end token-goat's line and start one of its own that reads exactly like another entry token-goat had written, with nothing but the line break to tell them apart. Control characters, Unicode line separators and format characters in those values are escaped into their visible form, so one entry stays one line and hostile content is shown rather than obeyed. The same rule covers a carriage return that would overwrite the line on screen, an ANSI escape that would recolour it, and a bidi override that would make the rest of it render backwards. Ordinary names and values pass through untouched. This matters most for an archive, since a `.whl`, `.vsix` or `.nupkg` comes from a package registry rather than from you.
|
|
1248
|
+
|
|
1226
1249
|
The MCP tools (`symbol` when given a `file` filter, `read`, `section`, `skeleton`, `outline`, `refs`, `brief`, `grep`, `imports`, `exports`) are confined to the project root, resolving symlinks before the check. Set `mcp.confine_reads_to_project_root = false` (env `TOKEN_GOAT_MCP_CONFINE_READS`) in your global config if you genuinely need cross-root reads from an MCP client; a per-project file cannot set it. The CLI is deliberately unconfined and unchanged. This is defense in depth for one sink, not a sandbox: an agent that can call these tools can usually call its own read tool too.
|
|
1227
1250
|
|
|
1228
1251
|
Note what that flag does and does not cover. It stops a caller traversing *out of* the root it is given; it does not constrain *which* root the caller supplies. Every MCP tool takes an optional `projectRoot`, and it exists for a reason — the server's cwd is often not the workspace root for MCP clients — but tool arguments are model-generated, so that choice is untrusted input like any other. If your deployment treats MCP as the only path to the filesystem, set `mcp.allowed_roots` (env `TOKEN_GOAT_MCP_ALLOWED_ROOTS`, delimiter-separated like `PATH`) to the roots that may legitimately be named; a resolved root outside every entry is then refused. It is empty by default, which keeps the multi-root behaviour above unchanged.
|