@tpsdev-ai/flair 0.56.0 → 0.58.0

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 (153) hide show
  1. package/README.md +19 -20
  2. package/SECURITY.md +4 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli.js +1800 -293
  5. package/dist/commands/agent.js +22 -15
  6. package/dist/commands/bridge.js +40 -3
  7. package/dist/commands/doctor.js +214 -4
  8. package/dist/commands/federation.js +265 -38
  9. package/dist/commands/hook.js +10 -2
  10. package/dist/commands/init.js +179 -48
  11. package/dist/commands/memory.js +24 -2
  12. package/dist/commands/quality.js +26 -18
  13. package/dist/commands/service.js +137 -22
  14. package/dist/commands/status.js +114 -3
  15. package/dist/commands/upgrade.js +204 -84
  16. package/dist/doctor-client.js +50 -4
  17. package/dist/federation/scheduler.js +253 -4
  18. package/dist/install/clients.js +89 -23
  19. package/dist/install/global-bin-path.js +26 -6
  20. package/dist/lib/atomic-write.js +256 -0
  21. package/dist/lib/auth-resolve.js +46 -0
  22. package/dist/lib/daemon-liveness.js +61 -0
  23. package/dist/lib/doctor-run.js +5 -0
  24. package/dist/lib/embed-gpu-doctor.js +49 -26
  25. package/dist/lib/federation-memory-attributes.js +15 -0
  26. package/dist/lib/init-admin-pass.js +4 -2
  27. package/dist/lib/init-listener-environ.js +38 -0
  28. package/dist/lib/init-occupied-listener.js +165 -0
  29. package/dist/lib/instance-identity-row.js +580 -0
  30. package/dist/lib/launchd-domain-preflight.js +448 -0
  31. package/dist/lib/launchd-management.js +176 -6
  32. package/dist/lib/launchd-repair.js +95 -0
  33. package/dist/lib/memory-attributes.js +77 -0
  34. package/dist/lib/node-alias-path.js +95 -0
  35. package/dist/lib/npm-registry.js +119 -6
  36. package/dist/lib/owned-pins.js +20 -6
  37. package/dist/lib/redact-token-id.js +197 -0
  38. package/dist/lib/service-repoint-apply.js +267 -0
  39. package/dist/lib/service-repoint.js +575 -0
  40. package/dist/lib/toml-string-array.js +104 -0
  41. package/dist/lib/tree-divergence.js +716 -0
  42. package/dist/lib/upgrade-plain-tree.js +18 -8
  43. package/dist/lib/upgrade-prior-liveness.js +69 -0
  44. package/dist/lib/upgrade-rollback.js +116 -0
  45. package/dist/rem/runner.js +11 -0
  46. package/dist/resources/Agent.js +27 -14
  47. package/dist/resources/AgentSeed.js +39 -2
  48. package/dist/resources/Asset.js +3 -11
  49. package/dist/resources/Credential.js +4 -10
  50. package/dist/resources/Federation.js +299 -127
  51. package/dist/resources/Integration.js +8 -32
  52. package/dist/resources/Memory.js +623 -86
  53. package/dist/resources/MemoryArchive.js +9 -0
  54. package/dist/resources/MemoryBootstrap.js +23 -12
  55. package/dist/resources/MemoryCandidate.js +3 -11
  56. package/dist/resources/MemoryDedupStats.js +1 -1
  57. package/dist/resources/MemoryFeed.js +214 -5
  58. package/dist/resources/MemoryGrant.js +19 -40
  59. package/dist/resources/MemoryHostSource.js +90 -0
  60. package/dist/resources/MemoryMaintenance.js +121 -32
  61. package/dist/resources/MemoryReflect.js +4 -1
  62. package/dist/resources/MemoryReindex.js +7 -4
  63. package/dist/resources/MemoryUsage.js +55 -18
  64. package/dist/resources/Presence.js +18 -10
  65. package/dist/resources/RecordUsage.js +30 -40
  66. package/dist/resources/Relationship.js +170 -89
  67. package/dist/resources/SemanticSearch.js +44 -19
  68. package/dist/resources/Soul.js +31 -19
  69. package/dist/resources/XAA.js +7 -3
  70. package/dist/resources/agent-auth.js +16 -10
  71. package/dist/resources/auth-middleware.js +164 -50
  72. package/dist/resources/auto-promote-lib.js +4 -4
  73. package/dist/resources/bm25-index-service.js +246 -32
  74. package/dist/resources/bm25-status.js +132 -0
  75. package/dist/resources/bm25.js +13 -14
  76. package/dist/resources/ed25519-auth.js +11 -54
  77. package/dist/resources/embed-gpu.js +262 -47
  78. package/dist/resources/embeddings-boot.js +52 -17
  79. package/dist/resources/federation-classify.js +12 -0
  80. package/dist/resources/federation-cleanup.js +289 -51
  81. package/dist/resources/federation-crypto.js +65 -19
  82. package/dist/resources/health.js +105 -22
  83. package/dist/resources/host-pointer/registry.js +35 -0
  84. package/dist/resources/host-pointer-adapter.js +15 -0
  85. package/dist/resources/host-source-visibility.js +167 -0
  86. package/dist/resources/host-source.js +151 -0
  87. package/dist/resources/in-process-api.js +2 -1
  88. package/dist/resources/instance-create-lock.js +363 -0
  89. package/dist/resources/instance-identity-rows.js +43 -0
  90. package/dist/resources/instance-identity.js +97 -12
  91. package/dist/resources/mcp-handler.js +155 -51
  92. package/dist/resources/mcp-tool-arguments.js +83 -0
  93. package/dist/resources/mcp-tools.js +28 -25
  94. package/dist/resources/memory-consolidate-lib.js +3 -1
  95. package/dist/resources/memory-declared-attributes.js +103 -0
  96. package/dist/resources/memory-feed-lib.js +5 -1
  97. package/dist/resources/memory-host-source.js +163 -0
  98. package/dist/resources/memory-visibility.js +10 -7
  99. package/dist/resources/migrations/synthetic-test-migration.js +4 -1
  100. package/dist/resources/migrations/visibility-backfill.js +4 -1
  101. package/dist/resources/originator-instance.js +235 -0
  102. package/dist/resources/promotion-stamp.js +2 -0
  103. package/dist/resources/provenance.js +111 -11
  104. package/dist/resources/rate-limit.js +6 -4
  105. package/dist/resources/record-owner-guard.js +19 -0
  106. package/dist/resources/record-type-kit.js +44 -23
  107. package/dist/resources/record-types.js +6 -6
  108. package/dist/resources/relay-ops.js +28 -3
  109. package/dist/resources/replay-store.js +289 -0
  110. package/dist/resources/request-transaction.js +78 -0
  111. package/dist/resources/search-readiness.js +26 -22
  112. package/dist/resources/semantic-retrieval-core.js +103 -4
  113. package/dist/resources/table-helpers.js +33 -0
  114. package/dist/resources/table-patch-policy.js +109 -0
  115. package/dist/resources/table-patches.js +17 -0
  116. package/dist/resources/table-post-policy.js +138 -0
  117. package/dist/resources/table-posts.js +22 -0
  118. package/dist/resources/table-subscription-policy.js +135 -0
  119. package/dist/resources/table-subscriptions.js +19 -0
  120. package/dist/resources/tool-descriptors/index.js +15 -15
  121. package/dist/resources/trust-block.js +10 -3
  122. package/dist/resources/usage-recording.js +169 -41
  123. package/dist/src/lib/instance-identity-row.js +580 -0
  124. package/dist/src/lib/memory-attributes.js +77 -0
  125. package/dist/src/lib/redact-token-id.js +197 -0
  126. package/docs/api-reference.md +80 -16
  127. package/docs/auth.md +5 -5
  128. package/docs/claude-code.md +137 -6
  129. package/docs/deploying-on-fabric.md +6 -3
  130. package/docs/deployment.md +1 -1
  131. package/docs/embedding-in-a-harper-app.md +3 -3
  132. package/docs/federation.md +17 -10
  133. package/docs/hosted-on-fabric.md +4 -3
  134. package/docs/integrations.md +28 -19
  135. package/docs/mcp-clients.md +26 -32
  136. package/docs/n8n.md +8 -8
  137. package/docs/notes/mcp-oauth-model2.md +27 -18
  138. package/docs/openclaw.md +29 -28
  139. package/docs/quickstart.md +5 -0
  140. package/docs/releasing.md +134 -2
  141. package/docs/spoke-bringup.md +14 -11
  142. package/docs/standalone-local.md +2 -2
  143. package/docs/supply-chain-policy.md +28 -10
  144. package/docs/system-requirements.md +1 -1
  145. package/docs/troubleshooting.md +11 -0
  146. package/docs/upgrade.md +189 -63
  147. package/package.json +9 -5
  148. package/schemas/agent.graphql +9 -6
  149. package/schemas/federation.graphql +2 -11
  150. package/schemas/memory.graphql +106 -17
  151. package/schemas/replay.graphql +18 -0
  152. package/templates/launchd/start-flair-with-admin-pass.sh +22 -0
  153. package/dist/resources/federation-nonce-store.js +0 -195
@@ -14,21 +14,11 @@ If you've never set up Flair before, do step 1 first. If Flair is already runnin
14
14
 
15
15
  ## Step 1 — Install Flair (do once)
16
16
 
17
- ```bash
18
- # Install Flair globally
19
- npm install -g @tpsdev-ai/flair
20
-
21
- # Initialize the local Harper-backed server
22
- flair init
23
-
24
- # Provision an agent identity. Pick a name — typically per-project, per-purpose,
25
- # or "me" if you want one durable identity across everything.
26
- flair agent add my-project
27
- # → writes ~/.flair/keys/my-project.key (Ed25519 PKCS8) and registers the agent
28
-
29
- # Sanity check
30
- flair status
31
- ```
17
+ Follow [the laptop quickstart](quickstart.md) through agent setup and
18
+ verification. Its `flair init --agent local` path creates the agent identity
19
+ and attempts to wire detected clients when wiring is enabled.
20
+ For the manual snippets below, replace `my-project` with the agent ID you
21
+ created (`local` if you followed the quickstart unchanged).
32
22
 
33
23
  > **`flair: command not found` right after installing?** Your npm global prefix's bin dir isn't on PATH (common with a user prefix like `~/.npm-global`) — run `export PATH="$(npm prefix -g)/bin:$PATH"`, persist that line in your shell profile, and `flair doctor` will print the exact line for your shell any time.
34
24
 
@@ -45,7 +35,7 @@ The snippets below are the **local** path. Flair also has a native `/mcp` endpoi
45
35
 
46
36
  Native `/mcp` is remote-only by design. The OAuth authorization server fetches client metadata over HTTPS and refuses private, loopback, and link-local hosts. `flair mcp enable` refuses localhost, loopback, RFC1918, IPv4 link-local, and `.local`. Set `FLAIR_MCP_OAUTH=true` — that is the one value that enables both Flair's `/mcp` route and the OAuth component. A loopback Flair cannot be the origin those clients dial. The stdio adapter is the local path because it speaks the instance's Ed25519 HTTP API and does not need that public origin.
47
37
 
48
- `flair init` writes the stdio adapter. Turning on native `/mcp` is a separate operator step for a publicly reachable instance, documented from the API side in [api-reference.md](api-reference.md#mcp-tools).
38
+ `flair init --agent <id>` attempts to wire detected local clients unless MCP wiring is disabled; bare `flair init` only initializes the instance. Turning on native `/mcp` is a separate operator step for a publicly reachable instance, documented from the API side in [api-reference.md](api-reference.md#mcp-tools).
49
39
 
50
40
  ---
51
41
 
@@ -53,9 +43,9 @@ Native `/mcp` is remote-only by design. The OAuth authorization server fetches c
53
43
 
54
44
  Pick whichever you use. The MCP server is the same package; only the config syntax differs.
55
45
 
56
- > **Pin the version.** An unpinned `@tpsdev-ai/flair-mcp` re-resolves to whatever is currently published on *every* agent session, so any future publish reaches your machine silently, with no lockfile and no review step in the path. `flair init` wires clients to a **pinned** spec on purpose, and every MCP-server config snippet below is written the same way: `@tpsdev-ai/flair-mcp@<version>`.
46
+ > **Pin the version.** An unpinned `@tpsdev-ai/flair-mcp` re-resolves to whatever is currently published on *every* agent session, so any future publish reaches your machine silently, with no lockfile and no review step in the path. `flair init --agent <id>` attempts to wire detected clients when wiring is enabled; every MCP-server config snippet below is written the same way: `@tpsdev-ai/flair-mcp@<version>`.
57
47
  >
58
- > Replace `<version>` with the version you intend to run — the one you already have is `flair --version` — and bump it deliberately. Leaving the literal `<version>` in place fails loudly at `npx`, which is the intended failure: better than a config that looks pinned and isn't. `flair init` is the easier path and fills this in for you.
48
+ > Replace `<version>` with the version you intend to run — the one you already have is `flair --version` — and bump it deliberately. Leaving the literal `<version>` in place fails loudly at `npx`, which is the intended failure: better than a config that looks pinned and isn't. `flair init --agent <id>` can fill in the version for clients it wires; check its wiring summary for skipped or held configs.
59
49
  >
60
50
  > **Do not stay on a pin older than 0.18.0.** `@tpsdev-ai/flair-client` before 0.18.0 (and `@tpsdev-ai/flair-mcp` that shipped it) silently drops writes — including against another agent's shared memories — and a server upgrade does not fix that. `flair doctor` flags those pins; the remedy is `flair upgrade` (the adapter), not a newer Harper/Flair server alone. See [troubleshooting — silent write drop](troubleshooting.md#pre-0180-flair-client--flair-mcp-silently-drops-writes).
61
51
 
@@ -176,7 +166,7 @@ If you already have the older, unwrapped command, `flair doctor` reports it and
176
166
 
177
167
  The hook reads Claude Code's SessionStart
178
168
  payload on stdin, calls Flair's `bootstrap` (soul + relevant memories +
179
- predicted context, scoped to your project by the session's working directory),
169
+ predicted context; the hook sends a basename subject hint, and bootstrap selects a bounded set of the agent's own and recent memories under a token budget),
180
170
  and emits it as `hookSpecificOutput.additionalContext` — which Claude Code
181
171
  injects into the new session's context. The matcher is omitted, so it fires on
182
172
  every session start (`startup`, `resume`, `clear`, `compact`); add
@@ -188,8 +178,9 @@ It honors the same env as the MCP server (`FLAIR_AGENT_ID`, `FLAIR_URL`,
188
178
  `FLAIR_HOOK_HARNESS=codex` so bootstrap records the Codex channel; the
189
179
  stdout contract stays `hookSpecificOutput.additionalContext`.
190
180
 
191
- **It degrades to a no-op, always.** No `FLAIR_AGENT_ID`, Flair down, an auth
192
- error, or a hung daemon (past the timeout) → the hook prints `{}` and exits 0.
181
+ A failed bootstrap attempts a stderr diagnostic and can still return a continuity
182
+ resume hint; without either kind of context it returns `{}`, and the entry point
183
+ exits successfully.
193
184
  Claude Code treats that as "no context to add" and starts normally. The hook
194
185
  can never block or break session startup. The injected context is clamped to
195
186
  ≤10,000 characters to keep the session-start payload small. And if the command
@@ -257,7 +248,8 @@ flair hook uninstall --harness codex
257
248
 
258
249
  `flair doctor` reports this hook when Codex is detected. `flair hook install
259
250
  --harness codex` writes `FLAIR_HOOK_HARNESS=codex` and keeps hook stderr
260
- visible (auth failures must not be swallowed). After install, **re-approve**
251
+ visible; the session-start hook attempts one stderr diagnostic when bootstrap
252
+ fails (auth failures must not be swallowed). After install, **re-approve**
261
253
  the command in Codex with `/hooks` — a wiring change resets trust, and
262
254
  untrusted hooks are listed and skipped. `flair hook status --harness codex`
263
255
  reports that pending-approval state as configured but delivery not verified.
@@ -304,28 +296,30 @@ Clients on this page talk to the stdio server `@tpsdev-ai/flair-mcp`. Its `tools
304
296
  | Tool | What it does |
305
297
  |---|---|
306
298
  | `memory_search` | Semantic search across the caller's own and other agents' non-private memories |
307
- | `memory_store` | Save a memory (type, durability, tags, visibility), attributed to the authenticated agent. Optional `usedMemoryIds` cites memories that informed the write |
299
+ | `memory_store` | Save a memory (type, durability, tags, visibility), under the configured agent ID, subject to server authorization. Optional `usedMemoryIds` cites memories that informed the write |
308
300
  | `skill_store` | Write a skill-tagged memory. `trigger` is the recall text; `content` is the procedure. Durability is forced to persistent, and SkillScan rejects a dangerous payload before embed |
309
301
  | `skill_search` | Rank skills by their trigger against a task. Returns a catalog (id, name, trigger, description, tags, agentId), not the procedure |
310
- | `skill_get` | Fetch one skill's full procedure by id. Own skills and shared skills only; a private skill owned by someone else is not returned |
302
+ | `skill_get` | Fetch one skill's full procedure by id. Non-admin callers can retrieve their own and other agents' non-private skills; administrators can also retrieve private skills |
311
303
  | `memory_update` | Update a memory by id. Overwrites in place, or pass `preserveHistory` to write a superseding version. Optional `usedMemoryIds` |
312
304
  | `memory_get` | Fetch a specific memory by ID |
313
- | `memory_delete` | Delete one of your own memories |
305
+ | `memory_delete` | Delete a memory by ID. Non-admin callers can delete only their own memories; administrators can also delete other agents' memories |
314
306
  | `relationship_store` | Assert a subject-predicate-object triple (for example "nathan manages flair"). Asserting the same triple again updates that row |
315
307
  | `bootstrap` | Session-start context: soul, memories, and predicted context. Pass `subjects` for predictive loading |
316
- | `soul_set` | Advertised as setting a soul entry. The server refuses runtime Soul writes, including this tool's Ed25519 call; operators use `flair soul set` |
308
+ | `soul_set` | Advertised as setting a soul entry. Verified administrator Basic credentials are accepted; Ed25519 agent calls, including this tool's, are refused. Operators use `flair soul set` |
317
309
  | `soul_get` | Get a soul entry |
318
310
  | `flair_workspace_set` | Set this agent's workspace state (ref, label, provider, task, phase, summary) in the Office Space |
319
311
  | `flair_orgevent` | Publish an org-wide coordination event (claim, release, or status), attributed to the caller |
320
312
  | `flair_catchup` | Drain this agent's own org-event catch-up feed. Page with `after`; advance the watermark with `ack` |
321
313
  | `record_usage` | Report that recalled memories were actually used (`memoryId` or `memoryIds`, plus optional `attribution`). Drives `usageCount` / `usageBoost` |
322
314
 
323
- Writes are scoped per-agent (your `FLAIR_AGENT_ID`) and enforced by Flair's server, not by client convention — you can't write as another agent. Reads are more open by design: any agent on the same Flair instance can read any other agent's **non-private** memories, with no grant to set up (open-within-org read; see [SECURITY.md](../SECURITY.md)).
315
+ For ordinary signed agents, Flair enforces write ownership server-side: they can write only under their authenticated agent ID. Administrator credentials and administrator agent roles have broader authority. Reads are more open by design: any agent on the same Flair instance can read any other agent's **non-private** memories, with no grant to set up (open-within-org read; see [SECURITY.md](../SECURITY.md)).
324
316
 
325
- Which memories are non-private is decided at write time, and the default is not "shared". `memory_store` defaults `durability` to `standard`, and the server derives visibility from durability — `permanent`/`persistent` → `shared`, `standard`/`ephemeral` → `private` — so **a bare `memory_store` call writes an owner-only memory that no other agent can read.** Pass `visibility: "shared"` (or `"private"`, to be explicit) to say what you mean; the tool reports the visibility the write actually landed on so an agent can confirm it rather than assume.
317
+ Which memories are non-private is decided at write time, and the default is not "shared". `memory_store` defaults `durability` to `standard`, and the server derives visibility from durability — `permanent`/`persistent` → `shared`, `standard`/`ephemeral` → `private` — so **a bare `memory_store` call creates a private memory: ordinary agents other than its owner cannot read it; administrators retain access.** Pass `visibility: "shared"` (or `"private"`, to be explicit) to say what you mean; the tool reports the visibility the write actually landed on so an agent can confirm it rather than assume.
326
318
 
327
319
  ### Reading the `bootstrap` payload
328
320
 
321
+ The following structured-payload details describe the HTTP bootstrap response and native `/mcp`; stdio `flair-mcp` returns the formatted context as an MCP text block.
322
+
329
323
  `bootstrap` returns the canonical structured containers — `soul`, `memories`, `predicted`, `teammateFindings`, `events` — plus counts and a `tokenEstimate`. The containers are **always present** (empty `[]`/`{}` when there's nothing), so an empty container is distinguishable from an unsupported one.
330
324
 
331
325
  **The token ledger reconciles `tokenEstimate` from the payload alone (flair#1270).** Every token-charged content class carries a counter — `soulTokens`, `memoryTokens`, `trustTokens`, `eventsTokens` — plus a measured `scaffoldTokens` for the fixed JSON frame, and `tokenEstimate ≈ scaffoldTokens + soulTokens + memoryTokens + trustTokens + eventsTokens`. The remaining ≈ gap is the bounded per-item difference between the prose lines the memory counters measure and the heavier structured objects the containers ship. A payload whose estimate an agent can't decompose from the reported figures is a bug, not an accounting convention.
@@ -342,7 +336,7 @@ Which memories are non-private is decided at write time, and the default is not
342
336
  |---|---|---|
343
337
  | `FLAIR_AGENT_ID` | (none — required) | Must match `flair agent add <id>` |
344
338
  | `FLAIR_URL` | `http://127.0.0.1:19926` | Override for remote Flair instances |
345
- | `FLAIR_KEY_PATH` | `~/.flair/keys/<agent>.key` | Ed25519 PKCS8 key — created by `flair agent add` |
339
+ | `FLAIR_KEY_PATH` | `~/.flair/keys/<agent>.key` | Path to the Ed25519 private key; `flair agent add` creates a raw 32-byte seed. |
346
340
 
347
341
  The MCP server has no client-side flags beyond these env vars; everything else (timeouts, dedup thresholds, error classification) is opinionated defaults from the underlying [`@tpsdev-ai/flair-client`](../packages/flair-client) package.
348
342
 
@@ -350,7 +344,7 @@ The MCP server has no client-side flags beyond these env vars; everything else (
350
344
 
351
345
  ## What about pi?
352
346
 
353
- pi has no MCP client support, so Flair ships a **native pi extension** instead: [`@tpsdev-ai/pi-flair`](../packages/pi-flair/README.md). Same backend, same agent isolation, zero MCP in the path.
347
+ pi has no MCP client support, so Flair ships a **native pi extension** instead: [`@tpsdev-ai/pi-flair`](../packages/pi-flair/README.md). Same backend. With an ordinary signed identity, writes are owned by that agent; reads admit its own records and other agents' non-private records. Zero MCP in the path.
354
348
 
355
349
  Wiring is a `packages` entry in pi's own settings (`~/.pi/agent/settings.json`), not an `mcpServers` block:
356
350
 
@@ -360,7 +354,7 @@ Wiring is a `packages` entry in pi's own settings (`~/.pi/agent/settings.json`),
360
354
  }
361
355
  ```
362
356
 
363
- `flair init --client pi` writes exactly that (pinned), or use pi's own installer: `pi install npm:@tpsdev-ai/pi-flair`. `flair doctor` detects pi and checks the wiring — including the one known trap: **an `npm:` spec under the `extensions` settings key is silently ignored by pi** (`extensions` takes local file paths only; package sources belong under `packages` — [#1346](https://github.com/tpsdev-ai/flair/issues/1346)). Doctor calls that misconfiguration out by name, and `flair doctor --fix` moves the entry.
357
+ `flair init --agent my-agent --client pi` writes exactly that (pinned), or use pi's own installer: `pi install npm:@tpsdev-ai/pi-flair`. `flair doctor` detects pi and checks the wiring — including the one known trap: **an `npm:` spec under the `extensions` settings key is silently ignored by pi** (`extensions` takes local file paths only; package sources belong under `packages` — [#1346](https://github.com/tpsdev-ai/flair/issues/1346)). Doctor calls that misconfiguration out by name, and `flair doctor --fix` moves the entry.
364
358
 
365
359
  One difference from the MCP clients above: pi settings carry no per-package `env` block, so `FLAIR_AGENT_ID` (and `FLAIR_URL` when non-default) must be exported in the environment that launches pi. Doctor reports what it sees in its own shell and says so — it cannot observe the environment of every pi launch.
366
360
 
@@ -368,7 +362,7 @@ One difference from the MCP clients above: pi settings carry no per-package `env
368
362
 
369
363
  ## What about Hermes (Nous Research)?
370
364
 
371
- Hermes uses its own Python-native `MemoryProvider` ABC instead of MCP. It has its own Flair integration in [`packages/hermes-flair/`](../packages/hermes-flair). Same backend, same agent isolation, different plug shape.
365
+ Hermes uses its own Python-native `MemoryProvider` ABC instead of MCP. It has its own Flair integration in [`packages/hermes-flair/`](../packages/hermes-flair). Same backend. With an ordinary signed identity, writes are owned by that agent; reads admit its own records and other agents' non-private records. Different plug shape.
372
366
 
373
367
  Future MCP-capable agent CLIs (and there are more landing every month) will work out of the box with the MCP server above — no per-framework adapter required from us.
374
368
 
package/docs/n8n.md CHANGED
@@ -39,7 +39,7 @@ In n8n: **Credentials → New → Flair API**. Fill in:
39
39
  | Field | Value |
40
40
  |---|---|
41
41
  | **Base URL** | `http://localhost:19926` (or your team's Flair URL) |
42
- | **Agent ID** | Logical identity that will own memories from this n8n workspace. Workflows that share an Agent ID share memory ownership. Use distinct IDs when isolation matters. |
42
+ | **Agent ID** | Logical identity that will own memories from this n8n workspace. Workflows that share an Agent ID share memory ownership. Use distinct Agent IDs to organize ownership; the shared admin credential can access the whole instance. |
43
43
  | **Admin Password** | Your Flair admin password (in `~/.flair/admin-pass` for local installs). **Sensitive** — see [Security](#security). |
44
44
 
45
45
  Click **Test** — if the test request to `/Memory` returns 200, the credential is good.
@@ -48,7 +48,7 @@ Click **Test** — if the test request to `/Memory` returns 200, the credential
48
48
 
49
49
  Three nodes ship in the package:
50
50
 
51
- - **Flair Chat Memory** — connects to an AI Agent's `Memory` socket. Stores chat history in Flair, scoped by Subject. Defaults to per-workflow memory; set the optional Session Sub-Key to `={{ $execution.id }}` for per-run isolation.
51
+ - **Flair Chat Memory** — connects to an AI Agent's `Memory` socket. Stores chat history in Flair, scoped by Subject. Defaults to per-workflow memory; set the optional Session Sub-Key to `={{ $execution.id }}` for per-run chat-history grouping by subject.
52
52
  - **Flair Search** — connects to an AI Agent's `Tool` socket. Two operations:
53
53
  - *Semantic Search* — agent calls `flair_search({ query })`, gets memories ranked by similarity.
54
54
  - *Get By Subject* — agent calls `flair_get_by_subject()`, gets memories under a config-time-bound subject.
@@ -70,14 +70,14 @@ The agent now answers using both its current chat history (from Flair Chat Memor
70
70
 
71
71
  n8n memory connectors expose a `sessionKey` parameter that scopes the chat history. Flair has a richer model:
72
72
 
73
- - **Subject** (required) — the entity / conversation / topic the memory is about. Indexed in Flair's schema; efficient to filter on. Default: `={{ $workflow.name }}`.
74
- - **Session Sub-Key** (optional) — appended to the subject as `<subject>:<sessionKey>`. Use the n8n execution id (`={{ $execution.id }}`) for per-run isolation, or a customer/user id for per-customer scoping, or leave blank to share across runs.
73
+ - **Subject** (required) — the entity / conversation / topic the memory is about. For Flair Search Get By Subject, the client compares subjects after retrieval and the node requests no ordering. Default: `={{ $workflow.name }}`.
74
+ - **Session Sub-Key** (optional) — appended to the subject as `<subject>:<sessionKey>`. Use the n8n execution id (`={{ $execution.id }}`) for per-run chat-history grouping by subject, or a customer/user id for per-customer scoping, or leave blank to share across runs.
75
75
 
76
76
  Patterns:
77
77
 
78
78
  - **"This assistant remembers"** — set Subject to a stable string (`customer-support`, `daily-standup`). Leave Session Sub-Key blank. All runs share memory.
79
- - **Per-conversation isolation** — set Subject to the conversation owner (`customer:1234`), leave Session Sub-Key blank. Each conversation is isolated by subject.
80
- - **Per-execution isolation** — set Session Sub-Key to `={{ $execution.id }}`. Each n8n run gets its own memory window. (This is most similar to n8n's default `sessionKey={{ $execution.id }}`.)
79
+ - **Per-conversation grouping** — set Subject to a unique conversation ID (for example, `conversation:abc123`) and leave Session Sub-Key blank. Runs using the same Agent ID and conversation ID select the same chat history; different conversation IDs select different histories.
80
+ - **Per-execution grouping** — set Session Sub-Key to `={{ $execution.id }}`. A distinct subject selects each conversation's or run's chat-history window; it does not restrict access to those memories. (This is most similar to n8n's default `sessionKey={{ $execution.id }}`.)
81
81
 
82
82
  ## Security
83
83
 
@@ -91,9 +91,9 @@ For production deployments where untrusted workflow inputs reach Flair, wait for
91
91
 
92
92
  If any of those don't hold, use Flair's CLI / SDK clients (which support per-agent Ed25519 today) and wait for the n8n credential update.
93
93
 
94
- ## Get By Tag — coming soon
94
+ ## Get By Tag
95
95
 
96
- The Flair Search node currently exposes Semantic Search and Get By Subject. **Get By Tag** is deferred until `flair-client.memory.list` exposes a `tags` filter. Workaround for now: use Semantic Search and let the model filter results by tags in the response.
96
+ The Flair Search node currently exposes Semantic Search and Get By Subject. **Get By Tag** is not yet exposed as an operation. The `memory.list` client does support the `tags` filter — use it directly via the SDK for agent-driven tag filtering.
97
97
 
98
98
  ## Worked examples
99
99
 
@@ -6,8 +6,8 @@
6
6
  > Do NOT enable in production until Sherlock signs off on live enablement.
7
7
 
8
8
  This is the **Model 2** native-MCP path: a custom in-process `/mcp` JSON-RPC
9
- handler guarded by `@harperfast/oauth`'s `withMCPAuth`, serving the 9 curated
10
- flair tools with a per-agent OAuth identity. It is distinct from the
9
+ handler guarded by `@harperfast/oauth`'s `withMCPAuth`, serving the 17 tools in `resources/mcp-tools.ts`
10
+ with a per-agent OAuth identity. It is distinct from the
11
11
  native-application-MCP surface (design A / `FLAIR_MCP_ENABLED`); Model 2 does not
12
12
  use Harper's native MCP transport, so it is not blocked by the Harper native-MCP
13
13
  gating gaps.
@@ -18,12 +18,10 @@ gating gaps.
18
18
  Streamable HTTP: `initialize` / `tools/list` / `tools/call` / `ping`. On
19
19
  `tools/call` it resolves the verified token `sub` → a flair `Agent`, then
20
20
  dispatches to the curated tool.
21
- - `resources/mcp-tools.ts` — the 9 curated tools (memory_search, memory_store,
22
- memory_get, memory_delete, bootstrap, soul_set, soul_get, flair_workspace_set,
23
- flair_orgevent), each a thin wrapper over the existing resource handler
21
+ - `resources/mcp-tools.ts` — the 17 tools in `resources/mcp-tools.ts`, each a thin wrapper over the existing resource handler
24
22
  (Memory / SemanticSearch / BootstrapMemories / Soul / WorkspaceState /
25
- OrgEvent). No raw CRUD surface — the only path to the datastore through `/mcp`
26
- is one of these 9 semantic tools. Curated **by construction**.
23
+ OrgEvent / AttentionQuery / RecordUsage). No raw CRUD surface — the only path to the datastore through `/mcp`
24
+ is one of the 17 tools in `resources/mcp-tools.ts`. Curated **by construction**.
27
25
  - `resources/mcp-oauth.ts` — registers `server.http(withMCPAuth(mcpHandler),
28
26
  { urlPath: '/mcp' })` **only when `FLAIR_MCP_OAUTH` is on.** `/mcp` runs on its
29
27
  own dispatch chain; flair's default auth-middleware does not run for it.
@@ -36,11 +34,25 @@ aud, scope }`. The handler maps `sub` → a flair `Agent` id:
36
34
 
37
35
  1. Look up `Credential` where `kind === "idp"` AND `idpSubject === sub` → its
38
36
  `principalId` is the Agent id. (Same credential surface XAA's ID-JAG path
39
- uses — one identity model.)
37
+ uses — one identity model.) That Agent must exist and be active on **every**
38
+ tool call dispatched through the mapping — the rule the Ed25519 path applies
39
+ (`isPrincipalDeactivated`; a record with no `status` field counts as
40
+ active). A deactivated or missing principal is refused with a JSON-RPC error
41
+ that names the principal and the operator's remedy, so a token minted while
42
+ the principal was active stops working once it is deactivated and, while the
43
+ token remains valid, works again once it is reactivated. The credential's
44
+ `lastUsedAt` is updated, best effort, after a tool has run; the update
45
+ writes that field alone.
40
46
  2. If no mapping and `FLAIR_MCP_JIT_PROVISION` is on, JIT-provision a
41
47
  non-admin `Agent` + `Credential(kind:"idp")` from the sub.
42
48
  3. Otherwise **deny** — an unresolvable sub never runs as anonymous or admin.
43
49
 
50
+ A failed credential lookup or principal read during identity resolution
51
+ refuses the call. It is never read as "allowed", and never as "no mapping", so
52
+ step 2 runs only for a subject the credential lookup answered for. A failed
53
+ read of the credential before the post-tool `lastUsedAt` update leaves the
54
+ served answer unchanged.
55
+
44
56
  The resolved agent is set as `request.tpsAgent` on a flair-shaped delegation
45
57
  context, so the wrapped handler scopes to the verified agent exactly as an
46
58
  Ed25519-signed REST call would. Identity always comes from the resolved agent,
@@ -108,8 +120,8 @@ registered identities.
108
120
 
109
121
  ## Enabling (operator checklist)
110
122
 
111
- 1. **Install the AS plugin** — add `@harperfast/oauth` (already an exact-pinned
112
- dependency) and declare it in `config.yaml`:
123
+ 1. **Configure the AS plugin** — `@harperfast/oauth` is exact-pinned in `package.json`
124
+ and already declared in `config.yaml`; configure the existing block:
113
125
 
114
126
  ```yaml
115
127
  '@harperfast/oauth':
@@ -136,13 +148,12 @@ registered identities.
136
148
  ```
137
149
 
138
150
  **DCR is not supported; clients connect via CIMD (Client ID Metadata
139
- Documents).** `flair mcp enable` (flair#756) writes exactly this shape —
140
- see "Legacy clients" below.
151
+ Documents).** The shipped `config.yaml` contains this block; `flair mcp enable`
152
+ uses it instead of creating it. See "Legacy clients" below.
141
153
 
142
- The `config.yaml` block is intentionally NOT committed to the live config in
143
- this slice — adding it changes boot behavior, which would break the
144
- default-OFF / byte-identical contract. An operator adds it deliberately when
145
- turning the surface on.
154
+ The shipped `config.yaml` already declares `@harperfast/oauth`; enable its MCP
155
+ surface with `FLAIR_MCP_OAUTH=true` and configure the issuer and provider
156
+ credentials.
146
157
 
147
158
  2. **Set the env:**
148
159
  - `FLAIR_MCP_OAUTH=true` — turns on the `/mcp` route registration AND the
@@ -191,8 +202,6 @@ cannot connect to this surface.
191
202
 
192
203
  ## Deferred (not in this slice)
193
204
 
194
- - Live `config.yaml` wiring of the `@harperfast/oauth` plugin (kept out to
195
- preserve the byte-identical flag-OFF contract; documented above for operators).
196
205
  - Migrating the homegrown `OAuth.ts` / `XAA.ts` opaque-token AS to the plugin.
197
206
  Per Kern: deprecate-don't-delete — they stay for the Ed25519/signed-REST path.
198
207
  XAA's JIT-provisioning is kept; the Model-2 handler reuses the same
package/docs/openclaw.md CHANGED
@@ -29,22 +29,34 @@ In your OpenClaw agent config, add the Flair plugin:
29
29
 
30
30
  ```json
31
31
  {
32
- "plugins": {
33
- "@tpsdev-ai/openclaw-flair": {
34
- "agentId": "my-agent",
35
- "flairUrl": "http://localhost:19926"
32
+ "plugins": {
33
+ "allow": ["openclaw-flair"],
34
+ "slots": {
35
+ "memory": "openclaw-flair"
36
+ },
37
+ "entries": {
38
+ "openclaw-flair": {
39
+ "enabled": true,
40
+ "hooks": {
41
+ "allowPromptInjection": true
42
+ },
43
+ "config": {
44
+ "url": "http://127.0.0.1:19926",
45
+ "autoRecall": true,
46
+ "autoCapture": false,
47
+ "maxRecallResults": 5,
48
+ "maxBootstrapTokens": 4000,
49
+ "agentId": "my-agent"
50
+ }
51
+ }
52
+ }
36
53
  }
37
- }
38
54
  }
39
55
  ```
40
56
 
41
- Or set environment variables:
42
-
43
- ```bash
44
- export FLAIR_AGENT_ID=my-agent
45
- export FLAIR_URL=http://localhost:19926
46
- ```
57
+ `allowConversationAccess` is required to enable auto-capture (the plugin also reads it for a startup warning and status), so this example, with `autoCapture: false`, leaves it out.
47
58
 
59
+ An optional `agentId` in `config` is an **allow-list**: it restricts which agents may be served but never substitutes for the host's per-invocation identity, which comes from host context on every call.
48
60
  ### 5. Restart the gateway
49
61
 
50
62
  ```bash
@@ -58,21 +70,20 @@ The Flair plugin adds these tools to your OpenClaw agent:
58
70
  | Tool | Description |
59
71
  |------|-------------|
60
72
  | `memory_store` | Write a memory with optional type, durability, and tags |
61
- | `memory_recall` | Semantic search over stored memories |
73
+ | `memory_search` | Semantic search over stored memories |
62
74
  | `memory_get` | Retrieve a specific memory by ID |
63
75
 
64
76
  ### Automatic Bootstrap
65
77
 
66
- On each new conversation, the plugin injects relevant context from Flair:
78
+ With `autoRecall` on (the default) and the host's `hooks.allowPromptInjection` enabled, the plugin handles `before_prompt_build`: it requests bootstrap context from Flair, up to `maxBootstrapTokens` and without passing a conversation topic, and returns it as `prependContext` when the context is non-empty. The context can include:
67
79
  - Soul entries (persistent personality and project context)
68
- - Recent memories (last 24h)
69
- - Relevant memories (semantically matched to the conversation topic)
80
+ - Recent memories (an adaptive window: 48 hours, widening to 7 and then 30 days when fewer than three are found)
70
81
 
71
- This happens automatically — no agent configuration needed beyond the plugin setup.
82
+ Without `hooks.allowPromptInjection` the plugin contributes no context and logs `prompt context disabled: policy` at startup.
72
83
 
73
84
  ## Multi-Agent
74
85
 
75
- Each OpenClaw agent gets its own isolated memory space:
86
+ Each OpenClaw agent writes with its `agentId` as a field (tags are optional); reads use owner plus visibility. A verified agent can read all its own records (private included) and other agents' non-private records on the instance; grants do not expand that read scope.
76
87
 
77
88
  ```bash
78
89
  flair agent add research-agent
@@ -80,13 +91,6 @@ flair agent add coding-agent
80
91
  flair agent add review-agent
81
92
  ```
82
93
 
83
- Agents can share memories via grants:
84
-
85
- ```bash
86
- # Let review-agent read coding-agent's memories
87
- flair grant coding-agent review-agent --scope read
88
- ```
89
-
90
94
  ## Soul (Personality)
91
95
 
92
96
  Set persistent context that shapes how the agent behaves:
@@ -103,10 +107,7 @@ Soul entries are included in every bootstrap — they're the agent's persistent
103
107
 
104
108
  ## Key Resolution
105
109
 
106
- The plugin resolves Ed25519 keys in this order:
107
- 1. `FLAIR_KEY_PATH` environment variable
108
- 2. `~/.flair/keys/<agent-id>.key`
109
- 3. `~/.tps/secrets/flair/<agent-id>-priv.key` (legacy TPS path)
110
+ The plugin finds Ed25519 keys for the host-provided agent identity: `keyPath` from config is only valid with a sole allowed agent (`agentId` set); otherwise the client resolves via `FLAIR_KEY_DIR` env var, then `~/.flair/keys/<agent-id>.key`, then `~/.tps/secrets/flair/<agent-id>-priv.key`. For each resolved home, `.flair` then the legacy path are checked in order before the next home.
110
111
 
111
112
  ## Troubleshooting
112
113
 
@@ -121,6 +121,11 @@ flair memory add --agent local "Harper v5 sandbox blocks node:module but process
121
121
 
122
122
  Flair embedded the text locally on write. No network calls.
123
123
 
124
+ ### Task summaries
125
+ Use `flair memory write-task-summary --agent local --outcome merged --summary "Finished the task"` to save a persistent task summary and print its memory id.
126
+ The optional `--ref <ref>` accepts a task, issue, or PR reference; omitted references use `unreferenced`. Outcomes are `merged`, `rejected`, or `abandoned`.
127
+ Existing `--beads` callers remain supported as a deprecated alias; `--ref` takes precedence.
128
+
124
129
  ### Who can read it
125
130
 
126
131
  `visibility: private` means **only `local` can read this memory** — no other agent on the instance can search it, fetch it by id, or receive it in a bootstrap.
package/docs/releasing.md CHANGED
@@ -83,13 +83,94 @@ fragment directory is empty (nothing to release) or when someone hand-wrote an e
83
83
 
84
84
  ### Phase 2 — tag the release
85
85
 
86
- After the release PR is merged to `main`, push the version tag:
86
+ After a release PR merges to `main`, [Release auto-tag](../.github/workflows/release-auto-tag.yml)
87
+ normally creates its tag after a successful push CI run, subject to the release checks.
88
+ If an allowlisted advisory job fails that CI run, the immediate path is skipped and
89
+ nightly recovery makes the tag instead. It runs at **04:23 UTC daily**, so expect up
90
+ to **24 hours plus run time**. It uses completed CI runs regardless of their overall
91
+ conclusion and tolerates only exact names in [the advisory allowlist](../.github/release-auto-tag-advisories.json).
92
+ All other release conditions must pass, and it targets the version still declared
93
+ on `main`, so a newer version supersedes a missed release.
94
+
95
+ To tag by hand, push the version tag:
87
96
 
88
97
  ```bash
89
98
  git checkout main && git pull
90
99
  git tag v0.11.0 && git push origin v0.11.0
91
100
  ```
92
101
 
102
+ > The [`release-auto-tag`](../.github/workflows/release-auto-tag.yml) workflow
103
+ > normally pushes this tag for you once a release PR merges green (see
104
+ > [#1928](https://github.com/tpsdev-ai/flair/issues/1928)); the hand-push above is
105
+ > the manual fallback. When the release commit's tree carries
106
+ > `packages/adk-flair/pyproject.toml` whose `[project].version` equals the version
107
+ > being tagged, the auto-tagger ALSO creates `adk-flair-v<version>` from the same
108
+ > commit — so the PyPI publish run then needs only the environment gate its owner
109
+ > keeps or drops (no hand-pushed `adk-flair-v` tag).
110
+ >
111
+ > The project version is read with Python's `tomllib` — the SAME reader
112
+ > `.github/workflows/adk-flair-publish.yml` decides with — by handing the file to
113
+ > `python3` on stdin, in isolated mode (`-I`: no working-directory module can
114
+ > shadow the standard library) with an environment of `PATH` only, so no token
115
+ > reaches the interpreter ((r9e)). It fails CLOSED: a TOML parse error, a `python3` without
116
+ > `tomllib` (older than 3.11), or a `[project]` that is not a table is
117
+ > `unsupported`, and the tagger refuses `adk-pyproject-unsupported` naming the
118
+ > reason ((s), (v)); a `dynamic = [ … "version" … ]` or a missing
119
+ > `[project].version` is NONE and refuses `adk-version-mismatch` ((t)); a
120
+ > `[project].version` that differs from the version being tagged refuses
121
+ > `adk-version-mismatch` BEFORE either tag is written ((p), (q), (g)) — a
122
+ > `version =` line inside a multi-line string or array is never read as the
123
+ > project version. With NO `packages/adk-flair/pyproject.toml` the
124
+ > tagger's adk step is skipped ((b)), but `scripts/check-version-sync.mjs` lists the
125
+ > pyproject as a source file and refuses when it is missing, so today such a release
126
+ > refuses at `version-sync`. Removing the Python package from the repo means removing
127
+ > it, in the same change, from the checker's source list and from the paths
128
+ > `scripts/release.sh` stages for the release commit; a release is then tagged `v`
129
+ > alone. An
130
+ > `adk-flair-v<version>` already at another commit refuses
131
+ > `adk-tag-exists-elsewhere` before the `v` tag is written ((d)); a second POST
132
+ > rejected for lack of permission refuses `adk-ref-write-rejected`, and the text
133
+ > reports what THIS run read back for BOTH refs and the next step ((e)): for a 403
134
+ > the text names the App's bypass-actor setting on the `adk-flair-v*` ruleset as the
135
+ > first thing to check (the usual cause; the code sees only the status), then a
136
+ > re-run; for any other status, a re-run ((r9a)). A read of the adk ref that FAILS
137
+ > (the API answers neither found nor not found) refuses `adk-ref-unreadable` instead
138
+ > of throwing: before any tag is written at the pre-check and on a same-commit re-run
139
+ > ((r9b), (r9f), (r9g)), and with the `v` tag in place at the re-read and the
140
+ > read-back ((r9c), (r9d)). After a REJECTED adk POST the refusal stays
141
+ > `adk-ref-write-rejected`, and the text reports the adk read-back as
142
+ > `not read: <reason>`; when the adk read-back cannot be resolved, the text reports its raw
143
+ > ref type and SHA (or `not found`), so it names BOTH refs' read-back values on every
144
+ > branch. The post-POST read-back has THREE refusals, each reporting only
145
+ > what this run observed: the adk ref did not read back at all (MISSING, (i2)); it
146
+ > read back but could not be resolved to a commit (UNRESOLVED, (i3)); or it
147
+ > resolves elsewhere (ELSEWHERE, (i)). None states what a future run will do. The
148
+ > membership+read of the pyproject is ONE function (`readAdkPyproject`): a
149
+ > `git ls-tree` that does not answer exactly "absent" or "the path" (non-zero exit,
150
+ > spawn error, timeout, unexpected output) or a failed `git show` refuses
151
+ > `adk-pyproject-unreadable` — before any POST, on BOTH the decide and write paths
152
+ > ((r1)-(r4)); no stderr substring decides anything.
153
+ >
154
+ > The writer (`scripts/check-version-sync.mjs --write`) precomputes the two
155
+ > `SOURCE_VERSION_FILES` edits — `packages/flair-bench/src/version.ts` and
156
+ > `packages/adk-flair/pyproject.toml` — verifies the pyproject edit with `tomllib`
157
+ > (refused unless only `project.version` changed) and the flair-bench edit with its
158
+ > own declaration check (exactly one `TOOL_VERSION = "…"` match), writes NOTHING if
159
+ > either fails, and leaves the `package.json` bumps to `release.sh` ((w), (x2), (m),
160
+ > (h), all-or-nothing).
161
+ >
162
+ > Re-run states (`decide`): with the `v` tag already at `<sha>` and the adk tag
163
+ > absent, the run is a TAG with the `v` step marked SKIP ((n)); with BOTH tags at
164
+ > `<sha>` it is a SKIP, so no write job starts on later runs ((o)). Once `v` is
165
+ > known to sit at the sha, EVERY later refusal carries `v_verdict=SKIP`, so the
166
+ > refusal issue never prints `v: REFUSE` for an existing ref — fed from `decide`'s
167
+ > outputs when `write` was skipped — and that is asserted on the RENDERED issue
168
+ > line, not the wiring (`test/unit/release-auto-tag-workflow.test.ts`). The App
169
+ > must be listed as a bypass actor on the `adk-flair-v*` tag ruleset (id 24044018)
170
+ > for that second POST to be allowed. Each guarantee names its test:
171
+ > `test/unit/release-auto-tag.test.ts` and
172
+ > `test/unit/release-auto-tag-workflow.test.ts`.
173
+
93
174
  The tag push triggers the [`release-publish`](../.github/workflows/release-publish.yml)
94
175
  workflow, which:
95
176
 
@@ -149,12 +230,15 @@ cannot be re-staged under a different tag.
149
230
 
150
231
  The moment the staged packages are approved, dispatch the
151
232
  [`post-publish canary`](../.github/workflows/canary.yml) (Actions → "Post-publish canary
152
- — install + boot a published version") with two inputs:
233
+ — install + boot a published version") with three inputs:
153
234
 
154
235
  | Input | Value |
155
236
  | ----- | ----- |
156
237
  | `version` | the version just approved, exact (e.g. `vX.Y.Z` without the `v`) |
157
238
  | `expected_sha256` | the published tarball's sha256 (64 hex). The canary computes it from the registry with `node scripts/ci/registry-tarball-sha256.mjs <ver>`. |
239
+ | `package_set_digest` | the certified package-set digest (64 lowercase hex), printed as `package-set-digest=<digest>` in the log of the release run's "Pack publishable packages and write the release manifest" step. It can also be recomputed from that step's lines (`<name>@<version> <sha256> <basename>`) by feeding `<name>=<sha256>` lines to `node scripts/ci/package-set-digest.mjs --version <ver>`. The canary re-derives the digest from the tarballs it verified and refuses a mismatch before any verdict. |
240
+
241
+ For example, after all staged packages are public: `gh workflow run canary.yml --ref main -f 'version=<ver>' -f 'expected_sha256=<flair-tarball-sha256>' -f 'package_set_digest=<package-set-digest>'`.
158
242
 
159
243
  The canary runs on clean `ubuntu-latest` and `macos-latest` runners and is
160
244
  **credential-less**: it installs `@tpsdev-ai/flair@<ver>` by exact version from the
@@ -332,3 +416,51 @@ The maintainer who approves staged packages must have 2FA enabled on their npm a
332
416
  npm itself; local approvers need a recent npm.
333
417
  - Node **≥ 22.14**.
334
418
  - Trusted publishing runs on GitHub-hosted runners only (no self-hosted support yet).
419
+
420
+ ## Automated promote — slice 1 (flair#1928)
421
+
422
+ After the npm approval, a maintainer today pastes the promote block from a
423
+ checkout. Slice 1 lands the four pieces the privileged promote job (slice 2) will
424
+ stand on; it holds no npm credential (the poll runs on the automatic
425
+ `GITHUB_TOKEN` with `actions: write`, `contents: read` and `deployments: read`).
426
+
427
+ - **The certified digest travels with the release attempt.** The `release-attempt`
428
+ deployment marker carries a `payload` of `package_set_digest`, `manifest_sha256`
429
+ and `version`, taken from the values `stage-publish` re-derived from the artifact
430
+ it staged. It is written BEFORE anything is staged, so a missing or mismatched
431
+ digest refuses the stage (nothing staged).
432
+ - **A machine surface for the promote block.** `scripts/ci/canary-verdict.sh
433
+ --emit bash` prints ONLY the executable promote block — byte-identical to the
434
+ text between the fences a human sees (one definition). A FAIL or a non-release
435
+ version has no promote block: `--emit bash` exits 3 with one stderr line.
436
+ - **The unprivileged poll.** `release-promote-poll.yml` runs every 10 minutes
437
+ (`schedule` only — there is no manual trigger, because `gh workflow run --ref <branch>` runs that branch's copy of the workflow, and a guard inside the file cannot bind it to main) and holds NO npm credential: no `environment`,
438
+ no repo secret — it runs on the automatic `GITHUB_TOKEN` with `actions: write`,
439
+ `contents: read` and `deployments: read`. It checks out ONLY the default branch
440
+ at the run's own sha (never a tag's tree), and brings exactly what the package
441
+ derivation reads (`scripts/ci`, the root `package.json` and
442
+ `packages/*/package.json`); that derivation FAILS CLOSED — a non-zero exit or an
443
+ empty list is an error exit that names the cause, never a silent "ready". It
444
+ reads every `release-attempt` / `promoted` marker across ALL pages
445
+ (`--paginate`, flattened), and for each pending marker takes the version from the
446
+ MARKER PAYLOAD (never main's `package.json`, which moves on after a release;
447
+ never the ref alone — the ref must equal `v<payload.version>` or the marker is
448
+ refused). It requires EVERY lockstep package `<name>@<version>` to be public and
449
+ to re-derive the certified package-set digest (ALL-form: one missing/odd package
450
+ is NOT READY, exit 0, the package named), and on READY dispatches
451
+ `release-promote.yml --ref v<version>`, gated behind that workflow existing
452
+ (slice 2). Every run is a schedule run of the default branch's copy of the file, so
453
+ `github.sha` is always a main sha. **The poll's outputs are
454
+ never an input to what gets promoted** — the privileged job re-derives everything
455
+ it acts on. (`test/unit/release-promote-poll-workflow.test.ts`.)
456
+ - **Trust-root ownership.** `.github/CODEOWNERS` puts `/scripts/ci/canary-verdict.sh`,
457
+ `/scripts/ci/package-set-digest.mjs`, `/scripts/ci/registry-tarball-sha256.mjs`,
458
+ `/scripts/ci/registry-latest-skew.mjs`, `/scripts/ci/lockstep-packages.mjs`,
459
+ `/.github/workflows/canary.yml` and `/.github/workflows/release-promote*.yml`
460
+ under the trust root (`@heskew`); the test resolves EFFECTIVE ownership (last
461
+ matching rule wins) for each protected path.
462
+ (`test/unit/release-auto-tag-workflow.test.ts`.)
463
+
464
+ Not in this slice: the privileged `release-promote.yml`, the `release-promote`
465
+ environment, `NPM_TOKEN`, the machinery-recency guard, and the refusal issue with
466
+ restore lines — all slice 2.