@openclaw/tokenjuice 2026.9.4 → 2026.9.6

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 (41) hide show
  1. package/assets/activity.svg +3 -0
  2. package/assets/icon.png +0 -0
  3. package/node_modules/tokenjuice/README.md +10 -1
  4. package/node_modules/tokenjuice/dist/cli/install-output.d.ts +7 -0
  5. package/node_modules/tokenjuice/dist/cli/install-output.js +19 -0
  6. package/node_modules/tokenjuice/dist/cli/main.d.ts +7 -0
  7. package/node_modules/tokenjuice/dist/cli/main.js +201 -36
  8. package/node_modules/tokenjuice/dist/core/analysis.js +3 -3
  9. package/node_modules/tokenjuice/dist/core/artifacts.d.ts +6 -1
  10. package/node_modules/tokenjuice/dist/core/artifacts.js +122 -45
  11. package/node_modules/tokenjuice/dist/core/bounded-jsonl.d.ts +26 -0
  12. package/node_modules/tokenjuice/dist/core/bounded-jsonl.js +407 -0
  13. package/node_modules/tokenjuice/dist/core/compaction-metadata.d.ts +1 -1
  14. package/node_modules/tokenjuice/dist/core/integrations/compact-bash-result.d.ts +2 -0
  15. package/node_modules/tokenjuice/dist/core/integrations/compact-bash-result.js +3 -2
  16. package/node_modules/tokenjuice/dist/core/reduce.js +23 -10
  17. package/node_modules/tokenjuice/dist/core/text.d.ts +4 -0
  18. package/node_modules/tokenjuice/dist/core/text.js +32 -0
  19. package/node_modules/tokenjuice/dist/core/wrap.js +1 -1
  20. package/node_modules/tokenjuice/dist/hosts/codex/index.d.ts +31 -1
  21. package/node_modules/tokenjuice/dist/hosts/codex/index.js +554 -288
  22. package/node_modules/tokenjuice/dist/hosts/droid/index.js +12 -3
  23. package/node_modules/tokenjuice/dist/hosts/grok-bot/index.d.ts +25 -0
  24. package/node_modules/tokenjuice/dist/hosts/grok-bot/index.js +644 -0
  25. package/node_modules/tokenjuice/dist/hosts/opencode/extension/runtime.js +644 -279
  26. package/node_modules/tokenjuice/dist/hosts/pi/extension/runtime.js +647 -282
  27. package/node_modules/tokenjuice/dist/hosts/shared/hook-command-doctor.d.ts +24 -0
  28. package/node_modules/tokenjuice/dist/hosts/shared/hook-command-doctor.js +80 -1
  29. package/node_modules/tokenjuice/dist/hosts/shared/hook-command.d.ts +19 -0
  30. package/node_modules/tokenjuice/dist/hosts/shared/hook-command.js +61 -6
  31. package/node_modules/tokenjuice/dist/hosts/shared/hook-doctor.d.ts +3 -1
  32. package/node_modules/tokenjuice/dist/hosts/shared/hook-doctor.js +2 -0
  33. package/node_modules/tokenjuice/dist/hosts/shared/host-command.d.ts +10 -1
  34. package/node_modules/tokenjuice/dist/hosts/shared/host-command.js +43 -4
  35. package/node_modules/tokenjuice/dist/hosts/shared/pre-tool-wrap.js +9 -7
  36. package/node_modules/tokenjuice/dist/index.d.ts +3 -1
  37. package/node_modules/tokenjuice/dist/index.js +2 -1
  38. package/node_modules/tokenjuice/dist/types.d.ts +15 -0
  39. package/node_modules/tokenjuice/package.json +1 -1
  40. package/openclaw.plugin.json +1 -1
  41. package/package.json +8 -6
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M3 5h6M3 19h6M21 5h-6M21 19h-6M3 12h6l-3-3m3 3-3 3M21 12h-6l3-3m-3 3 3 3" />
3
+ </svg>
Binary file
@@ -80,6 +80,7 @@ beta integrations:
80
80
  | <img width="48px" src="docs/client-goose.svg" alt="Goose" /> | [Goose](https://goose-docs.ai/) | `tokenjuice install goose` | `.goosehints` |
81
81
  | <img width="48px" src="docs/client-greptile.svg" alt="Greptile" /> | [Greptile](https://www.greptile.com/docs/code-review/greptile-config) | `tokenjuice install greptile` | `.greptile/rules.md` |
82
82
  | <img width="48px" src="docs/client-grok-build.svg" alt="Grok Build" /> | [Grok Build](https://docs.x.ai/build/overview) | `tokenjuice install grok-build` | `AGENTS.md` |
83
+ | <img width="48px" src="docs/client-grok-bot.svg" alt="Grok Bot" /> | Grok Bot | `tokenjuice install grok-bot` | `.cursor/rules/tokenjuice.mdc` |
83
84
  | <img width="48px" src="docs/client-grok-cli.svg" alt="Grok CLI" /> | [Grok CLI](https://github.com/superagent-ai/grok-cli) | `tokenjuice install grok-cli` | `~/.grok/user-settings.json` |
84
85
  | <img width="48px" src="docs/client-gptme.svg" alt="gptme" /> | [gptme](https://gptme.org/docs/prompts.html) | `tokenjuice install gptme` | `AGENTS.md` |
85
86
  | <img width="48px" src="docs/client-copilot.png" alt="GitHub Copilot coding agent" /> | [GitHub Copilot coding agent](https://docs.github.com/en/copilot/using-github-copilot/coding-agent) | `tokenjuice install copilot-agent` | `.github/hooks/tokenjuice-agent.json` |
@@ -130,11 +131,15 @@ npm install -g tokenjuice
130
131
  pnpm add -g tokenjuice
131
132
  # or
132
133
  yarn global add tokenjuice
133
- # or
134
+ # or (the vincentkoc/tap alias maps to github.com/vincentkoc/homebrew-tap)
134
135
  brew tap vincentkoc/tap
135
136
  brew install tokenjuice
136
137
  ```
137
138
 
139
+ Homebrew publication is owned by the Tokenjuice workflow in the canonical
140
+ `vincentkoc/homebrew-tap` repository. Release maintainers dispatch it manually
141
+ with the published tag until GitHub App automation lands.
142
+
138
143
  then:
139
144
 
140
145
  ```bash
@@ -161,6 +166,7 @@ tokenjuice --version
161
166
  tokenjuice reduce [file]
162
167
  tokenjuice reduce-json [file]
163
168
  tokenjuice wrap -- <command> [args...]
169
+ tokenjuice wrap --no-stats -- <command> [args...]
164
170
  tokenjuice wrap --raw -- <command> [args...]
165
171
  tokenjuice wrap --store -- <command> [args...]
166
172
  tokenjuice install [adal|aether|aictl|ai-memory-protocol|aider|agent-layer|agentinit|agentlink|agentloom|agents-cli|agents-md|agentsge|agentsmesh|amazon-q|amp|antigravity|anywhere-agents|augment|avante|baz|bito|blackbox|blocks|clawdbot|bob|builder|charlie|codex|claude-code|cline|codeant|codebuff|codegen|coder-agents|coderabbit|codebuddy|command-code|continue|copilot-agent|crush|cursor|deepagents|devin|dot-agents|docker-agent|droid|eca|elyra|firebase-studio|forgecode|gemini-cli|gitlab-duo|goose|greptile|grok-build|grok-cli|gptme|jean2|jetbrains-ai|junie|jules|leanctl|kimi|kiro|kilo|localcode|mcp-agent|mini-swe-agent|swe-agent|stagewise|mistral-vibe|mux|novakit|knowns|ona|openhands|open-interpreter|openwebui|pi|pi-go|opencode|plandex|qodo|qoder|qwen-code|replit|roo|rovo|ruler|tabby|tabnine|trae|uipath|vscode-copilot|warp|windsurf|copilot-cli|zed|zencoder]
@@ -176,6 +182,7 @@ tokenjuice doctor pi
176
182
  tokenjuice doctor opencode
177
183
  tokenjuice stats
178
184
  tokenjuice stats --timezone utc
185
+ tokenjuice stats --limit 1000
179
186
  ```
180
187
 
181
188
  ## overview
@@ -191,6 +198,8 @@ tokenjuice wrap --raw -- pnpm --help
191
198
  tokenjuice wrap --full -- git status
192
199
  ```
193
200
 
201
+ statistics use bounded metadata segments and exclude pre-existing JSON sidecars. page with `--limit` and the returned `--cursor`; output reports when coverage is partial. set `TOKENJUICE_STATS=off` or pass `--no-stats` to stop metadata and hook-debug telemetry writes. `--raw` and `--full` return untouched bytes; artifact retention remains opt-in through `--store`.
202
+
194
203
  useful maintenance commands:
195
204
 
196
205
  ```bash
@@ -2,4 +2,11 @@ export type InstallOutputDetail = {
2
2
  label: string;
3
3
  value: string;
4
4
  };
5
+ export type CodeBuddyInstallOutput = {
6
+ settingsPath: string;
7
+ command: string;
8
+ backupPath?: string;
9
+ local: boolean;
10
+ };
5
11
  export declare function formatInstallSuccess(target: string, noun: string, details: InstallOutputDetail[]): string;
12
+ export declare function formatCodeBuddyInstallSuccess(result: CodeBuddyInstallOutput): string;
@@ -9,3 +9,22 @@ export function formatInstallSuccess(target, noun, details) {
9
9
  }
10
10
  return `${lines.join("\n")}\n`;
11
11
  }
12
+ export function formatCodeBuddyInstallSuccess(result) {
13
+ const doctorCommand = `tokenjuice doctor codebuddy${result.local ? " --local" : ""}`;
14
+ const details = [
15
+ { label: "Settings", value: result.settingsPath },
16
+ { label: "Command", value: result.command },
17
+ {
18
+ label: "Activate",
19
+ value: "open /hooks and review the external change for this session, or start a new CodeBuddy session",
20
+ },
21
+ {
22
+ label: "Verify",
23
+ value: `${doctorCommand} (persisted config only; not active-session activation)`,
24
+ },
25
+ ];
26
+ if (result.backupPath) {
27
+ details.push({ label: "Backup", value: result.backupPath });
28
+ }
29
+ return formatInstallSuccess("codebuddy", "hook", details);
30
+ }
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import type { StatsSourceReport } from "../core/analysis.js";
2
3
  import type { WrapResult } from "../types.js";
3
4
  type Format = "text" | "json";
4
5
  type ParsedArgs = {
@@ -11,9 +12,11 @@ type ParsedArgs = {
11
12
  toolName: string | undefined;
12
13
  exitCode: number | undefined;
13
14
  store: boolean;
15
+ noStats: boolean;
14
16
  tee: boolean;
15
17
  raw: boolean;
16
18
  noOmit: boolean;
19
+ allowOmit: boolean;
17
20
  storeDir: string | undefined;
18
21
  maxInlineChars: number | undefined;
19
22
  maxCaptureBytes: number | undefined;
@@ -21,6 +24,8 @@ type ParsedArgs = {
21
24
  timeZone: string | undefined;
22
25
  source: string | undefined;
23
26
  bySource: boolean;
27
+ limit: number | undefined;
28
+ cursor: string | undefined;
24
29
  wrapLauncher: string | undefined;
25
30
  trace: boolean;
26
31
  printInstructions: boolean;
@@ -30,5 +35,7 @@ type ParsedArgs = {
30
35
  export declare function parseArgs(argv: string[]): ParsedArgs;
31
36
  export declare function resolveNoOmit(noOmitFlag: boolean, env?: NodeJS.ProcessEnv): boolean;
32
37
  export declare function decorateWrapInlineText(result: WrapResult["result"], raw: boolean): string;
38
+ export declare function formatStatsSources(sources: StatsSourceReport[]): string;
39
+ export declare function main(argv?: string[]): Promise<number>;
33
40
  export declare function isDirectModuleEntrypoint(moduleUrl: string | URL, argv?: string[]): Promise<boolean>;
34
41
  export {};
@@ -4,7 +4,8 @@ import { dirname, relative, resolve } from "node:path";
4
4
  import { stdin as inputStdin } from "node:process";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import packageJson from "../../package.json" with { type: "json" };
7
- import { getArtifact, listArtifactMetadata, listArtifacts } from "../core/artifacts.js";
7
+ import { getArtifact, listArtifactMetadata, listArtifactMetadataPage, listArtifacts } from "../core/artifacts.js";
8
+ import { shouldRecordStats } from "../core/artifacts.js";
8
9
  import { buildAnalysisEntry, discoverCandidates, doctorArtifacts, statsArtifacts } from "../core/analysis.js";
9
10
  import { verifyBuiltinFixtures } from "../core/fixtures.js";
10
11
  import { readNoOmissionFromEnv } from "../core/env.js";
@@ -12,6 +13,7 @@ import { parseReduceJsonRequest } from "../core/json-protocol.js";
12
13
  import { WRAP_AUTHORITATIVE_FOOTER } from "../core/compaction-metadata.js";
13
14
  import { reduceExecution } from "../core/reduce.js";
14
15
  import { verifyRules } from "../core/rules.js";
16
+ import { UNKNOWN_ARTIFACT_SOURCE } from "../core/source.js";
15
17
  import { runWrappedCommand } from "../core/wrap.js";
16
18
  import { doctorAdalInstructions, installAdalInstructions, uninstallAdalInstructions } from "../hosts/adal/index.js";
17
19
  import { doctorAetherPrompt, installAetherPrompt, uninstallAetherPrompt } from "../hosts/aether/index.js";
@@ -50,7 +52,7 @@ import { doctorCodeRabbitConfig, installCodeRabbitConfig, uninstallCodeRabbitCon
50
52
  import { doctorCodeBuddyHook, installCodeBuddyHook, runCodeBuddyPreToolUseHook, uninstallCodeBuddyHook } from "../hosts/codebuddy/index.js";
51
53
  import { doctorCommandCodeHook, installCommandCodeHook, runCommandCodePostToolUseHook, uninstallCommandCodeHook } from "../hosts/command-code/index.js";
52
54
  import { doctorContinueRule, installContinueRule, uninstallContinueRule } from "../hosts/continue/index.js";
53
- import { doctorCodexHook, installCodexHook, runCodexPostToolUseHook, uninstallCodexHook } from "../hosts/codex/index.js";
55
+ import { doctorCodexHook, installCodexHook, runCodexPostToolUseHook, uninstallCodexHook, } from "../hosts/codex/index.js";
54
56
  import { doctorCopilotAgentHook, installCopilotAgentHook, runCopilotAgentPostToolUseHook, uninstallCopilotAgentHook } from "../hosts/copilot-agent/index.js";
55
57
  import { doctorCopilotCliHook, getCopilotCliInstructionsSnippet, installCopilotCliHook, runCopilotCliPostToolUseHook, uninstallCopilotCliHook, } from "../hosts/copilot-cli/index.js";
56
58
  import { doctorCrushSkill, installCrushSkill, uninstallCrushSkill } from "../hosts/crush/index.js";
@@ -69,6 +71,7 @@ import { doctorGitLabDuoRule, installGitLabDuoRule, uninstallGitLabDuoRule } fro
69
71
  import { doctorGooseHints, installGooseHints, uninstallGooseHints } from "../hosts/goose/index.js";
70
72
  import { doctorGreptileRule, installGreptileRule, uninstallGreptileRule } from "../hosts/greptile/index.js";
71
73
  import { doctorGrokBuildInstructions, installGrokBuildInstructions, uninstallGrokBuildInstructions } from "../hosts/grok-build/index.js";
74
+ import { doctorGrokBotRule, installGrokBotRule, uninstallGrokBotRule } from "../hosts/grok-bot/index.js";
72
75
  import { doctorGrokCliHook, installGrokCliHook, runGrokCliPostToolUseHook, uninstallGrokCliHook } from "../hosts/grok-cli/index.js";
73
76
  import { doctorGptmeInstructions, installGptmeInstructions, uninstallGptmeInstructions } from "../hosts/gptme/index.js";
74
77
  import { doctorJean2Instructions, installJean2Instructions, uninstallJean2Instructions } from "../hosts/jean2/index.js";
@@ -115,7 +118,7 @@ import { doctorZencoderRule, installZencoderRule, uninstallZencoderRule } from "
115
118
  import { doctorInstalledHooks } from "../hosts/shared/hook-doctor.js";
116
119
  import { shellQuote } from "../hosts/shared/hook-command.js";
117
120
  import { formatHookDoctorReport } from "./doctor-output.js";
118
- import { formatInstallSuccess } from "./install-output.js";
121
+ import { formatCodeBuddyInstallSuccess, formatInstallSuccess } from "./install-output.js";
119
122
  function formatPlandexLoadCommand(conventionPath) {
120
123
  const loadPath = relative(process.cwd(), conventionPath) || "PLANDEX.tokenjuice.md";
121
124
  return `plandex load ${shellQuote(loadPath)}`;
@@ -131,9 +134,9 @@ function printUsage() {
131
134
  "usage:",
132
135
  " tokenjuice --help",
133
136
  " tokenjuice --version",
134
- " tokenjuice reduce [file] [--format text|json] [--classifier <id>] [--store] [--raw|--full] [--no-omit]",
137
+ " tokenjuice reduce [file] [--format text|json] [--classifier <id>] [--store] [--raw|--full] [--no-omit] [--no-stats]",
135
138
  " tokenjuice reduce-json [file]",
136
- " tokenjuice wrap [--raw|--full] [--no-omit] [--source <name>] -- <command> [args...] [--tee] [--store] [--max-capture-bytes <n>]",
139
+ " tokenjuice wrap [--raw|--full] [--no-omit] [--no-stats] [--source <name>] -- <command> [args...] [--tee] [--store] [--max-capture-bytes <n>]",
137
140
  " tokenjuice <command> ... [--trace]",
138
141
  " tokenjuice install adal",
139
142
  " tokenjuice install aether",
@@ -162,7 +165,7 @@ function printUsage() {
162
165
  " tokenjuice install bob",
163
166
  " tokenjuice install builder",
164
167
  " tokenjuice install charlie",
165
- " tokenjuice install codex [--local]",
168
+ " tokenjuice install codex [--local] [--no-omit]",
166
169
  " tokenjuice install claude-code [--local]",
167
170
  " tokenjuice install cline [--local]",
168
171
  " tokenjuice install codeant",
@@ -190,6 +193,7 @@ function printUsage() {
190
193
  " tokenjuice install goose",
191
194
  " tokenjuice install greptile",
192
195
  " tokenjuice install grok-build",
196
+ " tokenjuice install grok-bot",
193
197
  " tokenjuice install grok-cli [--local]",
194
198
  " tokenjuice install gptme",
195
199
  " tokenjuice install jean2",
@@ -289,6 +293,7 @@ function printUsage() {
289
293
  " tokenjuice uninstall goose",
290
294
  " tokenjuice uninstall greptile",
291
295
  " tokenjuice uninstall grok-build",
296
+ " tokenjuice uninstall grok-bot",
292
297
  " tokenjuice uninstall grok-cli",
293
298
  " tokenjuice uninstall gptme",
294
299
  " tokenjuice uninstall jean2",
@@ -337,8 +342,9 @@ function printUsage() {
337
342
  " tokenjuice cat <artifact-id>",
338
343
  " tokenjuice verify [--fixtures]",
339
344
  " tokenjuice discover [file] [--source-command <cmd>] [--tool-name <name>] [--exit-code <n>] [--source <name>] [--by-source]",
340
- " tokenjuice doctor [file|hooks|adal|aether|aictl|ai-memory-protocol|aider|agent-layer|agentinit|agentlink|agentloom|agents-cli|agents-md|agentsge|agentsmesh|amazon-q|amp|antigravity|anywhere-agents|augment|avante|baz|bito|blackbox|blocks|clawdbot|bob|builder|charlie|codex|claude-code|cline|codeant|codebuff|codegen|coder-agents|coderabbit|codebuddy|command-code|continue|copilot-agent|crush|cursor|deepagents|devin|dot-agents|docker-agent|droid|eca|elyra|firebase-studio|forgecode|gemini-cli|gitlab-duo|goose|greptile|grok-build|grok-cli|gptme|jean2|jetbrains-ai|junie|jules|leanctl|kimi|kiro|kilo|localcode|mcp-agent|mini-swe-agent|swe-agent|stagewise|mistral-vibe|mux|novakit|knowns|ona|openhands|open-interpreter|openwebui|pi|pi-go|opencode|plandex|qodo|qoder|qwen-code|replit|roo|rovo|ruler|tabby|tabnine|trae|uipath|vscode-copilot|warp|windsurf|zed|zencoder|copilot-cli] [--local] [--print-instructions] [--source-command <cmd>] [--tool-name <name>] [--exit-code <n>]",
341
- " tokenjuice stats [--timezone local|utc|<iana-timezone>] [--source <name>] [--by-source]",
345
+ " tokenjuice doctor [file|hooks|adal|aether|aictl|ai-memory-protocol|aider|agent-layer|agentinit|agentlink|agentloom|agents-cli|agents-md|agentsge|agentsmesh|amazon-q|amp|antigravity|anywhere-agents|augment|avante|baz|bito|blackbox|blocks|clawdbot|bob|builder|charlie|codex|claude-code|cline|codeant|codebuff|codegen|coder-agents|coderabbit|codebuddy|command-code|continue|copilot-agent|crush|cursor|deepagents|devin|dot-agents|docker-agent|droid|eca|elyra|firebase-studio|forgecode|gemini-cli|gitlab-duo|goose|greptile|grok-build|grok-bot|grok-cli|gptme|jean2|jetbrains-ai|junie|jules|leanctl|kimi|kiro|kilo|localcode|mcp-agent|mini-swe-agent|swe-agent|stagewise|mistral-vibe|mux|novakit|knowns|ona|openhands|open-interpreter|openwebui|pi|pi-go|opencode|plandex|qodo|qoder|qwen-code|replit|roo|rovo|ruler|tabby|tabnine|trae|uipath|vscode-copilot|warp|windsurf|zed|zencoder|copilot-cli] [--local] [--print-instructions] [--source-command <cmd>] [--tool-name <name>] [--exit-code <n>]",
346
+ " tokenjuice doctor codex [--local] [--no-omit]",
347
+ " tokenjuice stats [--timezone local|utc|<iana-timezone>] [--source <name>] [--by-source] [--limit <n>] [--cursor <cursor>]",
342
348
  ].join("\n"));
343
349
  process.stderr.write("\n");
344
350
  }
@@ -354,9 +360,11 @@ export function parseArgs(argv) {
354
360
  let toolName;
355
361
  let exitCode;
356
362
  let store = false;
363
+ let noStats = false;
357
364
  let tee = false;
358
365
  let raw = false;
359
366
  let noOmit = false;
367
+ let allowOmit = false;
360
368
  let storeDir;
361
369
  let maxInlineChars;
362
370
  let maxCaptureBytes;
@@ -364,6 +372,8 @@ export function parseArgs(argv) {
364
372
  let timeZone;
365
373
  let source;
366
374
  let bySource = false;
375
+ let limit;
376
+ let cursor;
367
377
  let wrapLauncher;
368
378
  let trace = false;
369
379
  let printInstructions = false;
@@ -428,6 +438,10 @@ export function parseArgs(argv) {
428
438
  store = true;
429
439
  index += 1;
430
440
  break;
441
+ case "--no-stats":
442
+ noStats = true;
443
+ index += 1;
444
+ break;
431
445
  case "--raw":
432
446
  case "--full":
433
447
  raw = true;
@@ -437,6 +451,10 @@ export function parseArgs(argv) {
437
451
  noOmit = true;
438
452
  index += 1;
439
453
  break;
454
+ case "--allow-omit":
455
+ allowOmit = true;
456
+ index += 1;
457
+ break;
440
458
  case "--tee":
441
459
  tee = true;
442
460
  index += 1;
@@ -487,6 +505,20 @@ export function parseArgs(argv) {
487
505
  bySource = true;
488
506
  index += 1;
489
507
  break;
508
+ case "--limit":
509
+ if (!next || !Number.isInteger(Number(next)) || Number(next) <= 0) {
510
+ throw new Error("--limit requires a positive integer");
511
+ }
512
+ limit = Number(next);
513
+ index += 2;
514
+ break;
515
+ case "--cursor":
516
+ if (!next) {
517
+ throw new Error("--cursor requires a value");
518
+ }
519
+ cursor = next;
520
+ index += 2;
521
+ break;
490
522
  case "--wrap-launcher":
491
523
  if (!next) {
492
524
  throw new Error("--wrap-launcher requires a value");
@@ -506,6 +538,12 @@ export function parseArgs(argv) {
506
538
  throw new Error(`unknown flag: ${current}`);
507
539
  }
508
540
  }
541
+ if (noOmit && allowOmit) {
542
+ throw new Error("--no-omit and --allow-omit cannot be used together");
543
+ }
544
+ if (allowOmit && (command === "install" || command === "doctor")) {
545
+ throw new Error("--allow-omit is not supported for install or doctor; Codex hooks honor the configured omission policy");
546
+ }
509
547
  return {
510
548
  command,
511
549
  format,
@@ -516,9 +554,11 @@ export function parseArgs(argv) {
516
554
  toolName,
517
555
  exitCode,
518
556
  store,
557
+ noStats,
519
558
  tee,
520
559
  raw,
521
560
  noOmit,
561
+ allowOmit,
522
562
  storeDir,
523
563
  maxInlineChars,
524
564
  maxCaptureBytes,
@@ -526,6 +566,8 @@ export function parseArgs(argv) {
526
566
  timeZone,
527
567
  source,
528
568
  bySource,
569
+ limit,
570
+ cursor,
529
571
  wrapLauncher,
530
572
  trace,
531
573
  printInstructions,
@@ -549,6 +591,25 @@ async function readStdin(maxBytes = DEFAULT_MAX_INPUT_BYTES) {
549
591
  }
550
592
  return Buffer.concat(chunks).toString("utf8");
551
593
  }
594
+ async function readStdinForCodexHook(maxBytes = DEFAULT_MAX_INPUT_BYTES) {
595
+ if (inputStdin.isTTY) {
596
+ return "";
597
+ }
598
+ const chunks = [];
599
+ let totalBytes = 0;
600
+ let exceededLimit = false;
601
+ for await (const chunk of inputStdin) {
602
+ const buffer = Buffer.from(chunk);
603
+ totalBytes += buffer.length;
604
+ if (totalBytes > maxBytes) {
605
+ exceededLimit = true;
606
+ continue;
607
+ }
608
+ chunks.push(buffer);
609
+ }
610
+ // Drain stdin so Tokenjuice exits cleanly instead of failing on oversized hook input.
611
+ return exceededLimit ? undefined : Buffer.concat(chunks).toString("utf8");
612
+ }
552
613
  async function readTextInput(file, maxBytes = DEFAULT_MAX_INPUT_BYTES) {
553
614
  if (!file) {
554
615
  return await readStdin(maxBytes);
@@ -581,7 +642,7 @@ async function runReduce(args) {
581
642
  ...(args.raw ? { raw: true } : {}),
582
643
  ...(noOmit ? { noOmit: true } : {}),
583
644
  ...(args.trace ? { trace: true } : {}),
584
- recordStats: true,
645
+ recordStats: !args.noStats && shouldRecordStats(),
585
646
  ...(args.store ? { store: true } : {}),
586
647
  ...(args.storeDir ? { storeDir: args.storeDir } : {}),
587
648
  ...(typeof args.maxInlineChars === "number" ? { maxInlineChars: args.maxInlineChars } : {}),
@@ -612,7 +673,7 @@ async function runReduceJson(args) {
612
673
  ...(args.raw ? { raw: true } : {}),
613
674
  ...(noOmit ? { noOmit: true } : {}),
614
675
  ...(args.trace ? { trace: true } : {}),
615
- recordStats: true,
676
+ recordStats: !args.noStats && shouldRecordStats(),
616
677
  ...(args.store ? { store: true } : {}),
617
678
  ...(args.storeDir ? { storeDir: args.storeDir } : {}),
618
679
  ...(typeof args.maxInlineChars === "number" ? { maxInlineChars: args.maxInlineChars } : {}),
@@ -627,7 +688,7 @@ async function runWrap(args) {
627
688
  ...(args.raw ? { raw: true } : {}),
628
689
  ...(noOmit ? { noOmit: true } : {}),
629
690
  ...(args.trace ? { trace: true } : {}),
630
- recordStats: true,
691
+ recordStats: !args.noStats && shouldRecordStats(),
631
692
  ...(args.store ? { store: true } : {}),
632
693
  ...(args.storeDir ? { storeDir: args.storeDir } : {}),
633
694
  ...(typeof args.maxInlineChars === "number" ? { maxInlineChars: args.maxInlineChars } : {}),
@@ -1170,7 +1231,10 @@ async function runInstall(args) {
1170
1231
  return 0;
1171
1232
  }
1172
1233
  if (target === "codex") {
1173
- const result = await installCodexHook(undefined, { local: args.local });
1234
+ const result = await installCodexHook(undefined, {
1235
+ local: args.local,
1236
+ ...(args.noOmit ? { noOmit: true } : {}),
1237
+ });
1174
1238
  if (args.format === "json") {
1175
1239
  process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
1176
1240
  return 0;
@@ -1178,6 +1242,7 @@ async function runInstall(args) {
1178
1242
  const details = [
1179
1243
  { label: "Hook", value: result.hooksPath },
1180
1244
  { label: "Command", value: result.command },
1245
+ { label: "Writer", value: `${result.writer} (${result.fragmentId})` },
1181
1246
  ];
1182
1247
  if (result.featureFlag.enabled) {
1183
1248
  const source = result.featureFlag.key ? `[features].${result.featureFlag.key}` : "default-on";
@@ -1309,12 +1374,7 @@ async function runInstall(args) {
1309
1374
  process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
1310
1375
  return 0;
1311
1376
  }
1312
- process.stdout.write(`installed codebuddy hook: ${result.settingsPath}\n`);
1313
- process.stdout.write(`command: ${result.command}\n`);
1314
- if (result.backupPath) {
1315
- process.stdout.write(`backup: ${result.backupPath}\n`);
1316
- }
1317
- process.stdout.write(`doctor: tokenjuice doctor hooks${args.local ? " --local" : ""}\n`);
1377
+ process.stdout.write(formatCodeBuddyInstallSuccess({ ...result, local: args.local }));
1318
1378
  return 0;
1319
1379
  }
1320
1380
  if (target === "command-code" || target === "commandcode") {
@@ -1667,6 +1727,24 @@ async function runInstall(args) {
1667
1727
  process.stdout.write(formatInstallSuccess("grok-build", "instructions", details));
1668
1728
  return 0;
1669
1729
  }
1730
+ if (target === "grok-bot" || target === "grokbot") {
1731
+ const result = await installGrokBotRule();
1732
+ if (args.format === "json") {
1733
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
1734
+ return 0;
1735
+ }
1736
+ const details = [
1737
+ { label: "Rule", value: result.rulePath },
1738
+ { label: "Beta", value: ".cursor/rules guidance; Grok Bot still owns execution and output delivery" },
1739
+ { label: "Verify", value: "tokenjuice doctor grok-bot" },
1740
+ { label: "Escape hatch", value: "tokenjuice wrap --raw -- <command>" },
1741
+ ];
1742
+ if (result.backupPath) {
1743
+ details.push({ label: "Backup", value: result.backupPath });
1744
+ }
1745
+ process.stdout.write(formatInstallSuccess("grok-bot", "rule", details));
1746
+ return 0;
1747
+ }
1670
1748
  if (target === "goose") {
1671
1749
  const result = await installGooseHints();
1672
1750
  if (args.format === "json") {
@@ -2501,7 +2579,7 @@ async function runInstall(args) {
2501
2579
  process.stdout.write(formatInstallSuccess("zencoder", "rule", details));
2502
2580
  return 0;
2503
2581
  }
2504
- throw new Error("install currently supports: adal, aether, aictl, ai-memory-protocol, aider, agent-layer, agentinit, agentlink, agentloom, agents-cli, agents-md, agentsge, agentsmesh, amazon-q, amp, antigravity, anywhere-agents, augment, avante, baz, bito, blackbox, blocks, clawdbot, bob, builder, charlie, codex, claude-code, cline, codeant, codebuff, codegen, coder-agents, coderabbit, codebuddy, command-code, continue, copilot-agent, crush, cursor, deepagents, devin, dot-agents, docker-agent, droid, eca, elyra, firebase-studio, forgecode, gemini-cli, gitlab-duo, goose, greptile, grok-build, grok-cli, gptme, jean2, jetbrains-ai, junie, jules, leanctl, kimi, kiro, kilo, knowns, localcode, mcp-agent, mini-swe-agent, swe-agent, stagewise, mistral-vibe, mux, novakit, ona, openhands, open-interpreter, openwebui, pi, pi-go, opencode, plandex, qodo, qoder, replit, qwen-code, roo, rovo, ruler, tabby, tabnine, trae, uipath, vscode-copilot, warp, windsurf, copilot-cli, zed, zencoder");
2582
+ throw new Error("install currently supports: adal, aether, aictl, ai-memory-protocol, aider, agent-layer, agentinit, agentlink, agentloom, agents-cli, agents-md, agentsge, agentsmesh, amazon-q, amp, antigravity, anywhere-agents, augment, avante, baz, bito, blackbox, blocks, clawdbot, bob, builder, charlie, codex, claude-code, cline, codeant, codebuff, codegen, coder-agents, coderabbit, codebuddy, command-code, continue, copilot-agent, crush, cursor, deepagents, devin, dot-agents, docker-agent, droid, eca, elyra, firebase-studio, forgecode, gemini-cli, gitlab-duo, goose, greptile, grok-build, grok-bot, grok-cli, gptme, jean2, jetbrains-ai, junie, jules, leanctl, kimi, kiro, kilo, knowns, localcode, mcp-agent, mini-swe-agent, swe-agent, stagewise, mistral-vibe, mux, novakit, ona, openhands, open-interpreter, openwebui, pi, pi-go, opencode, plandex, qodo, qoder, replit, qwen-code, roo, rovo, ruler, tabby, tabnine, trae, uipath, vscode-copilot, warp, windsurf, copilot-cli, zed, zencoder");
2505
2583
  }
2506
2584
  async function runUninstall(args) {
2507
2585
  const target = args.positionals[0];
@@ -2827,6 +2905,7 @@ async function runUninstall(args) {
2827
2905
  }
2828
2906
  process.stdout.write(`removed codex hook: ${result.hooksPath}\n`);
2829
2907
  process.stdout.write(`removed entries: ${result.removed}\n`);
2908
+ process.stdout.write(`writer: ${result.writer} (${result.fragmentId})\n`);
2830
2909
  if (result.backupPath) {
2831
2910
  process.stdout.write(`backup: ${result.backupPath}\n`);
2832
2911
  }
@@ -3076,6 +3155,18 @@ async function runUninstall(args) {
3076
3155
  process.stdout.write("enable: tokenjuice install grok-build\n");
3077
3156
  return 0;
3078
3157
  }
3158
+ if (target === "grok-bot" || target === "grokbot") {
3159
+ const result = await uninstallGrokBotRule();
3160
+ if (args.format === "json") {
3161
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
3162
+ return 0;
3163
+ }
3164
+ process.stdout.write(`removed grok-bot rule: ${result.removed ? "yes" : "no"}\n`);
3165
+ process.stdout.write(`rule path: ${result.rulePath}\n`);
3166
+ process.stdout.write(`restored backup: ${result.restoredBackup ? "yes" : "no"}\n`);
3167
+ process.stdout.write("enable: tokenjuice install grok-bot\n");
3168
+ return 0;
3169
+ }
3079
3170
  if (target === "goose") {
3080
3171
  const result = await uninstallGooseHints();
3081
3172
  if (args.format === "json") {
@@ -3637,7 +3728,7 @@ async function runUninstall(args) {
3637
3728
  process.stdout.write("enable: tokenjuice install zencoder\n");
3638
3729
  return 0;
3639
3730
  }
3640
- throw new Error("uninstall currently supports: adal, aether, aictl, ai-memory-protocol, aider, agent-layer, agentinit, agentlink, agentloom, agents-cli, agents-md, agentsge, agentsmesh, amazon-q, amp, antigravity, anywhere-agents, augment, avante, baz, bito, blackbox, blocks, clawdbot, bob, builder, charlie, codex, claude-code, cline, codeant, codebuff, codegen, coder-agents, coderabbit, codebuddy, command-code, continue, copilot-agent, crush, cursor, deepagents, devin, dot-agents, docker-agent, droid, eca, elyra, firebase-studio, forgecode, gitlab-duo, gemini-cli, goose, greptile, grok-build, grok-cli, gptme, jean2, jetbrains-ai, junie, jules, leanctl, kimi, kiro, kilo, knowns, localcode, mcp-agent, mini-swe-agent, swe-agent, stagewise, mistral-vibe, mux, novakit, ona, openhands, open-interpreter, openwebui, pi, pi-go, opencode, plandex, qodo, qoder, replit, qwen-code, roo, rovo, ruler, tabby, tabnine, trae, uipath, vscode-copilot, warp, windsurf, copilot-cli, zed, zencoder");
3731
+ throw new Error("uninstall currently supports: adal, aether, aictl, ai-memory-protocol, aider, agent-layer, agentinit, agentlink, agentloom, agents-cli, agents-md, agentsge, agentsmesh, amazon-q, amp, antigravity, anywhere-agents, augment, avante, baz, bito, blackbox, blocks, clawdbot, bob, builder, charlie, codex, claude-code, cline, codeant, codebuff, codegen, coder-agents, coderabbit, codebuddy, command-code, continue, copilot-agent, crush, cursor, deepagents, devin, dot-agents, docker-agent, droid, eca, elyra, firebase-studio, forgecode, gitlab-duo, gemini-cli, goose, greptile, grok-build, grok-bot, grok-cli, gptme, jean2, jetbrains-ai, junie, jules, leanctl, kimi, kiro, kilo, knowns, localcode, mcp-agent, mini-swe-agent, swe-agent, stagewise, mistral-vibe, mux, novakit, ona, openhands, open-interpreter, openwebui, pi, pi-go, opencode, plandex, qodo, qoder, replit, qwen-code, roo, rovo, ruler, tabby, tabnine, trae, uipath, vscode-copilot, warp, windsurf, copilot-cli, zed, zencoder");
3641
3732
  }
3642
3733
  async function runList(args) {
3643
3734
  const refs = await listArtifacts(args.storeDir);
@@ -3744,6 +3835,30 @@ function formatMetric(value) {
3744
3835
  .format(value)
3745
3836
  .replace(/([KMBT])$/u, (suffix) => suffix.toLowerCase());
3746
3837
  }
3838
+ export function formatStatsSources(sources) {
3839
+ if (sources.length === 0) {
3840
+ return "";
3841
+ }
3842
+ const orderedSources = [...sources].sort((left, right) => right.totals.observedRawChars - left.totals.observedRawChars
3843
+ || left.source.localeCompare(right.source));
3844
+ const lines = ["sources:"];
3845
+ for (const source of orderedSources) {
3846
+ const observedRaw = source.totals.captureTruncatedEntries > 0
3847
+ ? ` observedRaw=${formatMetric(source.totals.observedRawChars)}`
3848
+ : "";
3849
+ lines.push(`source ${source.source}: entries=${formatMetric(source.totals.entries)} raw=${formatMetric(source.totals.rawChars)}${observedRaw} reduced=${formatMetric(source.totals.reducedChars)} saved=${formatMetric(source.totals.savedChars)} avgRatio=${formatRatio(source.totals.avgRatio)}`);
3850
+ if (source.reducers.length > 0) {
3851
+ lines.push(` reducers: ${source.reducers.slice(0, 3).map((reducer) => `${reducer.reducer}(${formatMetric(reducer.count)})`).join(", ")}`);
3852
+ }
3853
+ if (source.commands.length > 0) {
3854
+ lines.push(` commands: ${source.commands.slice(0, 3).map((command) => `${command.signature}(${formatMetric(command.count)})`).join(", ")}`);
3855
+ }
3856
+ }
3857
+ if (orderedSources.some((source) => source.source === UNKNOWN_ARTIFACT_SOURCE)) {
3858
+ lines.push("note: source unknown means stored artifacts have missing or invalid source metadata.");
3859
+ }
3860
+ return `${lines.join("\n")}\n`;
3861
+ }
3747
3862
  async function runDiscover(args) {
3748
3863
  const direct = await loadDirectAnalysisEntry(args);
3749
3864
  const entries = direct ? [direct.entry] : await listArtifactMetadata(args.storeDir);
@@ -4476,7 +4591,10 @@ async function runDoctor(args) {
4476
4591
  return report.status === "broken" ? 1 : 0;
4477
4592
  }
4478
4593
  if (args.positionals[0] === "codex") {
4479
- const report = await doctorCodexHook(undefined, { local: args.local });
4594
+ const report = await doctorCodexHook(undefined, {
4595
+ local: args.local,
4596
+ ...(args.noOmit ? { noOmit: true } : {}),
4597
+ });
4480
4598
  if (args.format === "json") {
4481
4599
  process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
4482
4600
  return report.status === "broken" ? 1 : 0;
@@ -5210,6 +5328,35 @@ async function runDoctor(args) {
5210
5328
  process.stdout.write(`repair: ${report.fixCommand}\n`);
5211
5329
  return report.status === "broken" ? 1 : 0;
5212
5330
  }
5331
+ if (args.positionals[0] === "grok-bot" || args.positionals[0] === "grokbot") {
5332
+ const report = await doctorGrokBotRule();
5333
+ if (args.format === "json") {
5334
+ process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
5335
+ return report.status === "broken" ? 1 : 0;
5336
+ }
5337
+ process.stdout.write(`rule path: ${report.rulePath}\n`);
5338
+ process.stdout.write(`health: ${report.status}\n`);
5339
+ if (report.issues.length > 0) {
5340
+ process.stdout.write("issues:\n");
5341
+ for (const issue of report.issues) {
5342
+ process.stdout.write(`- ${issue}\n`);
5343
+ }
5344
+ }
5345
+ if (report.missingPaths.length > 0) {
5346
+ process.stdout.write("missing paths:\n");
5347
+ for (const path of report.missingPaths) {
5348
+ process.stdout.write(`- ${path}\n`);
5349
+ }
5350
+ }
5351
+ if (report.advisories.length > 0) {
5352
+ process.stdout.write("advisories:\n");
5353
+ for (const advisory of report.advisories) {
5354
+ process.stdout.write(`- ${advisory}\n`);
5355
+ }
5356
+ }
5357
+ process.stdout.write(`repair: ${report.fixCommand}\n`);
5358
+ return report.status === "broken" ? 1 : 0;
5359
+ }
5213
5360
  if (args.positionals[0] === "goose") {
5214
5361
  const report = await doctorGooseHints();
5215
5362
  if (args.format === "json") {
@@ -6459,16 +6606,37 @@ async function runDoctor(args) {
6459
6606
  return 0;
6460
6607
  }
6461
6608
  async function runStats(args) {
6462
- const entries = await listArtifactMetadata(args.storeDir);
6463
- const report = statsArtifacts(entries, {
6609
+ const page = await listArtifactMetadataPage(args.storeDir, {
6610
+ ...(typeof args.limit === "number" ? { limit: args.limit } : {}),
6611
+ ...(args.cursor ? { cursor: args.cursor } : {}),
6612
+ });
6613
+ const report = statsArtifacts(page.entries, {
6464
6614
  timeZone: args.timeZone ?? "local",
6465
6615
  ...(args.source ? { source: args.source } : {}),
6466
6616
  ...(args.bySource ? { bySource: true } : {}),
6467
6617
  });
6468
6618
  if (args.format === "json") {
6469
- process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
6619
+ process.stdout.write(`${JSON.stringify({
6620
+ ...report,
6621
+ coverage: {
6622
+ source: "bounded-metadata-segments",
6623
+ legacySidecarsIncluded: page.legacySidecarsIncluded,
6624
+ partial: page.partial,
6625
+ nextCursor: page.nextCursor ?? null,
6626
+ },
6627
+ }, null, 2)}\n`);
6470
6628
  return 0;
6471
6629
  }
6630
+ process.stdout.write("coverage: bounded metadata segments; legacy sidecars excluded\n");
6631
+ if (page.partial) {
6632
+ process.stdout.write("partial: yes\n");
6633
+ if (page.nextCursor) {
6634
+ process.stdout.write(`next cursor: ${page.nextCursor}\n`);
6635
+ }
6636
+ }
6637
+ else {
6638
+ process.stdout.write("partial: no\n");
6639
+ }
6472
6640
  process.stdout.write(`entries: ${formatMetric(report.totals.entries)}\n`);
6473
6641
  process.stdout.write(`capture-truncated entries: ${formatMetric(report.totals.captureTruncatedEntries)}\n`);
6474
6642
  process.stdout.write(`observed entries: ${formatMetric(report.totals.observedEntries)}\n`);
@@ -6496,20 +6664,11 @@ async function runStats(args) {
6496
6664
  }
6497
6665
  }
6498
6666
  if (report.sources && report.sources.length > 0) {
6499
- process.stdout.write("sources:\n");
6500
- for (const source of report.sources) {
6501
- process.stdout.write(`source ${source.source}: entries=${formatMetric(source.totals.entries)} saved=${formatMetric(source.totals.savedChars)} avgRatio=${formatRatio(source.totals.avgRatio)}\n`);
6502
- if (source.reducers.length > 0) {
6503
- process.stdout.write(` reducers: ${source.reducers.slice(0, 3).map((reducer) => `${reducer.reducer}(${formatMetric(reducer.count)})`).join(", ")}\n`);
6504
- }
6505
- if (source.commands.length > 0) {
6506
- process.stdout.write(` commands: ${source.commands.slice(0, 3).map((command) => `${command.signature}(${formatMetric(command.count)})`).join(", ")}\n`);
6507
- }
6508
- }
6667
+ process.stdout.write(formatStatsSources(report.sources));
6509
6668
  }
6510
6669
  return 0;
6511
6670
  }
6512
- async function main(argv = process.argv.slice(2)) {
6671
+ export async function main(argv = process.argv.slice(2)) {
6513
6672
  const args = parseArgs(argv);
6514
6673
  switch (args.command) {
6515
6674
  case undefined:
@@ -6546,7 +6705,13 @@ async function main(argv = process.argv.slice(2)) {
6546
6705
  case "stats":
6547
6706
  return await runStats(args);
6548
6707
  case "codex-post-tool-use":
6549
- return await runCodexPostToolUseHook(await readStdin(args.maxInputBytes));
6708
+ {
6709
+ const hookInput = await readStdinForCodexHook(args.maxInputBytes);
6710
+ if (hookInput === undefined) {
6711
+ return 0;
6712
+ }
6713
+ return await runCodexPostToolUseHook(hookInput, { noOmit: args.noOmit, allowOmit: args.allowOmit });
6714
+ }
6550
6715
  case "claude-code-pre-tool-use":
6551
6716
  return await runClaudeCodePreToolUseHook(await readStdin(args.maxInputBytes), args.wrapLauncher);
6552
6717
  case "claude-code-post-tool-use":
@@ -49,7 +49,7 @@ function groupCandidates(entries, options = {}) {
49
49
  const groups = new Map();
50
50
  const includeSource = options.bySource || Boolean(options.source);
51
51
  for (const entry of entries) {
52
- const signature = normalizeCommandSignature(entry.metadata.command);
52
+ const signature = normalizeCommandSignature(entry.metadata.command ?? entry.metadata.commandFamily);
53
53
  if (!signature) {
54
54
  continue;
55
55
  }
@@ -68,7 +68,7 @@ function groupCandidates(entries, options = {}) {
68
68
  totalRawChars: 0,
69
69
  ratioSum: 0,
70
70
  ratioCount: 0,
71
- sampleCommand: entry.metadata.command ?? signature,
71
+ sampleCommand: entry.metadata.command ?? entry.metadata.commandFamily ?? signature,
72
72
  ...(entry.metadata.classification.matchedReducer
73
73
  ? { matchedReducer: entry.metadata.classification.matchedReducer }
74
74
  : {}),
@@ -198,7 +198,7 @@ function buildStatsReport(entries, options, source) {
198
198
  continue;
199
199
  }
200
200
  const reducer = entry.metadata.classification.matchedReducer ?? "generic/fallback";
201
- const signature = normalizeCommandSignature(entry.metadata.command) ?? "(unknown)";
201
+ const signature = normalizeCommandSignature(entry.metadata.command ?? entry.metadata.commandFamily) ?? "(unknown)";
202
202
  const day = formatDay(entry.metadata.createdAt);
203
203
  rawChars += entry.metadata.rawChars;
204
204
  reducedChars += reduced;