@tpsdev-ai/flair 0.59.0 → 0.62.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.
- package/README.md +4 -4
- package/SECURITY.md +36 -0
- package/config.yaml +12 -1
- package/dist/bridges/builtins/mem0.js +63 -28
- package/dist/bridges/runtime/import-runner.js +12 -0
- package/dist/bridges/runtime/load-plugin.js +42 -13
- package/dist/bridges/runtime/yaml-loader.js +4 -2
- package/dist/build-info.json +3 -3
- package/dist/cli.js +991 -248
- package/dist/commands/agent.js +224 -43
- package/dist/commands/attention.js +4 -3
- package/dist/commands/backup.js +202 -34
- package/dist/commands/bridge.js +172 -119
- package/dist/commands/deploy.js +37 -4
- package/dist/commands/doctor.js +592 -146
- package/dist/commands/export.js +54 -19
- package/dist/commands/federation.js +141 -21
- package/dist/commands/hook.js +155 -2
- package/dist/commands/idp.js +14 -1
- package/dist/commands/import.js +7 -3
- package/dist/commands/init.js +462 -193
- package/dist/commands/integrity.js +388 -0
- package/dist/commands/keys.js +247 -58
- package/dist/commands/mcp.js +97 -35
- package/dist/commands/memory.js +171 -21
- package/dist/commands/migrate-harness-memory.js +3 -2
- package/dist/commands/orgevent.js +46 -37
- package/dist/commands/presence.js +4 -3
- package/dist/commands/principal.js +426 -48
- package/dist/commands/quality.js +10 -1
- package/dist/commands/reembed.js +141 -17
- package/dist/commands/relationship.js +2 -1
- package/dist/commands/rem.js +56 -18
- package/dist/commands/restore.js +101 -61
- package/dist/commands/search.js +6 -4
- package/dist/commands/service.js +151 -38
- package/dist/commands/soul.js +4 -3
- package/dist/commands/status.js +43 -5
- package/dist/commands/test.js +3 -2
- package/dist/commands/upgrade.js +24 -1
- package/dist/commands/workspace.js +6 -3
- package/dist/component-env.js +31 -41
- package/dist/deploy.js +77 -1
- package/dist/doctor-client.js +529 -92
- package/dist/engine-version-contract.js +1 -0
- package/dist/engine-version.js +23 -3
- package/dist/federation-verify.js +4 -3
- package/dist/hook-install.js +670 -6
- package/dist/keystore.js +72 -0
- package/dist/lib/action-recall-runtime.js +328 -0
- package/dist/lib/agent-home-fields.js +132 -0
- package/dist/lib/agent-home.js +427 -0
- package/dist/lib/agent-id-rule.js +46 -0
- package/dist/lib/agent-roster.js +33 -0
- package/dist/lib/auth-resolve.js +49 -16
- package/dist/lib/capture-runtime.js +124 -0
- package/dist/lib/credential-status-rule.js +78 -0
- package/dist/lib/daemon-liveness.js +41 -10
- package/dist/lib/doctor-run.js +75 -37
- package/dist/lib/durability-copy.js +10 -0
- package/dist/lib/embedding-space-doctor.js +75 -0
- package/dist/lib/flair-agent-role.js +4 -0
- package/dist/lib/hub-url.js +12 -0
- package/dist/lib/init-admin-pass.js +88 -12
- package/dist/lib/init-listener-environ.js +1 -2
- package/dist/lib/init-occupied-listener.js +15 -111
- package/dist/lib/init-spawn-attribution.js +73 -0
- package/dist/lib/init-tcp-probe.js +33 -0
- package/dist/lib/instance-identity-row.js +20 -0
- package/dist/lib/launchd-management.js +24 -0
- package/dist/lib/listener-table.js +268 -0
- package/dist/lib/local-delete-instance.js +27 -0
- package/dist/lib/local-instance-pair.js +256 -0
- package/dist/lib/mcp-enable.js +1168 -326
- package/dist/lib/mcp-oauth-env-core.js +133 -0
- package/dist/lib/mcp-oauth-env.js +125 -0
- package/dist/lib/mcp-spec.js +17 -1
- package/dist/lib/memory-attributes.js +2 -0
- package/dist/lib/memory-id-policy.js +46 -0
- package/dist/lib/memory-integrity.js +309 -0
- package/dist/lib/memory-purge-response.js +20 -0
- package/dist/lib/ops-table-count.js +25 -0
- package/dist/lib/owned-pins.js +67 -10
- package/dist/lib/peer-status.js +27 -0
- package/dist/lib/principal-status.js +29 -0
- package/dist/lib/process-start-time.js +76 -12
- package/dist/lib/proto-safe-record.js +42 -0
- package/dist/lib/record-id-path.js +25 -0
- package/dist/lib/reembed-server-support.js +66 -0
- package/dist/lib/restore-verify.js +104 -0
- package/dist/lib/scheduler-platform.js +10 -6
- package/dist/lib/secret-keys.js +25 -0
- package/dist/lib/secrets-push.js +50 -22
- package/dist/lib/skill-seed-pending.js +24 -0
- package/dist/lib/skill-seed.js +365 -0
- package/dist/lib/stop-start-recovery.js +54 -0
- package/dist/lib/using-flair-skill.js +87 -0
- package/dist/mcp-client-assertion.js +112 -4
- package/dist/memory-id-checkpoint.js +326 -0
- package/dist/memory-node-compare.js +207 -0
- package/dist/packages/flair-mcp/src/secret-redaction.js +113 -0
- package/dist/rem/restore.js +6 -5
- package/dist/rem/runner.js +103 -44
- package/dist/resources/Agent.js +321 -1
- package/dist/resources/AgentKeyRegister.js +214 -0
- package/dist/resources/AgentKeyRegistration.js +28 -0
- package/dist/resources/AgentSeed.js +10 -4
- package/dist/resources/AutoPromoteCandidates.js +7 -1
- package/dist/resources/Credential.js +177 -2
- package/dist/resources/Federation.js +751 -143
- package/dist/resources/FederationRetry.js +140 -0
- package/dist/resources/InstructionVersion.js +220 -0
- package/dist/resources/Integration.js +300 -25
- package/dist/resources/Memory.js +2113 -604
- package/dist/resources/MemoryArchive.js +75 -42
- package/dist/resources/MemoryBootstrap.js +110 -39
- package/dist/resources/MemoryCandidate.js +21 -1
- package/dist/resources/MemoryDedupStats.js +30 -1
- package/dist/resources/MemoryFeed.js +327 -45
- package/dist/resources/MemoryGrant.js +21 -1
- package/dist/resources/MemoryMaintenance.js +129 -25
- package/dist/resources/MemoryPurge.js +232 -0
- package/dist/resources/MemoryReflect.js +7 -2
- package/dist/resources/MemoryReindex.js +24 -8
- package/dist/resources/Message.js +5 -3
- package/dist/resources/OAuth.js +186 -9
- package/dist/resources/OrgEvent.js +126 -3
- package/dist/resources/Presence.js +144 -49
- package/dist/resources/PromoteMemoryCandidate.js +18 -7
- package/dist/resources/Relationship.js +23 -0
- package/dist/resources/SemanticSearch.js +63 -32
- package/dist/resources/Soul.js +189 -76
- package/dist/resources/TeamDirectory.js +35 -0
- package/dist/resources/WorkspaceState.js +21 -1
- package/dist/resources/XAA.js +181 -63
- package/dist/resources/agent-auth.js +40 -15
- package/dist/resources/auth-middleware.js +400 -161
- package/dist/resources/ed25519-auth.js +1 -1
- package/dist/resources/embedding-space-guard.js +366 -72
- package/dist/resources/engine-version-stamp-boot.js +53 -0
- package/dist/resources/federation-classify.js +72 -0
- package/dist/resources/federation-crypto.js +5 -5
- package/dist/resources/federation-retry-lib.js +135 -0
- package/dist/resources/grant-visibility.js +135 -0
- package/dist/resources/harper-routing.js +83 -0
- package/dist/resources/health.js +120 -18
- package/dist/resources/host-source-citation.js +49 -0
- package/dist/resources/host-source-visibility.js +7 -6
- package/dist/resources/instance-create-lock.js +17 -0
- package/dist/resources/instance-identity.js +23 -0
- package/dist/resources/instruction-version-record.js +343 -0
- package/dist/resources/key-lock.js +3 -3
- package/dist/resources/mcp-handler.js +36 -8
- package/dist/resources/mcp-oauth-env-guard.js +36 -0
- package/dist/resources/mcp-oauth.js +23 -6
- package/dist/resources/mcp-tool-arguments.js +4 -6
- package/dist/resources/mcp-tools.js +128 -19
- package/dist/resources/memory-bootstrap-lib.js +5 -15
- package/dist/resources/memory-declared-attributes.js +3 -1
- package/dist/resources/memory-deletion-history.js +55 -0
- package/dist/resources/memory-durability.js +54 -0
- package/dist/resources/memory-embed-hash.js +88 -0
- package/dist/resources/memory-embedding-value.js +8 -0
- package/dist/resources/memory-host-source.js +27 -5
- package/dist/resources/memory-id-guard.js +75 -0
- package/dist/resources/memory-redaction.js +236 -0
- package/dist/resources/memory-supplied-vector.js +72 -0
- package/dist/resources/memory-write-lock.js +310 -0
- package/dist/resources/memory-write-response.js +139 -0
- package/dist/resources/migrations/data-dir.js +74 -16
- package/dist/resources/migrations/dir-safety.js +1 -1
- package/dist/resources/migrations/embedding-stamp.js +193 -79
- package/dist/resources/migrations/export.js +1 -0
- package/dist/resources/migrations/graph-heal.js +18 -25
- package/dist/resources/migrations/lock.js +7 -1
- package/dist/resources/migrations/snapshot.js +1 -0
- package/dist/resources/migrations/source-fields.js +5 -5
- package/dist/resources/migrations/synthetic-test-migration.js +14 -11
- package/dist/resources/migrations/visibility-backfill.js +29 -29
- package/dist/resources/object-body-guard.js +33 -0
- package/dist/resources/org-event-created-at.js +133 -0
- package/dist/resources/originator-instance.js +39 -7
- package/dist/resources/owner-delete-recheck.js +78 -0
- package/dist/resources/owner-field-guard.js +39 -5
- package/dist/resources/owner-scoped-write-policy.js +212 -0
- package/dist/resources/owner-scoped-writes.js +58 -0
- package/dist/resources/presence-receipt.js +236 -0
- package/dist/resources/promotion-stamp.js +47 -12
- package/dist/resources/record-owner-guard.js +74 -26
- package/dist/resources/record-types.js +1 -1
- package/dist/resources/relay-ops.js +78 -6
- package/dist/resources/replay-store.js +96 -19
- package/dist/resources/request-target.js +136 -0
- package/dist/resources/request-transaction.js +35 -0
- package/dist/resources/search-readiness.js +4 -1
- package/dist/resources/seed-ids.js +9 -0
- package/dist/resources/seed-reservation.js +117 -0
- package/dist/resources/semantic-retrieval-core.js +20 -9
- package/dist/resources/skill-manifest.js +20 -11
- package/dist/resources/skill-subject.js +53 -0
- package/dist/resources/skill-version-write.js +432 -0
- package/dist/resources/skill-write-fault.js +17 -0
- package/dist/resources/skill-write-policy.js +67 -0
- package/dist/resources/skill-write.js +67 -7
- package/dist/resources/table-helpers.js +10 -7
- package/dist/resources/team-directory.js +248 -0
- package/dist/resources/tool-descriptors/index.js +69 -8
- package/dist/resources/txn-pause-point.js +118 -0
- package/dist/resources/usage-recording.js +171 -63
- package/dist/resources/write-back.js +218 -0
- package/dist/src/engine-version-contract.js +1 -0
- package/dist/src/keystore.js +72 -0
- package/dist/src/lib/agent-home-fields.js +132 -0
- package/dist/src/lib/agent-id-rule.js +46 -0
- package/dist/src/lib/agent-key-register.js +80 -0
- package/dist/src/lib/atomic-write.js +256 -0
- package/dist/src/lib/credential-status-rule.js +78 -0
- package/dist/src/lib/expired-by-agent.js +37 -0
- package/dist/src/lib/flair-agent-role.js +4 -0
- package/dist/src/lib/idp-mapping-rule.js +81 -0
- package/dist/src/lib/instance-identity-row.js +20 -0
- package/dist/src/lib/mcp-oauth-env-core.js +133 -0
- package/dist/src/lib/memory-attributes.js +2 -0
- package/dist/src/lib/memory-id-policy.js +46 -0
- package/dist/src/lib/principal-status.js +29 -0
- package/dist/src/lib/proto-safe-record.js +42 -0
- package/dist/src/lib/reembed-server-support.js +66 -0
- package/dist/src/lib/scheduler-platform.js +10 -6
- package/dist/src/lib/systemd-agent-id.js +38 -0
- package/docs/access-control.md +146 -45
- package/docs/api-reference.md +46 -11
- package/docs/auth.md +6 -12
- package/docs/bridges.md +11 -0
- package/docs/claude-code.md +34 -4
- package/docs/deploying-on-fabric.md +70 -0
- package/docs/deployment.md +2 -0
- package/docs/embedding-in-a-harper-app.md +1 -1
- package/docs/federation.md +33 -2
- package/docs/hosted-on-fabric.md +43 -36
- package/docs/integrations.md +5 -5
- package/docs/mcp-clients.md +5 -2
- package/docs/n8n.md +17 -11
- package/docs/notes/mcp-agent-auth-consumer.md +12 -4
- package/docs/notes/mcp-oauth-model2.md +34 -5
- package/docs/quickstart-fabric.md +2 -2
- package/docs/quickstart.md +9 -1
- package/docs/releasing.md +12 -6
- package/docs/rem.md +8 -0
- package/docs/secrets-and-keys.md +19 -2
- package/docs/standalone-local.md +1 -0
- package/docs/supply-chain-policy.md +13 -3
- package/docs/upgrade.md +32 -6
- package/package.json +10 -5
- package/schemas/agent-key-registration.graphql +22 -0
- package/schemas/agent.graphql +3 -0
- package/schemas/federation.graphql +38 -1
- package/schemas/memory.graphql +84 -5
- package/schemas/oauth.graphql +19 -0
- package/schemas/schema.graphql +2 -0
package/docs/access-control.md
CHANGED
|
@@ -90,6 +90,37 @@ read-back described under [One mapping per login](#one-mapping-per-login)
|
|
|
90
90
|
passed. The command stops before restarting the instance, reports the
|
|
91
91
|
`secrets-provisioning` step as not applied, and exits non-zero.
|
|
92
92
|
|
|
93
|
+
### Link or unlink one login
|
|
94
|
+
|
|
95
|
+
`flair principal link` does only the mapping step, on an instance that is
|
|
96
|
+
already enabled:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
flair principal link alice --instance https://flair.example.com \
|
|
100
|
+
--idp-subject alice --admin-pass "$TARGET_ADMIN_PASS"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The principal must already exist: a missing one is refused by name. A subject
|
|
104
|
+
already mapped to that principal is reported with nothing written; a subject
|
|
105
|
+
mapped to a different principal is refused unless `--replace` moves it, which
|
|
106
|
+
prints the prior principal and any superseded credential. More than one active
|
|
107
|
+
principal mapped to the subject is refused before writing.
|
|
108
|
+
`--instance` (else `FLAIR_URL`) must be HTTPS: these commands
|
|
109
|
+
send the target's admin credential to its operations API, which on a hosted
|
|
110
|
+
instance is the instance host at port 9925. <!-- docs-freshness-allow: hosted operations API port, not the data port -->
|
|
111
|
+
An unparseable URL, `localhost`, a `.local` name, or a loopback, unspecified,
|
|
112
|
+
RFC1918, link-local or IPv6 unique-local address literal is refused before any
|
|
113
|
+
request, and a REMOTE target gets no `--admin-pass` fallback (the rule
|
|
114
|
+
`flair mcp enable` applies).
|
|
115
|
+
|
|
116
|
+
`flair principal unlink <principal> --idp-subject <login>` defaults to provider
|
|
117
|
+
`github`; pass `--idp-provider <name>` for a different provider. Unlink reports
|
|
118
|
+
success only after confirmed updates and no resolvable subject mapping on
|
|
119
|
+
readback. With `FLAIR_MCP_JIT_PROVISION` on, a known tool call after an
|
|
120
|
+
unmapped login may provision a new principal.
|
|
121
|
+
`flair principal links <principal>` lists a principal's current mappings, and
|
|
122
|
+
both take the same `--instance` and `--admin-pass`.
|
|
123
|
+
|
|
93
124
|
### One mapping per login
|
|
94
125
|
|
|
95
126
|
`flair mcp enable` and the resolver both count a login's `idp` credential unless
|
|
@@ -105,11 +136,34 @@ name:
|
|
|
105
136
|
- If the login has a credential that is not `revoked` under a different
|
|
106
137
|
provider name, the run revokes it (the row stays, with status `revoked`) and
|
|
107
138
|
prints its id after `SUPERSEDED:`.
|
|
108
|
-
- After writing, it
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
139
|
+
- After writing, it requires exactly one resolvable (principal-bearing) active
|
|
140
|
+
credential matching the written id and principal.
|
|
141
|
+
Principal-less legacy rows are skipped and may remain active.
|
|
142
|
+
|
|
143
|
+
### Who writes a mapping
|
|
144
|
+
|
|
145
|
+
Through the `Credential` resource, only an administrator or Flair itself
|
|
146
|
+
creates an `idp` credential, changes its kind or identity fields, or
|
|
147
|
+
reactivates it. Flair writes mappings through `flair mcp enable`,
|
|
148
|
+
`flair principal link` and `unlink`, and just-in-time provisioning (below, and
|
|
149
|
+
the XAA grant's); an administrator can also write one through the `Credential`
|
|
150
|
+
resource.
|
|
151
|
+
|
|
152
|
+
On POST, PUT and PATCH, the checks that run first decide before this rule:
|
|
153
|
+
authentication, the owner checks, and the request checks (the rate limit and
|
|
154
|
+
kind validation on POST and PUT, the single-record body on PATCH). For a
|
|
155
|
+
non-admin agent, the owner checks keep their own 403: on PATCH and PUT the
|
|
156
|
+
owner-field guard refuses a change to the credential's principal, PUT refuses
|
|
157
|
+
a body that names another principal, and PATCH, PUT and DELETE refuse a write
|
|
158
|
+
to another principal's credential. On POST, a non-admin agent's credential is
|
|
159
|
+
stamped with its own principal; a `principalId` in the body is not used. An
|
|
160
|
+
administrator may write another principal's credential. A non-admin agent's
|
|
161
|
+
write that passes those checks gets HTTP 403
|
|
162
|
+
with the error `idp_mapping_admin_only` when it would create an `idp`
|
|
163
|
+
credential, change a credential's kind to or from `idp`, change an `idp`
|
|
164
|
+
credential's provider or subject, or change its status to anything other than
|
|
165
|
+
`revoked` (so it cannot reactivate one). A non-admin agent may relabel its own
|
|
166
|
+
`idp` credential, set its status to `revoked`, and delete it.
|
|
113
167
|
|
|
114
168
|
### Just-in-time provisioning
|
|
115
169
|
|
|
@@ -165,17 +219,20 @@ instead (see below).
|
|
|
165
219
|
`client_id` before it sends the person to the identity provider; the person
|
|
166
220
|
continues from there.
|
|
167
221
|
- **Public clients with PKCE.** The document of an app that signs people in
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
222
|
+
may declare its token endpoint auth method. With the shipped `config.yaml` it
|
|
223
|
+
must be `token_endpoint_auth_method: none`, or the field left out; any other
|
|
224
|
+
value is refused with `invalid_client`. Every authorization request must
|
|
225
|
+
carry a PKCE `code_challenge` with method `S256`. With MCP enabled and a
|
|
226
|
+
provider configured, the shipped server advertises `none`,
|
|
227
|
+
`client_secret_basic` and `client_secret_post` as token endpoint auth methods (the last two apply only to registered clients)
|
|
228
|
+
and does not advertise `private_key_jwt`. Setting
|
|
174
229
|
`mcp.clientCredentials.enabled: true`, which turns on the headless grant,
|
|
175
230
|
changes the metadata: it then also lists `private_key_jwt`, the
|
|
176
|
-
`client_credentials` grant type and `EdDSA` as the
|
|
177
|
-
|
|
178
|
-
|
|
231
|
+
`client_credentials` grant type and `RS256`, `ES256` and `EdDSA` as the
|
|
232
|
+
assertion signing algorithms. Setting
|
|
233
|
+
`mcp.clientIdMetadataDocuments.privateKeyJwt.enabled: true` also lists
|
|
234
|
+
`private_key_jwt` and those three algorithms. With either setting, a document
|
|
235
|
+
may declare `private_key_jwt` (with usable keys) instead of `none`.
|
|
179
236
|
|
|
180
237
|
### Changing the list
|
|
181
238
|
|
|
@@ -216,19 +273,31 @@ an upgrade replaces that file, run the command again or edit the file.
|
|
|
216
273
|
|
|
217
274
|
### ChatGPT
|
|
218
275
|
|
|
219
|
-
ChatGPT's
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
error `invalid_client`, and the description
|
|
225
|
-
`token_endpoint_auth_method 'private_key_jwt' is not supported for interactive CIMD clients; use 'none'`.
|
|
226
|
-
Stored registrations are a separate path (see [2. Which apps](#2-which-apps)),
|
|
227
|
-
and registration of new clients is off.
|
|
276
|
+
With MCP enabled and a provider configured, admitting ChatGPT's CIMD client
|
|
277
|
+
requires `chatgpt.com` in `mcp.clientIdMetadataDocuments.allowedHosts` and
|
|
278
|
+
`mcp.clientIdMetadataDocuments.privateKeyJwt.enabled: true`. ChatGPT's assertion
|
|
279
|
+
uses the token-endpoint URL as its audience, so the pinned `@harperfast/oauth`
|
|
280
|
+
2.9.0 also requires this exception in the deployed `config.yaml`:
|
|
228
281
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
282
|
+
```yaml
|
|
283
|
+
'@harperfast/oauth':
|
|
284
|
+
mcp:
|
|
285
|
+
clientIdMetadataDocuments:
|
|
286
|
+
allowedHosts:
|
|
287
|
+
- claude.ai
|
|
288
|
+
- claude.com
|
|
289
|
+
- chatgpt.com
|
|
290
|
+
privateKeyJwt:
|
|
291
|
+
enabled: true
|
|
292
|
+
tokenEndpointAudience:
|
|
293
|
+
clientIds:
|
|
294
|
+
- https://chatgpt.com/oauth/client.json
|
|
295
|
+
expiresAt: '2026-11-01T00:00:00Z'
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Use the exact client ID and an operator-chosen future ISO 8601 `expiresAt`;
|
|
299
|
+
the exception stops accepting the token-endpoint audience at that expiry.
|
|
300
|
+
Restart Flair after editing the configuration.
|
|
232
301
|
|
|
233
302
|
## 3. What they can touch
|
|
234
303
|
|
|
@@ -269,24 +338,57 @@ A connection acts as its principal:
|
|
|
269
338
|
|
|
270
339
|
### Revoking access
|
|
271
340
|
|
|
272
|
-
Deactivate
|
|
273
|
-
`--admin-pass
|
|
341
|
+
Deactivate or reactivate a local principal with `FLAIR_ADMIN_PASS` set or
|
|
342
|
+
`--admin-pass` (and neither `--instance` nor `FLAIR_URL` set):
|
|
274
343
|
|
|
275
344
|
```bash
|
|
276
345
|
flair principal disable alice
|
|
346
|
+
flair principal enable alice
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
For a principal on a remote instance, pass the instance URL and its admin
|
|
350
|
+
password explicitly. These commands share two precedence and credential rules
|
|
351
|
+
with `flair mcp enable`: an explicit `--instance` wins over `FLAIR_URL`, and a
|
|
352
|
+
remote operation requires an explicit `--admin-pass`. The principal commands accept
|
|
353
|
+
explicit loopback targets; `flair mcp enable` accepts loopback or unspecified targets
|
|
354
|
+
for the local restart but refuses local issuers.
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
flair principal disable alice \
|
|
358
|
+
--instance https://flair.example.com \
|
|
359
|
+
--admin-pass "$TARGET_ADMIN_PASS"
|
|
360
|
+
flair principal enable alice \
|
|
361
|
+
--instance https://flair.example.com \
|
|
362
|
+
--admin-pass "$TARGET_ADMIN_PASS"
|
|
277
363
|
```
|
|
278
364
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
`
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
365
|
+
Set `TARGET_ADMIN_PASS` to that instance's admin password before running the
|
|
366
|
+
remote example. A success line appears only after the command reads `alice`,
|
|
367
|
+
the operations API names it in the update result, and a read-back shows the
|
|
368
|
+
requested status; the line reports that read-back status.
|
|
369
|
+
|
|
370
|
+
- On the local path it sends an `update` to the operations API at `127.0.0.1`
|
|
371
|
+
on the machine it runs on. The port precedence is a valid explicit
|
|
372
|
+
`--ops-port`, then `FLAIR_OPS_PORT`, then `opsPort` in the local Flair config,
|
|
373
|
+
then one less than the resolved HTTP port. An invalid explicit `--ops-port`
|
|
374
|
+
is refused with a remedy; it never falls through to a lower-precedence port.
|
|
375
|
+
- With `--instance` (or `FLAIR_URL`) it sends the same `update` to the ops API
|
|
376
|
+
derived from that served instance URL, using the `flair mcp enable` hosted
|
|
377
|
+
operations port convention. A remote target requires an explicit
|
|
378
|
+
`--admin-pass`: `FLAIR_ADMIN_PASS` and `~/.flair/admin-pass` are
|
|
379
|
+
this machine's local credentials and are never sent to another instance.
|
|
380
|
+
`FLAIR_TARGET` and `FLAIR_OPS_TARGET` do not select a principal target.
|
|
381
|
+
Redirects, unconfirmed results, and requests that fail or time out are
|
|
382
|
+
refused with a non-zero exit. Diagnostics omit URL userinfo, query values,
|
|
383
|
+
and unexpected response values; an unparseable target is printed only as
|
|
384
|
+
`<unparseable URL>`.
|
|
385
|
+
- Disable sets the principal's `status` to `deactivated`; enable sets it to
|
|
386
|
+
`active`. Both update its `updatedAt` and nothing else: the principal's
|
|
387
|
+
memories and its login mapping stay. Harper can accept an update for an id
|
|
388
|
+
that has no record, so the command reads the principal first and refuses
|
|
389
|
+
`no principal <id>` before any update when no row exists; a read that fails
|
|
390
|
+
or returns an unreadable body is refused as unverified rather than as
|
|
391
|
+
missing.
|
|
290
392
|
- Flair reads the principal's status on every `tools/call` for a known tool, and
|
|
291
393
|
refuses those calls for a deactivated principal, including calls that carry a
|
|
292
394
|
token issued before the change:
|
|
@@ -299,8 +401,8 @@ When the operations API accepts the update, it prints
|
|
|
299
401
|
401 `{"error":"principal_deactivated"}`.
|
|
300
402
|
- Disabling does not revoke OAuth tokens: they stay valid until they expire,
|
|
301
403
|
and their tool calls are refused. Setting the status back to `active`
|
|
302
|
-
restores access for tokens that are still valid.
|
|
303
|
-
|
|
404
|
+
restores access for tokens that are still valid. `flair principal enable`
|
|
405
|
+
sets the status to `active`.
|
|
304
406
|
|
|
305
407
|
To close `/mcp` for everyone, unset `FLAIR_MCP_OAUTH` in the instance's
|
|
306
408
|
environment (or set it to `0`) and restart the instance; `flair mcp disable`
|
|
@@ -339,7 +441,9 @@ instance's admin password.
|
|
|
339
441
|
|
|
340
442
|
Create a GitHub OAuth app whose callback URL is
|
|
341
443
|
`https://flair.example.com/oauth/github/callback` (the command prints this URL
|
|
342
|
-
too).
|
|
444
|
+
too). The command stages `OAUTH_GITHUB_CLIENT_ID`, `OAUTH_GITHUB_CLIENT_SECRET`
|
|
445
|
+
and `OAUTH_GITHUB_REDIRECT_URI=<public-origin>/oauth` using `--issuer`
|
|
446
|
+
(default: `--instance`). Then run:
|
|
343
447
|
|
|
344
448
|
```bash
|
|
345
449
|
flair mcp enable \
|
|
@@ -352,8 +456,6 @@ flair mcp enable \
|
|
|
352
456
|
When it finishes, it prints each step it ran, marked ✓ or ✗. The steps that
|
|
353
457
|
act:
|
|
354
458
|
|
|
355
|
-
- `signing-key` creates `~/.flair/mcp-signing-key.pem` (or the
|
|
356
|
-
`--signing-key-file` path), or reuses the file if it exists.
|
|
357
459
|
- `idp-credentials` checks that the OAuth app's client id and secret are
|
|
358
460
|
present; in a terminal, the command prompts for them before the steps run.
|
|
359
461
|
- `secrets-provisioning` always stages the secrets the instance needs in a local
|
|
@@ -441,7 +543,6 @@ shares her connector's memories.
|
|
|
441
543
|
|
|
442
544
|
**How to choose:** use one principal when both apps should see the same private
|
|
443
545
|
memories. Keep two when you want to revoke or audit them separately.
|
|
444
|
-
ChatGPT's CIMD client cannot be the second app yet; see [ChatGPT](#chatgpt).
|
|
445
546
|
|
|
446
547
|
**Check:** `bootstrap` in each app returns the `agentId` you chose.
|
|
447
548
|
**Revoke:** `flair principal disable` for the principal you want to stop.
|
package/docs/api-reference.md
CHANGED
|
@@ -136,6 +136,7 @@ is `GET /Name/<id>` unless noted.
|
|
|
136
136
|
| POST | `/Agent` | Admin Basic | Create principal. Also `POST /AgentSeed` (operator/internal only — not an admin-agent key). |
|
|
137
137
|
| PUT / PATCH | `/Agent/<id>` | Ed25519 | An agent updates **only its own** record. |
|
|
138
138
|
| DELETE | `/Agent/<id>` | Admin Basic | Deprovision. |
|
|
139
|
+
| POST | `/AgentKeyRegister` | Basic admin / Ed25519 agent with the admin annotation | Register an agent key. Under Flair's per-agent registration lock, reads a fresh local, non-deactivated row with `publicKey: "pending"` and, at the confirmation read, requires the committed row to equal the fresh-read snapshot and still be `pending` before commit. The lock serializes registrations for that agent within one Harper process; raw operations-API writes and other processes do not take it. A change committed after the confirmation read and before commit is not seen, and a change restored before the confirmation read is not observed; a commit-time pending check is a follow-up. Unsupported schemes that reach the handler receive 401 before Flair's `resolveAgentAuth`, body validation and table reads. Harper handles some Authorization values upstream: a Bearer refresh token receives Harper's 404 before any resource runs. Refuses 409 `agent_key_not_pending` (a non-`pending` row points to key rotation), 403 `agent_not_local` / `agent_inactive`, 404 `agent_not_found`, 400 `registration_request_invalid`, 409 `registration_conflict`, 503 `registration_unavailable`. Writes an `AgentKeyRegistration` audit row and an `agent_key_registered` OrgEvent. The audit `keyFingerprint` and the event `detail` carry the key fingerprint, not the key; the audit `agentId` and the event `refId` carry the target agent's id, which the event `summary` names in text. |
|
|
139
140
|
| GET | `/Presence` | Verified reader | Roster. Requires a valid `TPS-Ed25519` agent signature or the admin credential; an anonymous request gets 401. An instance may opt in to a public roster with `PRESENCE_PUBLIC_ROSTER=true`, in which case an unverified reader gets the allowlisted roster with `currentTask`, `flairVersion`, and `harperVersion` as null. Thresholds: [Presence for API consumers](#presence-for-api-consumers). |
|
|
140
141
|
| POST | `/Presence` | Ed25519 | Heartbeat. Agent writes only its own row (403 cross-agent). Stamps `flairVersion` / `harperVersion` on the row. |
|
|
141
142
|
| PUT / DELETE | `/Presence/<id>` | Ed25519 | Own row only. Collection PUT is not a public bypass. |
|
|
@@ -143,9 +144,15 @@ is `GET /Name/<id>` unless noted.
|
|
|
143
144
|
| POST / PUT / PATCH / DELETE | `/Soul` | **Operator / internal** | Not Ed25519. Learned Memory text cannot be copied in as Soul. See [docs/auth.md](auth.md#soul-authorship). |
|
|
144
145
|
| POST | `/FeedSouls` | Ed25519 | Soul change feed (verified). |
|
|
145
146
|
|
|
146
|
-
`Credential` (GET/POST verified; extra credentials for a principal
|
|
147
|
+
`Credential` (GET/POST verified; extra credentials for a principal; through
|
|
148
|
+
this resource only an administrator or the server creates a `kind: "idp"`
|
|
149
|
+
credential, changes its kind or identity fields, or reactivates it, and its
|
|
150
|
+
owner may relabel, revoke or delete it, see
|
|
151
|
+
[Who writes a mapping](access-control.md#who-writes-a-mapping)) and
|
|
147
152
|
`Integration` (legacy 0.x platform rows; verified, prefer Credential) sit on
|
|
148
|
-
the same identity plane.
|
|
153
|
+
the same identity plane. `AgentKeyRegistration`
|
|
154
|
+
(agent-key-registration.graphql) is the admin-read-only audit log of committed
|
|
155
|
+
registrations; its key field is the fingerprint, not the key.
|
|
149
156
|
|
|
150
157
|
### Memory, search, bootstrap
|
|
151
158
|
|
|
@@ -153,12 +160,13 @@ the same identity plane.
|
|
|
153
160
|
|--------|------|------|--------------|
|
|
154
161
|
| GET | `/Memory`, `/Memory/<id>` | Ed25519 | open-within-org. By-id deny = 404. |
|
|
155
162
|
| POST / PUT / PATCH | `/Memory` | Ed25519 | Own `agentId` only. Auto-embed on write. Visibility defaults from durability (`permanent`/`persistent` → `shared`, `standard`/`ephemeral` → `private`). Identified client older than 0.18.0 → **426** `stale_flair_client` (missing version is served). |
|
|
163
|
+
| PATCH | `/Memory/<id>`, body `{"embedding": null, "embeddingModel": null}` | Ed25519 | Owner or admin. Re-embeds the stored row, writing `embedding`, `embeddingModel` and `updatedAt`, and answers `{ id, updatedAt }` (what `flair reembed` sends; it reads `embeddingModel` from the stored row afterwards). |
|
|
156
164
|
| DELETE | `/Memory/<id>` | Ed25519 | Owner or admin. `permanent` owner-delete is allowed. |
|
|
157
|
-
| POST | `/SemanticSearch` | Ed25519 | Hybrid semantic + lexical. Same read-scope as Memory. Default scoring is `raw`. |
|
|
165
|
+
| POST | `/SemanticSearch` | Ed25519 | Hybrid semantic + lexical. Same read-scope as Memory. Default scoring is `raw`. Results carry `provenance` (like the by-id and list reads); `includeTrust` and `abstain` stay opt-in. |
|
|
158
166
|
| POST | `/BootstrapMemories` | Ed25519 | Cold-start context (soul + predicted memories + optional org events). |
|
|
159
167
|
| POST | `/RecordUsage` | Ed25519 | Cross-agent usage signal (`Memory.usageCount`). No ownership requirement; counts only memories in the caller's read scope (`resolveReadScope`: own at any visibility, others' non-private), admin callers included even though admin Memory reads are unfiltered; an out-of-scope id is handled like a missing one. No existence oracle in the response. Prefer this over writing `/MemoryUsage` directly. |
|
|
160
168
|
| GET | `/MemoryUsage` | Ed25519 | Non-admin reads: own ledger rows only, about memories the caller can currently read; any other row reads as not found. Admin and internal reads are unchanged. PUT/DELETE are admin/internal — agents must not delete their row to re-count. |
|
|
161
|
-
| GET / write | `/MemoryGrant` | Ed25519 |
|
|
169
|
+
| GET / write | `/MemoryGrant` | Ed25519 | Non-admin reads: owner or grantee. Write/delete: owner only (you share your own memories). A `write` grant lets the grantee write a successor of the owner's memory or skill (`supersedes`). A write grant does not include changing a record's visibility; visibility is set by the owner or an admin. For that grant-authorized write, the successor carries the predecessor's visibility, and a write naming a different one is refused with 403 `grant_cannot_change_visibility` unless an earlier validation refuses it first (an ordinary, non-skill ephemeral write naming `shared` gets 400 `invalid_visibility_for_durability`; an ephemeral skill write gets 400 `skill_durability`, and a `session` skill write gets 400 `invalid_durability` on Memory POST/PUT (durability validation runs first) and 400 `skill_durability` on FeedMemories). After staging the close, the writer re-reads the predecessor's committed row; a visibility that no longer reads the same refuses the write with 409 `predecessor_visibility_changed`, and a change committed after that final re-read is not seen. An ordinary successor and its close share the write's transaction. An ordinary close refusal aborts the whole write: a storage Response returns the fixed 500 `write_response_withheld`; grant revocation returns 409 `granted_close_revoked`; a predecessor change that keeps visibility the same returns 409 `stored_row_changed`. No refusal writes anything. An ordinary successor is the grantee's own row, so the grantee may later change its visibility as its owner; a skill successor keeps its lineage owner. |
|
|
162
170
|
| GET / write | `/Asset` | Ed25519 | Owner-only blobs linked by `memoryId`. No MCP and no federation in this slice. |
|
|
163
171
|
| GET / write | `/MemoryCandidate` | Ed25519 | Owner-only REM drafts. Never auto-promoted except the narrow ADK path. |
|
|
164
172
|
| POST | `/PromoteMemoryCandidate` | Ed25519 | Promote/reject with required rationale. |
|
|
@@ -170,6 +178,7 @@ the same identity plane.
|
|
|
170
178
|
| POST | `/MemoryConsolidate` | Ed25519 | Dedup / consolidate. |
|
|
171
179
|
| POST | `/MemoryReflect` | Ed25519 | REM distill → MemoryCandidate. |
|
|
172
180
|
| POST | `/MemoryDedupStats` | Admin Basic | Dedup diagnostics. Fleet-wide sweep; `allowCreate` is `allowAdmin`. |
|
|
181
|
+
| POST | `/MemoryPurge` | **Operator / internal** | Not Ed25519, admin-agent keys included. Physical removal of Memory rows by id; a skill-tagged row expands to its whole skill lineage. `removedIds` lists the rows a read after the commit finds gone; a target not stored before the delete fails the call (404). A target still stored after the commit keeps its pointer row. Unconfirmed history cleanup returns 500 `memory_purge_history_cleanup_unconfirmed` before pointer-cleanup failure (500 `memory_purge_pointer_cleanup_failed`) or a still-stored target (409 `memory_purge_unconfirmed`). Does not change `DELETE /Memory/<id>`. An accepted DELETE of a non-reserved skill closes its head; the reserved `using-flair` seed is physically deleted. |
|
|
173
182
|
| POST | `/SkillScan` | Ed25519 | Skill-tag scan on Memory writes. |
|
|
174
183
|
| GET | `/OrgSkillAssignment`, `/OrgSkillAssignment/<id>` | Ed25519 | Any verified agent. Org-scope skill assignments; see the `skills` paragraph in [docs/mcp-clients.md](mcp-clients.md). Not federated. |
|
|
175
184
|
| POST / PUT / PATCH / DELETE | `/OrgSkillAssignment/` (POST), `/OrgSkillAssignment/<id>` (PUT / PATCH / DELETE) | **Operator / internal** | Not Ed25519, admin-agent keys included. Each accepted write appends an `OrgSkillAssignmentHistory` row. |
|
|
@@ -217,7 +226,7 @@ The remedy is `flair upgrade` (the adapter), not a server upgrade alone.
|
|
|
217
226
|
| GET / POST / PUT | `/Relationship` | Ed25519 / Admin Basic | Owner-only for non-admin agents; administrators can read across owners. POST creates; a create that is otherwise admitted, valid and within the rate limit is 409 when its id already exists. PUT upserts. For a verified non-admin agent both stamp the owner from the caller (a body naming another agent is 403); an administrator keeps the owner it supplies. A write that passes validation gets provenance built server-side. |
|
|
218
227
|
| GET / POST / PUT | `/WorkspaceState` | Ed25519 | Owner-only. POST stamps `agentId`; PUT rejects a mismatch. |
|
|
219
228
|
| GET | `/WorkspaceLatest` | Ed25519 | Latest workspace row for the caller. |
|
|
220
|
-
| GET / POST / PUT | `/OrgEvent` | Ed25519 | Any verified agent reads every event.
|
|
229
|
+
| GET / POST / PUT / PATCH | `/OrgEvent` | Ed25519 / Admin Basic | Any verified agent reads every event. `authorId` for a non-admin agent: POST sets it from the caller, whatever the body says; PUT requires the body to name the caller (403 otherwise, including when it is absent); PATCH leaves the stored value unless the body names one, and refuses a change (403). An administrator (an admin agent key or credentialed Basic admin) may supply `authorId` on any verb; POST defaults it to the administrator's own id. The server assigns an OrgEvent's `createdAt` on create. After the earlier checks, a `createdAt` check reads the stored row under each event's id. A stored row's `createdAt` is authoritative whatever its value (an empty string included): an update that omits it keeps it, and one that names a different value is refused with 409 `created_at_immutable`. An event that reaches the check and is not an object, or whose id is not a non-empty string or a non-empty array of strings, is refused with 400 `invalid_event_id` before any write, as is an administrator's PATCH to the collection (for a non-admin's collection PUT, PATCH or DELETE, if reached, the table guard returns the 403 collection refusal; existing DELETE middleware may refuse earlier). Before validation, an addressed POST binds a missing or `null` body id to the addressed id, and a string or number body id when its text matches the address; any other id type is left unchanged by this step. At the root collection, POST generates an id when the body's id is missing, `null` or empty. At POST id validation, at the root collection or an addressed path whose body id was not bound, a remaining id that is not a non-empty string or a non-empty array of strings receives 400 `invalid_event_id`. |
|
|
221
230
|
| GET / POST | `/OrgEventCatchup` | Ed25519 | Catch-up feed for the caller. `since` is optional (defaults to the per-agent watermark). GET pages; POST acks `{ position }` (advance-on-ack). |
|
|
222
231
|
| GET / POST | `/AgentReadPosition` | Ed25519 | Owner-only watermark (`stream`, default `org-event`). Foundation for light-comms catch-up. |
|
|
223
232
|
| POST | `/OrgEventMaintenance` | Ed25519 / admin | Expire / sweep org events. |
|
|
@@ -264,8 +273,13 @@ operator audit trail.
|
|
|
264
273
|
| GET / write | `/IdpConfig` | Admin Basic | XAA IdP registration (`flair idp add`). |
|
|
265
274
|
| GET | `/MCPClientMetadata` | Public / handler-gated | CIMD documents for allowed hosts. |
|
|
266
275
|
|
|
267
|
-
`OAuthAuthCode`, `OAuthToken`, and `
|
|
268
|
-
`@export`). They hold codes, hashed tokens,
|
|
276
|
+
`OAuthAuthCode`, `OAuthToken`, `IdJagReplay`, and `OAuthSingleUse` are internal
|
|
277
|
+
tables (no `@export`). They hold codes, hashed tokens, used `jti` values, and
|
|
278
|
+
the hashed keys of codes presented for redemption and refresh tokens presented
|
|
279
|
+
for rotation. A single-use row records that a redemption was claimed. The
|
|
280
|
+
handler attempts the later `used` or revocation write before issuing tokens.
|
|
281
|
+
If that write fails, no token pair is issued; the claim remains, so the code
|
|
282
|
+
or token cannot be redeemed again.
|
|
269
283
|
|
|
270
284
|
OAuth rate limits and env vars: [docs/auth.md](auth.md#rate-limiting).
|
|
271
285
|
|
|
@@ -334,7 +348,7 @@ client-writable even if a client sends them. Full comments live in
|
|
|
334
348
|
|
|
335
349
|
`GET /Presence` requires a **verified reader** by default. A verified reader is a request carrying a valid `TPS-Ed25519` agent signature from an agent registered on this instance, or the admin credential. An anonymous — or otherwise unverified — request gets **401**, not a redacted roster. The roster is org-visible data (who is working, on what class of activity, and how recently) and is not published by default.
|
|
336
350
|
|
|
337
|
-
An instance that runs a public status page opts back in with the presence config key `PRESENCE_PUBLIC_ROSTER=true` (the same env-var channel as the thresholds below); it is **off by default** and is documented as *publishes your roster to the internet*. With it on
|
|
351
|
+
An instance that runs a public status page opts back in with the presence config key `PRESENCE_PUBLIC_ROSTER=true` (the same env-var channel as the thresholds below); it is **off by default** and is documented as *publishes your roster to the internet*. With it on, an anonymous caller gets the field-allowlisted roster (id, display name, role, runtime, activity fields, `presenceStatus`, `lastHeartbeatAt`), and three fields are redacted to `null` for an HTTP caller unless the request carries a valid `TPS-Ed25519` agent signature: `currentTask`, `flairVersion`, and `harperVersion`. Over HTTP, anonymous callers, unsigned loopback and Basic admin are unverified readers of the content gate. A trusted in-process read delegated on behalf of a registered agent can also receive the three fields without a signature. The nulls are intentional. Public `/Health` exposes the server version and build identity. A null `flairVersion` on an unverified read does not mean the peer lacks a version, and it does not mean the peer cannot accept a directed handoff.
|
|
338
352
|
|
|
339
353
|
A verified reader still sees `null` for a version the row never stored. Heartbeats stamp the running server's versions; a row written before that stamp, and not heartbeated since, has no value to return. `harperVersion` is also null when this process could not resolve Harper's package version. That null means unknown, not redacted.
|
|
340
354
|
|
|
@@ -388,6 +402,14 @@ A peer can therefore show `presenceStatus: "offline"`, `activity: "idle"`, `last
|
|
|
388
402
|
|
|
389
403
|
> The host pointer (`hostSource`) is **not** a Memory attribute — it lives in its own `MemoryHostSource` table (below). There is no `hostSource` / `hostSourceVisibility` field on `Memory`.
|
|
390
404
|
|
|
405
|
+
#### Durability tiers (#2217)
|
|
406
|
+
|
|
407
|
+
- permanent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it); it never decays; bootstrap considers the bootstrapping agent's own permanent memories before recent rows, subject to scope, expiry/closure and the token budget.
|
|
408
|
+
- persistent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it).
|
|
409
|
+
- standard — routine maintenance archives it once its validTo passes or, as a session note, after 30 days.
|
|
410
|
+
- ephemeral — routine maintenance reaps it once its TTL (24h by default) passes.
|
|
411
|
+
- No tier adds a flush, fsync, backup or replica acknowledgement: an explicit delete (owner or admin) or a store failure can end any of them.
|
|
412
|
+
|
|
391
413
|
#### Memory host pointer (`MemoryHostSource`, #1940 A1'-A5)
|
|
392
414
|
|
|
393
415
|
The pointer is a host-object pointer — versioned JSON `{ v: 1, host, kind, id, url? }` — that records which host object the writer claims as the memory’s source. **Supported writes store host pointers only in `MemoryHostSource`. For non-admin `Memory.get`, `Memory.search`, and `SemanticSearch` results, the gated projection removes inline pointer fields and renders a pointer only from a bound `MemoryHostSource` row.**
|
|
@@ -412,13 +434,13 @@ The **binding** (A1-iv item 1): The named application create paths stamp a local
|
|
|
412
434
|
- **A4** — the server stamps `receivedAt` inside `provenance`; it is server-stamped and never client-writable. `createdAt` stays the writer's claimed time, so `asOf`/valid-time queries use the writer's claim.
|
|
413
435
|
- **A5** — the pointer is NOT inside `provenance`; `provenance` stays never-client-writable.
|
|
414
436
|
|
|
415
|
-
**Read** — the pointer reaches a reader ONLY through a gated join into Memory results (search, by-ID, semantic search; semantic results carry the joined pointer to a permitted reader — test `(s5)`), which has three outcomes: the pointer, `"withheld"`, or nothing. A pointer is visible only to the record's author unless the write opted it into the record's scope, and it is never wider than its record: the effective visibility is the narrower of the record's write-time visibility (`scopeAtWrite`) and its current visibility (`narrower(scopeAtWrite, record.visibility)`). The join takes the narrower of the stored pointer scope and the Memory row's current visibility, so a later widening of the record does not widen the pointer. A reader who may read the record but not the pointer:
|
|
437
|
+
**Read** — the pointer reaches a reader ONLY through a gated join into Memory results (search, by-ID, semantic search, bootstrap; semantic results carry the joined pointer to a permitted reader — test `(s5)`), which has three outcomes: the pointer, `"withheld"`, or nothing. A pointer is visible only to the record's author unless the write opted it into the record's scope, and it is never wider than its record: the effective visibility is the narrower of the record's write-time visibility (`scopeAtWrite`) and its current visibility (`narrower(scopeAtWrite, record.visibility)`). The join takes the narrower of the stored pointer scope and the Memory row's current visibility, so a later widening of the record does not widen the pointer. A reader who may read the record but not the pointer: on a non-admin read, a bound pointer outside the reader's pointer scope renders as `"withheld"` on the structured reads (get / search / semantic search) and as the prose marker `[via withheld]` in bootstrap; an unbound or archived pointer renders nothing. Wherever a URL is rendered, only scheme, host and path appear; query and fragment are stripped. Redaction is applied on the server, in the read projection — no client or MCP layer can un-redact. `Memory.get()`, `Memory.search()`, `SemanticSearch` and bootstrap render pointers through the pointer helper; for a non-admin agent caller, bootstrap cites a visible pointer in PROSE as `[via <host>/<kind> <id8> (unverified)]`, where the first 8 id characters are display-only and the full URL never appears. Each reader fetches pointers in ONE batched query per result set, never one per row.
|
|
416
438
|
|
|
417
439
|
**Direct access** — Direct resource reads permit admin agents and trusted in-process callers; non-admin agents cannot read this table directly. The author reads their own pointer only through the gated join. The table has **NO REST write verbs**: `POST`/`PUT`/`PATCH`/`DELETE` to the resource are refused for EVERY caller, non-admin and admin alike, with nothing written (`r4-http`), so no REST caller can plant a pointer. A superuser Harper operation against the table (an admin `export`, `backup`, `reseed`, or a hygiene/forensics read of orphaned or author-only pointers) is the named operator path and is not gated by the resource (`r4-http` proves only the resource refusal). This admin exception names `MemoryHostSource` explicitly.
|
|
418
440
|
|
|
419
441
|
**Federation** — `MemoryHostSource` is excluded from the sync's table set by mechanism (it is absent from the federation table policy), and an inbound row carrying a pointer field is refused. The outbound reader projects declared Memory attributes. The inbound merge removes undeclared attributes except the named bookkeeping fields (`f1-out`, `f1-in`). `Memory.delete` and maintenance expiry or age-based archival delete the pointer with their Memory operation. `MemoryArchive` basement/restore retains the pointer row; the join suppresses it while the Memory is archived. `Memory.delete` joins a request transaction when present; maintenance uses an owned transaction per item. An orphan sweep re-checks inside the transaction before deleting; a cleanup failure makes the maintenance run report a failure, not "complete". Orphaned pointers are absent from ordinary Memory joins but remain directly readable by administrators.
|
|
420
442
|
|
|
421
|
-
|
|
443
|
+
hostSource is the writer's unverified claim about an external source, stored with the writer's authenticated agent id; Flair does not verify it. The Ed25519 request signature covers method and URL, not the body.
|
|
422
444
|
|
|
423
445
|
### Soul
|
|
424
446
|
|
|
@@ -430,7 +452,7 @@ A `hostSource`, like a client-supplied `createdAt`, is a writer claim attributed
|
|
|
430
452
|
| `priority` | String | `critical` \| `high` \| `standard` \| `low` |
|
|
431
453
|
| `metadata` | String | JSON (skill governance, etc.) |
|
|
432
454
|
| `provenance` | String | Operator/internal author + `sourceClass` |
|
|
433
|
-
| `durability` | String |
|
|
455
|
+
| `durability` | String | POST defaults to `permanent`; PUT supplies no default |
|
|
434
456
|
| `createdAt` / `updatedAt` | String | |
|
|
435
457
|
| `originatorInstanceId` | String | Server-stamped write-time instance id; not client-writable through a resource write |
|
|
436
458
|
|
|
@@ -465,6 +487,7 @@ ed25519 / idp) and **Integration** (legacy platform connection).
|
|
|
465
487
|
| **Instance** | yes | One row per Flair instance (`id`, `publicKey`, `role` hub/spoke, `fabricEndpoint`, `status`) |
|
|
466
488
|
| **PairingToken** | yes | One-time token (`expiresAt`, `consumedBy`) |
|
|
467
489
|
| **Peer** | yes | Pinned peer (`publicKey`, `endpoint`, `status`, `lastSyncAt` / `lastMergeAt`, `lastSyncCursor`, `relayOnly`) |
|
|
490
|
+
| **FederationRetry** | yes | Sender-owned federation retry bookkeeping, shaped for one row per (peer, table, record) refused for a reason a later re-offer could clear (`state`, `attempts`, `firstRefusedAt`, `lastReason`, `resolution`, `bound`). No production sender path creates rows yet; admin-written rows are readable. `@sealed`: a write naming an undeclared field is refused. Admin-only on every operation; excluded from federation policy and the receive mapping. |
|
|
468
491
|
| **ReplayNonce** | no | `schemas/replay.graphql`. Anti-replay record shared by agent auth (`a:<agentId>:<nonce>`) and federation body signatures (`f:<nonce>`). Local to the instance (`replicate: false`); rows expire after 120 s |
|
|
469
492
|
| **SyncLog** | no | Per-sync audit (`peerId`, `direction`, counts, `skippedReasons`, `status`) |
|
|
470
493
|
|
|
@@ -480,15 +503,27 @@ ed25519 / idp) and **Integration** (legacy platform connection).
|
|
|
480
503
|
| **Asset** | memory.graphql | yes | Blob (`contentType`, `data`) owned by `agentId`, linked by `memoryId` |
|
|
481
504
|
| **OrgSkillAssignment** | memory.graphql | yes | Org-scope skill assignment (`skillName`, `skillRef`, `priority`, server-stamped `writer` / `sourceClass`) |
|
|
482
505
|
| **OrgSkillAssignmentHistory** | memory.graphql | no | One row per accepted OrgSkillAssignment resource write (`assignmentId`, `op`, `actor`, `sourceClass`, `previousHash`) |
|
|
506
|
+
| **MemoryDeletionHistory** | memory.graphql | no | History of confirmed physical deletions of permanent/persistent Memory rows through `Memory.delete` (including CLI hygiene and agent remove), appended in the delete transaction. Non-durable deletes, including maintenance expiry, append no history (`memoryId`, `memoryInstanceToken`, `durability`, `actor`, `sourceClass`, `at`); read by `flair integrity check` for history-backed attributions. `replicate: true` is declared explicitly to state the database default (a table replicates unless it opts out) |
|
|
507
|
+
| **InstructionVersion** | memory.graphql | yes (read only) | Append-only history for single-row Soul resource writes and skill writes through Memory post/put/delete and FeedMemories (excluding `_reindex` and reserved-seed deletes). Soul collection deletes and InstructionVersion REST writes are refused. The operator's reserved seed row keeps its fixed id and is versioned in place. Skill writers share a subject-type lock, select rows where `archived !== true` and `validTo` is not a nonempty string, and refuse stale create/update targets or predecessors and ambiguous heads. Reads authorize `soul` subjects under Soul's verified-agent rule. Ordinary skill readers require readable stored visibility and current authority: matching subjects, a live skill Memory row owned by the head's owner, or a delete head with null `memoryId`; authority references require nonempty owners and explicit private/shared visibility. Admin/internal keep unfiltered skill reads; unknown subject types deny. `Memory.skillSubjectId` is nullable and server-owned. |
|
|
483
508
|
| **WorkspaceState** | workspace.graphql | yes | Current work (`ref`, `provider`, `phase`, `entities`) |
|
|
484
509
|
| **OrgEvent** | event.graphql | yes | Org-visible event (`authorId`, `kind`, `summary`, `entities`) |
|
|
485
510
|
| **AgentReadPosition** | agent.graphql | no | Per-agent watermark (`agentId`, `stream`, `position`). HTTP via `/AgentReadPosition`, not raw-table REST. |
|
|
511
|
+
| **AgentKeyRegistration** | agent-key-registration.graphql | yes (admin read only) | Audit log of committed `POST /AgentKeyRegister` calls (`actorId`, `operator`, `agentId`, `instanceId`, `keyFingerprint`, `createdAt`). The Flair resource route refuses every write; the registration operation is its only application writer. The operations API is a separate raw-table trust root. `replicate: true` is declared explicitly to state the database default (a table replicates unless it opts out). |
|
|
486
512
|
| **Message** | message.graphql | yes | Signed envelope (`from`, `to`, `threadId`, `seq`, `state`, `signature`) |
|
|
487
513
|
| **OAuthClient** | oauth.graphql | yes | Registered OAuth clients |
|
|
488
514
|
| **OAuthAuthCode** | oauth.graphql | no | Single-use codes + PKCE |
|
|
489
515
|
| **OAuthToken** | oauth.graphql | no | Hashed access/refresh tokens |
|
|
490
516
|
| **IdpConfig** | oauth.graphql | yes | XAA IdP (`issuer`, `jwksUri`, `requiredDomain`) |
|
|
491
517
|
| **IdJagReplay** | oauth.graphql | no | Used ID-JAG `jti` values |
|
|
518
|
+
| **OAuthSingleUse** | oauth.graphql | no | A claim to redeem an authorization code or rotate a refresh token, keyed by its SHA-256 |
|
|
519
|
+
|
|
520
|
+
`flair integrity check` reports missing checkpointed durable Memory IDs or replacements with changed or missing previously nonempty tokens without matching new deletion history. A row created and lost entirely between scans is not observed. The scan reads deletion history at or after the checkpoint's watermark minus a margin; an absent or unknown watermark reads the whole table.
|
|
521
|
+
|
|
522
|
+
`flair integrity prune-history` prunes deletion history older than the oldest named checkpoint watermark minus a margin. It is a dry run unless `--apply` is given, prunes at most `--max` rows in a run, and refuses — naming the reason — when a checkpoint is missing or a watermark is unreadable. Pruning against only some of the checkpoints that read an instance can remove history an unnamed checkpoint still needs, which causes false alerts there.
|
|
523
|
+
|
|
524
|
+
`InstructionVersion` rows are appended by Flair's in-process write path. The administrator operations API (`upsert` / `delete` under admin auth) can also write version rows, and that path is not audited by this table — a documented, deferred exception.
|
|
525
|
+
|
|
526
|
+
Raw operations-API Memory deletes create no deletion history. A scan alerts when a checkpointed durable incarnation is missing or replaced without new matching history.
|
|
492
527
|
|
|
493
528
|
---
|
|
494
529
|
|
package/docs/auth.md
CHANGED
|
@@ -12,19 +12,13 @@ Different surfaces authenticate differently. The model in one place:
|
|
|
12
12
|
| **CLI / SDK clients** (`flair`, `flair-client`) | Ed25519 agent keys; administrator Basic on supported paths | Ordinary signed agents: own writes; own and org-wide non-private reads | Administrator agent roles and Basic credentials have broader authority. |
|
|
13
13
|
| **MCP server** (`@tpsdev-ai/flair-mcp`) | Ed25519 agent key; configured administrator Basic fallback | Ordinary signed agents: own writes; own and org-wide non-private reads | The key is auto-resolved from `~/.flair/keys/<agent>.key`; Basic is used when no key resolves and administrator credentials are configured. |
|
|
14
14
|
| **OpenClaw / pi / Hermes plugins** | Ed25519 agent keys; Pi can use configured administrator Basic fallback | Ordinary signed agents: own writes; own and org-wide non-private reads | OpenClaw identity comes from host context; Pi requires `FLAIR_AGENT_ID`; Hermes defaults to `hermes`. |
|
|
15
|
-
| **`n8n-nodes-flair`** | **
|
|
15
|
+
| **`n8n-nodes-flair`** | **Ed25519 with Agent Private Key selected**; deprecated administrator Basic | Ordinary signed agents: own writes; own and org-wide non-private reads | The deprecated **Admin Password** authenticates as the Harper administrator (whole instance, including `private`) when Agent Private Key is empty. |
|
|
16
16
|
|
|
17
17
|
**The default, secure path is Ed25519 per-agent** (see below): each agent holds its own key and signs every request. For ordinary signed agents, this enforces write ownership: they can write only their own records and read their own plus other agents' non-private records. Administrator credentials and administrator agent roles have broader authority, including access to private records. The hard access boundary is the **federation edge** (a separate Flair instance / org), not reads within an instance. See [SECURITY.md](../SECURITY.md) for the full model. Use Ed25519 per-agent everywhere you can regardless — it's still what makes writes and identity trustworthy.
|
|
18
18
|
|
|
19
|
-
###
|
|
19
|
+
### n8n: agent-key signing, with the admin password deprecated
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- The n8n instance is single-tenant and operator-controlled.
|
|
24
|
-
- Workflow inputs are trusted (your own CRM, your own webhook source).
|
|
25
|
-
- Write-forgery and full read access (including `private` memories) are acceptable for the use case.
|
|
26
|
-
|
|
27
|
-
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 to gain Ed25519 per-agent auth (planned). Full guidance in [docs/n8n.md](n8n.md#security).
|
|
21
|
+
With **Agent Private Key** selected, `n8n-nodes-flair` signs as the credential's Agent ID. Ordinary agents write their own memories and read their own plus other agents' non-private memories. The deprecated **Admin Password** path uses Harper administrator Basic authentication only with an empty Agent Private Key, and warns on each node execution. See [n8n setup](n8n.md#3-create-the-credential).
|
|
28
22
|
|
|
29
23
|
## Ed25519 Agent Auth (Default)
|
|
30
24
|
|
|
@@ -324,9 +318,9 @@ Ed25519 keys, including admin-agent keys, and MCP/OAuth delegation cannot create
|
|
|
324
318
|
update, patch or delete Soul. A missing context does not grant Soul authority.
|
|
325
319
|
This distinguishes credential classes; an administrator password is still a
|
|
326
320
|
privileged secret, not proof that a human typed the request. Keep it out of
|
|
327
|
-
agent-runtime environments. The n8n adapter
|
|
328
|
-
|
|
329
|
-
|
|
321
|
+
agent-runtime environments. The n8n adapter uses agent signing when Agent Private
|
|
322
|
+
Key is selected; its deprecated Admin Password path uses administrator Basic
|
|
323
|
+
authentication. Existing verified Soul reads are unchanged.
|
|
330
324
|
|
|
331
325
|
For an explicit operator edit:
|
|
332
326
|
|
package/docs/bridges.md
CHANGED
|
@@ -47,6 +47,12 @@ interface BridgeMemory {
|
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
- permanent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it); it never decays; bootstrap considers the bootstrapping agent's own permanent memories before recent rows, subject to scope, expiry/closure and the token budget.
|
|
51
|
+
- persistent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it).
|
|
52
|
+
- standard — routine maintenance archives it once its validTo passes or, as a session note, after 30 days.
|
|
53
|
+
- ephemeral — routine maintenance reaps it once its TTL (24h by default) passes.
|
|
54
|
+
- No tier adds a flush, fsync, backup or replica acknowledgement: an explicit delete (owner or admin) or a store failure can end any of them.
|
|
55
|
+
|
|
50
56
|
**Required on import:** `content` and (`agentId` or the `--agent` flag).
|
|
51
57
|
|
|
52
58
|
**Flair-owned, never set by a bridge:** `contentHash`, `embedding`, `embeddingModel`, `retrievalCount`, `lastRetrieved`, `promotionStatus`, `_safetyFlags`, any `*By` audit field. These are computed on ingest; if a bridge emits them they're ignored.
|
|
@@ -73,6 +79,9 @@ Common runtime options for `import`:
|
|
|
73
79
|
| `--port <port>` | Harper HTTP port |
|
|
74
80
|
| `--url <url>` | Flair base URL (overrides `--port`) |
|
|
75
81
|
| `--key <path>` | Ed25519 private key path (default: resolved from agent) |
|
|
82
|
+
| `--user <id>` | Foreign-system user id for bridges that import one user (e.g. mem0); YAML imports do not use it |
|
|
83
|
+
| `--base-url <url>` | HTTP(S) base URL of the foreign API for API bridges (e.g. a self-hosted mem0); an explicit empty or invalid mem0 URL is refused |
|
|
84
|
+
| `--api-key-file <path>` | For API bridges that declare an `apiKey` option, read the key from a file with no group/world permissions (`chmod 600` recommended). YAML imports refuse this flag. For mem0, `MEM0_API_KEY` is the alternative; the key is never a flag value. |
|
|
76
85
|
|
|
77
86
|
## Your first import (worked example: agentic-stack)
|
|
78
87
|
|
|
@@ -198,6 +207,8 @@ export const bridge: MemoryBridge = {
|
|
|
198
207
|
};
|
|
199
208
|
```
|
|
200
209
|
|
|
210
|
+
**`opts`** contains the option values passed to the plugin as own properties. For `import` it is a null-prototype record, so inherited methods such as `opts.hasOwnProperty` are not available: test for a key with `Object.hasOwn(opts, key)`, which works for `export` too.
|
|
211
|
+
|
|
201
212
|
**`BridgeContext`** gives you:
|
|
202
213
|
|
|
203
214
|
- `ctx.fetch` — instrumented, rate-limited HTTP. **Always use this instead of the global `fetch`** — it's how the runtime applies per-bridge throttling and audit logging.
|
package/docs/claude-code.md
CHANGED
|
@@ -74,9 +74,11 @@ Copy this into your project's `CLAUDE.md` (or `.claude/settings.md`, `AGENTS.md`
|
|
|
74
74
|
|
|
75
75
|
### Durability levels
|
|
76
76
|
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
77
|
+
- permanent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it); it never decays; bootstrap considers the bootstrapping agent's own permanent memories before recent rows, subject to scope, expiry/closure and the token budget.
|
|
78
|
+
- persistent — routine maintenance never reaps or age-archives it (an expired validTo archives an eligible row; an acquired expiresAt never reaps it).
|
|
79
|
+
- standard — routine maintenance archives it once its validTo passes or, as a session note, after 30 days.
|
|
80
|
+
- ephemeral — routine maintenance reaps it once its TTL (24h by default) passes.
|
|
81
|
+
- No tier adds a flush, fsync, backup or replica acknowledgement: an explicit delete (owner or admin) or a store failure can end any of them.
|
|
80
82
|
|
|
81
83
|
> **End of CLAUDE.md snippet.**
|
|
82
84
|
|
|
@@ -86,13 +88,15 @@ This is a prompt-driven CLI setup: Claude must choose to run these commands. For
|
|
|
86
88
|
|
|
87
89
|
## Hooks
|
|
88
90
|
|
|
89
|
-
`@tpsdev-ai/flair-mcp` ships
|
|
91
|
+
`@tpsdev-ai/flair-mcp` ships six 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
92
|
|
|
91
93
|
| Hook | Claude Code event | What it does | Install |
|
|
92
94
|
|---|---|---|---|
|
|
93
95
|
| `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
96
|
| `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
97
|
| `flair-prompt-recall` | `UserPromptSubmit` | Searches memory with each prompt and adds the relevant memories as context before the model answers. | By hand, below |
|
|
98
|
+
| `flair-action-recall` | `PreToolUse` | Matches the pending Bash command against the agent's own triggered lessons and adds the matching ones as context on the next model request. | `flair hook install --action-recall` |
|
|
99
|
+
| `flair-capture` | `PostToolUseFailure`, `PostToolUse` and `Stop` | Stages candidates locally; a background flush attempts writes. | `flair hook install --capture` |
|
|
96
100
|
| `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
101
|
|
|
98
102
|
### Per-prompt recall (`flair-prompt-recall`)
|
|
@@ -144,6 +148,32 @@ The same `npx -y -p @tpsdev-ai/flair-mcp@<version> flair-prompt-recall` invocati
|
|
|
144
148
|
|
|
145
149
|
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.
|
|
146
150
|
|
|
151
|
+
### Action recall (`flair-action-recall`)
|
|
152
|
+
|
|
153
|
+
`flair hook install --action-recall` copies the version-matched hook and its runtime modules to `~/.flair/hooks/action-recall/<version>-<content hash>/` and probes that installed command. This Flair-owned directory survives npm cache eviction; uninstall removes it. Status probes a detected entry; absence is informational. If absent, run `npx -y -p @tpsdev-ai/flair-mcp@<CLI version> node --version` first, then `flair hook install --action-recall`. An incompatible SessionStart entry or held pin refuses installation.
|
|
154
|
+
|
|
155
|
+
**How it decides.** A lesson opts in through its JSON `metadata` field:
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{ "flairActionRecall": { "v": 1, "triggers": [ { "verb": "git", "subcommands": ["push"], "flags": ["--force"], "paths": [] } ] } }
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Write a new lesson with `client.memory.write(content, { type: "lesson", metadata: { flairActionRecall: { v: 1, triggers } } })`. For an existing lesson, `client.memory.update(id, content, { metadata: { flairActionRecall: { v: 1, triggers } } })` preserves other metadata keys.
|
|
162
|
+
|
|
163
|
+
`verb` is a literal executable basename; `subcommands` are an exact contiguous argv prefix after it; `flags` are required members; `paths` are optional operand-glob alternatives matched against the command's operands, normalized against the payload `cwd`. A trigger with none of the three is rejected. At most 4 triggers per lesson, 3 subcommands, 8 flags and 2 path globs per trigger, each string at most 128 bytes. Set `triggers: []` through `client.memory.update` to disable recall at the next refresh.
|
|
164
|
+
|
|
165
|
+
The hot path reads a per-session cache of the agent's own lessons under `~/.flair/action-recall/`, refreshed at session start through a signed, non-admin read. The cache expires five minutes after refresh starts, shortened by each lesson's valid expiry or end-of-validity timestamp. Between refreshes, a deletion, edit or supersession can stay visible until expiry.
|
|
166
|
+
|
|
167
|
+
**What it never does.** It emits only `hookSpecificOutput.additionalContext` — never a permission decision, a question, replacement input or blocking output. It never executes or echoes the submitted command. Caught read and input errors produce no context. Missing, corrupt, wrong-mode, oversized or stale caches do not match. The reader checks path components for symlinks before opening and uses `O_NOFOLLOW` on the final component. A command it cannot read as one simple argv command (expansions, substitutions, assignments, redirects, comments, pipelines, lists, heredocs, compound commands) is silently not matched. At most three lessons are shown, each quoted line bounded, the whole output at most 4 KiB; excerpts are redacted before they are cached and quoted when shown. The hook does not read or use credentials, signs nothing and makes no network call.
|
|
168
|
+
|
|
169
|
+
### Learning capture (`flair-capture`)
|
|
170
|
+
|
|
171
|
+
`flair hook install --capture` copies the version-matched hook and its runtime modules to `~/.flair/hooks/capture/<version>-<content hash>/` and probes that installed command. It wires three Claude Code events: `PostToolUseFailure` (matching `Bash`), `PostToolUse` (matching `Write|Edit|NotebookEdit|Bash`) and `Stop`.
|
|
172
|
+
|
|
173
|
+
The hook may stage a possible matching follow-up to a failed `Bash` call, or a cue-matching sentence from the turn's final text, in a bounded local spool under `~/.flair/capture/`. Network writes run in a detached flush. The foreground stdin deadline is 2 seconds; the default append-lock wait for Stop, PostToolUse and flush snapshot/rewrite operations is 200 ms. A failed-tool append waits up to 2 seconds for the lock and refuses if it remains busy. The installed command suppresses stdout, keeps stderr for lock-contention and pending-write warnings, and exits 0. The flush bounds its asynchronous setup and each write with one deadline; the 10 ms p95 hot-path budget in `scripts/capture-latency.mjs` is a manual measurement, not a CI gate.
|
|
174
|
+
|
|
175
|
+
Install probes the copied command; status probes artifact paths named in settings, without a directory restriction, and reports `partial` when only some of the three events are wired. Absence is informational: installing the hooks is the opt-in. If absent, run `npx -y -p @tpsdev-ai/flair-mcp@<CLI version> node --version` first, then `flair hook install --capture`.
|
|
176
|
+
|
|
147
177
|
## Multiple Projects
|
|
148
178
|
|
|
149
179
|
Create a separate agent per project:
|