token-harness 0.1.7 → 0.1.9

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 CHANGED
@@ -3,98 +3,157 @@
3
3
  **Make Claude Code and Codex easier to understand and use efficiently.**
4
4
 
5
5
  Token Harness checks your coding agents, shows subscription allowance when it can be
6
- observed reliably, reduces avoidable context overhead, and recommends one useful next
7
- action. It runs locally and never presents local token estimates as subscription quota.
6
+ observed reliably, reduces avoidable context overhead, and recommends useful actions.
7
+ It runs locally and never presents local token estimates as subscription quota.
8
8
 
9
- ## The easy path
9
+ ## Open it. Approve setup. Keep coding.
10
10
 
11
- You need [Node.js 22.13 or newer](https://nodejs.org/) and at least one signed-in coding
12
- agent: Claude Code or Codex.
13
-
14
- Open a terminal and paste:
11
+ You need [Node.js 22.13 or newer](https://nodejs.org/) and an installed, signed-in
12
+ Claude Code or Codex. Install Token Harness, then open it:
15
13
 
16
14
  ```sh
17
15
  npm install --global token-harness@latest
18
- token-harness setup
16
+ token-harness
19
17
  ```
20
18
 
21
- That is the whole first-time check. `setup` tells you:
19
+ The browser is now the primary interface. **Set up automatically** checks both agents and
20
+ prepares the supported integration changes. It describes each change in plain language.
21
+ Choose **Approve and apply** to apply the reviewed configuration with backups and verification.
22
+ There are no plan IDs to copy and no daily command sequence to remember.
23
+
24
+ Already configured? The app shows your existing integrations without replacing them.
25
+ An absent provider or an unreviewed version combination is explained rather than installed
26
+ or forced silently. Automatic setup covers the reviewed integration paths, not every possible
27
+ provider/version. Token Harness does not install Claude Code or Codex or log you in.
28
+
29
+ ### Daily use
22
30
 
23
- - which coding agents it found;
24
- - whether an optimization provider is active;
25
- - whether the current setup works;
26
- - what it changed, if anything;
27
- - exactly one next step.
31
+ Continue launching `claude` or `codex` as usual. Supported output integrations operate in the
32
+ agent, not in the dashboard. You can close the page and its terminal without disabling those
33
+ integrations. Open `token-harness` whenever you want to see results; the visible dashboard
34
+ imports available provider records and refreshes its readings automatically.
28
35
 
29
- The first run does not change Claude Code, Codex, or project configuration. If Token
30
- Harness finds a supported improvement, it shows the safe plan and may suggest:
36
+ **Recorded savings** shows retained history across locally recorded projects, with date bounds,
37
+ provider, measurement class, units, changed-output counts, and before/after values. It does not
38
+ add incompatible provider figures together. Negative results remain visible. No telemetry is
39
+ shown as **not measured**, never a reassuring zero or an invented subscription saving.
40
+ Some provider records may predate Token Harness; locally stored records are not guaranteed
41
+ complete lifetime history. RTK history is imported directly. HarnessTrim project-local records
42
+ must have been imported from their project, or exposed through a configured known metrics path;
43
+ the app does not crawl your disk looking for private projects.
44
+
45
+ For a terminal-only summary, the one command is:
31
46
 
32
47
  ```sh
33
- token-harness setup --yes
48
+ token-harness savings
34
49
  ```
35
50
 
36
- `--yes` is always explicit. The change is backed up, applied transactionally, and
37
- verified. Unsupported combinations are left untouched.
51
+ Optional windows are `--since 7d` and `--since 30d`. The advanced `metrics` command remains
52
+ project-scoped; opening the app from its installation folder does not change the savings scope.
53
+
54
+ ### Find what you need
55
+
56
+ The app has three tabs: **Overview** for agents and recorded savings, **Rules & settings**
57
+ for one agent's rules at a time, and **Activity** for checks and guarded undo. Theme follows
58
+ your system; the header also offers light and dark modes.
59
+
60
+ Each rule shows what was actually **observed**, separately from how it works. Actions sit
61
+ next to the relevant state: **Adjust reasoning** opens the supported review/apply flow;
62
+ **Change in Claude/Codex** explains native steps when an automatic write is not available.
63
+ Missing allowance data and measurement records have their own setup/help actions.
38
64
 
39
- ## Open the dashboard
65
+ A saved Claude effort can be displayed even on an unreviewed CLI version. That does not
66
+ admit automatic writes on that version. **No saved preference** means the user field is
67
+ absent, not that reasoning is disabled. A failed read is a separate state with a cause.
68
+ The displayed preference is not a live reading of an already-running session.
40
69
 
41
- After setup, run:
70
+ ### The rules are visible
71
+
72
+ **Rules & settings** explains each configured rule: what it does, why it is used,
73
+ its mode, and the evidence available. Automatic integrations, persistent preferences,
74
+ observations and features that are not enabled are explicitly distinguished.
75
+
76
+ RTK's supported command integration can reduce output automatically. HarnessTrim can use
77
+ adapters or skills/instructions, depending on the installation; skills-only is not a transparent
78
+ hook, and the agent must actually use the reducer. Configured never means every command was
79
+ intercepted. Provider telemetry and its exact/estimated classification remain separate evidence.
80
+
81
+ **Optional: match reasoning to your work** lets you choose the agent and the type of work
82
+ without learning CLI flags. It previews the actual supported effort/verbosity change, then
83
+ applies only after approval. **This is a persistent preference for future sessions, not an
84
+ automatic per-task switch.** It does not switch models, billing, login, or hook trust. The
85
+ baseline automatic setup never guesses a task or quietly lowers reasoning.
86
+
87
+ **Check integrations** performs the existing integration checks from the UI.
88
+ **Undo last change**, available after an application in that dashboard session, previews a
89
+ whole-file backup restoration. It refuses to undo a newer unrelated transaction. It restores
90
+ only the last successful agent transaction; manual edits to those same files after that
91
+ transaction would also be restored, as the confirmation explains.
92
+
93
+ ### Run the current source
94
+
95
+ From an existing clone, after installing its dependencies, one command builds and opens the app:
42
96
 
43
97
  ```sh
44
- token-harness ui
98
+ npm start
45
99
  ```
46
100
 
47
- The dashboard opens in your browser and shows harness status, active providers,
48
- allowance windows, the main recommendation, and the next action. It is a small local
49
- web page served only on `127.0.0.1`: no Electron app, account, or cloud service.
50
-
51
- Use `Ctrl+C` in the terminal to close it. If you do not want it to open a browser:
101
+ For a fresh clone:
52
102
 
53
103
  ```sh
54
- token-harness ui --no-open
104
+ git clone https://github.com/giuliastro/token-harness.git
105
+ cd token-harness
106
+ npx --yes pnpm@10.33.4 install --frozen-lockfile
107
+ npm start
55
108
  ```
56
109
 
57
- ## Ask your AI to install Token Harness
110
+ This uses the clone, not an older global installation. An unmerged branch or unpublished main
111
+ change is not automatically available through `token-harness@latest`.
58
112
 
59
- You can give this prompt to Claude Code or Codex:
113
+ ### Advanced and AI-assisted use
60
114
 
61
- ```text
62
- Install the latest stable Token Harness from npm on this computer, then run
63
- `token-harness setup`. Do not install or replace Claude Code, Codex, or any
64
- optimization provider unless Token Harness's supported plan explicitly requires it.
65
-
66
- Explain the setup result in plain language: what was detected, what already works,
67
- what would change, and the single next step. Do not expose credentials, cookies,
68
- tokens, raw home paths, or private project contents. If setup proposes a supported
69
- configuration change, show me the short plan and ask before running
70
- `token-harness setup --yes`. After an approved change, verify it and start
71
- `token-harness ui`. If anything is unsupported, stop safely and explain why.
72
- ```
115
+ An AI may use the existing JSON CLI to inspect, plan and apply an explicitly approved change.
116
+ That is optional: another AI subscription is not required to operate the app. No persistent
117
+ agent, background model calls or task classifier runs behind your back.
73
118
 
74
- The AI should ask before the `--yes` step because that is the point where coding-agent
75
- configuration may change.
119
+ The older automation contracts remain available: `setup`, `optimize`, `plan`, `apply`,
120
+ `verify`, `metrics`, `rollback`, and their JSON reports. `ui --json` preserves its existing
121
+ schema-1 report; `ui --read-only` opens the legacy read-only dashboard. `ui --no-open` starts
122
+ the guided app without launching a browser. Stop either local server with Ctrl+C.
76
123
 
77
124
  ## What normal output looks like
78
125
 
79
- Human output is intentionally short:
126
+ A healthy final check is intentionally short:
80
127
 
81
128
  ```text
82
129
  TOKEN HARNESS - READY
83
130
 
84
- DETECTED
85
- Claude Code: detected
86
- Codex: configured
87
- harnesstrim: active on Codex
131
+ WHAT WORKS
132
+ Codex: configured (0.146.0)
133
+ HarnessTrim: active on Codex
88
134
 
89
135
  CHANGES
90
136
  Nothing changed.
91
137
 
92
138
  NEXT STEP
93
- token-harness ui
94
- Open the dashboard to see status, allowance, and advice.
139
+ Use your coding agent normally; configured optimizers run automatically.
140
+ ```
141
+
142
+ A newer-than-tested combination is not presented as if the whole setup were broken:
143
+
144
+ ```text
145
+ TOKEN HARNESS - READY WITH LIMITATIONS
146
+
147
+ WHAT WORKS
148
+ Claude Code: configured
149
+ RTK: active on Claude Code
150
+
151
+ NEXT STEP
152
+ token-harness verify
153
+ You can keep working; verify the active integrations when convenient.
95
154
  ```
96
155
 
97
- Need the evidence behind the summary? Add `--verbose`:
156
+ Need the evidence behind a summary? Add `--verbose`:
98
157
 
99
158
  ```sh
100
159
  token-harness doctor --verbose
@@ -109,26 +168,10 @@ token-harness ui --json
109
168
 
110
169
  `--json` keeps the complete schema-1 result and diagnostics; it is not shortened.
111
170
 
112
- ## Three commands to remember
171
+ ## Two entry points to remember
113
172
 
114
- ```sh
115
- token-harness setup
116
- token-harness ui
117
- token-harness optimize
118
- ```
119
-
120
- | Command | Answer |
121
- | --- | --- |
122
- | `setup` | Is Token Harness ready, and what is my one next step? |
123
- | `ui` | What is active, how much allowance is visible, and what should I do? |
124
- | `optimize` | What is the best evidence-based action for the task I am starting? |
125
-
126
- For example:
127
-
128
- ```sh
129
- token-harness optimize --task hard --profile quality
130
- token-harness optimize --task mechanical --profile economy
131
- ```
173
+ `token-harness` opens the application. `token-harness savings` prints recorded results.
174
+ The advanced commands below are implementation tools, not a required user workflow.
132
175
 
133
176
  ## Safety and privacy
134
177
 
@@ -136,18 +179,24 @@ Token Harness is conservative by design:
136
179
 
137
180
  - normal read-only commands do not change coding-agent or project configuration;
138
181
  - `setup --yes`, `apply --yes`, `update --yes`, `rollback --yes`, and
139
- `uninstall --yes` are the explicit configuration-changing forms;
182
+ `uninstall --yes` are the explicit CLI configuration-changing forms; the guided UI uses
183
+ a reviewed preview and explicit **Approve and apply** instead;
140
184
  - plans are checked again immediately before they are applied;
141
185
  - existing files are backed up before a managed write;
142
186
  - only exact Token Harness-owned entries are removed by `uninstall`;
143
187
  - newer or untested combinations are reported, not guessed;
144
- - the dashboard binds only to the local loopback address and provides no mutation API;
188
+ - an available provider update outside reviewed compatibility is kept out rather than
189
+ forced, and the installed working version stays in place;
190
+ - the guided app binds only to 127.0.0.1 and protects its fixed local controls with exact
191
+ Host/Origin checks, a per-process anti-forgery token and single-use approval tickets;
192
+ - the legacy read-only dashboard and external status seam remain read-only;
145
193
  - source code, prompts, command contents, credentials, and cookies are not sent to a
146
194
  Token Harness service.
147
195
 
148
196
  Plans, receipts, metrics, and backups stay in the local Token Harness state directory.
149
- See [RFC 0004](docs/rfcs/0004-execution-safety-ownership-update.md) for the execution
150
- model and [RFC 0006](docs/rfcs/0006-cli-contract.md) for CLI/JSON guarantees.
197
+ See [RFC 0013](docs/rfcs/0013-guided-local-experience.md) for the local browser trust boundary,
198
+ [RFC 0004](docs/rfcs/0004-safety-and-installation.md) for the execution model and
199
+ [RFC 0006](docs/rfcs/0006-cli-contract.md) for CLI/JSON guarantees.
151
200
 
152
201
  ## Supported optimizations
153
202
 
@@ -183,15 +232,71 @@ Most people do not need this section. Run `token-harness <command> --help` for d
183
232
  | `verify` | Check the declared integration tier | No |
184
233
  | `metrics` | Report attributable reducer savings | No |
185
234
  | `status` | Report pipelines, drift, and importer modes | No |
186
- | `update` | Check/update installed providers | Yes, only with `--yes` |
235
+ | `update` | Check/update installed providers; unreviewed targets stay installed | Yes, only with `--yes` |
187
236
  | `rollback` | Restore the latest transaction snapshot | Yes, only with `--yes` |
188
237
  | `uninstall` | Remove owned integration entries | Yes, only with `--yes` |
189
238
  | `schedule` | Compare Claude Code and Codex using available evidence | No |
190
239
  | `handoff` | Build a bounded cross-harness handoff | No |
191
240
  | `benchmark*`, `transfer*` | Capture and compare empirical evidence | Local state only |
192
241
 
242
+ ## Applying native recommendations
243
+
244
+ `optimize` remains read-only. Review a plan before applying a supported native change:
245
+
246
+ ```sh
247
+ token-harness plan --harness claude --native-policy --task mechanical --profile economy
248
+ token-harness apply --plan <printed-plan-id> --yes
249
+ ```
250
+
251
+ `apply --plan <id>` restores the reviewed harness/provider selection automatically; you
252
+ should not have to repeat `--harness`, `--provider`, `--native-policy`, `--task` or `--profile`.
253
+ Run it from the same project as `plan`. Conflicting explicit selectors are rejected, and
254
+ actual version, ownership and configuration changes still invalidate the plan. Existing
255
+ schema-1 plans remain usable; only their approved actions can execute.
256
+
257
+ The first Claude path supports the **persisted user effort preference** on the reviewed
258
+ Claude Code 2.1.261 build. It does not change model, authentication, hooks, endpoint or billing.
259
+ `max` is never persisted. Project/local/ancestor settings, custom configuration roots and
260
+ known environment/thinking overrides block the change rather than being overwritten. The
261
+ preference affects future sessions unless overridden: reopen Claude and check `/effort`.
262
+ This is not evidence of a running session's effective effort or a guaranteed quota saving.
263
+
264
+ For Codex, the same plan/apply flow manages the existing reviewed reasoning-effort and
265
+ verbosity fields through native `config/batchWrite`; project/profile overrides remain yours.
266
+ `rollback --yes` restores the complete pre-change files. `uninstall --yes` removes only owned
267
+ changes and restores a prior Claude effort preference without undoing unrelated later edits.
268
+
193
269
  ## Troubleshooting
194
270
 
271
+ ### Claude allowance is unavailable
272
+
273
+ The dashboard now explains whether the optional companion is missing, lacks the safe CLI
274
+ flags, cannot find Python, has no usable Claude session, reports an expired session, or returns
275
+ an unsupported source. It does not expose credentials, raw companion errors or private paths.
276
+
277
+ As observed on **September 5, 2026**, npm `cclimits@1.7.0` includes the merged Claude
278
+ zero-configuration support and the read-only flags. The latest GitHub Release listing is older
279
+ and is not evidence of what npm ships. To check the same path Token Harness uses:
280
+
281
+ ```sh
282
+ npm list --global cclimits
283
+ cclimits --claude --json --no-cache-write --no-stale-fallback
284
+ token-harness budget --harness claude --verbose
285
+ ```
286
+
287
+ An explicit optional installation/update is `npm install --global cclimits@1.7.0`.
288
+ Token Harness does not install it automatically or retry without its read-only flags.
289
+ A fresh local Claude cache is shown as **cached**, never promoted to live quota pacing.
290
+ A missing observation is not zero remaining allowance. Never paste credentials to debug it.
291
+
292
+ ### Codex is configured but its hook does not run
293
+
294
+ `token-harness verify --harness codex --verbose` now reads native `hooks/list` where the
295
+ installed app-server exposes it. Disabled, untrusted and modified hooks are distinguished from
296
+ an unavailable observation. Trust must still be granted explicitly in Codex. Enabled/trusted
297
+ metadata does not prove interception, reduction, or task quality; the integration remains
298
+ `config-only` until attributable runtime evidence exists.
299
+
195
300
  ### `token-harness` is not found
196
301
 
197
302
  Check that Node is new enough and the package is installed:
@@ -214,6 +319,13 @@ token-harness doctor --verbose
214
319
  Do not force an unsupported plan. Open an issue with the redacted `--json` result if
215
320
  you believe the combination should be supported.
216
321
 
322
+ ### `update` finds a newer version but keeps the installed one
323
+
324
+ That is normally a safety decision, not a failed installation. Token Harness found a
325
+ newer provider release but does not yet have reviewed compatibility evidence for the
326
+ active provider × harness × platform combination. Keep using the installed version; no
327
+ manual upgrade is required.
328
+
217
329
  ### Verification says `not-exercised`
218
330
 
219
331
  Restart the coding agent, use it for one normal command, and run:
@@ -272,3 +384,22 @@ behavior or architecture.
272
384
 
273
385
  [Apache License 2.0](LICENSE). Referenced provider tools are independent projects with
274
386
  their own licenses.
387
+
388
+ ### Loading, impact and sharing
389
+
390
+ The dashboard shows animated, named checks while it reads your setup. Agent cards and saved
391
+ reduction records appear as they are ready; a slow allowance check does not hide the results.
392
+ Refreshing keeps previous readings visible until newer ones arrive. Errors and waiting are
393
+ explicit, and reduced-motion preferences disable animation without removing status text.
394
+
395
+ A result can now say **"65% less tool output"**, with its source, before/after values and count
396
+ of recorded changed outputs immediately beside it. An estimate says **"Estimated"**. This
397
+ percentage describes only those recorded outputs, not your whole coding session, subscription
398
+ allowance or money. Provider rows remain separate; negative results and errors remain visible.
399
+
400
+ Choose **Share result** to preview the exact summary and a locally generated image. **Open X
401
+ draft** prepares a short post. **Open Reddit** prepares a title/link; copy the summary into a
402
+ text post and choose a community yourself. **Copy for Discord** prepares a message to paste
403
+ in your chosen channel. **Save image** creates a PNG you can attach yourself. Nothing is
404
+ posted or uploaded automatically, and sharing excludes private paths, code, prompts and
405
+ account/allowance information. An open share preview stays fixed even if readings update.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "token-harness",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Quota-aware efficiency layer for Claude Code and Codex subscription limits.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/sbom.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "bomFormat": "CycloneDX",
3
3
  "specVersion": "1.5",
4
- "serialNumber": "urn:uuid:e8f87991-af2b-4ce8-a0eb-db80b10befbe",
4
+ "serialNumber": "urn:uuid:98b38470-d012-6450-a4aa-0abf63b8e925",
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.7",
11
+ "version": "0.1.9",
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": "e8f87991af2b4ce8a0ebdb80b10befbe435aee3d71c2309e20b093ef4a8c27e5"
23
+ "content": "98b38470d0126450a4aa0abf63b8e925b297a1f1a2110d4a1074d7e3c0b10a21"
24
24
  }
25
25
  ]
26
26
  },