@mmerterden/multi-agent-pipeline 20.43.0 → 20.43.1

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/CHANGELOG.md CHANGED
@@ -16,6 +16,18 @@ Internal file-layout changes that don't affect the slash-command surface are sti
16
16
 
17
17
  ## [Unreleased]
18
18
 
19
+ ## [20.43.1] - 2026-11-04
20
+
21
+ ### Fixed
22
+
23
+ - `usage-register.mjs` checks a stored token with the server (`POST <register url>/check`, token in the `x-usage-token` header, 4-second timeout, trusted hosts only) before calling it onboarded. An explicit `valid: false` registers again in the usual order (a proof, else the stored `declaredLogin`, else the pinned `registeredAs` as a declared name) with no question and overwrites the stored token; a network failure, timeout or 5xx keeps it. Opted-out machines, a token in the environment or prefs, and dry runs send no check. A machine whose token was revoked no longer stays without a working token while reporting "token already onboarded".
24
+ - A pinned machine with no stored token registers its `registeredAs` as a declared name instead of staying silent.
25
+
26
+ ### Changed
27
+
28
+ - `usage-register.mjs --json` adds `tokenCheck` (`valid`, `invalid`, `unknown`, `skipped`) and, on a refused registration, `refusal` (`not_collaborator`, `proof_required`). A declared name refused after a rejected token also drops the `registeredAs` pin, so `needsPersonalAccount` turns true.
29
+ - `/multi-agent:update` step 5b and `/multi-agent:setup` ask a question only on `refusal: "not_collaborator"` (one line, then the name once more) or `needsPersonalAccount: true`, which stays false whenever the account is already known.
30
+
19
31
  ## [20.43.0] - 2026-11-04
20
32
 
21
33
  ### Added
package/docs/facts.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$comment": "Generated by pipeline/scripts/gen-facts.mjs. Do not hand-edit: the site reads this, and a number edited here instead of at its source is the drift this file removes.",
3
3
  "generatedAt": "2026-11-04",
4
- "version": "20.43.0",
4
+ "version": "20.43.1",
5
5
  "phaseSchema": 2,
6
6
  "phases": [
7
7
  {
package/manifest.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@mmerterden/multi-agent-pipeline",
3
- "version": "20.43.0",
4
- "commit": "3844a807091ab103954f467e9a8caeb379d6a706",
5
- "generatedAt": "2026-11-04T14:18:58.787Z",
3
+ "version": "20.43.1",
4
+ "commit": "ba52aeb7bc89eaf20d06d54127c1d42cfdc89d9a",
5
+ "generatedAt": "2026-11-05T06:07:51.626Z",
6
6
  "algorithm": "sha256",
7
7
  "fileCount": 1934,
8
8
  "files": {
9
- "CHANGELOG.md": "bc8d3bb01071faa83c4da02ef3709505fc72ccea14900dff78a234e4be135ec1",
9
+ "CHANGELOG.md": "d782b2b737f4dfdc9ed7d9cd5040d8e6f7f569ebf1a7b1cb5a0367b0ad5ab42c",
10
10
  "LICENSE": "8d8c51aaf1e1538b180c69965fa038db71be86798cc3e26a143bebfefe16a43e",
11
11
  "README.md": "b655fb0d5bfd21756f02056c9ad329db9fd95706365e25dfd89194e13dd34d8f",
12
12
  "README.tr.md": "0239298131257517a9b47f8c3c1075a3d733a953fd64788171e99e5725897826",
@@ -36,7 +36,7 @@
36
36
  "docs/best-practices.md": "f8b75b0d38b5896a6a852bb30a1edddeb24dab8b5b7b1d9313290e1241c72024",
37
37
  "docs/ecosystem.md": "e5df04f67041681d130694b4df95834e67337cbe642805ca6db9f8ea132f16b3",
38
38
  "docs/engineering.md": "5f5d5eeca696bbd1d1eed7d443e5e979d19a5749727a7a6318ea419b5a29508e",
39
- "docs/facts.json": "827e27e8f97ab589678e5e201b005260ecf8afda1b68e8088f4e1f395b557119",
39
+ "docs/facts.json": "1399d807aa3c93ef8d3eb85ad99c84a6e8abaea184667cd8f9185f9934774acb",
40
40
  "docs/features.md": "b2a2a164c65b89d09de3a050f0d7c5aab4f9ea11458129a749f4312e1f7ddbf2",
41
41
  "docs/performance.md": "bbf2f3922c25dcba0c1a9e69ef420e3871a729af5b35009a49b48a5d3c5cd151",
42
42
  "docs/recovery-guide.md": "23595353417fb990c225e35978ff6a764002bd6bcd81859ebae4e01e8a7824f8",
@@ -68,7 +68,7 @@
68
68
  "install/templates/multi-agent-autopilot-awake.plist.template": "ddd25c76c56fcbb38a89de8e35637372d70ace993d6bc487a88ca9cfb702fe1f",
69
69
  "install/templates/multi-agent-autopilot.plist.template": "122c8a61cd927edd99375d6e3da40f1d42bcceed5b6641785c8b28bb930bc77e",
70
70
  "install/unattended-profile-legacy.json": "f52e86b998956f09ad306b1735a6c10b58580d7082d8a55665a4c6bb15c3aa1f",
71
- "package.json": "b6f8edf0c8f34f9b07f7fb133a5adabd91cef05c6597af203e92a88b9464a44c",
71
+ "package.json": "e85f05eefc4cb61dbf7313efb178223a94aec5d533b7a117fa09fae1041c9717",
72
72
  "pipeline/agents/android-architect.md": "11fb74543cb0ebcf9525ca6654fe95d53da7229e0bf4a1149b31fd9005abc453",
73
73
  "pipeline/agents/backend-architect.md": "b02a606c301e4714131aed70ae6d16eeb77fbc819a001e2752cff2488d4246de",
74
74
  "pipeline/agents/bulk-reader.md": "5619d5fb3dee26da7b4c5b1f55d22584c9404e350c221d13bc25a70d88f75f8c",
@@ -143,7 +143,7 @@
143
143
  "pipeline/commands/multi-agent/search/SKILL.md": "ebb8b50a3755a38368d89e586cc5a108153665ec551d37ed8e54651bd975837e",
144
144
  "pipeline/commands/multi-agent/security-review/SKILL.md": "d8565d768e9c9fb6686602902e68b53d32b6b3f0974f79742f525622764ff850",
145
145
  "pipeline/commands/multi-agent/serve/SKILL.md": "25a6d30ef7f3b3d6dad77d371498733502c090af2fd93ad4447b022579d0f075",
146
- "pipeline/commands/multi-agent/setup/SKILL.md": "333940062f3f8ba873cbe8e638333ea9bb9085807e717c7894b9e5497f35734a",
146
+ "pipeline/commands/multi-agent/setup/SKILL.md": "20c51f71bcfbcae4eb7fbe269075baadf97a5aaa3907a669fa41f1864955644c",
147
147
  "pipeline/commands/multi-agent/stack/SKILL.md": "69711a0b925b4d8d87a5aa5f117c0ce556a92f4465217ad9fce6558d73739e55",
148
148
  "pipeline/commands/multi-agent/status/SKILL.md": "123c40f3baf33a93774035a339a86d931da23c1a7416628356a987a35961e166",
149
149
  "pipeline/commands/multi-agent/steer/SKILL.md": "a1325e548bb0296ad3994cbfb48c2955a13f27b010f7c0afaf5c703c85553f50",
@@ -157,7 +157,7 @@
157
157
  "pipeline/commands/multi-agent/test/SKILL.md": "5a67be2b1ec0321e79f8b7f35be53676e349e55a4f8ca09a07f0de89dadac8c4",
158
158
  "pipeline/commands/multi-agent/testflight-validation/SKILL.md": "34772175fc6359e939ba346c1af7a92627b2fd079dacafdd7656b4d10197074b",
159
159
  "pipeline/commands/multi-agent/uninstall/SKILL.md": "5fff95c58b81a141bfa59d1849fb827ad417a48fc94c120f48ca316b1ef844a3",
160
- "pipeline/commands/multi-agent/update/SKILL.md": "40378b2740be14300a2fff579e46cd63e31d342bf432210b1a10e0052f4907c7",
160
+ "pipeline/commands/multi-agent/update/SKILL.md": "27e2bdf5c3713660719ff335cf744732925a843bf4fdf00f239f70eef6100da4",
161
161
  "pipeline/commands/sim-test.md": "bb12fdaddccacffd9df286c04fa3cf92ca92368bd8df3663446cd8fcec052d9e",
162
162
  "pipeline/contract/CHANGELOG.md": "527f6877a2877e0f5d652ce24a43e50a4f33b9181d677e91b1ba05cdc4274eaf",
163
163
  "pipeline/contract/README.md": "e086dd571712e8261da10c1f4d920d2932ab5f21975e834c1deb8245c9fd29e1",
@@ -400,7 +400,7 @@
400
400
  "pipeline/multi-agent-refs/features/unattended-gates.md": "72a7f3c7baa6c1877e78c50619d564c48b2ccba884f25220c3e760c85944d9e9",
401
401
  "pipeline/multi-agent-refs/features/unattended-security.md": "03a30c6882972e5d2ce13f75c5b5f32fcc6a8ed6db0bc8bb817440e5661ccb70",
402
402
  "pipeline/multi-agent-refs/features/url-enrichment.md": "14c6fcadd31cecf85011d936021a2103d87d37f618a0aab07c693be63aeae210",
403
- "pipeline/multi-agent-refs/features/usage-reporting.md": "e99d129c3b39e6d3446a4b700d6aa0295f0f5a0a0e9a951b05a81547508bd807",
403
+ "pipeline/multi-agent-refs/features/usage-reporting.md": "11acc5bc74c0bc438745e20295520d0328c70b6688eca154b65d9b5066be79fb",
404
404
  "pipeline/multi-agent-refs/features/valven.md": "13b1fb8a3815330f6f970181506ac117e0d1c42761e5a83454edbd0b383ee1a7",
405
405
  "pipeline/multi-agent-refs/features/verify-by-test.md": "7ad889b3d84f5594b2950fb8385b27089280777275c31f89cd82f0de55b62a92",
406
406
  "pipeline/multi-agent-refs/features/verify.md": "1a6db5e7239eac01e51100353013abd16bf785a7fce88b40139fca27f4166be4",
@@ -1049,7 +1049,7 @@
1049
1049
  "pipeline/scripts/update-issue-progress.sh": "e7e16b0778e14646d2d909390a9fac91af63f082564896f2a2d060aa6052bb20",
1050
1050
  "pipeline/scripts/usage-identity.mjs": "201134b0290026c3c6c5fa5dda9243c88e7301cb661754eb703b73f17d5c9cca",
1051
1051
  "pipeline/scripts/usage-register-beacon.mjs": "5945011db4b755eadb9e50b329e0e1944cf067ee9c144efd7fb68994c74fa3c6",
1052
- "pipeline/scripts/usage-register.mjs": "210d5bad42ea69bcb5e38644732918bfebe91c1c7cbbce427bb9040ee534402a",
1052
+ "pipeline/scripts/usage-register.mjs": "2a8fb74fe103effcef91b2ad82729d4cef98340a90971e93be79628c76bd5c5f",
1053
1053
  "pipeline/scripts/usage-report.mjs": "ecda4cfe78e01b6da75917ccd8820188ad468ca1f556e6153c5594d937488af6",
1054
1054
  "pipeline/scripts/user-test-handoff.sh": "16f2c9a86fb5d02d97636c92e2314b7778feda203de3d49c08e36c0273c0ac16",
1055
1055
  "pipeline/scripts/validate-analysis-doc.mjs": "e1347c78af9f795218731763f0dcff1cc2e52f5184971fc8f824e08f1ba84542",
@@ -1076,7 +1076,7 @@
1076
1076
  "pipeline/scripts/worktrees.mjs": "62a36279c0dfbe9360262b4995b639a7de7297ed26b62afe66e8d34111e1aa06",
1077
1077
  "pipeline/scripts/write-state.mjs": "730159a81a788d5ebb104b83457a6ca2c25a2d02ab48febeda411da9216df8ef",
1078
1078
  "pipeline/scripts/write-store-config.mjs": "6dd31817648fad8b388ccf29499d20ea79483230947a6c052789b793501b6518",
1079
- "pipeline/skills/.skill-manifest.json": "52561a3e5f56d524dd88218e748ee2403ec6b4db7c3284e815f981e8a71aca0e",
1079
+ "pipeline/skills/.skill-manifest.json": "e917daa8edbedc491ed442477d7b424ce6265aaf2881bff6b8ab5b7dc4ee52d6",
1080
1080
  "pipeline/skills/.skills-index.json": "790b1ea08d96a4a7f3c197f9375d7ea48b98e48dad6c6b7c656accd7d01be36d",
1081
1081
  "pipeline/skills/renamed.json": "775ce44ec4809a7efaaf5ea59666a13809105a8b15a2a90fc34ad394993f5cde",
1082
1082
  "pipeline/skills/shared/README.md": "3f014b547c1e11484ac1ae4696ca230757364a2a79472a1e6e24439994c59cda",
@@ -1147,7 +1147,7 @@
1147
1147
  "pipeline/skills/shared/core/multi-agent-search/SKILL.md": "b8d68fbe80cd5b21cb18c2fd34e067f4e4cc1d310919369de9cde7290d295e5d",
1148
1148
  "pipeline/skills/shared/core/multi-agent-security-review/SKILL.md": "287931decf53639971a14b135fa4d18fdd8dcbc6cbe0021fb4e2c1908a60c283",
1149
1149
  "pipeline/skills/shared/core/multi-agent-serve/SKILL.md": "82ba766a7b23285f1b2b3eba2bcbd671ade82b28cc094093832075970504f732",
1150
- "pipeline/skills/shared/core/multi-agent-setup/SKILL.md": "0e214ead6e18eca77dc46823cd78ccf2cc0e15243dad8eedd8b7e48620cb4d78",
1150
+ "pipeline/skills/shared/core/multi-agent-setup/SKILL.md": "956344a6f2d7be618b920ad261d9abe35b06d6ea81197f39715a04f6b7eace2c",
1151
1151
  "pipeline/skills/shared/core/multi-agent-stack/SKILL.md": "6f3fa424f1d51749bc5bc59b9f8130504ceae6ccc24131ce742ca7e66f2e0b09",
1152
1152
  "pipeline/skills/shared/core/multi-agent-status/SKILL.md": "76ff9989c8daae3b70d71e41842516a741be89889ce7bbd2bcab005b29e62874",
1153
1153
  "pipeline/skills/shared/core/multi-agent-steer/SKILL.md": "9ac0c48c3cbafd98022a04b24ef4f16723dda6a852202002231f43bbb7dd453b",
@@ -1161,7 +1161,7 @@
1161
1161
  "pipeline/skills/shared/core/multi-agent-test/SKILL.md": "342f7a0656180072829b3bcceeb1aa8f9a7ab2a4f1166403f90a1bbfcb3401ef",
1162
1162
  "pipeline/skills/shared/core/multi-agent-testflight-validation/SKILL.md": "0d5c651037a9f41f269c5fed6e05acac2f7d7f22f275a7ad56a3e88ced5a7702",
1163
1163
  "pipeline/skills/shared/core/multi-agent-uninstall/SKILL.md": "a3760583157d89f9c63420d2f69242f940196a626536a51b8944fca706ddb46f",
1164
- "pipeline/skills/shared/core/multi-agent-update/SKILL.md": "2f9e224e240e1c9053a59066678f869ae36f18c088482488f3bda8fd207148ea",
1164
+ "pipeline/skills/shared/core/multi-agent-update/SKILL.md": "6e032ba4d9f350d0fa71a5ce2e05c517c665822b0288bd36882ec8e7e2e32803",
1165
1165
  "pipeline/skills/shared/core/multi-agent/SKILL.md": "f18884461a848c966b625c57a783adc6b446ff451cc05b35c4839c8176ab5c60",
1166
1166
  "pipeline/skills/shared/external/accessibility-compliance-accessibility-audit/SKILL.md": "0508b6e832b43d54c6ed5f57d42c292925b81e4df1c132ba1786860385ea2838",
1167
1167
  "pipeline/skills/shared/external/accessibility-compliance-accessibility-audit/evals/evals.json": "fc85d6a8c3bcc5d98d5452a5315a8a932a6e1b22c45b056dfdc2e6eb8cb1b000",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmerterden/multi-agent-pipeline",
3
- "version": "20.43.0",
3
+ "version": "20.43.1",
4
4
  "description": "6-phase AI development pipeline with full orchestration on Claude Code, Copilot CLI and Codex CLI. Analysis, planning, TDD, CLI-aware parallel review with consensus surfacing + Fable triage, default-FAIL evidence gates, secret + intent guards, per-phase cost ledger, persistent learnings memory, wiki generation, commit automation. Token-preserving uninstall.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -49,7 +49,7 @@ Show one line per service with its key or `MISSING`, then the counts (`$HOME/.cl
49
49
 
50
50
  ### Step 2.7 - Operational reporting
51
51
 
52
- Ask whether the user has an operational-reporting token; proceed only on an explicit yes. On paste, store it in the credential store ONLY (never a file, prefs value, git or synced tree): `pbpaste | ~/.claude/lib/credential-store.sh set "${USER}_Usage_Ingest_Token" -` then `pbcopy < /dev/null`. Pasted or skipped, run `node "$HOME/.claude/scripts/usage-register.mjs" --json`; on `"needsPersonalAccount":true` ask once for a GitHub username (Skip leaves reporting off) and re-run with `--login <name>`. What is sent: `$HOME/.claude/multi-agent-refs/features/usage-reporting.md`.
52
+ Ask whether the user has an operational-reporting token; proceed only on an explicit yes. On paste, store it in the credential store ONLY (never a file, prefs value, git or synced tree): `pbpaste | ~/.claude/lib/credential-store.sh set "${USER}_Usage_Ingest_Token" -` then `pbcopy < /dev/null`. Pasted or skipped, run `node "$HOME/.claude/scripts/usage-register.mjs" --json`. Ask only when that JSON line calls for it, nothing else: on `"refusal":"not_collaborator"` say in one line that the name is not a collaborator, ask once for the GitHub username again and re-run with `--login <name>` (a second refusal leaves reporting off); otherwise only on `"needsPersonalAccount":true`, which is false whenever the account is already known (a provable gh, credential-helper or SSH account, a stored `declaredLogin`, a pinned `registeredAs`), ask once for a GitHub username (Skip leaves reporting off) and re-run with `--login <name>`. What is sent: `$HOME/.claude/multi-agent-refs/features/usage-reporting.md`.
53
53
 
54
54
  The Jira project key and git identity are learned from use, never asked (`$HOME/.claude/multi-agent-refs/setup/accounts.md` "Auto-learned fields").
55
55
 
@@ -126,14 +126,27 @@ and every later block that needs them starts by sourcing it.
126
126
  ```
127
127
 
128
128
  It requests a per-machine **write-only** token when none resolves, stores it
129
- only in the credential store, and flips `usageLog.enabled` on. `usageLog.optOut:
130
- true` blocks it permanently. Offline, endpoint down or ingest disabled leaves
131
- reporting off with one status line - never an error. Contract and the data it
132
- sends: `$HOME/.claude/multi-agent-refs/features/usage-reporting.md`.
133
-
134
- If its JSON line says `"needsPersonalAccount":true`, ask once for the person's
135
- GitHub username (free text; Skip leaves reporting off) and run
136
- `node "$HOME/.claude/scripts/usage-register.mjs" --login <name> --json`.
129
+ only in the credential store, and flips `usageLog.enabled` on. A stored token
130
+ is checked with the server first; one the server rejects is replaced by
131
+ registering again (a proof first, else the stored `usageLog.declaredLogin` or
132
+ `registeredAs`, with no question), and a check that cannot reach the server
133
+ keeps the token. `usageLog.optOut: true` blocks it permanently. Offline,
134
+ endpoint down or ingest disabled leaves reporting off with one status line -
135
+ never an error. Contract and the data it sends:
136
+ `$HOME/.claude/multi-agent-refs/features/usage-reporting.md`.
137
+
138
+ Ask a question only when the JSON line calls for one, and ask nothing else:
139
+ - `"refusal":"not_collaborator"`: say in one line that the name is not a
140
+ collaborator of the pipeline repository, ask once for the GitHub username
141
+ again (Skip leaves reporting off) and run
142
+ `node "$HOME/.claude/scripts/usage-register.mjs" --login <name> --json`.
143
+ A second refusal ends it: reporting stays off, no further question.
144
+ - otherwise, only when `"needsPersonalAccount":true`: ask once for the
145
+ person's GitHub username (free text; Skip leaves reporting off) and run the
146
+ same `--login <name> --json` call. The flag is false whenever the account
147
+ is already known (a provable gh, credential-helper or SSH account, a stored
148
+ `declaredLogin`, or a pinned `registeredAs`), so a known account is never
149
+ asked for.
137
150
 
138
151
  6. **Tell the user what the update brought.** Read the notes, then write the summary yourself:
139
152
  ```bash
@@ -140,11 +140,24 @@ is named after it, with no identity check, and finding no account later does not
140
140
  undo it (`decideRegistration`). So the personal account has to be reachable only
141
141
  once, at the moment of registration.
142
142
 
143
+ A pin holds only while its token works. When a token is stored,
144
+ `usage-register.mjs` first asks the server whether it still does (see "The
145
+ stored-token check" below). A token the server rejects counts as no token: the
146
+ machine registers again in the usual order (a proof first, else the stored
147
+ `usageLog.declaredLogin`, else the pinned `registeredAs` as a declared name),
148
+ with no question, and the new token overwrites the old one in its
149
+ credential-store entry. The same declared registration under `registeredAs`
150
+ runs when the pinned machine has no stored token at all.
151
+
143
152
  `usage-register.mjs --json` reports `needsPersonalAccount: true` only when the
144
153
  machine is not pinned, no account with access was found (no gh account, no
145
- credential-helper token, no SSH key) and no name was declared. Setup and update
146
- then ask once for the person's GitHub username (free text; Skip leaves
147
- reporting off) and run:
154
+ credential-helper token, no SSH key) and no name was declared. A stored
155
+ `declaredLogin` or a pinned `registeredAs` keeps it false. Setup and update
156
+ ask a question only in two cases: on `refusal: "not_collaborator"` they say in
157
+ one line that the name is not a collaborator and ask once for it again (a
158
+ second refusal leaves reporting off); otherwise, on `needsPersonalAccount:
159
+ true`, they ask once for the person's GitHub username (free text; Skip leaves
160
+ reporting off). Either way they run:
148
161
 
149
162
  ```bash
150
163
  node "$HOME/.claude/scripts/usage-register.mjs" --login "$GITHUB_LOGIN" --json
@@ -159,7 +172,11 @@ a token only for a collaborator (the repository owner registers with a proof),
159
172
  and marks its row `claimed:<machine>`. Later runs (the Phase 0 backstop) register a declared name
160
173
  the same way, without asking again. A name that is not a collaborator answers
161
174
  `not_collaborator` (the owner's name, `proof_required`) and is forgotten, so the
162
- next setup or update asks again once the repository owner has added it.
175
+ next setup or update asks again once the repository owner has added it. When
176
+ the refused name was registered under a token the server had rejected, the pin
177
+ (`registeredAs`) is dropped too, so the same run reports `needsPersonalAccount:
178
+ true`. A declared registration is usable as soon as it is issued; there is no
179
+ approval step.
163
180
 
164
181
  A declared name never replaces a proof: it is used only when the machine proves
165
182
  no account, and never over a stored token that was issued for a proven login
@@ -206,6 +223,29 @@ is read or any key is used. Redirects are not followed by any of the calls, so
206
223
  neither a GitHub token, a signature nor the ingest token can be carried to
207
224
  another host.
208
225
 
226
+ ### The stored-token check
227
+
228
+ `POST <register url>/check` with an empty JSON body and the stored ingest token
229
+ in the `x-usage-token` header, read from the credential store into memory and
230
+ never put on an argv, in a log or in the body. It goes only where the login
231
+ proof may go (the trusted-host rule above) and is never sent for an opted-out
232
+ machine, a token in `$MULTI_AGENT_USAGE_TOKEN` or `usageLog.token`, a dry run,
233
+ or a machine with no stored token. The timeout is 4 seconds.
234
+
235
+ | Answer | `tokenCheck` in `--json` | Effect |
236
+ |--------|--------------------------|--------|
237
+ | `200 { ok: true, valid: true, u, claimed }` | `valid` | the token is kept |
238
+ | `200 { ok: true, valid: false }` | `invalid` | treated as no token: register again, replace the stored token |
239
+ | `5xx`, any other status, no verdict, timeout, network failure, redirect | `unknown` | the token is kept (no churn on an outage) |
240
+ | not sent | `skipped` | unchanged behaviour |
241
+
242
+ A rejected token that cannot be replaced (no proof, no known name) leaves the
243
+ reason as `stored token rejected; <why>`, which `--quiet` prints on stderr.
244
+ `--json` also carries `refusal` (`not_collaborator` or `proof_required`) when
245
+ a declared name was refused for that reason.
246
+
247
+ ### Register answers
248
+
209
249
  | Answer | Status line |
210
250
  |--------|-------------|
211
251
  | `401` / `403` `login_mismatch` | the login that could not be confirmed (for gh: `gh auth status` must list it) |
@@ -47,6 +47,13 @@
47
47
  * `--login <name>` records the person's GitHub username, for a machine that
48
48
  * proves no account (a work machine), and implies `--refresh`.
49
49
  *
50
+ * A stored token is checked first (`POST <register url>/check`, the token in
51
+ * the `x-usage-token` header). Only an explicit `valid: false` treats it as
52
+ * gone and registers again; an unreachable or undecided check keeps it.
53
+ * `--json` carries the outcome as `tokenCheck`: valid, invalid, unknown or
54
+ * skipped (no stored token, opted out, a token in the environment or prefs, a
55
+ * dry run, or an endpoint the token may not go to).
56
+ *
50
57
  * Exit: always 0. `--json` says what happened; the shell does not need to care.
51
58
  *
52
59
  * @module pipeline/scripts/usage-register
@@ -89,6 +96,7 @@ exitOnHelp(import.meta.url);
89
96
  const DEFAULT_ENDPOINT = "https://mmerterden.com/api/usage/ingest";
90
97
  const BUILT_IN_HOSTS = ["mmerterden.com"];
91
98
  const TIMEOUT_MS = 10000;
99
+ const CHECK_TIMEOUT_MS = 4000;
92
100
 
93
101
  function readJson(file) {
94
102
  try {
@@ -288,6 +296,42 @@ function refusal(status, json, body, method) {
288
296
  return `endpoint answered ${status}${detail}`;
289
297
  }
290
298
 
299
+ /** The check URL next to the register URL. */
300
+ export function checkUrl(url) {
301
+ return `${url.replace(/\/+$/, "")}/check`;
302
+ }
303
+
304
+ /**
305
+ * Ask the server whether the stored ingest token still works. The token goes
306
+ * only in the `x-usage-token` header (from memory, never an argv), and only to
307
+ * a URL `registerUrlAllowed` accepts; the caller checks that first.
308
+ * Returns "valid", "invalid" (an explicit `valid: false`), or "unknown" for a
309
+ * transport failure, a timeout, a redirect or any answer without a verdict.
310
+ */
311
+ export async function checkStoredToken(url, token, post = postHttp) {
312
+ let r;
313
+ try {
314
+ r = await post({
315
+ url: checkUrl(url),
316
+ headers: { "x-usage-token": token },
317
+ body: "{}",
318
+ timeoutMs: CHECK_TIMEOUT_MS,
319
+ });
320
+ } catch {
321
+ return "unknown";
322
+ }
323
+ if (!r || r.failure || r.status !== 200) return "unknown";
324
+ let json;
325
+ try {
326
+ json = JSON.parse(r.body);
327
+ } catch {
328
+ return "unknown";
329
+ }
330
+ if (json?.valid === true) return "valid";
331
+ if (json?.valid === false) return "invalid";
332
+ return "unknown";
333
+ }
334
+
291
335
  async function requestToken(url, body, proof, method) {
292
336
  const { res, json, failure, reason } = await postJson(url, body, proof);
293
337
  if (failure) return { token: null, why: failure, reason };
@@ -658,6 +702,7 @@ async function main(argv) {
658
702
  };
659
703
  const identity = { login: undefined };
660
704
  const beacon = { login: null };
705
+ const outcome = { tokenCheck: "skipped", refusal: null };
661
706
  const done = (status, detail, reason = null) => {
662
707
  if (!opts.dryRun) recordRegister(HOME, status, detail);
663
708
  sendFailureBeacon({
@@ -669,7 +714,9 @@ async function main(argv) {
669
714
  });
670
715
  if (opts.json) {
671
716
  const needsPersonalAccount = personalAccountMissing(readJson(prefsPath), identity.login);
672
- process.stdout.write(`${JSON.stringify({ status, detail, needsPersonalAccount })}\n`);
717
+ const out = { status, detail, needsPersonalAccount, tokenCheck: outcome.tokenCheck };
718
+ if (outcome.refusal) out.refusal = outcome.refusal;
719
+ process.stdout.write(`${JSON.stringify(out)}\n`);
673
720
  }
674
721
  if (opts.quiet && reportingStaysOff(status, detail)) {
675
722
  process.stderr.write(`multi-agent: usage reporting is off - ${detail}\n`);
@@ -715,16 +762,35 @@ async function main(argv) {
715
762
  const identityMatters = !["opted out", "token in environment", "token in prefs"].includes(
716
763
  pre.reason,
717
764
  );
718
- const has = identityMatters ? Boolean(storedToken(prefs, credStore)) : false;
765
+ // The stored token stays in memory and is sent only in the check's header.
766
+ const stored = identityMatters ? storedToken(prefs, credStore) : null;
767
+ const checkAt = registerUrl(prefs.global?.usageLog?.endpoint);
768
+ if (
769
+ stored &&
770
+ !opts.dryRun &&
771
+ registerUrlAllowed(checkAt, prefs.global?.usageLog?.trustedHosts || [])
772
+ ) {
773
+ outcome.tokenCheck = await checkStoredToken(checkAt, stored);
774
+ }
775
+ const rejected = outcome.tokenCheck === "invalid";
776
+ if (rejected) {
777
+ say(" -> operational reporting: the stored token is no longer accepted; registering again");
778
+ }
779
+ const has = Boolean(stored) && !rejected;
719
780
  let who = identityMatters
720
781
  ? reportingUser(prefsPath, { refresh: opts.refresh, write: !opts.dryRun })
721
782
  : { login: undefined, reason: null };
722
783
  const current = readJson(prefsPath) || prefs;
784
+ const cu = current.global?.usageLog || {};
785
+ // With no usable token, the login this machine was pinned to is a name
786
+ // already known, so it is registered as declared rather than asked for.
787
+ const known = !has && pinned(cu) && LOGIN_RE.test(cu.registeredAs) ? cu.registeredAs : null;
723
788
  const declared =
724
- opts.dryRun && opts.login !== null ? String(opts.login).trim() : declaredLoginOf(current);
789
+ opts.dryRun && opts.login !== null
790
+ ? String(opts.login).trim()
791
+ : declaredLoginOf(current) || known;
725
792
  // A typed name is used only when this machine proves no account at all; a
726
793
  // proof, for that name or another, is evidence and a declaration is not.
727
- const cu = current.global?.usageLog || {};
728
794
  const provenPin = has && pinned(cu) && cu.registeredClaim !== true;
729
795
  if (identityMatters && declared && !who.login && !provenPin && !opts.feedback) {
730
796
  who = { login: declared, method: "claim", key: null, reason: "declared by the person" };
@@ -761,8 +827,9 @@ async function main(argv) {
761
827
  ) {
762
828
  sendInstalledVersion(prefsPath);
763
829
  }
764
- say(` -> operational reporting: unchanged (${decision.reason})`);
765
- return done("skipped", decision.reason);
830
+ const detail = rejected ? `stored token rejected; ${decision.reason}` : decision.reason;
831
+ say(` -> operational reporting: unchanged (${detail})`);
832
+ return done("skipped", detail);
766
833
  }
767
834
 
768
835
  const url = registerUrl(current.global?.usageLog?.endpoint);
@@ -810,9 +877,14 @@ async function main(argv) {
810
877
  result = await requestToken(url, { u: user, c: host }, proof, who.method || "gh");
811
878
  }
812
879
  const { token, why, declined, code, reason, login: pinnedLogin } = result;
813
- if (who.method === "claim" && ["not_collaborator", "proof_required"].includes(code))
880
+ if (who.method === "claim" && ["not_collaborator", "proof_required"].includes(code)) {
881
+ outcome.refusal = code;
814
882
  declareLogin(prefsPath, null);
815
- else if (who.method === "claim" && !token && !declined)
883
+ identity.login = null;
884
+ // A rejected token pins nothing, so the refused name is not kept as one.
885
+ if (rejected || known)
886
+ patchUsageLog(prefsPath, { registeredAs: undefined, registeredClaim: undefined });
887
+ } else if (who.method === "claim" && !token && !declined)
816
888
  patchUsageLog(prefsPath, { claimFailedAt: new Date().toISOString() });
817
889
  if (declined) {
818
890
  say(` -> operational reporting left off (${why})`);
@@ -824,7 +896,12 @@ async function main(argv) {
824
896
  }
825
897
 
826
898
  const optedOut = prefs.global?.usageLog?.optOut === true;
827
- const entry = `${process.env.USER || user}_Usage_Ingest_Token`;
899
+ // A rejected token is overwritten in its own entry rather than left beside a new one.
900
+ const mapped = current.global?.keychainMapping?.usage_ingest;
901
+ const entry =
902
+ rejected && typeof mapped === "string" && /^[A-Za-z0-9._-]{1,128}$/.test(mapped)
903
+ ? mapped
904
+ : `${process.env.USER || user}_Usage_Ingest_Token`;
828
905
  const set = spawnSync("bash", [credStore, "set", entry, "-"], {
829
906
  input: token,
830
907
  encoding: "utf8",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-11-04T09:26:45Z",
3
+ "generatedAt": "2026-11-04T18:55:55Z",
4
4
  "skillCount": 244,
5
5
  "entries": [
6
6
  {
@@ -245,7 +245,7 @@
245
245
  },
246
246
  {
247
247
  "path": "shared/core/multi-agent-setup/SKILL.md",
248
- "sha256": "0e214ead6e18eca77dc46823cd78ccf2cc0e15243dad8eedd8b7e48620cb4d78"
248
+ "sha256": "956344a6f2d7be618b920ad261d9abe35b06d6ea81197f39715a04f6b7eace2c"
249
249
  },
250
250
  {
251
251
  "path": "shared/core/multi-agent-stack/SKILL.md",
@@ -301,7 +301,7 @@
301
301
  },
302
302
  {
303
303
  "path": "shared/core/multi-agent-update/SKILL.md",
304
- "sha256": "2f9e224e240e1c9053a59066678f869ae36f18c088482488f3bda8fd207148ea"
304
+ "sha256": "6e032ba4d9f350d0fa71a5ce2e05c517c665822b0288bd36882ec8e7e2e32803"
305
305
  },
306
306
  {
307
307
  "path": "shared/core/multi-agent/SKILL.md",
@@ -49,7 +49,7 @@ Show one line per service with its key or `MISSING`, then the counts (`$HOME/.cl
49
49
 
50
50
  ### Step 2.7 - Operational reporting
51
51
 
52
- Ask whether the user has an operational-reporting token; proceed only on an explicit yes. On paste, store it in the credential store ONLY (never a file, prefs value, git or synced tree): `pbpaste | ~/.copilot/lib/credential-store.sh set "${USER}_Usage_Ingest_Token" -` then `pbcopy < /dev/null`. Pasted or skipped, run `node "$HOME/.copilot/scripts/usage-register.mjs" --json`; on `"needsPersonalAccount":true` ask once for a GitHub username (Skip leaves reporting off) and re-run with `--login <name>`. What is sent: `$HOME/.claude/multi-agent-refs/features/usage-reporting.md`.
52
+ Ask whether the user has an operational-reporting token; proceed only on an explicit yes. On paste, store it in the credential store ONLY (never a file, prefs value, git or synced tree): `pbpaste | ~/.copilot/lib/credential-store.sh set "${USER}_Usage_Ingest_Token" -` then `pbcopy < /dev/null`. Pasted or skipped, run `node "$HOME/.copilot/scripts/usage-register.mjs" --json`. Ask only when that JSON line calls for it, nothing else: on `"refusal":"not_collaborator"` say in one line that the name is not a collaborator, ask once for the GitHub username again and re-run with `--login <name>` (a second refusal leaves reporting off); otherwise only on `"needsPersonalAccount":true`, which is false whenever the account is already known (a provable gh, credential-helper or SSH account, a stored `declaredLogin`, a pinned `registeredAs`), ask once for a GitHub username (Skip leaves reporting off) and re-run with `--login <name>`. What is sent: `$HOME/.claude/multi-agent-refs/features/usage-reporting.md`.
53
53
 
54
54
  The Jira project key and git identity are learned from use, never asked (`$HOME/.claude/multi-agent-refs/setup/accounts.md` "Auto-learned fields").
55
55
 
@@ -41,12 +41,18 @@ Update the pipeline with a single command. Preferences are preserved; only skill
41
41
  5b. `node "$HOME/.claude/scripts/usage-register.mjs" --json` - operational reporting.
42
42
  It requests a per-machine **write-only** token when none resolves, stores it in
43
43
  the credential store only, and switches reporting on. A no-op when a token is
44
- already onboarded, and permanently blocked by `usageLog.optOut: true`. Offline
45
- or endpoint down leaves reporting off with one line, never an error. Contract:
44
+ already onboarded and the server still accepts it (a rejected token is
45
+ replaced with no question; an unreachable check keeps it), and permanently
46
+ blocked by `usageLog.optOut: true`. Offline or endpoint down leaves reporting
47
+ off with one line, never an error. Contract:
46
48
  `$HOME/.claude/multi-agent-refs/features/usage-reporting.md`.
47
- If its JSON line says `"needsPersonalAccount":true`, ask once for the person's
48
- GitHub username (free text; Skip leaves reporting off) and run
49
- `node "$HOME/.copilot/scripts/usage-register.mjs" --login <name> --json`.
49
+ Ask only when the JSON line calls for it, nothing else. On
50
+ `"refusal":"not_collaborator"`, say in one line that the name is not a
51
+ collaborator, ask once for the GitHub username again and run
52
+ `node "$HOME/.copilot/scripts/usage-register.mjs" --login <name> --json`; a
53
+ second refusal leaves reporting off. Otherwise, only on
54
+ `"needsPersonalAccount":true` (false whenever the account is already known),
55
+ ask once for the username (Skip leaves reporting off) and run the same call.
50
56
  6. Show the new version + changelog
51
57
  7. Smoke test (schema + cross-cli)
52
58