@tpsdev-ai/flair 0.56.0 → 0.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +19 -20
  2. package/SECURITY.md +4 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli.js +1800 -293
  5. package/dist/commands/agent.js +22 -15
  6. package/dist/commands/bridge.js +40 -3
  7. package/dist/commands/doctor.js +214 -4
  8. package/dist/commands/federation.js +265 -38
  9. package/dist/commands/hook.js +10 -2
  10. package/dist/commands/init.js +179 -48
  11. package/dist/commands/memory.js +24 -2
  12. package/dist/commands/quality.js +26 -18
  13. package/dist/commands/service.js +137 -22
  14. package/dist/commands/status.js +114 -3
  15. package/dist/commands/upgrade.js +204 -84
  16. package/dist/doctor-client.js +50 -4
  17. package/dist/federation/scheduler.js +253 -4
  18. package/dist/install/clients.js +89 -23
  19. package/dist/install/global-bin-path.js +26 -6
  20. package/dist/lib/atomic-write.js +256 -0
  21. package/dist/lib/auth-resolve.js +46 -0
  22. package/dist/lib/daemon-liveness.js +61 -0
  23. package/dist/lib/doctor-run.js +5 -0
  24. package/dist/lib/embed-gpu-doctor.js +49 -26
  25. package/dist/lib/federation-memory-attributes.js +15 -0
  26. package/dist/lib/init-admin-pass.js +4 -2
  27. package/dist/lib/init-listener-environ.js +38 -0
  28. package/dist/lib/init-occupied-listener.js +165 -0
  29. package/dist/lib/instance-identity-row.js +580 -0
  30. package/dist/lib/launchd-domain-preflight.js +448 -0
  31. package/dist/lib/launchd-management.js +176 -6
  32. package/dist/lib/launchd-repair.js +95 -0
  33. package/dist/lib/memory-attributes.js +77 -0
  34. package/dist/lib/node-alias-path.js +95 -0
  35. package/dist/lib/npm-registry.js +119 -6
  36. package/dist/lib/owned-pins.js +20 -6
  37. package/dist/lib/redact-token-id.js +197 -0
  38. package/dist/lib/service-repoint-apply.js +267 -0
  39. package/dist/lib/service-repoint.js +575 -0
  40. package/dist/lib/toml-string-array.js +104 -0
  41. package/dist/lib/tree-divergence.js +716 -0
  42. package/dist/lib/upgrade-plain-tree.js +18 -8
  43. package/dist/lib/upgrade-prior-liveness.js +69 -0
  44. package/dist/lib/upgrade-rollback.js +116 -0
  45. package/dist/rem/runner.js +11 -0
  46. package/dist/resources/Agent.js +27 -14
  47. package/dist/resources/AgentSeed.js +39 -2
  48. package/dist/resources/Asset.js +3 -11
  49. package/dist/resources/Credential.js +4 -10
  50. package/dist/resources/Federation.js +299 -127
  51. package/dist/resources/Integration.js +8 -32
  52. package/dist/resources/Memory.js +623 -86
  53. package/dist/resources/MemoryArchive.js +9 -0
  54. package/dist/resources/MemoryBootstrap.js +23 -12
  55. package/dist/resources/MemoryCandidate.js +3 -11
  56. package/dist/resources/MemoryDedupStats.js +1 -1
  57. package/dist/resources/MemoryFeed.js +214 -5
  58. package/dist/resources/MemoryGrant.js +19 -40
  59. package/dist/resources/MemoryHostSource.js +90 -0
  60. package/dist/resources/MemoryMaintenance.js +121 -32
  61. package/dist/resources/MemoryReflect.js +4 -1
  62. package/dist/resources/MemoryReindex.js +7 -4
  63. package/dist/resources/MemoryUsage.js +55 -18
  64. package/dist/resources/Presence.js +18 -10
  65. package/dist/resources/RecordUsage.js +30 -40
  66. package/dist/resources/Relationship.js +170 -89
  67. package/dist/resources/SemanticSearch.js +44 -19
  68. package/dist/resources/Soul.js +31 -19
  69. package/dist/resources/XAA.js +7 -3
  70. package/dist/resources/agent-auth.js +16 -10
  71. package/dist/resources/auth-middleware.js +164 -50
  72. package/dist/resources/auto-promote-lib.js +4 -4
  73. package/dist/resources/bm25-index-service.js +246 -32
  74. package/dist/resources/bm25-status.js +132 -0
  75. package/dist/resources/bm25.js +13 -14
  76. package/dist/resources/ed25519-auth.js +11 -54
  77. package/dist/resources/embed-gpu.js +262 -47
  78. package/dist/resources/embeddings-boot.js +52 -17
  79. package/dist/resources/federation-classify.js +12 -0
  80. package/dist/resources/federation-cleanup.js +289 -51
  81. package/dist/resources/federation-crypto.js +65 -19
  82. package/dist/resources/health.js +105 -22
  83. package/dist/resources/host-pointer/registry.js +35 -0
  84. package/dist/resources/host-pointer-adapter.js +15 -0
  85. package/dist/resources/host-source-visibility.js +167 -0
  86. package/dist/resources/host-source.js +151 -0
  87. package/dist/resources/in-process-api.js +2 -1
  88. package/dist/resources/instance-create-lock.js +363 -0
  89. package/dist/resources/instance-identity-rows.js +43 -0
  90. package/dist/resources/instance-identity.js +97 -12
  91. package/dist/resources/mcp-handler.js +155 -51
  92. package/dist/resources/mcp-tool-arguments.js +83 -0
  93. package/dist/resources/mcp-tools.js +28 -25
  94. package/dist/resources/memory-consolidate-lib.js +3 -1
  95. package/dist/resources/memory-declared-attributes.js +103 -0
  96. package/dist/resources/memory-feed-lib.js +5 -1
  97. package/dist/resources/memory-host-source.js +163 -0
  98. package/dist/resources/memory-visibility.js +10 -7
  99. package/dist/resources/migrations/synthetic-test-migration.js +4 -1
  100. package/dist/resources/migrations/visibility-backfill.js +4 -1
  101. package/dist/resources/originator-instance.js +235 -0
  102. package/dist/resources/promotion-stamp.js +2 -0
  103. package/dist/resources/provenance.js +111 -11
  104. package/dist/resources/rate-limit.js +6 -4
  105. package/dist/resources/record-owner-guard.js +19 -0
  106. package/dist/resources/record-type-kit.js +44 -23
  107. package/dist/resources/record-types.js +6 -6
  108. package/dist/resources/relay-ops.js +28 -3
  109. package/dist/resources/replay-store.js +289 -0
  110. package/dist/resources/request-transaction.js +78 -0
  111. package/dist/resources/search-readiness.js +26 -22
  112. package/dist/resources/semantic-retrieval-core.js +103 -4
  113. package/dist/resources/table-helpers.js +33 -0
  114. package/dist/resources/table-patch-policy.js +109 -0
  115. package/dist/resources/table-patches.js +17 -0
  116. package/dist/resources/table-post-policy.js +138 -0
  117. package/dist/resources/table-posts.js +22 -0
  118. package/dist/resources/table-subscription-policy.js +135 -0
  119. package/dist/resources/table-subscriptions.js +19 -0
  120. package/dist/resources/tool-descriptors/index.js +15 -15
  121. package/dist/resources/trust-block.js +10 -3
  122. package/dist/resources/usage-recording.js +169 -41
  123. package/dist/src/lib/instance-identity-row.js +580 -0
  124. package/dist/src/lib/memory-attributes.js +77 -0
  125. package/dist/src/lib/redact-token-id.js +197 -0
  126. package/docs/api-reference.md +80 -16
  127. package/docs/auth.md +5 -5
  128. package/docs/claude-code.md +137 -6
  129. package/docs/deploying-on-fabric.md +6 -3
  130. package/docs/deployment.md +1 -1
  131. package/docs/embedding-in-a-harper-app.md +3 -3
  132. package/docs/federation.md +17 -10
  133. package/docs/hosted-on-fabric.md +4 -3
  134. package/docs/integrations.md +28 -19
  135. package/docs/mcp-clients.md +26 -32
  136. package/docs/n8n.md +8 -8
  137. package/docs/notes/mcp-oauth-model2.md +27 -18
  138. package/docs/openclaw.md +29 -28
  139. package/docs/quickstart.md +5 -0
  140. package/docs/releasing.md +134 -2
  141. package/docs/spoke-bringup.md +14 -11
  142. package/docs/standalone-local.md +2 -2
  143. package/docs/supply-chain-policy.md +28 -10
  144. package/docs/system-requirements.md +1 -1
  145. package/docs/troubleshooting.md +11 -0
  146. package/docs/upgrade.md +189 -63
  147. package/package.json +9 -5
  148. package/schemas/agent.graphql +9 -6
  149. package/schemas/federation.graphql +2 -11
  150. package/schemas/memory.graphql +106 -17
  151. package/schemas/replay.graphql +18 -0
  152. package/templates/launchd/start-flair-with-admin-pass.sh +22 -0
  153. package/dist/resources/federation-nonce-store.js +0 -195
@@ -82,7 +82,67 @@ Copy this into your project's `CLAUDE.md` (or `.claude/settings.md`, `AGENTS.md`
82
82
 
83
83
  ---
84
84
 
85
- That's it. Claude Code will now bootstrap context on start and store important things as it works.
85
+ This is a prompt-driven CLI setup: Claude must choose to run these commands. For MCP tools and automatic startup recall, run `flair init --agent my-project --client claude-code`, restart Claude Code, and verify the hook with `flair hook status --harness claude-code`; these prompt instructions do not guarantee automatic capture.
86
+
87
+ ## Hooks
88
+
89
+ `@tpsdev-ai/flair-mcp` ships four Claude Code hooks. Each is a separate binary and each is optional. Each exits 0 on every failure it handles, but a hook can still delay the session start, the prompt or the compaction it runs for; the time budgets and limits of prompt recall and of the PreCompact hook are described below.
90
+
91
+ | Hook | Claude Code event | What it does | Install |
92
+ |---|---|---|---|
93
+ | `flair-session-start` | `SessionStart` | Loads bootstrap context (soul plus relevant memories) when a session opens. | `flair hook install` ([details](mcp-clients.md#auto-recall-on-session-start-optional-hook)) |
94
+ | `flair-continuity-capture` | `PostToolUse` and `Stop` | Journals the agent's working state into the ephemeral memory tier, so the next session start can point at it with a one-line resume hint. | `flair hook install --continuity` |
95
+ | `flair-prompt-recall` | `UserPromptSubmit` | Searches memory with each prompt and adds the relevant memories as context before the model answers. | By hand, below |
96
+ | `flair-precompact` | `PreCompact` | Saves a bounded continuity record just before a compaction, for `flair-session-start` to show first afterwards. | By hand, [below](#continuity-across-compaction-flair-precompact-optional) |
97
+
98
+ ### Per-prompt recall (`flair-prompt-recall`)
99
+
100
+ Session-start recall runs once. Later in the session a prompt can bring up something the agent's memory already covers, such as a user's direction on a named technique or an earlier decision, and unless something searches at that moment the agent answers without it. `flair-prompt-recall` searches on every prompt:
101
+
102
+ 1. It builds a search query from the prompt, with markup, URLs and noise such as long ids stripped, bounded to 500 characters.
103
+ 2. It runs the same hybrid search as the MCP `memory_search` tool, signed with the agent's own Ed25519 key, so the results are limited to what that agent may read.
104
+ 3. It adds the hits whose score meets a relevance threshold (at most 4 by default), each with its id, date, score and a snippet, under a header that frames them as a signal, not an instruction, and tells the model to read the full memory before acting on it. The whole block is at most 2,000 characters. A memory that Flair's content scan flagged as possible prompt injection is shown with a fixed warning line ahead of its quoted text; cutting the text to fit never cuts the warning, so such a memory appears with its whole warning or not at all.
105
+
106
+ It can delay a prompt until its time budget runs out, and a response that has fully arrived within the budget can take longer to process (see below). It skips two kinds of prompt: background task notifications, and prompts too short to search once cleaned ("ok, thanks"). Every other prompt is searched, question or not. It exits 0 on every failure it handles. When Flair is unreachable, slow or refuses the request, it adds no memories, only one line saying recall was unavailable for that prompt.
107
+
108
+ The time budget (3 seconds by default) runs from the moment the hook process starts: reading the prompt, reading the config file and the search all count against it. When it runs out during asynchronous work (waiting for the prompt on stdin, reading the config file, connecting to Flair or downloading its response), the hook prints the one "unavailable" line and exits 0 at once. The prompt payload is read up to 1 MiB (a larger one is not searched), and the config file is read only if it is a regular file of at most 256 KiB. Once a response has arrived in full, the Flair client parses it and converts every result in it before returning, synchronously; the deadline cannot interrupt that work, and there is no cap on the size of a response that arrives within the budget. After the client returns, the hook's own processing looks at no more than the requested number of results and the first 4,096 characters of each memory. What happens before the process starts is outside the budget: the launcher and node's own start-up.
109
+
110
+ `flair hook install` does not write this hook, so wire it by hand. The hook runs on every prompt, so its launcher's start-up is added to every turn. Install the pinned package once into a directory of its own, and point the hook at its binary:
111
+
112
+ ```bash
113
+ npm install --prefix ~/.flair-hooks @tpsdev-ai/flair-mcp@<version>
114
+ ```
115
+
116
+ Then add the hook to `~/.claude/settings.json`:
117
+
118
+ ```json
119
+ {
120
+ "hooks": {
121
+ "UserPromptSubmit": [
122
+ {
123
+ "hooks": [
124
+ {
125
+ "type": "command",
126
+ "command": "sh -c 'out=$(FLAIR_AGENT_ID=my-project \"$HOME/.flair-hooks/node_modules/.bin/flair-prompt-recall\" 2>/dev/null) && printf %s \"$out\" || true'"
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ }
132
+ }
133
+ ```
134
+
135
+ Swap `my-project` for your agent ID and `<version>` for `flair --version`. The binary runs with the `node` found on the hook's `PATH`, which must be Node 22 or later. The `sh -c ... || true` wrapper is the same one the SessionStart hook uses: if the command cannot run at all, the prompt goes through with no output. Nothing in the CLI rewrites this entry or that directory, so re-run the `npm install` with the new version after an upgrade.
136
+
137
+ The same `npx -y -p @tpsdev-ai/flair-mcp@<version> flair-prompt-recall` invocation the SessionStart hook uses also works in place of the binary path, at a cost: npx resolves the package before the hook process starts, on every prompt, outside the hook's budget. That adds npm's own start-up to every turn even when the package is cached, and a download when the pinned version is not in npx's cache.
138
+
139
+ | Setting | Environment variable | `~/.flair/config.yaml` key | Default |
140
+ |---|---|---|---|
141
+ | Relevance threshold, 0 to 1, on the search's absolute score | `FLAIR_PROMPT_RECALL_MIN_SCORE` | `promptRecallMinScore` | `0.62` |
142
+ | Most memories added per prompt, 1 to 10 | `FLAIR_PROMPT_RECALL_MAX_HITS` | `promptRecallMaxHits` | `4` |
143
+ | Time budget in milliseconds, from the hook's start, 250 to 15000 | `FLAIR_PROMPT_RECALL_TIMEOUT_MS` | `promptRecallTimeoutMs` | `3000` |
144
+
145
+ The environment wins over the config file, where the keys are top-level entries; a value that is missing or out of range falls through to the next source. Until the config file has been read, the hook's deadline uses the environment's budget or the default; a budget set in the config file applies from then on, still measured from the start. The hook reads `FLAIR_AGENT_ID`, `FLAIR_URL` and `FLAIR_KEY_PATH` like the other hooks. It never uses `FLAIR_ADMIN_USER` or `FLAIR_ADMIN_PASSWORD`: without an agent key the request goes out unsigned, Flair refuses it, and the prompt gets the one "unavailable" line.
86
146
 
87
147
  ## Multiple Projects
88
148
 
@@ -94,19 +154,18 @@ flair agent add project-beta
94
154
  flair agent add infra-ops
95
155
  ```
96
156
 
97
- Each project's `CLAUDE.md` uses its own agent ID. Memories are fully isolated between projects.
157
+ Each project's `CLAUDE.md` uses its own agent ID. Writes carry an `agentId` field (tags are optional); reads use owner plus visibility.
98
158
 
99
159
  ## Subagents
100
160
 
101
161
  Claude Code subagents (spawned via `/run` or background tasks) can share the parent's memory:
102
162
 
103
163
  ### Subagents
104
- Subagents share memory with the parent session. Use the same agent ID:
105
- FLAIR_AGENT_ID=my-project
164
+ Subagents share memory with the parent session when they use the same agent ID (to share, set `FLAIR_AGENT_ID=my-project`). A subagent with its own agent ID owns what it writes, but this is not isolation: only its private records are hidden from other agents, and it can still read other agents' non-private records. Writes without an explicit visibility default by durability: persistent and permanent are shared, standard and ephemeral are private.
106
165
 
107
166
  When spawning subagents, pass the agent ID so they can access shared context.
108
167
 
109
- Or give subagents their own identity for isolation:
168
+ Or give subagents their own identity, so each owns what it writes (ownership, not isolation):
110
169
 
111
170
  ```bash
112
171
  flair agent add my-project-review # code review subagent
@@ -132,6 +191,78 @@ Then the CLAUDE.md simplifies to:
132
191
 
133
192
  Use `flair bootstrap` when MCP is not wired.
134
193
 
194
+ ## Continuity across compaction (`flair-precompact`, optional)
195
+
196
+ When Claude Code compacts a conversation, it replaces the history with a summary, and whatever the summary leaves out is gone from the agent's context: a rule the user gave an hour ago, the open task list, the work in flight. `flair-precompact` is a `PreCompact` hook that saves one bounded record just before that happens (when the end of the transcript holds something to record and the write succeeds), and `flair-session-start` can show the saved record the local marker file names first, when Flair returns it as an eligible live row: when the session continues after the compaction, or when the next session starts after a restart and the marker still names the previous session (see the limits below).
197
+
198
+ It needs `flair-session-start` installed (`flair hook install`): that hook creates the per-session continuity state the record belongs to, and it is the one that shows the record, when the marker matches and Flair returns an eligible live row. `flair hook install` does not write the PreCompact entry, so add it to `~/.claude/settings.json` by hand:
199
+
200
+ ```json
201
+ {
202
+ "hooks": {
203
+ "PreCompact": [
204
+ {
205
+ "hooks": [
206
+ {
207
+ "type": "command",
208
+ "command": "sh -c 'out=$(FLAIR_AGENT_ID=my-project npx -y -p @tpsdev-ai/flair-mcp@<version> flair-precompact 2>/dev/null) && printf %s \"$out\" || true'",
209
+ "timeout": 30
210
+ }
211
+ ]
212
+ }
213
+ ]
214
+ }
215
+ }
216
+ ```
217
+
218
+ Swap `my-project` for your agent ID and `<version>` for `flair --version`. With no `matcher`, the hook runs for both `/compact` (`manual`) and automatic (`auto`) compaction. A PreCompact hook that exits 2 blocks compaction; this command exits 0 whenever it runs to completion (the `|| true` covers a launcher that fails before the hook runs), and `timeout` bounds the launcher, whose start-up happens before the hook's own budget begins.
219
+
220
+ What the record holds: text copied from the end of the transcript (no model call, no summary), under fixed section headings, with a status label on each task (taken from the transcript only when it looks like one, at most 20 lowercase letters and underscores, and is not credential-shaped; else `open`) and a tool label (`bash:`, `write:`, `edit:` or `notebook-edit:`) on each in-flight line:
221
+
222
+ - **Standing instructions**: sentences from the turns the transcript labels as user turns (once the harness markup described below is removed) that start with a rule-giving phrase (don't, do not, never, always, stop, avoid, make sure, remember to, from now on, going forward) or contain always, never, from now on, going forward or in (the) future. Extracted sentences that end in `?` are skipped. At most 6, the newest, 200 characters each.
223
+ - **Open tasks**: the task tools' list (`TaskCreate`/`TaskUpdate`, and `TodoWrite` when a session has it enabled), minus completed and deleted tasks. At most 8.
224
+ - **In-flight work**: the last 5 file edits and shell commands, one line each (a repeated one included), recorded the way `flair-continuity-capture` records them: a file's path, a shell command's description, never the command itself.
225
+ - **The last assistant message**: its text blocks joined in order, cut to 300 characters.
226
+
227
+ A section with nothing in it is left out, and when nothing at all was found no record is written. The whole record is at most 2,000 characters. The hook reads at most the last 1 MiB of the transcript and keeps up to the last 2,000 nonblank lines of it. From tool results it reads only two identifiers, to keep the task list straight: the id `TaskCreate` assigned, and which tool call a result answers. It never copies result content, thinking or subagent turns into the record. Of the messages the harness writes into the transcript, it skips user turns that carry a marker it recognizes (`<task-notification>`; a slash command's `<command-name>`, `<command-message>` or `<command-args>`; `<local-command-…>` output), meta entries and compaction summaries, and it drops system-reminder blocks, all before it redacts the text that is left; a harness message with none of these markers is treated as a user turn, since the hook cannot tell it from your own words.
228
+
229
+ Before the record's content is stored, strings in it that match these patterns are replaced with `[redacted]` (a task status label that redaction would change is shown as `open` instead): private key blocks, `user:password@` in URLs, Authorization-style values (everything after an `Authorization:` or `Proxy-Authorization:` label in any case, or after the word `Bearer` in any case or `Basic` capitalized or in capitals, through the end of that line, whatever its characters, where a line ends at a line feed, carriage return, vertical tab, form feed, U+0085, U+2028 or U+2029, the same breaks the displayed record is split on, so the line after the value is kept; this also cuts short a line of prose such as "use Bearer tokens here", while the lower-case word "basic" is left alone), `name=value` and `name: value` pairs whose name contains password, secret, token, credential, or api, access or private key, and the prefixed tokens in the table below. This is pattern matching and best effort: a secret with no recognizable shape, such as a bare password in a sentence, is stored as written. The record lives in the ephemeral tier (it expires after 24 hours by default; the Flair server's `FLAIR_EPHEMERAL_TTL_HOURS` sets it), is private to the agent, and is written with the agent's own key through the same signed request as the continuity journal; the hook never uses `FLAIR_ADMIN_USER` or `FLAIR_ADMIN_PASSWORD`.
230
+
231
+ A prefixed token is recognized only when its prefix starts a word and is followed by a long enough run of the characters its pattern allows, so ordinary words are not caught:
232
+
233
+ | Prefix | Followed by |
234
+ |---|---|
235
+ | `sk-` | 16 or more letters, digits, `_` or `-`, counted from right after `sk-`, so a subtype counts toward them: `sk-ant-` followed by 12 more, or `sk-proj-` followed by 11 more, is redacted |
236
+ | `ghp_`, `gho_`, `ghu_`, `ghs_`, `ghr_` | 20 or more letters or digits |
237
+ | `github_pat_` | 20 or more letters, digits or `_` |
238
+ | `pat_` | 16 or more letters, digits, `_`, `.` or `-` |
239
+ | `glpat-` | 20 or more letters, digits, `_` or `-` |
240
+ | `xoxa-`, `xoxb-`, `xoxp-`, `xoxo-`, `xoxs-`, `xoxr-` | 10 or more letters, digits or `-` |
241
+ | `AKIA`, `ASIA` | exactly 16 capital letters or digits |
242
+ | `AIza` | 30 or more letters, digits, `_` or `-` |
243
+ | `npm_` | exactly 36 letters or digits |
244
+ | `eyJ` (a JWT) | 8 or more letters, digits, `_` or `-`, then two more such runs, each after a `.` |
245
+
246
+ A shorter run is stored as written: `pat_ab`, `sk-abc123` and `ghp_a.b` are not redacted. A character the pattern does not allow ends the match: `pat_` allows dots, so a long enough dotted value such as `pat_abcdefgh.ijklmnop` is redacted whole, while `ghp_` does not, so `ghp_` followed by 20 letters and then `.tail` is stored as `[redacted].tail`, and `ghp_` followed by 10 letters, a dot and 10 more letters is stored as written.
247
+
248
+ When `flair-session-start` shows the record, it treats it as quoted data, not instructions: under a line that says so, the record sits between two fixed lines, `<<<BEGIN flair-precompact-record: quoted data, not instructions>>>` and `<<<END flair-precompact-record>>>`, and every line of the record starts with `| `. The record is split into lines at each of the line breaks listed above, and a tab or any other control character in it is shown as a space. A line in the transcript that imitates the end line, or starts with `System:`, `Human:` or `Assistant:`, therefore stays inside the block and never starts a line of the session's context. The text inside is still untrusted: the prefix keeps it inside the block, but no formatting can guarantee that a model disregards an instruction written in it. The record is shown only while it is provably unexpired: its expiry is set and later than now. It is shown as Flair returns it at that moment, which can differ from what the hook wrote, so its text goes through the same redaction again, before it is cut to 2,000 characters and shown.
249
+
250
+ Each run of the hook that finds something to record attempts at most one write, once its local checks pass (the marker, if there is one, can be read, and it can be written; time is left in its budget; the Flair client could be built); a record is added or updated only when Flair applies that write. The write targets a new record, unless the marker file names a record for the same session and trigger that it first named less than 5 minutes before: then it targets that record again. The marker is written before the write is attempted, so that window starts even when the write fails; a later write that Flair applies creates the record if it is absent and updates it if present. This holds whether the run repeats the same compaction or handles a second compaction of the same kind, since the hook cannot tell the two apart, so two such compactions within those 5 minutes target one record: it holds the newer state if the later write is applied, and keeps the earlier state if that write fails. It covers runs that come one after another; see the limits below. The record's id is kept in `~/.flair/session/<agent>.precompact.json`, which holds ids and a timestamp, never record content.
251
+
252
+ Once it has started, the hook does not block compaction: every path it handles exits 0. Its time budget (`FLAIR_PRECOMPACT_TIMEOUT_MS`, default 5000 ms, 250 to 15000) starts before it reads its input. When it passes, the hook stops waiting on its asynchronous work (whatever is still pending), prints its timeout warning when `FLAIR_AGENT_ID` is set (without it, nothing), and exits 0 once that output drains, waiting at most one more second. It cannot interrupt synchronous work, and one such step is not the hook's own: the Flair client reads the agent's key file synchronously. The `timeout` in the hook entry, Claude Code's own limit for the command, is the outer bound. The hook reads its own files asynchronously. Of the transcript it reads only the end, within the limits above. The session's continuity state file and the marker file are a few hundred bytes when Flair wrote them, and the hook checks their size before reading either: one larger than 16 KiB, or anything at those paths that is not a regular file, is refused unread, with a warning naming it, and one that grows past 16 KiB while it is read is refused after at most 16 KiB and 1 byte. When Flair is unreachable, slow or refuses the write, or the transcript or the hook's own files cannot be read, Claude Code shows one short warning naming the reason, and compaction goes ahead either way. When a write is not confirmed, the warning says the save did not finish in time (after a timeout) or could not be confirmed (after any other error), and that the record may be missing: Flair can still finish a write the hook stopped waiting for, or may already have applied one whose answer could not be read. A warning that names the state file or the marker shows its path with these changes, each only where it applies: a path inside your home directory (`HOME`, else the system's) starts with `~` (a home directory of `/` collapses nothing), each control character is shown as `?`, strings that match the credential patterns are redacted, and a path longer than 200 characters is cut. A path outside your home directory that none of these touch is shown as it is.
253
+
254
+ Limits worth knowing:
255
+
256
+ - The instruction heuristic is simple. It misses a rule phrased any other way ("I'd rather you ask first", other languages), and it can pick up a sentence that only mentions the words ("I never said that").
257
+ - Claude Code writes the transcript asynchronously, so the newest messages may not be in it yet when the hook runs.
258
+ - Only the end of the transcript is read: a task created before that part has no name there and is left out, and an instruction given before it is not seen.
259
+ - The transcript's format is Claude Code's own, not a documented interface; a field the hook does not recognize is skipped, never guessed.
260
+ - After a restart, a record is shown only when the marker file still names the previous session, and the record shown is the saved record the marker still names, which can predate a later compaction of that session whose record was not saved, and can be older than that session's final state. The block shows the row's `createdAt`, which the hook sets to the time of the run that wrote it (a row changed since can carry another value); treat it as a signal to check, not an instruction.
261
+ - The marker file remembers only the newest record per agent ID. When two sessions share one agent ID and both compact, the session that compacted first no longer finds its record through the marker.
262
+ - Two runs of the hook at the same moment for one agent ID can both find no marker and each write a record: nothing locks the marker across processes.
263
+ - In-flight lines are not merged: five edits of one file fill that section with five identical lines.
264
+ - A Flair server older than 0.47.0 stamps no expiry on the write, so a record saved there is not shown unless a later write gives it an expiry.
265
+
135
266
  ## Soul (Personality / Context)
136
267
 
137
268
  Want Claude Code to have consistent personality or project context? Set soul entries:
@@ -206,4 +337,4 @@ const context = await flair.bootstrap({ maxTokens: 4000 })
206
337
  - **Use durability wisely.** Most things are `standard`. Only promote to `persistent` for things that should survive months.
207
338
  - **Search is semantic.** "deployment issues" finds memories about "CI pipeline failures" — you don't need exact keywords.
208
339
  - **Temporal queries work.** "What happened today" and "what did we ship recently" are understood.
209
- - **Dedup is automatic.** Writing the same fact twice won't create duplicates (0.7 similarity threshold).
340
+ - **Dedup is a report, not a write guard.** A successful create is stored even when it matches an earlier memory. For eligible creates, the server checks the top active candidate from the same agent using writer-overridable cosine and Jaccard thresholds, and returns `deduplicated` and `matchedId` on a match.
@@ -164,16 +164,19 @@ No shell on the hub, so mint the token remotely rather than over `ssh`:
164
164
 
165
165
  ```bash
166
166
  # On any machine — note --ops-target, this hits the ops API
167
- (umask 077; set -C; FLAIR_ADMIN_PASS="$(cat /path/to/hub-admin-pass)" flair federation token \
167
+ (umask 077; set -C; flair federation token --admin-pass-file /path/to/hub-admin-pass \
168
168
  --target https://<cluster>.<org>.harperfabric.com \
169
169
  --ops-target <ops-url> > ./pair-triple.json)
170
170
 
171
171
  # On the spoke
172
- FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair https://<cluster>.<org>.harperfabric.com \
172
+ flair federation pair https://<cluster>.<org>.harperfabric.com \
173
+ --admin-pass-file ~/.flair/admin-pass \
173
174
  --token-from ./pair-triple.json
174
175
  ```
175
176
 
176
- `federation token` takes `--admin-pass`, **not** `--admin-pass-file`. The triple holds a
177
+ `federation token` and `federation pair` both take `--admin-pass-file`, reading the
178
+ password in-process (mode 0600 enforced) so it stays out of shell history and the process
179
+ list; `--admin-pass` still works but lands in both, and `FLAIR_ADMIN_PASS` suits CI. The triple holds a
177
180
  one-time credential — delete it after pairing (60-min TTL, `--ttl`). `set -C` refuses to
178
181
  overwrite an existing `pair-triple.json`, so remove an old one first.
179
182
 
@@ -216,7 +216,7 @@ These are read by the Harper process at boot (same places as the table above: la
216
216
  | Variable | Default | What it does |
217
217
  |----------|---------|--------------|
218
218
  | `FLAIR_EMBED_THREADS` | `max(1, availableParallelism() − 1)` | CPU threads for in-process embedding (harper-fabric-embeddings / llama.cpp). Host-aware so a 4-core box does not inherit HFE's fixed 6, and an 8-vCPU ingest host is not stuck at 6 idle cores. One core is left for Harper's event loop and the OS. `availableParallelism()` respects a container CPU quota. Set a positive integer to pin. Invalid values fall back to the default. |
219
- | `FLAIR_EMBED_GPU_LAYERS` | derived: `99` when a usable Metal backend is present (darwin-arm64 + resolvable `@node-llama-cpp/mac-arm64-metal`), else `0` | Layers to offload to the GPU. Unset **derives** the default and states it on the boot log and `/Health` (`embedding.backend` / `gpuLayers` / `source`). `0` = pin CPU; `99` = full offload. Invalid values fall through to the derived default. If offload is requested and Metal does not engage, Health and the log state the CPU fallback — they never claim GPU for a CPU run. |
219
+ | `FLAIR_EMBED_GPU_LAYERS` | derived: `99` when a usable Metal backend is present (darwin-arm64 + resolvable `@node-llama-cpp/mac-arm64-metal`), else `0` | Layers to offload to the GPU. Unset **derives** the default and states it on the boot log and `/Health` (`embedding.backend` / `gpuLayers` / `source`). `0` = pin CPU; `99` = full offload. Invalid values fall through to the derived default. `0` reports `cpu` / `gpuLayers: 0` without a readback. For an offload request, Health reports after warmup the GPU type from the native binding that warmup already opened (not a second addon): `metal` with the requested layer count when that binding says Metal, `cpu` / `gpuLayers: 0` only when that binding says no GPU, and `unconfirmed` / `gpuLayers: null` when it exposes no readback. While warmup is running, Health reports the unconfirmed preview with `pending: true`; HealthDetail calls it "pending (warmup in progress)", and `flair doctor` treats it as advisory even when `source=env`. The pending field disappears when warmup finishes. Health does not infer CPU from an empty log capture or from a different binary, and it does not claim GPU for a run the engine says is on CPU. A finished `source=detected` miss stays advisory in `flair doctor`; a finished `source=env` miss stays blocking. |
220
220
  | `FLAIR_HYBRID_RETRIEVAL` | `true` | Hybrid BM25 + vector retrieval. Set `false` / `0` / `off` to revert to the legacy HNSW + keyword-bump path. |
221
221
  | `FLAIR_MODELS_DIR` | `<data-dir>/models` | Directory the embedding GGUF is loaded from (and downloaded into on first boot). Point this at a pre-seeded directory to skip the HuggingFace download; see [troubleshooting.md](troubleshooting.md). |
222
222
 
@@ -272,13 +272,13 @@ flair memory search "deploy schedule" --agent mybot
272
272
  Federation, which has no in-process equivalent:
273
273
 
274
274
  ```bash
275
- (umask 077; set -C; FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation token > triple.json)
276
- FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair <hub-url> --token-from ./triple.json
275
+ (umask 077; set -C; flair federation token --admin-pass-file ~/.flair/admin-pass > triple.json)
276
+ flair federation pair <hub-url> --admin-pass-file ~/.flair/admin-pass --token-from ./triple.json
277
277
  flair federation sync enable --interval 300
278
278
  flair federation status
279
279
  ```
280
280
 
281
- `set -C` makes the redirect refuse an existing `triple.json` (and `umask 077` only modes a file it creates); remove an old one first (`rm triple.json`). `--admin-pass` is also accepted but puts the password in shell history and process listings; prefer the environment form above (or a secret manager).
281
+ `set -C` makes the redirect refuse an existing `triple.json` (and `umask 077` only modes a file it creates); remove an old one first (`rm triple.json`). `--admin-pass-file` reads the password in-process (mode 0600 enforced), so it stays out of shell history and the process list; `--admin-pass` is also accepted but lands in both, and `FLAIR_ADMIN_PASS` suits CI.
282
282
 
283
283
  `sync enable` landed **after 0.30.0**; on an older install, schedule the one-shot yourself.
284
284
 
@@ -35,7 +35,7 @@ Pairing connects a spoke to a hub with mutual key pinning and an auth-aware hand
35
35
  On the hub machine, the admin runs `flair federation token`. The command emits a JSON triple containing a one-time bootstrap credential:
36
36
 
37
37
  ```bash
38
- FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation token
38
+ flair federation token --admin-pass-file ~/.flair/admin-pass
39
39
  ```
40
40
 
41
41
  Output (a single JSON object):
@@ -56,10 +56,10 @@ On the spoke machine:
56
56
 
57
57
  ```bash
58
58
  # From a file
59
- FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair <hub-url> --token-from /path/to/triple.json
59
+ flair federation pair <hub-url> --admin-pass-file ~/.flair/admin-pass --token-from /path/to/triple.json
60
60
 
61
61
  # From stdin
62
- cat triple.json | FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair <hub-url> --token-from -
62
+ cat triple.json | flair federation pair <hub-url> --admin-pass-file ~/.flair/admin-pass --token-from -
63
63
  ```
64
64
 
65
65
  **4. Behind the scenes**
@@ -76,20 +76,21 @@ Earlier designs relied on `allowCreate=true` combined with body-only authenticat
76
76
 
77
77
  ## Fabric Pairing Example
78
78
 
79
- A managed Harper Fabric hub has no shell. Mint the triple from any machine that can reach it, then pair from the spoke. `FLAIR_ADMIN_PASS` on that mint is the **hub/cluster** admin (the admin file on the hub host, or a secret manager), not the spoke's `~/.flair/admin-pass`. `--admin-pass` is also accepted but puts the password in shell history and process listings; prefer the environment form below. The full bring-up, including why `--ops-target` names port 9925, is [spoke-bringup.md §5a](spoke-bringup.md#harper-fabric-hub-no-shell). <!-- docs-freshness-allow: Fabric ops API port, not legacy data port -->
79
+ A managed Harper Fabric hub has no shell. Mint the triple from any machine that can reach it, then pair from the spoke. The `--admin-pass-file` on that mint is the **hub/cluster** admin (the admin file on the hub host, or a secret manager), not the spoke's `~/.flair/admin-pass`. `--admin-pass-file` reads the password in-process (mode 0600 enforced) so it stays out of shell history and the process list; `--admin-pass` is also accepted but lands in both, and `FLAIR_ADMIN_PASS` suits CI. The full bring-up, including why `--ops-target` names port 9925, is [spoke-bringup.md §5a](spoke-bringup.md#harper-fabric-hub-no-shell). <!-- docs-freshness-allow: Fabric ops API port, not legacy data port -->
80
80
 
81
81
  ```bash
82
82
  # 1. On any machine (the spoke itself is fine) — no ssh, no scp.
83
83
  # umask 077 sets the mode of a file the redirect CREATES; set -C makes the redirect
84
84
  # refuse to overwrite an existing one, so a retry cannot truncate-and-reuse a looser file.
85
- # /path/to/hub-admin-pass is a 0600 file holding the HUB admin password, not ~/.flair/admin-pass on this machine; a literal here would land in shell history.
86
- (umask 077; set -C; FLAIR_ADMIN_PASS="$(cat /path/to/hub-admin-pass)" flair federation token \
85
+ # /path/to/hub-admin-pass is a 0600 file holding the HUB admin password, not ~/.flair/admin-pass on this machine.
86
+ (umask 077; set -C; flair federation token --admin-pass-file /path/to/hub-admin-pass \
87
87
  --target https://<hub>.<org>.harperfabric.com \
88
88
  --ttl 60 \
89
89
  --ops-target https://<hub>.<org>.harperfabric.com:9925 > ./pair-triple.json) # docs-freshness-allow: Fabric ops API port, not legacy data port
90
90
 
91
91
  # 2. On the spoke — the SPOKE admin password (its own ~/.flair/admin-pass) writes the local Peer row; the mint above used the hub admin
92
- FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair https://<hub>.<org>.harperfabric.com \
92
+ flair federation pair https://<hub>.<org>.harperfabric.com \
93
+ --admin-pass-file ~/.flair/admin-pass \
93
94
  --token-from ./pair-triple.json
94
95
  ```
95
96
 
@@ -105,10 +106,16 @@ the observability limits of a node you have no shell on. See
105
106
  Push local changes to the hub, once:
106
107
 
107
108
  ```bash
108
- flair federation sync --admin-pass <password>
109
+ flair federation sync --admin-pass-file ~/.flair/admin-pass
109
110
  # Output: ✅ Synced 12 records (0 skipped) in 145ms
110
111
  ```
111
112
 
113
+ `sync` and `verify` take the admin password from `--admin-pass-file` (an owner-only
114
+ file, mode 0600 enforced). In CI, where a file is awkward, set `FLAIR_ADMIN_PASS`
115
+ instead: an explicit `--admin-pass-file` or `--admin-pass` overrides it, and giving
116
+ both the file and `--admin-pass` is a usage error. Avoid `--admin-pass` itself — it
117
+ lands in shell history and the process list.
118
+
112
119
  ### What a push sends
113
120
 
114
121
  Each sync pushes rows changed since the cursor from four tables: `Memory`, `Soul`, `Agent`, and `Relationship`. `Presence` is not in that set.
@@ -262,7 +269,7 @@ Records with `updatedAt` more than 5 minutes in the future are rejected. This pr
262
269
  | `flair federation sync disable [--remove-shim]` | Remove the scheduled sync driver |
263
270
  | `flair federation sync status` | Show whether the driver is installed and genuinely active |
264
271
  | `flair federation watch [--interval <s>]` | Run sync in a foreground loop for an interactive session (default 30s) |
265
- | `flair federation verify [--wait <s>] [--admin-pass <pass>]` | Write a canary, push it, and check each peer. Flag/file admin credentials authenticate the admin-gated peer listing. 401/403, unreachable, and revoked are UNVERIFIABLE (warning, exit 0); a reachable peer missing the canary still FAILs (exit 1). |
272
+ | `flair federation verify [--wait <s>] [--admin-pass-file <path>]` | Write a canary, push it, and check each peer. Flag/file admin credentials authenticate the admin-gated peer listing. 401/403, unreachable, and revoked are UNVERIFIABLE (warning, exit 0); a reachable peer missing the canary still FAILs (exit 1). |
266
273
  | `flair federation reachability` | Probe local instance + each paired peer (read-only) |
267
274
  | `flair federation token [--ttl <min>]` | Generate a one-time pairing token triple (hub only) |
268
275
 
@@ -309,7 +316,7 @@ flair federation unpin <instanceId>
309
316
  ```
310
317
 
311
318
  HTTP paths (`/FederationPair`, `/FederationSync`, `/FederationInstance`,
312
- `/FederationPeers`) and the Instance / Peer / PairingToken / Nonce / SyncLog
319
+ `/FederationPeers`) and the Instance / Peer / PairingToken / SyncLog / ReplayNonce
313
320
  schemas: **[docs/api-reference.md](api-reference.md#federation)**.
314
321
 
315
322
  ## Limitations (1.0)
@@ -213,13 +213,14 @@ See [upgrade.md](upgrade.md#upgrading-a-fabric-deployed-instance) for the full w
213
213
  Available. Pair a local spoke to a Fabric-hosted hub:
214
214
 
215
215
  ```bash
216
- # On any machine (no shell on the hub) — generate a pairing token triple. /path/to/hub-admin-pass is a 0600 file holding the HUB admin password (never a literal on the command line: it would land in shell history)
217
- (umask 077; set -C; FLAIR_ADMIN_PASS="$(cat /path/to/hub-admin-pass)" flair federation token \
216
+ # On any machine (no shell on the hub) — generate a pairing token triple. /path/to/hub-admin-pass is a 0600 file holding the HUB admin password; --admin-pass-file reads it in-process, never as a literal on the command line
217
+ (umask 077; set -C; flair federation token --admin-pass-file /path/to/hub-admin-pass \
218
218
  --target https://<cluster>.<org>.harperfabric.com \
219
219
  --ops-target <ops-url> > ./pair-triple.json)
220
220
 
221
221
  # On the spoke — the SPOKE admin password (its own ~/.flair/admin-pass) writes the local Peer row
222
- FLAIR_ADMIN_PASS="$(cat ~/.flair/admin-pass)" flair federation pair https://<cluster>.<org>.harperfabric.com \
222
+ flair federation pair https://<cluster>.<org>.harperfabric.com \
223
+ --admin-pass-file ~/.flair/admin-pass \
223
224
  --token-from ./pair-triple.json
224
225
  ```
225
226
 
@@ -1,8 +1,8 @@
1
1
  # Flair integrations
2
2
 
3
- Where Flair already runs. Each integration shown here is a working surface — the same memory, federated across all of them, scoped per-agent by Ed25519 keys.
3
+ Where Flair already runs. Each integration can reach one shared Flair memory store; signed requests identify an agent, while other verified agents may read its non-private records, and n8n uses admin Basic auth.
4
4
 
5
- > **The point.** Memory should follow the agent across orchestrators. Every entry below pulls from the same Flair instance, sees the same `agentId` namespace, respects the same isolation. Pick whichever harness you're shipping in; the memory layer doesn't care.
5
+ > **The point.** Memory can follow an agent across orchestrators. Integrations using an ordinary Ed25519 agent key can write under that identity and read their own plus other agents' non-private records. Administrator agent roles have broader authority. n8n uses Harper administrator Basic auth; stdio MCP, Pi, LangGraph, and the wake runner can also use it when no signing key resolves. Administrator Basic auth can read private records and write under any agent ID. Choose an integration with its authentication and recall behavior in mind.
6
6
 
7
7
  ---
8
8
 
@@ -18,15 +18,15 @@ Where Flair already runs. Each integration shown here is a working surface — t
18
18
  | **Antigravity CLI** (`agy`) | [`flair-mcp`](#claude-code-cursor-codex-gemini-cli-continuedev-via-flair-mcp) | MCP config | `~/.gemini/config/mcp_config.json`; pickup by a live `agy` pending verification |
19
19
  | **Goose** (block/goose) | [`flair-mcp`](#claude-code-cursor-codex-gemini-cli-continuedev-via-flair-mcp) | MCP config | Goose ships native MCP support |
20
20
  | **DeepSeek Harness** (`dsh`) | [`flair-mcp`](deepseek-harness.md) | Cordis overlay | First-party MCP bridge; tools-only, reactive recall — [dedicated page](deepseek-harness.md) |
21
- | **LangGraph (TS)** | [`langgraph-flair`](#langgraph-typescript) | FlairClient | Drop-in `BaseStore` |
22
- | **OpenClaw** | [`openclaw-flair`](#openclaw) | Ed25519 | Native plugin + context engine |
21
+ | **LangGraph (TS)** | [`langgraph-flair`](#langgraph-typescript) | FlairClient | FlairStore provides get, put, delete, search, and batch (limitations apply) |
22
+ | **OpenClaw** | [`openclaw-flair`](#openclaw) | Ed25519 | Native plugin (context-engine slot left intact) |
23
23
  | **n8n** | [`n8n-nodes-flair`](#n8n) | FlairApi credential | Three nodes (chat memory, search, store) |
24
24
  | **Hermes Agent** | [`hermes-flair`](#hermes-agent) | Ed25519 | Python `MemoryProvider` |
25
- | **Pi agent** | [`pi-flair`](#pi-agent) | Ed25519 | Native pi extension (pi has no MCP support); `flair init --client pi` wires it, `flair doctor` checks it |
25
+ | **Pi agent** | [`pi-flair`](#pi-agent) | Ed25519 | Native pi extension (pi has no MCP support); with `--agent <id>` and wiring enabled, `flair init` attempts Pi wiring for `--client pi`, for detected Pi under `--client all`, or for detected Pi when `--client` is omitted; `--client none` and `--no-mcp` skip it. |
26
26
  | **Google ADK** (Python) | [`adk-flair`](../packages/adk-flair/README.md) | Ed25519 | `BaseMemoryService`; see [hosted auth](#hosted-flair-auth--your-agent-got-a-404) if you just got a 404 |
27
27
  | **Google ADK** (JS/TS) | [`@tpsdev-ai/adk-flair`](../packages/adk-flair-js/README.md) | Ed25519 | Same identity model as the Python package |
28
28
 
29
- Don't see your harness? If it speaks **MCP** — Flair already works with `flair-mcp`. If it has a **custom memory protocol** like LangGraph's `BaseStore` or CrewAI's `RAGStorage`, an adapter is a ~200-line package; [open an issue](https://github.com/tpsdev-ai/flair/issues) or [send a PR](https://github.com/tpsdev-ai/flair).
29
+ Don't see your harness? If it speaks **MCP** — Flair already works with `flair-mcp`. For a custom memory protocol such as LangGraph's `BaseStore` or CrewAI's `RAGStorage`, an adapter must translate that protocol's operations to Flair; [open an issue](https://github.com/tpsdev-ai/flair/issues) or [send a PR](https://github.com/tpsdev-ai/flair).
30
30
 
31
31
  **Already running on Harper?** Every surface above reaches Flair over HTTP. If your application is itself a Harper app, you can skip the network entirely — load Flair as a component of the same instance and call its resources in-process. See [embedding-in-a-harper-app.md](embedding-in-a-harper-app.md), which also covers the table-vs-resource distinction that decides whether your memories are scoped.
32
32
 
@@ -76,9 +76,12 @@ A verified agent that is not allowed the row gets 404, never 403. Anonymous by-i
76
76
 
77
77
  | Adapter | URL | Agent id | Keyfile | Hosted extras |
78
78
  |---|---|---|---|---|
79
- | **adk-flair** / **adk-flair-js** | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | `FLAIR_ALLOW_REMOTE_URL=1`, `FLAIR_HTTP_TIMEOUT` — [adk-flair README](../packages/adk-flair/README.md#hosted-flair) |
79
+ | **adk-flair** (Python) | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | `FLAIR_ALLOW_REMOTE_URL=1`, `FLAIR_HTTP_TIMEOUT` — [adk-flair README](../packages/adk-flair/README.md#hosted-flair) |
80
+ | **adk-flair-js** (JS/TS) | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEYFILE` | For a non-localhost URL, set `FLAIR_ALLOW_REMOTE_URL=1`; request timeout comes from constructor `timeoutMs` (default 2000 ms), not `FLAIR_HTTP_TIMEOUT` — [adk-flair-js README](../packages/adk-flair-js/README.md) |
80
81
  | **flair-mcp** / Cursor plugin | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` (optional; auto-resolved) | Key must be on the **npx host** |
81
- | **Hermes / pi / LangGraph** | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` or client `keyPath` | Same Ed25519 model |
82
+ | **Hermes** | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` or Hermes `key_path` | Same Ed25519 model |
83
+ | **Pi** | `FLAIR_URL` | `FLAIR_AGENT_ID` | `FLAIR_KEY_PATH` or Pi client `keyPath` | Same Ed25519 model |
84
+ | **LangGraph** | `FLAIR_URL` | `config.agentId` (required) | Signed requests use `config.privateKey`, `config.keyPath`, or automatic key candidates (`FLAIR_KEY_DIR`, then standard paths); it does not read `FLAIR_KEY_PATH`. | Admin credentials provide a Basic-auth fallback when no key is available. |
82
85
 
83
86
  n8n still uses Harper admin Basic auth — it is not this path. See [n8n.md](n8n.md#security).
84
87
 
@@ -88,7 +91,7 @@ n8n still uses Harper admin Basic auth — it is not this path. See [n8n.md](n8n
88
91
 
89
92
  [`@tpsdev-ai/flair-mcp`](https://www.npmjs.com/package/@tpsdev-ai/flair-mcp) is a [Model Context Protocol](https://modelcontextprotocol.io/) server that exposes Flair as a memory tool to any MCP-speaking client. One server, every MCP client.
90
93
 
91
- No install step needed — every snippet below uses `npx -y @tpsdev-ai/flair-mcp`, which fetches and runs the server on demand (zero-install). The fastest path is `flair init`, which detects and wires these clients for you. To wire by hand, drop the relevant snippet into each tool's MCP config:
94
+ No install step needed — every snippet below uses `npx -y @tpsdev-ai/flair-mcp`, which fetches and runs the server on demand (zero-install). The fastest path is `flair init --agent <id>`, which attempts to wire detected clients when wiring is enabled. To wire by hand, drop the relevant snippet into each tool's MCP config:
92
95
 
93
96
  **Claude Code** (user scope lives in `~/.claude.json` — the file `claude mcp add`, `flair init`, and `flair doctor` all read and write):
94
97
  ```bash
@@ -156,7 +159,7 @@ Full per-tool walkthrough including troubleshooting: [`docs/mcp-clients.md`](mcp
156
159
 
157
160
  ## LangGraph (TypeScript)
158
161
 
159
- [`@tpsdev-ai/langgraph-flair`](https://www.npmjs.com/package/@tpsdev-ai/langgraph-flair) implements LangGraph's `BaseStore`. Drop-in for `InMemoryStore`.
162
+ [`@tpsdev-ai/langgraph-flair`](https://www.npmjs.com/package/@tpsdev-ai/langgraph-flair) implements LangGraph's `BaseStore` interface. FlairStore provides get, put, delete, search, batch, listNamespaces, start, and stop; see the package README for its API and retrieval limitations.
160
163
 
161
164
  ```bash
162
165
  npm install @tpsdev-ai/langgraph-flair
@@ -170,21 +173,21 @@ const store = new FlairStore({ agentId: "my-langgraph-agent" });
170
173
  const agent = createReactAgent({ llm, tools, store });
171
174
  ```
172
175
 
173
- Maps LangGraph namespaces to Flair tags, keys to ids, values to JSON content. Search delegates to Flair's HNSW. Filter operators applied client-side. Full mapping table: [`packages/langgraph-flair/README.md`](../packages/langgraph-flair/README.md).
176
+ Maps LangGraph namespaces to Flair tags, keys to ids, values to JSON content. Non-empty search queries call Flair's `/SemanticSearch` endpoint. The server selects hybrid (BM25 plus vector), vector-only, or BM25-only retrieval; embedding availability affects whether the vector leg can run. Filter operators applied client-side. Full mapping table: [`packages/langgraph-flair/README.md`](../packages/langgraph-flair/README.md).
174
177
 
175
- LangGraph **Python** support is on the roadmap (same `BaseStore` shape, Python adapter).
178
+ This package contains the TypeScript adapter; it does not include a Python implementation.
176
179
 
177
180
  ---
178
181
 
179
182
  ## OpenClaw
180
183
 
181
- [`@tpsdev-ai/openclaw-flair`](https://www.npmjs.com/package/@tpsdev-ai/openclaw-flair) is the native OpenClaw plugin. Adds Flair as a memory provider AND registers the `flair` context engine that re-injects PERMANENT-tier rules (SOUL.md, IDENTITY.md, AGENTS.md) every turn.
184
+ [`@tpsdev-ai/openclaw-flair`](https://www.npmjs.com/package/@tpsdev-ai/openclaw-flair) is the native OpenClaw plugin. Adds Flair as a memory provider AND provides bootstrap through a `before_prompt_build` hook (context-engine slot left intact; the host's native memory section stays untouched).
182
185
 
183
186
  ```bash
184
187
  openclaw plugins install @tpsdev-ai/openclaw-flair
185
188
  ```
186
189
 
187
- Configuration via OpenClaw's standard plugin surface. See [`docs/openclaw.md`](openclaw.md) for the per-agent install pattern, including how to wire SOUL.md so behavioral anchors persist across long sessions without drift.
190
+ Configuration via OpenClaw's standard plugin surface. See [`docs/openclaw.md`](openclaw.md) for the per-agent install pattern. The host's own workspace files load each agent's `SOUL.md` / `AGENTS.md`; Flair does not manage or anchor these.
188
191
 
189
192
  ---
190
193
 
@@ -194,7 +197,11 @@ Configuration via OpenClaw's standard plugin surface. See [`docs/openclaw.md`](o
194
197
 
195
198
  - **FlairChatMemory** — drop-in chat-memory for n8n's AI Agent / LangChain workflow nodes. Same role as Postgres / Redis chat memory but with cross-orchestrator portability.
196
199
  - **FlairSearch** — semantic search over your Flair memories from any workflow.
197
- - **FlairApi** credential — Ed25519 keypair entry point for the agentId.
200
+ - **FlairWrite** — pipeline-mode node that writes a memory into Flair.
201
+
202
+ The FlairApi credential provides authentication.
203
+
204
+ **FlairApi credential** — Harper administrator password for Basic authentication; Agent ID selects memory ownership and does not restrict the credential's instance-wide authority.
198
205
 
199
206
  Install via the standard n8n community-node UI (Settings → Community nodes → `@tpsdev-ai/n8n-nodes-flair`) or:
200
207
 
@@ -222,15 +229,15 @@ Auth: TPS-Ed25519 (the same model the rest of Flair uses) — writes are isolate
222
229
 
223
230
  [`@tpsdev-ai/pi-flair`](https://www.npmjs.com/package/@tpsdev-ai/pi-flair) is the **native pi extension** for the [Pi coding agent](https://github.com/mariozechner/pi-coding-agent) — pi has no MCP client support, so this is a first-party plugin, not an MCP bridge. Memory + identity (`memory_search`, `memory_store`, `bootstrap`) for the pi runtime.
224
231
 
225
- Wire it (either form is equivalent):
232
+ To provision an agent and wire Pi, use the init command below; if the agent is already provisioned, install the extension with Pi's installer.
226
233
 
227
234
  ```bash
228
- flair init --client pi # writes a pinned "packages" entry into ~/.pi/agent/settings.json
235
+ flair init --agent my-agent --client pi # attempts to wire Pi with a CLI-version pin
229
236
  # or
230
237
  pi install npm:@tpsdev-ai/pi-flair
231
238
  ```
232
239
 
233
- Which produces:
240
+ When Flair writes a new Pi package entry, it uses this version-pinned form:
234
241
 
235
242
  ```json
236
243
  {
@@ -238,6 +245,8 @@ Which produces:
238
245
  }
239
246
  ```
240
247
 
248
+ `pi install npm:@tpsdev-ai/pi-flair` records the unpinned source `npm:@tpsdev-ai/pi-flair` instead.
249
+
241
250
  **Known trap:** the `extensions` settings key takes local file paths only — an `npm:` spec there is *silently ignored* by pi, so the tools never register ([#1346](https://github.com/tpsdev-ai/flair/issues/1346)). Package sources belong under `packages`. `flair doctor` detects pi, verifies the wiring, calls this exact misconfiguration out, and `flair doctor --fix` moves the entry.
242
251
 
243
252
  pi settings carry no per-package env, so identity comes from the environment that launches pi:
@@ -255,7 +264,7 @@ Full details (tools, env reference, auto-recall/auto-capture flags, security not
255
264
 
256
265
  If it speaks MCP, you're already covered — every MCP client works through `flair-mcp` (the section above lists 6 we've explicitly tested).
257
266
 
258
- If it has a custom memory protocol, the adapter pattern is small (~200 lines). LangGraph and Hermes are the reference implementations. **Adapters we'd love to see:**
267
+ If it has a custom memory protocol, an adapter must translate its operations, identity, and retrieval semantics to Flair. LangGraph and Hermes are the reference implementations. **Adapters we'd love to see:**
259
268
 
260
269
  - LangGraph Python (mirror of our TS adapter)
261
270
  - CrewAI (Python `BaseRAGStorage` protocol)