wendkeep 0.80.2 → 0.85.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 (75) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/README.en.md +28 -11
  3. package/README.md +28 -11
  4. package/docs/en/commands/capabilities.md +82 -0
  5. package/docs/en/commands/getting-started.md +3 -1
  6. package/docs/en/commands/mcp.md +99 -0
  7. package/docs/en/commands/portable.md +88 -0
  8. package/docs/en/commands/sync-protocol.md +58 -0
  9. package/docs/en/commands/tdd.md +96 -0
  10. package/docs/en/commands/verify.md +5 -0
  11. package/docs/pt-BR/commands/capabilities.md +82 -0
  12. package/docs/pt-BR/commands/getting-started.md +3 -2
  13. package/docs/pt-BR/commands/mcp.md +99 -0
  14. package/docs/pt-BR/commands/portable.md +87 -0
  15. package/docs/pt-BR/commands/sync-protocol.md +58 -0
  16. package/docs/pt-BR/commands/tdd.md +96 -0
  17. package/docs/pt-BR/commands/verify.md +5 -0
  18. package/hooks/active-context-store.mjs +2 -0
  19. package/hooks/change-core.mjs +5 -0
  20. package/hooks/project-scope.mjs +2 -1
  21. package/hooks/session-ensure.mjs +23 -7
  22. package/hooks/session-start.mjs +20 -5
  23. package/package.json +3 -3
  24. package/packages/cli/src/index.mjs +42 -2
  25. package/packages/harness/src/sensors-core.mjs +16 -3
  26. package/packages/integrations/src/capabilities.mjs +220 -0
  27. package/packages/integrations/src/index.mjs +1 -0
  28. package/packages/mcp/src/audit.mjs +49 -0
  29. package/packages/mcp/src/cli.mjs +78 -0
  30. package/packages/mcp/src/config.mjs +22 -1
  31. package/packages/mcp/src/effects.mjs +115 -0
  32. package/packages/mcp/src/executor.mjs +354 -0
  33. package/packages/mcp/src/index.mjs +7 -0
  34. package/packages/mcp/src/server.mjs +342 -0
  35. package/packages/mcp/src/stdio.mjs +38 -0
  36. package/packages/mcp/src/sync.mjs +56 -0
  37. package/packages/pi/package.json +2 -1
  38. package/packages/pi/src/index.mjs +29 -0
  39. package/schema/handoff-contract-v1.schema.json +4 -0
  40. package/schema/host-capability-manifest-v1.schema.json +46 -0
  41. package/schema/host-coverage-v1.schema.json +55 -0
  42. package/schema/mcp-effect-manifest-v1.schema.json +36 -0
  43. package/schema/mcp-tool-input-v1.schema.json +32 -0
  44. package/schema/mcp-tool-result-v1.schema.json +22 -0
  45. package/schema/portable-active-work-v1.schema.json +38 -0
  46. package/schema/portable-state-v1.schema.json +36 -0
  47. package/schema/sync-event-v1.schema.json +25 -0
  48. package/schema/sync-private-envelope-v1.schema.json +16 -0
  49. package/schema/sync-state-v1.schema.json +18 -0
  50. package/schema/task-contract-v1.schema.json +2 -0
  51. package/schema/tdd-attestation-v1.schema.json +39 -0
  52. package/schema/wendkeep.evidence-envelope-v2.schema.json +17 -0
  53. package/schema/wendkeep.sensors.schema.json +19 -0
  54. package/src/active-context-runtime.mjs +1 -0
  55. package/src/capabilities.mjs +50 -0
  56. package/src/doctor.mjs +28 -0
  57. package/src/evidence-envelope.mjs +12 -6
  58. package/src/host-capabilities.mjs +34 -0
  59. package/src/init.mjs +3 -3
  60. package/src/mcp.mjs +7 -0
  61. package/src/observer-snapshot.mjs +25 -0
  62. package/src/portable.mjs +558 -0
  63. package/src/skills-seed.mjs +26 -0
  64. package/src/sync-adapters.mjs +188 -0
  65. package/src/sync-outbox.mjs +155 -0
  66. package/src/sync-protocol-cli.mjs +277 -0
  67. package/src/sync-protocol.mjs +368 -0
  68. package/src/sync.mjs +8 -0
  69. package/src/task-contracts.mjs +67 -2
  70. package/src/task.mjs +5 -1
  71. package/src/tdd-attestation-store.mjs +98 -0
  72. package/src/tdd-attestation.mjs +254 -0
  73. package/src/tdd.mjs +198 -0
  74. package/src/vault-readme.mjs +4 -4
  75. package/src/verify.mjs +24 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,109 @@ 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.85.0] — 2026-08-25
8
+
9
+ ### Added
10
+
11
+ - **Matriz versionada de capacidades dos hosts.** Claude Code, Codex, Pi e MCP/CLI genérico
12
+ declaram as mesmas 17 capacidades de lifecycle/efeitos como `native`, `adapted`, `polled`,
13
+ `manual` ou `unavailable`; `wendkeep capabilities` inspeciona a cobertura sem exigir Vault e
14
+ versões/hosts desconhecidos entram em modo degradado explícito.
15
+ - **Pi adapter e efeitos MCP verificáveis.** O workspace Pi deixa de ser placeholder e normaliza
16
+ envelopes lifecycle sem importar adapters irmãos. Efeitos vêm do catálogo assinado, nunca do
17
+ nome da tool: reads conhecidos pulam o mutation gate, writes/destructive permanecem gated e
18
+ desconhecidos falham fechado.
19
+ - **Cobertura causal persistida.** Gaps são injetados no início e acompanham session registry,
20
+ active context, handoff, Evidence Envelope e Observer; estados manuais continuam apenas
21
+ `reported`, sem promoção indevida a prova verificada.
22
+
23
+ ### Changed
24
+
25
+ - **Gates de verify e ASSURE conscientes do host.** Projetos podem declarar
26
+ `requires_host_capabilities` no `wendkeep.sensors.json`; capacidades manuais/indisponíveis
27
+ bloqueiam `verify` e handoff ASSURE salvo waiver humano explícito com aprovador e motivo.
28
+ - **Contrato e documentação pública bilíngue.** Novos schemas de manifest/cobertura, campos
29
+ opcionais de handoff/evidência, README e guias PT-BR/EN documentam fallback, versões, waivers,
30
+ códigos de saída e recovery.
31
+
32
+ ## [0.84.0] — 2026-08-25
33
+
34
+ ### Added
35
+
36
+ - **Protocolo de sync local-first.** `wendkeep sync status/push/pull/conflicts/resolve` transporta
37
+ estado autoral portátil por revisões, CAS, pais causais, record keys com escopo de
38
+ projeto/branch/worktree, tombstones e conflitos explícitos, sem last-write-wins ou cloud
39
+ obrigatória.
40
+ - **Operação offline e coordenação recuperável.** Outbox append-only, acknowledgements
41
+ idempotentes, replay fora de ordem, leases expirantes com histórico, adaptadores de referência
42
+ filesystem/HTTP e resolução auditável preservam autoria sob partição, retry e clocks
43
+ divergentes.
44
+ - **Privacidade, diagnóstico e contrato público.** Envelopes opt-in AES-256-GCM com rotação de
45
+ chave, schemas v1, status no `doctor` e no Observer sanitizado, chaos tests e guias PT-BR/EN
46
+ documentam consistência, erros e threat model. O sync desabilitado não cria runtime nem altera
47
+ Keep Core.
48
+
49
+ ## [0.83.0] — 2026-08-25
50
+
51
+ ### Added
52
+
53
+ - **Estado autoral portátil e `active-work`.** `wendkeep portable status/export/import/diff`
54
+ produz um snapshot determinístico e revisável de CORE, ADRs, specs e changes autorais, com uma
55
+ projeção compacta de retomada por active context sem session/worktree IDs, paths locais, tokens,
56
+ transcritos, locks, leases ou outboxes.
57
+ - **Import fail-closed e provenance privado.** Schema, project, allowlist, hashes, limites,
58
+ traversal, symlinks/hardlinks e revision/hash são validados antes da primeira escrita; estado
59
+ stale ou conflitante nunca sobrescreve silenciosamente o local. Export/import registram somente
60
+ metadados e hashes em ledger privado, e o `doctor` diagnostica authored state divergente.
61
+ - **Contrato público bilíngue.** Schemas `portable-state-v1`/`portable-active-work-v1`, README,
62
+ guias PT-BR/EN e política LF em `.gitattributes` documentam redaction, opt-out de Git, revisão em
63
+ PR e retomada segura em clone limpo.
64
+
65
+ ## [0.82.0] — 2026-08-25
66
+
67
+ ### Added
68
+
69
+ - **MCP semântico nativo.** `wendkeep mcp serve` oferece tools bounded para projeto, contexto,
70
+ memória, changes, specs, tarefas, handoff, evidência e Observer por JSON-RPC/stdio, com schemas
71
+ versionados, paginação, budgets, timeout, cancelamento, redaction e compatibilidade Core com
72
+ Node 18; Observer SQL permanece capability separada em Node 22.13+.
73
+ - **Effects, capabilities e writes causais.** Um catálogo versionado com integridade SHA-256
74
+ distingue read/write/destructive; reads conhecidas deixam de ser bloqueadas apenas pelo prefixo
75
+ MCP, enquanto desconhecidas e manifestos inválidos falham fechado. Writes exigem capability,
76
+ ator, sessão, active context, lease e motivo, revalidam o binding causal e reutilizam os gates da
77
+ CLI; delivery, merge, push, tag, publicação e exclusão ficam fora da superfície padrão.
78
+ - **Auditoria e configuração multi-cliente.** O ledger local registra somente metadados de chamada,
79
+ nunca argumentos/payload; `wendkeep mcp config` gera configuração para Claude, Codex, Cursor e
80
+ clientes genéricos, e o tarball instalado prova o handshake e a consulta semântica.
81
+
82
+ ### Changed
83
+
84
+ - **MCP principal reproduzível.** `init` substitui o servidor de Vault executado com `@latest` por
85
+ `npx --no-install wendkeep mcp serve --vault <vault>`, preservando o merge não destrutivo de
86
+ `.mcp.json`; README, arquitetura e guias PT-BR/EN documentam tools, gates, limites e recovery.
87
+ - **Bootstrap stdio desacoplado do checkout.** `mcp serve` inicia sem exigir um Vault no cwd; quando
88
+ `--vault` não é informado, cada tool resolve e audita somente o binding do `project_root` declarado,
89
+ preservando isolamento multi-projeto e permitindo handshake empacotado em CI/editores.
90
+
91
+ ## [0.81.0] — 2026-08-24
92
+
93
+ ### Added
94
+
95
+ - **Atestação TDD causal.** `wendkeep tdd red|green|status|waive` registra o ciclo RED → GREEN
96
+ ligado a projeto, repositório, worktree, work session, change, tarefa, requisito e paths de teste.
97
+ RED já verde ou causado por import/sintaxe/configuração fica `invalid`; GREEN exige sucessor
98
+ causal e diff de produção posterior, enquanto waiver exige motivo e autoridade humana explícita.
99
+ - **Prova reviewable e portátil.** O store v1 conserva digests e cauda sanitizada limitada, preserva
100
+ histórico após refactor/revalidação e expõe IDs no Evidence Envelope, pacote deep, handoff e
101
+ Observer, sem persistir saída completa nem paths absolutos.
102
+
103
+ ### Changed
104
+
105
+ - **Gate TDD por perfil.** Task Contracts exigem atestação atual para tarefas `[tdd]` em GOVERN e
106
+ para comportamento testável em ASSURE; mutante sobrevivente ou mudança pós-GREEN invalida a
107
+ prova. OFF/FLOW permanecem opcionais e GUIDE recomendado. Skill `wk-tdd`, schemas, README e
108
+ guias PT-BR/EN documentam o contrato e a recuperação.
109
+
7
110
  ## [0.80.2] — 2026-08-24
8
111
 
9
112
  ### Fixed
package/README.en.md CHANGED
@@ -39,12 +39,15 @@ sibling adapters with no dependency between them, and the direction remains
39
39
  remain equivalent; the private `@wendkeep/integrations` workspace stays inside the single
40
40
  published `wendkeep` package, with no public `wendkeep/integrations` subpath. Pi is the next phase.
41
41
 
42
- In the **0.65 MCP Configuration Kernel** phase, `packages/mcp/src/config.mjs` becomes the
43
- canonical authority for the MCPVault entry, catalog-described server selection, and `.mcp.json`
44
- merging. `src/taxonomy.mjs` supplies descriptors while `src/init.mjs` retains only filesystem
45
- orchestration. Existing keys and servers remain preserved; invalid JSON stays byte-for-byte intact
46
- and the reconciled proposal is written to `.mcp.json.new`. The workspace remains private, with no
47
- public `wendkeep/mcp` subpath or separate npm package.
42
+ The **native MCP** workspace now serves semantic project, context, memory, change, spec, task,
43
+ handoff, evidence, and Observer tools through `wendkeep mcp serve`. A versioned, verified catalog
44
+ declares every effect/capability; known reads skip the mutation gate, while writes require a
45
+ capability, session, active context, lease, and reason. Stable schemas, pagination, byte budgets,
46
+ timeouts, cancellation, redaction, and payload-free local audit bound the surface. `init` preserves
47
+ the `.mcp.json` merge while invoking the installed package through
48
+ `npx --no-install wendkeep mcp serve`—with no dynamic `@latest` dependency or arbitrary filesystem
49
+ access. Stdio may start outside a bound project; without `--vault`, each call resolves and audits
50
+ only its declared `project_root`. The workspace remains private inside the single `wendkeep` package.
48
51
 
49
52
  In the **0.64 CLI Runtime** phase, `packages/cli/src/index.mjs` owns help, version reporting, Vault
50
53
  selection, error presentation, and lazy dispatch. `bin/wendkeep.mjs` is reduced to the shebang and
@@ -87,7 +90,7 @@ Decisions, dead ends, the reason you chose X over Y — gone next session. The p
87
90
  | **Recall** — injected back | Canonical `CORE` + operational `SHARED_MEMORY` enter on `startup`, `/clear`, and `/compact`; on every prompt, the local chunk index selects a few passages with source, authority, and validity under an explicit budget. |
88
91
  | **Cost** — what it all cost | Per‑model, cache‑aware token pricing per session — plus `cost --trend` with a run‑rate projection across the whole vault; research previews without a final rate remain unestimated. |
89
92
  | **Multi‑agent** — one vault, both agents | `init` wires the session hooks into `.claude/settings.json` *and* `.codex/hooks.json`, and every note is tagged with the agent that wrote it: Claude Code is detected from its environment, anything else is recorded as Codex. One shared graph, whichever agent you are in. |
90
- | **Local‑first** — no cloud, no account | Everything is plain Markdown on your disk. An optional MCP server (`@bitbonsai/mcpvault`) lets the agent read/write the vault. |
93
+ | **Local‑first** — no cloud, no account | Everything is plain Markdown on your disk. The native MCP queries local semantic state and gates writes by capability/context/lease. |
91
94
  | **Local Observer** — many projects, one view | `wendkeep observer` keeps documents, FTS5 chunks, sessions, agents, tokens, costs, calls, and transcripts in SQLite. Identities and foreign keys are project-scoped; each event is atomic. Hooks publish only what changed; `observer reconcile --url` ignores the incremental cursor to regenerate the complete projection while preserving local/remote revision baselines. |
92
95
 
93
96
  During historical migration, the Observer preserves differences between frontmatter totals and the
@@ -117,7 +120,7 @@ npx wendkeep init
117
120
  2. Write a provider-neutral **`.wendkeep.json`** binding at the project root and a matching `.brain/PROJECT.json` marker in the vault, then merge the session hooks into **`.claude/settings.json`**. The binding is provider-neutral by design: any agent resolves the same vault from its session `cwd`, with no machine-global environment variable. Older registrations already in `.claude/settings.json` are adopted automatically.
118
121
  3. Wire the Codex hooks in **`.codex/hooks.json`** — twelve compatible entries: `brain-inject` + `session-start` + `observer-publish` on `SessionStart`, `session-ensure` + `evidence-context` + `change-context` on `UserPromptSubmit`, `session-stop` + `observer-publish` + `change-nag` on `Stop`, `subagent-stop` + `observer-publish` on `SubagentStop`, and `change-guard` on `PreToolUse` for `Bash`, `exec_command`, `apply_patch`, and mutable MCP tools, always in the `npx wendkeep hook <name>` form. For the Observer, `SessionStart` only drains the outbox, `Stop` enqueues the changed session, and `SubagentStop` enqueues only the affected transcript; full scanning is explicit through `observer reconcile`. When the host omits `work_session_id`, `session-start` and `session-ensure` derive it from the canonical `session_id`, preserving an explicit handoff and the already registered value first. The guard accepts object, raw-string, and argv Codex payloads; before a mutation it compares the session with the project, Git root, remote, branch, and worktree, denying missing or divergent targets. A raw `git checkout/switch` branch transition is denied before it can strand the session; use `wendkeep context switch <branch> [--create]`, which moves Git and the causal scope together in the same worktree with an audited revision and rollback. If a divergence is already quarantined, `context status --session <id>` inventories sanitized `reserved`/`observed` candidates; `context recover --session <id> --select <reserved|observed> --revision <n> --reason <text>` requires an explicit choice, CAS, and current-checkout proof, failing closed before clearing the conflict if revalidation changes. `doctor` diagnoses orphaned active contexts, removed worktrees, and expired `request-stop` leases without writing; `context repair --key <key> --revision <n> --reason <text> --session <id>` revalidates under lock, closes only the ownerless/removed context or expires only its lease, while preserving the record and all historical memory. The change lifecycle uses `active_contexts`, identified by `repository_id` + `worktree_id` + `work_session_id`; two matching sessions fail with ambiguity instead of selecting silently, `CURRENT_CHANGE.md` is only a derived projection for one unambiguous context, and migration never invents a worktree or session identity. The other four stay out because Codex offers no equivalent payload, tool, or event: `change-warn` (no reliable `tool_input.file_path`), `plan-capture` (no `ExitPlanMode`), `decision-capture` (`AskUserQuestion` is Claude-only), and `task-log` (`TaskCompleted` is not in Codex's event enum). Codex scope blocks use `permissionDecision: "deny"`; `ask` is never emitted in `PreToolUse`. The merge remains non-destructive, preserves third-party hooks, and migrates legacy `timeout` to `timeoutSec`. **Codex enumerates every hook as untrusted and runs none until you approve the “Hooks need review” prompt at startup — `init` cannot pre-approve them**.
119
122
  Once `active_contexts` is initialized, `brain-inject` and `change-context` mark only the causal context's change as current; the backlog remains global, and an empty or ambiguous store never revives `CURRENT_CHANGE.md`.
120
- 4. Add the **`wendkeep-vault`** MCP server to `.mcp.json` so the agent can read/write the vault. Skip with `--no-mcp` e.g. when the agent already has a vault MCP. (`--no-mcp` skips *only wendkeep's own* MCP; companion MCPs still follow `--companions`.)
123
+ 4. Add the native semantic **`wendkeep-vault`** MCP server to `.mcp.json`. It offers bounded reads and capability-gated writes without arbitrary filesystem access or an `@latest` download. Skip with `--no-mcp`. (`--no-mcp` skips *only wendkeep's own* MCP; companion MCPs still follow `--companions`.)
121
124
  5. Offer to pin **companion** plugins/MCP (multi-choice; **none** pre-checked — wendkeep is a neutral harness and presumes no third-party plugin). Each is wired the most agent-agnostic way it supports:
122
125
  - **`context-mode`** — context optimizer + FTS5 memory, wired as a Claude Code plugin. It ships its own MCP server, so wendkeep deliberately adds no `.mcp.json` entry (registering both cold-started two servers at once). On non-Claude agents, add the MCP by hand: `npx -y context-mode`.
123
126
  - **`understand-anything`** — project domain graph, via a `understand-inject` SessionStart hook that injects the graph when generated.
@@ -244,6 +247,10 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
244
247
  | **Installation and updates** | `init`, `sync`, companions, and the first project↔vault binding | [Installation and first use](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/getting-started.md) |
245
248
  | **Managed worktrees** | `worktree create/list/status/open/finish/cleanup/remove/prune`, merge proof, preflight, crash-safe cleanup/common gate, and receipts | [Managed worktrees](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/worktrees.md) |
246
249
  | **Active context** | `active_contexts` by `repository_id`/`worktree_id`/`work_session_id`, causal transition, quarantine, and explicit recovery | [Active context](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/context.md) |
250
+ | **Portable state** | `portable status/export/import/diff`, authored/runtime boundary, redaction, and the `active-work` snapshot | [Portable state](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/portable.md) |
251
+ | **Local-first sync** | `sync status/push/pull/conflicts/resolve`, revision/CAS, outbox, leases, and explicit conflicts | [Sync protocol](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/sync-protocol.md) |
252
+ | **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) |
253
+ | **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) |
247
254
  | **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) |
248
255
  | **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) |
249
256
  | **Shared memory** | CORE, SHARED, status, validation, repair, and curation | [Memory](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/memory.md) |
@@ -254,6 +261,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
254
261
  | **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) |
255
262
 
256
263
  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),
264
+ [causal TDD attestation](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/tdd.md),
257
265
  [legacy-memory migration](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/memory-migration.md), and
258
266
  [safe retroactive import](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/retroactive-import.md).
259
267
 
@@ -401,6 +409,12 @@ ambiguity. Use `--scope core` for Keep Core health, `--scope runtime` for govern
401
409
  `--strict` in CI/release; `wendkeep sync` validates Core only so work in progress does not become
402
410
  an installation failure.
403
411
 
412
+ To resume a change in another clone without tracking transcripts, tokens, paths, leases, or outboxes,
413
+ `wendkeep portable export` creates `.wendkeep/portable/state.json` with sanitized authored
414
+ CORE/ADRs/specs/deltas and a compact `active-work` projection. `portable import` validates project,
415
+ hashes, revisions, and paths before writing; stale or conflicting state never silently replaces local
416
+ state. Git tracking is opt-in and the command never adds files automatically.
417
+
404
418
  ## Shared Project Memory v2
405
419
 
406
420
  Hot memory now separates human authorship, operational state, and evidence:
@@ -552,8 +566,8 @@ explore → propose → apply (TDD) → verify → archive
552
566
  ```
553
567
 
554
568
  - **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.
555
- - **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.
556
- - **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, 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 both package and verdict to the current `envelope_id`.
569
+ - **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.
570
+ - **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`.
557
571
  - **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.
558
572
 
559
573
  > 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.
@@ -606,7 +620,7 @@ npx wendkeep change new dark-mode # proposta/design/tarefas — cha
606
620
  Edit `tarefas.md` — tag proof and requirement per task:
607
621
 
608
622
  ```markdown
609
- - [ ] 1.1 toggle persists across sessions [req:UI-1] [sensor:tests]
623
+ - [ ] 1.1 toggle persists across sessions [req:UI-1] [sensor:tests] [tdd]
610
624
  ```
611
625
 
612
626
  Declare the capability in `proposta.md` (`specs: [ui]`) and author its delta only in
@@ -618,6 +632,9 @@ npx wendkeep change list # same backlog, plus the archived
618
632
  npx wendkeep change status dark-mode # one screen for one change: specs / tasks / sensors / verdict
619
633
  npx wendkeep spec effective --change dark-mode # living contract + this change's delta
620
634
  npx wendkeep change done 1.1 # tick a task from the CLI
635
+ npx wendkeep tdd red 1.1 --requirement UI-1 --test tests/ui.test.mjs --command "npm test"
636
+ # implement; then observe GREEN in the same causal context
637
+ npx wendkeep tdd green 1.1 --command "npm test"
621
638
  npx wendkeep verify # run the declared sensors -> evidencia.json
622
639
  npx wendkeep verify --deep # assemble the verification package
623
640
  # the wk-verify skill (fresh, read-only pass) writes verdict.json
package/README.md CHANGED
@@ -39,12 +39,15 @@ sibling adapters with no dependency between them, and the direction remains
39
39
  remain equivalent; the private `@wendkeep/integrations` workspace stays inside the single
40
40
  published `wendkeep` package, with no public `wendkeep/integrations` subpath. Pi is the next phase.
41
41
 
42
- In the **0.65 MCP Configuration Kernel** phase, `packages/mcp/src/config.mjs` becomes the
43
- canonical authority for the MCPVault entry, catalog-described server selection, and `.mcp.json`
44
- merging. `src/taxonomy.mjs` supplies descriptors while `src/init.mjs` retains only filesystem
45
- orchestration. Existing keys and servers remain preserved; invalid JSON stays byte-for-byte intact
46
- and the reconciled proposal is written to `.mcp.json.new`. The workspace remains private, with no
47
- public `wendkeep/mcp` subpath or separate npm package.
42
+ The **native MCP** workspace now serves semantic project, context, memory, change, spec, task,
43
+ handoff, evidence, and Observer tools through `wendkeep mcp serve`. A versioned, verified catalog
44
+ declares every effect/capability; known reads skip the mutation gate, while writes require a
45
+ capability, session, active context, lease, and reason. Stable schemas, pagination, byte budgets,
46
+ timeouts, cancellation, redaction, and payload-free local audit bound the surface. `init` preserves
47
+ the `.mcp.json` merge while invoking the installed package through
48
+ `npx --no-install wendkeep mcp serve`—with no dynamic `@latest` dependency or arbitrary filesystem
49
+ access. Stdio may start outside a bound project; without `--vault`, each call resolves and audits
50
+ only its declared `project_root`. The workspace remains private inside the single `wendkeep` package.
48
51
 
49
52
  In the **0.64 CLI Runtime** phase, `packages/cli/src/index.mjs` owns help, version reporting, Vault
50
53
  selection, error presentation, and lazy dispatch. `bin/wendkeep.mjs` is reduced to the shebang and
@@ -87,7 +90,7 @@ Decisions, dead ends, the reason you chose X over Y — gone next session. The p
87
90
  | **Recall** — injected back | Canonical `CORE` + operational `SHARED_MEMORY` enter on `startup`, `/clear`, and `/compact`; on every prompt, the local chunk index selects a few passages with source, authority, and validity under an explicit budget. |
88
91
  | **Cost** — what it all cost | Per‑model, cache‑aware token pricing per session — plus `cost --trend` with a run‑rate projection across the whole vault; research previews without a final rate remain unestimated. |
89
92
  | **Multi‑agent** — one vault, both agents | `init` wires the session hooks into `.claude/settings.json` *and* `.codex/hooks.json`, and every note is tagged with the agent that wrote it: Claude Code is detected from its environment, anything else is recorded as Codex. One shared graph, whichever agent you are in. |
90
- | **Local‑first** — no cloud, no account | Everything is plain Markdown on your disk. An optional MCP server (`@bitbonsai/mcpvault`) lets the agent read/write the vault. |
93
+ | **Local‑first** — no cloud, no account | Everything is plain Markdown on your disk. The native MCP queries local semantic state and gates writes by capability/context/lease. |
91
94
  | **Local Observer** — many projects, one view | `wendkeep observer` keeps documents, FTS5 chunks, sessions, agents, tokens, costs, calls, and transcripts in SQLite. Identities and foreign keys are project-scoped; each event is atomic. Hooks publish only what changed; `observer reconcile --url` ignores the incremental cursor to regenerate the complete projection while preserving local/remote revision baselines. |
92
95
 
93
96
  During historical migration, the Observer preserves differences between frontmatter totals and the
@@ -117,7 +120,7 @@ npx wendkeep init
117
120
  2. Write a provider-neutral **`.wendkeep.json`** binding at the project root and a matching `.brain/PROJECT.json` marker in the vault, then merge the session hooks into **`.claude/settings.json`**. The binding is provider-neutral by design: any agent resolves the same vault from its session `cwd`, with no machine-global environment variable. Older registrations already in `.claude/settings.json` are adopted automatically.
118
121
  3. Wire the Codex hooks in **`.codex/hooks.json`** — twelve compatible entries: `brain-inject` + `session-start` + `observer-publish` on `SessionStart`, `session-ensure` + `evidence-context` + `change-context` on `UserPromptSubmit`, `session-stop` + `observer-publish` + `change-nag` on `Stop`, `subagent-stop` + `observer-publish` on `SubagentStop`, and `change-guard` on `PreToolUse` for `Bash`, `exec_command`, `apply_patch`, and mutable MCP tools, always in the `npx wendkeep hook <name>` form. For the Observer, `SessionStart` only drains the outbox, `Stop` enqueues the changed session, and `SubagentStop` enqueues only the affected transcript; full scanning is explicit through `observer reconcile`. When the host omits `work_session_id`, `session-start` and `session-ensure` derive it from the canonical `session_id`, preserving an explicit handoff and the already registered value first. The guard accepts object, raw-string, and argv Codex payloads; before a mutation it compares the session with the project, Git root, remote, branch, and worktree, denying missing or divergent targets. A raw `git checkout/switch` branch transition is denied before it can strand the session; use `wendkeep context switch <branch> [--create]`, which moves Git and the causal scope together in the same worktree with an audited revision and rollback. If a divergence is already quarantined, `context status --session <id>` inventories sanitized `reserved`/`observed` candidates; `context recover --session <id> --select <reserved|observed> --revision <n> --reason <text>` requires an explicit choice, CAS, and current-checkout proof, failing closed before clearing the conflict if revalidation changes. `doctor` diagnoses orphaned active contexts, removed worktrees, and expired `request-stop` leases without writing; `context repair --key <key> --revision <n> --reason <text> --session <id>` revalidates under lock, closes only the ownerless/removed context or expires only its lease, while preserving the record and all historical memory. The change lifecycle uses `active_contexts`, identified by `repository_id` + `worktree_id` + `work_session_id`; two matching sessions fail with ambiguity instead of selecting silently, `CURRENT_CHANGE.md` is only a derived projection for one unambiguous context, and migration never invents a worktree or session identity. The other four stay out because Codex offers no equivalent payload, tool, or event: `change-warn` (no reliable `tool_input.file_path`), `plan-capture` (no `ExitPlanMode`), `decision-capture` (`AskUserQuestion` is Claude-only), and `task-log` (`TaskCompleted` is not in Codex's event enum). Codex scope blocks use `permissionDecision: "deny"`; `ask` is never emitted in `PreToolUse`. The merge remains non-destructive, preserves third-party hooks, and migrates legacy `timeout` to `timeoutSec`. **Codex enumerates every hook as untrusted and runs none until you approve the “Hooks need review” prompt at startup — `init` cannot pre-approve them**.
119
122
  Once `active_contexts` is initialized, `brain-inject` and `change-context` mark only the causal context's change as current; the backlog remains global, and an empty or ambiguous store never revives `CURRENT_CHANGE.md`.
120
- 4. Add the **`wendkeep-vault`** MCP server to `.mcp.json` so the agent can read/write the vault. Skip with `--no-mcp` e.g. when the agent already has a vault MCP. (`--no-mcp` skips *only wendkeep's own* MCP; companion MCPs still follow `--companions`.)
123
+ 4. Add the native semantic **`wendkeep-vault`** MCP server to `.mcp.json`. It offers bounded reads and capability-gated writes without arbitrary filesystem access or an `@latest` download. Skip with `--no-mcp`. (`--no-mcp` skips *only wendkeep's own* MCP; companion MCPs still follow `--companions`.)
121
124
  5. Offer to pin **companion** plugins/MCP (multi-choice; **none** pre-checked — wendkeep is a neutral harness and presumes no third-party plugin). Each is wired the most agent-agnostic way it supports:
122
125
  - **`context-mode`** — context optimizer + FTS5 memory, wired as a Claude Code plugin. It ships its own MCP server, so wendkeep deliberately adds no `.mcp.json` entry (registering both cold-started two servers at once). On non-Claude agents, add the MCP by hand: `npx -y context-mode`.
123
126
  - **`understand-anything`** — project domain graph, via a `understand-inject` SessionStart hook that injects the graph when generated.
@@ -244,6 +247,10 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
244
247
  | **Installation and updates** | `init`, `sync`, companions, and the first project↔vault binding | [Installation and first use](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/getting-started.md) |
245
248
  | **Managed worktrees** | `worktree create/list/status/open/finish/cleanup/remove/prune`, merge proof, preflight, crash-safe cleanup/common gate, and receipts | [Managed worktrees](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/worktrees.md) |
246
249
  | **Active context** | `active_contexts` by `repository_id`/`worktree_id`/`work_session_id`, causal transition, quarantine, and explicit recovery | [Active context](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/context.md) |
250
+ | **Portable state** | `portable status/export/import/diff`, authored/runtime boundary, redaction, and the `active-work` snapshot | [Portable state](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/portable.md) |
251
+ | **Local-first sync** | `sync status/push/pull/conflicts/resolve`, revision/CAS, outbox, leases, and explicit conflicts | [Sync protocol](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/sync-protocol.md) |
252
+ | **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) |
253
+ | **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) |
247
254
  | **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) |
248
255
  | **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) |
249
256
  | **Shared memory** | CORE, SHARED, status, validation, repair, and curation | [Memory](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/memory.md) |
@@ -254,6 +261,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
254
261
  | **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) |
255
262
 
256
263
  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),
264
+ [causal TDD attestation](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/tdd.md),
257
265
  [legacy-memory migration](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/memory-migration.md), and
258
266
  [safe retroactive import](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/retroactive-import.md).
259
267
 
@@ -401,6 +409,12 @@ ambiguity. Use `--scope core` for Keep Core health, `--scope runtime` for govern
401
409
  `--strict` in CI/release; `wendkeep sync` validates Core only so work in progress does not become
402
410
  an installation failure.
403
411
 
412
+ To resume a change in another clone without tracking transcripts, tokens, paths, leases, or outboxes,
413
+ `wendkeep portable export` creates `.wendkeep/portable/state.json` with sanitized authored
414
+ CORE/ADRs/specs/deltas and a compact `active-work` projection. `portable import` validates project,
415
+ hashes, revisions, and paths before writing; stale or conflicting state never silently replaces local
416
+ state. Git tracking is opt-in and the command never adds files automatically.
417
+
404
418
  ## Shared Project Memory v2
405
419
 
406
420
  Hot memory now separates human authorship, operational state, and evidence:
@@ -552,8 +566,8 @@ explore → propose → apply (TDD) → verify → archive
552
566
  ```
553
567
 
554
568
  - **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.
555
- - **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.
556
- - **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, 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 both package and verdict to the current `envelope_id`.
569
+ - **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.
570
+ - **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`.
557
571
  - **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.
558
572
 
559
573
  > 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.
@@ -606,7 +620,7 @@ npx wendkeep change new dark-mode # proposta/design/tarefas — cha
606
620
  Edit `tarefas.md` — tag proof and requirement per task:
607
621
 
608
622
  ```markdown
609
- - [ ] 1.1 toggle persists across sessions [req:UI-1] [sensor:tests]
623
+ - [ ] 1.1 toggle persists across sessions [req:UI-1] [sensor:tests] [tdd]
610
624
  ```
611
625
 
612
626
  Declare the capability in `proposta.md` (`specs: [ui]`) and author its delta only in
@@ -618,6 +632,9 @@ npx wendkeep change list # same backlog, plus the archived
618
632
  npx wendkeep change status dark-mode # one screen for one change: specs / tasks / sensors / verdict
619
633
  npx wendkeep spec effective --change dark-mode # living contract + this change's delta
620
634
  npx wendkeep change done 1.1 # tick a task from the CLI
635
+ npx wendkeep tdd red 1.1 --requirement UI-1 --test tests/ui.test.mjs --command "npm test"
636
+ # implement; then observe GREEN in the same causal context
637
+ npx wendkeep tdd green 1.1 --command "npm test"
621
638
  npx wendkeep verify # run the declared sensors -> evidencia.json
622
639
  npx wendkeep verify --deep # assemble the verification package
623
640
  # the wk-verify skill (fresh, read-only pass) writes verdict.json
@@ -0,0 +1,82 @@
1
+ # Host capabilities
2
+
3
+ [Português (Brasil)](../../pt-BR/commands/capabilities.md)
4
+
5
+ ## Purpose
6
+
7
+ Show the versioned matrix of the 17 lifecycle/effect capabilities each host actually provides as
8
+ `native`, `adapted`, `polled`, `manual`, or `unavailable`.
9
+
10
+ ## When to use
11
+
12
+ Use it before depending on session hooks, tool use, task completion, subagents, transcript, or
13
+ usage; and when diagnosing differences across Claude Code, Codex, Pi, and generic MCP/CLI clients.
14
+
15
+ ## When not to use
16
+
17
+ Do not treat the matrix as proof that a manual event happened. `manual` has `reported` authority;
18
+ only native/adapted/polled events can be `verified`.
19
+
20
+ ## Prerequisites
21
+
22
+ Node.js 18+ and WendKeep installed. The command is pure and needs no Vault. Session coverage uses
23
+ the detected host and may receive its version through `WENDKEEP_HOST_VERSION`.
24
+
25
+ ## Syntax
26
+
27
+ ```text
28
+ wendkeep capabilities [--host <claude|codex|pi|generic-mcp>] [--host-version <v>] [--json]
29
+ ```
30
+
31
+ Without `--host`, all manifests are listed. An unknown host explicitly degrades to `generic-mcp`;
32
+ an out-of-range version is marked `HOST_VERSION_UNPROVEN`.
33
+
34
+ ## Options and exit codes
35
+
36
+ - `--host <id>` selects a host; unknown ids are never silently promoted.
37
+ - `--host-version <v>` compares the observed major with the manifest.
38
+ - `--json` emits the `host-coverage-v1` contract.
39
+ - exit `0`: matrix emitted; exit `2`: invalid argument.
40
+
41
+ `wendkeep.sensors.json` may declare `requires_host_capabilities` and explicit human waivers under
42
+ `host_capability_waivers`. `verify` exits `1` when a required capability is manual/unavailable
43
+ without `authority: human`, `approved_by`, and `reason`. ASSURE applies the same handoff rule.
44
+
45
+ ## Examples
46
+
47
+ ```powershell
48
+ wendkeep capabilities --host codex --host-version 1.2.0
49
+ wendkeep capabilities --host generic-mcp --json
50
+ ```
51
+
52
+ ```json
53
+ {
54
+ "requires_host_capabilities": ["task.completed"],
55
+ "host_capability_waivers": [{
56
+ "capability": "task.completed",
57
+ "authority": "human",
58
+ "approved_by": "maintainer",
59
+ "reason": "manual confirmation"
60
+ }]
61
+ }
62
+ ```
63
+
64
+ ## Expected result
65
+
66
+ Coverage flows into the session registry, active context, handoff, evidence envelope, and Observer
67
+ summary. Gaps are injected at session start before the agent assumes nonexistent parity. MCP effects
68
+ come from the signed manifest: known reads skip the mutation gate; writes/destructive remain gated;
69
+ an unknown effect fails closed.
70
+
71
+ ## Common errors and diagnosis
72
+
73
+ - `HOST_UNKNOWN`: use MCP/CLI fallback or publish an isolated adapter.
74
+ - `HOST_VERSION_UNPROVEN`: update the manifest or operate in degraded mode.
75
+ - `HOST_CAPABILITY_UNAVAILABLE`: remove the dependency or obtain an explicit human waiver.
76
+ - `HOST_ENVELOPE_UNKNOWN`: an unknown version/event never becomes verified evidence.
77
+ - A suggestive tool name does not define its effect; inspect the signed catalog with `wendkeep mcp inspect`.
78
+
79
+ ## Next steps
80
+
81
+ See [Native MCP](mcp.md), [sessions and import](sessions-and-import.md),
82
+ [changes and verification](changes-and-verification.md), and [Observer](observer.md).
@@ -86,7 +86,9 @@ initialized vault. Existing files are merged or preserved, and the selected vaul
86
86
  When MCP is enabled, `init` preserves existing properties and servers in `.mcp.json` and adds
87
87
  `wendkeep-vault`. If the existing JSON is invalid, the original file remains byte-for-byte intact
88
88
  and the reconciled proposal is written to `.mcp.json.new`. Since version 0.65, this composition is
89
- owned by the private MCP kernel without changing commands, flags, or the public npm surface.
89
+ owned by the private MCP kernel. The entry runs the installed semantic server through
90
+ `npx --no-install wendkeep mcp serve --vault <vault>`, with no dynamic `@latest` download. See
91
+ [Native MCP](mcp.md) for tools, gates, limits, and client snippets.
90
92
 
91
93
  Pure rules that project Claude/Codex hooks and interpret envelopes, transcripts, usage, and
92
94
  identity belong to the private `@wendkeep/integrations` workspace. Historical facades retain
@@ -0,0 +1,99 @@
1
+ # Native MCP
2
+
3
+ [Português](../../pt-BR/commands/mcp.md)
4
+
5
+ ## Purpose
6
+
7
+ Expose local semantic project, context, memory, change, task, evidence, and Observer state without
8
+ arbitrary filesystem reads or a dynamic `@latest` dependency.
9
+
10
+ ## When to use
11
+
12
+ Use it when an MCP client must discover and query WendKeep or execute a causal write explicitly
13
+ authorized by capability, active context, and lease.
14
+
15
+ ## When not to use
16
+
17
+ Do not use it for delivery, merge, push, tag, publication, deletion, or generic file access. Those
18
+ operations remain outside the default surface and use the appropriate CLI/ASSURE workflows.
19
+
20
+ ## Prerequisites
21
+
22
+ - `wendkeep` installed in the project or available through its binary;
23
+ - a valid project↔Vault binding;
24
+ - Node.js 18+ for Core; Node.js 22.13+ only for Observer SQL;
25
+ - for writes: a current causal session, active context, and authorization.
26
+
27
+ ## Syntax
28
+
29
+ ```powershell
30
+ wendkeep mcp serve --vault <vault>
31
+ wendkeep mcp serve --vault <vault> --timeout-ms <n>
32
+ wendkeep mcp config --client generic --vault <vault>
33
+ wendkeep mcp config --client claude --vault <vault>
34
+ wendkeep mcp config --client codex --vault <vault>
35
+ wendkeep mcp config --client cursor --vault <vault>
36
+ ```
37
+
38
+ ## Options and exit codes
39
+
40
+ - `--vault <path>` selects the Vault; it is required by `config` and optional for `serve`. Without
41
+ it, stdio starts independently of the process checkout and lazily resolves each call's binding
42
+ and audit ledger from the declared `project_root`; one project never reuses another's auditor.
43
+ - `--timeout-ms <n>` accepts 1 through 120000; the per-call default is 10000.
44
+ - `--client` accepts `generic`, `claude`, `codex`, or `cursor`.
45
+ - Exit 0: transport/configuration completed; Exit 2: invalid subcommand, client, or option.
46
+ - Tool errors use an MCP `isError` result with `schema_version: 1`, an `MCP_*` code, sanitized
47
+ message, and `retryable`; they do not terminate the server.
48
+
49
+ ## Examples
50
+
51
+ `init` generates this reproducible generic entry:
52
+
53
+ ```json
54
+ {
55
+ "mcpServers": {
56
+ "wendkeep-vault": {
57
+ "type": "stdio",
58
+ "command": "npx",
59
+ "args": ["--no-install", "wendkeep", "mcp", "serve", "--vault", "<vault>"]
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ Reads: `wendkeep_project_status`, `wendkeep_context_status`, `wendkeep_memory_recall`,
66
+ `wendkeep_memory_conflicts`, `wendkeep_change_list`, `wendkeep_change_show`,
67
+ `wendkeep_change_status`, `wendkeep_spec_effective`, `wendkeep_task_show`,
68
+ `wendkeep_task_evaluate`, `wendkeep_handoff_current`, `wendkeep_evidence_latest`, and
69
+ `wendkeep_observer_query`.
70
+
71
+ Writes: `wendkeep_memory_assert`, `wendkeep_checkpoint_create`, `wendkeep_context_select`,
72
+ `wendkeep_task_claim`, `wendkeep_task_complete`, and `wendkeep_handoff_publish`.
73
+
74
+ ## Expected result
75
+
76
+ The handshake and `tools/list` return valid JSON-RPC. Every tool declares a versioned
77
+ effect/capability and schemas. Known reads skip the mutation gate while retaining explicit
78
+ project/worktree binding, cursor pagination, a 1 MiB default budget, redaction, timeout, and
79
+ cancellation. Observer is declared unavailable below Node 22.13 without blocking Core on Node 18.
80
+
81
+ Writes require `project_root`, `session_id`, `active_context_id`, `actor`, `reason`, the exact
82
+ capability, and `lease.id`/`lease.expires_at`; the executor revalidates causal authorization and CLI
83
+ gates. The local `.brain/runtime/MCP_AUDIT.jsonl` audit stores only tool, effect, capability,
84
+ outcome, code, and duration—never arguments or payloads.
85
+
86
+ ## Common errors and diagnosis
87
+
88
+ - `MCP_TOOL_UNKNOWN`: the tool/alias is absent from the verified catalog; update client or package.
89
+ - `MCP_CAPABILITY_REQUIRED` / `MCP_SCOPE_AUTH_REQUIRED`: capability missing or unauthorized.
90
+ - `MCP_LEASE_EXPIRED`: obtain a new authorization/lease; do not hand-edit its timestamp.
91
+ - `MCP_PROJECT_SCOPE_MISMATCH`: `project_root` and `worktree_root` use different bindings.
92
+ - `MCP_REQUEST_TOO_LARGE` / `MCP_RESPONSE_TOO_LARGE`: use `limit` and the returned cursor.
93
+ - `MCP_RUNTIME_UNSUPPORTED`: use Node 22.13+ for Observer; Core remains available.
94
+
95
+ ## Next steps
96
+
97
+ Run `wendkeep mcp config --client <client> --vault <vault>`, install the snippet in the client, and
98
+ perform `initialize` → `tools/list` → a known read. See [Context](context.md) for causal identity and
99
+ [Observer](observer.md) for the optional SQL backend.