wendkeep 0.87.0 → 0.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.en.md +3 -2
  3. package/README.md +3 -2
  4. package/bin/wendkeep.mjs +1 -0
  5. package/docs/en/commands/ecosystem-bridges.md +172 -0
  6. package/docs/en/commands/observer-security.md +154 -0
  7. package/docs/en/commands/observer.md +30 -12
  8. package/docs/en/commands/verify.md +6 -0
  9. package/docs/pt-BR/commands/ecosystem-bridges.md +169 -0
  10. package/docs/pt-BR/commands/observer-security.md +154 -0
  11. package/docs/pt-BR/commands/observer.md +30 -12
  12. package/docs/pt-BR/commands/verify.md +6 -0
  13. package/hooks/observer-publish.mjs +3 -1
  14. package/package.json +2 -1
  15. package/packages/cli/src/index.mjs +10 -1
  16. package/packages/harness/src/sensors-core.mjs +49 -3
  17. package/packages/integrations/src/bridge-config.mjs +139 -0
  18. package/packages/integrations/src/bridge-contract.mjs +316 -0
  19. package/packages/integrations/src/bridge-diagnostics.mjs +45 -0
  20. package/packages/integrations/src/canonical-bridge-authority.mjs +32 -0
  21. package/packages/integrations/src/capabilities.mjs +34 -0
  22. package/packages/integrations/src/ecosystem-bridge.mjs +82 -0
  23. package/packages/integrations/src/index.mjs +6 -0
  24. package/packages/integrations/src/spec-kit-adapter.mjs +259 -0
  25. package/packages/integrations/src/superpowers-adapter.mjs +269 -0
  26. package/packages/mcp/src/executor.mjs +35 -2
  27. package/packages/observer/package.json +16 -0
  28. package/packages/observer/src/audit.mjs +1 -0
  29. package/packages/observer/src/authz.mjs +38 -0
  30. package/packages/observer/src/encryption.mjs +75 -0
  31. package/packages/observer/src/index.mjs +7 -0
  32. package/packages/observer/src/policy.mjs +305 -0
  33. package/packages/observer/src/purge.mjs +100 -0
  34. package/packages/observer/src/redaction.mjs +54 -0
  35. package/packages/observer/src/retention.mjs +39 -0
  36. package/packages/observer/src/token-registry.mjs +122 -0
  37. package/schema/ecosystem-bridge-artifact-manifest-v1.schema.json +30 -0
  38. package/schema/ecosystem-bridge-v1.schema.json +65 -0
  39. package/schema/observer/006-observer-security.sql +64 -0
  40. package/schema/observer-policy-v1.schema.json +63 -0
  41. package/schema/sync-event-v1.schema.json +10 -0
  42. package/schema/wendkeep.evidence-envelope-v2.schema.json +39 -0
  43. package/schema/wendkeep.sensors.schema.json +14 -0
  44. package/src/doctor.mjs +6 -1
  45. package/src/ecosystem-bridge-artifact-collector.mjs +111 -0
  46. package/src/ecosystem-bridge-baseline.mjs +58 -0
  47. package/src/ecosystem-bridge-proof.mjs +97 -0
  48. package/src/ecosystem-bridges.mjs +227 -0
  49. package/src/evidence-envelope.mjs +2 -0
  50. package/src/observer-auth.mjs +8 -0
  51. package/src/observer-privacy.mjs +7 -3
  52. package/src/observer-publish.mjs +31 -0
  53. package/src/observer-server.mjs +179 -20
  54. package/src/observer-sql-migrate.mjs +5 -2
  55. package/src/observer-sql-publish.mjs +114 -39
  56. package/src/observer-sql-store.mjs +299 -45
  57. package/src/observer-transcript-store.mjs +23 -8
  58. package/src/observer.mjs +145 -12
  59. package/src/sync-protocol.mjs +20 -0
  60. package/src/task-contracts.mjs +19 -0
  61. package/src/task.mjs +82 -0
  62. package/src/verify.mjs +9 -0
  63. package/web/observer/app.mjs +107 -31
  64. package/web/observer/index.html +7 -0
  65. package/web/observer/styles.css +5 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,41 @@ All notable changes to **wendkeep** are documented here. Format based on
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this project follows
5
5
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.89.0] — 2026-08-30
8
+
9
+ ### Added
10
+
11
+ - **Bridges opcionais oficiais para Spec Kit e Superpowers.** Projeções read-only preservam IDs,
12
+ hashes e ownership canônico do WendKeep; adapters são habilitados separadamente, validam
13
+ versões compatíveis e degradam com diagnósticos tipados sem afetar o Core nativo.
14
+ - **Prova externa vinculada ao Git e ao CI.** Dispatch deriva somente de contratos canônicos e
15
+ artifacts externos permanecem `reported` até que manifest, blob, task, sensor e Evidence
16
+ Envelope coincidam com o checkout versionado.
17
+
18
+ ### Security
19
+
20
+ - **Autoridade única e drift fail-closed.** Ownership concorrente, projeção stale, hashes/paths
21
+ divergentes, claims fabricados e promoção autoafirmada para `verified` bloqueiam import,
22
+ dispatch e verify antes de qualquer execução externa.
23
+
24
+ ## [0.88.0] — 2026-08-29
25
+
26
+ ### Added
27
+
28
+ - **Políticas oficiais e RBAC do Observer por projeto.** Captura de transcripts, uso, memória e
29
+ sync passa por policy única, redaction por classe/campo e matriz explícita de papéis e scopes;
30
+ tokens são armazenados somente por hash, escopados, expirados, revogáveis e rotacionáveis.
31
+ - **Ciclo de vida auditável.** Retenção e purge idempotentes ficam disponíveis por CLI e endpoint,
32
+ com receipts retriáveis, tratamento de chegadas tardias e reconciliação segura do índice FTS.
33
+
34
+ ### Security
35
+
36
+ - **Criptografia fail-closed no Observer.** Quando exigida, ingestão, outbox e publicação recusam
37
+ plaintext; o backfill protege dados legados antes de leituras, e backups de migração v5 usam
38
+ AES-256-GCM, manifest de integridade, permissões restritas e restore autenticado.
39
+ - **Bootstrap remoto sem credencial irrestrita.** Server, MCP, CLI e Compose usam o registry
40
+ hash-only com projeto, papel, scopes e expiração explícitos, incluindo revogação e rotação.
41
+
7
42
  ## [0.87.0] — 2026-08-29
8
43
 
9
44
  ### Added
package/README.en.md CHANGED
@@ -253,6 +253,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
253
253
  | **Native MCP** | semantic tools, effects/capabilities, stdio, schemas, pagination, budgets, audit, and client configuration | [Native MCP](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/mcp.md) |
254
254
  | **Evidence recall and embeddings** | cursor/byte budgets, bounded lexical/FTS sidecars, and an optional local plugin contract that is off by default | [Optional embedding plugin](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/evidence-embeddings.md) |
255
255
  | **Host capabilities** | versioned lifecycle/effect matrix, degraded mode, human waivers, and evidence/Observer coverage | [Host capabilities](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/capabilities.md) |
256
+ | **Ecosystem bridges** | optional Spec Kit/Superpowers adapters, canonical baseline, single ownership, drift, and Git/CI/Envelope proof with an index/worktree-identical manifest | [Ecosystem bridges](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/ecosystem-bridges.md) |
256
257
  | **Operating profiles** | `profile`, `flow`, always-on Keep Core, and Wend Runtime governance | [Operating profiles](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/operating-profiles.md) |
257
258
  | **Changes and verification** | `change`, specs, sensors, TDD, evidence, Task Contracts, and archive | [Changes and verification](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/changes-and-verification.md) |
258
259
  | **Shared memory** | CORE, SHARED, status, validation, repair, and curation | [Memory](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/memory.md) |
@@ -261,7 +262,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
261
262
  | **Costs and observability** | safe dry-run, tri-state, aggregation, trends, and historical rebuild | [Costs and observability](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/costs-and-observability.md) |
262
263
  | **Maintenance and diagnostics** | doctor, frontier/manifest freshness, drift, version, and help | [Maintenance and diagnostics](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/maintenance-and-diagnostics.md) |
263
264
  | **Evidence-based commits** | `wendkeep commit`, tasks derived from contracts, tests only from canonical execution bound to the exact SHA, opt-in Git hooks, privacy, and remote range gate | [Commits](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/commit.md) |
264
- | **Local Observer** | `observer serve`, registration, incremental publication, `reconcile`, outbox, and multi-project index | [Local Observer](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/observer.md) |
265
+ | **Local Observer** | `observer serve`, scoped/expiring hash-only bootstrap, incremental publishing with canonical timestamps, `reconcile`, policy, stable structural identities, content-bound hashes, deletion-safe capture, required encryption, retention, purge, and multi-project index | [Local Observer](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/observer.md) · [Security](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/observer-security.md) |
265
266
 
266
267
  Operations that deserve step-by-step guidance: [verify and exits 0/1/2](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/verify.md),
267
268
  [causal TDD attestation](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/tdd.md),
@@ -570,7 +571,7 @@ explore → propose → apply (TDD) → verify → archive
570
571
 
571
572
  - **Propose** — `wendkeep change new <slug>` scaffolds `08-Mudanças/<slug>/` (`proposta.md`, `design.md`, `tarefas.md`; `--simple` skips the design). `--guide` creates the compact GUIDE contract and omits automatic design/spec/ADR when `contract_impact:none`. It becomes the global *current* change. When the change declares `spec_impact: required`, you author the delta yourself at `specs/<capability>/spec.md` — there is no placeholder to delete. Multiple changes may remain open: `change list`/`status` and the hooks show every pending one, while commands without `--change` act on the current one alone. `change use <slug>` changes focus and `change continue <archived> <new>` creates an auditable continuation.
572
573
  - **Apply** — implement each `tarefas.md` task. Mark machine proof with one or more `[sensor:<id>]` tags on the same task: every distinct ID enters the gate once, in declaration order. Also mark satisfied requirements with one or more `[req:<ID>]` tags. For causal TDD, add `[tdd]` and record `wendkeep tdd red|green`; the [TDD attestation guide](docs/en/commands/tdd.md) covers profiles, waivers, and exit codes.
573
- - **Verify** — `wendkeep verify` runs declared sensors and writes an **Evidence Envelope v2** to `evidencia.json`, SHA-256-bound to project/repository/worktree/session, HEAD, index tree, normalized worktree digest, tasks, effective spec, TDD attestations, and sensor configuration. Each sensor records a sanitized command, execution window, duration, exit code, output digest, and a sanitized tail bounded to 2,000 characters. If HEAD changes during the run, no new envelope is published. `change status` reports `bound`, `stale`, `context-mismatch`, or `legacy-unbound`; v1 evidence remains readable but cannot satisfy v2 authority. The public schema is [`schema/wendkeep.evidence-envelope-v2.schema.json`](schema/wendkeep.evidence-envelope-v2.schema.json). `verify --deep` binds the package, attestations, and verdict to the current `envelope_id`.
574
+ - **Verify** — `wendkeep verify` runs declared sensors and writes an **Evidence Envelope v2** to `evidencia.json`, SHA-256-bound to project/repository/worktree/session, HEAD, index tree, normalized worktree digest, tasks, effective spec, TDD attestations, and sensor configuration. Each sensor records a sanitized command, execution window, duration, exit code, output digest, and a sanitized tail bounded to 2,000 characters; `artifact_results` binds explicit digests for versioned files without using stdout as proof. If HEAD changes during the run, no new envelope is published. `change status` reports `bound`, `stale`, `context-mismatch`, or `legacy-unbound`; v1 evidence remains readable but cannot satisfy v2 authority. The public schema is [`schema/wendkeep.evidence-envelope-v2.schema.json`](schema/wendkeep.evidence-envelope-v2.schema.json). `verify --deep` binds the package, attestations, and verdict to the current `envelope_id`.
574
575
  - **Archive** — `wendkeep change archive <slug>` **gates** on the evidence (blocks unless every declared critical sensor is green), promotes each applicable spec delta (`ADDED`/`MODIFIED`/`REMOVED`) into the living `07-Specs/<capability>.md` and moves the change to `_arquivo/`. GOVERN/ASSURE mint an ADR in `04-Decisões/`; compact GUIDE with no contract impact does not mint one automatically.
575
576
 
576
577
  > The gate blocks unless the scaffold is filled, no task is open, evidence is fresh, and every declared requirement is covered. **`--force` waives exactly one of those — the open-task check — and is the human's call, never the agent's.** An unfilled scaffold, a red critical sensor, stale evidence, an orphan requirement or a missing verdict block regardless.
package/README.md CHANGED
@@ -253,6 +253,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
253
253
  | **Native MCP** | semantic tools, effects/capabilities, stdio, schemas, pagination, budgets, audit, and client configuration | [Native MCP](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/mcp.md) |
254
254
  | **Evidence recall and embeddings** | cursor/byte budgets, bounded lexical/FTS sidecars, and an optional local plugin contract that is off by default | [Optional embedding plugin](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/evidence-embeddings.md) |
255
255
  | **Host capabilities** | versioned lifecycle/effect matrix, degraded mode, human waivers, and evidence/Observer coverage | [Host capabilities](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/capabilities.md) |
256
+ | **Ecosystem bridges** | optional Spec Kit/Superpowers adapters, canonical baseline, single ownership, drift, and Git/CI/Envelope proof with an index/worktree-identical manifest | [Ecosystem bridges](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/ecosystem-bridges.md) |
256
257
  | **Operating profiles** | `profile`, `flow`, always-on Keep Core, and Wend Runtime governance | [Operating profiles](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/operating-profiles.md) |
257
258
  | **Changes and verification** | `change`, specs, sensors, TDD, evidence, Task Contracts, and archive | [Changes and verification](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/changes-and-verification.md) |
258
259
  | **Shared memory** | CORE, SHARED, status, validation, repair, and curation | [Memory](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/memory.md) |
@@ -261,7 +262,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
261
262
  | **Costs and observability** | safe dry-run, tri-state, aggregation, trends, and historical rebuild | [Costs and observability](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/costs-and-observability.md) |
262
263
  | **Maintenance and diagnostics** | doctor, frontier/manifest freshness, drift, version, and help | [Maintenance and diagnostics](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/maintenance-and-diagnostics.md) |
263
264
  | **Evidence-based commits** | `wendkeep commit`, tasks derived from contracts, tests only from canonical execution bound to the exact SHA, opt-in Git hooks, privacy, and remote range gate | [Commits](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/commit.md) |
264
- | **Local Observer** | `observer serve`, registration, incremental publication, `reconcile`, outbox, and multi-project index | [Local Observer](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/observer.md) |
265
+ | **Local Observer** | `observer serve`, scoped/expiring hash-only bootstrap, incremental publishing with canonical timestamps, `reconcile`, policy, stable structural identities, content-bound hashes, deletion-safe capture, required encryption, retention, purge, and multi-project index | [Local Observer](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/observer.md) · [Security](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/observer-security.md) |
265
266
 
266
267
  Operations that deserve step-by-step guidance: [verify and exits 0/1/2](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/verify.md),
267
268
  [causal TDD attestation](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/tdd.md),
@@ -570,7 +571,7 @@ explore → propose → apply (TDD) → verify → archive
570
571
 
571
572
  - **Propose** — `wendkeep change new <slug>` scaffolds `08-Mudanças/<slug>/` (`proposta.md`, `design.md`, `tarefas.md`; `--simple` skips the design). `--guide` creates the compact GUIDE contract and omits automatic design/spec/ADR when `contract_impact:none`. It becomes the global *current* change. When the change declares `spec_impact: required`, you author the delta yourself at `specs/<capability>/spec.md` — there is no placeholder to delete. Multiple changes may remain open: `change list`/`status` and the hooks show every pending one, while commands without `--change` act on the current one alone. `change use <slug>` changes focus and `change continue <archived> <new>` creates an auditable continuation.
572
573
  - **Apply** — implement each `tarefas.md` task. Mark machine proof with one or more `[sensor:<id>]` tags on the same task: every distinct ID enters the gate once, in declaration order. Also mark satisfied requirements with one or more `[req:<ID>]` tags. For causal TDD, add `[tdd]` and record `wendkeep tdd red|green`; the [TDD attestation guide](docs/en/commands/tdd.md) covers profiles, waivers, and exit codes.
573
- - **Verify** — `wendkeep verify` runs declared sensors and writes an **Evidence Envelope v2** to `evidencia.json`, SHA-256-bound to project/repository/worktree/session, HEAD, index tree, normalized worktree digest, tasks, effective spec, TDD attestations, and sensor configuration. Each sensor records a sanitized command, execution window, duration, exit code, output digest, and a sanitized tail bounded to 2,000 characters. If HEAD changes during the run, no new envelope is published. `change status` reports `bound`, `stale`, `context-mismatch`, or `legacy-unbound`; v1 evidence remains readable but cannot satisfy v2 authority. The public schema is [`schema/wendkeep.evidence-envelope-v2.schema.json`](schema/wendkeep.evidence-envelope-v2.schema.json). `verify --deep` binds the package, attestations, and verdict to the current `envelope_id`.
574
+ - **Verify** — `wendkeep verify` runs declared sensors and writes an **Evidence Envelope v2** to `evidencia.json`, SHA-256-bound to project/repository/worktree/session, HEAD, index tree, normalized worktree digest, tasks, effective spec, TDD attestations, and sensor configuration. Each sensor records a sanitized command, execution window, duration, exit code, output digest, and a sanitized tail bounded to 2,000 characters; `artifact_results` binds explicit digests for versioned files without using stdout as proof. If HEAD changes during the run, no new envelope is published. `change status` reports `bound`, `stale`, `context-mismatch`, or `legacy-unbound`; v1 evidence remains readable but cannot satisfy v2 authority. The public schema is [`schema/wendkeep.evidence-envelope-v2.schema.json`](schema/wendkeep.evidence-envelope-v2.schema.json). `verify --deep` binds the package, attestations, and verdict to the current `envelope_id`.
574
575
  - **Archive** — `wendkeep change archive <slug>` **gates** on the evidence (blocks unless every declared critical sensor is green), promotes each applicable spec delta (`ADDED`/`MODIFIED`/`REMOVED`) into the living `07-Specs/<capability>.md` and moves the change to `_arquivo/`. GOVERN/ASSURE mint an ADR in `04-Decisões/`; compact GUIDE with no contract impact does not mint one automatically.
575
576
 
576
577
  > The gate blocks unless the scaffold is filled, no task is open, evidence is fresh, and every declared requirement is covered. **`--force` waives exactly one of those — the open-task check — and is the human's call, never the agent's.** An unfilled scaffold, a red critical sensor, stale evidence, an orphan requirement or a missing verdict block regardless.
package/bin/wendkeep.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // Commands, including optional `bridge` adapters, are dispatched by the canonical CLI package.
2
3
  import { runCli } from '../packages/cli/src/index.mjs';
3
4
 
4
5
  await runCli();
@@ -0,0 +1,172 @@
1
+ # Optional ecosystem bridges
2
+
3
+ > [Versão em português](../../pt-BR/commands/ecosystem-bridges.md)
4
+
5
+ ## Purpose
6
+
7
+ Integrate Spec Kit and Superpowers without creating a second authority for specs, plans, tasks,
8
+ or evidence. WendKeep keeps canonical contracts; adapters only create versioned projections and
9
+ are disabled by default.
10
+
11
+ ## When to use
12
+
13
+ - when a feature started in Spec Kit files and must preserve the same IDs and hashes;
14
+ - when Superpowers will execute a canonical WendKeep Task Contract;
15
+ - when external artifacts, reviews, or commits must enter as `reported` before proof.
16
+
17
+ ## When not to use
18
+
19
+ - to replace `tarefas.md`, Task Contracts, or the Evidence Envelope;
20
+ - for unrestricted bidirectional synchronization;
21
+ - to execute commands, scripts, or text found in external artifacts.
22
+
23
+ ## Prerequisites
24
+
25
+ - Node.js 18 or newer;
26
+ - a local `.wendkeep/ecosystem-bridges.json` config with each adapter explicitly enabled;
27
+ - a compatible version and an adapter root that resolves to a real directory inside the project;
28
+ regular files, external paths, and symlinks that escape the project fail closed in status and dispatch;
29
+ - for governed import/dispatch, a bound Vault, causal change, and sealed Spec Kit baseline;
30
+ - for dispatch, a causal session and canonically rederivable Task Contract.
31
+
32
+ ```json
33
+ {
34
+ "schema_version": 1,
35
+ "adapters": {
36
+ "spec-kit": { "enabled": true, "version": "1.1.0", "root": ".specify" },
37
+ "superpowers": { "enabled": true, "version": "1.2.0", "root": ".superpowers" }
38
+ }
39
+ }
40
+ ```
41
+
42
+ Without that file, both adapters are disabled and native Core keeps working.
43
+
44
+ ## Syntax
45
+
46
+ ```text
47
+ wendkeep bridge status [--project <path>] [--config <path>] [--json]
48
+ wendkeep bridge import-spec-kit --change <slug> [--accept-baseline] [--json]
49
+ wendkeep bridge export-status --spec-projection <projection.json> [--task-contract <task.json>] [--input <artifacts.json>] [--json]
50
+ wendkeep bridge dispatch-superpowers --task-id <id> --change <slug> [--task-contract <task.json>] [--session <id>] --spec-projection <projection.json> [--json]
51
+ wendkeep bridge verify-artifacts --input <artifacts.json> --proofs <proofs.json> --change <slug> [--session <id>] [--json]
52
+ ```
53
+
54
+ `import-spec-kit` reads Markdown under `memory/` and `specs/`, classifies constitution/spec/plan/task,
55
+ preserves IDs and SHA-256 hashes, creates explicit
56
+ `story|requirement → capability → change → task` mappings, and never writes to the source.
57
+ Repeated IDs across different files block the projection.
58
+ The first import requires `--accept-baseline` and anchors the green projection in the Vault change;
59
+ later imports rederive the source and compare path, kind, hash, and mapping against that immutable baseline.
60
+ `dispatch-superpowers` contains only minimal
61
+ structural context derived from the Task Contract; transcripts, private content, and external
62
+ ownership are excluded.
63
+ Dispatch rederives the contract and active context from the Vault/checkout; submitted JSON is only
64
+ a comparison copy and never validates its own `binding`.
65
+ With Spec Kit active, the baseline and `--spec-projection` are mandatory and the source is
66
+ reimported before dispatch.
67
+ The `spec-projection` contract belongs exclusively to the `spec-kit` adapter: an incompatible
68
+ version, out-of-schema kind, or projection resealed by another adapter is rejected before producing `spec_refs`.
69
+ An `ok: false` decision requires at least one blocking diagnostic, while `ok: true` cannot coexist
70
+ with a blocking diagnostic; any inconsistency blocks dispatch without exposing references.
71
+ `export-status` recomputes and validates `projection_id`, returns a `reported` projection only, and
72
+ does not write to Spec Kit files.
73
+
74
+ ## Options and exit codes
75
+
76
+ | Option | Effect |
77
+ |---|---|
78
+ | `--project <path>` | Selects the consumer root. |
79
+ | `--config <path>` | Overrides `.wendkeep/ecosystem-bridges.json`. |
80
+ | `--change <slug>` | Selects the change holding canonical baseline and Evidence Envelope. |
81
+ | `--accept-baseline` | Anchors only the first green Spec Kit baseline; never overwrites drift. |
82
+ | `--task-id <id>` | Selects the causal task and rederives its canonical contract. |
83
+ | `--task-contract <path>` | Optional copy that must match the rederived contract. |
84
+ | `--spec-projection <path>` | Links Spec Kit refs to dispatch without copying content. |
85
+ | `--input` / `--proofs` | Classifies external artifacts and their Git/CI/Envelope proofs. |
86
+ | `--json` | Emits the typed contract as one JSON line. |
87
+
88
+ - `0`: valid operation; optional disabled adapters are healthy too;
89
+ - `1`: enabled adapter blocked, drift, incompatibility, or missing proof;
90
+ - `2`: invalid argument, configuration, or input file.
91
+
92
+ ## Examples
93
+
94
+ Small flow without adapters:
95
+
96
+ ```powershell
97
+ node ./bin/wendkeep.mjs bridge status --json
98
+ ```
99
+
100
+ Medium read-only Spec Kit flow:
101
+
102
+ ```powershell
103
+ node ./bin/wendkeep.mjs bridge import-spec-kit --change ecosystem-bridges --accept-baseline --json > spec-projection.json
104
+ node ./bin/wendkeep.mjs bridge dispatch-superpowers --task-id 3.1 --change ecosystem-bridges --session "$env:CODEX_THREAD_ID" --spec-projection spec-projection.json --json
105
+ node ./bin/wendkeep.mjs bridge export-status --spec-projection spec-projection.json --task-contract task-contract.json --json
106
+ ```
107
+
108
+ Large flow with external report and proof ingestion:
109
+
110
+ ```powershell
111
+ node ./bin/wendkeep.mjs verify --change ecosystem-bridges
112
+ node ./bin/wendkeep.mjs bridge verify-artifacts --input artifacts.json --proofs ci-proofs.json --change ecosystem-bridges --json
113
+ ```
114
+
115
+ Before `verify`, commit the artifact and `.wendkeep/bridge-artifacts.json` to the Git index. The v1
116
+ manifest binds each item to `source`, `external_id`, `kind`, `path`, `sensor_id`, and `task_id`. The
117
+ matching sensor in `wendkeep.sensors.json` declares v1 `artifact_results` with `external_id`, `path`,
118
+ and `algorithm: sha256`; the runner computes the byte digest, including binary files, only after a
119
+ green run. This explicit result contains no artifact content, transcript, or artifact output tail.
120
+ The collector checks the index first and then requires the identical copy to exist in the worktree;
121
+ deleting or changing only the working copy fails closed, while absence from both index and worktree
122
+ still means that the optional bridge declared no artifacts.
123
+
124
+ Each `ci-proofs.json` reference contains only
125
+ `{"type":"evidence-envelope","external_id":"review-1"}`. Path, task, sensor, digests, and Git
126
+ blobs are rederived from the canonical manifest and Envelope; self-declared state, SHA, or authority
127
+ are ignored for promotion. `artifacts.json` remains only the external report to compare.
128
+
129
+ An artifact starts as `reported`. External JSON that merely declares `state: verified` remains
130
+ `reported`. Promotion to `verified` jointly requires a project-contained file equal to its Git
131
+ index blob, a green CI sensor with an explicit `artifact_results.digest`, a canonical Evidence
132
+ Envelope v2 bound to the checkout, and a matching Envelope `external_artifacts` entry.
133
+ `output_sha256` does not prove artifacts. The result
134
+ exposes a sealed proof bound to `evidence_envelope_id` without copying transcript or Vault content.
135
+
136
+ ## Expected result
137
+
138
+ - Spec Kit remains a read-only external source;
139
+ - canonical plan, task, and evidence remain owned by WendKeep;
140
+ - Superpowers receives minimal dispatch without permission to rewrite scope;
141
+ - worktree creation/reuse and finishing remain delegated to the `wendkeep worktree` argv derived in dispatch;
142
+ - post-merge cleanup uses `wendkeep worktree finish <slug> --pr <number-or-url>`;
143
+ - drift and competing ownership block before execution;
144
+ - removing or disabling an adapter does not degrade Core.
145
+
146
+ ## Common errors and diagnosis
147
+
148
+ | Code | Diagnosis |
149
+ |---|---|
150
+ | `BRIDGE_ADAPTER_DISABLED` | Normal optional state; enable explicitly when needed. |
151
+ | `BRIDGE_ADAPTER_MISSING` | Adapter is enabled, but its root is absent. |
152
+ | `BRIDGE_VERSION_INCOMPATIBLE` | Version falls outside the published compatibility range. |
153
+ | `BRIDGE_OWNERSHIP_CONFLICT` | External tool tried to own plan/task/evidence. |
154
+ | `BRIDGE_SOURCE_DRIFT` | Hash changed, a plan became stale, or a reference appeared/disappeared. |
155
+ | `BRIDGE_SOURCE_ID_DUPLICATE` | The same story/requirement ID appears in different files. |
156
+ | `BRIDGE_BASELINE_MISSING` | Spec Kit is active without canonical baseline or required projection. |
157
+ | `BRIDGE_BASELINE_STALE` | Source/projection diverged from the sealed Vault baseline. |
158
+ | `BRIDGE_PROJECTION_INVALID` | Content and `projection_id` differ or schema fields are incomplete. |
159
+ | `BRIDGE_SCHEMA_INVALID` | Runtime envelope does not satisfy the published contract. |
160
+ | `BRIDGE_ARTIFACT_MANIFEST_UNTRACKED` | Bridge manifest exists on only one side or differs between index and worktree. |
161
+ | `BRIDGE_ARTIFACT_FORGED` | Artifact path/bytes do not match the versioned file. |
162
+ | `BRIDGE_ARTIFACT_RESULT_MISSING` | A green sensor did not produce the explicit digest bound by the manifest. |
163
+ | `BRIDGE_PROOF_MISSING` | External report has no bound independent proof yet. |
164
+ | `BRIDGE_PROOF_UNVERIFIED` | Self-declared proof was retained as `reported`. |
165
+
166
+ `wendkeep doctor` renders a `[bridges]` section without importing, dispatching, or writing.
167
+
168
+ ## Next steps
169
+
170
+ Review the projection before dispatch, keep generated files outside canonical control, and verify
171
+ artifacts through CI or an Evidence Envelope. See [Changes and verification](changes-and-verification.md)
172
+ and [Managed worktrees](worktrees.md) as well.
@@ -0,0 +1,154 @@
1
+ # Observer security
2
+
3
+ **English** · [Português](../../pt-BR/commands/observer-security.md)
4
+
5
+ ## Purpose
6
+
7
+ The Observer is a local/team read model, never a new authority over the Vault, specs, memory, or
8
+ sync. Its threat model assumes a compromised remote host, stolen token, curious operator, copied
9
+ database/outbox, adversarial payload, and interrupted purge. Host/Origin validation remains active;
10
+ mutations and sensitive reads fail closed, including on loopback.
11
+
12
+ | Class | Default | Primary risk |
13
+ |---|---|---|
14
+ | document | `metadata` | full memory/decisions |
15
+ | transcript | `metadata` | conversation and tools |
16
+ | prompt/response | `redacted` | PII and secrets |
17
+ | usage | `aggregate` | cost and operational identity |
18
+ | audit/receipt | minimal metadata | deleting the proof itself |
19
+
20
+ Policy v1 restricts by class, `project_id`, path glob, and `entity_type`. Later rules win only in
21
+ the matching project. Redaction covers Bearer values, URL/connection-string credentials, access
22
+ keys, email, phone, and safe configurable regular expressions. Its schema is
23
+ `schema/observer-policy-v1.schema.json`.
24
+ With `transcript_capture: messages`, arrays, JSONL, and the canonical `{messages:[...]}` envelope
25
+ retain only `user|assistant|system` messages with string `role`/`content` after redaction; extra
26
+ fields, tool records, and malformed entries are dropped or fail closed.
27
+ Explicit policy is the publisher's sole capture authority; `WENDKEEP_OBSERVER_CAPTURE_LEVEL` is
28
+ only translated into policy for legacy callers that supplied no policy file, and can never elevate
29
+ or suppress explicit `none|metadata|messages|full` or `selected` documents.
30
+ For document/transcript upserts, `content_hash` always binds the final content after capture and
31
+ redaction; metadata/selected capture uses the SHA-256 of empty content. Document deletions remain
32
+ effective even when content capture is `none`, preserve their path/revision/operation metadata,
33
+ and never carry stale content or content hashes.
34
+ Redaction never rewrites validated structural identity fields such as project/event/entity IDs,
35
+ logical paths, revisions, or operations. Path privacy is enforced fail-closed by project/path
36
+ capture rules; it is not implemented by renaming a storage key through a content-redaction rule.
37
+ The per-event structural contract also preserves accepted snake/camel aliases, document/session/
38
+ agent/call/transcript/rollup keys, timestamps, roles, status, coverage, model/pricing dimensions,
39
+ workflow, and source provenance. `title`, `summary`, `agent_name`, content, prompt/response, and
40
+ metadata remain redactable display/content fields.
41
+ During incremental publishing, missing or blank turn timestamps inherit the batch's canonical
42
+ instant, numeric epoch milliseconds are normalized to ISO 8601, and invalid non-empty values fail
43
+ closed before policy/store; the event and payload use the same instant.
44
+
45
+ ## When to use
46
+
47
+ Use it before enabling Observer for real data, registering or revoking credentials, restricting
48
+ capture, protecting SQLite/outbox, defining retention, or deleting data with verifiable proof.
49
+
50
+ ## When not to use
51
+
52
+ Do not use it as a corporate KMS/secret manager, to publish Vault/runtime data, to replace local
53
+ authority, or to delete tables and indexes manually. `full` capture remains opt-in and subject to
54
+ policy/redaction.
55
+
56
+ ## Prerequisites
57
+
58
+ Use Node.js 22.13+, keep the bind on loopback, and inject tokens/keys only through environment
59
+ variables. The bootstrap token is registered hash-only with explicit projects and a finite expiry;
60
+ it is not a registry-bypassing wildcard admin. For Docker, also set
61
+ `WENDKEEP_OBSERVER_BOOTSTRAP_PROJECTS`, `WENDKEEP_OBSERVER_BOOTSTRAP_EXPIRES_AT`, and a 32-byte
62
+ hex/base64 `WENDKEEP_OBSERVER_ENCRYPTION_KEY`. The operator owns the key and external receipts.
63
+
64
+ ## Syntax
65
+
66
+ ```bash
67
+ npx wendkeep observer serve --token <token> --bootstrap-projects <p1,p2> --bootstrap-expires-at <ISO> [--bootstrap-token-id <id>] [--require-loopback-auth] [--require-encryption]
68
+ npx wendkeep observer security token create --project-id <project> --role <role> --scopes <scopes> --token-env <env> --expires-at <ISO>
69
+ npx wendkeep observer security token rotate --project-id <project> --token-id <id> --token-env <env> --expires-at <ISO> [--new-token-id <id>]
70
+ npx wendkeep observer security token revoke --project-id <project> --token-id <id>
71
+ npx wendkeep observer security policy set --project-id <project> --file <policy.json>
72
+ npx wendkeep observer security policy show --project-id <project>
73
+ npx wendkeep observer security purge --project-id <project> --before <ISO> --classes <classes> [--dry-run]
74
+ npx wendkeep observer security retention run --project-id <project> [--dry-run] [--operation-id <id>]
75
+ ```
76
+
77
+ ## Options and exit codes
78
+
79
+ - `viewer` reads metadata/aggregates; `auditor` may receive sensitive scopes; `publisher` ingests;
80
+ `admin` manages policy, purge, and recovery. Role, scope, and project must authorize together.
81
+ - Tokens persist only as SHA-256; expiry, rotation, and revocation take effect without restart.
82
+ - After rotating bootstrap credentials, update both token and token ID in the environment; restart
83
+ never reactivates an expired or revoked predecessor.
84
+ - `--token-env` names the variable holding the secret; the command never prints its value.
85
+ - `--require-loopback-auth` protects the whole API; sensitive reads require a token without it too.
86
+ - `--require-encryption` fails when external key material is missing or invalid.
87
+ - `WENDKEEP_OBSERVER_REQUIRE_ENCRYPTION=1` applies the same fail-closed behavior to `status`,
88
+ `security`, `register`, `publish`, and `reconcile`; with a configured key, every first v5 upgrade
89
+ creates only `.bak.enc` plus its manifest before any read/backfill.
90
+ - Exit `0` means the operation completed; exit `1` means invalid configuration, authorization,
91
+ policy, key, or operation. The hook retains fail-open exit `0` for the local workflow, but aborts
92
+ before persisting unsafe content.
93
+
94
+ Audit stores capability, outcome, route, and time, never a Bearer value, prompt, response, or payload.
95
+
96
+ ## Examples
97
+
98
+ Explicit audited offline recovery:
99
+
100
+ ```powershell
101
+ $env:OBSERVER_RECOVERY_TOKEN = '<strong-temporary-secret>'
102
+ npx wendkeep observer security token create --data-dir C:\WendKeepObserver `
103
+ --project-id project-a --role admin --scopes '*' --token-env OBSERVER_RECOVERY_TOKEN `
104
+ --expires-at 2026-09-29T12:00:00Z --reason 'offline recovery' --json
105
+ npx wendkeep observer security token revoke --data-dir C:\WendKeepObserver `
106
+ --project-id project-a --token-id <id> --reason 'recovery complete' --json
107
+ ```
108
+
109
+ Always dry-run purge first. The retention runner is explicit and idempotent (CLI or
110
+ `POST /v1/projects/:id/security/retention`), with no hidden timer:
111
+
112
+ ```powershell
113
+ npx wendkeep observer security purge --data-dir C:\WendKeepObserver `
114
+ --project-id project-a --before 2026-08-01T00:00:00Z `
115
+ --classes documents,calls,transcripts --dry-run --json
116
+ ```
117
+
118
+ ```powershell
119
+ npx wendkeep observer security retention run --data-dir C:\WendKeepObserver `
120
+ --project-id project-a --operation-id scheduled-2026-08-29 --dry-run --json
121
+ ```
122
+
123
+ ## Expected result
124
+
125
+ TTL is independent for documents, calls, and transcripts. Counts, projection/FTS removal, events,
126
+ and receipt share one transaction; retry is idempotent and late old data creates new proof.
127
+
128
+ AES-256-GCM uses project/class/record/field AAD and an external `keyProvider`. The v6 backfill
129
+ removes plaintext and derived indexes before reads; a wrong key fails without disclosing content.
130
+ Structural migration `006-observer-security.sql` creates a backup, checks checksum, rolls back, and
131
+ supports retry. In required at-rest mode the backup is `.bak.enc`, carries a manifest/key ID and
132
+ restrictive permissions, fails restore with a wrong key, and leaves no plaintext `.bak` behind.
133
+
134
+ The hook applies metadata/redacted policy by default; `WENDKEEP_OBSERVER_POLICY_FILE` selects an
135
+ explicit policy. `WENDKEEP_OBSERVER_OUTBOX_KEY_ENV` names the outbox key variable and
136
+ `WENDKEEP_OBSERVER_OUTBOX_KEY_ID` identifies the key. Compose requires authentication and
137
+ encryption. The dashboard keeps Bearer only in memory, exports a sanitized copy, and exposes
138
+ Security. MCP requires scopes for calls/full search. Sync carries only `policy_ref`, without
139
+ duplicating tokens or authority.
140
+
141
+ ## Common errors and diagnosis
142
+
143
+ - `observer_token_missing|expired|revoked`: create/rotate a scoped token or use offline recovery.
144
+ - `observer_project_forbidden|role_forbidden|scope_forbidden`: check project/role/scope intersection.
145
+ - `observer_encryption_key_unavailable|observer_decryption_failed`: check key ID/material; never
146
+ weaken required mode.
147
+ - `observer_policy_invalid`: validate fields/captures and remove invalid or explosive regexes.
148
+ - v6 migration failure: preserve `.pre-006-*.bak.enc` and its manifest, correct the cause, and retry.
149
+
150
+ ## Next steps
151
+
152
+ Read [Local Observer](observer.md), dry-run retention, validate revoked/expired tokens, and keep the
153
+ receipt outside the database when external proof is required. Never publish the database, backup,
154
+ outbox, key, token, or `/data`.
@@ -26,7 +26,9 @@ WendKeep hooks.
26
26
 
27
27
  Use Node.js 22.13 or newer for the SQL Observer. Keep Core and the remaining commands continue to
28
28
  support Node.js 18 or newer. Explicitly register each project and set `WENDKEEP_OBSERVER_TOKEN`;
29
- loopback reads remain open, while every mutation requires a Bearer token.
29
+ every mutation and every sensitive-content read requires a Bearer token, including on loopback.
30
+ Metadata and aggregates may remain locally open when `--require-loopback-auth` is omitted. See
31
+ [Observer security](observer-security.md).
30
32
 
31
33
  ## Syntax
32
34
 
@@ -36,7 +38,7 @@ npx wendkeep observer register --project <project> --vault <vault> --data-dir <d
36
38
  npx wendkeep observer publish --project <project> --vault <vault> --data-dir <directory>
37
39
  npx wendkeep observer reconcile --project <project> --vault <vault> --data-dir <directory> [--url http://127.0.0.1:8787]
38
40
  npx wendkeep observer memory import --project <project> --vault <vault> --url http://127.0.0.1:8787 --token <token> --json
39
- npx wendkeep observer serve --host 127.0.0.1 --port 8787 --data-dir <directory> --token <token>
41
+ npx wendkeep observer serve --host 127.0.0.1 --port 8787 --data-dir <directory> --token <token> --bootstrap-projects <p1,p2> --bootstrap-expires-at <ISO> [--require-loopback-auth] [--require-encryption]
40
42
  ```
41
43
 
42
44
  ## Options and exit codes
@@ -46,7 +48,13 @@ npx wendkeep observer serve --host 127.0.0.1 --port 8787 --data-dir <directory>
46
48
  - `--project` and `--vault` identify a project for `register`, `publish`, `reconcile`, and `memory import`.
47
49
  - `--host` accepts only `127.0.0.1`, `localhost`, or `::1`; other hosts are rejected before
48
50
  listening.
49
- - `--token` or `WENDKEEP_OBSERVER_TOKEN` authenticates mutations; `--allow-non-loopback` fails without one.
51
+ - `--token` or `WENDKEEP_OBSERVER_TOKEN` supplies hash-only bootstrap material; explicit projects
52
+ and finite expiry are required, and all mutations/sensitive reads go through the registry;
53
+ `--allow-non-loopback` fails without one.
54
+ - `--require-loopback-auth` also requires Bearer for local metadata and aggregates and enables the
55
+ project's secure ingestion policy.
56
+ - `--require-encryption` requires a 32-byte hex/base64 `WENDKEEP_OBSERVER_ENCRYPTION_KEY`; use
57
+ `WENDKEEP_OBSERVER_ENCRYPTION_KEY_ID` to identify the external key.
50
58
  - `WENDKEEP_OBSERVER_CAPTURE_LEVEL` accepts `metadata` (default, no messages), `messages`, or
51
59
  `full-transcript`. Absolute local paths are never published.
52
60
  - Exit `0` means success; exit `1` means configuration or operation failure; the publisher hook
@@ -57,7 +65,10 @@ npx wendkeep observer serve --host 127.0.0.1 --port 8787 --data-dir <directory>
57
65
  ```powershell
58
66
  npx wendkeep observer register --project C:\GitHub\WendKeep --vault C:\GitHub\WendKeep\.WendKeep-vault --data-dir C:\WendKeepObserver
59
67
  $env:WENDKEEP_OBSERVER_TOKEN = '<strong-local-token>'
60
- npx wendkeep observer serve --host 127.0.0.1 --port 8787 --data-dir C:\WendKeepObserver --token $env:WENDKEEP_OBSERVER_TOKEN
68
+ $env:WENDKEEP_OBSERVER_BOOTSTRAP_PROJECTS = 'project-a'
69
+ $env:WENDKEEP_OBSERVER_BOOTSTRAP_EXPIRES_AT = '2026-09-29T12:00:00Z'
70
+ $env:WENDKEEP_OBSERVER_ENCRYPTION_KEY = '<32-bytes-in-hex-or-base64>'
71
+ npx wendkeep observer serve --host 127.0.0.1 --port 8787 --data-dir C:\WendKeepObserver --token $env:WENDKEEP_OBSERVER_TOKEN --require-loopback-auth
61
72
  $env:WENDKEEP_OBSERVER_URL = 'http://127.0.0.1:8787'
62
73
  ```
63
74
 
@@ -67,15 +78,19 @@ For local Docker:
67
78
  docker compose -f docker/wendkeep-observer/compose.yaml up -d --build
68
79
  ```
69
80
 
81
+ Compose requires token, bootstrap allowlist/expiry, and key material; it starts with full
82
+ authentication and required encryption. An `encryption_required` policy refuses plaintext ingest/outbox.
83
+
70
84
  ## Local web dashboard
71
85
 
72
86
  With the server running, open [http://127.0.0.1:8787/](http://127.0.0.1:8787/) in a browser. The
73
- dashboard is served by the same process and opens directly for reads, without a form or token. Keep the port
74
- bound to the computer loopback; do not expose this address on a network interface.
87
+ dashboard is served by the same process. Enter the token in the local form: it remains only in page
88
+ memory, is sent as Bearer for queries, and is discarded on reload. Keep the port bound to the
89
+ computer loopback; do not expose this address on a network interface.
75
90
 
76
91
  The dashboard shows the multi-project list, version, health, latest session, active change, change
77
92
  count, and last capture time. Opening a project exposes Overview, Consumption, Sessions, Memory,
78
- Changes, and Sync screens. Consumption shows total cost, token categories, primary agents,
93
+ Changes, Sync, and Security screens. Consumption shows total cost, token categories, primary agents,
79
94
  subagents, providers, models, daily trend, historical coverage, and calls with prompt, response,
80
95
  and transcript content according to the selected capture level. Loading, empty, unavailable-server, conflict, no-pricing, and stale-data
81
96
  states are visible, with manual refresh and an automatic 15-second refresh.
@@ -160,18 +175,21 @@ complete, archive, repair, or promote state.
160
175
  - `POST /v1/projects/:project_id/ingest` — idempotent batches of documents, sessions, agents,
161
176
  rollups, calls, and transcripts.
162
177
  - `GET /v1/projects/:project_id/memory/tree` — document tree and metadata.
163
- - `GET /v1/projects/:project_id/memory/document?path=...` — complete Markdown content.
178
+ - `GET /v1/projects/:project_id/memory/document?path=...` — complete Markdown content; requires Bearer.
164
179
  - `GET /v1/projects/:project_id/memory/search?q=...` — ranked chunk search with matching passage
165
- and provenance; uses a lexical fallback when FTS5 is unavailable.
180
+ and provenance; uses a lexical fallback when FTS5 is unavailable and requires Bearer.
166
181
  - `GET /v1/projects/:project_id/sync` — mode, counts, conflicts, and latest event.
167
182
  - `PUT /v1/projects/:project_id/sync` — compatibility configuration; SQL remains authoritative.
168
- - `GET /v1/projects/:project_id/memory/export` — read-only export with complete content.
183
+ - `GET /v1/projects/:project_id/memory/export` — read-only export sanitized by default; requires Bearer.
169
184
  - `POST /v1/projects/:project_id/memory/events` — idempotent batch ingestion.
170
185
  - `GET /v1/projects/:project_id/usage/summary` — filterable totals by period, change, session,
171
186
  agent, provider, model, and role.
172
187
  - `GET /v1/projects/:project_id/usage/breakdown` — agent, subagent, and model hierarchy.
173
- - `GET /v1/projects/:project_id/usage/calls` — individual calls with prompt and response.
174
- - `GET /v1/projects/:project_id/transcripts/:transcript_id` — compressed transcript validated by hash.
188
+ - `GET /v1/projects/:project_id/usage/calls` — individual calls with prompt and response; requires Bearer.
189
+ - `GET /v1/projects/:project_id/transcripts/:transcript_id` — compressed transcript validated by hash; requires Bearer.
190
+ - `GET /v1/projects/:project_id/security` — policy, token counts, and sanitized audit; requires admin.
191
+ - `PUT /v1/projects/:project_id/security/policy` — updates the effective policy without restart; requires admin.
192
+ - `POST /v1/projects/:project_id/security/purge` — transactional dry-run/purge with receipt; requires admin.
175
193
 
176
194
  The `/v1` routes reject transported or expanded bodies above their limits and validate project,
177
195
  path, revision, hash, idempotency, and isolation before writing to SQLite. Use `memory/export` for
@@ -87,6 +87,12 @@ temporary in the same directory and an atomic rename. In deep mode, `verificacao
87
87
  `verdict.json` carry the same `evidenceEnvelopeId` and complete `evidenceBinding`; the independent
88
88
  reviewer must preserve both.
89
89
 
90
+ For bridge artifacts, `.wendkeep/bridge-artifacts.json` and every referenced file must be committed
91
+ and equal to the Git index. The sensor bound to the same task declares v1 `artifact_results` in
92
+ `wendkeep.sensors.json`; after GREEN, the runner computes SHA-256 directly from the bytes and records
93
+ the structured result on that sensor. `verify` crosses manifest, task, sensor, digest, and Git blobs
94
+ before populating `external_artifacts`; stdout, transcripts, and `output_tail` never prove the file.
95
+
90
96
  The envelope carries `tdd_attestations`, and `verificacao.json` carries `tddAttestations`. Under GOVERN, a task marked
91
97
  `[tdd]` requires a current GREEN or explicit waiver; under ASSURE this applies to testable
92
98
  behavior. A later refactor/commit or a surviving mutant invalidates GREEN in the Task Contract.