wendkeep 0.73.0 → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,37 @@ 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.74.0] — 2026-08-20
8
+
9
+ ### Added
10
+
11
+ - **Registradores de memória escopados.** Eventos novos declaram escopo de projeto, work session,
12
+ change, branch ou worktree. HEADs de branches paralelas coexistem, enquanto decisões,
13
+ constraints e blockers realmente incompatíveis continuam sob curadoria humana.
14
+ - **Migração append-only de escopo.** `memory rescope` mostra uma prévia sem valores e
15
+ `memory rescope --apply` anexa eventos de reescopo sem reescrever o ledger histórico; retry é
16
+ idempotente e candidates ambíguos não recebem vencedor automático.
17
+ - **Recall baseado em evidências.** O índice `.brain/EVIDENCE_INDEX.jsonl` divide Markdown por
18
+ headings, parágrafos, decisões, tarefas, requisitos e evidências, preservando origem, heading,
19
+ autoridade, validade, sessão, work session, change e hash.
20
+ - **Context broker por prompt.** `UserPromptSubmit` consulta o índice local, aplica ranking lexical
21
+ BM25 com frase exata, peso por campo, autoridade, validade, recência limitada e diversidade, e
22
+ injeta somente os melhores trechos dentro de um budget explícito.
23
+ - **FTS5 no Observer.** O schema SQL 4 mantém chunks por projeto, faz feature probe de FTS5 e usa o
24
+ mesmo ranking/proveniência do Keep Core com fallback lexical quando a extensão não está disponível.
25
+
26
+ ### Changed
27
+
28
+ - **Ambiguidade fica isolada.** Uma chave conflitante é omitida da projeção operacional e recebe
29
+ marcador de revisão; CORE e registros independentes continuam disponíveis.
30
+ - **`/brain-recall` retorna passagens.** Resultados agora apontam para o trecho do match e incluem
31
+ arquivo, heading, autoridade, data e validade, em vez de retornar somente nomes de sessões.
32
+
33
+ ### Performance
34
+
35
+ - Documentos excepcionalmente grandes usam amostragem distribuída limitada a 4 MiB no índice de
36
+ chunks, preservando o transporte gzip e evitando trabalho proporcional a transcripts gigantes.
37
+
7
38
  ## [0.73.0] — 2026-08-20
8
39
 
9
40
  ### Added
package/README.en.md CHANGED
@@ -84,11 +84,11 @@ Decisions, dead ends, the reason you chose X over Y — gone next session. The p
84
84
  |---|---|
85
85
  | **Capture** — every turn, on disk | `SessionStart` / `Stop` hooks write each session to a dated Markdown note: prompts, iterations, files touched, wikilinks. |
86
86
  | **Derive** — decisions, bugs, learnings | Pulled from the transcript into their own notes, backlinked to the session. Your history becomes navigable, not archival. |
87
- | **Recall** — injected back | Canonical `CORE` + operational `SHARED_MEMORY`, with explicit budgets, are injected on `startup`, `/clear`, and `/compact`; `DIGEST` remains a deep-recall index and legacy fallback. |
87
+ | **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
88
  | **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
89
  | **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
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. |
91
- | **Local Observer** — many projects, one view | `wendkeep observer` keeps documents, sessions, agents, tokens, costs, calls, and transcripts in the Docker volume SQLite database; every project gets a **Consumption** tab in the read-only dashboard at `http://127.0.0.1:8787/`, loopback has no token, and unavailable hooks use a gzip outbox without blocking the session, including large transcripts. |
91
+ | **Local Observer** — many projects, one view | `wendkeep observer` keeps documents, FTS5 chunks, sessions, agents, tokens, costs, calls, and transcripts in SQLite; search returns the matching passage with provenance and falls back to the local lexical ranker when FTS5 is unavailable. |
92
92
 
93
93
  During historical migration, the Observer preserves differences between frontmatter totals and the
94
94
  ledger as explicit reconciliation rows, and disambiguates duplicate `session_id` values per file
@@ -100,7 +100,7 @@ The Codex scope guard treats `commit`, `push`, `pull`, `merge`, `publish`, and d
100
100
  operations as independent capabilities, including inside compound commands.
101
101
 
102
102
  - Node.js ≥ 18
103
- - An AI coding agent with hooks. `init` wires **Claude Code** and **Codex** automatically — Codex gets eight compatible hooks, including the scoped `PreToolUse` guard, and enumerates them untrusted, so approve its “Hooks need review” prompt once at startup (see [Notes & roadmap](#notes--roadmap))
103
+ - An AI coding agent with hooks. `init` wires **Claude Code** and **Codex** automatically — Codex gets twelve compatible hooks, including per-prompt recall and the scoped `PreToolUse` guard, and enumerates them untrusted, so approve its “Hooks need review” prompt once at startup (see [Notes & roadmap](#notes--roadmap))
104
104
  - Obsidian (to view the graph) — optional but the point
105
105
 
106
106
  ## Install & set up
@@ -115,7 +115,7 @@ npx wendkeep init
115
115
 
116
116
  1. Create the vault folder taxonomy and a templated `README.md` (default vault: `<project>/.<project-name>-vault`, e.g. `.MyApp-vault`; override with `--vault`).
117
117
  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
- 3. Wire the Codex hooks in **`.codex/hooks.json`** — eleven compatible entries: `brain-inject` + `session-start` + `observer-publish` on `SessionStart`, `session-ensure` + `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. `observer-publish` keeps the sanitized index projection and also sends the local SQL authority with documents, consumption, and transcripts; it does not replace the local lifecycle. 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. 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**.
118
+ 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. `observer-publish` keeps the sanitized index projection and also sends the local SQL authority with documents, consumption, and transcripts; it does not replace the local lifecycle. 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. 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
119
  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`.)
120
120
  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:
121
121
  - **`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`.
@@ -125,7 +125,7 @@ npx wendkeep init
125
125
 
126
126
  Control with `--companions <csv>` or `--no-companions`. The Claude Code plugin layer (`extraKnownMarketplaces` + `enabledPlugins`) is wired as a bonus where the companion has one.
127
127
  6. Install a **color system** into the vault's `.obsidian/`: a CSS snippet that accents notes by type (session/decision/bug/learning, via the `cssclasses` the hooks emit) plus graph color groups by folder. Non-destructive merge into `appearance.json`/`graph.json`; skip with `--no-colors`. Re-apply it any time on an existing vault with `wendkeep theme sync` — Obsidian owns `graph.json` and can drop the color groups (a grey graph); the re-sync restores them without a full re-`init`.
128
- 7. Seed **Shared Project Memory v2** without overwriting existing artifacts: `.brain/CORE.md` (hand-curated canonical truth), `.brain/SHARED_MEMORY.md` (generated operational state), `.brain/MEMORY_EVENTS.jsonl` (append-only ledger), `.brain/MEMORY_CANDIDATES.jsonl` (curation queue), and `.brain/COMPACTION_PROTOCOL.md`. The durable outbox appears under `.brain/memory-outbox/` when events exist; `DIGEST.md` and `index.jsonl` remain deep recall. Everything stays local to the vault.
128
+ 7. Seed **Shared Project Memory v2** without overwriting existing artifacts: `.brain/CORE.md`, `.brain/SHARED_MEMORY.md`, `.brain/MEMORY_EVENTS.jsonl`, `.brain/MEMORY_CANDIDATES.jsonl`, and `.brain/COMPACTION_PROTOCOL.md`. The durable outbox appears under `.brain/memory-outbox/`; `EVIDENCE_INDEX.jsonl` is rebuilt locally from chunks while `DIGEST.md`/`index.jsonl` remain compatible. Everything stays in the vault.
129
129
  8. Seed the **definitions + skills layer**: `.brain/agents/` + `.brain/skills/` (versioned source of truth), including the native process skills `wk-workflow` / `wk-tdd` / `wk-debugging` / `wk-brainstorming` / `wk-planning` / `wk-verify` (some ship templates — e.g. `wk-verify`'s `verdict-template.json` + reviewer prompt). `init` runs `wendkeep sync-defs` for you, delivering the skills to `.claude/skills/` and `.agents/skills/`, and the agent definitions (`.brain/agents/*.toml`) to `.codex/agents/`, plus a managed section in `AGENTS.md` that indexes the skills for Codex; `sync-defs --check` detects stale copies (re-run `sync-defs` after editing `.brain`).
130
130
  9. Seed the **change/spec lifecycle**: the `07-Specs/` + `08-Mudanças/` folders and a native `wendkeep.sensors.json` — critical memory validation/health sensors plus one for each of `typecheck` / `test` / `lint` / `build` found in your `package.json`. `memory-health` blocks delivery on corruption or projection divergence; semantic conflicts degrade only the affected keys and await curation. Pending outbox events and ordinary candidates are warnings. Add sensors with `wendkeep sensors add`. Drives `wendkeep change` / `wendkeep verify` — see **Change lifecycle** below.
131
131
 
@@ -332,9 +332,9 @@ spec, or ADR. If delivery requires a code/config edit, it pauses and work return
332
332
  `implementation`:
333
333
 
334
334
  ```bash
335
- npx wendkeep delivery start release-0-73-0 --allow git:merge --allow git:push --allow publish --source-change <slug> --source-commit <sha>
336
- npx wendkeep delivery status release-0-73-0
337
- npx wendkeep delivery finish release-0-73-0 --target main --ci-url <url> --version 0.73.0 --npm-integrity <sha512> --release-url <url>
335
+ npx wendkeep delivery start release-0-74-0 --allow git:merge --allow git:push --allow publish --source-change <slug> --source-commit <sha>
336
+ npx wendkeep delivery status release-0-74-0
337
+ npx wendkeep delivery finish release-0-74-0 --target main --ci-url <url> --version 0.74.0 --npm-integrity <sha512> --release-url <url>
338
338
  ```
339
339
 
340
340
  If the harness does not record a lease, a small fix remains under the configured profile —
@@ -369,6 +369,8 @@ Hot memory now separates human authorship, operational state, and evidence:
369
369
  - **`SHARED_MEMORY.md` is generated operational state.** The `Stop` hook turns the session handoff into sanitized events; the projector deterministically reduces the ledger and publishes a verifiable revision, cursor, and hash. Facts are `verified` only with local evidence; unsupported reports remain `reported`, and disagreements become candidates for human judgment.
370
370
  - **`MEMORY_EVENTS.jsonl` is the append-only authority.** `Stop` makes events durable in the outbox before acknowledging the attempt; the projector runs outside the registry lock and retries reuse the same IDs. Repeating an identical `event_id`/payload is a no-op; reusing the ID with different bytes is observable corruption.
371
371
  - **`MEMORY_CANDIDATES.jsonl` is the curation queue.** Conflicts and legacy content are never silently promoted. `promote` and `reject` record the decision as a new event; promotion preserves the selected event's JSON type, session, activation/epoch, and source turn.
372
+ - **Registers are scoped.** `git.local-head`, handoffs, verdicts, and change status carry project, work-session, change, branch, or worktree scope. Two branches do not create a global conflict; only events in the same scope and causal lineage may advance automatically.
373
+ - **`EVIDENCE_INDEX.jsonl` is local recall.** Markdown is chunked by headings and blocks without requiring the Observer. Ranking combines BM25, exact phrases, field weights, authority, validity, bounded recency, and source diversity; `UserPromptSubmit` injects only relevant passages with provenance.
372
374
 
373
375
  Artifacts stay under `.brain/` only. Sanitization strips secrets, tokens, local paths, transcripts, and harness payloads both before persistence and before injection. Events carry a `project_id`, and one vault never accepts another project's events.
374
376
 
@@ -390,6 +392,8 @@ Codex uses `session_id`/`turn_id` plus transcript order, with no artificial caus
390
392
  npx --no-install wendkeep memory status --gate --vault .MyApp-vault
391
393
  npx --no-install wendkeep memory migrate --vault .MyApp-vault # preview, zero writes
392
394
  npx --no-install wendkeep memory migrate --apply --vault .MyApp-vault # backup + candidates + v2 bundle
395
+ npx --no-install wendkeep memory rescope --vault .MyApp-vault # preview without values
396
+ npx --no-install wendkeep memory rescope --apply --vault .MyApp-vault # append-only and idempotent
393
397
  ```
394
398
 
395
399
  ### Health and recovery
package/README.md CHANGED
@@ -84,11 +84,11 @@ Decisions, dead ends, the reason you chose X over Y — gone next session. The p
84
84
  |---|---|
85
85
  | **Capture** — every turn, on disk | `SessionStart` / `Stop` hooks write each session to a dated Markdown note: prompts, iterations, files touched, wikilinks. |
86
86
  | **Derive** — decisions, bugs, learnings | Pulled from the transcript into their own notes, backlinked to the session. Your history becomes navigable, not archival. |
87
- | **Recall** — injected back | Canonical `CORE` + operational `SHARED_MEMORY`, with explicit budgets, are injected on `startup`, `/clear`, and `/compact`; `DIGEST` remains a deep-recall index and legacy fallback. |
87
+ | **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
88
  | **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
89
  | **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
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. |
91
- | **Local Observer** — many projects, one view | `wendkeep observer` keeps documents, sessions, agents, tokens, costs, calls, and transcripts in the Docker volume SQLite database; every project gets a **Consumption** tab in the read-only dashboard at `http://127.0.0.1:8787/`, loopback has no token, and unavailable hooks use a gzip outbox without blocking the session, including large transcripts. |
91
+ | **Local Observer** — many projects, one view | `wendkeep observer` keeps documents, FTS5 chunks, sessions, agents, tokens, costs, calls, and transcripts in SQLite; search returns the matching passage with provenance and falls back to the local lexical ranker when FTS5 is unavailable. |
92
92
 
93
93
  During historical migration, the Observer preserves differences between frontmatter totals and the
94
94
  ledger as explicit reconciliation rows, and disambiguates duplicate `session_id` values per file
@@ -100,7 +100,7 @@ The Codex scope guard treats `commit`, `push`, `pull`, `merge`, `publish`, and d
100
100
  operations as independent capabilities, including inside compound commands.
101
101
 
102
102
  - Node.js ≥ 18
103
- - An AI coding agent with hooks. `init` wires **Claude Code** and **Codex** automatically — Codex gets eight compatible hooks, including the scoped `PreToolUse` guard, and enumerates them untrusted, so approve its “Hooks need review” prompt once at startup (see [Notes & roadmap](#notes--roadmap))
103
+ - An AI coding agent with hooks. `init` wires **Claude Code** and **Codex** automatically — Codex gets twelve compatible hooks, including per-prompt recall and the scoped `PreToolUse` guard, and enumerates them untrusted, so approve its “Hooks need review” prompt once at startup (see [Notes & roadmap](#notes--roadmap))
104
104
  - Obsidian (to view the graph) — optional but the point
105
105
 
106
106
  ## Install & set up
@@ -115,7 +115,7 @@ npx wendkeep init
115
115
 
116
116
  1. Create the vault folder taxonomy and a templated `README.md` (default vault: `<project>/.<project-name>-vault`, e.g. `.MyApp-vault`; override with `--vault`).
117
117
  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
- 3. Wire the Codex hooks in **`.codex/hooks.json`** — eleven compatible entries: `brain-inject` + `session-start` + `observer-publish` on `SessionStart`, `session-ensure` + `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. `observer-publish` keeps the sanitized index projection and also sends the local SQL authority with documents, consumption, and transcripts; it does not replace the local lifecycle. 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. 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**.
118
+ 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. `observer-publish` keeps the sanitized index projection and also sends the local SQL authority with documents, consumption, and transcripts; it does not replace the local lifecycle. 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. 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
119
  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`.)
120
120
  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:
121
121
  - **`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`.
@@ -125,7 +125,7 @@ npx wendkeep init
125
125
 
126
126
  Control with `--companions <csv>` or `--no-companions`. The Claude Code plugin layer (`extraKnownMarketplaces` + `enabledPlugins`) is wired as a bonus where the companion has one.
127
127
  6. Install a **color system** into the vault's `.obsidian/`: a CSS snippet that accents notes by type (session/decision/bug/learning, via the `cssclasses` the hooks emit) plus graph color groups by folder. Non-destructive merge into `appearance.json`/`graph.json`; skip with `--no-colors`. Re-apply it any time on an existing vault with `wendkeep theme sync` — Obsidian owns `graph.json` and can drop the color groups (a grey graph); the re-sync restores them without a full re-`init`.
128
- 7. Seed **Shared Project Memory v2** without overwriting existing artifacts: `.brain/CORE.md` (hand-curated canonical truth), `.brain/SHARED_MEMORY.md` (generated operational state), `.brain/MEMORY_EVENTS.jsonl` (append-only ledger), `.brain/MEMORY_CANDIDATES.jsonl` (curation queue), and `.brain/COMPACTION_PROTOCOL.md`. The durable outbox appears under `.brain/memory-outbox/` when events exist; `DIGEST.md` and `index.jsonl` remain deep recall. Everything stays local to the vault.
128
+ 7. Seed **Shared Project Memory v2** without overwriting existing artifacts: `.brain/CORE.md`, `.brain/SHARED_MEMORY.md`, `.brain/MEMORY_EVENTS.jsonl`, `.brain/MEMORY_CANDIDATES.jsonl`, and `.brain/COMPACTION_PROTOCOL.md`. The durable outbox appears under `.brain/memory-outbox/`; `EVIDENCE_INDEX.jsonl` is rebuilt locally from chunks while `DIGEST.md`/`index.jsonl` remain compatible. Everything stays in the vault.
129
129
  8. Seed the **definitions + skills layer**: `.brain/agents/` + `.brain/skills/` (versioned source of truth), including the native process skills `wk-workflow` / `wk-tdd` / `wk-debugging` / `wk-brainstorming` / `wk-planning` / `wk-verify` (some ship templates — e.g. `wk-verify`'s `verdict-template.json` + reviewer prompt). `init` runs `wendkeep sync-defs` for you, delivering the skills to `.claude/skills/` and `.agents/skills/`, and the agent definitions (`.brain/agents/*.toml`) to `.codex/agents/`, plus a managed section in `AGENTS.md` that indexes the skills for Codex; `sync-defs --check` detects stale copies (re-run `sync-defs` after editing `.brain`).
130
130
  9. Seed the **change/spec lifecycle**: the `07-Specs/` + `08-Mudanças/` folders and a native `wendkeep.sensors.json` — critical memory validation/health sensors plus one for each of `typecheck` / `test` / `lint` / `build` found in your `package.json`. `memory-health` blocks delivery on corruption or projection divergence; semantic conflicts degrade only the affected keys and await curation. Pending outbox events and ordinary candidates are warnings. Add sensors with `wendkeep sensors add`. Drives `wendkeep change` / `wendkeep verify` — see **Change lifecycle** below.
131
131
 
@@ -332,9 +332,9 @@ spec, or ADR. If delivery requires a code/config edit, it pauses and work return
332
332
  `implementation`:
333
333
 
334
334
  ```bash
335
- npx wendkeep delivery start release-0-73-0 --allow git:merge --allow git:push --allow publish --source-change <slug> --source-commit <sha>
336
- npx wendkeep delivery status release-0-73-0
337
- npx wendkeep delivery finish release-0-73-0 --target main --ci-url <url> --version 0.73.0 --npm-integrity <sha512> --release-url <url>
335
+ npx wendkeep delivery start release-0-74-0 --allow git:merge --allow git:push --allow publish --source-change <slug> --source-commit <sha>
336
+ npx wendkeep delivery status release-0-74-0
337
+ npx wendkeep delivery finish release-0-74-0 --target main --ci-url <url> --version 0.74.0 --npm-integrity <sha512> --release-url <url>
338
338
  ```
339
339
 
340
340
  If the harness does not record a lease, a small fix remains under the configured profile —
@@ -369,6 +369,8 @@ Hot memory now separates human authorship, operational state, and evidence:
369
369
  - **`SHARED_MEMORY.md` is generated operational state.** The `Stop` hook turns the session handoff into sanitized events; the projector deterministically reduces the ledger and publishes a verifiable revision, cursor, and hash. Facts are `verified` only with local evidence; unsupported reports remain `reported`, and disagreements become candidates for human judgment.
370
370
  - **`MEMORY_EVENTS.jsonl` is the append-only authority.** `Stop` makes events durable in the outbox before acknowledging the attempt; the projector runs outside the registry lock and retries reuse the same IDs. Repeating an identical `event_id`/payload is a no-op; reusing the ID with different bytes is observable corruption.
371
371
  - **`MEMORY_CANDIDATES.jsonl` is the curation queue.** Conflicts and legacy content are never silently promoted. `promote` and `reject` record the decision as a new event; promotion preserves the selected event's JSON type, session, activation/epoch, and source turn.
372
+ - **Registers are scoped.** `git.local-head`, handoffs, verdicts, and change status carry project, work-session, change, branch, or worktree scope. Two branches do not create a global conflict; only events in the same scope and causal lineage may advance automatically.
373
+ - **`EVIDENCE_INDEX.jsonl` is local recall.** Markdown is chunked by headings and blocks without requiring the Observer. Ranking combines BM25, exact phrases, field weights, authority, validity, bounded recency, and source diversity; `UserPromptSubmit` injects only relevant passages with provenance.
372
374
 
373
375
  Artifacts stay under `.brain/` only. Sanitization strips secrets, tokens, local paths, transcripts, and harness payloads both before persistence and before injection. Events carry a `project_id`, and one vault never accepts another project's events.
374
376
 
@@ -390,6 +392,8 @@ Codex uses `session_id`/`turn_id` plus transcript order, with no artificial caus
390
392
  npx --no-install wendkeep memory status --gate --vault .MyApp-vault
391
393
  npx --no-install wendkeep memory migrate --vault .MyApp-vault # preview, zero writes
392
394
  npx --no-install wendkeep memory migrate --apply --vault .MyApp-vault # backup + candidates + v2 bundle
395
+ npx --no-install wendkeep memory rescope --vault .MyApp-vault # preview without values
396
+ npx --no-install wendkeep memory rescope --apply --vault .MyApp-vault # append-only and idempotent
393
397
  ```
394
398
 
395
399
  ### Health and recovery
@@ -30,6 +30,7 @@ Pass the vault explicitly in automation. Preserve backups and evidence before re
30
30
  npx wendkeep memory status [--gate] --vault <vault>
31
31
  npx wendkeep memory curate --vault <vault>
32
32
  npx wendkeep memory candidates [--active] --vault <vault>
33
+ npx wendkeep memory rescope [--apply] --vault <vault>
33
34
  npx wendkeep memory repair --vault <vault>
34
35
  npx wendkeep memory recover-attempt <session> [--apply] --vault <vault>
35
36
  npx wendkeep memory reconcile <ambiguous-session> --by-session <successor-session> --reason <reason> [--apply] --vault <vault>
@@ -51,7 +52,7 @@ npx wendkeep validate-memory --vault <v2-vault>
51
52
  non-TTY environment it exits `2` without changing bytes and recommends the advanced fallback
52
53
  `memory candidates --active`.
53
54
  - `memory candidates` is read-only and prints deterministic JSON containing only `candidate_id`,
54
- `reason`, `status`, `memory_key`, and `event_ids`; it does not expose memory values or content and
55
+ `reason`, `status`, `memory_key`, scope when present, and `event_ids`; it does not expose memory values or content and
55
56
  does not create a lock or mutate the bundle. `--active` omits terminal candidates (`resolved`,
56
57
  `rejected`, and `superseded`). A missing status is normalized to `active`.
57
58
  - For `memory candidates`, exit `0` means a valid inventory (including empty or conflicted), exit
@@ -95,6 +96,18 @@ npx wendkeep validate-memory --vault <v2-vault>
95
96
  and its successor. Replay is CORE-aware, checkpoints use the physical ledger cursor, and the
96
97
  command neither rewrites ledger/CORE/notes nor consumes the outbox. Retrying the same applied
97
98
  decision is idempotent.
99
+ - `memory rescope` is a dry run by default and lists only planned IDs, keys, and scopes. With
100
+ `--apply`, it appends explicit project, work-session, change, branch, or worktree events while
101
+ preserving historic bytes as the ledger prefix. Ambiguous candidates are neither migrated nor
102
+ assigned a winner; retry returns `unchanged`.
103
+ - Registers such as `git.local-head`, `handoff.latest`, `quality.latest-*`, and
104
+ `change.<slug>.status` compete only inside the same scope. Automatic resolution still requires
105
+ the same project and causal lineage; incompatible decisions, constraints, and blockers remain
106
+ human-curated. An ambiguous key is omitted from SHARED without removing CORE or independent keys.
107
+ - `.brain/EVIDENCE_INDEX.jsonl` chunks documents by heading and block and records file, heading,
108
+ type, change, session, work session, authority, date, validity, and hash. `/brain-recall` and the
109
+ `UserPromptSubmit` hook use BM25, exact phrase, field weights, authority, validity, bounded
110
+ recency, and diversity to return the matching passage with provenance.
98
111
  - Every memory path validates the physical topology of `.brain`, ledger, outbox, CORE, SHARED,
99
112
  candidates, registry, notes, backups, temporary files, and sidecars before reading or writing.
100
113
  Junctions, symlinks, reparse points, or hardlinks fail closed without touching external bytes.
@@ -136,6 +149,8 @@ npx wendkeep validate-memory --vault <v2-vault>
136
149
  npx wendkeep memory status --gate --vault .MyApp-vault
137
150
  npx wendkeep memory curate --vault .MyApp-vault
138
151
  npx wendkeep memory candidates --active --vault .MyApp-vault
152
+ npx wendkeep memory rescope --vault .MyApp-vault
153
+ npx wendkeep memory rescope --apply --vault .MyApp-vault
139
154
  npx wendkeep memory recover-attempt session-123 --vault .MyApp-vault
140
155
  npx wendkeep memory recover-attempt session-123 --apply --vault .MyApp-vault
141
156
  npx wendkeep memory reconcile old --by-session current --reason "delivery continued" --vault .MyApp-vault
@@ -96,6 +96,12 @@ cost/token total recorded in frontmatter is preserved through an explicit reconc
96
96
  the detailed ledger does not add up; that row does not invent calls. Historical sessions sharing
97
97
  one `session_id` receive a canonical per-file identity so one rollup cannot overwrite the other.
98
98
 
99
+ In schema 4, each ingested document is also projected into chunks carrying path, heading,
100
+ authority, time, and validity. The Observer feature-probes FTS5 and uses the index when the
101
+ extension is available; otherwise it preserves the same semantics through a lexical fallback.
102
+ Search returns the passage containing the match and its provenance rather than only the beginning
103
+ of the document.
104
+
99
105
  `init` projects `observer-publish` into `SessionStart`, `Stop`, and `SubagentStop` after the primary
100
106
  hooks. When the server is unavailable, it writes snapshots to `.brain/observer-outbox/` and SQL
101
107
  events to `.brain/observer-sql-outbox/` without blocking the session; a later run retries the
@@ -139,7 +145,8 @@ complete, archive, repair, or promote state.
139
145
  rollups, calls, and transcripts.
140
146
  - `GET /v1/projects/:project_id/memory/tree` — document tree and metadata.
141
147
  - `GET /v1/projects/:project_id/memory/document?path=...` — complete Markdown content.
142
- - `GET /v1/projects/:project_id/memory/search?q=...` — path and body search.
148
+ - `GET /v1/projects/:project_id/memory/search?q=...` — ranked chunk search with matching passage
149
+ and provenance; uses a lexical fallback when FTS5 is unavailable.
143
150
  - `GET /v1/projects/:project_id/sync` — mode, counts, conflicts, and latest event.
144
151
  - `PUT /v1/projects/:project_id/sync` — compatibility configuration; SQL remains authoritative.
145
152
  - `GET /v1/projects/:project_id/memory/export` — read-only export with complete content.
@@ -248,7 +248,7 @@ Deliver an approved version without manufacturing another change:
248
248
  ```bash
249
249
  npx wendkeep delivery start release-0-73-0 --source-change proportional-governance --allow git:merge --allow git:push --allow publish
250
250
  npx wendkeep delivery status release-0-73-0
251
- npx wendkeep delivery finish release-0-73-0 --target v0.73.0 --ci-url <run> --version 0.73.0 --npm-integrity <sha512> --release-url <release>
251
+ npx wendkeep delivery finish release-0-74-0 --target v0.74.0 --ci-url <run> --version 0.74.0 --npm-integrity <sha512> --release-url <release>
252
252
  ```
253
253
 
254
254
  ## Expected result
@@ -30,6 +30,7 @@ Informe o vault explicitamente em automações. Preserve backups e evidências a
30
30
  npx wendkeep memory status [--gate] --vault <cofre>
31
31
  npx wendkeep memory curate --vault <cofre>
32
32
  npx wendkeep memory candidates [--active] --vault <cofre>
33
+ npx wendkeep memory rescope [--apply] --vault <cofre>
33
34
  npx wendkeep memory repair --vault <cofre>
34
35
  npx wendkeep memory recover-attempt <sessão> [--apply] --vault <cofre>
35
36
  npx wendkeep memory reconcile <sessão-ambígua> --by-session <sessão-sucessora> --reason <motivo> [--apply] --vault <cofre>
@@ -51,7 +52,7 @@ npx wendkeep validate-memory --vault <cofre-v2>
51
52
  não-TTY/terminal não interativo, ele retorna exit `2` sem alterar bytes e orienta usar o fallback
52
53
  avançado `memory candidates --active`.
53
54
  - `memory candidates` é read-only e imprime JSON determinístico com somente `candidate_id`,
54
- `reason`, `status`, `memory_key` e `event_ids`; não expõe valores nem conteúdo da memória e não
55
+ `reason`, `status`, `memory_key`, escopo quando presente e `event_ids`; não expõe valores nem conteúdo da memória e não
55
56
  cria lock nem altera o bundle. `--active` omite candidates terminais (`resolved`, `rejected` e
56
57
  `superseded`). Status ausente é normalizado para `active`.
57
58
  - Em `memory candidates`, exit `0` indica inventário válido (inclusive vazio ou com conflitos),
@@ -95,6 +96,18 @@ npx wendkeep validate-memory --vault <cofre-v2>
95
96
  do attempt exato, salva backup do registry e limita a mutação ao attempt ambíguo e à sucessora.
96
97
  O replay é CORE-aware, usa cursor físico do ledger no checkpoint e não reescreve ledger, CORE ou
97
98
  notas, nem consome a outbox. Repetir a mesma decisão aplicada é idempotente.
99
+ - `memory rescope` é dry-run por padrão e lista somente IDs, chaves e escopos planejados. Com
100
+ `--apply`, anexa eventos explícitos de projeto, work session, change, branch ou worktree e mantém
101
+ os bytes históricos como prefixo do ledger. Candidates ambíguos não são migrados nem recebem
102
+ vencedor; uma repetição retorna `unchanged`.
103
+ - Registradores como `git.local-head`, `handoff.latest`, `quality.latest-*` e
104
+ `change.<slug>.status` só competem dentro do mesmo escopo. Resolução automática ainda exige o
105
+ mesmo projeto e linhagem causal; decisões, constraints e blockers incompatíveis permanecem sob
106
+ curadoria. Uma chave ambígua é omitida de SHARED sem remover CORE ou chaves independentes.
107
+ - `.brain/EVIDENCE_INDEX.jsonl` divide documentos por headings e blocos e registra arquivo,
108
+ heading, tipo, change, sessão, work session, autoridade, data, validade e hash. `/brain-recall`
109
+ e o hook `UserPromptSubmit` usam BM25, frase exata, pesos por campo, autoridade, validade,
110
+ recência limitada e diversidade para retornar o trecho do match com proveniência.
98
111
  - Toda rota de memória valida a topologia física de `.brain`, ledger, outbox, CORE, SHARED,
99
112
  candidates, registry, notas, backups, temporários e sidecars antes de ler ou escrever. Junction,
100
113
  symlink, reparse point ou hardlink falham fechados sem tocar bytes externos. Locks publicam owner
@@ -134,6 +147,8 @@ npx wendkeep validate-memory --vault <cofre-v2>
134
147
  npx wendkeep memory status --gate --vault .MeuApp-vault
135
148
  npx wendkeep memory curate --vault .MeuApp-vault
136
149
  npx wendkeep memory candidates --active --vault .MeuApp-vault
150
+ npx wendkeep memory rescope --vault .MeuApp-vault
151
+ npx wendkeep memory rescope --apply --vault .MeuApp-vault
137
152
  npx wendkeep memory recover-attempt sessao-123 --vault .MeuApp-vault
138
153
  npx wendkeep memory recover-attempt sessao-123 --apply --vault .MeuApp-vault
139
154
  npx wendkeep memory reconcile antiga --by-session atual --reason "entrega continuada" --vault .MeuApp-vault
@@ -98,6 +98,11 @@ reconciliação quando o ledger detalhado não fecha com ele; essa linha não in
98
98
  Sessões históricas com o mesmo `session_id` recebem uma identidade canônica por arquivo para
99
99
  evitar que um rollup sobrescreva o outro.
100
100
 
101
+ No schema 4, cada documento ingerido também é projetado em chunks com caminho, heading,
102
+ autoridade, data e validade. O Observer faz um feature probe de FTS5 e usa o índice quando a
103
+ extensão está disponível; caso contrário, mantém a mesma semântica por fallback lexical. A busca
104
+ retorna o trecho em que houve o match e sua proveniência, não apenas o começo do documento.
105
+
101
106
  O `init` projeta `observer-publish` para `SessionStart`, `Stop` e `SubagentStop` depois dos hooks
102
107
  principais. Sem servidor disponível, ele grava snapshots em `.brain/observer-outbox/` e eventos
103
108
  SQL em `.brain/observer-sql-outbox/`, sem bloquear a sessão; uma execução posterior tenta
@@ -140,7 +145,8 @@ corte. As telas do Observer não concluem, arquivam, reparam ou promovem estado.
140
145
  chamadas e transcripts.
141
146
  - `GET /v1/projects/:project_id/memory/tree` — árvore e metadados dos documentos.
142
147
  - `GET /v1/projects/:project_id/memory/document?path=...` — conteúdo Markdown integral.
143
- - `GET /v1/projects/:project_id/memory/search?q=...` — busca no caminho e no corpo.
148
+ - `GET /v1/projects/:project_id/memory/search?q=...` — busca ranqueada por chunks, com trecho do
149
+ match e proveniência; usa fallback lexical quando FTS5 não está disponível.
144
150
  - `GET /v1/projects/:project_id/sync` — modo, contagem, conflitos e último evento.
145
151
  - `PUT /v1/projects/:project_id/sync` — compatibilidade de configuração; a autoridade continua SQL.
146
152
  - `GET /v1/projects/:project_id/memory/export` — exportação read-only com conteúdo completo.
@@ -247,7 +247,7 @@ Entregar uma versão já aprovada sem fabricar outra change:
247
247
  ```bash
248
248
  npx wendkeep delivery start release-0-73-0 --source-change governanca-proporcional --allow git:merge --allow git:push --allow publish
249
249
  npx wendkeep delivery status release-0-73-0
250
- npx wendkeep delivery finish release-0-73-0 --target v0.73.0 --ci-url <run> --version 0.73.0 --npm-integrity <sha512> --release-url <release>
250
+ npx wendkeep delivery finish release-0-74-0 --target v0.74.0 --ci-url <run> --version 0.74.0 --npm-integrity <sha512> --release-url <release>
251
251
  ```
252
252
 
253
253
  ## Resultado esperado
@@ -5,6 +5,7 @@ import { basename, join } from 'node:path';
5
5
  import { ensureDir, stripYamlQuotes, toVaultRelative } from './obsidian-common.mjs';
6
6
  import { getLocale } from './locale.mjs';
7
7
  import { sanitizeMemoryText } from './memory-schema.mjs';
8
+ import { buildEvidenceIndex } from './evidence-recall.mjs';
8
9
 
9
10
  export function brainDir(vaultBase) {
10
11
  return join(vaultBase, '.brain');
@@ -85,6 +86,7 @@ export function buildBrainIndex(vaultBase) {
85
86
  ensureDir(brainDir(vaultBase));
86
87
  const out = rows.map((r) => JSON.stringify(r)).join('\n') + (rows.length ? '\n' : '');
87
88
  writeFileSync(join(brainDir(vaultBase), 'index.jsonl'), out, 'utf8');
89
+ buildEvidenceIndex(vaultBase);
88
90
  return rows;
89
91
  }
90
92
 
@@ -4,10 +4,12 @@
4
4
  import { pathToFileURL } from 'node:url';
5
5
  import { getVaultBase } from './obsidian-common.mjs';
6
6
  import { loadIndex } from './brain-core.mjs';
7
+ import { loadEvidenceIndex, recallEvidence } from './evidence-recall.mjs';
7
8
 
8
9
  export { loadIndex };
9
10
 
10
11
  export function scoreRows(rows, query, topK = 5) {
12
+ if (rows.some((row) => row?.chunk_id)) return recallEvidence(rows, query, { topK });
11
13
  const terms = String(query).toLowerCase().split(/\s+/).filter(Boolean);
12
14
  if (!terms.length) return [];
13
15
  return rows
@@ -27,6 +29,8 @@ export function scoreRows(rows, query, topK = 5) {
27
29
 
28
30
  if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
29
31
  const vaultBase = getVaultBase();
30
- const hits = scoreRows(loadIndex(vaultBase), process.argv.slice(2).join(' '));
32
+ const query = process.argv.slice(2).join(' ');
33
+ const evidence = loadEvidenceIndex(vaultBase);
34
+ const hits = evidence.length ? recallEvidence(evidence, query, { topK: 5 }) : scoreRows(loadIndex(vaultBase), query);
31
35
  process.stdout.write(JSON.stringify(hits, null, 2) + '\n');
32
36
  }
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ // UserPromptSubmit: bounded, read-only retrieval from the local evidence index.
3
+ import { pathToFileURL } from 'node:url';
4
+ import { readHookInput, writeHookOutput } from './obsidian-common.mjs';
5
+ import { loadEvidenceIndex, recallEvidence, renderEvidenceContext } from './evidence-recall.mjs';
6
+ import { sanitizeMemoryText } from './memory-schema.mjs';
7
+ import { resolveHookOperatingProfile } from './operating-profile-runtime.mjs';
8
+ import { isBootstrapPrompt } from '../packages/integrations/src/prompt-content.mjs';
9
+
10
+ export function buildPromptEvidenceContext(vaultBase, prompt, {
11
+ topK = 3, maxBytes = 3072, rows = null,
12
+ } = {}) {
13
+ const query = sanitizeMemoryText(String(prompt || '')).trim();
14
+ if (!query || isBootstrapPrompt(query)) return '';
15
+ const evidence = rows || loadEvidenceIndex(vaultBase);
16
+ if (!evidence.length) return '';
17
+ return sanitizeMemoryText(renderEvidenceContext(
18
+ recallEvidence(evidence, query, { topK }),
19
+ { maxBytes },
20
+ ));
21
+ }
22
+
23
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
24
+ try {
25
+ const input = readHookInput();
26
+ const runtime = resolveHookOperatingProfile({ input });
27
+ if (runtime.bindingError) {
28
+ writeHookOutput({});
29
+ } else {
30
+ const context = buildPromptEvidenceContext(
31
+ runtime.vaultBase,
32
+ input.prompt || input.user_prompt || '',
33
+ );
34
+ writeHookOutput(context ? {
35
+ hookSpecificOutput: { hookEventName: 'UserPromptSubmit', additionalContext: context },
36
+ } : {});
37
+ }
38
+ } catch {
39
+ writeHookOutput({});
40
+ }
41
+ }
@@ -0,0 +1 @@
1
+ export * from '../packages/vault/src/evidence-recall.mjs';
@@ -0,0 +1 @@
1
+ export * from '../packages/vault/src/memory-scope.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wendkeep",
3
- "version": "0.73.0",
3
+ "version": "0.74.0",
4
4
  "description": "Vault-first persistent memory for AI coding agents, with an optional profile-aware governance runtime: OFF, FLOW, GUIDE, GOVERN, or ASSURE. Local-first and agent-agnostic (Claude Code, Codex, Cursor…).",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -41,7 +41,7 @@
41
41
  "node": ">=18"
42
42
  },
43
43
  "scripts": {
44
- "check": "node --check scripts/release.mjs && node --check scripts/release-plan.mjs && node --check scripts/release-provenance.mjs && node --check scripts/run-scope.mjs && node --check src/release-provenance.mjs && node --check bin/wendkeep.mjs && node --check packages/cli/src/index.mjs && node --check src/init.mjs && node --check src/doctor.mjs && node --check src/project-vault.mjs && node --check src/observer-auth.mjs && node --check src/observer-privacy.mjs && node --check src/observer-snapshot.mjs && node --check src/observer-store.mjs && node --check src/observer-memory.mjs && node --check src/observer-memory-publish.mjs && node --check src/observer-sql-store.mjs && node --check src/observer-sql-migrate.mjs && node --check src/observer-sql-publish.mjs && node --check src/observer-transcript-store.mjs && node --check src/observer-server.mjs && node --check src/observer.mjs && node --check src/observer-publish.mjs && node --check src/operating-profile.mjs && node --check src/profile.mjs && node --check src/flow.mjs && node --check src/work-kind.mjs && node --check src/delivery.mjs && node --check web/observer/app.mjs && node --check hooks/observer-publish.mjs && node --check hooks/operating-profile-runtime.mjs && node --check hooks/operating-profile-task-store.mjs && node --check hooks/flow-core.mjs && node --check hooks/flow-protected-policy.mjs && node --check hooks/git-snapshot.mjs && node --check hooks/vault-path-safety.mjs && node --check hooks/vault-runtime-store.mjs && node --check packages/harness/src/index.mjs && node --check packages/harness/src/flow-store.mjs && node --check packages/harness/src/operating-profile.mjs && node --check packages/harness/src/sensors-core.mjs && node --check packages/integrations/src/host-hooks.mjs && node --check packages/integrations/src/hook-envelope.mjs && node --check packages/integrations/src/prompt-content.mjs && node --check packages/integrations/src/transcript-usage.mjs && node --check packages/integrations/src/transcripts.mjs && node --check packages/integrations/src/session-identity.mjs && node --check packages/integrations/src/index.mjs && node --check packages/mcp/src/config.mjs && node --check packages/mcp/src/index.mjs && node --check packages/vault/src/index.mjs && node --check packages/vault/src/project-vault.mjs && node --check packages/vault/src/vault-path-safety.mjs && node --check packages/vault/src/locale.mjs && node --check packages/vault/src/memory-schema.mjs && node --check packages/vault/src/memory-mode.mjs && node --check packages/vault/src/memory-handoff.mjs && node --check packages/vault/src/memory-store.mjs && node --check packages/vault/src/validate-core.mjs && node --check packages/vault/src/validate-memory.mjs",
44
+ "check": "node --check scripts/release.mjs && node --check scripts/release-plan.mjs && node --check scripts/release-provenance.mjs && node --check scripts/run-scope.mjs && node --check src/release-provenance.mjs && node --check bin/wendkeep.mjs && node --check packages/cli/src/index.mjs && node --check src/init.mjs && node --check src/doctor.mjs && node --check src/project-vault.mjs && node --check src/observer-auth.mjs && node --check src/observer-privacy.mjs && node --check src/observer-snapshot.mjs && node --check src/observer-store.mjs && node --check src/observer-memory.mjs && node --check src/observer-memory-publish.mjs && node --check src/observer-sql-store.mjs && node --check src/observer-sql-migrate.mjs && node --check src/observer-sql-publish.mjs && node --check src/observer-transcript-store.mjs && node --check src/observer-server.mjs && node --check src/observer.mjs && node --check src/observer-publish.mjs && node --check src/operating-profile.mjs && node --check src/profile.mjs && node --check src/flow.mjs && node --check src/work-kind.mjs && node --check src/delivery.mjs && node --check web/observer/app.mjs && node --check hooks/observer-publish.mjs && node --check hooks/evidence-context.mjs && node --check hooks/evidence-recall.mjs && node --check hooks/memory-scope.mjs && node --check hooks/operating-profile-runtime.mjs && node --check hooks/operating-profile-task-store.mjs && node --check hooks/flow-core.mjs && node --check hooks/flow-protected-policy.mjs && node --check hooks/git-snapshot.mjs && node --check hooks/vault-path-safety.mjs && node --check hooks/vault-runtime-store.mjs && node --check packages/harness/src/index.mjs && node --check packages/harness/src/flow-store.mjs && node --check packages/harness/src/operating-profile.mjs && node --check packages/harness/src/sensors-core.mjs && node --check packages/integrations/src/host-hooks.mjs && node --check packages/integrations/src/hook-envelope.mjs && node --check packages/integrations/src/prompt-content.mjs && node --check packages/integrations/src/transcript-usage.mjs && node --check packages/integrations/src/transcripts.mjs && node --check packages/integrations/src/session-identity.mjs && node --check packages/integrations/src/index.mjs && node --check packages/mcp/src/config.mjs && node --check packages/mcp/src/index.mjs && node --check packages/vault/src/index.mjs && node --check packages/vault/src/project-vault.mjs && node --check packages/vault/src/vault-path-safety.mjs && node --check packages/vault/src/locale.mjs && node --check packages/vault/src/memory-schema.mjs && node --check packages/vault/src/memory-mode.mjs && node --check packages/vault/src/memory-scope.mjs && node --check packages/vault/src/evidence-recall.mjs && node --check packages/vault/src/memory-handoff.mjs && node --check packages/vault/src/memory-store.mjs && node --check packages/vault/src/validate-core.mjs && node --check packages/vault/src/validate-memory.mjs",
45
45
  "test": "node --test --test-concurrency=2",
46
46
  "test:core": "node scripts/run-scope.mjs core",
47
47
  "release": "node scripts/release.mjs",
@@ -104,7 +104,7 @@ Usage:
104
104
  wendkeep lesson add "t" "l" Record a project-local lesson (injected at SessionStart).
105
105
  wendkeep memory curate Guide one semantic conflict at a time in an interactive terminal.
106
106
  Every promote/reject requires confirmation; --vault P.
107
- wendkeep memory <sub> Shared memory v2: status | candidates [--active] | curate | migrate [--apply] | repair |
107
+ wendkeep memory <sub> Shared memory v2: status | candidates [--active] | curate | migrate [--apply] | rescope [--apply] | repair |
108
108
  recover-attempt <session> [--apply] |
109
109
  reconcile <session> --by-session <session> --reason <text> [--apply] |
110
110
  promote <candidate> [--event <event-id>] | reject <candidate>. --vault P.
@@ -19,6 +19,7 @@ export const SESSION_HOOKS = [
19
19
  { event: 'Stop', matcher: null, name: 'session-stop', timeout: 60, codex: true, statusMessage: 'wendkeep: writing session checkpoint' },
20
20
  { event: 'Stop', matcher: null, name: 'observer-publish', timeout: 5, order: 20, codex: true, statusMessage: 'wendkeep: publishing local observer snapshot' },
21
21
  { event: 'UserPromptSubmit', matcher: null, name: 'session-ensure', timeout: 30, codex: true, statusMessage: 'wendkeep: ensuring active session' },
22
+ { event: 'UserPromptSubmit', matcher: null, name: 'evidence-context', timeout: 10, order: 5, codex: true, statusMessage: 'wendkeep: retrieving relevant evidence' },
22
23
  // Capture an interactive decision (AskUserQuestion) — options + the user's choice — into 04-Decisões.
23
24
  // codex: AskUserQuestion is a Claude-only tool; there is nothing to match on.
24
25
  { event: 'PostToolUse', matcher: 'AskUserQuestion', name: 'decision-capture', timeout: 15, statusMessage: 'wendkeep: recording decision' },