@tokmizer/plugin 0.9.60 → 0.9.61
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +45 -14
- package/command-templates/tkr-status.md +1 -1
- package/dist/bin/tkr-codex-hook.js +4 -4
- package/dist/bin/tkr-daemon.js +58 -58
- package/dist/bin/tkr-exec +35 -35
- package/dist/bin/tkr-exec.js +35 -35
- package/dist/bin/tkr-processor.js +4 -4
- package/dist/bin/tkr-shim.js +4 -4
- package/dist/bin/tkr.js +85 -85
- package/dist/hooks-host/command-expansion.js +3 -0
- package/dist/hooks-host/post-tool-use.js +4 -4
- package/dist/hooks-host/pre-tool-use.js +5 -5
- package/dist/hooks-host/reducer-stop.js +13 -13
- package/dist/hooks-host/session-recap.js +1 -1
- package/dist/index.js +4 -4
- package/dist/native/manifest.json +12 -12
- package/dist/native/single.json +12 -12
- package/dist/native/tkr-exec-darwin-arm64 +0 -0
- package/dist/native/tkr-exec-darwin-x64 +0 -0
- package/dist/native/tkr-exec-linux-arm64 +0 -0
- package/dist/native/tkr-exec-linux-x64 +0 -0
- package/dist/native/tkr-exec-win32-arm64.exe +0 -0
- package/dist/native/tkr-exec-win32-x64.exe +0 -0
- package/hooks/hooks.json +12 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tokmizer
|
|
2
2
|
|
|
3
|
-
Tokmizer reduces token consumption for AI coding
|
|
3
|
+
Tokmizer reduces token consumption for 21 AI coding agents, including Claude Code, OpenAI Codex, Cursor, Gemini CLI and GitHub Copilot. Aider, Cline and Windsurf run through `tkr wrap`. Works on macOS, Linux, and Windows.
|
|
4
4
|
|
|
5
5
|
It shortens command output before it reaches the model, reducing the space it takes in the context window. The reduction depends on the output and the chosen mode. This is not a guarantee of a lower bill or faster coding, rendering, or builds.
|
|
6
6
|
|
|
@@ -15,7 +15,14 @@ In Claude Code:
|
|
|
15
15
|
|
|
16
16
|
Then restart Claude Code once, hooks only load at startup. Verify with `/tkr-status`, you should see Status active.
|
|
17
17
|
|
|
18
|
-
Any other
|
|
18
|
+
Any other agent: install the CLI with npm (Node.js 20.11 or newer), then set up every agent found on this machine:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g @tokmizer/plugin
|
|
22
|
+
tkr setup --all
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Without Node.js, the install script uses npm when Node.js 20.11 or newer is there and otherwise downloads a standalone build for macOS or Linux, checked against its SHA-256. It leaves your shell profile unchanged. Then run `tkr setup --all`.
|
|
19
26
|
|
|
20
27
|
```bash
|
|
21
28
|
curl -fsSL https://tokmizer.com/install.sh | bash
|
|
@@ -25,7 +32,7 @@ Windows (PowerShell):
|
|
|
25
32
|
|
|
26
33
|
```powershell
|
|
27
34
|
npm.cmd install -g @tokmizer/plugin
|
|
28
|
-
tkr.cmd
|
|
35
|
+
tkr.cmd setup --all
|
|
29
36
|
```
|
|
30
37
|
|
|
31
38
|
See the [installation guide](https://tokmizer.com/en/docs#installation) for per-tool notes.
|
|
@@ -36,7 +43,7 @@ Codex, after installing with npm or Homebrew:
|
|
|
36
43
|
tkr setup-codex
|
|
37
44
|
```
|
|
38
45
|
|
|
39
|
-
Restart Codex, then approve the hook in `/hooks`.
|
|
46
|
+
Restart Codex, then approve the hook in `/hooks`. `tkr setup --all` includes Codex.
|
|
40
47
|
|
|
41
48
|
If Codex reports `PreToolUse hook returned updatedInput without permissionDecision:allow`, it is running the Claude Code hooks: an older Tokmizer plugin installed in Codex, or hooks copied over by Codex `/import`. Run `tkr doctor --fix`, then approve the Tokmizer hook in `/hooks` and restart Codex.
|
|
42
49
|
|
|
@@ -93,7 +100,9 @@ Each command adds one `PreToolUse` hook for the agent's shell tool. It rewrites
|
|
|
93
100
|
|
|
94
101
|
Permission rules stay in force. Agents match their allow, ask and deny rules against the command text, so Tokmizer leaves a command untouched whenever one of your deny or ask rules matches it. Tokmizer reads those rules for Claude Code (`permissions.deny` and `permissions.ask` in user, project, local and managed settings; a command matched by one of your `permissions.allow` rules is left untouched too, so that rule keeps approving it), OpenCode (`permission` in `opencode.json`), Cursor CLI (`permissions.deny`), Gemini CLI (policy files and `tools.exclude`) and Antigravity CLI (`permissions.deny` and `permissions.ask`). For the other agents, and on top of the Cursor, Gemini and Antigravity rules, only inspection, build and test commands (`cat`, `rg`, `git log`, `npm test`, `cargo build` and similar; inspection only for Codex) are routed; anything else, such as `git push` or `rm`, runs exactly as typed. If a settings file cannot be read, nothing is routed. Shell functions, aliases, builtins and anything that is not a program on your `PATH` always run exactly as typed.
|
|
95
102
|
|
|
96
|
-
In Claude Code, a command is rewritten only when that adds no permission prompt: in `bypassPermissions` mode, or when a plain `Bash` allow rule in your user or managed settings applies and the session is in default, `acceptEdits` or `dontAsk` mode. Otherwise it runs exactly as typed, so Claude Code still approves read-only commands such as `ls`, `cat` or `git status` on its own, and Tokmizer shortens the output once the command has succeeded.
|
|
103
|
+
In Claude Code, a command is rewritten only when that adds no permission prompt: in `bypassPermissions` mode, or when a plain `Bash` allow rule in your user or managed settings applies and the session is in default, `acceptEdits` or `dontAsk` mode. Otherwise it runs exactly as typed, so Claude Code still approves read-only commands such as `ls`, `cat` or `git status` on its own, and Tokmizer shortens the output once the command has succeeded. Claude Code runs that after-command hook only for successful commands, so in this default mode a failing command reaches Claude in full. When commands are rewritten, failing output is shortened too, with its failure details kept.
|
|
104
|
+
|
|
105
|
+
Aider, Cline and Windsurf have no hooks. Start them through Tokmizer, for example `tkr wrap aider`: only that session goes through Tokmizer's command shims. Your own terminals are not changed; `tkr shim global-path on` routes every terminal through the shims by adding a PATH line to your shell profile, and `tkr shim global-path off` removes it.
|
|
97
106
|
|
|
98
107
|
Every agent found on this machine at once (each `tkr setup-…` above runs in turn, agents that are not installed are skipped, and a summary ends the run):
|
|
99
108
|
|
|
@@ -111,10 +120,10 @@ Homebrew:
|
|
|
111
120
|
|
|
112
121
|
```bash
|
|
113
122
|
brew install norwelltw/tokmizer/tokmizer
|
|
114
|
-
tkr
|
|
123
|
+
tkr setup --all
|
|
115
124
|
```
|
|
116
125
|
|
|
117
|
-
Node.js
|
|
126
|
+
The formula brings Node.js with it. Installed with npm or Homebrew, tkr updates itself when a new version is out; `tkr auto-update off` stops that. Restart each agent after its setup, then run `tkr status`. An offline installation reports that free activation is pending; run `tkr status` again when online.
|
|
118
127
|
|
|
119
128
|
## Free access
|
|
120
129
|
|
|
@@ -139,7 +148,7 @@ In Claude Code:
|
|
|
139
148
|
- `/tkr-telemetry` views or changes usage stats (command names and token counts; on by default, off in one command)
|
|
140
149
|
- `/tkr-update` updates the plugin when a new version is out
|
|
141
150
|
|
|
142
|
-
From any terminal (after
|
|
151
|
+
From any terminal (after installing with npm, the install script or Homebrew):
|
|
143
152
|
|
|
144
153
|
- `tkr status` shows your account and engine status
|
|
145
154
|
- `tkr gain` shows the estimated reduction in command-output tokens
|
|
@@ -151,6 +160,9 @@ From any terminal (after the shell-shim install, or `npm install -g @tokmizer/pl
|
|
|
151
160
|
- `tkr settings show|set|configure` manages settings and syncs them across your machines
|
|
152
161
|
- `tkr network off|on|status` blocks or allows every connection to tokmizer.com
|
|
153
162
|
- `tkr migrate rtk` moves your rtk filters, settings and history over and turns off rtk hooks where Tokmizer runs (see [Switching from rtk to Tokmizer](#switching-from-rtk-to-tokmizer))
|
|
163
|
+
- `tkr setup [--all]` sets up the agents found on this machine; `tkr setup-<agent> --remove` takes one out
|
|
164
|
+
- `tkr doctor [--fix]` shows what is detected and repairs outdated shims and hooks
|
|
165
|
+
- `tkr uninstall` removes every hook, shim and PATH line Tokmizer added (see [Uninstall](#uninstall))
|
|
154
166
|
|
|
155
167
|
## /power and the reducer in other agents
|
|
156
168
|
|
|
@@ -187,7 +199,7 @@ Never overwritten: an existing `power` command or skill that Tokmizer did not wr
|
|
|
187
199
|
|
|
188
200
|
Choose `light` for gentle reduction, `balanced` (the default) for more compact output, or `max` for the strongest standard reduction. The aliases `normal`, `compact`, and `minimal` map to these levels respectively. Short or exact output can be identical across levels.
|
|
189
201
|
|
|
190
|
-
|
|
202
|
+
Since 0.9.54, Light keeps recognized file reads of up to 16 KB complete; larger reads are shortened again. Balanced and Max can fold code bodies. Choose Light when you need implementation details. Explicit outlining remains available to callers that request it. Host limits and the CLI's output buffer still apply.
|
|
191
203
|
|
|
192
204
|
Since 0.9.52, short code reads and small explicit excerpts stay complete by default in all three standard modes. Larger reads can still be shortened. Recognized failures retain their diagnostics; Max can summarize repeated log lines with an occurrence count. Distinct diagnostic messages and command exit codes are preserved.
|
|
193
205
|
|
|
@@ -212,7 +224,7 @@ Terminal commands managed by Tokmizer use the mode selected when execution start
|
|
|
212
224
|
|
|
213
225
|
`tkr gain` measures output size before and after compression and estimates tokens as UTF-8 bytes divided by four. Token and cost figures are estimates about command output, not your actual bill or a measure of task quality or completion speed.
|
|
214
226
|
|
|
215
|
-
|
|
227
|
+
Since 0.9.53, successful `tkr restore` calls are counted as additional output in the local gain history, even with telemetry disabled. They reduce the net saving; repeated restorations count again and can make it negative. The display shows restored tokens separately. `gain --json` exposes the net estimate in `observed.savedTokens` and restoration totals in `restoration`; the existing top-level `savedTokens` remains the total for reduced outputs only. Earlier restorations cannot be reconstructed from local history. Manually repeated commands, prompts, replies and replayed conversation context are not attributed to restoration costs.
|
|
216
228
|
|
|
217
229
|
Other local views: `tkr gain --by-rule` groups savings by rule (your custom filters by name, built-in rules by command), `tkr gain --failures` lists commands whose output went through unchanged and why (no rule, nothing to cut, failed run kept in full), and `tkr gain --quota [pro|5x|20x]` estimates the share of a Claude plan budget the savings represent. The quota view is an estimate, not a plan limit: tokens saved per day × 30, divided by an assumed 44,000 tokens per 5-hour window × 144 windows × the plan multiplier (1, 5 or 20). Anthropic does not publish plan limits in tokens. All three combine with a period, `--project` and `--json`.
|
|
218
230
|
|
|
@@ -236,7 +248,7 @@ Entries are kept 30 days, up to 8 MB each and 200 MB in total; the oldest go fir
|
|
|
236
248
|
|
|
237
249
|
On October 9, 2026, a fixed set of 30 real and synthetic command outputs contained 774,863 tokens before compression. The table counts tokens with the cl100k tokenizer, excluding restoration notices. It is a test corpus, not a sample of customer usage.
|
|
238
250
|
|
|
239
|
-
These are historical results for the earlier mode behavior, not measurements of the
|
|
251
|
+
These are historical results for the earlier mode behavior, not measurements of the Light read policy introduced in 0.9.54.
|
|
240
252
|
|
|
241
253
|
| Mode | Output tokens | Preservation checks passed |
|
|
242
254
|
| --- | ---: | ---: |
|
|
@@ -255,6 +267,10 @@ In a separate controlled test for 0.9.52, a repetitive failure log went from 1,0
|
|
|
255
267
|
|
|
256
268
|
These tokenizer counts are separate from the byte-based estimates in `tkr gain`. They measure output volume, not your bill, an agent's task success, or execution speed. See the [mode guide](https://tokmizer.com/en/docs#configuration) for usage and limits.
|
|
257
269
|
|
|
270
|
+
### Benchmark of October 17, 2026
|
|
271
|
+
|
|
272
|
+
Each tool's Claude Code hook chain replayed 68 real command outputs offline (network cut, empty home folder, no account, median of 3 runs) with Tokmizer 0.9.60 and its default settings, against rtk 1.0.1. Tokmizer removed 84% of tokens in Claude Code's default mode and up to 93% when commands are rewritten (`bypassPermissions` or a plain `Bash` allow rule); rtk removed 55%. All 307 failure details were kept in both Tokmizer modes. The full results are on [tokmizer.com/en/compare/rtk](https://tokmizer.com/en/compare/rtk).
|
|
273
|
+
|
|
258
274
|
## Custom filters
|
|
259
275
|
|
|
260
276
|
Add your own output rules as `*.toml` files in `~/.tokmizer/filters/` (or `$TOKMIZER_HOME/filters/`). They load next to the built-in rules and win over them for the commands they match. They stay on your machine and are never uploaded. A file or rule that fails validation is skipped; `tkr doctor` shows what was loaded and why something was skipped.
|
|
@@ -319,10 +335,10 @@ What leaves your machine, and when:
|
|
|
319
335
|
|---|---|---|
|
|
320
336
|
| First online run, no account | A random install ID, your computer name, OS and version, CPU model and core count, a SHA-256 hash of your network card (MAC) address, a SHA-256 hash of your user name, a fingerprint (SHA-256 of all of these), your time zone and the plugin version | Create the install token used to download rules |
|
|
321
337
|
| `tkr link <key>` | The same, plus your key, and your email only if you pass `--email` | Attach this machine to your account |
|
|
322
|
-
| Regular check-in (heartbeat) | Install ID, fingerprint, plugin version, local date and time zone | Refresh access
|
|
338
|
+
| Regular check-in (heartbeat) | Install ID, fingerprint, plugin version, local date and time zone; while usage stats are on, also install health counts, for example outdated shims, broken hooks, repairs and commands that ran without Tokmizer because its files were missing | Refresh access, learn that a new version is out and spot broken installs |
|
|
323
339
|
| Rule downloads | Install ID, fingerprint, plugin version | Get the latest compression rules and the `/power` and reducer instructions |
|
|
324
340
|
| Settings sync, linked accounts only | Your Tokmizer settings | Keep them in sync with the dashboard |
|
|
325
|
-
| Usage stats, only while they are on (with or without an account) | Command names such as `npm install` (never arguments; Git and GitHub commands
|
|
341
|
+
| Usage stats, only while they are on (with or without an account) | Command names such as `npm install` (never arguments; Git and GitHub commands only as the tool and its action, such as `git push` or `gh pr`), token counts, rule IDs with output sizes, session ID, agent name | See which commands to optimize next |
|
|
326
342
|
| `tkr unlink` | Install ID, fingerprint | Remove this device from your account |
|
|
327
343
|
| CLI self-update, after a check-in reports a new version | Runs `npm i -g @tokmizer/plugin@<version>` or `brew upgrade tokmizer`, which contact the npm registry, Homebrew and GitHub | Keep the CLI current (`tkr auto-update off` stops only this) |
|
|
328
344
|
|
|
@@ -351,7 +367,7 @@ tkr network on
|
|
|
351
367
|
|
|
352
368
|
In CI or for one shell, set `TOKMIZER_NETWORK=0`. `tkr status` and `tkr doctor` show the current state.
|
|
353
369
|
|
|
354
|
-
While it is off there is no sign-up, heartbeat, rule download, settings sync, usage stats or update check. Tokmizer keeps compressing locally: with the last downloaded rules for up to 7 days, then with
|
|
370
|
+
While it is off there is no sign-up, heartbeat, rule download, settings sync, usage stats or update check. Tokmizer keeps compressing locally: with the last downloaded rules for up to 7 days, then with the rules built into the CLI. Settings are saved on this machine only. `tkr link` and `tkr heartbeat` explain how to turn the network back on.
|
|
355
371
|
|
|
356
372
|
The switch does not cover Claude Code's own marketplace auto-update, which `/tkr-update` turns on (set `extraKnownMarketplaces.tokmizer.autoUpdate` to `false` in `~/.claude/settings.json` to stop it), nor commands you run yourself such as the installer, `/tkr-update`, npm or brew.
|
|
357
373
|
|
|
@@ -361,6 +377,21 @@ The switch does not cover Claude Code's own marketplace auto-update, which `/tkr
|
|
|
361
377
|
- The public [redaction helpers](https://github.com/norwelltw/Tokmizer/blob/main/src/learn/redact.ts) are available for inspection.
|
|
362
378
|
- Local state lives in `~/.tokmizer/`.
|
|
363
379
|
|
|
380
|
+
## Uninstall
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
tkr uninstall
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
`tkr uninstall` removes every hook, shim and PATH line Tokmizer added, `/power` and the reducer in the other agents, and the config backups. It does not remove the program itself. Then run the command for the way you installed it:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
npm uninstall -g @tokmizer/plugin
|
|
390
|
+
brew uninstall tokmizer
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
In Claude Code: `/plugin uninstall tokmizer@tokmizer`. Your savings history stays in `~/.tokmizer` until you delete that folder. To pause Tokmizer without uninstalling: `tkr settings set enabled false`.
|
|
394
|
+
|
|
364
395
|
## License
|
|
365
396
|
|
|
366
397
|
Proprietary. See [LICENSE](LICENSE) and the EULA at [tokmizer.com/eula](https://tokmizer.com/eula).
|
|
@@ -12,7 +12,7 @@ node "${CLAUDE_PLUGIN_ROOT}/dist/bin/tkr.js" status
|
|
|
12
12
|
|
|
13
13
|
Print the output as is. It includes the network state, the token state, whether the device is linked and whether `/power` is available right now. Tokmizer is free: there is no plan or subscription to mention.
|
|
14
14
|
|
|
15
|
-
If the user asks what Tokmizer sends over the network, answer plainly. No account or email is needed. Tokmizer contacts tokmizer.com to keep its rules up to date and to improve the product. It sends a random install ID, the computer name, OS and CPU model, a hash of the network card address and of the user name, and the plugin version. This is not anonymous: the same machine always gives the same values. Command contents and output are never sent. Usage stats (command names, token counts and install health counts) are sent only
|
|
15
|
+
If the user asks what Tokmizer sends over the network, answer plainly. No account or email is needed. Tokmizer contacts tokmizer.com to keep its rules up to date and to improve the product. It sends a random install ID, the computer name, OS and CPU model, a hash of the network card address and of the user name, and the plugin version. This is not anonymous: the same machine always gives the same values. Command contents and output are never sent. Usage stats (command names, token counts and install health counts) are on by default and sent only while they are on; `tkr telemetry off` stops them. Git and GitHub commands are recorded only as the tool and its action, such as `git push`.
|
|
16
16
|
|
|
17
17
|
If the output shows `Network: off`, explain that nothing leaves the machine and Tokmizer keeps compressing with the rules already on it. To turn it back on: `tkr network on`. To turn everything off: `tkr network off`; usage stats only: `tkr telemetry off`.
|
|
18
18
|
|