token-harness 0.1.17 → 0.1.19
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 +102 -19
- package/package.json +1 -1
- package/sbom.json +3 -3
- package/token-harness.mjs +5497 -971
package/README.md
CHANGED
|
@@ -33,14 +33,15 @@ The first screen is **Overview**. There is no separate Setup page to learn.
|
|
|
33
33
|
|
|
34
34
|
1. Token Harness detects Claude Code and Codex.
|
|
35
35
|
2. Each detected coding agent says either **Ready** or **Setup incomplete**.
|
|
36
|
-
3. If setup is incomplete,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
3. If setup is incomplete, use the **Optimizer setup** matrix. It shows every optimizer against
|
|
37
|
+
every detected agent and lets you select one harness or both in the same review. The recommended
|
|
38
|
+
**RTK + HarnessTrim** baseline has its own action in that matrix and shows the exact safe plan
|
|
39
|
+
before anything changes.
|
|
40
|
+
4. Optional optimizers (mcptoon, GitNexus and Headroom) use the same matrix and per-optimizer action;
|
|
41
|
+
there is no repeated setup button under each coding-agent card.
|
|
41
42
|
5. **Health and updates** is maintenance, not another onboarding checklist. Normal setup performs its
|
|
42
|
-
own safety checks. Use **Re-check health** for troubleshooting and **Check for updates**
|
|
43
|
-
|
|
43
|
+
own safety checks. Use **Re-check health** for troubleshooting and **Check for updates** to inspect
|
|
44
|
+
Token Harness and optimizer versions. If an update is available, the same dialog offers
|
|
44
45
|
**Install updates** after showing the versions.
|
|
45
46
|
6. Keep using Claude Code or Codex normally. Open **Results** when you want detailed evidence.
|
|
46
47
|
|
|
@@ -160,7 +161,7 @@ algorithms into this repository.
|
|
|
160
161
|
| [RTK](https://github.com/rtk-ai/rtk) | Shell/tool output reduction | Managed on reviewed combinations |
|
|
161
162
|
| [HarnessTrim](https://github.com/giuliastro/HarnessTrim) | Deterministic output/context reduction | Managed first-party integration |
|
|
162
163
|
| mcptoon | MCP discovery / compact manifest guidance | Optional managed integration on exact reviewed 0.7.10 rows; no savings assumed |
|
|
163
|
-
| GitNexus | Repository graph / MCP context | Optional managed Claude integration for
|
|
164
|
+
| GitNexus | Repository graph / MCP context | Optional managed Claude/Codex integration for reviewed 1.6.12; license review required |
|
|
164
165
|
| Headroom | Local MCP context compression/retrieval | Optional config-only managed Claude/Codex integration for already-installed 0.37.0; package prerequisite stays user-owned |
|
|
165
166
|
| [cclimits](https://github.com/cruzanstx/cclimits) | Optional Claude allowance evidence | Read-only evidence; not an optimizer |
|
|
166
167
|
| [ccusage](https://github.com/ccusage/ccusage) | Local usage history | Read-only evidence; never subscription quota |
|
|
@@ -172,11 +173,12 @@ be accepted without another hard-coded version bump when their executable versio
|
|
|
172
173
|
machine-readable `capabilities` version and the semantic surface/write-set comparison reports no
|
|
173
174
|
drift.
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
can
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
Token Harness and provider **package updates are separate from harness configuration writes**.
|
|
177
|
+
`token-harness update` can update the app when it is running from its verified global npm
|
|
178
|
+
installation, and can replace a reviewed provider target without requiring an exact historical
|
|
179
|
+
Claude/Codex fixture for that package version; exact compatibility rows still gate any later
|
|
180
|
+
managed agent-config mutation. HarnessTrim updates use its reviewed npm channel and capture the
|
|
181
|
+
previous global version for rollback. On native Windows RTK still prefers WinGet, but when that catalog is behind the
|
|
180
182
|
reviewed 0.49.0 target Token Harness can fall back to the exact official GitHub Windows x64 release:
|
|
181
183
|
it verifies GitHub's published SHA-256, replaces only the uniquely resolved `rtk.exe`, verifies the
|
|
182
184
|
new version, and restores and re-verifies the previous bytes on failure. This package-only fallback
|
|
@@ -194,7 +196,8 @@ verification, managed lifecycle, compatibility/reversibility, project maturity a
|
|
|
194
196
|
validation. Broader context owners also require an explicit admission decision.
|
|
195
197
|
|
|
196
198
|
See [docs/optimizer-priorities.md](docs/optimizer-priorities.md) and
|
|
197
|
-
[RFC 0027](docs/rfcs/0027-optimization-stack-manager.md)
|
|
199
|
+
[RFC 0027](docs/rfcs/0027-optimization-stack-manager.md) and
|
|
200
|
+
[RFC 0028](docs/rfcs/0028-smart-model-routing.md).
|
|
198
201
|
|
|
199
202
|
## Stable-stack operating model
|
|
200
203
|
|
|
@@ -245,6 +248,7 @@ browser controller itself.
|
|
|
245
248
|
| `apply` | Apply a reviewed stored plan | Yes, only with `--yes` |
|
|
246
249
|
| `verify` | Check the declared integration tier | No |
|
|
247
250
|
| `metrics` | Report attributable reducer savings | No |
|
|
251
|
+
| `routing` | Export/configure an owned CCR rule or inspect routing decisions | Yes, only after preview and `--yes` |
|
|
248
252
|
| `status` | Report pipelines, drift and importer modes | No |
|
|
249
253
|
| `update` | Check/update reviewed provider packages | Yes, only with `--yes` |
|
|
250
254
|
| `rollback` | Restore the latest transaction snapshot | Yes, only with `--yes` |
|
|
@@ -260,6 +264,79 @@ The older automation contracts remain available. `ui --json` preserves its exist
|
|
|
260
264
|
report; `ui --read-only` opens the legacy read-only UI; `ui --no-open` starts the guided app without
|
|
261
265
|
launching a browser.
|
|
262
266
|
|
|
267
|
+
### Smart Model Routing (advanced)
|
|
268
|
+
|
|
269
|
+
The local TypeScript classifier needs no API key or local model. On Node.js 22+, Token Harness can
|
|
270
|
+
install and start the reviewed CCR 3.1.1 CLI in its own protected state directory. Installation and
|
|
271
|
+
routing configuration are separate preview/apply steps. Existing authenticated CCR services can be
|
|
272
|
+
used as-is; Token Harness does not adopt or update an external/global CCR installation. For a useful
|
|
273
|
+
shadow report, the selected CCR profile needs an existing provider/model; when exactly one matching
|
|
274
|
+
Claude Code or Codex provider is already configured, Token Harness adds a profile scoped to CCR CLI
|
|
275
|
+
launches if the provider exposes one unambiguous default model. If it exposes several models, set
|
|
276
|
+
`TOKEN_HARNESS_ROUTING_PROFILE_MODEL` to the exact `Provider/model` for the profile. To enable a
|
|
277
|
+
conservative candidate, set `TOKEN_HARNESS_ROUTING_SIMPLE_MODEL` to an exact configured
|
|
278
|
+
`Provider/model`; Token Harness validates it against CCR's provider catalog. It never imports OAuth
|
|
279
|
+
credentials or edits native harness endpoints. Select provider login/import explicitly in CCR when
|
|
280
|
+
needed. See CCR's
|
|
281
|
+
[Agent Profiles guide](https://github.com/musistudio/claude-code-router/blob/main/docs/src/content/docs/en/configuration/profiles.md).
|
|
282
|
+
On a first install, preview and approve CCR install/start, then preview and approve routing setup:
|
|
283
|
+
|
|
284
|
+
```sh
|
|
285
|
+
# First preview and approve CCR install/start.
|
|
286
|
+
token-harness routing --configure-ccr --harness codex
|
|
287
|
+
token-harness routing --configure-ccr --harness codex --yes
|
|
288
|
+
# Then preview and approve the routing rule and optional profile.
|
|
289
|
+
token-harness routing --configure-ccr --harness codex
|
|
290
|
+
token-harness routing --configure-ccr --harness codex --yes
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
To update the Token Harness-owned CCR CLI to the current reviewed version pin, preview and apply:
|
|
294
|
+
|
|
295
|
+
```sh
|
|
296
|
+
token-harness routing --update-ccr
|
|
297
|
+
token-harness routing --update-ccr --yes
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
After setup, launch the scoped profile shown by Token Harness (for Codex, typically
|
|
301
|
+
`ccr "Token Harness Codex"`) and confirm a real request appears in CCR logs. The saved profile or
|
|
302
|
+
gateway status alone does not prove interception. In shadow mode the rule records the proposed tier
|
|
303
|
+
and leaves the current model unchanged.
|
|
304
|
+
|
|
305
|
+
For a paired routing experiment, capture the baseline while the rule is in shadow mode, then record
|
|
306
|
+
the task's actual quality outcome. To test conservative routing, set
|
|
307
|
+
`TOKEN_HARNESS_ROUTING_SIMPLE_MODEL` in the Token Harness environment to an exact model already
|
|
308
|
+
configured in CCR, roll back the owned shadow rule, and preview/apply the conservative rule. Token
|
|
309
|
+
Harness validates the alias and embeds it in the script. Run the same task as the optimized variant,
|
|
310
|
+
record its quality, then compare the receipt paths printed by Token Harness:
|
|
311
|
+
|
|
312
|
+
```sh
|
|
313
|
+
token-harness benchmark-start --benchmark-id routing-codex-1 --variant baseline --task mechanical --harness codex
|
|
314
|
+
# Run the task with CCR in shadow mode, then finish with the actual quality and attempt counts.
|
|
315
|
+
token-harness benchmark-finish --benchmark-id routing-codex-1 --variant baseline --quality passed --attempts 1 --failed-attempts 0
|
|
316
|
+
|
|
317
|
+
token-harness routing --rollback-ccr --harness codex
|
|
318
|
+
token-harness routing --rollback-ccr --harness codex --yes
|
|
319
|
+
token-harness routing --configure-ccr --harness codex --route-mode conservative
|
|
320
|
+
token-harness routing --configure-ccr --harness codex --route-mode conservative --yes
|
|
321
|
+
token-harness benchmark-start --benchmark-id routing-codex-1 --variant optimized --task mechanical --harness codex
|
|
322
|
+
# Repeat the same task under comparable conditions, then finish with its real quality outcome.
|
|
323
|
+
token-harness benchmark-finish --benchmark-id routing-codex-1 --variant optimized --quality passed --attempts 1 --failed-attempts 0
|
|
324
|
+
|
|
325
|
+
token-harness benchmark --baseline /path/to/baseline.json --optimized /path/to/optimized.json
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
To inspect decisions and local CCR request usage outside the task comparison, use
|
|
329
|
+
`token-harness routing --route-metrics` or add `--ccr-usage`.
|
|
330
|
+
|
|
331
|
+
The benchmark reads CCR session counters only when the task produced local routing events with a
|
|
332
|
+
recognized harness identity. Receipts retain model and token aggregates, not prompts or session
|
|
333
|
+
IDs. The comparator shows CCR token and provider-cost-estimate deltas separately and only when both
|
|
334
|
+
observations are complete and both quality gates pass. This is not evidence of saved Codex/Claude
|
|
335
|
+
subscription quota; quota deltas remain separately attributable, and no live savings are claimed
|
|
336
|
+
until real paired tasks have been measured. `token-harness benchmark-matrix` also aggregates CCR
|
|
337
|
+
usage across complete quality-passed pairs and reports withheld pairs separately. Shadow mode
|
|
338
|
+
remains the default, and switching an owned rule's mode requires rollback before reconfiguration.
|
|
339
|
+
|
|
263
340
|
### Evaluation evidence (advanced / maintainers)
|
|
264
341
|
|
|
265
342
|
Evaluation campaigns are an advanced maintainer workflow; managed setup stays in the unified **Optimization Stack**. The app
|
|
@@ -361,17 +438,22 @@ Update Token Harness itself:
|
|
|
361
438
|
npm install --global token-harness@latest
|
|
362
439
|
```
|
|
363
440
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
441
|
+
Token Harness and optimizer checks are in **Overview -> Health and updates**. The browser checks
|
|
442
|
+
the app's npm installation and the reviewed optimizer channels. When an installable update exists,
|
|
443
|
+
it offers **Install updates** in the same dialog. After updating Token Harness from the browser,
|
|
444
|
+
restart the app to load the new version. From the advanced CLI, the preview prints the exact
|
|
445
|
+
confirmation command:
|
|
367
446
|
|
|
368
447
|
```sh
|
|
369
448
|
token-harness update
|
|
370
449
|
token-harness update --yes
|
|
371
450
|
```
|
|
372
451
|
|
|
373
|
-
`update`
|
|
374
|
-
|
|
452
|
+
`update` installs Token Harness itself only when the running copy matches its global npm package;
|
|
453
|
+
other install methods remain available through their original updater. Optimizer updates replace
|
|
454
|
+
only installed providers whose target is inside the reviewed provider-package policy. The npm
|
|
455
|
+
package inventory captures the previous Token Harness version for rollback. HarnessTrim uses npm
|
|
456
|
+
and captures the previous global version for rollback. On native
|
|
375
457
|
Windows RTK prefers WinGet; when WinGet cannot yet reach the reviewed target, Token Harness can use
|
|
376
458
|
the verified official GitHub Windows x64 release fallback described above. That fallback verifies the
|
|
377
459
|
published digest and post-update version and restores the previous executable on failure.
|
|
@@ -471,6 +553,7 @@ does not require that Corepack shim write.
|
|
|
471
553
|
|
|
472
554
|
Before changing public behavior or architecture, read
|
|
473
555
|
[RFC 0027](docs/rfcs/0027-optimization-stack-manager.md),
|
|
556
|
+
[RFC 0028](docs/rfcs/0028-smart-model-routing.md),
|
|
474
557
|
[docs/optimizer-priorities.md](docs/optimizer-priorities.md),
|
|
475
558
|
[docs/release-readiness.md](docs/release-readiness.md), [PLAN.md](PLAN.md), and the accepted
|
|
476
559
|
[RFCs](docs/rfcs).
|
package/package.json
CHANGED
package/sbom.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bomFormat": "CycloneDX",
|
|
3
3
|
"specVersion": "1.5",
|
|
4
|
-
"serialNumber": "urn:uuid:
|
|
4
|
+
"serialNumber": "urn:uuid:fd379d86-ac5b-23d6-ac6a-6b9654496726",
|
|
5
5
|
"version": 1,
|
|
6
6
|
"metadata": {
|
|
7
7
|
"component": {
|
|
8
8
|
"type": "application",
|
|
9
9
|
"bom-ref": "token-harness",
|
|
10
10
|
"name": "token-harness",
|
|
11
|
-
"version": "0.1.
|
|
11
|
+
"version": "0.1.19",
|
|
12
12
|
"description": "Quota-aware efficiency layer for Claude Code and Codex subscription limits.",
|
|
13
13
|
"licenses": [
|
|
14
14
|
{
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"hashes": [
|
|
21
21
|
{
|
|
22
22
|
"alg": "SHA-256",
|
|
23
|
-
"content": "
|
|
23
|
+
"content": "fd379d86ac5b23d6ac6a6b96544967266bf50ee71039397bb7d6a3f3c34373f7"
|
|
24
24
|
}
|
|
25
25
|
]
|
|
26
26
|
},
|