@tpsdev-ai/flair 0.31.1 → 0.32.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.
@@ -18,88 +18,86 @@ Embedding *adds* the in-process path; `rest: true` keeps serving MCP clients and
18
18
 
19
19
  **1. Add Flair to your instance.** Deploy `@tpsdev-ai/flair` as a component the way you deploy your own — Fabric's component deploy, Studio, or your pipeline. Its tables are declared `@table(database: "flair")`, so they never collide with yours.
20
20
 
21
- **2. Resolve the resource and write a memory.**
21
+ **2. Import the facade and write a memory.**
22
22
 
23
23
  ```javascript
24
- import { server } from "harper";
25
- // Flair ships these two helpers so you do not have to get either of them right
26
- // by hand. They are the whole in-process contract.
27
- import { agentContext, internalContext, collectionResource } from "@tpsdev-ai/flair/dist/resources/in-process.js";
24
+ import { Flair } from "@tpsdev-ai/flair";
28
25
 
29
- // The RESOURCE carries auth, scoping, visibility, embedding.
30
- // NOT databases.flair.Memory: that is the raw table, and enforces none of it.
31
- // Keys carry NO leading slash: get("Memory"), never get("/Memory").
32
- const flair = (path) => server.resources.get(path).Resource;
26
+ const flair = new Flair(server);
27
+ const planner = flair.as("planner");
33
28
 
34
- export async function remember(agentId, content, opts = {}) {
35
- // A create needs a COLLECTION-bound instance. `new Cls(...)` does not give
36
- // you one, and cannot be made to — see the note below.
37
- const h = await collectionResource(flair("Memory"), agentContext(agentId));
38
- return h.post({
39
- agentId, // required — an absent one is never filled in
40
- content,
41
- durability: opts.durability ?? "standard",
42
- });
43
- }
29
+ await planner.memory.write("deploy runs at 0200 UTC", { durability: "standard" });
44
30
  ```
45
31
 
46
- > ### Why `collectionResource`, and not `new Memory()`
47
- >
48
- > A resource's `post()` only works on an instance Harper has marked as a **collection**, and that mark is a *private* field only Harper's own `getResource()` can set. The public `isCollection` is a getter with no setter, so the obvious spelling fails two different ways, neither of which names the cause:
49
- >
50
- > ```javascript
51
- > const h = new (flair("Memory"))(undefined, agentContext(agentId));
52
- > h.isCollection = true; // TypeError: Cannot set property isCollection ... which has only a getter
53
- > h.post({ ... }); // without the line above: 405 "The Memory does not have a post method implemented"
54
- > ```
55
- >
56
- > `collectionResource(Cls, context)` is a two-line wrapper over the supported call — `Cls.getResource({}, context, { isCollection: true })` — and exists so this is written once. **Reads do not need it:** `Cls.get(id, context)` and `Cls.search(query, context)` thread the context themselves.
57
- >
58
- > They do still need the **context**. Only the collection binding is unnecessary for a read, never the identity — `Cls.search(query)` with the second argument left off resolves to the trusted `internal` verdict when it runs outside a request scope (a boot hook, a timer, a queue worker, a detached promise) and returns every agent's private records. On that path the resource's `allow*` gate is not consulted at all. Pass the context to every call, read and write.
59
-
60
- > ### ⚠️ A resource with no context is an administrator
61
- >
62
- > A resource built without a context resolves to Flair's trusted `internal` verdict and runs **unfiltered** — every read unscoped, every write unowned. Silently. No error, no warning, no trace.
63
- >
64
- > Measured, not inferred: a context-less `Memory.search()` returns every agent's `private` records, and so does a context-less `SemanticSearch`.
65
- >
66
- > Correct for Flair's own maintenance passes. In your app it is a data leak you find months later.
67
- >
68
- > **Make `agentId` a required argument, as above.** Never export a version that defaults it.
32
+ That is the whole API. No deep import, no `server.resources`, no `.Resource`, no `collectionResource()`, no double-passing `agentId`. The facade stamps `agentId` from the handle's context onto the body internally — you pass it once, at `flair.as(id)`.
69
33
 
70
34
  **3. Read it back, scoped to that agent.**
71
35
 
72
36
  ```javascript
73
- export async function recall(agentId, query, limit = 5) {
74
- const h = await collectionResource(flair("SemanticSearch"), agentContext(agentId));
75
- return h.post({ q: query, limit });
76
- }
37
+ const hits = await planner.recall("deploy schedule", { limit: 5 });
38
+ const record = await planner.memory.get(hits[0].id);
39
+ ```
40
+
41
+ **4. Register an agent, no CLI.**
42
+
43
+ ```javascript
44
+ await flair.admin.registerAgent("planner", { publicKey: "pending" });
77
45
  ```
78
46
 
79
- **4. Verify it worked, still in-process.**
47
+ > **`flair.admin` is a root shell.** Every call site is greppable via `git grep "flair.admin"`. Use for provisioning and maintenance only, never as a request handler's default.
48
+
49
+ **5. Verify it worked.**
80
50
 
81
51
  ```javascript
82
- await remember("agent-alpha", "deploy runs at 0200 UTC");
83
- console.log(await recall("agent-alpha", "deploy schedule"));
52
+ console.log(await planner.memory.search({ limit: 10 }));
84
53
  console.log([...server.resources.keys()].sort()); // what Flair registered
85
54
  ```
86
55
 
87
- > ### What we measured, so you do not have to
88
- >
89
- > Run end to end on **Harper 5.1.22**, from a second component loaded into the same instance — the exact shape above. `test/integration/in-process-agents.test.ts` in the Flair repo is that run, and `test/fixtures/inproc-app` is the component it drives.
90
- >
91
- > | Claim | Result |
92
- > |---|---|
93
- > | `server.resources.get("Memory")` from another component | Returns an **entry object** `{ Resource, path, exportTypes, hasSubPaths, relativeURL }` — `.Resource` is required, it is not the class itself |
94
- > | `.Resource` is Flair's resource, not the raw table | Confirmed: prototype chain `Memory → Memory → Resource`, and it is **not** `databases.flair.Memory` |
95
- > | Key format | **No leading slash.** `get("Memory")` hits; `get("/Memory")` returns `undefined` |
96
- > | `getMatch` | `getMatch("Memory")` hits. **`getMatch("/Memory")` misses** — do not use the slashed form |
97
- > | When the lookup becomes valid | Flair's resources were already registered at the app component's **module top level** (55 entries, `Memory` and `Agent` present). The only entry missing at that moment was the app's *own*, still mid-registration. Resolving lazily, as above, is still the advice — it costs nothing and does not depend on component load order |
98
- > | Per-agent scoping through `SemanticSearch` | Holds. Querying as `agent-beta` for a topic only `agent-alpha` has written returns **beta's own** memory, never alpha's private one — with real 768-dim embeddings attached, not a degraded path |
99
- > | Cross-agent by-id read | `Memory.get(<beta's private id>)` as alpha returns **404**, never 403 — a denied caller cannot enumerate ids |
100
- > | Context-less call | Unfiltered across all agents, via both `search` and `SemanticSearch` (see the warning above) |
56
+ ---
101
57
 
102
- Handlers return a `Response` for `401`/`403`/`400` rather than throwing — check for one. `Memory.post()` is in-process only; over HTTP the schema exposes `PUT`.
58
+ ## The facade
59
+
60
+ ### `new Flair(server)`
61
+
62
+ One handle per Harper instance. Resolves resources lazily on first use — no lookup at construction time.
63
+
64
+ ### `flair.as(agentId)`
65
+
66
+ Returns an `AgentHandle` scoped to that agent. The `agentId` is runtime-validated: missing, empty, blank, or non-string throws `InProcessContextError`.
67
+
68
+ ```javascript
69
+ const planner = flair.as("planner");
70
+ planner.agentId; // "planner"
71
+ ```
72
+
73
+ **Security:** In-process identity is asserted, not verified — co-location IS the grant. Build the `agentId` from your own server-side state, never from request data. If an agent id can reach `flair.as()` from user input — a body field, a query param, a header you did not verify yourself — that is privilege escalation with **no error, no 403 and no trace**.
74
+
75
+ ### `AgentHandle`
76
+
77
+ | Method | Description |
78
+ |---|---|
79
+ | `handle.memory.write(content, opts?)` | Write a memory as this agent. `agentId` is stamped from the handle — the caller never passes it. |
80
+ | `handle.memory.get(id)` | Read a memory by id, scoped to this agent. |
81
+ | `handle.memory.search(opts?)` | Search memories scoped to this agent. |
82
+ | `handle.recall(query, opts?)` | Semantic search scoped to this agent. |
83
+
84
+ ### `flair.admin`
85
+
86
+ Admin operations — unfiltered reads, cross-agent writes. Every call site is greppable via `git grep "flair.admin"`.
87
+
88
+ | Method | Description |
89
+ |---|---|
90
+ | `flair.admin.registerAgent(id, opts?)` | Register an agent through the Agent resource (full Principal shape). |
91
+ | `flair.admin.memory.get(id)` | Read any memory by id, unfiltered. |
92
+ | `flair.admin.memory.write(asAgentId, content, opts?)` | Write a memory attributed to another agent. |
93
+
94
+ ### `flair.internal`
95
+
96
+ Trusted, unattributed, unfiltered operations — Flair's `internal` verdict. Every call site is greppable via `git grep "flair.internal"`.
97
+
98
+ | Method | Description |
99
+ |---|---|
100
+ | `flair.internal.agentTable.put(record)` | Write directly to the Agent resource (bypasses admin gate). |
103
101
 
104
102
  ---
105
103
 
@@ -109,7 +107,8 @@ Handlers return a `Response` for `401`/`403`/`400` rather than throwing — chec
109
107
 
110
108
  ```javascript
111
109
  for (const id of ["planner", "researcher", "reviewer"]) {
112
- await remember(id, `${id} came online`);
110
+ const agent = flair.as(id);
111
+ await agent.memory.write(`${id} came online`);
113
112
  }
114
113
  ```
115
114
 
@@ -117,18 +116,14 @@ for (const id of ["planner", "researcher", "reviewer"]) {
117
116
 
118
117
  ### Registering agents, no CLI
119
118
 
120
- Go through the `Agent` **resource**, with no context provisioning is infrastructure work your app has already authorised, and `Agent.post()` fills in the whole Principal shape for you:
119
+ Go through `flair.admin.registerAgent()` — it goes through the `Agent` **resource**, which fills in the whole Principal shape for you:
121
120
 
122
121
  ```javascript
123
- export async function registerAgent(id, { publicKey = "pending", admin = false } = {}) {
124
- const h = await collectionResource(flair("Agent"), internalContext()); // provisioning is infrastructure, not an agent's write
125
- return h.post({
126
- id, name: id, displayName: id,
127
- publicKey, // a placeholder is fine — see below
128
- runtime: "headless",
129
- ...(admin ? { admin: true } : {}), // sets role:"admin" too — see below
130
- });
131
- }
122
+ await flair.admin.registerAgent("researcher", {
123
+ publicKey: "pending",
124
+ displayName: "Research Agent",
125
+ admin: false,
126
+ });
132
127
  ```
133
128
 
134
129
  Verified against a real instance: that lands `kind: "agent"`, `status: "active"`, `displayName`, `admin: false`, `defaultTrustTier: "unverified"`, `type: "agent"`, `createdAt`/`updatedAt` and the federation `originatorInstanceId` stamp — without you naming any of them.
@@ -146,7 +141,7 @@ import { generateKeyPairSync } from "node:crypto";
146
141
 
147
142
  const { publicKey, privateKey } = generateKeyPairSync("ed25519");
148
143
  const raw = publicKey.export({ format: "der", type: "spki" }).subarray(-32);
149
- await registerAgent("remote-worker", { publicKey: raw.toString("hex") });
144
+ await flair.admin.registerAgent("remote-worker", { publicKey: raw.toString("hex") });
150
145
  // keep `privateKey` in your own secret store — Flair never sees it
151
146
  ```
152
147
 
@@ -298,6 +293,106 @@ A `SyncLog` row reads `direction: "pull"` — the receiver's label for a push it
298
293
 
299
294
  ---
300
295
 
296
+ ## Appendix: the primitives layer
297
+
298
+ The facade wraps a lower-level API that is still available for callers who need direct access. Import it from `@tpsdev-ai/flair/server`:
299
+
300
+ ```javascript
301
+ import { agentContext, adminContext, internalContext, collectionResource } from "@tpsdev-ai/flair/server";
302
+ ```
303
+
304
+ This is the same seam Flair's own MCP handler and internal tooling use. You should not need it for ordinary agent operations — the facade covers those. Use the primitives when you are building your own abstraction on top of Flair's resources.
305
+
306
+ ### Resolving a resource
307
+
308
+ ```javascript
309
+ // The RESOURCE — carries auth, scoping, visibility, embedding.
310
+ // NOT databases.flair.Memory: that is the raw table, and enforces none of it.
311
+ // Keys carry NO leading slash: get("Memory"), never get("/Memory").
312
+ const flair = (path) => server.resources.get(path).Resource;
313
+ ```
314
+
315
+ ### Writing a memory (primitives)
316
+
317
+ ```javascript
318
+ export async function remember(agentId, content, opts = {}) {
319
+ // A create needs a COLLECTION-bound instance. `new Cls(...)` does not give
320
+ // you one, and cannot be made to — see the note below.
321
+ const h = await collectionResource(flair("Memory"), agentContext(agentId));
322
+ return h.post({
323
+ agentId, // required — an absent one is never filled in
324
+ content,
325
+ durability: opts.durability ?? "standard",
326
+ });
327
+ }
328
+ ```
329
+
330
+ > ### Why `collectionResource`, and not `new Memory()`
331
+ >
332
+ > A resource's `post()` only works on an instance Harper has marked as a **collection**, and that mark is a *private* field only Harper's own `getResource()` can set. The public `isCollection` is a getter with no setter, so the obvious spelling fails two different ways, neither of which names the cause:
333
+ >
334
+ > ```javascript
335
+ > const h = new (flair("Memory"))(undefined, agentContext(agentId));
336
+ > h.isCollection = true; // TypeError: Cannot set property isCollection ... which has only a getter
337
+ > h.post({ ... }); // without the line above: 405 "The Memory does not have a post method implemented"
338
+ > ```
339
+ >
340
+ > `collectionResource(Cls, context)` is a two-line wrapper over the supported call — `Cls.getResource({}, context, { isCollection: true })` — and exists so this is written once. **Reads do not need it:** `Cls.get(id, context)` and `Cls.search(query, context)` thread the context themselves.
341
+ >
342
+ > They do still need the **context**. Only the collection binding is unnecessary for a read, never the identity — `Cls.search(query)` with the second argument left off resolves to the trusted `internal` verdict when it runs outside a request scope (a boot hook, a timer, a queue worker, a detached promise) and returns every agent's private records. On that path the resource's `allow*` gate is not consulted at all. Pass the context to every call, read and write.
343
+
344
+ > ### ⚠️ A resource with no context is an administrator
345
+ >
346
+ > A resource built without a context resolves to Flair's trusted `internal` verdict and runs **unfiltered** — every read unscoped, every write unowned. Silently. No error, no warning, no trace.
347
+ >
348
+ > Measured, not inferred: a context-less `Memory.search()` returns every agent's `private` records, and so does a context-less `SemanticSearch`.
349
+ >
350
+ > Correct for Flair's own maintenance passes. In your app it is a data leak you find months later.
351
+ >
352
+ > **Make `agentId` a required argument, as above.** Never export a version that defaults it.
353
+
354
+ ### Reading back (primitives)
355
+
356
+ ```javascript
357
+ export async function recall(agentId, query, limit = 5) {
358
+ const h = await collectionResource(flair("SemanticSearch"), agentContext(agentId));
359
+ return h.post({ q: query, limit });
360
+ }
361
+ ```
362
+
363
+ ### Registering agents (primitives)
364
+
365
+ ```javascript
366
+ export async function registerAgent(id, { publicKey = "pending", admin = false } = {}) {
367
+ const h = await collectionResource(flair("Agent"), internalContext()); // provisioning is infrastructure, not an agent's write
368
+ return h.post({
369
+ id, name: id, displayName: id,
370
+ publicKey, // a placeholder is fine — see below
371
+ runtime: "headless",
372
+ ...(admin ? { admin: true } : {}), // sets role:"admin" too — see below
373
+ });
374
+ }
375
+ ```
376
+
377
+ ### What we measured, so you do not have to
378
+
379
+ Run end to end on **Harper 5.1.22**, from a second component loaded into the same instance — the exact shape above. `test/integration/in-process-agents.test.ts` in the Flair repo is that run, and `test/fixtures/inproc-app` is the component it drives.
380
+
381
+ | Claim | Result |
382
+ |---|---|
383
+ | `server.resources.get("Memory")` from another component | Returns an **entry object** `{ Resource, path, exportTypes, hasSubPaths, relativeURL }` — `.Resource` is required, it is not the class itself |
384
+ | `.Resource` is Flair's resource, not the raw table | Confirmed: prototype chain `Memory → Memory → Resource`, and it is **not** `databases.flair.Memory` |
385
+ | Key format | **No leading slash.** `get("Memory")` hits; `get("/Memory")` returns `undefined` |
386
+ | `getMatch` | `getMatch("Memory")` hits. **`getMatch("/Memory")` misses** — do not use the slashed form |
387
+ | When the lookup becomes valid | Flair's resources were already registered at the app component's **module top level** (55 entries, `Memory` and `Agent` present). The only entry missing at that moment was the app's *own*, still mid-registration. Resolving lazily, as above, is still the advice — it costs nothing and does not depend on component load order |
388
+ | Per-agent scoping through `SemanticSearch` | Holds. Querying as `agent-beta` for a topic only `agent-alpha` has written returns **beta's own** memory, never alpha's private one — with real 768-dim embeddings attached, not a degraded path |
389
+ | Cross-agent by-id read | `Memory.get(<beta's private id>)` as alpha returns **404**, never 403 — a denied caller cannot enumerate ids |
390
+ | Context-less call | Unfiltered across all agents, via both `search` and `SemanticSearch` (see the warning above) |
391
+
392
+ Handlers return a `Response` for `401`/`403`/`400` rather than throwing — check for one. `Memory.post()` is in-process only; over HTTP the schema exposes `PUT`.
393
+
394
+ ---
395
+
301
396
  ## See also
302
397
 
303
398
  [Integrations](integrations.md) · [Deployment](deployment.md) · [Federation](federation.md) · [Auth](auth.md) · [Architecture](../DESIGN.md)
@@ -0,0 +1,203 @@
1
+ # Hosted on Harper Fabric
2
+
3
+ Deploy Flair as a component to a [Harper Fabric](https://www.harperdb.io/) instance. You do not run the Harper process yourself: managed hosting, multi-region replication, no shell on the node.
4
+
5
+ ---
6
+
7
+ ## Deploy
8
+
9
+ You **deploy** rather than install. `flair deploy` pushes Flair as a Fabric component:
10
+
11
+ ```bash
12
+ export FABRIC_USER=<admin> FABRIC_PASSWORD=<pass>
13
+
14
+ # Validate args and package layout without deploying
15
+ flair deploy --fabric-org <org> --fabric-cluster <cluster> --dry-run
16
+
17
+ # Deploy
18
+ flair deploy --fabric-org <org> --fabric-cluster <cluster>
19
+ ```
20
+
21
+ Credentials go via the environment, not argv, so they stay out of `ps`. Use `--fabric-password-file <path>` (mode `0600`) when scripting; inline `--fabric-user`/`--fabric-password` flags leak to shell history and are discouraged.
22
+
23
+ Target defaults to `https://<cluster>.<org>.harperfabric.com`; override with `--target`. Deploy verifies the served API, waits for replication, and polls for convergence before reporting success.
24
+
25
+ > `--fabric-token` is accepted but **fails** — `deploy_component` is Basic-auth only.
26
+
27
+ ### Provision the instance
28
+
29
+ Run **once**, before serving traffic:
30
+
31
+ ```bash
32
+ flair init --target https://<cluster>.<org>.harperfabric.com \
33
+ --ops-target <ops-url> \
34
+ --cluster-admin-user <user> --cluster-admin-pass <pass> \
35
+ --remote --force
36
+ ```
37
+
38
+ - `--force` is required — this writes to a live instance.
39
+ - `--remote` marks it a federation **hub** and creates the `flair_pair_initiator` role; without it, pairing later fails role-not-found.
40
+ - Generated admin password lands in `~/.tps/secrets/flair-fabric-hdb` (mode `0600`); `--flair-admin-pass` to choose your own.
41
+
42
+ ### Port derivation trap
43
+
44
+ Locally, Flair serves data on `19926` and the ops API on `19925`. The CLI derives **ops = data − 1** everywhere. A managed endpoint is HTTPS on 443 with no port, so derivation produces `:442` — where nothing answers.
45
+
46
+ **Pass `--ops-target <url>` explicitly** (or set `FLAIR_OPS_TARGET`) on any command that touches the ops API: `init --target`, `agent add --target`, `federation token --target`.
47
+
48
+ ---
49
+
50
+ ## Configuration
51
+
52
+ On Fabric, configuration goes through the component's environment, not a local `config.yaml`. Set these in the Fabric component env:
53
+
54
+ | Variable | What it does | When to set it |
55
+ |----------|--------------|----------------|
56
+ | `FLAIR_PUBLIC_URL` | The URL operators reach this Flair on. Surfaced in OAuth metadata and A2A discovery. | **Always set** — or clients see a loopback address. |
57
+ | `HDB_ADMIN_PASSWORD` | Bootstrap password for the embedded Harper. | Set at install time. |
58
+ | `FLAIR_KEY_PASSPHRASE` | Passphrase for federation key encryption. | Set for production federation deployments. |
59
+
60
+ On Fabric / managed deploys, environment variables are provisioned through Harper's Fabric secrets mechanism (encrypted at rest with `enc:v1:` storage format).
61
+
62
+ ---
63
+
64
+ ## Agent authentication
65
+
66
+ Agents authenticate with **Ed25519 per-agent keys** — the same model as standalone local. Each agent holds a private key and signs every request.
67
+
68
+ ### Register an agent
69
+
70
+ ```bash
71
+ # Register an agent — --ops-target is required (see Port derivation trap above)
72
+ flair agent add mybot --target "$FLAIR_URL" --ops-target <ops-url>
73
+ ```
74
+
75
+ The private key is stored on the **client machine** at `~/.flair/keys/<agent>.key`, not on the Fabric node. The Fabric node stores only the public key in the `Agent` table.
76
+
77
+ ### Connect a client
78
+
79
+ ```bash
80
+ export FLAIR_URL=https://<cluster>.<org>.harperfabric.com
81
+
82
+ # Register an agent
83
+ flair agent add mybot --target "$FLAIR_URL" --ops-target <ops-url>
84
+
85
+ # Use with any MCP client — set FLAIR_AGENT_ID and FLAIR_URL in the client env
86
+ ```
87
+
88
+ Auth is the same protocol as standalone: Ed25519 signature of `agentId:timestamp:nonce:METHOD:/path`, 30-second replay window, nonce deduplication. The difference is purely the transport — HTTPS instead of localhost HTTP.
89
+
90
+ See [secrets-and-keys.md](secrets-and-keys.md) for the full threat model.
91
+
92
+ ---
93
+
94
+ ## Verify it works
95
+
96
+ ### Health and status
97
+
98
+ ```bash
99
+ curl -sf https://<cluster>.<org>.harperfabric.com/Health
100
+
101
+ flair status --target https://<cluster>.<org>.harperfabric.com
102
+ flair fleet verify --target https://<cluster>.<org>.harperfabric.com
103
+ ```
104
+
105
+ `fleet verify` checks health, auth, and version across the origin node plus every Flair federation peer on file. Exit codes: 0 = all verified, 1 = origin failed, 2 = peer version skew, 3 = peer unverifiable.
106
+
107
+ > **A credential mismatch renders as an empty section.** `flair status` reads `/HealthDetail` with `FLAIR_ADMIN_PASS` / `HDB_ADMIN_PASSWORD` / a pinned agent key — **not** the `FABRIC_*` credentials. On failure it renders blank.
108
+
109
+ ### What is available remotely
110
+
111
+ | Command | Works remotely |
112
+ |---|---|
113
+ | `GET /Health` | Yes — public, no auth |
114
+ | `flair status --target <url>` | Yes — subsystem rollups |
115
+ | `flair quality --target <url>` | Yes — recall/coverage metrics |
116
+ | `flair fleet verify --target <url>` | Yes — origin + Flair peers |
117
+ | `flair federation status\|verify\|reachability --target <url>` | Yes — peer table, sync recency |
118
+
119
+ ### What does **not** work remotely
120
+
121
+ **`flair doctor`** takes no `--target` — it hardcodes localhost, reads a local PID file, and shells out to `lsof`. Unavailable too: `start`, `stop`, `restart`, `snapshot`, `reembed`, `rem`, `bridge`.
122
+
123
+ **Fabric's own cluster topology is invisible.** `fleet verify` sweeps *Flair's* federation peer table, not Harper's cluster nodes. `cluster_status` is harper-pro-only. `0 peers known` means "0 on file", never "0 exist."
124
+
125
+ ---
126
+
127
+ ## Upgrade
128
+
129
+ A Fabric-deployed Flair is a component, not an npm package. Upgrade in place:
130
+
131
+ ```bash
132
+ FABRIC_USER=<admin> FABRIC_PASSWORD=<pass> \
133
+ flair upgrade --target https://<cluster>.<org>.harperfabric.com
134
+ ```
135
+
136
+ This resolves the target version, stages a clean deployable with the required `@harperfast/harper` version pin, confirms the staged build before deploying, pushes it via `flair deploy`, and verifies the result. After a successful deploy, it runs a fleet convergence sweep across the origin plus every Flair federation peer.
137
+
138
+ - `--check` shows the version diff and plan without deploying.
139
+ - `--yes` skips the confirmation prompt for scripted use.
140
+ - `--fabric-password-file <path>` reads the password from a file instead of an env var.
141
+ - `--no-fleet-verify` skips the post-deploy fleet sweep.
142
+
143
+ Inline `--fabric-user`/`--fabric-password` flags also work but are **discouraged** — both leak to shell history and `ps`.
144
+
145
+ ### Backup before upgrading
146
+
147
+ `flair snapshot` is local-only. Back up before every upgrade:
148
+
149
+ ```bash
150
+ flair backup --url https://<cluster>.<org>.harperfabric.com \
151
+ --admin-pass-file <path> --output ./flair-backup.json
152
+ ```
153
+
154
+ See [upgrade.md](upgrade.md#upgrading-a-fabric-deployed-instance) for the full walkthrough.
155
+
156
+ ---
157
+
158
+ ## Federation
159
+
160
+ Available. Pair a local spoke to a Fabric-hosted hub:
161
+
162
+ ```bash
163
+ # On any machine (no shell on the hub) — generate a pairing token triple
164
+ FLAIR_ADMIN_PASS=<hub-admin-password> flair federation token \
165
+ --target https://<cluster>.<org>.harperfabric.com \
166
+ --ops-target <ops-url> > ./pair-triple.json
167
+
168
+ # On the spoke — pair to the Fabric hub
169
+ flair federation pair https://<cluster>.<org>.harperfabric.com \
170
+ --token-from ./pair-triple.json
171
+ ```
172
+
173
+ ### Pairing limitation
174
+
175
+ 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.
176
+
177
+ Full walkthrough: [federation.md](federation.md).
178
+
179
+ ### Multi-region replication
180
+
181
+ Fabric gives you N regional nodes running one component — **not** N Flair instances. Every node shares one Flair identity (the `Instance` table replicates). You do **not** federate your own regions to each other — Harper replication handles that. Use `flair federation pair` only to reach a **separate** Flair instance.
182
+
183
+ ---
184
+
185
+ ## Known operational limitations
186
+
187
+ ### No disk or quota telemetry
188
+
189
+ `flair status` reports usage for two directories: no free space, no total, no quota. An instance can hit its quota with nothing saying so. The one indirect signal is a migration halting for space.
190
+
191
+ ### Unbounded npm cache
192
+
193
+ Every deploy runs a server-side `npm install` using the node's default cache. npm never evicts it, so it grows until it fills the quota. There is no cache flag, alternate location, or cleanup option. [flair#886](https://github.com/tpsdev-ai/flair/issues/886).
194
+
195
+ ---
196
+
197
+ ## See also
198
+
199
+ - [deployment-shapes.md](deployment-shapes.md) — choose your shape
200
+ - [upgrade.md](upgrade.md#upgrading-a-fabric-deployed-instance) — full Fabric upgrade walkthrough
201
+ - [federation.md](federation.md) — pairing, sync driver, conflict resolution
202
+ - [standalone-local.md](standalone-local.md) — the standalone shape (different upgrade, shell available)
203
+ - [secrets-and-keys.md](secrets-and-keys.md) — admin password, key lifecycle
@@ -7,11 +7,11 @@ Flair owns **identity**. Flair does **not** own arbitrary secrets. This page dra
7
7
  For each registered agent, Flair stores:
8
8
 
9
9
  - A **public key** in the `Agent` table (server-side; used to verify signed requests).
10
- - A **private key** at `~/.flair/keys/<agent>.key` on the host that owns that agent (PKCS8 base64). Created by `flair agent add <id>`. Mode `0600`.
10
+ - A **private key** at `~/.flair/keys/<agent>.key` on the host that owns that agent the raw 32-byte Ed25519 seed. Created by `flair init --agent <id>` or `flair agent add <id>`. Mode `0600`.
11
11
 
12
12
  Agents sign every request to Flair with this key. Flair refuses unsigned requests and refuses signatures that don't match the registered public key. The signed payload is `<agentId>:<timestamp>:<nonce>:<METHOD>:<path>` with a 30-second replay window and nonce dedup — replays inside that window are rejected.
13
13
 
14
- **This is the only secret material Flair manages.** Lose the key file and the agent is locked out (`flair agent rotate <id>` to issue a new pair).
14
+ **This is the only secret material Flair manages.** Lose the key file and the agent is locked out (`flair agent rotate-key <id>` to issue a new pair).
15
15
 
16
16
  ## Flair admin password (Harper instance)
17
17
  - If not provided via `--admin-pass`, `--admin-pass-file`, `FLAIR_ADMIN_PASS`, or `HDB_ADMIN_PASSWORD`, a random password is generated and written to `~/.flair/admin-pass` (mode `0o600`). The password is **not** printed to the console.
@@ -140,7 +140,7 @@ Hermes uses `~/.hermes/.env` for provider API keys (managed by `hermes auth`). T
140
140
 
141
141
  - **Stays on the host that owns the agent.** If your agent runs on a given host, the key lives on that host. If you spin up the same agent on another machine, **don't copy the key** — register a new agent identity (`flair agent add <id>-on-<other-host>`) on that machine. Different identities, same Flair instance can store memories for both, you decide cross-agent visibility.
142
142
  - **`chmod 600` enforced** by `flair agent add`. Don't relax it.
143
- - **Don't check it into git.** `.gitignore` should already exclude `~/.flair/keys/`; if you're ever tempted to share keys for "convenience," rotate first (`flair agent rotate <id>`).
143
+ - **Don't check it into git.** `.gitignore` should already exclude `~/.flair/keys/`; if you're ever tempted to share keys for "convenience," rotate first (`flair agent rotate-key <id>`).
144
144
  - **Backup separately**, encrypted. The `flair backup` command excludes private keys by default. Roll your own backup of `~/.flair/keys/` via age-encrypted archive if you want offsite recovery.
145
145
 
146
146
  ## What about a `flair secret` CLI?
@@ -153,7 +153,7 @@ If you find yourself wanting one anyway, your agent can call `security find-gene
153
153
 
154
154
  | Asset | Owned by | If compromised → |
155
155
  |---|---|---|
156
- | Flair agent private key (`~/.flair/keys/<agent>.key`) | Flair (you, on the host) | Attacker can **write** memories under that agent's identity and read that agent's **`private`**-marked memories until you rotate. Use `flair agent rotate <id>`. Other agents' write identity is unaffected — they can't be impersonated with this key. |
156
+ | Flair agent private key (`~/.flair/keys/<agent>.key`) | Flair (you, on the host) | Attacker can **write** memories under that agent's identity and read that agent's **`private`**-marked memories until you rotate. Use `flair agent rotate-key <id>`. Other agents' write identity is unaffected — they can't be impersonated with this key. |
157
157
  | LLM provider API keys (Anthropic, OpenAI, etc.) | OS keyring / 1Password | Standard provider revocation: rotate the key in the provider's console, update keyring entry. |
158
158
  | Cross-host secrets (1Password vault, age-sops) | The secret manager itself | Trust falls back to that manager's MFA / key handling. Document recovery in your team's ops runbook. |
159
159
  | Memory contents | Flair (server-side) | Write access requires the owning agent's key → see "Per-agent write isolation, org-wide non-private read" below. |