@tpsdev-ai/flair 0.55.2 → 0.57.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 (106) hide show
  1. package/README.md +18 -19
  2. package/dist/bridges/builtins/markdown.js +2 -2
  3. package/dist/bridges/discover.js +2 -2
  4. package/dist/bridges/runtime/allow-list.js +2 -2
  5. package/dist/build-info.json +3 -3
  6. package/dist/cli.js +125 -26
  7. package/dist/commands/agent.js +22 -15
  8. package/dist/commands/attention.js +2 -2
  9. package/dist/commands/backup.js +2 -2
  10. package/dist/commands/bridge.js +40 -3
  11. package/dist/commands/doctor.js +91 -28
  12. package/dist/commands/export.js +2 -2
  13. package/dist/commands/federation.js +441 -68
  14. package/dist/commands/hook.js +4 -4
  15. package/dist/commands/init.js +59 -12
  16. package/dist/commands/mcp.js +2 -2
  17. package/dist/commands/migrate-harness-memory.js +8 -8
  18. package/dist/commands/rem.js +2 -2
  19. package/dist/commands/service.js +25 -1
  20. package/dist/commands/session.js +2 -2
  21. package/dist/commands/uninstall.js +2 -2
  22. package/dist/commands/upgrade.js +3 -3
  23. package/dist/doctor-client.js +5 -23
  24. package/dist/engine-version.js +2 -2
  25. package/dist/federation/scheduler.js +5 -5
  26. package/dist/install/clients.js +5 -10
  27. package/dist/keystore.js +10 -2
  28. package/dist/lib/auth-resolve.js +51 -5
  29. package/dist/lib/doctor-config-path.js +2 -2
  30. package/dist/lib/flair-paths.js +29 -0
  31. package/dist/lib/home.js +60 -0
  32. package/dist/lib/instance-identity-row.js +580 -0
  33. package/dist/lib/launchd-repair.js +6 -0
  34. package/dist/lib/mcp-enable.js +4 -4
  35. package/dist/lib/owned-pins.js +1 -13
  36. package/dist/lib/redact-token-id.js +197 -0
  37. package/dist/lib/socket-path-limit.js +120 -0
  38. package/dist/lib/uninstall-purge.js +2 -18
  39. package/dist/lib/upgrade-plain-tree.js +2 -2
  40. package/dist/mcp-client-assertion.js +3 -3
  41. package/dist/rem/runner.js +3 -3
  42. package/dist/rem/scheduler.js +5 -5
  43. package/dist/rem/snapshot.js +2 -2
  44. package/dist/resources/AgentSeed.js +4 -1
  45. package/dist/resources/Asset.js +3 -11
  46. package/dist/resources/Credential.js +4 -10
  47. package/dist/resources/Federation.js +232 -78
  48. package/dist/resources/Integration.js +8 -32
  49. package/dist/resources/Memory.js +58 -16
  50. package/dist/resources/MemoryBootstrap.js +19 -12
  51. package/dist/resources/MemoryCandidate.js +3 -11
  52. package/dist/resources/MemoryDedupStats.js +1 -1
  53. package/dist/resources/MemoryFeed.js +10 -2
  54. package/dist/resources/MemoryGrant.js +19 -40
  55. package/dist/resources/MemoryUsage.js +7 -20
  56. package/dist/resources/OAuth.js +62 -11
  57. package/dist/resources/Presence.js +135 -47
  58. package/dist/resources/Relationship.js +3 -11
  59. package/dist/resources/SemanticSearch.js +25 -13
  60. package/dist/resources/admin-layout.js +7 -2
  61. package/dist/resources/auth-middleware.js +32 -5
  62. package/dist/resources/bm25.js +13 -14
  63. package/dist/resources/federation-cleanup.js +289 -51
  64. package/dist/resources/health.js +48 -8
  65. package/dist/resources/in-process-api.js +2 -1
  66. package/dist/resources/instance-create-lock.js +363 -0
  67. package/dist/resources/instance-identity-rows.js +43 -0
  68. package/dist/resources/instance-identity.js +94 -10
  69. package/dist/resources/mcp-handler.js +9 -1
  70. package/dist/resources/mcp-tool-arguments.js +83 -0
  71. package/dist/resources/mcp-tools.js +4 -5
  72. package/dist/resources/memory-reflect-lib.js +17 -1
  73. package/dist/resources/memory-visibility.js +10 -7
  74. package/dist/resources/rate-limit.js +6 -4
  75. package/dist/resources/record-type-kit.js +47 -23
  76. package/dist/resources/search-readiness.js +7 -1
  77. package/dist/resources/semantic-retrieval-core.js +98 -3
  78. package/dist/resources/table-helpers.js +33 -0
  79. package/dist/resources/tool-descriptors/index.js +2 -2
  80. package/dist/src/keystore.js +10 -2
  81. package/dist/src/lib/home.js +60 -0
  82. package/dist/src/lib/instance-identity-row.js +580 -0
  83. package/dist/src/lib/redact-token-id.js +197 -0
  84. package/dist/src/rem/scheduler.js +5 -5
  85. package/dist/version-check.js +2 -2
  86. package/dist/version-handshake.js +2 -2
  87. package/docs/api-reference.md +32 -7
  88. package/docs/auth.md +19 -7
  89. package/docs/claude-code.md +5 -6
  90. package/docs/deploying-on-fabric.md +8 -4
  91. package/docs/deployment.md +26 -37
  92. package/docs/embedding-in-a-harper-app.md +4 -2
  93. package/docs/entity-vocabulary.md +5 -5
  94. package/docs/federation.md +48 -21
  95. package/docs/hosted-on-fabric.md +7 -4
  96. package/docs/integrations.md +24 -15
  97. package/docs/mcp-clients.md +44 -23
  98. package/docs/n8n.md +8 -8
  99. package/docs/notes/mcp-oauth-model2.md +12 -17
  100. package/docs/openclaw.md +29 -28
  101. package/docs/spoke-bringup.md +44 -22
  102. package/docs/standalone-local.md +12 -16
  103. package/docs/supply-chain-policy.md +21 -8
  104. package/docs/system-requirements.md +1 -1
  105. package/docs/upgrade.md +2 -2
  106. package/package.json +1 -1
@@ -10,9 +10,9 @@ matching across free-text fields.
10
10
  This document is that convention. It's written down and enforced by a small validator
11
11
  (`resources/entity-vocab.ts`) **before** anything is built on top of it, because three
12
12
  surfaces already consume entity strings today (the `Relationship` graph's `subject`/`object`,
13
- and the new `entities` fields on `WorkspaceState`/`OrgEvent`/`Memory`), plus a future
14
- attention query and any future MCP scope field — retrofitting a divergent vocabulary later
15
- is expensive.
13
+ and the new `entities` fields on `WorkspaceState`/`OrgEvent`/`Memory`), plus the attention
14
+ query and bootstrap collision surfacing (both shipped in later slices) and any future MCP
15
+ scope field — retrofitting a divergent vocabulary later is expensive.
16
16
 
17
17
  > This doc covers the vocabulary and validator only — the foundation slice of the attention
18
18
  > plane (flair#675). The attention query ("what touches entity E in the last N days") and
@@ -84,7 +84,7 @@ Per the attention-plane spec's K&S-approved refinements, `entities: [String] @in
84
84
  - `WorkspaceState` (`schemas/workspace.graphql`)
85
85
  - `OrgEvent` (`schemas/event.graphql`)
86
86
  - `Memory` (`schemas/memory.graphql`) — added in v1 (not deferred to v2) for index-pushdown
87
- uniformity across all three sources the future attention query joins.
87
+ uniformity across all three sources the attention query (shipped in a later slice) joins.
88
88
 
89
89
  Existing rows on all three tables simply carry no `entities` — readers must tolerate absence,
90
90
  the same pattern already used for `Presence.activityUpdatedAt`. No migration, no backfill.
@@ -111,7 +111,7 @@ vocabulary; wiring that validation is a follow-up, not part of this foundation s
111
111
 
112
112
  ## What's explicitly NOT in this slice
113
113
 
114
- - The attention query (`AttentionQuery` / `flair attention <entity>`) that joins Memory,
114
+ - The attention query (`AttentionQuery` / `flair attention <type:value>`) that joins Memory,
115
115
  Relationship, WorkspaceState, Presence, and OrgEvent by entity — shipped in flair#678
116
116
  (`resources/AttentionQuery.ts`), a later slice.
117
117
  - Bootstrap collision surfacing ("others in the room") — shipped in flair#681
@@ -4,7 +4,7 @@ Hub-and-spoke sync between Flair instances. A hub instance coordinates sync for
4
4
 
5
5
  ## Overview
6
6
 
7
- Federation lets multiple Flair instances share memories, relationships, and agent records **in one direction per call**. Each instance maintains its own Ed25519 identity. Sync requests are signed and verified against pinned peer public keys.
7
+ Federation lets multiple Flair instances share memories, relationships, and agent records **in one direction per call**. Each instance maintains its own Ed25519 identity. Sync requests are signed and verified against pinned peer public keys. A push omits private memories — see [What a push sends](#what-a-push-sends).
8
8
 
9
9
  ```
10
10
  Spoke A ──[POST /FederationSync]──▶ Hub
@@ -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 federation token --admin-pass <hub-admin-password>
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 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 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,21 +76,25 @@ Earlier designs relied on `allowCreate=true` combined with body-only authenticat
76
76
 
77
77
  ## Fabric Pairing Example
78
78
 
79
- When the hub runs on Harper Fabric, adapt the hub URL to the Fabric pattern:
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
- # 1. Hub admin generates the triple (on the Fabric host)
83
- ssh hub-host
84
- flair federation token --admin-pass <hub-admin-password> > /tmp/pair-triple.json
85
-
86
- # 2. Transfer the triple to the spoke admin (out-of-band)
87
- scp hub-host:/tmp/pair-triple.json ./pair-triple.json
88
-
89
- # 3. Spoke admin pairs using the Fabric URL
90
- flair federation pair https://<fabric-node>:19926/<instance-name> --token-from ./pair-triple.json
82
+ # 1. On any machine (the spoke itself is fine) — no ssh, no scp.
83
+ # umask 077 sets the mode of a file the redirect CREATES; set -C makes the redirect
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.
86
+ (umask 077; set -C; flair federation token --admin-pass-file /path/to/hub-admin-pass \
87
+ --target https://<hub>.<org>.harperfabric.com \
88
+ --ttl 60 \
89
+ --ops-target https://<hub>.<org>.harperfabric.com:9925 > ./pair-triple.json) # docs-freshness-allow: Fabric ops API port, not legacy data port
90
+
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 federation pair https://<hub>.<org>.harperfabric.com \
93
+ --admin-pass-file ~/.flair/admin-pass \
94
+ --token-from ./pair-triple.json
91
95
  ```
92
96
 
93
- Replace `<fabric-node>`, `<instance-name>`, and `<hub-admin-password>` with your actual values.
97
+ Replace `<hub>` and `<org>` with your actual values, and point `/path/to/hub-admin-pass` at a 0600 file holding the hub admin password on the minting machine. The pair step's admin password is the spoke's, used to write the local Peer row.
94
98
 
95
99
  Running the hub on Fabric has its own considerations — port derivation against a managed
96
100
  `443` endpoint, why the sync driver can only be installed on a machine you control, and
@@ -102,10 +106,30 @@ the observability limits of a node you have no shell on. See
102
106
  Push local changes to the hub, once:
103
107
 
104
108
  ```bash
105
- flair federation sync --admin-pass <password>
109
+ flair federation sync --admin-pass-file ~/.flair/admin-pass
106
110
  # Output: ✅ Synced 12 records (0 skipped) in 145ms
107
111
  ```
108
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
+
119
+ ### What a push sends
120
+
121
+ Each sync pushes rows changed since the cursor from four tables: `Memory`, `Soul`, `Agent`, and `Relationship`. `Presence` is not in that set.
122
+
123
+ **Memory rows with `visibility` exactly `"private"` are left behind.** Durability is not the filter. `"shared"` and any other present value are included. Soul, Agent, and Relationship have no `visibility` field, so this rule does not apply to them.
124
+
125
+ A Memory row with **no `visibility` field still syncs, on purpose.** Those rows were written before the field existed. The push uses the same predicate as cross-agent read (`resolveReadScope` in `resources/memory-read-scope.ts`): only the literal string `"private"` is private. Missing, `null`, and anything else stay non-private so pre-field rows keep replicating exactly as they did. That is the migration rule, not a hole in the filter.
126
+
127
+ Private means owner-only on this instance. A peer that received the row would hold a copy other agents on that instance could read. Holding the row back is the point of `private`.
128
+
129
+ Durability still explains a count gap that is entirely `standard` rows. When a write omits `visibility`, the server defaults it from durability: `permanent` and `persistent` become `shared`; `standard`, `ephemeral`, and an omitted durability become `private`. A standard memory therefore stays on the spoke unless the writer set `visibility` to `shared`. Ephemeral memories are private-only at write time, so they never federate. That is the default and the ephemeral constraint, not a second filter and not loss of memories that were stored as shared.
130
+
131
+ `flair federation verify` writes its canary as `durability: "standard"` and `visibility: "shared"` for this reason. When every changed Memory row was withheld, sync says they were held back for private visibility instead of reporting that nothing changed.
132
+
109
133
  ### Keeping it synced
110
134
 
111
135
  `flair federation sync` is one-shot and `flair federation watch` only runs
@@ -245,7 +269,7 @@ Records with `updatedAt` more than 5 minutes in the future are rejected. This pr
245
269
  | `flair federation sync disable [--remove-shim]` | Remove the scheduled sync driver |
246
270
  | `flair federation sync status` | Show whether the driver is installed and genuinely active |
247
271
  | `flair federation watch [--interval <s>]` | Run sync in a foreground loop for an interactive session (default 30s) |
248
- | `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). |
249
273
  | `flair federation reachability` | Probe local instance + each paired peer (read-only) |
250
274
  | `flair federation token [--ttl <min>]` | Generate a one-time pairing token triple (hub only) |
251
275
 
@@ -255,13 +279,16 @@ Federation uses record-level last-write-wins (LWW) with ISO timestamp comparison
255
279
 
256
280
  ## Troubleshooting
257
281
 
258
- ### config.yaml port drift
282
+ ### Listen port drift
283
+
284
+ There is no `federation.port` key. Federation uses the hub's HTTP listen port. The spoke's pair URL has to use that port.
259
285
 
260
- If the hub's configured port in `config.yaml` differs from the port the spoke is targeting, federation requests fail with a connection error. Verify the port matches between the spoke's pair URL and the hub's `config.yaml` (`federation.port` or the instance's listen port).
286
+ On the hub, the listen port Harper last bound is `http.port` in the instance data directory (default `~/.flair/data/harper-config.yaml`). A default install also records a top-level `port:` in `~/.flair/config.yaml`. That file's port keys are `port` and `opsPort` only.
261
287
 
262
288
  ```bash
263
- # On the hub, confirm the listening port
264
- grep -E 'port|federation' ~/.flair/config.yaml
289
+ # On the hub. `http.port` is host-qualified, for example 127.0.0.1:19926.
290
+ grep -A2 '^http:' ~/.flair/data/harper-config.yaml
291
+ grep -E '^(port|opsPort):' ~/.flair/config.yaml
265
292
  ```
266
293
 
267
294
  ### Local FederationInstance fetch needs auth
@@ -213,16 +213,19 @@ 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
217
- FLAIR_ADMIN_PASS=<hub-admin-password> 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
- --ops-target <ops-url> > ./pair-triple.json
219
+ --ops-target <ops-url> > ./pair-triple.json)
220
220
 
221
- # On the spoke — pair to the Fabric hub
221
+ # On the spoke — the SPOKE admin password (its own ~/.flair/admin-pass) writes the local Peer row
222
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
 
227
+ `set -C` refuses an existing `./pair-triple.json`; remove an old one first (`rm ./pair-triple.json`).
228
+
226
229
  ### Pairing limitation
227
230
 
228
231
  The scheduled sync driver (`flair federation sync enable`) writes a launchd job or systemd timer **on the machine running the CLI** — it cannot be installed on a Fabric node. A periodic one-shot from the spoke machine is the workaround.
@@ -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,11 +18,11 @@ 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
 
@@ -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`. FlairStore provides get, put, delete, search, and batch, with the limitations below.
160
163
 
161
164
  ```bash
162
165
  npm install @tpsdev-ai/langgraph-flair
@@ -178,13 +181,13 @@ LangGraph **Python** support is on the roadmap (same `BaseStore` shape, Python a
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:
@@ -24,7 +24,7 @@ flair init
24
24
  # Provision an agent identity. Pick a name — typically per-project, per-purpose,
25
25
  # or "me" if you want one durable identity across everything.
26
26
  flair agent add my-project
27
- # → writes ~/.flair/keys/my-project.key (Ed25519 PKCS8) and registers the agent
27
+ # → writes ~/.flair/keys/my-project.key (a raw 32-byte Ed25519 seed) and registers the agent
28
28
 
29
29
  # Sanity check
30
30
  flair status
@@ -32,7 +32,20 @@ flair status
32
32
 
33
33
  > **`flair: command not found` right after installing?** Your npm global prefix's bin dir isn't on PATH (common with a user prefix like `~/.npm-global`) — run `export PATH="$(npm prefix -g)/bin:$PATH"`, persist that line in your shell profile, and `flair doctor` will print the exact line for your shell any time.
34
34
 
35
- Flair runs as a local server at `http://127.0.0.1:19926` by default. The MCP server connects to it on demand via Ed25519-signed requests; nothing leaves your machine unless you explicitly route to a remote Flair instance.
35
+ Flair runs as a local server at `http://127.0.0.1:19926` by default. The MCP server this page configures connects to it on demand via Ed25519-signed requests; nothing leaves your machine unless you explicitly route to a remote Flair instance.
36
+
37
+ ## Two MCP paths
38
+
39
+ The snippets below are the **local** path. Flair also has a native `/mcp` endpoint, and the two are not substitutes. The [README](../README.md#one-install-one-binary) names both; this section is why each exists.
40
+
41
+ | Client | Path | Auth |
42
+ |--------|------|------|
43
+ | MCP client on this machine (Claude Code, Cursor, Codex, Gemini, and the snippets below) | `npx -y @tpsdev-ai/flair-mcp@<version>` stdio adapter | Ed25519 over HTTP to the instance |
44
+ | Remote MCP client that must dial a public HTTPS origin | Native `/mcp` on the instance | OAuth bearer. Unmounted until `FLAIR_MCP_OAUTH=true` and a public issuer are set (otherwise the path 404s). |
45
+
46
+ Native `/mcp` is remote-only by design. The OAuth authorization server fetches client metadata over HTTPS and refuses private, loopback, and link-local hosts. `flair mcp enable` refuses localhost, loopback, RFC1918, IPv4 link-local, and `.local`. Set `FLAIR_MCP_OAUTH=true` — that is the one value that enables both Flair's `/mcp` route and the OAuth component. A loopback Flair cannot be the origin those clients dial. The stdio adapter is the local path because it speaks the instance's Ed25519 HTTP API and does not need that public origin.
47
+
48
+ `flair init --agent <id>` attempts to wire detected local clients unless MCP wiring is disabled; bare `flair init` only initializes the instance. Turning on native `/mcp` is a separate operator step for a publicly reachable instance, documented from the API side in [api-reference.md](api-reference.md#mcp-tools).
36
49
 
37
50
  ---
38
51
 
@@ -40,9 +53,9 @@ Flair runs as a local server at `http://127.0.0.1:19926` by default. The MCP ser
40
53
 
41
54
  Pick whichever you use. The MCP server is the same package; only the config syntax differs.
42
55
 
43
- > **Pin the version.** An unpinned `@tpsdev-ai/flair-mcp` re-resolves to whatever is currently published on *every* agent session, so any future publish reaches your machine silently, with no lockfile and no review step in the path. `flair init` wires clients to a **pinned** spec on purpose, and every MCP-server config snippet below is written the same way: `@tpsdev-ai/flair-mcp@<version>`.
56
+ > **Pin the version.** An unpinned `@tpsdev-ai/flair-mcp` re-resolves to whatever is currently published on *every* agent session, so any future publish reaches your machine silently, with no lockfile and no review step in the path. `flair init --agent <id>` attempts to wire detected clients when wiring is enabled; every MCP-server config snippet below is written the same way: `@tpsdev-ai/flair-mcp@<version>`.
44
57
  >
45
- > Replace `<version>` with the version you intend to run — the one you already have is `flair --version` — and bump it deliberately. Leaving the literal `<version>` in place fails loudly at `npx`, which is the intended failure: better than a config that looks pinned and isn't. `flair init` is the easier path and fills this in for you.
58
+ > Replace `<version>` with the version you intend to run — the one you already have is `flair --version` — and bump it deliberately. Leaving the literal `<version>` in place fails loudly at `npx`, which is the intended failure: better than a config that looks pinned and isn't. `flair init --agent <id>` can fill in the version for clients it wires; check its wiring summary for skipped or held configs.
46
59
  >
47
60
  > **Do not stay on a pin older than 0.18.0.** `@tpsdev-ai/flair-client` before 0.18.0 (and `@tpsdev-ai/flair-mcp` that shipped it) silently drops writes — including against another agent's shared memories — and a server upgrade does not fix that. `flair doctor` flags those pins; the remedy is `flair upgrade` (the adapter), not a newer Harper/Flair server alone. See [troubleshooting — silent write drop](troubleshooting.md#pre-0180-flair-client--flair-mcp-silently-drops-writes).
48
61
 
@@ -163,7 +176,7 @@ If you already have the older, unwrapped command, `flair doctor` reports it and
163
176
 
164
177
  The hook reads Claude Code's SessionStart
165
178
  payload on stdin, calls Flair's `bootstrap` (soul + relevant memories +
166
- predicted context, scoped to your project by the session's working directory),
179
+ predicted context; the hook sends a basename subject hint, and bootstrap selects a bounded set of the agent's own and recent memories under a token budget),
167
180
  and emits it as `hookSpecificOutput.additionalContext` — which Claude Code
168
181
  injects into the new session's context. The matcher is omitted, so it fires on
169
182
  every session start (`startup`, `resume`, `clear`, `compact`); add
@@ -175,8 +188,9 @@ It honors the same env as the MCP server (`FLAIR_AGENT_ID`, `FLAIR_URL`,
175
188
  `FLAIR_HOOK_HARNESS=codex` so bootstrap records the Codex channel; the
176
189
  stdout contract stays `hookSpecificOutput.additionalContext`.
177
190
 
178
- **It degrades to a no-op, always.** No `FLAIR_AGENT_ID`, Flair down, an auth
179
- error, or a hung daemon (past the timeout) → the hook prints `{}` and exits 0.
191
+ A failed bootstrap attempts a stderr diagnostic and can still return a continuity
192
+ resume hint; without either kind of context it returns `{}`, and the entry point
193
+ exits successfully.
180
194
  Claude Code treats that as "no context to add" and starts normally. The hook
181
195
  can never block or break session startup. The injected context is clamped to
182
196
  ≤10,000 characters to keep the session-start payload small. And if the command
@@ -244,7 +258,8 @@ flair hook uninstall --harness codex
244
258
 
245
259
  `flair doctor` reports this hook when Codex is detected. `flair hook install
246
260
  --harness codex` writes `FLAIR_HOOK_HARNESS=codex` and keeps hook stderr
247
- visible (auth failures must not be swallowed). After install, **re-approve**
261
+ visible; the session-start hook attempts one stderr diagnostic when bootstrap
262
+ fails (auth failures must not be swallowed). After install, **re-approve**
248
263
  the command in Codex with `/hooks` — a wiring change resets trust, and
249
264
  untrusted hooks are listed and skipped. `flair hook status --harness codex`
250
265
  reports that pending-approval state as configured but delivery not verified.
@@ -286,22 +301,26 @@ If you see (a) the agent calling the `bootstrap` tool returning soul + recent me
286
301
 
287
302
  ## What the MCP server exposes
288
303
 
289
- Twelve tools, kept deliberately small:
304
+ Clients on this page talk to the stdio server `@tpsdev-ai/flair-mcp`. Its `tools/list` advertises these sixteen tools, in this order. The embedded HTTP `/mcp` handler is a different set: it also advertises `memory_basement`, `memory_restore`, and `attention`, and it does not advertise `relationship_store` or `flair_catchup`.
290
305
 
291
306
  | Tool | What it does |
292
307
  |---|---|
293
- | `memory_search` | Semantic search across your agent's memories |
294
- | `memory_store` | Save a memory with type, durability, tags, visibility. Auto-dedups near-duplicates. Optional `usedMemoryIds` cites memories that informed the write |
295
- | `memory_update` | Update an existing memory by ID — overwrite in place, or version it with `preserveHistory`. Optional `usedMemoryIds` for citation-on-write |
308
+ | `memory_search` | Semantic search across the caller's own and other agents' non-private memories |
309
+ | `memory_store` | Save a memory (type, durability, tags, visibility), attributed to the authenticated agent. Optional `usedMemoryIds` cites memories that informed the write |
310
+ | `skill_store` | Write a skill-tagged memory. `trigger` is the recall text; `content` is the procedure. Durability is forced to persistent, and SkillScan rejects a dangerous payload before embed |
311
+ | `skill_search` | Rank skills by their trigger against a task. Returns a catalog (id, name, trigger, description, tags, agentId), not the procedure |
312
+ | `skill_get` | Fetch one skill's full procedure by id. Own skills and shared skills only; a private skill owned by someone else is not returned |
313
+ | `memory_update` | Update a memory by id. Overwrites in place, or pass `preserveHistory` to write a superseding version. Optional `usedMemoryIds` |
296
314
  | `memory_get` | Fetch a specific memory by ID |
297
- | `memory_delete` | Remove a memory |
298
- | `relationship_store` | Record a subject-predicate-object relationship triple (e.g. "nathan manages flair") |
299
- | `bootstrap` | Get session-start context: soul + recent memories + predicted-relevant context |
300
- | `soul_set` | Runtime writes are refused; use operator credentials through `flair soul set` |
315
+ | `memory_delete` | Delete one of your own memories |
316
+ | `relationship_store` | Assert a subject-predicate-object triple (for example "nathan manages flair"). Asserting the same triple again updates that row |
317
+ | `bootstrap` | Session-start context: soul, memories, and predicted context. Pass `subjects` for predictive loading |
318
+ | `soul_set` | Advertised as setting a soul entry. The server refuses runtime Soul writes, including this tool's Ed25519 call; operators use `flair soul set` |
301
319
  | `soul_get` | Get a soul entry |
302
- | `flair_workspace_set` | Set your agent's current workspace state (ref/branch, phase, task) in the Office Space |
303
- | `flair_orgevent` | Publish an org-wide coordination event (claim/release/status) to the Office Space |
304
- | `record_usage` | Report that recalled memories were actually used (id + optional one-line how-it-was-used). Drives `usageCount` / `usageBoost` |
320
+ | `flair_workspace_set` | Set this agent's workspace state (ref, label, provider, task, phase, summary) in the Office Space |
321
+ | `flair_orgevent` | Publish an org-wide coordination event (claim, release, or status), attributed to the caller |
322
+ | `flair_catchup` | Drain this agent's own org-event catch-up feed. Page with `after`; advance the watermark with `ack` |
323
+ | `record_usage` | Report that recalled memories were actually used (`memoryId` or `memoryIds`, plus optional `attribution`). Drives `usageCount` / `usageBoost` |
305
324
 
306
325
  Writes are scoped per-agent (your `FLAIR_AGENT_ID`) and enforced by Flair's server, not by client convention — you can't write as another agent. Reads are more open by design: any agent on the same Flair instance can read any other agent's **non-private** memories, with no grant to set up (open-within-org read; see [SECURITY.md](../SECURITY.md)).
307
326
 
@@ -309,6 +328,8 @@ Which memories are non-private is decided at write time, and the default is not
309
328
 
310
329
  ### Reading the `bootstrap` payload
311
330
 
331
+ The following structured-payload details describe the HTTP bootstrap response and native `/mcp`; stdio `flair-mcp` returns the formatted context as an MCP text block.
332
+
312
333
  `bootstrap` returns the canonical structured containers — `soul`, `memories`, `predicted`, `teammateFindings`, `events` — plus counts and a `tokenEstimate`. The containers are **always present** (empty `[]`/`{}` when there's nothing), so an empty container is distinguishable from an unsupported one.
313
334
 
314
335
  **The token ledger reconciles `tokenEstimate` from the payload alone (flair#1270).** Every token-charged content class carries a counter — `soulTokens`, `memoryTokens`, `trustTokens`, `eventsTokens` — plus a measured `scaffoldTokens` for the fixed JSON frame, and `tokenEstimate ≈ scaffoldTokens + soulTokens + memoryTokens + trustTokens + eventsTokens`. The remaining ≈ gap is the bounded per-item difference between the prose lines the memory counters measure and the heavier structured objects the containers ship. A payload whose estimate an agent can't decompose from the reported figures is a bug, not an accounting convention.
@@ -325,7 +346,7 @@ Which memories are non-private is decided at write time, and the default is not
325
346
  |---|---|---|
326
347
  | `FLAIR_AGENT_ID` | (none — required) | Must match `flair agent add <id>` |
327
348
  | `FLAIR_URL` | `http://127.0.0.1:19926` | Override for remote Flair instances |
328
- | `FLAIR_KEY_PATH` | `~/.flair/keys/<agent>.key` | Ed25519 PKCS8 key — created by `flair agent add` |
349
+ | `FLAIR_KEY_PATH` | `~/.flair/keys/<agent>.key` | Path to the Ed25519 private key; `flair agent add` creates a raw 32-byte seed. |
329
350
 
330
351
  The MCP server has no client-side flags beyond these env vars; everything else (timeouts, dedup thresholds, error classification) is opinionated defaults from the underlying [`@tpsdev-ai/flair-client`](../packages/flair-client) package.
331
352
 
@@ -333,7 +354,7 @@ The MCP server has no client-side flags beyond these env vars; everything else (
333
354
 
334
355
  ## What about pi?
335
356
 
336
- pi has no MCP client support, so Flair ships a **native pi extension** instead: [`@tpsdev-ai/pi-flair`](../packages/pi-flair/README.md). Same backend, same agent isolation, zero MCP in the path.
357
+ pi has no MCP client support, so Flair ships a **native pi extension** instead: [`@tpsdev-ai/pi-flair`](../packages/pi-flair/README.md). Same backend. With an ordinary signed identity, writes are owned by that agent; reads admit its own records and other agents' non-private records. Zero MCP in the path.
337
358
 
338
359
  Wiring is a `packages` entry in pi's own settings (`~/.pi/agent/settings.json`), not an `mcpServers` block:
339
360
 
@@ -343,7 +364,7 @@ Wiring is a `packages` entry in pi's own settings (`~/.pi/agent/settings.json`),
343
364
  }
344
365
  ```
345
366
 
346
- `flair init --client pi` writes exactly that (pinned), or use pi's own installer: `pi install npm:@tpsdev-ai/pi-flair`. `flair doctor` detects pi and checks the wiring — including the one known trap: **an `npm:` spec under the `extensions` settings key is silently ignored by pi** (`extensions` takes local file paths only; package sources belong under `packages` — [#1346](https://github.com/tpsdev-ai/flair/issues/1346)). Doctor calls that misconfiguration out by name, and `flair doctor --fix` moves the entry.
367
+ `flair init --agent my-agent --client pi` writes exactly that (pinned), or use pi's own installer: `pi install npm:@tpsdev-ai/pi-flair`. `flair doctor` detects pi and checks the wiring — including the one known trap: **an `npm:` spec under the `extensions` settings key is silently ignored by pi** (`extensions` takes local file paths only; package sources belong under `packages` — [#1346](https://github.com/tpsdev-ai/flair/issues/1346)). Doctor calls that misconfiguration out by name, and `flair doctor --fix` moves the entry.
347
368
 
348
369
  One difference from the MCP clients above: pi settings carry no per-package `env` block, so `FLAIR_AGENT_ID` (and `FLAIR_URL` when non-default) must be exported in the environment that launches pi. Doctor reports what it sees in its own shell and says so — it cannot observe the environment of every pi launch.
349
370
 
@@ -351,7 +372,7 @@ One difference from the MCP clients above: pi settings carry no per-package `env
351
372
 
352
373
  ## What about Hermes (Nous Research)?
353
374
 
354
- Hermes uses its own Python-native `MemoryProvider` ABC instead of MCP. It has its own Flair integration in [`packages/hermes-flair/`](../packages/hermes-flair). Same backend, same agent isolation, different plug shape.
375
+ Hermes uses its own Python-native `MemoryProvider` ABC instead of MCP. It has its own Flair integration in [`packages/hermes-flair/`](../packages/hermes-flair). Same backend. With an ordinary signed identity, writes are owned by that agent; reads admit its own records and other agents' non-private records. Different plug shape.
355
376
 
356
377
  Future MCP-capable agent CLIs (and there are more landing every month) will work out of the box with the MCP server above — no per-framework adapter required from us.
357
378
 
package/docs/n8n.md CHANGED
@@ -39,7 +39,7 @@ In n8n: **Credentials → New → Flair API**. Fill in:
39
39
  | Field | Value |
40
40
  |---|---|
41
41
  | **Base URL** | `http://localhost:19926` (or your team's Flair URL) |
42
- | **Agent ID** | Logical identity that will own memories from this n8n workspace. Workflows that share an Agent ID share memory ownership. Use distinct IDs when isolation matters. |
42
+ | **Agent ID** | Logical identity that will own memories from this n8n workspace. Workflows that share an Agent ID share memory ownership. Use distinct Agent IDs to organize ownership; the shared admin credential can access the whole instance. |
43
43
  | **Admin Password** | Your Flair admin password (in `~/.flair/admin-pass` for local installs). **Sensitive** — see [Security](#security). |
44
44
 
45
45
  Click **Test** — if the test request to `/Memory` returns 200, the credential is good.
@@ -48,7 +48,7 @@ Click **Test** — if the test request to `/Memory` returns 200, the credential
48
48
 
49
49
  Three nodes ship in the package:
50
50
 
51
- - **Flair Chat Memory** — connects to an AI Agent's `Memory` socket. Stores chat history in Flair, scoped by Subject. Defaults to per-workflow memory; set the optional Session Sub-Key to `={{ $execution.id }}` for per-run isolation.
51
+ - **Flair Chat Memory** — connects to an AI Agent's `Memory` socket. Stores chat history in Flair, scoped by Subject. Defaults to per-workflow memory; set the optional Session Sub-Key to `={{ $execution.id }}` for per-run chat-history grouping by subject.
52
52
  - **Flair Search** — connects to an AI Agent's `Tool` socket. Two operations:
53
53
  - *Semantic Search* — agent calls `flair_search({ query })`, gets memories ranked by similarity.
54
54
  - *Get By Subject* — agent calls `flair_get_by_subject()`, gets memories under a config-time-bound subject.
@@ -70,14 +70,14 @@ The agent now answers using both its current chat history (from Flair Chat Memor
70
70
 
71
71
  n8n memory connectors expose a `sessionKey` parameter that scopes the chat history. Flair has a richer model:
72
72
 
73
- - **Subject** (required) — the entity / conversation / topic the memory is about. Indexed in Flair's schema; efficient to filter on. Default: `={{ $workflow.name }}`.
74
- - **Session Sub-Key** (optional) — appended to the subject as `<subject>:<sessionKey>`. Use the n8n execution id (`={{ $execution.id }}`) for per-run isolation, or a customer/user id for per-customer scoping, or leave blank to share across runs.
73
+ - **Subject** (required) — the entity / conversation / topic the memory is about. For Flair Search Get By Subject, the client compares subjects after retrieval and the node requests no ordering. Default: `={{ $workflow.name }}`.
74
+ - **Session Sub-Key** (optional) — appended to the subject as `<subject>:<sessionKey>`. Use the n8n execution id (`={{ $execution.id }}`) for per-run chat-history grouping by subject, or a customer/user id for per-customer scoping, or leave blank to share across runs.
75
75
 
76
76
  Patterns:
77
77
 
78
78
  - **"This assistant remembers"** — set Subject to a stable string (`customer-support`, `daily-standup`). Leave Session Sub-Key blank. All runs share memory.
79
- - **Per-conversation isolation** — set Subject to the conversation owner (`customer:1234`), leave Session Sub-Key blank. Each conversation is isolated by subject.
80
- - **Per-execution isolation** — set Session Sub-Key to `={{ $execution.id }}`. Each n8n run gets its own memory window. (This is most similar to n8n's default `sessionKey={{ $execution.id }}`.)
79
+ - **Per-conversation grouping** — set Subject to a unique conversation ID (for example, `conversation:abc123`) and leave Session Sub-Key blank. Runs using the same Agent ID and conversation ID select the same chat history; different conversation IDs select different histories.
80
+ - **Per-execution grouping** — set Session Sub-Key to `={{ $execution.id }}`. A distinct subject selects each conversation's or run's chat-history window; it does not restrict access to those memories. (This is most similar to n8n's default `sessionKey={{ $execution.id }}`.)
81
81
 
82
82
  ## Security
83
83
 
@@ -91,9 +91,9 @@ For production deployments where untrusted workflow inputs reach Flair, wait for
91
91
 
92
92
  If any of those don't hold, use Flair's CLI / SDK clients (which support per-agent Ed25519 today) and wait for the n8n credential update.
93
93
 
94
- ## Get By Tag — coming soon
94
+ ## Get By Tag
95
95
 
96
- The Flair Search node currently exposes Semantic Search and Get By Subject. **Get By Tag** is deferred until `flair-client.memory.list` exposes a `tags` filter. Workaround for now: use Semantic Search and let the model filter results by tags in the response.
96
+ The Flair Search node currently exposes Semantic Search and Get By Subject. **Get By Tag** is not yet exposed as an operation. The `memory.list` client does support the `tags` filter — use it directly via the SDK for agent-driven tag filtering.
97
97
 
98
98
  ## Worked examples
99
99
 
@@ -6,8 +6,8 @@
6
6
  > Do NOT enable in production until Sherlock signs off on live enablement.
7
7
 
8
8
  This is the **Model 2** native-MCP path: a custom in-process `/mcp` JSON-RPC
9
- handler guarded by `@harperfast/oauth`'s `withMCPAuth`, serving the 9 curated
10
- flair tools with a per-agent OAuth identity. It is distinct from the
9
+ handler guarded by `@harperfast/oauth`'s `withMCPAuth`, serving the 17 tools in `resources/mcp-tools.ts`
10
+ with a per-agent OAuth identity. It is distinct from the
11
11
  native-application-MCP surface (design A / `FLAIR_MCP_ENABLED`); Model 2 does not
12
12
  use Harper's native MCP transport, so it is not blocked by the Harper native-MCP
13
13
  gating gaps.
@@ -18,12 +18,10 @@ gating gaps.
18
18
  Streamable HTTP: `initialize` / `tools/list` / `tools/call` / `ping`. On
19
19
  `tools/call` it resolves the verified token `sub` → a flair `Agent`, then
20
20
  dispatches to the curated tool.
21
- - `resources/mcp-tools.ts` — the 9 curated tools (memory_search, memory_store,
22
- memory_get, memory_delete, bootstrap, soul_set, soul_get, flair_workspace_set,
23
- flair_orgevent), each a thin wrapper over the existing resource handler
21
+ - `resources/mcp-tools.ts` — the 17 tools in `resources/mcp-tools.ts`, each a thin wrapper over the existing resource handler
24
22
  (Memory / SemanticSearch / BootstrapMemories / Soul / WorkspaceState /
25
- OrgEvent). No raw CRUD surface — the only path to the datastore through `/mcp`
26
- is one of these 9 semantic tools. Curated **by construction**.
23
+ OrgEvent / AttentionQuery / RecordUsage). No raw CRUD surface — the only path to the datastore through `/mcp`
24
+ is one of the 17 tools in `resources/mcp-tools.ts`. Curated **by construction**.
27
25
  - `resources/mcp-oauth.ts` — registers `server.http(withMCPAuth(mcpHandler),
28
26
  { urlPath: '/mcp' })` **only when `FLAIR_MCP_OAUTH` is on.** `/mcp` runs on its
29
27
  own dispatch chain; flair's default auth-middleware does not run for it.
@@ -108,8 +106,8 @@ registered identities.
108
106
 
109
107
  ## Enabling (operator checklist)
110
108
 
111
- 1. **Install the AS plugin** — add `@harperfast/oauth` (already an exact-pinned
112
- dependency) and declare it in `config.yaml`:
109
+ 1. **Configure the AS plugin** — `@harperfast/oauth` is exact-pinned in `package.json`
110
+ and already declared in `config.yaml`; configure the existing block:
113
111
 
114
112
  ```yaml
115
113
  '@harperfast/oauth':
@@ -136,13 +134,12 @@ registered identities.
136
134
  ```
137
135
 
138
136
  **DCR is not supported; clients connect via CIMD (Client ID Metadata
139
- Documents).** `flair mcp enable` (flair#756) writes exactly this shape —
140
- see "Legacy clients" below.
137
+ Documents).** The shipped `config.yaml` contains this block; `flair mcp enable`
138
+ uses it instead of creating it. See "Legacy clients" below.
141
139
 
142
- The `config.yaml` block is intentionally NOT committed to the live config in
143
- this slice — adding it changes boot behavior, which would break the
144
- default-OFF / byte-identical contract. An operator adds it deliberately when
145
- turning the surface on.
140
+ The shipped `config.yaml` already declares `@harperfast/oauth`; enable its MCP
141
+ surface with `FLAIR_MCP_OAUTH=true` and configure the issuer and provider
142
+ credentials.
146
143
 
147
144
  2. **Set the env:**
148
145
  - `FLAIR_MCP_OAUTH=true` — turns on the `/mcp` route registration AND the
@@ -191,8 +188,6 @@ cannot connect to this surface.
191
188
 
192
189
  ## Deferred (not in this slice)
193
190
 
194
- - Live `config.yaml` wiring of the `@harperfast/oauth` plugin (kept out to
195
- preserve the byte-identical flag-OFF contract; documented above for operators).
196
191
  - Migrating the homegrown `OAuth.ts` / `XAA.ts` opaque-token AS to the plugin.
197
192
  Per Kern: deprecate-don't-delete — they stay for the Ed25519/signed-REST path.
198
193
  XAA's JIT-provisioning is kept; the Model-2 handler reuses the same