@tpsdev-ai/flair 0.62.0 → 0.63.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/README.md +14 -13
  2. package/SECURITY.md +73 -43
  3. package/config.yaml +11 -11
  4. package/dist/bridges/runtime/execute.js +1 -0
  5. package/dist/bridges/runtime/import-runner.js +4 -0
  6. package/dist/bridges/types.js +1 -0
  7. package/dist/build-info.json +3 -3
  8. package/dist/cli.js +309 -205
  9. package/dist/commands/agent.js +325 -137
  10. package/dist/commands/attention.js +2 -0
  11. package/dist/commands/backup-approval.js +218 -0
  12. package/dist/commands/backup.js +37 -33
  13. package/dist/commands/bootstrap.js +5 -1
  14. package/dist/commands/bridge.js +10 -0
  15. package/dist/commands/deploy.js +37 -7
  16. package/dist/commands/doctor.js +206 -42
  17. package/dist/commands/export.js +144 -15
  18. package/dist/commands/federation.js +653 -68
  19. package/dist/commands/grant.js +5 -6
  20. package/dist/commands/help.js +25 -0
  21. package/dist/commands/idp.js +14 -19
  22. package/dist/commands/import.js +167 -34
  23. package/dist/commands/init.js +380 -164
  24. package/dist/commands/integrity.js +5 -6
  25. package/dist/commands/keys.js +12 -8
  26. package/dist/commands/mcp.js +157 -79
  27. package/dist/commands/memory.js +38 -17
  28. package/dist/commands/migrate-harness-memory.js +9 -3
  29. package/dist/commands/orgevent.js +5 -10
  30. package/dist/commands/principal.js +32 -39
  31. package/dist/commands/quality.js +26 -3
  32. package/dist/commands/reembed.js +468 -111
  33. package/dist/commands/rem.js +484 -65
  34. package/dist/commands/restore.js +352 -44
  35. package/dist/commands/search.js +2 -0
  36. package/dist/commands/service.js +109 -2
  37. package/dist/commands/soul.js +0 -6
  38. package/dist/commands/status.js +165 -124
  39. package/dist/commands/test.js +4 -1
  40. package/dist/commands/upgrade.js +53 -22
  41. package/dist/commands/workspace.js +7 -8
  42. package/dist/deploy.js +59 -3
  43. package/dist/doctor-client.js +9 -25
  44. package/dist/fabric-upgrade.js +12 -2
  45. package/dist/federation/presence-send.js +139 -0
  46. package/dist/federation/scheduler.js +148 -12
  47. package/dist/federation-verify.js +269 -177
  48. package/dist/install/clients.js +171 -35
  49. package/dist/keystore.js +77 -10
  50. package/dist/lib/agent-id-rule.js +44 -2
  51. package/dist/lib/agent-key-file.js +509 -0
  52. package/dist/lib/agent-rotation-lock.js +249 -0
  53. package/dist/lib/atomic-write.js +3 -3
  54. package/dist/lib/auth-resolve.js +1040 -64
  55. package/dist/lib/backup-approval-store.js +612 -0
  56. package/dist/lib/backup-artifact.js +343 -0
  57. package/dist/lib/config-critical-section.js +212 -25
  58. package/dist/lib/connect-phase.js +33 -0
  59. package/dist/lib/daemon-liveness.js +2 -1
  60. package/dist/lib/federation-pair-access.js +4 -0
  61. package/dist/lib/federation-retry-queue.js +283 -0
  62. package/dist/lib/federation-retry-row.js +101 -0
  63. package/dist/lib/instruction-event-contract.js +17 -0
  64. package/dist/lib/instruction-event-doctor.js +102 -0
  65. package/dist/lib/key-dir.js +203 -0
  66. package/dist/lib/launchd-management.js +21 -6
  67. package/dist/lib/local-instance-pair.js +8 -1
  68. package/dist/lib/mcp-enable.js +14 -15
  69. package/dist/lib/memory-attributes.js +2 -0
  70. package/dist/lib/memory-provider-timeout.js +33 -0
  71. package/dist/lib/mqtt-config.js +132 -0
  72. package/dist/lib/mqtt-listener-doctor.js +104 -0
  73. package/dist/lib/node-alias-path.js +50 -2
  74. package/dist/lib/open-live-row.js +20 -0
  75. package/dist/lib/ops-url.js +52 -0
  76. package/dist/lib/promotion-content-hash.js +20 -0
  77. package/dist/lib/remote-admin-pass.js +157 -0
  78. package/dist/lib/restore-archive.js +760 -0
  79. package/dist/lib/restore-verify.js +1 -1
  80. package/dist/lib/scheduler-platform.js +13 -0
  81. package/dist/lib/service-repoint.js +13 -4
  82. package/dist/lib/skill-assignment-preflight.js +159 -0
  83. package/dist/lib/skill-seed.js +125 -10
  84. package/dist/lib/skill-tombstone-doctor.js +133 -0
  85. package/dist/lib/soul-scope-fields.js +26 -0
  86. package/dist/lib/terminal-text.js +32 -0
  87. package/dist/lib/uninstall-purge.js +266 -11
  88. package/dist/lib/upgrade-prior-liveness.js +2 -1
  89. package/dist/mcp-client-assertion.js +7 -14
  90. package/dist/memory-id-checkpoint.js +28 -7
  91. package/dist/mqtt-off-deploy.js +550 -0
  92. package/dist/rem/promote-policy.js +3 -3
  93. package/dist/rem/restore.js +302 -26
  94. package/dist/rem/runner.js +220 -58
  95. package/dist/rem/scheduler.js +21 -4
  96. package/dist/resources/A2AAdapter.js +131 -178
  97. package/dist/resources/AdminMemory.js +2 -0
  98. package/dist/resources/AdminMemoryCandidates.js +116 -0
  99. package/dist/resources/Agent.js +155 -45
  100. package/dist/resources/AgentCard.js +4 -0
  101. package/dist/resources/AgentKeyRegister.js +56 -22
  102. package/dist/resources/AgentReadPosition.js +7 -0
  103. package/dist/resources/AgentSeed.js +232 -107
  104. package/dist/resources/AutoPromoteCandidates.js +413 -84
  105. package/dist/resources/Credential.js +6 -8
  106. package/dist/resources/Federation.js +219 -57
  107. package/dist/resources/FederationRetry.js +4 -4
  108. package/dist/resources/InstructionVersion.js +1 -1
  109. package/dist/resources/MCPClientMetadata.js +6 -3
  110. package/dist/resources/Memory.js +1348 -271
  111. package/dist/resources/MemoryArchive.js +149 -64
  112. package/dist/resources/MemoryBootstrap.js +12 -22
  113. package/dist/resources/MemoryCandidate.js +16 -2
  114. package/dist/resources/MemoryConsolidate.js +2 -2
  115. package/dist/resources/MemoryFeed.js +360 -147
  116. package/dist/resources/MemoryMaintenance.js +290 -72
  117. package/dist/resources/MemoryPurge.js +138 -22
  118. package/dist/resources/MemoryReflect.js +68 -14
  119. package/dist/resources/MemoryReindex.js +91 -13
  120. package/dist/resources/Message.js +11 -2
  121. package/dist/resources/OAuth.js +156 -39
  122. package/dist/resources/OAuthClient.js +1 -1
  123. package/dist/resources/OrgEvent.js +292 -29
  124. package/dist/resources/OrgEventCatchup.js +7 -0
  125. package/dist/resources/OrgEventMaintenance.js +48 -10
  126. package/dist/resources/PairingToken.js +1 -1
  127. package/dist/resources/Presence.js +31 -11
  128. package/dist/resources/PromoteMemoryCandidate.js +8 -2
  129. package/dist/resources/RecordUsage.js +2 -4
  130. package/dist/resources/Soul.js +2 -0
  131. package/dist/resources/SoulFeed.js +2 -1
  132. package/dist/resources/WorkspaceLatest.js +4 -0
  133. package/dist/resources/XAA.js +36 -10
  134. package/dist/resources/a2a-stream.js +313 -0
  135. package/dist/resources/a2a-url.js +4 -5
  136. package/dist/resources/agent-admin.js +10 -1
  137. package/dist/resources/agent-auth.js +98 -68
  138. package/dist/resources/agent-read-position-lib.js +4 -1
  139. package/dist/resources/agent-status-guard.js +9 -7
  140. package/dist/resources/auth-middleware.js +166 -42
  141. package/dist/resources/authority-field-guard.js +9 -11
  142. package/dist/resources/auto-promote-lib.js +8 -5
  143. package/dist/resources/basic-auth-header.js +21 -0
  144. package/dist/resources/bm25-index-service.js +4 -5
  145. package/dist/resources/dedup-cluster.js +6 -1
  146. package/dist/resources/embeddings-provider.js +25 -0
  147. package/dist/resources/federation-classify.js +89 -0
  148. package/dist/resources/federation-retry-lib.js +6 -81
  149. package/dist/resources/health.js +75 -19
  150. package/dist/resources/host-pointer/registry.js +29 -0
  151. package/dist/resources/host-pointer-adapter.js +1 -0
  152. package/dist/resources/in-process-api.js +74 -11
  153. package/dist/resources/in-process.js +24 -22
  154. package/dist/resources/instruction-version-record.js +251 -7
  155. package/dist/resources/internal-authority.js +13 -0
  156. package/dist/resources/mcp-client-metadata-fields.js +4 -0
  157. package/dist/resources/mcp-handler.js +146 -13
  158. package/dist/resources/mcp-oauth-flag.js +12 -14
  159. package/dist/resources/mcp-oauth.js +446 -53
  160. package/dist/resources/mcp-tool-scopes.js +69 -0
  161. package/dist/resources/mcp-tools.js +70 -22
  162. package/dist/resources/memory-declared-attributes.js +1 -0
  163. package/dist/resources/memory-embed-hash.js +56 -0
  164. package/dist/resources/memory-host-source.js +5 -2
  165. package/dist/resources/memory-reflect-lib.js +1 -1
  166. package/dist/resources/memory-write-lock.js +202 -23
  167. package/dist/resources/memory-write-response.js +1 -1
  168. package/dist/resources/memory-write-transaction.js +243 -0
  169. package/dist/resources/migration-boot.js +17 -12
  170. package/dist/resources/migrations/boot-progress.js +25 -0
  171. package/dist/resources/migrations/data-dir.js +16 -3
  172. package/dist/resources/migrations/dir-safety.js +60 -2
  173. package/dist/resources/migrations/embedding-stamp.js +315 -49
  174. package/dist/resources/migrations/graph-heal.js +9 -2
  175. package/dist/resources/migrations/ledger.js +5 -2
  176. package/dist/resources/migrations/lock.js +867 -80
  177. package/dist/resources/migrations/progress.js +71 -10
  178. package/dist/resources/migrations/runner.js +212 -18
  179. package/dist/resources/migrations/state.js +36 -1
  180. package/dist/resources/migrations/status.js +2 -13
  181. package/dist/resources/migrations/synthetic-test-migration.js +78 -12
  182. package/dist/resources/migrations/types.js +26 -1
  183. package/dist/resources/migrations/visibility-backfill.js +111 -70
  184. package/dist/resources/oauth-discovery.js +0 -5
  185. package/dist/resources/object-body-guard.js +12 -5
  186. package/dist/resources/org-event-reserved.js +92 -0
  187. package/dist/resources/org-event-write-fault.js +19 -0
  188. package/dist/resources/owner-field-guard.js +1 -1
  189. package/dist/resources/owner-scoped-write-policy.js +65 -21
  190. package/dist/resources/owner-scoped-writes.js +37 -6
  191. package/dist/resources/path-id-rewrite.js +76 -0
  192. package/dist/resources/presence-internal.js +5 -5
  193. package/dist/resources/promotion-binding.js +43 -0
  194. package/dist/resources/promotion-stamp.js +124 -33
  195. package/dist/resources/protocol-context.js +189 -0
  196. package/dist/resources/record-type-kit.js +2 -4
  197. package/dist/resources/request-target.js +28 -1
  198. package/dist/resources/request-transaction.js +11 -1
  199. package/dist/resources/seed-reservation.js +1 -2
  200. package/dist/resources/semantic-retrieval-core.js +7 -6
  201. package/dist/resources/server-row-validation.js +71 -0
  202. package/dist/resources/skill-manifest.js +4 -3
  203. package/dist/resources/skill-version-write.js +400 -27
  204. package/dist/resources/skill-write-fault.js +6 -3
  205. package/dist/resources/skill-write-policy.js +2 -1
  206. package/dist/resources/soul-write-policy.js +26 -7
  207. package/dist/resources/table-helpers.js +1 -1
  208. package/dist/resources/table-subscription-policy.js +518 -85
  209. package/dist/resources/table-subscriptions.js +20 -7
  210. package/dist/resources/txn-pause-point.js +122 -5
  211. package/dist/resources/usage-recording.js +54 -46
  212. package/dist/resources/write-back.js +176 -11
  213. package/dist/resources/write-journal-context.js +5 -0
  214. package/dist/resources/write-journal.js +289 -0
  215. package/dist/src/keystore.js +77 -10
  216. package/dist/src/lib/agent-id-rule.js +44 -2
  217. package/dist/src/lib/atomic-write.js +3 -3
  218. package/dist/src/lib/federation-retry-row.js +101 -0
  219. package/dist/src/lib/instruction-event-contract.js +17 -0
  220. package/dist/src/lib/key-dir.js +203 -0
  221. package/dist/src/lib/memory-attributes.js +2 -0
  222. package/dist/src/lib/open-live-row.js +20 -0
  223. package/dist/src/lib/scheduler-platform.js +13 -0
  224. package/dist/src/lib/soul-scope-fields.js +26 -0
  225. package/dist/src/rem/promote-policy.js +3 -3
  226. package/dist/src/rem/scheduler.js +21 -4
  227. package/docs/access-control.md +39 -21
  228. package/docs/api-reference.md +161 -52
  229. package/docs/auth.md +69 -38
  230. package/docs/claude-code.md +3 -3
  231. package/docs/deploying-on-fabric.md +118 -2
  232. package/docs/deployment.md +17 -0
  233. package/docs/embedding-in-a-harper-app.md +23 -21
  234. package/docs/entity-vocabulary.md +7 -11
  235. package/docs/federation.md +29 -2
  236. package/docs/hosted-on-fabric.md +1 -1
  237. package/docs/integrations.md +11 -11
  238. package/docs/mcp-clients.md +7 -5
  239. package/docs/notes/mcp-agent-auth-consumer.md +4 -9
  240. package/docs/notes/mcp-oauth-model2.md +6 -6
  241. package/docs/openclaw.md +1 -1
  242. package/docs/quickstart-fabric.md +2 -2
  243. package/docs/quickstart.md +3 -3
  244. package/docs/releasing.md +13 -13
  245. package/docs/rem.md +24 -3
  246. package/docs/secrets-and-keys.md +9 -14
  247. package/docs/standalone-local.md +29 -2
  248. package/docs/supply-chain-policy.md +28 -20
  249. package/docs/the-team.md +2 -2
  250. package/docs/upgrade.md +29 -5
  251. package/package.json +18 -11
  252. package/schemas/agent.graphql +3 -3
  253. package/schemas/federation.graphql +10 -7
  254. package/schemas/memory.graphql +7 -2
  255. package/templates/bin/flair-rem-nightly.sh.tmpl +7 -1
  256. package/templates/launchd/start-flair-with-admin-pass.sh +188 -10
  257. package/dist/resources/soul-adk-guard.js +0 -68
@@ -118,7 +118,7 @@ lands in shell history and the process list.
118
118
 
119
119
  ### What a push sends
120
120
 
121
- Each sync pushes rows changed since the cursor from four tables: `Memory`, `Soul`, `Agent`, and `Relationship`. `Presence` is not in that set.
121
+ Each sync considers rows changed since the cursor from four tables: `Memory`, `Soul`, `Agent`, and `Relationship`. With `FLAIR_FEDERATION_PRESENCE_SEND` enabled (default off), `Presence` is scanned after those tables. Only Presence rows whose `originatorInstanceId` is this instance are eligible. Selection uses the later of `lastHeartbeatAt` and `activityUpdatedAt` against a separate watermark, clamped to scan time, with a 30 s overlap. A hub requires `FLAIR_FEDERATION_PRESENCE_RECEIVE` (default off) to store pushed Presence.
122
122
 
123
123
  **Memory rows with `visibility` exactly `"private"` are left behind.** Durability is not the filter. `"shared"` and any other present value are included. Soul, Agent, and Relationship have no `visibility` field, so this rule does not apply to them.
124
124
 
@@ -237,7 +237,13 @@ If neither the env var nor the passphrase file can be accessed, federation ident
237
237
 
238
238
  New peers must present a valid, unexpired, unused pairing token. This prevents unauthorized instances from joining the federation. Tokens are generated by the hub admin and are single-use on one node.
239
239
 
240
- An otherwise valid re-pair of a non-revoked peer (same instance ID, signed with the peer's pinned public key) requires no token; a supplied token must pass validation before the transactional Peer re-read and is consumed only if the pairing commits. Before writing, the re-pair rechecks the pinned key and revoke status inside its owned transaction: a different key is refused (409); otherwise a revoked peer is refused (403 `peer_revoked`), with no peer row written and no token consumed. A peer row absent at that re-read is paired as a first-time pair with a valid token; without a token the request is refused (401). On the token path, the re-read covers changes committed before the transaction's first read (its token read), not changes committed after it. A pair request whose first read finds no peer row (a first-time pair) stages its peer row in the owned transaction that consumes its token, then re-reads the committed peer row before that transaction commits. If that confirm read finds a row for the instance in committed state although the first read returned none, the pair is refused (409 `peer_row_appeared`): the request writes no peer row and the token stays unconsumed. The confirm reports a row present when it runs, not when that row was committed; it also detects a row committed after the token read, if that row is still present. A row committed after the confirm read and before the commit is not seen by it.
240
+ An otherwise valid re-pair of a non-revoked peer (same instance ID, signed with the peer's pinned public key) requires no token; a supplied token must pass validation before the transactional Peer re-read. Before writing, the re-pair rechecks the pinned key and revoke status inside its owned transaction: a different key is refused (409); otherwise a revoked peer is refused (403 `peer_revoked`), with no peer row written and no token consumed. A peer row absent at that re-read is paired as a first-time pair with a valid token; without a token the request is refused (401). On the token path, the re-read covers changes committed before the transaction's first read (its token read), not changes committed after it. Both first-pair routes (initially absent Peer or deleted Peer on a token re-pair) stage their peer row in the owned transaction that consumes its token, then confirm its absence in committed state before that transaction commits. If that confirm read finds a row for the instance in committed state although the earlier read returned none, the pair is refused (409 `peer_row_appeared`): the request writes no peer row and the token stays unconsumed. After the commit, each route confirms its write from a fresh committed read, and a request whose confirmation fails is never reported as `paired`:
241
+
242
+ - **First-time pair** (an initially absent Peer, or a token re-pair whose Peer was deleted): the committed Peer row must show this attempt's marker and every staged field at its staged value, and the committed `PairingToken` row must match the staged marker, `consumedBy`, and `consumedAt`. A mismatch is refused 409 `peer_pair_unconfirmed`; a failed read is refused 503 `peer_read_back_unconfirmed`.
243
+ - **Token re-pair of an existing Peer:** the same comparison, except that its staged Peer row is a copy of the re-read row, so Harper's `__createdtime__` and `__updatedtime__` are left out. A mismatch or a failed read is refused 409 `peer_pair_unconfirmed`.
244
+ - **Re-pair without a token:** the committed Peer row must show this attempt's marker and its staged fields, again without Harper's timestamps. A mismatch or a failed read answers 503 `write_outcome_unknown` with outcome `unconfirmed`; no token was spent, so the request may be sent again.
245
+
246
+ On both re-pair routes, `pairAttemptWriteId` is written by a pairing attempt as the id of its write. A field-level competing update that leaves this field alone merges around it, so a refused attempt's id can remain on the committed row next to the competing update's fields. The post-commit comparison uses it as the id of the staged write; it is not a confirmation of the attempt.
241
247
 
242
248
  ### Originator enforcement
243
249
 
@@ -308,6 +314,27 @@ so B's copy would then hold a different key from A's. A B row that is absent
308
314
  can receive A's registered-key row: the pending-key guard applies only to a row B
309
315
  already holds with `publicKey: "pending"`.
310
316
 
317
+ ### An agent's key, home and admin fields in a sync
318
+
319
+ An existing Agent row's `publicKey` and home (`originatorInstanceId`) change
320
+ through a sync only when the batch's signing sender is the row's stored home. A
321
+ record from another peer that would change either is skipped whole as
322
+ `agent_identity_not_from_home`. A missing, null or empty stored home counts as
323
+ no home: such a row takes no key change from a peer and cannot acquire a
324
+ non-empty home through a sync.
325
+
326
+ A sync does not set or change `role: "admin"` or `admin: true`: a new row is
327
+ stored without them, and an existing row keeps its stored admin state (whether
328
+ `role` is `"admin"` and whether `admin` is `true`) when the record's would change
329
+ it. A `role` label follows the merge when the stored and incoming roles are both
330
+ non-admin. A record that would
331
+ create a row whose id the receiving instance's `FLAIR_ADMIN_AGENTS` names is
332
+ skipped as `agent_admin_id_not_federated`.
333
+
334
+ Earlier checks, including the status and pending-key rules, keep their own
335
+ reasons. The receiving instance's administrator can write these fields, or
336
+ create the row, through its operations API.
337
+
311
338
  ## Troubleshooting
312
339
 
313
340
  ### Listen port drift
@@ -39,7 +39,7 @@ flair init --target https://<cluster>.<org>.harperfabric.com \
39
39
 
40
40
  - `--force` is required — this writes to a live instance.
41
41
  - `--remote` marks it a federation **hub** and creates the `flair_pair_initiator` role; without it, pairing later fails role-not-found.
42
- - Generated admin password lands in `~/.tps/secrets/flair-fabric-hdb` (mode `0600`); `--flair-admin-pass` to choose your own.
42
+ - Before attempting to set `admin`'s password, init saves the chosen or generated password locally in a mode-`0600` file; `--flair-admin-pass` chooses your own. The final credential path is `~/.tps/secrets/flair-fabric-hdb`. Init attempts this save only when it selects the branch that will try to create or update `admin`; an existing `super_user` cluster administrator is reused without writing a password file. With no file present the password is written directly and kept even if the deployment is refused; with one present, the new value is staged beside it and moved into place after the cluster accepts it and the staged copy verifies. If the cluster accepts the change but the saved copy cannot be confirmed, init prints the recovery step.
43
43
 
44
44
  ### Operations endpoint
45
45
 
@@ -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.
3
+ Where Flair already runs. Each integration can reach one shared Flair memory store; signed requests identify an agent. Reads follow each resource's policy: Memory uses owner/visibility scope with an additional current-authority check for retained closed skills, while Credential records are owner-only for non-admin callers.
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 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.
5
+ > **The point.** Memory can follow an agent across orchestrators. Integrations using an ordinary Ed25519 agent key can write under that identity. Reads follow each resource's policy: Memory uses owner/visibility scope with an additional current-authority check for retained closed skills, while Credential records are owner-only for non-admin callers. 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
 
@@ -22,9 +22,9 @@ Where Flair already runs. Each integration can reach one shared Flair memory sto
22
22
  | **OpenClaw** | [`openclaw-flair`](#openclaw) | Ed25519 | Native plugin (context-engine slot left intact) |
23
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
- | **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
- | **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 |
27
- | **Google ADK** (JS/TS) | [`@tpsdev-ai/adk-flair`](../packages/adk-flair-js/README.md) | Ed25519 | Same identity model as the Python package |
25
+ | **Pi agent** | [`pi-flair`](#pi-agent) | Ed25519 | Native pi extension; 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
+ | **Google ADK** (Python) | [`adk-flair`](https://github.com/tpsdev-ai/flair/blob/main/packages/adk-flair/README.md) | Ed25519 | `BaseMemoryService`; see [hosted auth](#hosted-flair-auth--your-agent-got-a-404) if you just got a 404 |
27
+ | **Google ADK** (JS/TS) | [`@tpsdev-ai/adk-flair`](https://github.com/tpsdev-ai/flair/blob/main/packages/adk-flair-js/README.md) | Ed25519 | Same identity model as the Python package |
28
28
 
29
29
  Don't see your harness? If it speaks **MCP** — Flair already works with `flair-mcp`. For a custom memory protocol such as LangGraph's `BaseStore` or CrewAI's `RAGStorage`, an adapter must translate that protocol's operations to Flair; [open an issue](https://github.com/tpsdev-ai/flair/issues) or [send a PR](https://github.com/tpsdev-ai/flair).
30
30
 
@@ -76,8 +76,8 @@ A verified agent that is not allowed the row gets 404, never 403. Anonymous by-i
76
76
 
77
77
  | Adapter | URL | Agent id | Keyfile | Hosted extras |
78
78
  |---|---|---|---|---|
79
- | **adk-flair** (Python) | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | `FLAIR_ALLOW_REMOTE_URL=1`, `FLAIR_HTTP_TIMEOUT` — [adk-flair README](../packages/adk-flair/README.md#hosted-flair) |
80
- | **adk-flair-js** (JS/TS) | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | For a non-localhost URL, set `FLAIR_ALLOW_REMOTE_URL=1`; request timeout comes from constructor `timeoutMs` (default 2000 ms), not `FLAIR_HTTP_TIMEOUT` — [adk-flair-js README](../packages/adk-flair-js/README.md) |
79
+ | **adk-flair** (Python) | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | `FLAIR_ALLOW_REMOTE_URL=1`, `FLAIR_HTTP_TIMEOUT` — [adk-flair README](https://github.com/tpsdev-ai/flair/blob/main/packages/adk-flair/README.md#hosted-flair) |
80
+ | **adk-flair-js** (JS/TS) | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | For a non-localhost URL, set `FLAIR_ALLOW_REMOTE_URL=1`; request timeout comes from constructor `timeoutMs` (default 2000 ms), not `FLAIR_HTTP_TIMEOUT` — [adk-flair-js README](https://github.com/tpsdev-ai/flair/blob/main/packages/adk-flair-js/README.md) |
81
81
  | **flair-mcp** / Cursor plugin | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` (optional; auto-resolved) | Key must be on the **npx host** |
82
82
  | **Hermes** | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` or Hermes `key_path` | Same Ed25519 model |
83
83
  | **Pi** | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` or Pi client `keyPath` | Same Ed25519 model |
@@ -173,7 +173,7 @@ const store = new FlairStore({ agentId: "my-langgraph-agent" });
173
173
  const agent = createReactAgent({ llm, tools, store });
174
174
  ```
175
175
 
176
- Maps LangGraph namespaces to Flair tags, keys to ids, values to JSON content. Non-empty search queries call Flair's `/SemanticSearch` endpoint. The server selects hybrid (BM25 plus vector), vector-only, or BM25-only retrieval; embedding availability affects whether the vector leg can run. Filter operators applied client-side. Full mapping table: [`packages/langgraph-flair/README.md`](../packages/langgraph-flair/README.md).
176
+ Maps LangGraph namespaces to Flair tags, keys to ids, values to JSON content. Non-empty search queries call Flair's `/SemanticSearch` endpoint. The server selects hybrid (BM25 plus vector), vector-only, or BM25-only retrieval; embedding availability affects whether the vector leg can run. Filter operators applied client-side. Full mapping table: [`packages/langgraph-flair/README.md`](https://github.com/tpsdev-ai/flair/blob/main/packages/langgraph-flair/README.md).
177
177
 
178
178
  This package contains the TypeScript adapter; it does not include a Python implementation.
179
179
 
@@ -187,7 +187,7 @@ This package contains the TypeScript adapter; it does not include a Python imple
187
187
  openclaw plugins install @tpsdev-ai/openclaw-flair
188
188
  ```
189
189
 
190
- Configuration via OpenClaw's standard plugin surface. See [`docs/openclaw.md`](openclaw.md) for the per-agent install pattern. The host's own workspace files load each agent's `SOUL.md` / `AGENTS.md`; Flair does not manage or anchor these.
190
+ Configuration via OpenClaw's standard plugin surface. See [`docs/openclaw.md`](openclaw.md) for the per-agent install pattern. The host's own workspace files load each agent's `SOUL.md` / `AGENTS.md`; Flair does not manage or anchor these. <!-- docs-freshness-allow: names files in the host's workspace -->
191
191
 
192
192
  ---
193
193
 
@@ -227,7 +227,7 @@ Auth: TPS-Ed25519 (the same model the rest of Flair uses) — writes are isolate
227
227
 
228
228
  ## Pi agent
229
229
 
230
- [`@tpsdev-ai/pi-flair`](https://www.npmjs.com/package/@tpsdev-ai/pi-flair) is the **native pi extension** for the [Pi coding agent](https://github.com/mariozechner/pi-coding-agent) — pi has no MCP client support, so this is a first-party plugin, not an MCP bridge. Memory + identity (`memory_search`, `memory_store`, `bootstrap`) for the pi runtime.
230
+ [`@tpsdev-ai/pi-flair`](https://www.npmjs.com/package/@tpsdev-ai/pi-flair) is the **native pi extension** for the [Pi coding agent](https://github.com/mariozechner/pi-coding-agent). Memory + identity (`memory_search`, `memory_store`, `bootstrap`) for the pi runtime.
231
231
 
232
232
  To provision an agent and wire Pi, use the init command below; if the agent is already provisioned, install the extension with Pi's installer.
233
233
 
@@ -256,7 +256,7 @@ export FLAIR_AGENT_ID=my-agent # per host/purpose
256
256
  pi
257
257
  ```
258
258
 
259
- Full details (tools, env reference, auto-recall/auto-capture flags, security notes): [`packages/pi-flair/README.md`](../packages/pi-flair/README.md).
259
+ Full details (tools, env reference, auto-recall/auto-capture flags, security notes): [`packages/pi-flair/README.md`](https://github.com/tpsdev-ai/flair/blob/main/packages/pi-flair/README.md).
260
260
 
261
261
  ---
262
262
 
@@ -261,7 +261,7 @@ reports that pending-approval state as configured but delivery not verified.
261
261
  Some clients have no session-start hook Flair can write. Wiring the MCP
262
262
  server is necessary but not sufficient — the model still has to choose to
263
263
  call `bootstrap`. Add a short instruction block to the file that client
264
- already loads (`AGENTS.md`, `GEMINI.md`, or the equivalent):
264
+ already loads (`AGENTS.md`, `GEMINI.md`, or the equivalent): <!-- docs-freshness-allow: names files in the reader's project -->
265
265
 
266
266
  ```markdown
267
267
  ## Flair memory
@@ -299,7 +299,7 @@ Clients on this page talk to the stdio server `@tpsdev-ai/flair-mcp`. Its `tools
299
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 |
300
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 |
301
301
  | `skill_search` | Rank skills by their trigger against a task. Returns a catalog (id, name, trigger, description, tags, agentId), not the procedure |
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 |
302
+ | `skill_get` | Fetch one skill's full procedure by id. Non-admin callers use Memory's owner/visibility scope and, for retained closed skills, its current-authority check; administrators are not subject to those restrictions |
303
303
  | `memory_update` | Update a memory by id. Overwrites in place, or pass `preserveHistory` to write a superseding version. Optional `usedMemoryIds` |
304
304
  | `memory_get` | Fetch a specific memory by ID |
305
305
  | `memory_delete` | Delete a memory by ID. Non-admin callers can delete only their own memories; administrators can also delete other agents' memories |
@@ -313,7 +313,9 @@ Clients on this page talk to the stdio server `@tpsdev-ai/flair-mcp`. Its `tools
313
313
  | `team_directory` | List active agents with published tps-mail contacts. Filter by `id` or `name`; page with `cursor`/`limit` |
314
314
  | `record_usage` | Report that recalled memories were actually used (`memoryId` or `memoryIds`, plus optional `attribution`). Drives `usageCount` / `usageBoost` |
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)).
316
+ On the embedded `/mcp` handler, `soul_set` is listed only for a caller the soul write policy's source-authorization step admits (`Soul.post` applies its content guards after that step). That route authenticates callers with OAuth bearer tokens: a token subject mapped to an Agent acts as an agent principal, and the policy refuses an agent principal, so an agent's `tools/list` does not include `soul_set`. Listing resolves the caller the way a call does, except that it never JIT-provisions. An agent's soul is changed by the operator, on the agent's behalf (`flair soul set`).
317
+
318
+ 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: reads use the open-within-org base scope without a grant, with an additional current-authority check for non-admin by-id and collection reads of retained closed skills (see [SECURITY.md](../SECURITY.md)).
317
319
 
318
320
  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.
319
321
 
@@ -349,7 +351,7 @@ The MCP server has no client-side flags beyond these env vars; everything else (
349
351
 
350
352
  ## What about pi?
351
353
 
352
- 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
+ Flair ships a **native pi extension**: [`@tpsdev-ai/pi-flair`](https://github.com/tpsdev-ai/flair/blob/main/packages/pi-flair/README.md). Same backend. With an ordinary signed identity, writes are owned by that agent. Reads follow each resource's policy: Memory uses owner/visibility scope with an additional current-authority check for retained closed skills, while Credential records are owner-only for non-admin callers. Zero MCP in the path.
353
355
 
354
356
  Wiring is a `packages` entry in pi's own settings (`~/.pi/agent/settings.json`), not an `mcpServers` block:
355
357
 
@@ -367,7 +369,7 @@ One difference from the MCP clients above: pi settings carry no per-package `env
367
369
 
368
370
  ## What about Hermes (Nous Research)?
369
371
 
370
- 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
+ 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 follow each resource's policy: Memory uses owner/visibility scope with an additional current-authority check for retained closed skills, while Credential records are owner-only for non-admin callers. Different plug shape.
371
373
 
372
374
  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.
373
375
 
@@ -84,8 +84,7 @@ cache (e.g. after an unexpected 401).
84
84
  CLI: `flair mcp token --agent-id <id>` now performs the real mint by
85
85
  default; `--dry-run` restores the old sign-and-print behavior.
86
86
  `--client-id`/`--token-endpoint`/`--resource` default to this instance's own
87
- oauth surface (derived from `FLAIR_MCP_ISSUER` / `FLAIR_PUBLIC_URL`,
88
- matching `resources/mcp-oauth-flag.ts`) but are fully overridable — an
87
+ oauth surface (derived from `FLAIR_MCP_ISSUER` / `FLAIR_PUBLIC_URL`) but are fully overridable — an
89
88
  agent can authenticate to a **different** Harper MCP server; identity is
90
89
  portable.
91
90
 
@@ -93,9 +92,7 @@ portable.
93
92
 
94
93
  `buildTokenRequestForm` carries an optional `resource` field, pass-through
95
94
  only (it never invents a value). The CLI supplies the default:
96
- `${FLAIR_MCP_ISSUER}/mcp`, the same canonical resource identifier
97
- `resources/mcp-oauth-flag.ts`'s `mcpResource()` uses for this instance's own
98
- `/mcp` audience binding — exact-match, fail-closed on the AS side. The
95
+ `${FLAIR_MCP_ISSUER}/mcp` (falling back to `FLAIR_PUBLIC_URL`). The
99
96
  `resource` is part of the token-cache key: a token minted for one resource
100
97
  never serves another.
101
98
 
@@ -104,7 +101,7 @@ never serves another.
104
101
  Each agent's Client ID Metadata Document is **served**, not just generated:
105
102
  `GET /MCPClientMetadata/{agentId}` (public, unauthenticated — mirrors
106
103
  `AgentCard.ts`'s A2A-card posture). `client_id` = that URL itself (derived
107
- from `mcpIssuer()`, same env vars as above); `jwks` = the agent's existing
104
+ from `FLAIR_MCP_ISSUER` / `FLAIR_PUBLIC_URL`); `jwks` = the agent's existing
108
105
  `Agent.publicKey` re-expressed as a JWK OKP.
109
106
 
110
107
  Why served rather than exported for external hosting: Flair already
@@ -216,9 +213,7 @@ in-process proof, not measured; everything else above is measured.
216
213
  Whoever owns the AS-side `@harperfast/oauth` config for a given Harper
217
214
  instance MUST add this Flair instance's `MCPClientMetadata` host to
218
215
  `clientIdMetadataDocuments.allowedHosts`. That host is derived from
219
- `FLAIR_MCP_ISSUER` (or `FLAIR_PUBLIC_URL` as fallback) — the same env var
220
- `mcpIssuer()` in `resources/mcp-oauth-flag.ts` and `defaultMcpClientId()` in
221
- `src/mcp-client-assertion.ts` both read. If the allowlist isn't updated,
216
+ `FLAIR_MCP_ISSUER` (or `FLAIR_PUBLIC_URL` as fallback). If the allowlist isn't updated,
222
217
  `/mcp` client_credentials auth for this agent fails closed (by design; the
223
218
  e2e proves the "Unknown client" rejection live). This is an operational
224
219
  step, not a code change; flag it explicitly when coordinating a rollout.
@@ -157,12 +157,12 @@ registered identities.
157
157
  credentials.
158
158
 
159
159
  2. **Set the env:**
160
- - `FLAIR_MCP_OAUTH=true` — turns on the `/mcp` route registration AND the
161
- component AS (flair#1152: `true` is the ONE value both readers accept —
162
- flair's flag takes 1/true/yes/on, but the component's config read of the
163
- same var accepts only "true"/"false" and deletes anything else, so `1`
164
- gives you a guarded `/mcp` with no authorization server behind it).
165
- - `FLAIR_MCP_ISSUER=https://your-public-origin` (or `FLAIR_PUBLIC_URL`).
160
+ - `FLAIR_MCP_OAUTH=true` — the recommended value, which both readers accept
161
+ (the component trims it and ignores case, but `1`, `yes` and `on` leave it
162
+ disabled); the authorization
163
+ server also needs the issuer and provider credentials. An instance enabled
164
+ before 0.46 may still have `FLAIR_MCP_OAUTH=1`.
165
+ - `FLAIR_MCP_ISSUER=https://your-public-origin` — a bare HTTP(S) origin.
166
166
  - `OAUTH_GITHUB_CLIENT_ID`, `OAUTH_GITHUB_CLIENT_SECRET` and
167
167
  `OAUTH_GITHUB_REDIRECT_URI=https://your-public-origin/oauth` — staged by
168
168
  `flair mcp enable` using `--issuer` (default: `--instance`).
package/docs/openclaw.md CHANGED
@@ -83,7 +83,7 @@ Without `hooks.allowPromptInjection` the plugin contributes no context and logs
83
83
 
84
84
  ## Multi-Agent
85
85
 
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.
86
+ Each OpenClaw agent writes with its `agentId` as a field (tags are optional); reads use owner plus visibility. The base memory scope includes the reader's own records and other agents' non-private records; non-admin by-id and collection reads additionally check current authority for retained closed skills, and grants do not expand the read scope.
87
87
 
88
88
  ```bash
89
89
  flair agent add research-agent
@@ -89,7 +89,7 @@ In Cursor: **Plugins → Configure**
89
89
  | `FLAIR_URL` | `https://<cluster>.<org>.harperfabric.com` |
90
90
  | `FLAIR_AGENT_ID` | `mybot` (the id you just added) |
91
91
 
92
- Those are the two plugin schema fields. Local Cursor's `npx` can use the key from step 3 at `~/.flair/keys/mybot.key`. A cloud agent's `npx` runs on a different machine — that VM needs the key (or host-env admin credentials). See [`packages/cursor-flair/README.md`](../packages/cursor-flair/README.md).
92
+ Those are the two plugin schema fields. Local Cursor's `npx` can use the key from step 3 at `~/.flair/keys/mybot.key`. A cloud agent's `npx` runs on a different machine — that VM needs the key (or host-env admin credentials). See [`packages/cursor-flair/README.md`](https://github.com/tpsdev-ai/flair/blob/main/packages/cursor-flair/README.md).
93
93
 
94
94
  ## 5. Wire a Grok Bot agent
95
95
 
@@ -121,7 +121,7 @@ Same connector, different panel. This is the field-verified sequence — includi
121
121
 
122
122
  5. The next tool call picks up the key — a miss is not cached. A 401 names the agent and the paths that were looked in. If those are not where `flair agent add` wrote the file, the MCP process's home differs from the shell; set `FLAIR_KEY_PATH` to the absolute path of the `.key` file.
123
123
 
124
- 6. Verify: ask the agent to "load my Flair bootstrap". You should get soul + memories **including shared org context** — findings written by teammate agents. A shared-visibility write from this agent is now readable by every org agent.
124
+ 6. Verify: ask the agent to "load my Flair bootstrap". You should get soul + memories **including shared org context** — findings written by teammate agents. A shared-visibility write from this agent passes every org agent's base visibility check; non-admin Memory by-id and collection reads of retained closed skills also apply the current-authority check.
125
125
 
126
126
  **Account-wide connectors are shared.** A connector added at the Grok Bot account level is one identity used by every agent on that account. For per-agent identity, give each agent its own MCP entry with its own `FLAIR_AGENT_ID` — and register each id (steps 2–5).
127
127
 
@@ -154,7 +154,7 @@ flair memory add --agent local --visibility shared \
154
154
 
155
155
  `--visibility` takes exactly `private` or `shared` — a value it doesn't recognise is an error, not a guess — and overrides the durability rule in both directions. The `visibility` field in the response is the value the memory actually landed on, so read it rather than assuming.
156
156
 
157
- Once a memory is `shared`, **every** agent on this instance can read it, with no grant to set up. That is the shipped model: reads open within one instance, closed at the federation edge. Full picture in [SECURITY.md](../SECURITY.md).
157
+ A shared memory passes every agent's base visibility check without a grant; retained closed skills additionally require readable current authority on non-admin by-id and collection reads. That is the shipped model: reads open within one instance, closed at the federation edge. Full picture in [SECURITY.md](../SECURITY.md).
158
158
 
159
159
  ## 5. Find it back by meaning
160
160
 
@@ -177,7 +177,7 @@ Add `--explain` to see the ranking inputs per hit — the raw score, the composi
177
177
 
178
178
  ## 6. Give your agent context on boot
179
179
 
180
- With MCP wired (`flair init` does this for every client it detects), the recommended session-start is the `bootstrap` tool. In Claude Code that appears as `mcp__flair__bootstrap` (Claude Code's namespaced name for the server's `bootstrap` tool). Add this to your `CLAUDE.md`:
180
+ With MCP wired, the recommended session-start tool is `bootstrap`. In Claude Code that appears as `mcp__flair__bootstrap` (Claude Code's namespaced name for the server's `bootstrap` tool). Add this to your `CLAUDE.md`: <!-- docs-freshness-allow: names a file in the reader's project -->
181
181
 
182
182
  ```
183
183
  At the start of every session, run mcp__flair__bootstrap before responding.
@@ -202,7 +202,7 @@ Soul entries and relevant memories, in one block sized to a token budget. Paste
202
202
  | You want to... | Go to |
203
203
  |----------------|-------|
204
204
  | Add more agents to the same instance | `flair agent add <id>` |
205
- | Share a memory with your other agents | `flair memory add --visibility shared` — a bare write lands `private`, see [step 4](#who-can-read-it); a shared one is readable by every agent on the instance, no grant needed ([auth.md](auth.md)) |
205
+ | Share a memory with your other agents | `flair memory add --visibility shared` — a bare write lands `private`, see [step 4](#who-can-read-it); a shared memory passes the instance-wide base visibility check without a grant; non-admin Memory by-id and collection reads of retained closed skills also apply the current-authority check ([auth.md](auth.md)) |
206
206
  | Import memories from agentic-stack / Mem0 / etc. | [bridges.md](bridges.md) |
207
207
  | Sync memories across machines | [federation.md](federation.md) |
208
208
  | Integrate with OpenClaw, Claude Code, Cursor | [README.md#integration](../README.md#integration) |
package/docs/releasing.md CHANGED
@@ -63,18 +63,18 @@ a bug in the script — add the file to `SOURCE_VERSION_FILES` in
63
63
  **The changelog is assembled, not hand-promoted.** Entries land during development as one
64
64
  file per change under `.changelog/unreleased/` (flair#835 — a shared `[Unreleased]` block
65
65
  conflicted on every concurrent PR, and resolving a conflict dismisses approvals). The
66
- release script runs:
67
-
68
- ```bash
69
- node scripts/changelog-fragments.mjs promote 0.11.0
70
- ```
71
-
72
- which writes a `## [0.11.0] - <date>` section from the fragments — Keep a Changelog category
73
- order, filename order within a category, entry bodies copied verbatim — and deletes the
74
- fragment files. Released history above it is not touched. It **refuses** to run when the
75
- fragment directory is empty (nothing to release) or when someone hand-wrote an entry into
76
- `## [Unreleased]` that the step would otherwise silently overwrite. Preview any time with
77
- `node scripts/changelog-fragments.mjs render`.
66
+ release script invokes `bash scripts/release-promote-changelog.sh "$VERSION"`, which
67
+ passes `--with-dependencies` to `changelog-fragments.mjs promote` and forwards any
68
+ `--allow-no-release-tag` argument.
69
+ The `### Dependencies` section lists `feat`/`fix` commits since the tag selected by
70
+ `git describe` whose recorded author name matches `renovate[bot]` and whose changed
71
+ Git basenames are all `package.json`, `bun.lock`, `bun.lockb`, `package-lock.json`, or
72
+ `npm-shrinkwrap.json`.
73
+ Pass `--allow-no-release-tag` to `release.sh` to permit release PR preparation when
74
+ there is no `v*` tag.
75
+ Promotion refuses when there are neither fragments nor eligible dependency commits,
76
+ or when `## [Unreleased]` contains hand-written entries it would overwrite.
77
+ Preview fragments with `node scripts/changelog-fragments.mjs render`.
78
78
 
79
79
  ### Phase 2 — tag the release
80
80
 
@@ -186,7 +186,7 @@ auto-cuts a [GitHub release](https://github.com/tpsdev-ai/flair/releases) for th
186
186
  Release notes are a **lede + links** rendering of the matching `## [X.Y.Z]` section
187
187
  (`scripts/changelog-release-notes.mjs`): each entry keeps its bold lede, up to three
188
188
  issue links, and any `> **Heads-up:**` operator lines. The deep record stays in
189
- `CHANGELOG.md` and is linked from the footer at that tag. It is idempotent: re-running
189
+ `CHANGELOG.md` and is linked from the footer at that tag. <!-- docs-freshness-allow: the repository's changelog, not a package file --> It is idempotent: re-running
190
190
  the workflow or re-pushing the tag updates the existing release rather than failing.
191
191
  The GitHub release documents the tagged commit immediately; it does not wait on the
192
192
  npm 2FA gate. If the CHANGELOG has no section for the version, this job fails loudly
package/docs/rem.md CHANGED
@@ -52,13 +52,19 @@ Selects which `models.generative.<logicalName>` entry a REM call uses. Unset →
52
52
 
53
53
  `flair rem nightly enable` installs a platform-native timer (launchd / systemd) **on the host it runs on**. In a multi-node or Fabric deploy, enabling it on every node would run the cycle N times and scatter N sets of pre-cycle snapshots. The v1 rule: **exactly one node gets the timer** — pick it deliberately, the same way you'd pick a cron owner for any single-writer job. This is a v1 constraint, not a permanent one; see #709 for the roadmap toward a coordinated multi-node story.
54
54
 
55
- Snapshot locality follows from this: a nightly cycle's pre-run snapshot (`~/.flair/snapshots/<agent>/`) lands on **the node that ran that cycle** — `flair rem restore <date>` and `flair rem snapshot list` only see local snapshots. If you move which node owns the timer, snapshot history doesn't move with it. Live replay (`flair rem restore <date> --apply`) rewrites Soul with operator credentials (`--admin-pass` / `--admin-pass-file`); an agent key is refused. Leftover MemoryCandidate rows for that agent are deleted first so their claim text cannot block Soul restore.
55
+ Snapshot locality follows from this: a nightly cycle's pre-run snapshot (`~/.flair/snapshots/<agent>/`) lands on **the node that ran that cycle** — `flair rem restore <date>` and `flair rem snapshot list` only see local snapshots. If you move which node owns the timer, snapshot history doesn't move with it. Live replay (`flair rem restore <date> --apply` without `--dry-run`) rewrites Soul with operator credentials (`--admin-pass` / `--admin-pass-file`); an agent key is refused. Every Memory, Soul and MemoryCandidate read, delete and write it sends carries the admin credential it resolved, so it needs no local `~/.flair/admin-pass` when a flag supplies one. An `--apply --dry-run` to a non-loopback target without `--admin-pass` or `--admin-pass-file` resolves credentials signed-only and sends no Basic credential; `FLAIR_ADMIN_PASS` and the local admin-password file are read only for a loopback target. Leftover MemoryCandidate rows for that agent are deleted first so their claim text cannot block Soul restore. Live replay writes to the resolved base URL (`FLAIR_URL`'s scheme, port and path, or the local instance when it is unset) and lists those candidates through `GET /AdminMemoryCandidates/{agentId}` on that same endpoint; a dry run without an admin password does not list them. A live replay goes on only with a complete listing, read page by page (`after` set to the last id of the page before) until a page answers `hasMore: false`: a listing it cannot read completely (for example a malformed reply, a page that cannot move the cursor, a repeated id or a failed request such as `candidate_id_unusable`, which the route answers rather than leave out a row it reads without a usable id) is refused before any target-row delete or write. Flair server 0.63.0 adds that admin-only route: a live replay whose candidate request the target answers with HTTP 404 is refused with that version named; restore does not fall back to an operations endpoint. Restore's REST calls do not follow redirects.
56
56
 
57
57
  ## Interactive vs nightly
58
58
 
59
59
  - **Interactive (`flair rem rapid`):** one bounded, synchronous distillation call — gather cap 50 memories, bounded output tokens, seconds not minutes. Executes by default, staging candidates and printing a summary; `--prompt-only` returns the reflection prompt instead, for the bring-your-own-model handoff. A cold generative backend (first Ollama model load) is warmed outside Harper's request transaction so execute fails as the documented 502/503, not HTTP 422 from the 30s open-transaction ceiling.
60
60
  - **Nightly (`flair rem nightly enable` / `run-once`):** fully detached — the scheduler runs the full cycle (snapshot → maintenance → distillation), candidates land as pending rows, and an audit row lands in `~/.flair/logs/rem-nightly.jsonl`. The operator reviews in the morning via `flair rem candidates`.
61
61
 
62
+ ### Nightly admin credential
63
+
64
+ `flair rem nightly enable` bakes the absolute path of the admin-password file into the scheduler shim (`~/.flair/admin-pass` by default; override with `--admin-pass-file`). `run-once` reads the password from that file at run time; the value is never stored in the shim, exported into the environment, or passed in argv. The instance-wide dedup-cluster step calls an admin-gated route, so the file must exist and be owner-only (no group or world permission bits; `flair init` writes mode 0600). When the shim names a file that is missing, empty, or group-/world-readable, the run fails at startup before any cycle work with the dedup step NOT RUN, names the path and the remedy, and exits nonzero on every path, including a paused cycle and a dry run. An existing install picks up the new shim by re-running `flair rem nightly enable`; until then the previously installed shim stays in place.
65
+
66
+ The pending-candidate count `run-once` prints (`Pending:`) uses the same credential through the operations API. When that query fails, the line reads `Pending: unknown (<reason>)`, the failure is listed under `Errors:`, and the run exits nonzero. With no admin credential, when the cycle reaches the candidate-count step, the line reads `Pending: unknown (no admin credential for the operations API)`.
67
+
62
68
  ### Safety bounds (a large backlog must not take the instance down)
63
69
 
64
70
  A first run over thousands of unreflected memories used to hold the Harper main thread long enough that `/Health` and search timed out. Nightly distillation is now bounded:
@@ -75,7 +81,7 @@ Either path, the review loop is the same: `flair rem candidates` lists pending r
75
81
 
76
82
  adk-flair collapses every `(app, user)` into **one** Flair agentId, separating users only by a per-user tag `adk:<app>:<user>`. Distilling such an agentId with the default `scope:"recent"` would mix every user's sessions into shared claims — cross-user bleed. The nightly cycle therefore detects the agent's active `adk:<app>:<user>` tags (from the memories it already loads for the snapshot, with a recency cutoff that skips idle users and is scoped to the agent's own records) and runs distillation **once per tag** under `scope:"tagged"`, so each user's candidates come only from that user's own sessions. Agents with no `adk:` tags distill agentId-wide exactly as before.
77
83
 
78
- Memory promotion runs through `POST /PromoteMemoryCandidate` with `candidateId` and a nonempty `rationale`. The server reads the candidate and its lineage, writes the persistent memory through the normal safety/provenance path, and stamps `promotionStatus`, `promotedAt` and `promotedBy`. Direct Memory writes cannot create, change or clear these workflow fields, including administrator REST writes. Full-row updates may echo unchanged stamps; omitted stamps are preserved. Creating a successor with `memory_update(preserveHistory=true)` leaves the verdict on the predecessor; the new content starts without an approval stamp. Non-admin reviewers are attributed to their authenticated identity; only administrators may name another reviewer. `flair rem promote --to memory` uses this endpoint and requires an updated server; it does not fall back to direct verdict writes.
84
+ Memory promotion runs through `POST /PromoteMemoryCandidate` with `candidateId` and a nonempty `rationale`. The server reads the candidate and its lineage, writes the persistent memory through the normal safety/provenance path, and stamps `promotionStatus`, `promotedAt`, `promotedBy` and `promotionContentHash` (a server-only SHA-256 of the stored, post-redaction content at stamping time). Successful stamps bind newly created memories. Legacy verdicts without a matching binding are suppressed by binding-checked readers; review creates a new memory rather than binding the legacy row. When the automatic stamp reports failure, the candidate stays pending and the sweep reports `stamp_refused`. Direct Memory writes cannot set these workflow fields, including administrator REST writes; a content-changing write clears them. Full-row updates may echo unchanged stamps; omitted stamps are preserved. Creating a successor with `memory_update(preserveHistory=true)` leaves the verdict on the predecessor; the new content starts without an approval stamp. Non-admin reviewers are attributed to their authenticated identity; only administrators may name another reviewer. `flair rem promote --to memory` uses this endpoint and requires an updated server; it does not fall back to direct verdict writes.
79
85
 
80
86
  A candidate distilled under a tag records that tag in its `scopeTag` field. `flair rem promote` reads `scopeTag` as the authoritative per-user lineage tag and propagates it onto the promoted memory — so the promoted claim stays in that user's retrieval scope even if the source episodes are later archived or deleted. The single-node timer rule above is unchanged; the per-tag loop runs inside the one cycle on the one node. The non-thinking-model requirement (above) still holds — the per-tag path calls the same `models.generate()` route.
81
87
 
@@ -88,7 +94,19 @@ For ADK agents, the nightly cycle **auto-promotes** these `scopeTag`-bearing can
88
94
  - **Content-safety, strict.** The claim is scanned for prompt injection and refused on a flag regardless of `FLAIR_CONTENT_SAFETY` — an unattended write does not fall back to warn-and-tag.
89
95
  - **Non-impersonating reviewer.** The promoted memory and its candidate record `machine:adk-auto-promote`, never a value mistakable for a human or agent reviewer.
90
96
 
91
- Anything ineligible (no scope tag, flagged content, already decided) is left pending for the human `rem promote` path. The step is bounded per cycle and non-fatal; `flair rem nightly run-once` reports the count auto-promoted. **Non-ADK candidates never auto-promote** — the human review gate below is unchanged for them.
97
+ Anything ineligible (no scope tag, flagged content) is left pending for the human `rem promote` path. The step is bounded per cycle and non-fatal. The per-call `limit` caps the eligible candidates the sweep attempts a memory write for, whatever the attempt's outcome (rejected or thrown attempts included), plus those it takes an earlier recorded memory for (below); the rest stay pending for a later cycle. `flair rem nightly run-once` reports the count auto-promoted. **Non-ADK candidates never auto-promote** — the human review gate below is unchanged for them.
98
+
99
+ The sweep writes and stamps the promoted memory, then marks the candidate `promoted`; it does not mark a candidate promoted before its memory is stamped. (A concurrent deletion of that memory is still possible.) When the candidate update throws, the memory is already written and stamped, and the throw does not say whether the update committed, so the sweep reads the candidate back. `POST /AutoPromoteCandidates` answers `{ agentId, promoted, skipped, incomplete, unconfirmed, count, considered }`:
100
+
101
+ - `promoted`: the memory id of each candidate whose promoted update this call wrote without a throw, or that the read-back found promoted on this memory. `count` is its length.
102
+ - `skipped`: `{ id, reason }` for each candidate the call left pending for a reason it names, for example `no_adk_scope_tag`, `content_safety:…`, `memory_write_error`, `stamp_refused` or `recorded_row_changed`.
103
+ - `incomplete`: `{ memoryId, candidateId, error }` for each promotion whose memory was written and stamped but whose candidate update threw, when the read-back then found the candidate `pending`.
104
+ - `unconfirmed`: `{ memoryId, candidateId, error, readBack }` for the same throw when the read-back failed, or found the candidate neither `pending` nor promoted on this memory: the promotion on this memory was not confirmed. `readBack` says what the read found.
105
+ - `considered`: the number of pending candidates the call examined.
106
+
107
+ The read-back establishes only the candidate's state at that moment (`pending`, or `promoted` on this memory with this reviewer), not whether this call's update is the write that produced it. Neither `incomplete` nor `unconfirmed` entries count in `promoted` or `count`; their memory write attempts do count toward the `limit`.
108
+
109
+ A later sweep re-reads a candidate that is still pending. It can use the memory recorded on the candidate (`promotedRowId`, `promotedRowInstanceToken`) only when that identity is present on the candidate. The sweep records it before the stamp; when the identity is absent (for example, the recording threw before it committed), the next sweep attempts a fresh write instead. The recorded memory must still be the one the sweep wrote (same id and incarnation token, same owner, content equal to the claim, the sweep's visibility, durability and tags, not archived). When it also carries the sweep's own approval — `promotionStatus` `approved`, `promotedBy` `machine:adk-auto-promote`, a `promotionContentHash` that matches its content, and a `promotedAt` — the sweep adopts it. It takes the memory's write lock, re-checks all of this on a fresh read, and, still holding the lock, marks the candidate `promoted` with `decidedAt` set to the memory's `promotedAt`. It writes no other memory and reports that memory id under `promoted` (or, if that update throws, under the read-back's outcome). An owner edit that changes the memory's content (or otherwise makes it fail these checks) and lands before the lock leaves the candidate pending (`recorded_row_changed`). One that waits for the lock lands after the candidate update. When that update is reported promoted, a content change clears the approval the same way it does on any promoted memory; an edit that changes no content need not. Memory's dedup gate only reports a near-duplicate, so this check is what prevents the second row. When the recorded memory does not qualify at the sweep's first read (for example, a different verdict, edited content, or archived), the sweep attempts a fresh write and stamp, either of which can fail or be refused. The approval check trusts Flair's resource write paths, where verdict fields are server-written; the admin operations API writes rows directly and can change them. `flair rem nightly run-once` prints the incomplete and unconfirmed counts on its `Auto-promoted:` line.
92
110
 
93
111
  ## Memory retention and deletion
94
112
 
@@ -100,6 +118,9 @@ What each tier actually guarantees:
100
118
  - persistent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it).
101
119
  - standard — routine maintenance archives it once its validTo passes or, as a session note, after 30 days.
102
120
  - ephemeral — routine maintenance reaps it once its TTL (24h by default) passes.
121
+
122
+ Maintenance runs are scoped: an agent's own run covers that agent's rows; an admin run that omits `agentId` is fleet-wide and expires or archives eligible rows of every agent; one that names an `agentId` covers that agent. An admin `agentId` must match the agent-id rule (`^[a-zA-Z0-9_-]{1,64}$`), so an agent whose stored id is outside the rule cannot be named in an admin-scoped run. That 400 names the rule and the remedy: run that agent's own authenticated non-admin maintenance, which reaches its rows, when the stored id can authenticate (the signed TPS-Ed25519 header cannot carry a colon or whitespace); for an id the header cannot represent, run fleet-wide maintenance, which reaches that agent's rows and also expires and archives other agents' eligible rows.
123
+
103
124
  - 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
125
 
105
126
  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.
@@ -7,11 +7,11 @@ Flair owns **identity**. Flair does **not** own arbitrary secrets. This page dra
7
7
  For each registered agent, Flair stores:
8
8
 
9
9
  - A **public key** in the `Agent` table (server-side; used to verify signed requests).
10
- - A **private key** at `~/.flair/keys/<agent>.key` on the host that owns that agent — the raw 32-byte Ed25519 seed. Created by `flair init --agent <id>` or `flair agent add <id>`. Mode `0600`.
10
+ - A **private key** at `~/.flair/keys/<agent>.key` on the host that owns that agent — a 32-byte Ed25519 seed, or an exported base64 key string that `flair import` restores unchanged. `flair init --agent <id>`, `flair agent add <id>`, `flair principal add`, `flair import`, and `flair agent rotate-key <id>` create or stage a new key owner-only (`0600`) from the first byte on POSIX; an existing key with group or world bits is refused with `chmod 600 <path>` and left unchanged on the create and reuse paths, while rotation reports it. A successful rotation replaces the file; a failed update leaves it. The keys directory is requested with mode `0700` (the umask may make it narrower; an owned directory with group or world bits is tightened). On Windows mode bits do not establish owner-only.
11
11
 
12
- Agents sign every request to Flair with this key. Flair refuses unsigned requests and refuses signatures that don't match the registered public key. The signed payload is `<agentId>:<timestamp>:<nonce>:<METHOD>:<path>` with a 30-second replay window and nonce dedup — replays inside that window are rejected.
12
+ Agents sign requests to Flair with this key. The server verifies signatures against the registered public key. The signed payload is `<agentId>:<timestamp>:<nonce>:<METHOD>:<path+query>` with a 30-second replay window and nonce dedup — replays inside that window are rejected.
13
13
 
14
- **This is the only secret material Flair manages.** Lose the key file and the agent is locked out (`flair agent rotate-key <id>` to issue a new pair).
14
+ Lose the key file and the agent is locked out (`flair agent rotate-key <id>` to issue a new pair).
15
15
 
16
16
  ## Flair admin password (Harper instance)
17
17
  - Fresh local `flair init` writes the supplied or generated admin password to `~/.flair/admin-pass` (mode `0o600`).
@@ -117,7 +117,7 @@ The pattern is identical across CLIs: the CLI config references env var names, y
117
117
 
118
118
  `claude` reads `ANTHROPIC_API_KEY` from the env. Set it via the wrapper-from-Keychain pattern above; never `claude --api-key sk-ant-...` (writes to shell history).
119
119
 
120
- The flair-mcp server (`@tpsdev-ai/flair-mcp`) reads `FLAIR_AGENT_ID` and (optionally) `FLAIR_KEY_PATH` from its own env block in `.mcp.json`. The Flair private key isn't a "secret" you load from Keychain — it's a key file that already lives at a fixed path with `0600` mode, owned by Flair.
120
+ The flair-mcp server (`@tpsdev-ai/flair-mcp`) reads `FLAIR_AGENT_ID` and (optionally) `FLAIR_KEY_PATH` from its own env block in `.mcp.json`. The Flair private key isn't a "secret" you load from Keychain — it's a key file on the signing host.
121
121
 
122
122
  ### Gemini CLI
123
123
 
@@ -137,10 +137,11 @@ Hermes uses `~/.hermes/.env` for provider API keys (managed by `hermes auth`). T
137
137
 
138
138
  ## What to do with the Flair private key itself
139
139
 
140
- `~/.flair/keys/<agent>.key` is the only secret Flair generates. Treat it like an SSH private key:
140
+ Treat `~/.flair/keys/<agent>.key` like an SSH private key:
141
141
 
142
142
  - **Stays on the host that owns the agent.** If your agent runs on a given host, the key lives on that host. If you spin up the same agent on another machine, **don't copy the key** — register a new agent identity (`flair agent add <id>-on-<other-host>`) on that machine. Different identities, same Flair instance can store memories for both, you decide cross-agent visibility.
143
- - **`chmod 600` enforced** by `flair agent add`. Don't relax it.
143
+ - **On POSIX, created owner-only (`0600`) from the first byte** by `flair agent add`, `flair init`, `flair principal add`, and `flair import`; an existing key with group or world bits is refused, not changed (`chmod 600 <path>`). `flair doctor` warns about such a key file, and `flair status` does the same for a local target, naming its mode and the fix; the check covers the standard `resolveKeyPath` locations: `$FLAIR_KEY_DIR/<agent>.key` when set, `~/.flair/keys/<agent>.key` and the legacy `~/.tps/secrets/flair/<agent>-priv.key`; explicit key paths (such as `--key`) are outside this scan; a symlinked agent key is reported as not checked. Don't relax it.
144
+ - `flair export --include-key` creates its default output exclusively at `0600` and refuses an existing path; with an explicit `--output` it replaces the file through a `0600` temp file. Keystore seeds replace existing files through a `0600` temp file. A generated passphrase is published at `0600` if its path is absent; when the generated passphrase file is used (`FLAIR_KEY_PASSPHRASE` unset), an existing file with group or world bits is refused unchanged before reading (`chmod 600 <path>`). On Windows the mode bits do not apply.
144
145
  - **Don't check it into git.** `.gitignore` should already exclude `~/.flair/keys/`; if you're ever tempted to share keys for "convenience," rotate first (`flair agent rotate-key <id>`).
145
146
  - **Backup separately**, encrypted. The `flair backup` command excludes private keys by default. Roll your own backup of `~/.flair/keys/` via age-encrypted archive if you want offsite recovery.
146
147
 
@@ -161,12 +162,6 @@ original path.
161
162
 
162
163
  Unreadable reference rows leave node-shaped files unidentified.
163
164
 
164
- ## What about a `flair secret` CLI?
165
-
166
- Considered, deferred. Flair could ship a thin wrapper around the OS keyring (`flair secret get/set/list`) — but the OS primitives already work and are universally trusted. Adding a Flair-shaped wrapper would mean we own the bug surface for marginal ergonomic gain. Better path: document the OS primitives well (this page) and stay focused on identity + memory.
167
-
168
- If you find yourself wanting one anyway, your agent can call `security find-generic-password` / `secret-tool lookup` / `op read` directly — no Flair involvement needed.
169
-
170
165
  ## Threat model summary
171
166
 
172
167
  | Asset | Owned by | If compromised → |
@@ -180,7 +175,7 @@ If you find yourself wanting one anyway, your agent can call `security find-gene
180
175
 
181
176
  Writes are scoped per `agentId` and isolation is enforced **server-side** by Ed25519 signature verification — not by client convention. An attacker with another agent's key can write memories as that agent, but cannot forge writes under *your* agent's identity without *your* key.
182
177
 
183
- Reads are a different, and intentionally more open, story: within one Flair instance (one org), **any** verified agent — not just an attacker with a stolen key — can already read **any other agent's non-private memory**. That's the shipped access model (open-within-org read; see [SECURITY.md](../SECURITY.md)), not a consequence of key compromise. A key leak's actual *incremental* exposure is narrower than "read your agent's memories": it's (1) the ability to write under that agent's identity, and (2) the ability to read that agent's `visibility: private` memories, which stay owner-only under normal operation. Non-private memories were already org-readable before the leak.
178
+ Reads are a different, and intentionally more open, story: within one Flair instance (one org), any verified agent — not just an attacker with a stolen key — passes the base visibility check for another agent's non-private memory; non-admin by-id and collection reads of retained closed skills additionally require readable current authority. That's the shipped access model (open-within-org read; see [SECURITY.md](../SECURITY.md)), not a consequence of key compromise. A key leak's actual *incremental* exposure is narrower than "read your agent's memories": it's (1) the ability to write under that agent's identity, and (2) the ability to read that agent's `visibility: private` memories, which restrict non-admin reads to their owner. Non-private memories pass the org-wide base visibility check, while non-admin Memory by-id and collection reads of retained closed skills remain subject to current authority.
184
179
 
185
180
  The hard boundary in this model is the **federation edge** — a separate Flair instance / org. That's a different threat model from password-based or API-key-based memory services where a leaked key gives access to the full namespace across every trust boundary, not just one org.
186
181
 
@@ -188,4 +183,4 @@ The hard boundary in this model is the **federation edge** — a separate Flair
188
183
 
189
184
  - [`docs/auth.md`](auth.md) — full auth scheme and signature format
190
185
  - [`docs/mcp-clients.md`](mcp-clients.md) — wiring the flair-mcp server into Claude Code / Gemini CLI / Codex CLI
191
- - [`packages/hermes-flair/README.md`](../packages/hermes-flair/README.md) — Hermes-specific plugin auth notes
186
+ - [`packages/hermes-flair/README.md`](https://github.com/tpsdev-ai/flair/blob/main/packages/hermes-flair/README.md) — Hermes-specific plugin auth notes
@@ -110,6 +110,8 @@ httpBind: 127.0.0.1 # HTTP bind host; 0.0.0.0 widens (must include IPv4 loopb
110
110
  | `FLAIR_EMBED_GPU_LAYERS` | GPU layers to offload. Unset derives Metal (`99`) on Apple Silicon with a usable Metal prebuilt, else CPU (`0`). Stated on `/Health`. | Pin CPU with `0` on a Metal Mac, or force a layer count. See [deployment.md](deployment.md#performance-related-environment-variables). |
111
111
  | `FLAIR_HYBRID_RETRIEVAL` | Hybrid BM25 + vector retrieval (default on). | Set `false` to revert to HNSW-only. |
112
112
  | `FLAIR_MODELS_DIR` | Directory the embedding GGUF is loaded from. | When the model lives outside `<data-dir>/models`. |
113
+ | `FLAIR_REQUEST_TIMEOUT_MS` | Whole-request deadline for REST calls through the CLI's shared REST sender (`authedRequest`), in milliseconds: an integer from `1` to `3600000`, default `300000` (5 minutes). It covers the request and the response body read. The four REM work routes listed under `FLAIR_REM_REQUEST_TIMEOUT_MS` resolve that variable instead, and any request that passes its own explicit deadline — those routes or a command's own — is validated and returned before this variable is read. On expiry a GET or HEAD fails; every other method through that sender raises an outcome-unknown error and is not retried, and `flair rem restore` does not write that table and record id again in the same run. An empty or whitespace-only value is unset. | When a legitimate request needs longer than the default. A value outside the range, or a non-integer, is refused for the requests that resolve this variable. |
114
+ | `FLAIR_REM_REQUEST_TIMEOUT_MS` | Whole-request deadline for the REM work routes `POST /MemoryMaintenance`, `POST /ReflectMemories`, `POST /MemoryDedupStats` and `POST /AutoPromoteCandidates`, in milliseconds: an integer from `1` to `3600000`, default `1800000` (30 minutes). It overrides `FLAIR_REQUEST_TIMEOUT_MS` for those routes and is read only for them; every other request through the shared REST sender that passes no explicit deadline resolves `FLAIR_REQUEST_TIMEOUT_MS`, else the shared default. An empty or whitespace-only value is unset. | When a REM work route legitimately needs longer than 30 minutes. A value outside the range, or a non-integer, is refused for those routes before the request is sent. |
113
115
 
114
116
  ---
115
117
 
@@ -205,15 +207,40 @@ See [upgrade.md](upgrade.md) for the full walkthrough including re-embedding, ro
205
207
  ## Backup & restore
206
208
 
207
209
  ```bash
208
- # Backup all data (agents, memories, souls)
210
+ # Backup all data (agents, memories, souls). Writes the archive and, beside it,
211
+ # flair-backup-YYYYMMDD.json.sha256
209
212
  flair backup --output ~/flair-backup-$(date +%Y%m%d).json
210
213
 
211
- # Restore to a fresh instance
214
+ # Restore an archive (its .sha256 sidecar sits beside it, unless the archive is approved on this host; see below)
212
215
  flair restore ~/flair-backup-20260405.json
213
216
  ```
214
217
 
215
218
  Always backup before upgrades. `flair backup` excludes private keys.
216
219
 
220
+ Restore writes each archived Agent row through the Agent resource's administrator PUT, so the PUT's field rules apply: the target's stored `createdAt`, `publicKey`, `originatorInstanceId` and federation fields are kept, `updatedAt` is set by the server, and `role` and `admin` are reconciled (an archived row with `role: "agent"` and `admin: true` is stored as an admin, with `role: "admin"`). Restore's read-back of an Agent row currently verifies its id only, so a field the PUT set differently from the archive is not reported. An archived Agent row whose agent does not exist on the target is refused (HTTP 404, `agent_put_requires_existing`), so restore reports it as failed and exits non-zero; a full restore into a fresh instance needs a creation route for agents ([flair#2703](https://github.com/tpsdev-ai/flair/issues/2703)). Soul and Memory rows are still written, and restore reports a mismatch in the fields it verifies for them (the selected fields in `src/lib/restore-verify.ts`; server-managed fields such as `provenance` and `updatedAt` are excluded). Archived promotion verdicts are not restored either: restore reports a Memory row that carries one as failed (HTTP 403) unless the stored row already carries the same verdict.
221
+
222
+ `flair backup` writes two files: the archive and `<archive>.sha256`, the SHA-256 of the archive's exact bytes in `sha256sum` format (from the archive's directory, `shasum -a 256 -c <archive>.sha256` or GNU `sha256sum -c <archive>.sha256` checks it; for a file name containing a carriage return, use GNU `sha256sum`). Keep and move the two files together. `flair restore` verifies the pair before it sends any request, `--dry-run` included. It refuses an archive whose sidecar does not match, and an archive with no sidecar unless that archive is approved on this host (below). The sidecar detects a damaged, truncated or mismatched file; it does not prove who wrote the archive.
223
+
224
+ ### Restoring an archive written before digest sidecars
225
+
226
+ An archive with no `.sha256` sidecar is restored only after the operator approves its exact bytes on the host that restores it:
227
+
228
+ ```bash
229
+ # 1. Print the archive's SHA-256. This approves nothing and needs no credentials.
230
+ flair backup-approval legacy-admit ~/flair-backup-20250101.json
231
+
232
+ # 2. Compare that digest with a record you trust, then approve exactly those bytes.
233
+ flair backup-approval legacy-admit ~/flair-backup-20250101.json \
234
+ --confirm-digest 3f5c...e1a9 --admin-pass-file ~/.flair/admin-pass
235
+
236
+ # 3. Restore it.
237
+ flair restore ~/flair-backup-20250101.json
238
+ ```
239
+
240
+ Approving, a confirmed legacy admission (with `--confirm-digest`) and revoking need operator credentials: the admin password, which the command checks as a super_user against this host's running Flair. It finds the operations port from `--ops-port`, `FLAIR_OPS_PORT`, the local config, or the HTTP port minus one. Approvals live in `~/.flair/approved-archives/`, which must be owned by you: its directories mode `0700` and its record and archive files mode `0600` (a private temp file left by an interrupted approval is ignored; any other entry is refused before the store creates anything). The store keeps a copy of each approved archive under its SHA-256 and a record of when and by whom it was approved. No REST route can approve, revoke, list or read it. `flair backup-approval list` shows the approvals and checks each stored copy; `flair backup-approval revoke <sha256>` withdraws one. Restore uses an approval, of either kind, only while it is unrevoked and its stored copy still hashes to the archive's digest, and it restores that stored copy.
241
+
242
+ An approval authorizes those bytes on this host until you revoke it, so restoring an older approved archive deliberately is possible. It does not show where the archive came from, that a past promotion decision in it was right, or that an archive without a sidecar is unchanged since it was written. `flair backup-approval approve <archive>` records an approval for an archive that has its sidecar; `flair restore` does not need one for such an archive.
243
+
217
244
  ---
218
245
 
219
246
  ## Federation