@tpsdev-ai/flair 0.58.0 → 0.62.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 (268) hide show
  1. package/README.md +7 -6
  2. package/SECURITY.md +36 -0
  3. package/config.yaml +15 -1
  4. package/dist/bridges/builtins/mem0.js +63 -28
  5. package/dist/bridges/runtime/import-runner.js +12 -0
  6. package/dist/bridges/runtime/load-plugin.js +42 -13
  7. package/dist/bridges/runtime/yaml-loader.js +4 -2
  8. package/dist/build-info.json +3 -3
  9. package/dist/cli.js +1030 -343
  10. package/dist/commands/agent.js +384 -45
  11. package/dist/commands/attention.js +4 -3
  12. package/dist/commands/backup.js +202 -34
  13. package/dist/commands/bridge.js +172 -119
  14. package/dist/commands/deploy.js +37 -4
  15. package/dist/commands/doctor.js +601 -163
  16. package/dist/commands/export.js +54 -19
  17. package/dist/commands/federation.js +141 -21
  18. package/dist/commands/hook.js +155 -2
  19. package/dist/commands/idp.js +14 -1
  20. package/dist/commands/import.js +7 -3
  21. package/dist/commands/init.js +462 -193
  22. package/dist/commands/integrity.js +388 -0
  23. package/dist/commands/keys.js +247 -58
  24. package/dist/commands/mcp.js +146 -53
  25. package/dist/commands/memory.js +171 -21
  26. package/dist/commands/migrate-harness-memory.js +3 -2
  27. package/dist/commands/orgevent.js +46 -37
  28. package/dist/commands/presence.js +4 -3
  29. package/dist/commands/principal.js +426 -48
  30. package/dist/commands/quality.js +10 -1
  31. package/dist/commands/reembed.js +141 -17
  32. package/dist/commands/relationship.js +2 -1
  33. package/dist/commands/rem.js +56 -18
  34. package/dist/commands/restore.js +101 -61
  35. package/dist/commands/search.js +6 -4
  36. package/dist/commands/service.js +151 -38
  37. package/dist/commands/soul.js +4 -3
  38. package/dist/commands/status.js +43 -5
  39. package/dist/commands/test.js +3 -2
  40. package/dist/commands/upgrade.js +24 -1
  41. package/dist/commands/workspace.js +6 -3
  42. package/dist/component-env.js +31 -41
  43. package/dist/deploy.js +77 -1
  44. package/dist/doctor-client.js +529 -92
  45. package/dist/engine-version-contract.js +1 -0
  46. package/dist/engine-version.js +23 -3
  47. package/dist/federation-verify.js +4 -3
  48. package/dist/hook-install.js +670 -6
  49. package/dist/keystore.js +72 -0
  50. package/dist/lib/action-recall-runtime.js +328 -0
  51. package/dist/lib/agent-home-fields.js +132 -0
  52. package/dist/lib/agent-home.js +427 -0
  53. package/dist/lib/agent-id-rule.js +46 -0
  54. package/dist/lib/agent-roster.js +33 -0
  55. package/dist/lib/auth-resolve.js +49 -16
  56. package/dist/lib/capture-runtime.js +124 -0
  57. package/dist/lib/credential-status-rule.js +78 -0
  58. package/dist/lib/daemon-liveness.js +81 -8
  59. package/dist/lib/doctor-run.js +140 -35
  60. package/dist/lib/durability-copy.js +10 -0
  61. package/dist/lib/embedding-space-doctor.js +75 -0
  62. package/dist/lib/flair-agent-role.js +120 -0
  63. package/dist/lib/hub-url.js +12 -0
  64. package/dist/lib/init-admin-pass.js +88 -12
  65. package/dist/lib/init-listener-environ.js +1 -2
  66. package/dist/lib/init-occupied-listener.js +15 -111
  67. package/dist/lib/init-spawn-attribution.js +73 -0
  68. package/dist/lib/init-tcp-probe.js +33 -0
  69. package/dist/lib/instance-identity-row.js +20 -0
  70. package/dist/lib/launchd-management.js +27 -2
  71. package/dist/lib/listener-table.js +268 -0
  72. package/dist/lib/local-delete-instance.js +27 -0
  73. package/dist/lib/local-instance-pair.js +256 -0
  74. package/dist/lib/mcp-enable.js +1775 -338
  75. package/dist/lib/mcp-oauth-env-core.js +133 -0
  76. package/dist/lib/mcp-oauth-env.js +125 -0
  77. package/dist/lib/mcp-spec.js +17 -1
  78. package/dist/lib/memory-attributes.js +2 -0
  79. package/dist/lib/memory-id-policy.js +46 -0
  80. package/dist/lib/memory-integrity.js +309 -0
  81. package/dist/lib/memory-purge-response.js +20 -0
  82. package/dist/lib/ops-table-count.js +25 -0
  83. package/dist/lib/owned-pins.js +67 -10
  84. package/dist/lib/peer-status.js +27 -0
  85. package/dist/lib/principal-status.js +29 -0
  86. package/dist/lib/process-start-time.js +103 -7
  87. package/dist/lib/proto-safe-record.js +42 -0
  88. package/dist/lib/record-id-path.js +25 -0
  89. package/dist/lib/reembed-server-support.js +66 -0
  90. package/dist/lib/restore-verify.js +104 -0
  91. package/dist/lib/scheduler-platform.js +10 -6
  92. package/dist/lib/secret-keys.js +25 -0
  93. package/dist/lib/secrets-push.js +50 -22
  94. package/dist/lib/skill-seed-pending.js +24 -0
  95. package/dist/lib/skill-seed.js +365 -0
  96. package/dist/lib/stop-start-recovery.js +54 -0
  97. package/dist/lib/using-flair-skill.js +87 -0
  98. package/dist/mcp-client-assertion.js +112 -4
  99. package/dist/memory-id-checkpoint.js +326 -0
  100. package/dist/memory-node-compare.js +207 -0
  101. package/dist/packages/flair-mcp/src/secret-redaction.js +113 -0
  102. package/dist/rem/restore.js +6 -5
  103. package/dist/rem/runner.js +103 -44
  104. package/dist/resources/Agent.js +348 -8
  105. package/dist/resources/AgentKeyRegister.js +214 -0
  106. package/dist/resources/AgentKeyRegistration.js +28 -0
  107. package/dist/resources/AgentSeed.js +19 -4
  108. package/dist/resources/AutoPromoteCandidates.js +7 -1
  109. package/dist/resources/Credential.js +177 -2
  110. package/dist/resources/Federation.js +752 -132
  111. package/dist/resources/FederationRetry.js +140 -0
  112. package/dist/resources/InstructionVersion.js +220 -0
  113. package/dist/resources/Integration.js +300 -25
  114. package/dist/resources/Memory.js +2113 -604
  115. package/dist/resources/MemoryArchive.js +75 -42
  116. package/dist/resources/MemoryBootstrap.js +227 -64
  117. package/dist/resources/MemoryCandidate.js +21 -1
  118. package/dist/resources/MemoryDedupStats.js +30 -1
  119. package/dist/resources/MemoryFeed.js +327 -45
  120. package/dist/resources/MemoryGrant.js +21 -1
  121. package/dist/resources/MemoryMaintenance.js +129 -25
  122. package/dist/resources/MemoryPurge.js +232 -0
  123. package/dist/resources/MemoryReflect.js +7 -2
  124. package/dist/resources/MemoryReindex.js +24 -8
  125. package/dist/resources/Message.js +5 -3
  126. package/dist/resources/OAuth.js +186 -9
  127. package/dist/resources/OrgEvent.js +126 -3
  128. package/dist/resources/OrgSkillAssignment.js +209 -0
  129. package/dist/resources/Presence.js +144 -49
  130. package/dist/resources/PromoteMemoryCandidate.js +18 -7
  131. package/dist/resources/Relationship.js +23 -0
  132. package/dist/resources/SemanticSearch.js +63 -32
  133. package/dist/resources/Soul.js +189 -76
  134. package/dist/resources/TeamDirectory.js +35 -0
  135. package/dist/resources/WorkspaceState.js +21 -1
  136. package/dist/resources/XAA.js +212 -65
  137. package/dist/resources/agent-auth.js +40 -15
  138. package/dist/resources/agent-status-guard.js +63 -0
  139. package/dist/resources/auth-middleware.js +402 -162
  140. package/dist/resources/ed25519-auth.js +1 -1
  141. package/dist/resources/embedding-space-guard.js +366 -72
  142. package/dist/resources/engine-version-stamp-boot.js +53 -0
  143. package/dist/resources/federation-classify.js +94 -0
  144. package/dist/resources/federation-crypto.js +5 -5
  145. package/dist/resources/federation-retry-lib.js +135 -0
  146. package/dist/resources/flair-agent-role-boot.js +26 -0
  147. package/dist/resources/grant-visibility.js +135 -0
  148. package/dist/resources/harper-routing.js +83 -0
  149. package/dist/resources/health.js +130 -20
  150. package/dist/resources/host-source-citation.js +49 -0
  151. package/dist/resources/host-source-visibility.js +7 -6
  152. package/dist/resources/instance-create-lock.js +17 -0
  153. package/dist/resources/instance-identity.js +23 -0
  154. package/dist/resources/instruction-version-record.js +343 -0
  155. package/dist/resources/key-lock.js +31 -0
  156. package/dist/resources/mcp-handler.js +36 -8
  157. package/dist/resources/mcp-oauth-env-guard.js +36 -0
  158. package/dist/resources/mcp-oauth.js +26 -12
  159. package/dist/resources/mcp-tool-arguments.js +4 -6
  160. package/dist/resources/mcp-tools.js +150 -23
  161. package/dist/resources/memory-bootstrap-lib.js +5 -15
  162. package/dist/resources/memory-declared-attributes.js +3 -1
  163. package/dist/resources/memory-deletion-history.js +55 -0
  164. package/dist/resources/memory-durability.js +54 -0
  165. package/dist/resources/memory-embed-hash.js +88 -0
  166. package/dist/resources/memory-embedding-value.js +8 -0
  167. package/dist/resources/memory-host-source.js +27 -5
  168. package/dist/resources/memory-id-guard.js +75 -0
  169. package/dist/resources/memory-redaction.js +236 -0
  170. package/dist/resources/memory-supplied-vector.js +72 -0
  171. package/dist/resources/memory-write-lock.js +310 -0
  172. package/dist/resources/memory-write-response.js +139 -0
  173. package/dist/resources/migrations/data-dir.js +74 -16
  174. package/dist/resources/migrations/dir-safety.js +1 -1
  175. package/dist/resources/migrations/embedding-stamp.js +193 -79
  176. package/dist/resources/migrations/export.js +1 -0
  177. package/dist/resources/migrations/graph-heal.js +18 -25
  178. package/dist/resources/migrations/lock.js +7 -1
  179. package/dist/resources/migrations/snapshot.js +1 -0
  180. package/dist/resources/migrations/source-fields.js +5 -5
  181. package/dist/resources/migrations/synthetic-test-migration.js +14 -11
  182. package/dist/resources/migrations/visibility-backfill.js +29 -29
  183. package/dist/resources/multi-worker-guard.js +121 -0
  184. package/dist/resources/oauth-discovery.js +1 -0
  185. package/dist/resources/oauth-wellknown.js +8 -4
  186. package/dist/resources/object-body-guard.js +33 -0
  187. package/dist/resources/org-event-created-at.js +133 -0
  188. package/dist/resources/originator-instance.js +39 -7
  189. package/dist/resources/owner-delete-recheck.js +78 -0
  190. package/dist/resources/owner-field-guard.js +39 -5
  191. package/dist/resources/owner-scoped-write-policy.js +212 -0
  192. package/dist/resources/owner-scoped-writes.js +58 -0
  193. package/dist/resources/presence-receipt.js +236 -0
  194. package/dist/resources/promotion-stamp.js +47 -12
  195. package/dist/resources/record-owner-guard.js +74 -26
  196. package/dist/resources/record-types.js +17 -1
  197. package/dist/resources/relay-ops.js +78 -6
  198. package/dist/resources/replay-store.js +145 -21
  199. package/dist/resources/request-target.js +136 -0
  200. package/dist/resources/request-transaction.js +35 -0
  201. package/dist/resources/search-readiness.js +4 -1
  202. package/dist/resources/seed-ids.js +9 -0
  203. package/dist/resources/seed-reservation.js +117 -0
  204. package/dist/resources/semantic-retrieval-core.js +20 -9
  205. package/dist/resources/skill-manifest.js +190 -0
  206. package/dist/resources/skill-provenance.js +15 -10
  207. package/dist/resources/skill-subject.js +53 -0
  208. package/dist/resources/skill-version-write.js +432 -0
  209. package/dist/resources/skill-write-fault.js +17 -0
  210. package/dist/resources/skill-write-policy.js +67 -0
  211. package/dist/resources/skill-write.js +67 -7
  212. package/dist/resources/table-helpers.js +10 -7
  213. package/dist/resources/team-directory.js +248 -0
  214. package/dist/resources/tool-descriptors/index.js +69 -8
  215. package/dist/resources/txn-pause-point.js +118 -0
  216. package/dist/resources/usage-recording.js +171 -63
  217. package/dist/resources/write-back.js +218 -0
  218. package/dist/src/engine-version-contract.js +1 -0
  219. package/dist/src/keystore.js +72 -0
  220. package/dist/src/lib/agent-home-fields.js +132 -0
  221. package/dist/src/lib/agent-id-rule.js +46 -0
  222. package/dist/src/lib/agent-key-register.js +80 -0
  223. package/dist/src/lib/atomic-write.js +256 -0
  224. package/dist/src/lib/credential-status-rule.js +78 -0
  225. package/dist/src/lib/expired-by-agent.js +37 -0
  226. package/dist/src/lib/flair-agent-role.js +120 -0
  227. package/dist/src/lib/idp-mapping-rule.js +81 -0
  228. package/dist/src/lib/instance-identity-row.js +20 -0
  229. package/dist/src/lib/mcp-oauth-env-core.js +133 -0
  230. package/dist/src/lib/memory-attributes.js +2 -0
  231. package/dist/src/lib/memory-id-policy.js +46 -0
  232. package/dist/src/lib/principal-status.js +29 -0
  233. package/dist/src/lib/proto-safe-record.js +42 -0
  234. package/dist/src/lib/reembed-server-support.js +66 -0
  235. package/dist/src/lib/scheduler-platform.js +10 -6
  236. package/dist/src/lib/systemd-agent-id.js +38 -0
  237. package/docs/access-control.md +768 -0
  238. package/docs/api-reference.md +52 -13
  239. package/docs/auth.md +10 -12
  240. package/docs/bridges.md +11 -0
  241. package/docs/claude-code.md +34 -4
  242. package/docs/deepseek-harness.md +1 -1
  243. package/docs/deploying-on-fabric.md +70 -0
  244. package/docs/deployment.md +2 -0
  245. package/docs/embedding-in-a-harper-app.md +1 -1
  246. package/docs/federation.md +33 -2
  247. package/docs/hosted-on-fabric.md +43 -36
  248. package/docs/integrations.md +6 -6
  249. package/docs/mcp-clients.md +10 -5
  250. package/docs/n8n.md +17 -11
  251. package/docs/notes/mcp-agent-auth-consumer.md +12 -4
  252. package/docs/notes/mcp-oauth-model2.md +34 -5
  253. package/docs/quickstart-fabric.md +2 -2
  254. package/docs/quickstart.md +9 -1
  255. package/docs/releasing.md +34 -28
  256. package/docs/rem.md +8 -0
  257. package/docs/secrets-and-keys.md +19 -2
  258. package/docs/standalone-local.md +1 -0
  259. package/docs/supply-chain-policy.md +13 -3
  260. package/docs/upgrade.md +32 -6
  261. package/package.json +12 -6
  262. package/schemas/agent-key-registration.graphql +22 -0
  263. package/schemas/agent.graphql +3 -0
  264. package/schemas/federation.graphql +38 -1
  265. package/schemas/memory.graphql +115 -5
  266. package/schemas/oauth.graphql +27 -4
  267. package/schemas/schema.graphql +2 -0
  268. package/templates/launchd/start-flair-with-admin-pass.sh +89 -16
@@ -41,11 +41,11 @@ flair init --target https://<cluster>.<org>.harperfabric.com \
41
41
  - `--remote` marks it a federation **hub** and creates the `flair_pair_initiator` role; without it, pairing later fails role-not-found.
42
42
  - Generated admin password lands in `~/.tps/secrets/flair-fabric-hdb` (mode `0600`); `--flair-admin-pass` to choose your own.
43
43
 
44
- ### Port derivation trap
44
+ ### Operations endpoint
45
45
 
46
- Locally, Flair serves data on `19926` and the ops API on `19925`. The CLI derives **ops = data − 1** everywhere. A managed endpoint is HTTPS on 443 with no port, so derivation produces `:442` — where nothing answers.
46
+ Portless HTTPS targets derive the ops endpoint at `:9925`. <!-- docs-freshness-allow: Fabric ops API port (FABRIC_OPS_PORT), not legacy data port -->
47
47
 
48
- **Pass `--ops-target <url>` explicitly** (or set `FLAIR_OPS_TARGET`) on any command that touches the ops API: `init --target`, `agent add --target`, `federation token --target`.
48
+ Set `FLAIR_OPS_TARGET` to override the derived endpoint, including for `flair backup`.
49
49
 
50
50
  ---
51
51
 
@@ -59,56 +59,63 @@ On Fabric, configuration goes through the component's environment, not a local `
59
59
  | `HDB_ADMIN_PASSWORD` | Bootstrap password for the embedded Harper. | Set at install time. |
60
60
  | `FLAIR_KEY_PASSPHRASE` | Passphrase for federation key encryption. | Set for production federation deployments. |
61
61
 
62
- On Fabric / managed deploys, environment variables are provisioned through Harper's Fabric secrets mechanism (encrypted at rest with `enc:v1:` storage format).
62
+ On Fabric / managed deploys, Harper's secrets mechanism can provision environment variables (encrypted at rest with `enc:v1:` storage format). `flair mcp enable` uses a staged-file fallback when the push is unavailable or fails.
63
63
 
64
64
  ### How `flair mcp enable` delivers its secrets
65
65
 
66
- `flair mcp enable` needs five variables live in the target's process before it restarts — including `FLAIR_MCP_OAUTH` and the RS256 signing key, both read from `process.env` only and therefore impossible to deliver via `set_configuration`.
66
+ `flair mcp enable` provisions five variables for the target's process, including `FLAIR_MCP_OAUTH`, which is read from `process.env` only, so `set_configuration` cannot deliver it.
67
+
68
+ Use `--fabric` for a non-loopback custom-domain Fabric target.
67
69
 
68
70
  It asks the target what it can do, rather than assuming from the hostname or the version:
69
71
 
70
72
  | The target… | What happens |
71
73
  |-------------|--------------|
72
- | supports Harper's env-secrets operations | the five vars are **sealed locally** and pushed over the ops API. No manual step, no re-run. |
73
- | does not have them (Harper older than 5.2) | the vars are staged to a `0600` file and you apply them yourself, then re-run with `--confirm-secrets-applied` |
74
+ | returns a usable env-secrets public key | `enable` attempts a sealed push over the ops API. If the push fails, it reports a staged-file fallback. After confirmation, an already active surface can pass without a restart or re-run; restart if this run changed a secret value. If the surface is inactive, restart the Fabric target after a successful push, or apply the staged values and restart, then re-run with `--confirm-secrets-applied`. |
75
+ | reports no env-secrets public-key operation | the vars are staged to a `0600` file and you apply them yourself, then re-run with `--confirm-secrets-applied` |
74
76
  | is unreachable, refuses the probe, or answers unusably | same staged-file fallback, and the output says **which** of those happened |
75
77
 
76
- Values are encrypted **before leaving your machine** — AES-256-GCM on the value, RSA-OAEP(SHA-256) wrapping the key, addressed to a public key fetched from the target. Plaintext never appears in a request body, and the command's output carries variable *names* only.
78
+ For an automated push, values are encrypted **before leaving your machine** — AES-256-GCM on the value, RSA-OAEP(SHA-256) wrapping the key, addressed to a public key fetched from the target. Plaintext does not appear in the push request body, and the command's output names variables without showing their values.
77
79
 
78
- The staging file is written in every case, so a fallback never strands you mid-run. When the push succeeds it simply goes unused.
80
+ At secrets provisioning, `enable` stages the file before any probe or push; dry runs stop earlier. A successful push leaves it unused.
79
81
 
80
- > **What the probe does not promise.** It establishes that the target accepts secrets, not that it will *decrypt* them — no read-only call can, since a secret only proves it was decrypted by being present in the process. The **self-verify** step at the end is what proves that. Note the endpoint does *not* go quiet when the flag is off — flair serves its own OAuth 2.1 discovery document instead, and self-verify tells them apart by the advertised `token_endpoint` (`/OAuthToken` is flair's own; the MCP one is `/oauth/mcp/token`). So a secret that is stored and never decrypted fails at self-verify with a message naming `FLAIR_MCP_OAUTH`, rather than reporting success.
82
+ > **What the probe does not promise.** When successful, it returns a public key for a possible push; it does not prove the push succeeds or that the target process loads the values. `enable` checks the target's MCP token endpoint and public metadata before reporting success. Flair also serves OAuth metadata when the MCP flag is off: the target check distinguishes Flair's `/OAuthToken` from the MCP `/oauth/mcp/token`. An already active surface can pass these checks before newly pushed values are loaded; restart if this run changed a secret value.
81
83
 
82
84
  `--secrets-mechanism <fabric-env-secrets|env-file>` remains an explicit override and skips the probe entirely.
83
85
 
84
86
  ### The `mcp.enabled` operator step (Fabric)
85
87
 
86
- MCP is **off by default**. The shipped component `config.yaml` contains
87
- `@harperfast/oauth` → `mcp` → `enabled: false`. Until [flair#1152](https://github.com/tpsdev-ai/flair/issues/1152)
88
- lands (interpolate from env — *ON HOLD*), you must flip this manually:
89
-
90
- 1. In your deployed component's `config.yaml`, change:
91
- ```yaml
92
- '@harperfast/oauth':
93
- mcp:
94
- enabled: true # was: false
95
- ```
96
- 2. Re-deploy the component so Harper picks up the new value.
97
- 3. **Verify the `/mcp` surface is actually serving** (the flag alone does not
98
- guarantee it — a secret that is stored but never decrypted fails at self-verify):
99
- ```bash
100
- # Check /mcp is reachable and returning MCP protocol (not a loopback proxy or 404)
101
- curl -sf https://<cluster>.<org>.harperfabric.com/mcp
102
- # Should return MCP JSON-RPC content; if you get HTML redirect or 404 the flag
103
- # is not effective
104
- ```
105
-
106
- **⚠ SECURITY CAVEAT — the upgrade-reverts trap.** Any package update or fleet component
107
- update re-ships the literal `enabled: false` and silently darkens a live `/mcp` surface.
108
- You must **re-flip to `true` after every upgrade** and re-deploy. An updated component
109
- without this re-flip will appear healthy (`/Health` green) while its MCP tools are
110
- dark to every connected client. If you rely on MCP, add the re-flip to your upgrade
111
- runbook.
88
+ MCP is **off by default**. The shipped component `config.yaml` contains the `@harperfast/oauth` block
89
+ uncommented with `mcp.enabled: ${FLAIR_MCP_OAUTH}`, a whole-token environment reference
90
+ ([flair#1152](https://github.com/tpsdev-ai/flair/issues/1152)), so the on/off choice lives in the
91
+ instance's environment and a re-packed deploy cannot revert it. There is no `config.yaml` edit and no
92
+ re-deploy to make.
93
+
94
+ For **`*.harperfabric.com` targets** or non-loopback custom-domain targets selected with `--fabric`, `flair mcp enable` does not restart the instance. It provisions the secrets, then checks the MCP
95
+ surface in this order:
96
+
97
+ 1. **Target/issuer binding.** The target's *own* metadata at
98
+ `<instance-url>/.well-known/oauth-authorization-server` must name the verified issuer and advertise
99
+ the MCP token endpoint `/oauth/mcp/token`. A mismatch refuses the run.
100
+ 2. **Public-origin self-verify.** Metadata at the same path is fetched from the public issuer. The check
101
+ requires a matching issuer, the issuer's `/oauth/mcp/token` endpoint, and advertised
102
+ CIMD support. `flair mcp status`
103
+ uses this check.
104
+
105
+ Then one of:
106
+
107
+ - **Self-verify passes.** The run prints the paste block. If this run changed a secret value, restart the
108
+ instance so its process picks the new value up.
109
+ - **It answers but does not pass** (HTTP 404, flair's own authorization server, or CIMD not advertised).
110
+ The step fails, reports the metadata problem, and gives generic apply-or-restart advice. Re-run
111
+ `flair mcp enable` with the same options plus `--confirm-secrets-applied`.
112
+ - **The request fails** (DNS, connection, TLS, timeout). The step fails and says the public issuer could
113
+ not be reached, quoting the URL and the error. It gives no activation instruction; it asks you to check
114
+ that the host resolves, that this machine can reach it over HTTPS, and that the instance is running in
115
+ Fabric — then re-run with `--confirm-secrets-applied`.
116
+
117
+ After applying the secrets and restarting, re-run with `--confirm-secrets-applied`. The run passes only if
118
+ the target's issuer and MCP token endpoint match, and the public metadata and CIMD checks pass.
112
119
 
113
120
  ---
114
121
 
@@ -1,8 +1,8 @@
1
1
  # Flair integrations
2
2
 
3
- Where Flair already runs. Each integration can reach one shared Flair memory store; signed requests identify an agent, while other verified agents may read its non-private records, and n8n uses admin Basic auth.
3
+ Where Flair already runs. Each integration can reach one shared Flair memory store; signed requests identify an agent, while other verified agents may read its non-private records.
4
4
 
5
- > **The point.** Memory can follow an agent across orchestrators. Integrations using an ordinary Ed25519 agent key can write under that identity and read their own plus other agents' non-private records. Administrator agent roles have broader authority. n8n uses Harper administrator Basic auth; stdio MCP, Pi, LangGraph, and the wake runner can also use it when no signing key resolves. Administrator Basic auth can read private records and write under any agent ID. Choose an integration with its authentication and recall behavior in mind.
5
+ > **The point.** Memory can follow an agent across orchestrators. Integrations using an ordinary Ed25519 agent key can write under that identity and read their own plus other agents' non-private records. Administrator agent roles have broader authority. n8n signs with Agent Private Key selected; its deprecated Admin Password path uses administrator Basic only with an empty key. stdio MCP, Pi, LangGraph, and the wake runner can use administrator Basic auth when no signing key resolves. Administrator Basic auth can read private records and write under any agent ID. Choose an integration with its authentication and recall behavior in mind.
6
6
 
7
7
  ---
8
8
 
@@ -20,7 +20,7 @@ Where Flair already runs. Each integration can reach one shared Flair memory sto
20
20
  | **DeepSeek Harness** (`dsh`) | [`flair-mcp`](deepseek-harness.md) | Cordis overlay | First-party MCP bridge; tools-only, reactive recall — [dedicated page](deepseek-harness.md) |
21
21
  | **LangGraph (TS)** | [`langgraph-flair`](#langgraph-typescript) | FlairClient | FlairStore provides get, put, delete, search, and batch (limitations apply) |
22
22
  | **OpenClaw** | [`openclaw-flair`](#openclaw) | Ed25519 | Native plugin (context-engine slot left intact) |
23
- | **n8n** | [`n8n-nodes-flair`](#n8n) | FlairApi credential | Three nodes (chat memory, search, store) |
23
+ | **n8n** | [`n8n-nodes-flair`](#n8n) | Ed25519 with Agent Private Key selected; deprecated administrator Basic | Three nodes (chat memory, search, store) |
24
24
  | **Hermes Agent** | [`hermes-flair`](#hermes-agent) | Ed25519 | Python `MemoryProvider` |
25
25
  | **Pi agent** | [`pi-flair`](#pi-agent) | Ed25519 | Native pi extension (pi has no MCP support); with `--agent <id>` and wiring enabled, `flair init` attempts Pi wiring for `--client pi`, for detected Pi under `--client all`, or for detected Pi when `--client` is omitted; `--client none` and `--no-mcp` skip it. |
26
26
  | **Google ADK** (Python) | [`adk-flair`](../packages/adk-flair/README.md) | Ed25519 | `BaseMemoryService`; see [hosted auth](#hosted-flair-auth--your-agent-got-a-404) if you just got a 404 |
@@ -57,7 +57,7 @@ Do not "fix" a 401 or 404 by pasting the Harper admin password into the agent's
57
57
  | Shape | What is true | What you see | What to do |
58
58
  |---|---|---|---|
59
59
  | **Record missing** | No `Agent` row for this id on **this** instance | `401 {"error":"unknown_agent"}` on every signed route | Register against the hosted URL: `flair agent add <id> --target "$FLAIR_URL" --ops-target <ops-url> --admin-pass-file <path>`. Fabric ops is not `data-port − 1` — see [quickstart-fabric.md](quickstart-fabric.md). |
60
- | **Key mismatch** | The id exists; the public key on the server is not the one in your keyfile | `401 {"error":"invalid_signature"}` | Same id, wrong key — copied from another host, rotated on one side only, or the env pointing at a different agent's file. Point the env at the key that matches **this** instance, or re-seed the hosted `Agent` row from the key on this machine: `flair agent add <id> --target "$FLAIR_URL" --ops-target <ops-url> --admin-pass-file <path>` (reuses the local keyfile). `flair agent rotate-key` is localhost-only. Restart the adapter so it reloads the key. |
60
+ | **Key mismatch** | The id exists; the public key on the server is not the one in your keyfile | `401 {"error":"invalid_signature"}` | Same id, wrong key — copied from another host, rotated on one side only, or the env pointing at a different agent's file. Point the env at the key that matches **this** instance. `flair agent add` refuses an id that already exists and does not replace the stored key. On the Flair host, `flair agent rotate-key <id>` replaces the stored public key and writes the new private key on that host (it is localhost-only). The new key file must be on the adapter host before that process can sign with it. Configure that signing process to use the local file, then restart it. |
61
61
  | **Config wrong** | Identity may be fine; you are not talking to the Flair you think | Timeouts, connection errors, or **404 from Harper's catch-all** | `FLAIR_URL` must be the origin the **signing process** can open (cloud-agent localhost is the VM, not your laptop). adk-flair also needs `FLAIR_ALLOW_REMOTE_URL=1` and a raised `FLAIR_HTTP_TIMEOUT` (defaults are localhost fail-fast). A `FLAIR_URL` with a path prefix sends every request to a route that does not exist. `/Health` can be 200 while `/Memory` is still 404 if the Flair app is not loaded yet. |
62
62
 
63
63
  Clock skew is a fourth, rarer 401: `timestamp_out_of_window`.
@@ -83,7 +83,7 @@ A verified agent that is not allowed the row gets 404, never 403. Anonymous by-i
83
83
  | **Pi** | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` or Pi client `keyPath` | Same Ed25519 model |
84
84
  | **LangGraph** | `FLAIR_URL` | `config.agentId` (required) | Signed requests use `config.privateKey`, `config.keyPath`, or automatic key candidates (`FLAIR_KEY_DIR`, then standard paths); it does not read `FLAIR_KEY_PATH`. | Admin credentials provide a Basic-auth fallback when no key is available. |
85
85
 
86
- n8n still uses Harper admin Basic auth — it is not this path. See [n8n.md](n8n.md#security).
86
+ n8n signs as its credential's Agent ID with Agent Private Key selected. See [n8n.md](n8n.md#3-create-the-credential).
87
87
 
88
88
  ---
89
89
 
@@ -201,7 +201,7 @@ Configuration via OpenClaw's standard plugin surface. See [`docs/openclaw.md`](o
201
201
 
202
202
  The FlairApi credential provides authentication.
203
203
 
204
- **FlairApi credential** — Harper administrator password for Basic authentication; Agent ID selects memory ownership and does not restrict the credential's instance-wide authority.
204
+ **FlairApi credential** — with Agent Private Key selected, requests sign as Agent ID. Ordinary agents read their own and other agents' non-private memories. The deprecated Admin Password path uses Harper administrator Basic authentication only with an empty Agent Private Key, and warns on each node execution.
205
205
 
206
206
  Install via the standard n8n community-node UI (Settings → Community nodes → `@tpsdev-ai/n8n-nodes-flair`) or:
207
207
 
@@ -33,9 +33,9 @@ The snippets below are the **local** path. Flair also has a native `/mcp` endpoi
33
33
  | MCP client on this machine (Claude Code, Cursor, Codex, Gemini, and the snippets below) | `npx -y @tpsdev-ai/flair-mcp@<version>` stdio adapter | Ed25519 over HTTP to the instance |
34
34
  | Remote MCP client that must dial a public HTTPS origin | Native `/mcp` on the instance | OAuth bearer. Unmounted until `FLAIR_MCP_OAUTH=true` and a public issuer are set (otherwise the path 404s). |
35
35
 
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.
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` accepts loopback or unspecified targets for the local restart but refuses local issuers. 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.
37
37
 
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).
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). Who can connect through native `/mcp`, and how to revoke access, is in [access-control.md](access-control.md).
39
39
 
40
40
  ---
41
41
 
@@ -291,7 +291,7 @@ If you see (a) the agent calling the `bootstrap` tool returning soul + recent me
291
291
 
292
292
  ## What the MCP server exposes
293
293
 
294
- Clients on this page talk to the stdio server `@tpsdev-ai/flair-mcp`. Its `tools/list` advertises these sixteen tools, in this order. The embedded HTTP `/mcp` handler is a different set: it also advertises `memory_basement`, `memory_restore`, and `attention`, and it does not advertise `relationship_store` or `flair_catchup`.
294
+ Clients on this page talk to the stdio server `@tpsdev-ai/flair-mcp`. Its `tools/list` advertises these seventeen tools, in this order. The embedded HTTP `/mcp` handler is a different set: it also advertises `memory_basement`, `memory_restore`, and `attention`, and it does not advertise `relationship_store` or `flair_catchup`.
295
295
 
296
296
  | Tool | What it does |
297
297
  |---|---|
@@ -310,6 +310,7 @@ Clients on this page talk to the stdio server `@tpsdev-ai/flair-mcp`. Its `tools
310
310
  | `flair_workspace_set` | Set this agent's workspace state (ref, label, provider, task, phase, summary) in the Office Space |
311
311
  | `flair_orgevent` | Publish an org-wide coordination event (claim, release, or status), attributed to the caller |
312
312
  | `flair_catchup` | Drain this agent's own org-event catch-up feed. Page with `after`; advance the watermark with `ack` |
313
+ | `team_directory` | List active agents with published tps-mail contacts. Filter by `id` or `name`; page with `cursor`/`limit` |
313
314
  | `record_usage` | Report that recalled memories were actually used (`memoryId` or `memoryIds`, plus optional `attribution`). Drives `usageCount` / `usageBoost` |
314
315
 
315
316
  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)).
@@ -322,7 +323,11 @@ The following structured-payload details describe the HTTP bootstrap response an
322
323
 
323
324
  `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.
324
325
 
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.
326
+ **The structured containers carry no host-source pointer (flair#2448).** A `memories` or `predicted` entry omits `hostSource`. A visible, bound pointer appears in the bootstrap PROSE only when `includeContext` is true, for an authenticated non-admin caller; the admin bootstrap prose is uncited. A non-admin structured consumer that needs the pointer reads the memory back through the gated Memory read — `memory_get` by id — which renders the pointer that caller may see. An admin `memory_get` takes no pointer join, so it does not render the pointer either.
327
+
328
+ **Skill assignments are reported in `skills` and `skillDiagnostics` (flair#2141).** A `skills` entry is `{ name, skillId, scope, priority, source }` for an assigned skill that won priority resolution; a `skillDiagnostics` entry is a refused, superseded, unresolved or ambiguous assignment with its `decision` and `reason`. Both arrays are present whatever `includeSoul` and `includeContext` say, and hold the entries admitted within the remaining token budget; `skillsTruncated` and `skillDiagnosticsTruncated` count the entries that did not fit. An entry names the skill and does not carry its procedure: fetch that with `skill_get` and the `skillId`, or over REST with a signed `GET /Memory/<skillId>`, which applies the same by-id read gate as `skill_get`. A name-only assignment that wins priority resolution resolves when the agent has exactly one live skill row of its own with that name (not archived, past `validTo` or past `expiresAt`); with none it is `unresolved`, with more than one `ambiguous`. An `OrgSkillAssignment` row is also a candidate when the target's Agent record has `kind` agent and `status` active (absent counts as agent and active); humans, deactivated principals and targets with no Agent record get no org candidates. A Soul `skill-assignment` row with `metadata.optOut: true` removes the org candidates with that name for that agent before priority resolution, when this instance's id can be read and the row's `originatorInstanceId` equals it. An org `skills` entry has `scope: "org"` and its `skillId` is the row's `skillRef`; an org assignment that wins priority resolution with a `skillRef` that is not a live skill row the agent can read is `unresolved`. The `name` and `source` strings come from Soul `skill-assignment` rows, and an org entry's `name` from its `OrgSkillAssignment` row; they reach the agent without SkillScan; that is safe only because no agent key can write those rows (admin agent keys included); only operator credentials and Flair's own internal paths can, so widening who may write them changes what reaches the agent's context.
329
+
330
+ **The token ledger reconciles `tokenEstimate` from the payload alone (flair#1270).** Every token-charged content class carries a counter — `soulTokens`, `memoryTokens`, `trustTokens`, `eventsTokens`, `skillsTokens`, `skillDiagnosticsTokens` — plus a measured `scaffoldTokens` for the fixed JSON frame, and `tokenEstimate ≈ scaffoldTokens + soulTokens + memoryTokens + trustTokens + eventsTokens + skillsTokens + skillDiagnosticsTokens`. At the `/mcp` default (`includeContext: false`) 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; with `includeContext: true` the prose `context` mirror widens it and no upper bound applies. A payload whose estimate an agent can't decompose from the reported figures is a bug, not an accounting convention.
326
331
 
327
332
  **Empty containers say why they're empty (flair#1182).** When a structured container ships empty, the payload carries a short hint naming the reason and what fills it — `eventsHint`, `teammateFindingsHint`, `predictedHint`. This is present *only* when the container is empty, so a deliberately-empty container is never confused with a silent drop (a connector never has to diff against a previous payload to tell the two apart).
328
333
 
@@ -374,7 +379,7 @@ Future MCP-capable agent CLIs (and there are more landing every month) will work
374
379
 
375
380
  **"connection_error: could not reach Flair at http://127.0.0.1:19926".** The Flair server isn't running. Run `flair status` to check; `flair start` to bring it up.
376
381
 
377
- **"auth_error: …" on every call.** The agent identity doesn't match a registered key. Re-run `flair agent add <id>` (idempotent on re-add — won't lose existing memories). Against a hosted instance the same three shapes apply (record missing / key mismatch / config wrong), and a by-id 404 is fail-closed ownership, not an existence signal — [Hosted Flair auth](integrations.md#hosted-flair-auth--your-agent-got-a-404).
382
+ **"auth_error: …" on every call.** Read the reported cause. For `unknown_agent`, no Agent row exists: run `flair agent add <id>`. For `invalid_signature`, the signature did not verify against the stored public key. Check the signing key and the signed request first. For a confirmed key mismatch, `agent add` refuses a well-formed existing row. On the Flair host, `flair agent rotate-key <id>` writes a new private key on that host. That file must be on the client host before the MCP process can sign with it. `FLAIR_KEY_PATH` only names a path on the signing host; point it at that local file when the key is not in the default location, then restart the MCP process. `flair agent remove <id>` and then add again is the other path for a well-formed row. `flair agent remove` tries to delete that agent's Memory and Soul rows. Other auth errors follow the cause they name. A by-id 404 is fail-closed ownership, not an existence signal — [Hosted Flair auth](integrations.md#hosted-flair-auth--your-agent-got-a-404).
378
383
 
379
384
  **Tool calls succeed but the agent doesn't see results in subsequent turns.** Check that the CLI is actually invoking `bootstrap` at session start — most CLIs need an explicit prompt nudge ("call the bootstrap tool now") on first use. Subsequent turns should pick up automatically once the CLI sees the schema.
380
385
 
package/docs/n8n.md CHANGED
@@ -13,7 +13,7 @@ Flair is the right pick when you want:
13
13
  | **Shape** | Tagged + typed memories with semantic search, plus chat-buffer compatibility | Conversation-buffer only (LangChain `BaseMessage` records) |
14
14
  | **Cross-orchestrator** | Same memory readable from Claude Code, OpenClaw, n8n | n8n-internal schema; nothing else reads it |
15
15
  | **Cross-instance** | Hub-spoke federation built-in (local ↔ Fabric, etc.) | Single-instance unless you self-build replication |
16
- | **Identity** | Ed25519 per-agent (planned) or admin-token (v1) | n8n credential per workflow |
16
+ | **Identity** | Ed25519 with Agent Private Key selected; the v1 admin password is still accepted, deprecated | n8n credential per workflow |
17
17
 
18
18
  If your AI Agent only needs to remember the last N turns of a single chat in a single n8n instance, Postgres-as-memory is fine. If you want the same memory to inform a Claude Code conversation tomorrow, or to persist across n8n redeploys via federated Flair, this package is the path.
19
19
 
@@ -39,10 +39,20 @@ 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 Agent IDs to organize ownership; the shared admin credential can access the whole instance. |
43
- | **Admin Password** | Your Flair admin password (in `~/.flair/admin-pass` for local installs). **Sensitive** — see [Security](#security). |
42
+ | **Agent ID** | The memory owner and, with Agent Private Key selected, signing identity, e.g. `n8n-support`. Workflows that share an Agent ID share memory ownership. |
43
+ | **Agent Private Key** | That agent's Ed25519 private key. |
44
44
 
45
- Click **Test** — if the test request to `/Memory` returns 200, the credential is good.
45
+ Register a new agent with `flair agent add n8n-support`, or use an existing agent's matching key:
46
+
47
+ ```bash
48
+ base64 < ~/.flair/keys/n8n-support.key
49
+ ```
50
+
51
+ Paste the base64 output into **Agent Private Key**.
52
+
53
+ Click **Test** — it reads `/Memory` using the selected auth mode and reports that mode on success.
54
+
55
+ **Admin Password (deprecated)** — used only with Agent Private Key empty. Requests use Harper administrator Basic authentication, including access to other agents' private memories, and each node execution warns.
46
56
 
47
57
  ### 4. Wire the nodes
48
58
 
@@ -81,15 +91,11 @@ Patterns:
81
91
 
82
92
  ## Security
83
93
 
84
- > **The admin password gives every workflow with this credential read/write access to the entire Flair instance**, not just the configured Agent ID. The blast radius is the whole memory store. Treat the credential as highly sensitive: n8n encrypts credentials at rest, but any n8n admin or backup restore can extract it.
85
-
86
- For production deployments where untrusted workflow inputs reach Flair, wait for **Ed25519 per-agent authentication** (planned). v1 (admin password) is appropriate when:
94
+ With Agent Private Key selected, requests sign as the credential's Agent ID. Ordinary agents write their own memories and read their own plus other agents' non-private memories; administrator-role agents have broader authority.
87
95
 
88
- - The n8n instance is single-tenant and operator-controlled
89
- - Workflow inputs are trusted (your own CRM, your own webhook source)
90
- - Memory leakage between agents is acceptable for the use case
96
+ The deprecated **Admin Password** path uses Harper administrator Basic authentication, with access to other agents' private memories. It is used only while Agent Private Key is empty, and every execution that uses it logs a warning. To migrate, set Agent Private Key (step 3).
91
97
 
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.
98
+ Treat the key as a secret.
93
99
 
94
100
  ## Get By Tag
95
101
 
@@ -37,11 +37,19 @@ header `{alg: "EdDSA", typ: "JWT"}`; claims `iss = sub = client_id`, `aud =
37
37
  token endpoint`, `exp - iat ≤ 60s` (hard-capped, not just defaulted), `iat`,
38
38
  random `jti`. Signed with `node:crypto` alone (no new dependency, matching
39
39
  the plugin's own approach and this repo's existing `flair-client.mjs` /
40
- `buildEd25519Auth` signing style). The claim shape is pinned to what PR #165
40
+ `buildEd25519Auth` signing style). The default claim shape is pinned to what PR #165
41
41
  (`src/lib/mcp/clientAssertion.ts`) verifies, and
42
- `test/unit/mcp-client-credentials-live-package.test.ts` proves assertions
43
- this module signs pass the plugin's **real** `verifyClientAssertion` —
44
- including negative cases (wrong signing key, tampered payload).
42
+ `test/unit/mcp-client-credentials-live-package.test.ts` proves default-form
43
+ assertions this module signs pass the pinned plugin's **real**
44
+ `verifyClientAssertion`; it also checks refusals for the issuer form, wrong
45
+ signing keys, and tampered payloads.
46
+
47
+ The audience form is a transition switch (`FLAIR_MCP_CLIENT_ASSERTION_AUDIENCE`,
48
+ or `flair mcp token --assertion-audience`): the default is the shape above, and
49
+ `issuer` signs `aud` = the authorization server metadata document's `issuer`
50
+ with `typ: "client-authentication+jwt"` — the RFC 7523bis form, for the
51
+ verifier release that accepts it (HarperFast/oauth #245, merged upstream but
52
+ not released).
45
53
 
46
54
  Key loading (`resolveAgentKeyPath` / `loadEd25519PrivateKeyFromFile`) mirrors
47
55
  `src/cli.ts`'s existing `resolveKeyPath` / `buildEd25519Auth` (used by the
@@ -6,7 +6,7 @@
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 17 tools in `resources/mcp-tools.ts`
9
+ handler guarded by `@harperfast/oauth`'s `withMCPAuth`, serving the 18 tools in `resources/mcp-tools.ts`
10
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
@@ -18,10 +18,9 @@ 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 17 tools in `resources/mcp-tools.ts`, each a thin wrapper over the existing resource handler
21
+ - `resources/mcp-tools.ts` — the 18 tools in `resources/mcp-tools.ts`, delegating to resource handlers or the team-directory resolver
22
22
  (Memory / SemanticSearch / BootstrapMemories / Soul / WorkspaceState /
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**.
23
+ OrgEvent / AttentionQuery / RecordUsage / the team-directory resolver).
25
24
  - `resources/mcp-oauth.ts` — registers `server.http(withMCPAuth(mcpHandler),
26
25
  { urlPath: '/mcp' })` **only when `FLAIR_MCP_OAUTH` is on.** `/mcp` runs on its
27
26
  own dispatch chain; flair's default auth-middleware does not run for it.
@@ -130,6 +129,7 @@ registered identities.
130
129
  github:
131
130
  clientId: ${OAUTH_GITHUB_CLIENT_ID}
132
131
  clientSecret: ${OAUTH_GITHUB_CLIENT_SECRET}
132
+ redirectUri: ${OAUTH_GITHUB_REDIRECT_URI} # this instance's public origin + /oauth; the plugin appends '/github/callback'. Since @harperfast/oauth 2.7.0 a CONFIGURED provider needs it (2.8.1 skips an unconfigured one first — HarperFast/oauth#259)
133
133
  mcp:
134
134
  enabled: ${FLAIR_MCP_OAUTH} # whole-token env reference (flair#1152) — the choice lives in the ENVIRONMENT, so a re-packed deploy can't revert it
135
135
  issuer: ${FLAIR_MCP_ISSUER} # pin to your public origin — REQUIRED
@@ -144,7 +144,8 @@ registered identities.
144
144
  allowedHosts: # CIMD is the only supported client-registration path
145
145
  - claude.ai
146
146
  - claude.com
147
- signingKeyPem: ${FLAIR_MCP_SIGNING_KEY_PEM} # pin in clusters
147
+ # signingKeyPem: ${FLAIR_MCP_SIGNING_KEY_PEM} # Optional pin; add this line and stage the variable.
148
+ # Without a pin, minting reuses a persisted key or generates and persists one if the key table is empty.
148
149
  ```
149
150
 
150
151
  **DCR is not supported; clients connect via CIMD (Client ID Metadata
@@ -162,11 +163,39 @@ registered identities.
162
163
  same var accepts only "true"/"false" and deletes anything else, so `1`
163
164
  gives you a guarded `/mcp` with no authorization server behind it).
164
165
  - `FLAIR_MCP_ISSUER=https://your-public-origin` (or `FLAIR_PUBLIC_URL`).
166
+ - `OAUTH_GITHUB_CLIENT_ID`, `OAUTH_GITHUB_CLIENT_SECRET` and
167
+ `OAUTH_GITHUB_REDIRECT_URI=https://your-public-origin/oauth` — staged by
168
+ `flair mcp enable` using `--issuer` (default: `--instance`).
165
169
  - `FLAIR_MCP_JIT_PROVISION=1` — ONLY if you want unknown subjects
166
170
  auto-provisioned (default OFF; pre-provision Agent+Credential otherwise).
167
171
 
168
172
  3. **Restart flair.** `/mcp` mounts, OAuth-guarded.
169
173
 
174
+ 4. **Upgrading an instance that still holds the old staged value.** When the
175
+ component loads `FLAIR_MCP_OAUTH=1`, its MCP AS is disabled. Correct the value without re-running IdP intake
176
+ or changing the identity mapping:
177
+
178
+ `--admin-pass <target-admin-password>` is required.
179
+
180
+ ```bash
181
+ flair mcp enable --instance https://your-public-origin --refresh-flag --admin-pass <target-admin-password>
182
+ ```
183
+
184
+ It ATTEMPTS an encrypted
185
+ `FLAIR_MCP_OAUTH=true` push: it probes for a usable public key, attempts the update,
186
+ and checks the secret row's `processEnv` marker before restart and discovery
187
+ checks: the target's own discovery document must advertise that issuer with
188
+ the MCP token endpoint, and
189
+ the public document read at that issuer must match the same normalized issuer and its token
190
+ endpoint. When the update could not be pushed or confirmed — a failed capability
191
+ probe, a local encryption failure, a refused or unconfirmed push, or
192
+ a push whose read-back could not confirm storage with `processEnv=true` — it attempts a 0600
193
+ one-var fallback file. Refresh uses a separate default filename; an explicit
194
+ `--secrets-path` can select `mcp enable`'s path. An occupied explicit path
195
+ is refused before probing; an occupied default path is refused when the fallback is
196
+ needed — in both cases by name rather than truncated (the writer opens
197
+ exclusively). These fallback outcomes exit non-zero.
198
+
170
199
  ## Sherlock's 4 requirements — how they are met
171
200
 
172
201
  1. **Token lifetime.** `mcp.accessTokenTtl: 900` (5–15 min) in the AS config +
@@ -56,7 +56,7 @@ Then set an admin password in Fabric Studio (Cluster Settings → Admin). `flair
56
56
 
57
57
  `flair agent add` takes a positional id and `--target`. There is no `--remote` flag on this command (`--remote` belongs to `flair init`).
58
58
 
59
- On Fabric, ops lives on the **same hostname at port 9925**, not the CLI's default "data port − 1" derivation (that would be `:442`, where nothing answers). Pass `--ops-target` explicitly: <!-- docs-freshness-allow: Fabric ops API port, not legacy data port -->
59
+ For portless HTTPS, the CLI derives the ops endpoint at `:9925`; `--ops-target` overrides it. <!-- docs-freshness-allow: Fabric ops API port -->
60
60
 
61
61
  ```bash
62
62
  export FLAIR_URL=https://<cluster>.<org>.harperfabric.com
@@ -64,7 +64,7 @@ export FLAIR_URL=https://<cluster>.<org>.harperfabric.com
64
64
  # Keep the Fabric admin password in an owner-only file; the CLI reads it in-process.
65
65
  printf '%s\n' '<fabric-admin-password>' > ~/.flair/fabric-admin-pass && chmod 600 ~/.flair/fabric-admin-pass
66
66
 
67
- # Fabric ops is :9925 on the same host, not derived :442. docs-freshness-allow: Fabric ops API
67
+ # Operations endpoint override. docs-freshness-allow: Fabric ops API
68
68
  flair agent add mybot --target "$FLAIR_URL" --ops-target https://<cluster>.<org>.harperfabric.com:9925 --admin-pass-file ~/.flair/fabric-admin-pass
69
69
  ```
70
70
 
@@ -49,7 +49,7 @@ First run does six things:
49
49
  5. Wires every MCP client it detects — Claude Code, Cursor, Codex CLI, Gemini CLI — to `npx -y @tpsdev-ai/flair-mcp`, then smoke-tests it. `--no-mcp` skips this.
50
50
  6. Opens a short **soul wizard** so your agent knows who it is.
51
51
 
52
- It also generates a Harper admin password and writes it to `~/.flair/admin-pass` (mode 0600). The CLI prints that **path**, never the value — read the file when a command needs the password, and prefer `--admin-pass-file ~/.flair/admin-pass` over pasting it into a command line.
52
+ It also saves the supplied or generated Harper admin password to `~/.flair/admin-pass` (mode 0600). Read the file when a command needs the password, and prefer `--admin-pass-file ~/.flair/admin-pass` over pasting it into a command line.
53
53
 
54
54
  The soul wizard offers a few shapes:
55
55
 
@@ -137,6 +137,14 @@ You didn't ask for that, and it isn't a setting you have to remember. Flair deri
137
137
  | `permanent`, `persistent` | `shared` — a fact or decision worth keeping is worth the team being able to find |
138
138
  | `standard`, `ephemeral` — including a bare write with no `--durability` | `private` — working context and scratch state belong to the agent that produced them |
139
139
 
140
+ Retention, decay and bootstrap ordering by tier:
141
+
142
+ - permanent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it); it never decays; bootstrap considers the bootstrapping agent's own permanent memories before recent rows, subject to scope, expiry/closure and the token budget.
143
+ - persistent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it).
144
+ - standard — routine maintenance archives it once its validTo passes or, as a session note, after 30 days.
145
+ - ephemeral — routine maintenance reaps it once its TTL (24h by default) passes.
146
+ - No tier adds a flush, fsync, backup or replica acknowledgement: an explicit delete (owner or admin) or a store failure can end any of them.
147
+
140
148
  So sharing is a deliberate act, and it takes one flag:
141
149
 
142
150
  ```bash
package/docs/releasing.md CHANGED
@@ -15,13 +15,8 @@ The staging tag is an **immutable property of the staged package** (`npm help st
15
15
  re-staging the same version under a different tag requires `npm stage reject` first.
16
16
  There is no "fix the stage in place" — you reject it and re-cut the next patch.
17
17
 
18
- > `flair-bench` is version-bumped and tagged in lockstep with the other 7, and stages in
19
- > its own step in CI for [historical reasons](#flair-bench-bootstrap-one-time-done). That
20
- > step is no longer allowed to fail: every already-published package must stage
21
- > for a release to pass.
22
-
23
18
  ```
24
- merge release PR ──▶ push tag v0.11.0 ──▶ CI stages all packages (tag: staged)
19
+ merge release PR ──▶ auto-tag v0.11.0 ──▶ CI stages all packages (tag: staged)
25
20
  │
26
21
  maintainer reviews + approves (2FA)
27
22
  ▼
@@ -35,12 +30,10 @@ There is no "fix the stage in place" — you reject it and re-cut the next patch
35
30
  latest moves
36
31
  ```
37
32
 
38
- Pushing a `vX.Y.Z` tag triggers the release. This replaces the old "run
39
- `release.sh --publish` from a laptop logged into npm" flow. Nothing publishes without
40
- a human 2FA approval, and every package ships with a provenance attestation (public
41
- repo → verifiable build origin). The person who tags the release does **not** need npm
42
- credentials or `Actions: write` — only repo push access; the only privileged step is
43
- the maintainer's 2FA approval.
33
+ One `vX.Y.Z` tag starts npm staging and the `adk-flair` PyPI workflow.
34
+ PyPI requires the matching `packages/adk-flair/pyproject.toml` version and approval
35
+ in the `adk-flair-publish` environment. `adk-flair-vX.Y.Z` remains available for
36
+ Python-only releases; `workflow_dispatch` remains the manual fallback.
44
37
 
45
38
  ## Cutting a release
46
39
 
@@ -50,8 +43,10 @@ the maintainer's 2FA approval.
50
43
  ./scripts/release.sh 0.11.0
51
44
  ```
52
45
 
53
- This assembles the changelog, bumps every workspace package to the version, aligns
54
- internal deps, refreshes `bun.lock`, builds, tests, and opens a `release: v0.11.0` PR.
46
+ This assembles the changelog, bumps the lockstep release packages (listed in
47
+ `scripts/release.sh`) to the version, aligns internal deps, refreshes `bun.lock`, builds,
48
+ tests, and opens a `release: v0.11.0` PR. The Cursor workspaces (`packages/cursor-flair`
49
+ and `packages/cursor-wake-runner`) keep their own versions.
55
50
  Review and merge it (CI green + K&S approval) the same as any other PR.
56
51
 
57
52
  **Nothing about the version is bumped by hand.** The version is declared outside
@@ -84,7 +79,7 @@ fragment directory is empty (nothing to release) or when someone hand-wrote an e
84
79
  ### Phase 2 — tag the release
85
80
 
86
81
  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.
82
+ normally creates its tag after a successful push CI run on `main`, subject to the release checks.
88
83
  If an allowlisted advisory job fails that CI run, the immediate path is skipped and
89
84
  nightly recovery makes the tag instead. It runs at **04:23 UTC daily**, so expect up
90
85
  to **24 hours plus run time**. It uses completed CI runs regardless of their overall
@@ -92,21 +87,21 @@ conclusion and tolerates only exact names in [the advisory allowlist](../.github
92
87
  All other release conditions must pass, and it targets the version still declared
93
88
  on `main`, so a newer version supersedes a missed release.
94
89
 
95
- To tag by hand, push the version tag:
90
+ If Release auto-tag refused, resolve what it reports; do not tag by hand. If it did not
91
+ run, a repository admin tags by hand (a ruleset restricts creating `v*` tags) once the
92
+ checks it applies pass. The first command must print nothing:
96
93
 
97
94
  ```bash
95
+ git ls-remote --tags origin v0.11.0
98
96
  git checkout main && git pull
99
97
  git tag v0.11.0 && git push origin v0.11.0
100
98
  ```
101
99
 
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
100
+ > When the release commit's tree carries
106
101
  > `packages/adk-flair/pyproject.toml` whose `[project].version` equals the version
107
102
  > 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).
103
+ > commit. PyPI runs serialize per version, upload missing artifacts after the guards pass,
104
+ > and verify both filenames and SHA256 digests; lookup errors fail the run.
110
105
  >
111
106
  > The project version is read with Python's `tomllib` — the SAME reader
112
107
  > `.github/workflows/adk-flair-publish.yml` decides with — by handing the file to
@@ -179,11 +174,11 @@ workflow, which:
179
174
  3. Verifies every lockstep package's `package.json` is at that version.
180
175
  4. Builds every package.
181
176
  5. Runs `npm stage publish` for each lockstep package in dependency order
182
- (flair-client first), then `flair-bench` in its own step. Any lockstep package
177
+ (flair-client first). Any lockstep package
183
178
  failing to stage fails the release.
184
179
 
185
180
  It authenticates via OIDC — no secrets, and it does **not** create or move any tag (the
186
- tag you pushed is the trigger). Watch the run; when it's green, the packages are staged
181
+ tag is the trigger). Watch the run; when it's green, the packages are staged
187
182
  but **not yet live**.
188
183
 
189
184
  In parallel — and **independent of the npm staging approval** — a `github-release` job
@@ -313,6 +308,15 @@ and 0.55.1's promote had to be assembled by hand, line by line, for this reason.
313
308
  It reads `dist-tags.latest` for every lockstep package and exits non-zero
314
309
  naming any that disagree (or that differ from `<ver>`). The canary runs the same
315
310
  check BEFORE the verdict, so a pre-existing skew is visible there too.
311
+
312
+ The promote block runs this check itself, in its wait mode (`--await 120`, with
313
+ each package's previous `latest`): it reads every `latest` from the registry's
314
+ dist-tags endpoint, re-reads a package that is not yet at `<ver>` until it is or
315
+ the wait ends, and exits 3 if every such package still reads its previous
316
+ `latest` at the end. On exit 3, re-run the command the block prints before
317
+ restoring anything. A run without `--await` reads the package document, which
318
+ the public registry serves from its CDN and which can still show the previous
319
+ `latest` for a short time after a move.
316
320
  - **On FAIL**, the version stays public but unpromoted. The canary emits one
317
321
  `npm deprecate` line per package; run them, then re-cut the next patch. A
318
322
  version is never refreshed in place.
@@ -351,10 +355,6 @@ published; since flair#1683 it is a
351
355
 
352
356
  ### `flair-bench` bootstrap (one-time, done)
353
357
 
354
- **Nothing to do here.** This section is kept because the next brand-new package added to
355
- the release set will hit the same wall, and because it explains why `flair-bench` still
356
- stages in its own workflow step.
357
-
358
358
  `flair-bench` (added 2026-07-12, flair#702) was wired into the version-bump/tag flow
359
359
  (`scripts/release.sh`, `release-publish.yml`'s version-check) alongside the other 7 before
360
360
  it existed on npm at all. That is a chicken-and-egg: `npm stage publish` categorically
@@ -386,6 +386,12 @@ review. Because the release is triggered by a tag push, its deployment policy mu
386
386
  **`v*` tags** (Settings → Environments → `release` → Deployment branches and tags →
387
387
  Selected branches and tags → add tag rule `v*`).
388
388
 
389
+ ### GitHub `adk-flair-publish` environment
390
+
391
+ Repository admin: add the tag rule `v*` under Settings → Environments →
392
+ `adk-flair-publish` → Deployment branches and tags → Selected branches and tags.
393
+ Keep `adk-flair-v*` and the required reviewer. No tag-creation ruleset change is needed.
394
+
389
395
  ### Required status checks (ruleset)
390
396
 
391
397
  Add **`First-publish preflight`** to the main branch ruleset's required status
package/docs/rem.md CHANGED
@@ -94,4 +94,12 @@ Anything ineligible (no scope tag, flagged content, already decided) is left pen
94
94
 
95
95
  Durability is owner-controlled, including `permanent`: owners may create, change, archive and delete their own memories at every tier. Administrators may delete any owner’s memory. The permanent tier controls retention and bootstrap priority; it does not prevent an explicit owner deletion.
96
96
 
97
+ What each tier actually guarantees:
98
+
99
+ - permanent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it); it never decays; bootstrap considers the bootstrapping agent's own permanent memories before recent rows, subject to scope, expiry/closure and the token budget.
100
+ - persistent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it).
101
+ - standard — routine maintenance archives it once its validTo passes or, as a session note, after 30 days.
102
+ - ephemeral — routine maintenance reaps it once its TTL (24h by default) passes.
103
+ - No tier adds a flush, fsync, backup or replica acknowledgement: an explicit delete (owner or admin) or a store failure can end any of them.
104
+
97
105
  Soul is operator-authored identity, not a promotion target for learned candidates. `flair rem promote --to soul` is refused for stored candidate text even with operator credentials; promote learned claims to Memory instead.