@tpsdev-ai/flair 0.59.0 → 0.63.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 (359) hide show
  1. package/README.md +10 -10
  2. package/SECURITY.md +49 -5
  3. package/config.yaml +23 -12
  4. package/dist/bridges/builtins/mem0.js +63 -28
  5. package/dist/bridges/runtime/execute.js +1 -0
  6. package/dist/bridges/runtime/import-runner.js +12 -0
  7. package/dist/bridges/runtime/load-plugin.js +42 -13
  8. package/dist/bridges/runtime/yaml-loader.js +4 -2
  9. package/dist/bridges/types.js +1 -0
  10. package/dist/build-info.json +3 -3
  11. package/dist/cli.js +1054 -367
  12. package/dist/commands/agent.js +233 -90
  13. package/dist/commands/attention.js +4 -3
  14. package/dist/commands/backup-approval.js +218 -0
  15. package/dist/commands/backup.js +211 -39
  16. package/dist/commands/bootstrap.js +3 -1
  17. package/dist/commands/bridge.js +172 -119
  18. package/dist/commands/deploy.js +71 -8
  19. package/dist/commands/doctor.js +711 -146
  20. package/dist/commands/export.js +57 -23
  21. package/dist/commands/federation.js +787 -82
  22. package/dist/commands/grant.js +5 -6
  23. package/dist/commands/help.js +25 -0
  24. package/dist/commands/hook.js +155 -2
  25. package/dist/commands/idp.js +27 -19
  26. package/dist/commands/import.js +136 -20
  27. package/dist/commands/init.js +469 -200
  28. package/dist/commands/integrity.js +387 -0
  29. package/dist/commands/keys.js +247 -58
  30. package/dist/commands/mcp.js +108 -52
  31. package/dist/commands/memory.js +203 -35
  32. package/dist/commands/migrate-harness-memory.js +3 -2
  33. package/dist/commands/orgevent.js +51 -47
  34. package/dist/commands/presence.js +4 -3
  35. package/dist/commands/principal.js +428 -62
  36. package/dist/commands/quality.js +13 -1
  37. package/dist/commands/reembed.js +141 -17
  38. package/dist/commands/relationship.js +2 -1
  39. package/dist/commands/rem.js +537 -80
  40. package/dist/commands/restore.js +413 -65
  41. package/dist/commands/search.js +6 -4
  42. package/dist/commands/service.js +235 -40
  43. package/dist/commands/soul.js +4 -9
  44. package/dist/commands/status.js +94 -38
  45. package/dist/commands/test.js +7 -3
  46. package/dist/commands/upgrade.js +77 -23
  47. package/dist/commands/workspace.js +13 -11
  48. package/dist/component-env.js +31 -41
  49. package/dist/deploy.js +136 -4
  50. package/dist/doctor-client.js +534 -92
  51. package/dist/engine-version-contract.js +1 -0
  52. package/dist/engine-version.js +23 -3
  53. package/dist/fabric-upgrade.js +12 -2
  54. package/dist/federation/presence-send.js +139 -0
  55. package/dist/federation-verify.js +273 -180
  56. package/dist/hook-install.js +670 -6
  57. package/dist/install/clients.js +171 -35
  58. package/dist/keystore.js +72 -0
  59. package/dist/lib/action-recall-runtime.js +328 -0
  60. package/dist/lib/agent-home-fields.js +132 -0
  61. package/dist/lib/agent-home.js +427 -0
  62. package/dist/lib/agent-id-rule.js +88 -0
  63. package/dist/lib/agent-roster.js +33 -0
  64. package/dist/lib/atomic-write.js +1 -1
  65. package/dist/lib/auth-resolve.js +1069 -60
  66. package/dist/lib/backup-approval-store.js +612 -0
  67. package/dist/lib/backup-artifact.js +343 -0
  68. package/dist/lib/capture-runtime.js +124 -0
  69. package/dist/lib/config-critical-section.js +212 -25
  70. package/dist/lib/connect-phase.js +33 -0
  71. package/dist/lib/credential-status-rule.js +78 -0
  72. package/dist/lib/daemon-liveness.js +43 -11
  73. package/dist/lib/doctor-run.js +75 -37
  74. package/dist/lib/durability-copy.js +10 -0
  75. package/dist/lib/embedding-space-doctor.js +75 -0
  76. package/dist/lib/federation-pair-access.js +4 -0
  77. package/dist/lib/federation-retry-queue.js +283 -0
  78. package/dist/lib/federation-retry-row.js +101 -0
  79. package/dist/lib/flair-agent-role.js +4 -0
  80. package/dist/lib/hub-url.js +12 -0
  81. package/dist/lib/init-admin-pass.js +88 -12
  82. package/dist/lib/init-listener-environ.js +1 -2
  83. package/dist/lib/init-occupied-listener.js +15 -111
  84. package/dist/lib/init-spawn-attribution.js +73 -0
  85. package/dist/lib/init-tcp-probe.js +33 -0
  86. package/dist/lib/instance-identity-row.js +20 -0
  87. package/dist/lib/instruction-event-contract.js +17 -0
  88. package/dist/lib/instruction-event-doctor.js +102 -0
  89. package/dist/lib/launchd-management.js +38 -3
  90. package/dist/lib/listener-table.js +268 -0
  91. package/dist/lib/local-delete-instance.js +27 -0
  92. package/dist/lib/local-instance-pair.js +256 -0
  93. package/dist/lib/mcp-enable.js +1182 -341
  94. package/dist/lib/mcp-oauth-env-core.js +133 -0
  95. package/dist/lib/mcp-oauth-env.js +125 -0
  96. package/dist/lib/mcp-spec.js +17 -1
  97. package/dist/lib/memory-attributes.js +4 -0
  98. package/dist/lib/memory-id-policy.js +46 -0
  99. package/dist/lib/memory-integrity.js +309 -0
  100. package/dist/lib/memory-provider-timeout.js +33 -0
  101. package/dist/lib/memory-purge-response.js +20 -0
  102. package/dist/lib/mqtt-config.js +132 -0
  103. package/dist/lib/mqtt-listener-doctor.js +104 -0
  104. package/dist/lib/open-live-row.js +20 -0
  105. package/dist/lib/ops-table-count.js +25 -0
  106. package/dist/lib/ops-url.js +52 -0
  107. package/dist/lib/owned-pins.js +67 -10
  108. package/dist/lib/peer-status.js +27 -0
  109. package/dist/lib/principal-status.js +29 -0
  110. package/dist/lib/process-start-time.js +76 -12
  111. package/dist/lib/promotion-content-hash.js +20 -0
  112. package/dist/lib/proto-safe-record.js +42 -0
  113. package/dist/lib/record-id-path.js +25 -0
  114. package/dist/lib/reembed-server-support.js +66 -0
  115. package/dist/lib/restore-archive.js +760 -0
  116. package/dist/lib/restore-verify.js +104 -0
  117. package/dist/lib/scheduler-platform.js +10 -6
  118. package/dist/lib/secret-keys.js +25 -0
  119. package/dist/lib/secrets-push.js +50 -22
  120. package/dist/lib/skill-assignment-preflight.js +159 -0
  121. package/dist/lib/skill-seed-pending.js +24 -0
  122. package/dist/lib/skill-seed.js +448 -0
  123. package/dist/lib/skill-tombstone-doctor.js +133 -0
  124. package/dist/lib/soul-scope-fields.js +26 -0
  125. package/dist/lib/stop-start-recovery.js +54 -0
  126. package/dist/lib/uninstall-purge.js +266 -11
  127. package/dist/lib/upgrade-prior-liveness.js +2 -1
  128. package/dist/lib/using-flair-skill.js +87 -0
  129. package/dist/mcp-client-assertion.js +114 -14
  130. package/dist/memory-id-checkpoint.js +347 -0
  131. package/dist/memory-node-compare.js +207 -0
  132. package/dist/mqtt-off-deploy.js +550 -0
  133. package/dist/packages/flair-mcp/src/secret-redaction.js +113 -0
  134. package/dist/rem/promote-policy.js +3 -3
  135. package/dist/rem/restore.js +303 -26
  136. package/dist/rem/runner.js +317 -96
  137. package/dist/rem/scheduler.js +21 -4
  138. package/dist/resources/A2AAdapter.js +131 -178
  139. package/dist/resources/AdminMemory.js +2 -0
  140. package/dist/resources/AdminMemoryCandidates.js +116 -0
  141. package/dist/resources/Agent.js +463 -33
  142. package/dist/resources/AgentCard.js +4 -0
  143. package/dist/resources/AgentKeyRegister.js +248 -0
  144. package/dist/resources/AgentKeyRegistration.js +28 -0
  145. package/dist/resources/AgentReadPosition.js +7 -0
  146. package/dist/resources/AgentSeed.js +238 -107
  147. package/dist/resources/AutoPromoteCandidates.js +413 -78
  148. package/dist/resources/Credential.js +183 -10
  149. package/dist/resources/Federation.js +915 -145
  150. package/dist/resources/FederationRetry.js +140 -0
  151. package/dist/resources/InstructionVersion.js +220 -0
  152. package/dist/resources/Integration.js +300 -25
  153. package/dist/resources/MCPClientMetadata.js +6 -3
  154. package/dist/resources/Memory.js +3300 -758
  155. package/dist/resources/MemoryArchive.js +171 -53
  156. package/dist/resources/MemoryBootstrap.js +122 -61
  157. package/dist/resources/MemoryCandidate.js +37 -3
  158. package/dist/resources/MemoryConsolidate.js +2 -2
  159. package/dist/resources/MemoryDedupStats.js +30 -1
  160. package/dist/resources/MemoryFeed.js +545 -50
  161. package/dist/resources/MemoryGrant.js +21 -1
  162. package/dist/resources/MemoryMaintenance.js +368 -46
  163. package/dist/resources/MemoryPurge.js +348 -0
  164. package/dist/resources/MemoryReflect.js +71 -12
  165. package/dist/resources/MemoryReindex.js +111 -17
  166. package/dist/resources/Message.js +16 -5
  167. package/dist/resources/OAuth.js +342 -48
  168. package/dist/resources/OAuthClient.js +1 -1
  169. package/dist/resources/OrgEvent.js +405 -19
  170. package/dist/resources/OrgEventCatchup.js +7 -0
  171. package/dist/resources/OrgEventMaintenance.js +48 -10
  172. package/dist/resources/PairingToken.js +1 -1
  173. package/dist/resources/Presence.js +166 -51
  174. package/dist/resources/PromoteMemoryCandidate.js +24 -7
  175. package/dist/resources/RecordUsage.js +2 -4
  176. package/dist/resources/Relationship.js +23 -0
  177. package/dist/resources/SemanticSearch.js +63 -32
  178. package/dist/resources/Soul.js +191 -76
  179. package/dist/resources/SoulFeed.js +2 -1
  180. package/dist/resources/TeamDirectory.js +35 -0
  181. package/dist/resources/WorkspaceLatest.js +4 -0
  182. package/dist/resources/WorkspaceState.js +21 -1
  183. package/dist/resources/XAA.js +207 -63
  184. package/dist/resources/a2a-stream.js +313 -0
  185. package/dist/resources/a2a-url.js +4 -5
  186. package/dist/resources/agent-admin.js +10 -1
  187. package/dist/resources/agent-auth.js +138 -83
  188. package/dist/resources/agent-read-position-lib.js +4 -1
  189. package/dist/resources/agent-status-guard.js +9 -7
  190. package/dist/resources/auth-middleware.js +534 -171
  191. package/dist/resources/authority-field-guard.js +9 -11
  192. package/dist/resources/auto-promote-lib.js +8 -5
  193. package/dist/resources/basic-auth-header.js +21 -0
  194. package/dist/resources/bm25-index-service.js +4 -5
  195. package/dist/resources/dedup-cluster.js +6 -1
  196. package/dist/resources/ed25519-auth.js +1 -1
  197. package/dist/resources/embedding-space-guard.js +366 -72
  198. package/dist/resources/embeddings-provider.js +25 -0
  199. package/dist/resources/engine-version-stamp-boot.js +53 -0
  200. package/dist/resources/federation-classify.js +161 -0
  201. package/dist/resources/federation-crypto.js +5 -5
  202. package/dist/resources/federation-retry-lib.js +60 -0
  203. package/dist/resources/grant-visibility.js +135 -0
  204. package/dist/resources/harper-routing.js +83 -0
  205. package/dist/resources/health.js +163 -22
  206. package/dist/resources/host-pointer/registry.js +29 -0
  207. package/dist/resources/host-pointer-adapter.js +1 -0
  208. package/dist/resources/host-source-citation.js +49 -0
  209. package/dist/resources/host-source-visibility.js +7 -6
  210. package/dist/resources/in-process.js +24 -22
  211. package/dist/resources/instance-create-lock.js +17 -0
  212. package/dist/resources/instance-identity.js +23 -0
  213. package/dist/resources/instruction-version-record.js +587 -0
  214. package/dist/resources/internal-authority.js +13 -0
  215. package/dist/resources/key-lock.js +3 -3
  216. package/dist/resources/mcp-handler.js +141 -19
  217. package/dist/resources/mcp-oauth-env-guard.js +36 -0
  218. package/dist/resources/mcp-oauth-flag.js +12 -14
  219. package/dist/resources/mcp-oauth.js +450 -56
  220. package/dist/resources/mcp-tool-arguments.js +4 -6
  221. package/dist/resources/mcp-tools.js +187 -40
  222. package/dist/resources/memory-bootstrap-lib.js +5 -15
  223. package/dist/resources/memory-declared-attributes.js +4 -1
  224. package/dist/resources/memory-deletion-history.js +55 -0
  225. package/dist/resources/memory-durability.js +54 -0
  226. package/dist/resources/memory-embed-hash.js +144 -0
  227. package/dist/resources/memory-embedding-value.js +8 -0
  228. package/dist/resources/memory-host-source.js +32 -7
  229. package/dist/resources/memory-id-guard.js +75 -0
  230. package/dist/resources/memory-redaction.js +236 -0
  231. package/dist/resources/memory-reflect-lib.js +1 -1
  232. package/dist/resources/memory-supplied-vector.js +72 -0
  233. package/dist/resources/memory-write-lock.js +489 -0
  234. package/dist/resources/memory-write-response.js +139 -0
  235. package/dist/resources/memory-write-transaction.js +243 -0
  236. package/dist/resources/migration-boot.js +17 -12
  237. package/dist/resources/migrations/boot-progress.js +25 -0
  238. package/dist/resources/migrations/data-dir.js +90 -19
  239. package/dist/resources/migrations/dir-safety.js +61 -3
  240. package/dist/resources/migrations/embedding-stamp.js +462 -82
  241. package/dist/resources/migrations/export.js +1 -0
  242. package/dist/resources/migrations/graph-heal.js +27 -27
  243. package/dist/resources/migrations/ledger.js +5 -2
  244. package/dist/resources/migrations/lock.js +870 -77
  245. package/dist/resources/migrations/progress.js +71 -10
  246. package/dist/resources/migrations/runner.js +212 -18
  247. package/dist/resources/migrations/snapshot.js +1 -0
  248. package/dist/resources/migrations/source-fields.js +5 -5
  249. package/dist/resources/migrations/state.js +36 -1
  250. package/dist/resources/migrations/status.js +2 -13
  251. package/dist/resources/migrations/synthetic-test-migration.js +81 -12
  252. package/dist/resources/migrations/types.js +26 -1
  253. package/dist/resources/migrations/visibility-backfill.js +113 -72
  254. package/dist/resources/oauth-discovery.js +0 -5
  255. package/dist/resources/object-body-guard.js +40 -0
  256. package/dist/resources/org-event-created-at.js +133 -0
  257. package/dist/resources/org-event-reserved.js +92 -0
  258. package/dist/resources/org-event-write-fault.js +19 -0
  259. package/dist/resources/originator-instance.js +39 -7
  260. package/dist/resources/owner-delete-recheck.js +78 -0
  261. package/dist/resources/owner-field-guard.js +39 -5
  262. package/dist/resources/owner-scoped-write-policy.js +256 -0
  263. package/dist/resources/owner-scoped-writes.js +89 -0
  264. package/dist/resources/path-id-rewrite.js +76 -0
  265. package/dist/resources/presence-internal.js +5 -5
  266. package/dist/resources/presence-receipt.js +236 -0
  267. package/dist/resources/promotion-binding.js +43 -0
  268. package/dist/resources/promotion-stamp.js +143 -17
  269. package/dist/resources/protocol-context.js +189 -0
  270. package/dist/resources/record-owner-guard.js +74 -26
  271. package/dist/resources/record-type-kit.js +2 -4
  272. package/dist/resources/record-types.js +1 -1
  273. package/dist/resources/relay-ops.js +78 -6
  274. package/dist/resources/replay-store.js +96 -19
  275. package/dist/resources/request-target.js +163 -0
  276. package/dist/resources/request-transaction.js +46 -1
  277. package/dist/resources/search-readiness.js +4 -1
  278. package/dist/resources/seed-ids.js +9 -0
  279. package/dist/resources/seed-reservation.js +116 -0
  280. package/dist/resources/semantic-retrieval-core.js +27 -15
  281. package/dist/resources/server-row-validation.js +71 -0
  282. package/dist/resources/skill-manifest.js +24 -14
  283. package/dist/resources/skill-subject.js +53 -0
  284. package/dist/resources/skill-version-write.js +789 -0
  285. package/dist/resources/skill-write-fault.js +20 -0
  286. package/dist/resources/skill-write-policy.js +68 -0
  287. package/dist/resources/skill-write.js +67 -7
  288. package/dist/resources/soul-write-policy.js +26 -7
  289. package/dist/resources/table-helpers.js +10 -7
  290. package/dist/resources/table-subscription-policy.js +518 -85
  291. package/dist/resources/table-subscriptions.js +20 -7
  292. package/dist/resources/team-directory.js +248 -0
  293. package/dist/resources/tool-descriptors/index.js +69 -8
  294. package/dist/resources/txn-pause-point.js +235 -0
  295. package/dist/resources/usage-recording.js +186 -70
  296. package/dist/resources/write-back.js +383 -0
  297. package/dist/resources/write-journal-context.js +5 -0
  298. package/dist/resources/write-journal.js +289 -0
  299. package/dist/src/engine-version-contract.js +1 -0
  300. package/dist/src/keystore.js +72 -0
  301. package/dist/src/lib/agent-home-fields.js +132 -0
  302. package/dist/src/lib/agent-id-rule.js +88 -0
  303. package/dist/src/lib/agent-key-register.js +80 -0
  304. package/dist/src/lib/atomic-write.js +256 -0
  305. package/dist/src/lib/credential-status-rule.js +78 -0
  306. package/dist/src/lib/expired-by-agent.js +37 -0
  307. package/dist/src/lib/federation-retry-row.js +101 -0
  308. package/dist/src/lib/flair-agent-role.js +4 -0
  309. package/dist/src/lib/idp-mapping-rule.js +81 -0
  310. package/dist/src/lib/instance-identity-row.js +20 -0
  311. package/dist/src/lib/instruction-event-contract.js +17 -0
  312. package/dist/src/lib/mcp-oauth-env-core.js +133 -0
  313. package/dist/src/lib/memory-attributes.js +4 -0
  314. package/dist/src/lib/memory-id-policy.js +46 -0
  315. package/dist/src/lib/open-live-row.js +20 -0
  316. package/dist/src/lib/principal-status.js +29 -0
  317. package/dist/src/lib/proto-safe-record.js +42 -0
  318. package/dist/src/lib/reembed-server-support.js +66 -0
  319. package/dist/src/lib/scheduler-platform.js +10 -6
  320. package/dist/src/lib/soul-scope-fields.js +26 -0
  321. package/dist/src/lib/systemd-agent-id.js +38 -0
  322. package/dist/src/rem/promote-policy.js +3 -3
  323. package/dist/src/rem/scheduler.js +21 -4
  324. package/docs/access-control.md +164 -54
  325. package/docs/api-reference.md +165 -32
  326. package/docs/auth.md +46 -30
  327. package/docs/bridges.md +11 -0
  328. package/docs/claude-code.md +37 -7
  329. package/docs/deploying-on-fabric.md +178 -0
  330. package/docs/deployment.md +19 -0
  331. package/docs/embedding-in-a-harper-app.md +17 -15
  332. package/docs/entity-vocabulary.md +3 -6
  333. package/docs/federation.md +61 -3
  334. package/docs/hosted-on-fabric.md +43 -36
  335. package/docs/integrations.md +14 -14
  336. package/docs/mcp-clients.md +12 -7
  337. package/docs/n8n.md +17 -11
  338. package/docs/notes/mcp-agent-auth-consumer.md +16 -13
  339. package/docs/notes/mcp-oauth-model2.md +40 -11
  340. package/docs/openclaw.md +1 -1
  341. package/docs/quickstart-fabric.md +4 -4
  342. package/docs/quickstart.md +12 -4
  343. package/docs/releasing.md +25 -19
  344. package/docs/rem.md +32 -3
  345. package/docs/secrets-and-keys.md +21 -4
  346. package/docs/standalone-local.md +30 -2
  347. package/docs/supply-chain-policy.md +34 -16
  348. package/docs/the-team.md +2 -2
  349. package/docs/upgrade.md +46 -6
  350. package/package.json +24 -12
  351. package/schemas/agent-key-registration.graphql +22 -0
  352. package/schemas/agent.graphql +6 -3
  353. package/schemas/federation.graphql +41 -1
  354. package/schemas/memory.graphql +91 -7
  355. package/schemas/oauth.graphql +19 -0
  356. package/schemas/schema.graphql +2 -0
  357. package/templates/bin/flair-rem-nightly.sh.tmpl +7 -1
  358. package/templates/launchd/start-flair-with-admin-pass.sh +188 -10
  359. package/dist/resources/soul-adk-guard.js +0 -68
@@ -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
@@ -146,7 +154,7 @@ flair memory add --agent local --visibility shared \
146
154
 
147
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.
148
156
 
149
- 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).
150
158
 
151
159
  ## 5. Find it back by meaning
152
160
 
@@ -169,7 +177,7 @@ Add `--explain` to see the ranking inputs per hit — the raw score, the composi
169
177
 
170
178
  ## 6. Give your agent context on boot
171
179
 
172
- 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 -->
173
181
 
174
182
  ```
175
183
  At the start of every session, run mcp__flair__bootstrap before responding.
@@ -194,7 +202,7 @@ Soul entries and relevant memories, in one block sized to a token budget. Paste
194
202
  | You want to... | Go to |
195
203
  |----------------|-------|
196
204
  | Add more agents to the same instance | `flair agent add <id>` |
197
- | 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)) |
198
206
  | Import memories from agentic-stack / Mem0 / etc. | [bridges.md](bridges.md) |
199
207
  | Sync memories across machines | [federation.md](federation.md) |
200
208
  | Integrate with OpenClaw, Claude Code, Cursor | [README.md#integration](../README.md#integration) |
package/docs/releasing.md CHANGED
@@ -30,10 +30,10 @@ There is no "fix the stage in place" — you reject it and re-cut the next patch
30
30
  latest moves
31
31
  ```
32
32
 
33
- The `vX.Y.Z` tag triggers the release. This replaces the old "run
34
- `release.sh --publish` from a laptop logged into npm" flow. Nothing publishes without
35
- a human 2FA approval, and every package ships with a provenance attestation (public
36
- repo → verifiable build origin).
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.
37
37
 
38
38
  ## Cutting a release
39
39
 
@@ -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
 
@@ -100,8 +100,8 @@ git tag v0.11.0 && git push origin v0.11.0
100
100
  > When the release commit's tree carries
101
101
  > `packages/adk-flair/pyproject.toml` whose `[project].version` equals the version
102
102
  > being tagged, the auto-tagger ALSO creates `adk-flair-v<version>` from the same
103
- > commit — so the PyPI publish run then needs only the environment gate its owner
104
- > 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.
105
105
  >
106
106
  > The project version is read with Python's `tomllib` — the SAME reader
107
107
  > `.github/workflows/adk-flair-publish.yml` decides with — by handing the file to
@@ -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
@@ -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
@@ -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,10 +94,33 @@ 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
 
95
113
  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
114
 
115
+ What each tier actually guarantees:
116
+
117
+ - 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.
118
+ - persistent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it).
119
+ - standard — routine maintenance archives it once its validTo passes or, as a session note, after 30 days.
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
+
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.
125
+
97
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.
@@ -14,11 +14,11 @@ Agents sign every request to Flair with this key. Flair refuses unsigned request
14
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).
15
15
 
16
16
  ## Flair admin password (Harper instance)
17
- - If not provided via `--admin-pass`, `--admin-pass-file`, `FLAIR_ADMIN_PASS`, or `HDB_ADMIN_PASSWORD`, a random password is generated and written to `~/.flair/admin-pass` (mode `0o600`). The password is **not** printed to the console.
17
+ - Fresh local `flair init` writes the supplied or generated admin password to `~/.flair/admin-pass` (mode `0o600`).
18
18
  - The `--admin-pass-file <path>` option allows reading the password from a file (for pre-staged secrets).
19
19
  - The `--admin-pass <pass>` option is deprecated due to shell history exposure; use `--admin-pass-file` or environment variables instead. A warning is printed when this option is used.
20
20
  - Environment variables `FLAIR_ADMIN_PASS` and `HDB_ADMIN_PASSWORD` are also supported.
21
- - After the first start, Harper's persisted user hash is the source of truth. `HDB_ADMIN_PASSWORD` will not rotate it. If `~/.flair/admin-pass` is missing and the data dir already has a user, `flair init` refuses rather than writing a file that 401s. Recovery is exact: `flair init --admin-pass-file <path>` if you have the original, or `flair init --reset-admin-pass` to rotate through the operations socket and rewrite the file.
21
+ - After the first start, Harper's persisted user hash is the source of truth. `HDB_ADMIN_PASSWORD` will not rotate it. Without `--reset-admin-pass`, supplied credentials are refused when no instance is running and an admin-pass file or persisted admin user exists, except that `--skip-start` can reuse an identical securely read credential.
22
22
  ## What Flair does *not* own: API keys, tokens, third-party credentials
23
23
 
24
24
  Things that are NOT Flair's job:
@@ -144,6 +144,23 @@ Hermes uses `~/.hermes/.env` for provider API keys (managed by `hermes auth`). T
144
144
  - **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
145
  - **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
146
 
147
+ ## Key cleanup
148
+
149
+ `flair keys prune` classifies every `.key` file in the key directory and, with
150
+ `--apply`, moves prunable keys into `<keysDir>/.pruned/<date>/`; keys with
151
+ refused sidecars stay in place.
152
+ It never deletes a file itself. A move can still replace an entry that a
153
+ concurrent writer creates at the destination before the move lands: the selected
154
+ archive name, or, when a failed key move rolls its sidecar back, the sidecar's
155
+ original path.
156
+
157
+ - Agent signing keys whose seed parses are prunable when the agent is not
158
+ registered on the targeted instance, except node-shaped files without `.pub`.
159
+ - Node-shaped files (`flair_<hex8>.key` without `.pub`) stay report-only.
160
+ Minting attempts to record a sidecar; sidecar-write failure leaves them report-only.
161
+
162
+ Unreadable reference rows leave node-shaped files unidentified.
163
+
147
164
  ## What about a `flair secret` CLI?
148
165
 
149
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.
@@ -163,7 +180,7 @@ If you find yourself wanting one anyway, your agent can call `security find-gene
163
180
 
164
181
  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.
165
182
 
166
- 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.
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 — 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 stay owner-only under normal operation. 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.
167
184
 
168
185
  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.
169
186
 
@@ -171,4 +188,4 @@ The hard boundary in this model is the **federation edge** — a separate Flair
171
188
 
172
189
  - [`docs/auth.md`](auth.md) — full auth scheme and signature format
173
190
  - [`docs/mcp-clients.md`](mcp-clients.md) — wiring the flair-mcp server into Claude Code / Gemini CLI / Codex CLI
174
- - [`packages/hermes-flair/README.md`](../packages/hermes-flair/README.md) — Hermes-specific plugin auth notes
191
+ - [`packages/hermes-flair/README.md`](https://github.com/tpsdev-ai/flair/blob/main/packages/hermes-flair/README.md) — Hermes-specific plugin auth notes
@@ -45,6 +45,7 @@ flair init --agent mybot # name the agent (--agent-id also works)
45
45
  flair init --client claude-code # wire one specific MCP client
46
46
  flair init --no-mcp # instance + agent only, skip MCP wiring
47
47
  flair init --skip-smoke # skip the MCP smoke test
48
+ flair init --skip-start # do not start Harper; with --agent, defer registration
48
49
  flair init --port 8000 # use a non-default port
49
50
  ```
50
51
 
@@ -109,6 +110,8 @@ httpBind: 127.0.0.1 # HTTP bind host; 0.0.0.0 widens (must include IPv4 loopb
109
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). |
110
111
  | `FLAIR_HYBRID_RETRIEVAL` | Hybrid BM25 + vector retrieval (default on). | Set `false` to revert to HNSW-only. |
111
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. |
112
115
 
113
116
  ---
114
117
 
@@ -204,15 +207,40 @@ See [upgrade.md](upgrade.md) for the full walkthrough including re-embedding, ro
204
207
  ## Backup & restore
205
208
 
206
209
  ```bash
207
- # 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
208
212
  flair backup --output ~/flair-backup-$(date +%Y%m%d).json
209
213
 
210
- # 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)
211
215
  flair restore ~/flair-backup-20260405.json
212
216
  ```
213
217
 
214
218
  Always backup before upgrades. `flair backup` excludes private keys.
215
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
+
216
244
  ---
217
245
 
218
246
  ## Federation
@@ -15,7 +15,6 @@ We don't pull in any newly-published dep version for **at least 7 days** after i
15
15
  - The most-attacked window is "compromise published, defenders haven't yet noticed." Most malicious packages get flagged by Socket.dev, npm advisory, GitHub security advisory, or human reports within 1-7 days. Our delay puts us behind that detection front.
16
16
  - pnpm 11 shipped this as a default at 1 day (May 4 2026). We chose 7 as a more conservative posture for a security-adjacent project.
17
17
  - Workspace-internal `@tpsdev-ai/*` deps are exempt. We publish ourselves; we have direct visibility into our own changes; our 0.8.0 → 0.8.1 patch turnaround was same-day and we want to keep that latitude.
18
- - Tunable via `FLAIR_DEP_MIN_AGE_DAYS` env var if a specific run needs a different threshold. Don't bypass; document the exception.
19
18
 
20
19
  #### 1a. Keep-current allow-list
21
20
 
@@ -34,25 +33,34 @@ Adding to this list is a deliberate decision. The bar:
34
33
 
35
34
  Document any addition here, in this section, alongside the package name. The doc is the audit trail.
36
35
 
37
- Override per-run via `FLAIR_DEP_KEEP_CURRENT="pkg1,pkg2,@scope/pkg3"` env (additive — adds to the default allow-list, doesn't replace it).
36
+ Local runs without `--ci` can add to the default allow-list via `FLAIR_DEP_KEEP_CURRENT="pkg1,pkg2,@scope/pkg3"`.
37
+
38
+ #### 1b. Dated exemptions for security pins
39
+
40
+ A security patch can be newer than the bake window, and pinning it is the right move. The gate accepts an explicit, dated exemption in `.github/dep-age-allowlist.json`: one entry per checked `package` and `version` (an exact pin, or the version bun.lock resolves a range to; §2), with a GHSA-formatted id (`ghsa`), `added`, `expires` and a `reason`. Review verifies that the version fixes the advisory.
41
+
42
+ - An entry exempts an otherwise checked version only while unexpired; `expires` is the first day it no longer applies.
43
+ - An **expired** entry fails the gate before any registry request; removing it lets an otherwise checked version be age-checked. Re-read the `reason` before re-dating; removing the entry once the version has aged past the window is the normal outcome.
44
+ - A fresh checked version with no matching entry fails; keep-current packages are skipped. A malformed entry also fails.
45
+
46
+ A per-pin exemption belongs in this allowlist.
38
47
 
39
48
  ### 2. Exact-version pinning for production deps
40
49
 
41
- Some `dependencies` entries are exact-pinned (`harper@5.2.8`, `commander@14.0.3`, `jose@6.2.2`, `tweetnacl@1.0.3`), but others are range-spec'd (`harper-fabric-embeddings@^0.5.0`, `js-yaml@^4.3.2`, `semver@^7.8.5`, `tar@^7.5.22`). Most overrides use ranges (`^`/`~`), with one exact alias (`npm:empty-npm-package@1.0.0` for `react-native-fs`). The age gate (`scripts/check-dep-ages.mjs`, with the collection rule in `collectDeps` in `scripts/lib/check-dep-ages-collect.mjs`) checks npm publish age for external entries in both `dependencies` and `optionalDependencies` whose declared version starts with a digit (`/^\d/.test(version)`), excluding workspace-internal dependencies and the keep-current list (`harper`, `harper-fabric-embeddings`, `@harperfast/oauth`); its default threshold is seven days.
50
+ Some `dependencies` entries are exact-pinned (`harper@5.3.6`, `commander@14.0.3`, `jose@6.2.2`, `tweetnacl@1.0.3`), but others are range-spec'd (`harper-fabric-embeddings@^0.5.0`, `js-yaml@^4.3.2`, `semver@^7.8.5`, `tar@^7.5.22`). Overrides are mostly ranges (`^`/`~`). The age gate (`scripts/check-dep-ages.mjs`, with the collection and resolution rules in `scripts/lib/check-dep-ages-collect.mjs`) checks npm publish age for non-exempt external entries in `dependencies`, `devDependencies`, `optionalDependencies` and `overrides` — the root package.json and each `packages/<name>/package.json`. An exact pin is checked at its declared version (an exact `npm:` alias at its target's), except in `devDependencies`, where exact pins are not checked. A range is checked at the version bun.lock resolves it to: a dependency range through its workspace's own lock entry (`<workspace>/<name>`) when the lock carries one, else the hoisted entry (`<name>`), and a root range through the hoisted entry, where `<name>` is the declared key, so an `npm:` alias is found under its alias; an override range through the installed copies in its scope — every copy of the package for a top-level rule, and for a nested rule (`overrides["a"]["b"]`) the copies of `b` installed below a copy of `a`, key by key along the rule's path. A range the gate cannot resolve fails the gate: a dependency range with no lock entry, or declared in a manifest the lock's `workspaces` map does not list or (outside the root) lists under another name, a lock entry that installs a different package than the declaration names (an alias's target), an override whose key path carries a version selector (`a@^1`), which the gate does not evaluate, or a nested override below a copy whose dependencies bun.lock does not record; so does a `bun.lock` the gate cannot read, such as a `workspaces` map that is not an object or a workspace entry without a string `name`. The gate reads the root package.json and each `packages/<name>/package.json`; a `bun.lock` workspace outside those fails the gate, as does a missing `bun.lock` when the root package.json declares `workspaces`. An override range with no installed copy in its scope has nothing to check and is named in the output. Workspace-internal dependencies and the keep-current list (`harper`, `harper-fabric-embeddings`, `@harperfast/oauth`), both matched on the package a declaration installs (an `npm:` alias's target, never its key), and checked versions with a matching unexpired exemption in `.github/dep-age-allowlist.json` (§1b) are exempt; the default threshold is seven days. A refused `dependencies`, `devDependencies`, `optionalDependencies` or `overrides` form fails the gate, as does a non-string specifier or a non-object field in the first three. The gate reads `bun.lock` as written. For checked ranged declarations, the gate age-checks the versions selected from `bun.lock`. The same CI job (`test-unit`) then runs `bun install --frozen-lockfile`, which with bun 1.3.10 refused a `workspaces` array, a workspace entry with no `name`, a missing workspace entry and a wrong workspace `name` (exit 1), and, for a lock recording a workspace's range at a version outside that range, installed the recorded version, the one the gate checks; it does not check a recorded version against its declared range, nor a recorded peer (flair#1936).
42
51
 
43
- - `peerDependencies` may use ranges: they state what the host project must provide. They are still installed, but an exact-pin check of our declaration does not describe what actually gets installed — the consumer resolves them from a range. This is the reason we do not include peers in the bake-time gate (not "never bundled into tarballs"): the gate checks versions we actually pull, and we don't pull a peer declaration at face value. Our workspace install records the required peers of `langgraph-flair`, `n8n-nodes-flair` and `openclaw-flair` in `bun.lock` like any other dependency (the frozen-lockfile install does not check a recorded peer against its declared range; flair#1936). Most `devDependencies` are exact-pinned for build reproducibility; a few are ranged (`@types/semver@^7.8.0`). They don't ship in our published tarballs.
52
+ - `peerDependencies` may use ranges: they state what the host project must provide. They are still installed, but an exact-pin check of our declaration does not describe what actually gets installed — the consumer resolves them from a range. The bake-time gate does not age-check peer declarations. Our workspace install records the required peers of `langgraph-flair`, `n8n-nodes-flair` and `openclaw-flair` in `bun.lock` like any other dependency (the frozen-lockfile install does not check a recorded peer against its declared range; flair#1936). Most `devDependencies` are exact-pinned for build reproducibility; a few are ranged (`@types/semver@^7.8.0`), and a ranged one is age-checked at its lock resolution like a `dependencies` range. They don't ship in our published tarballs.
44
53
  - **Flair declares no optional peers today**, and no `optionalDependencies` at the root; `packages/flair-bench/package.json` (line 38) declares some. If either is ever proposed as an install-weight fix, the mechanism has now been measured twice (`@harperfast/oauth` flair#750, `node-llama-cpp` flair#887) and the result is counter-intuitive enough to be worth stating: **only `peerDependencies` + `peerDependenciesMeta.optional` is skipped by a default install** (npm and bun alike). A plain `optionalDependencies` entry *is* still installed by default — "optional" there means "a failed install is non-fatal", not "skipped" — so it buys no install-weight reduction whatsoever. Exact-pinning an optional peer (rather than ranging it) is also legitimate where the consuming code path is version-sensitive, so that an operator who installs a different version gets told the version they have is not the version that was tested.
45
54
 
46
55
  Note the corollary, measured during flair#893: an optional peer that is simply *absent* installs silently — npm prints no warning at all — so it cannot be relied on to prompt anyone to install it. Anything a user must install for a feature to work needs to be documented, or detected and reported at runtime.
47
- - `bun.lock` is committed and `bun install --frozen-lockfile` is run in CI (`.github/workflows/test.yml`, ~121). That lockfile gate fails when package.json and bun.lock disagree; `scripts/check-workspace-deps.mjs` compares each recognized internal `@tpsdev-ai/*` dependency's literal declared version to the version the target package ships, and accepts `workspace:` declarations (e.g. `workspace:*` at `packages/cursor-wake-runner/package.json`, line 22; skip at `scripts/check-workspace-deps.mjs`, line 59).
48
- - Pin updates happen via deliberate, test-gated PRs — never auto-merged. **Renovate is enabled** (the shared org preset at `.github/renovate-preset.json`, with `.github/renovate.json` holding only flair-specific exceptions) to *propose* these updates on a schedule, but it respects the bake-time cooldown (`minimumReleaseAge: "7 days"`, matching `FLAIR_DEP_MIN_AGE_DAYS`) and opens PRs only — `automerge` is off, so every bump flows through the full test suite + K&S review. Renovate uses `rangeStrategy: "pin"` so it proposes exact-version bumps (never re-widens to ranges) and shares the keep-current allow-list with `check-dep-ages.mjs`. Vulnerability alerts bypass the Renovate cooldown, so Renovate can propose an advisory fix immediately; the CI age gate can still hold a fresh pinned npm production dependency.
56
+ - `bun.lock` is committed and `bun install --frozen-lockfile` is run in CI (the `test-unit` job's "Install dependencies" step in `.github/workflows/test.yml`, after the bake-time step). That lockfile gate fails on the package.json and bun.lock mismatches bun detects, not on every one (§2 lists those measured, and a recorded version outside its declared range that it accepts); `scripts/check-workspace-deps.mjs` compares each recognized internal `@tpsdev-ai/*` dependency's literal declared version to the version the target package ships, and accepts `workspace:` declarations (e.g. `workspace:*` at `packages/cursor-wake-runner/package.json`, line 22; skip at `scripts/check-workspace-deps.mjs`, line 59).
57
+ - Pin updates happen via deliberate, test-gated PRs — never auto-merged. **Renovate is enabled** (the shared org preset at `.github/renovate-preset.json`, with `.github/renovate.json` holding only flair-specific exceptions) to *propose* these updates on a schedule; `automerge` is off, so every bump flows through the full test suite + K&S review. Renovate uses `rangeStrategy: "replace"` so it preserves declared ranges and shares the keep-current allow-list with `check-dep-ages.mjs`; an exact pin still receives exact-version updates. Vulnerability alerts bypass the Renovate cooldown, so Renovate can propose an advisory fix immediately; the CI age gate can still hold a fresh pinned npm production dependency.
49
58
 
50
59
  ### 3. Internal dep version lockstep
51
60
 
52
61
  Every `@tpsdev-ai/*` dep declared in any workspace package must match the version that workspace package ships. Enforced by `scripts/check-workspace-deps.mjs` in the test-unit CI job.
53
62
 
54
63
  - Why: prevents the v0.8.0 bug shape where `openclaw-flair@0.8.0` declared `@tpsdev-ai/flair-client@0.5.0`, shipping a 3-version-old client to consumers of the published tarball.
55
- - See `notes/dogfood-log.md` for the full incident.
56
64
 
57
65
  ### 4. Workspace `bun.lock` is the source of truth
58
66
 
@@ -94,15 +102,24 @@ Both mechanisms independently forced a pass (`|| echo` made the shell exit 0, so
94
102
  | `class` | `no-patch-published`, `vendor-pinned`, or `remediation-available` |
95
103
  | `introducedBy` | the dependency edge that pulls it in |
96
104
  | `reason` | why it cannot be fixed here, specifically |
97
- | `added`, `expires` | hard dates; lifetime is capped by severity |
105
+ | `added`, `expires` | each must be a real calendar date. Lifetime is `expires − added`; `added` must be on or before its id's first introduction day: the earliest UTC day of a commit containing it with no prior occurrence in ancestry within the pinned lineage. Ids compare case-insensitively |
106
+ | `overCapApproval` | an over-cap entry's approval: `approvedBy`, `reason`, `approvedOn` and `expires`. `approvedBy` records a name; the gate does not verify that name. Approval is reviewed in the PR |
98
107
  | `removeWhen` | the concrete condition that retires the entry |
99
108
 
100
- `scripts/audit-gate.mjs` fails the build on: an unlisted advisory, a malformed entry, an entry parked beyond its severity cap (critical 30 days, high 60, moderate/low 180), an **expired** entry, a **stale** entry whose advisory no longer appears, or a `no-patch-published` entry for which a patched version has since shipped. That last pair matters — an allowlist that only ever grows is the same failure with more ceremony.
109
+ An advisory can have several entries (for example one per install source or dependency chain), and one entry may still name several sources; an entry is identified by its `ghsa`, `package`, `sources` and `introducedBy`. At most one entry per advisory and package may name `bun` or the root npm install. When an advisory has several entries, each entry that names another consumer install must have an `introducedBy` chain that resolves to an installed copy there, and each reported copy must be covered by exactly one entry. `vendor-pinned` is refused for `bun`, which the root `overrides` control.
110
+
111
+ `scripts/audit-gate.mjs` fails the build on: an unlisted advisory, a malformed entry, an entry whose `added` is after today or later than its id's first introduction day, or a first history day after today for an id in the current entries, an entry whose `expires − added` span exceeds its severity cap (critical 30 days, high 60, moderate/low 180) without a valid over-cap approval, an **expired** entry, a **stale** entry whose advisory no longer appears (or, for an advisory with several entries, an entry that covers no reported location in a source it names), or, when the registry re-check succeeds, a `no-patch-published` entry for which a patched version has since shipped. An entry over its cap passes only with `overCapApproval` carrying all four members, a non-blank name and reason, real calendar dates, `approvedOn` no later than today and before its `expires`, and an entry that does not outlive the approval. The approval itself must not last longer than the severity cap, so it cannot extend an entry past `approvedOn` plus that cap; nothing is parked further than today plus the cap. That bound is on the expiry, not on the `added`-to-`expires` span. An `overCapApproval` on an entry within its cap is still validated, and an invalid one fails the build. `.github/audit-allowlist.json` is the fixed history path, pinned to its creation commit `847c40549c85dd9eb805b20f1790bf6956e8f38c` in the script. A shallow clone, a start outside HEAD's ancestry, a missing path at that start or any descendant in HEAD's ancestry, unreadable history, a non-JSON blob, a blob without an `entries` array, an allowlist naming more than 1,000 advisory ids (the history reader refuses it), or a malformed `policy.maxLifetimeDaysBySeverity` (a missing, non-numeric, non-positive, non-finite or over-ceiling value for one of the four severities, or a key other than those four) fails the run before advisory matching.
112
+
113
+ The four ceilings are pinned in `scripts/audit-gate.mjs` (`MAX_LIFETIME_DAYS_BY_SEVERITY`); `policy.maxLifetimeDaysBySeverity` may set a lower cap for a severity but cannot raise one. The gate fails when that block omits a severity, names a non-numeric value (a numeric string, `null`, `true` or an array), a non-positive or non-finite number, or a value above the ceiling; a severity outside the four fails closed.
114
+
115
+ Bun maps a missing or null advisory severity to `unknown`; npm first falls back to the package severity and uses `unknown` only if both are missing or null. A blank string stays blank; a non-null, non-string value selected by these fallbacks makes parsing throw. Both fail closed. `unknown` is not one of the four severities, so it has no lifetime cap: an allowlist entry with severity `unknown` is refused as malformed (`no lifetime cap is configured for severity "unknown"`), and without such an entry the advisory is reported as not allowlisted. Fix it, or wait for the source to classify it.
101
116
 
102
117
  When an entry expires the build fails and a human re-decides. **That is the mechanism working, not a flaw.** Re-dating an entry without re-reading its reason is how this file rots back into the thing it replaced.
103
118
 
104
119
  Run it locally with `node scripts/audit-gate.mjs --explain`.
105
120
 
121
+ `node scripts/ci/list-harper-bundled.mjs` prints harper's bundled packages and installed versions from `node_modules/harper/node_modules`. Root overrides do not replace those copies in a bun install, and `bun audit` reads only `bun.lock`, where those copies do not appear.
122
+
106
123
  **Standing rule for every check in this repo:** any check that is advisory-only must carry, in a comment at its own definition, what would make it blocking and when that gets re-evaluated. Advisory is a terminating state with a defined promotion event, never a resting place.
107
124
 
108
125
  ---
@@ -113,7 +130,7 @@ Run it locally with `node scripts/audit-gate.mjs --explain`.
113
130
 
114
131
  Renovate opens PRs to propose dependency updates so we don't drift behind upstream indefinitely — but on our terms, not the registry's. The org preset (`.github/renovate-preset.json`) is common to all tpsdev-ai repos; `.github/renovate.json` holds only flair-specific overrides (workspace-internal dep exclusions, keep-current allow-list)
115
132
 
116
- Renovate is configured to never auto-merge (`automerge: false`), to pin (`rangeStrategy: "pin"`, consistent with §2), and to respect the bake-time cooldown (`minimumReleaseAge: "7 days"` by default, matching `FLAIR_DEP_MIN_AGE_DAYS` in `check-dep-ages.mjs`), so by default it proposes only versions that have cleared the detection window — the two named exceptions are vulnerability fixes and the keep-current list below. Non-major updates are grouped per ecosystem (npm/Bun, Python, GitHub Actions, Docker); a manager outside those four gets no ecosystem-wide group from the four explicit rules (groups inherited from config:recommended may still apply); majors land as isolated PRs. The keep-current allow-list (`harper`, `harper-fabric-embeddings`, `@harperfast/oauth`) mirrors the script's `DEFAULT_KEEP_CURRENT` — keep the two in lockstep when either changes. Vulnerability alerts bypass the cooldown: Renovate can propose an advisory fix immediately. Flair's CI age gate (`check-dep-ages.mjs`) can still block a fresh pinned npm production dependency; other fresh versions follow the 7-day cooldown unless an explicit exception, such as the keep-current list, applies. The control for the fast-track is not the cooldown: it is `automerge: false` plus the full CI suite (including the bake-time and workspace-deps gates) and a K&S review on every Renovate PR. Docker image digests in Dockerfiles and compose files land in the docker group; images in workflow `container:`/`services:` are proposed by the github-actions manager and land in the github-actions group. The preset is in the CODEOWNERS trust root (`@heskew`): Renovate reads it from the default branch for every repo that extends it, so a change to it takes the same human as a change to the release tagger.
133
+ Renovate is configured with `automerge: false`, `rangeStrategy: "replace"` (§2), and `minimumReleaseAge: "7 days"` by default. The explicit ecosystem rules group `minor`, `patch`, `pin`, and `digest` updates per ecosystem (npm/Bun, Python, GitHub Actions, Docker); groups inherited from config:recommended may also apply. The shared preset leaves major updates ungrouped; repository-specific rules can group them. The keep-current allow-list (`harper`, `harper-fabric-embeddings`, `@harperfast/oauth`) mirrors the script's `DEFAULT_KEEP_CURRENT` — keep the two in lockstep when either changes. Vulnerability alerts bypass the cooldown: Renovate can propose an advisory fix immediately. Flair's CI age gate (`check-dep-ages.mjs`) can still block a fresh npm dependency version it checks (an exact pin, or the version bun.lock resolves a range to; §2). The control for the fast-track is not the cooldown: it is `automerge: false` plus the full CI suite (including the bake-time and workspace-deps gates) and a K&S review on every Renovate PR. Docker and GitHub Actions updates with types `minor`, `patch`, `pin`, or `digest` receive the corresponding ecosystem group. These explicit rules do not group `pinDigest` updates. The preset is in the CODEOWNERS trust root (`@heskew`): Renovate reads it from the default branch for every repo that extends it, so a change to it takes the same human as a change to the release tagger.
117
134
 
118
135
  ### `scripts/check-workspace-deps.mjs` (already shipped, PR #368)
119
136
 
@@ -121,7 +138,9 @@ Fails any PR where a workspace package declares an internal `@tpsdev-ai/*` dep a
121
138
 
122
139
  ### `scripts/check-dep-ages.mjs` (this PR)
123
140
 
124
- Fails any PR with an external pinned production dep version published less than `FLAIR_DEP_MIN_AGE_DAYS` ago (default 7). Queries the npm registry's `time` map. Checks both `dependencies` and `optionalDependencies` — npm and bun install optionalDependencies by default. Workspace-internal deps exempt. Wired into the `test-unit` job. Its limits, stated: it does not check `peerDependencies` (resolved from a range by the consumer's install) nor `devDependencies` (don't ship in our tarballs) — it reads the same registry publish timestamp Renovate does, so it is a second line against the cooldown being removed from the config — not against a release whose publish date lies.
141
+ Fails when a checked external dependency version is younger than the bake-time threshold without a matching unexpired exemption; keep-current packages are skipped, matched on the package a declaration installs (an `npm:` alias's target). Queries the configured registry's `time` map (the npm registry by default). Checks `dependencies`, `devDependencies`, `optionalDependencies` and `overrides` (the root package.json and each `packages/<name>/package.json`; a `bun.lock` workspace outside those fails the gate) — npm and bun install optionalDependencies by default. An exact pin outside `devDependencies` is checked at its declared version; a range at the version bun.lock resolves it to, with an override range checked at the installed copies in its scope (§2). A range the gate cannot resolve fails the gate, and an override range with no installed copy in its scope is named in the output, with nothing to check. Workspace-internal deps and checked versions with a matching unexpired exemption in `.github/dep-age-allowlist.json` (§1b) are exempt; a refused `dependencies`, `devDependencies`, `optionalDependencies` or `overrides` form fails the gate. Wired into the `test-unit` job. Its limits, stated: non-empty or malformed `resolutions` in root or workspace manifests are refused; it does not check `peerDependencies` (resolved from a range by the consumer's install) nor exact `devDependencies` pins (don't ship in our tarballs) — it reads the same registry publish timestamp Renovate does, so it is a second line against the cooldown being removed from the config — not against a release whose publish date lies.
142
+
143
+ Local runs without `--ci` can set `FLAIR_DEP_MIN_AGE_DAYS`, `FLAIR_DEP_KEEP_CURRENT` and `FLAIR_NPM_REGISTRY`; `--ci` refuses the first two when set and uses the committed defaults, and accepts `FLAIR_NPM_REGISTRY` only when it names a loopback host (the tests serve their fixture registry there; the gate does not check what serves it). The workflow check rejects any of these variables, and `FLAIR_CHECK_DEP_AGES_ROOT`, in the gate step's, its job's or the workflow's `env`. Not covered: an earlier step in the same job that starts its own registry on loopback and exports the variable through `$GITHUB_ENV`. That is a code change to the workflow, and review is what catches it.
125
144
 
126
145
  Configurable:
127
146
 
@@ -152,10 +171,10 @@ Mirrors the CI test-unit gates locally so issues are caught at `git commit` time
152
171
 
153
172
  Runs three checks before each commit:
154
173
  - `check-workspace-deps.mjs` — workspace internal-dep version lockstep
155
- - `check-dep-ages.mjs` — supply-chain bake-time (≥7 days for external pinned deps)
156
- - `check-impl-term-leaks.sh` — no Bead refs / impl labels in user-facing docs, `CHANGELOG.md`, or `.changelog/`
174
+ - `check-dep-ages.mjs` — supply-chain bake-time (≥7 days for the external dependency versions §2 describes)
175
+ - `check-impl-term-leaks.sh` — no Bead refs / impl labels in user-facing docs, `CHANGELOG.md`, or `.changelog/` <!-- docs-freshness-allow: names the files the gate scans -->
157
176
 
158
- Each check matches a CI gate exactly so the local and remote outcomes can't drift. Bypass with `git commit --no-verify` when warranted (rare; CI will still catch you). Skip just the dep-ages check (the slowest one, ~2-5s of registry fetches) with `FLAIR_PRECOMMIT_SKIP_DEP_AGES=1 git commit`.
177
+ Bypass with `git commit --no-verify` when warranted (rare; CI will still catch you). Skip just the dep-ages check (the slowest one, ~2-5s of registry fetches) with `FLAIR_PRECOMMIT_SKIP_DEP_AGES=1 git commit`.
159
178
 
160
179
  ---
161
180
 
@@ -195,7 +214,7 @@ Add `packageRules` only for your own exceptions. The preset carries no `@tpsdev-
195
214
 
196
215
  ## Exceptions and incident response
197
216
 
198
- - **Bypass for known-good fresh dep:** set `FLAIR_DEP_MIN_AGE_DAYS=0` for the affected CI run AND open a PR to add a comment-row in this doc explaining the exception. Don't bypass silently.
217
+ - **Exempt an otherwise checked fresh security pin:** add a dated entry to `.github/dep-age-allowlist.json` naming the advisory (§1b). It is reviewed on the PR and expires on its own. Don't bypass silently.
199
218
  - **Confirmed upstream compromise affecting Flair:** rotate any affected credential, revert the offending dep version, ship a patch release, file a public advisory at `github.com/tpsdev-ai/flair/security/advisories`. Notify Nathan immediately; don't act unilaterally.
200
219
  - **Suspected (not confirmed) compromise:** open an issue with the evidence; treat it as P0 in our backlog until disproven.
201
220
 
@@ -203,7 +222,6 @@ Add `packageRules` only for your own exceptions. The preset carries no `@tpsdev-
203
222
 
204
223
  ## See also
205
224
 
206
- - `notes/dogfood-log.md` — internal incidents that have shaped this policy
207
225
  - `scripts/check-workspace-deps.mjs` — the workspace-internal dep consistency gate
208
226
  - `scripts/check-dep-ages.mjs` — the bake-time dep guard
209
227
  - `ops/scripts/git-hooks/pre-commit-secret-guard.sh` — pre-commit secret blocker (cross-repo)
package/docs/the-team.md CHANGED
@@ -15,7 +15,7 @@ If you're trying to run your own multi-agent team using Flair as the memory laye
15
15
  | **Pulse** | EA / intel scanning / coordination | OpenClaw | Claude API | cloud VM |
16
16
  | **Nathan** | Founder / product owner / human-in-the-loop | (human) | (human) | wherever |
17
17
 
18
- Every agent has its own Ed25519 identity in Flair. They sign every memory write and every read. **Writes are isolated at the Flair API layer** — Sherlock can't accidentally (or maliciously) write into Pulse's memory, because the signature won't verify for anyone but Pulse. Reads are a different story: within one Flair instance, any verified agent can read any other agent's **non-private** memory — that's the shipped model (open-within-org read, no grant needed), not a gap. Which memories are non-private is decided at write time: visibility defaults from durability, so `permanent`/`persistent` writes land `shared` and `standard`/`ephemeral` writes land `private`. A teammate's scratch context is therefore owner-only until someone shares it deliberately, and an agent keeps something genuinely sensitive owner-only regardless of durability by writing it with `visibility: private`. The hard access boundary is the **federation edge** (a separate Flair instance), not reads within one.
18
+ Every agent has its own Ed25519 identity in Flair. They sign every memory write and every read. **Writes are isolated at the Flair API layer** — Sherlock can't accidentally (or maliciously) write into Pulse's memory, because the signature won't verify for anyone but Pulse. Reads are a different story: within one Flair instance, non-private memories pass the base visibility check without a grant; non-admin by-id and collection reads of retained closed skills additionally require readable current authority. That's the shipped model (open-within-org read), not a gap. Which memories are non-private is decided at write time: visibility defaults from durability, so `permanent`/`persistent` writes land `shared` and `standard`/`ephemeral` writes land `private`. A teammate's scratch context is therefore owner-only until someone shares it deliberately, and an agent keeps something genuinely sensitive owner-only regardless of durability by writing it with `visibility: private`. The hard access boundary is the **federation edge** (a separate Flair instance), not reads within one.
19
19
 
20
20
  ## How memory flows
21
21
 
@@ -50,7 +50,7 @@ No agent can write into another agent's memory — that's enforced server-side b
50
50
 
51
51
  The reverse also holds, and it is the part worth internalising: a `standard` or `ephemeral` write lands `private`, so an agent's day-to-day working context is *not* team-searchable by default. Commit something at `permanent`/`persistent` durability, or pass `visibility: shared`, when you mean the team to find it. An agent that needs something owner-only whatever its durability (a draft not ready for the team, a sensitive finding pre-disclosure) marks it `visibility: private` explicitly.
52
52
 
53
- When agents need to *coordinate* — a direct, targeted handoff rather than ambient searchable memory — they pass **explicit messages** through TPS mail (a separate signed delivery channel; see [tpsdev-ai/cli](https://github.com/tpsdev-ai/cli)). That's a different concern from memory visibility: TPS mail is for "I need you, specifically, to see this now"; Flair memory is the shared, searchable record everyone (except where `private`) can draw on later.
53
+ When agents need to *coordinate* — a direct, targeted handoff rather than ambient searchable memory — they pass **explicit messages** through TPS mail (a separate signed delivery channel; see [tpsdev-ai/cli](https://github.com/tpsdev-ai/cli)). That's a different concern from memory visibility: TPS mail is for "I need you, specifically, to see this now"; Flair memory is the shared, searchable record, subject to visibility, lifecycle filters and, on non-admin Memory by-id and collection reads of retained closed skills, the current-authority check.
54
54
 
55
55
  ## Why these splits
56
56