wendkeep 0.66.5 → 0.67.1
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 +52 -0
- package/README.en.md +76 -3
- package/README.md +76 -3
- package/docs/en/commands/operating-profiles.md +65 -10
- package/docs/en/commands/sessions-and-import.md +34 -9
- package/docs/en/commands/verify.md +5 -3
- package/docs/pt-BR/commands/operating-profiles.md +66 -11
- package/docs/pt-BR/commands/sessions-and-import.md +33 -8
- package/docs/pt-BR/commands/verify.md +6 -3
- package/hooks/change-nag.mjs +8 -0
- package/hooks/obsidian-common.mjs +7 -0
- package/hooks/operating-profile-runtime.mjs +36 -2
- package/hooks/operating-profile-task-store.mjs +77 -0
- package/hooks/session-backfill.mjs +26 -1
- package/hooks/session-ensure.mjs +22 -0
- package/hooks/session-stop.mjs +129 -7
- package/hooks/subagent-stop.mjs +35 -3
- package/package.json +3 -3
- package/packages/cli/src/index.mjs +3 -3
- package/packages/harness/src/operating-profile.mjs +127 -0
- package/packages/harness/src/sensors-core.mjs +41 -1
- package/packages/integrations/src/prompt-content.mjs +123 -0
- package/packages/integrations/src/transcripts.mjs +26 -10
- package/src/profile.mjs +95 -17
- package/src/skills-seed.mjs +38 -2
- package/src/sync-defs.mjs +16 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,58 @@ 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.67.1] — 2026-08-02
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **Turnos de subagents não bloqueiam mais a captura da sessão-mãe.** `UserPromptSubmit` de rollout
|
|
12
|
+
filho registra o path para observabilidade sem avançar a sequência principal, e `SessionStop`
|
|
13
|
+
prefere o mapeamento causal `turn_sequences[turn_id]` antes da ordem local do transcript. Isso
|
|
14
|
+
preserva os marcadores `wk-turn`, o encerramento e a memória mesmo com filhos intercalados.
|
|
15
|
+
- **`SubagentStop` consome o transcript correto do payload Codex.** O hook resolve o filho por
|
|
16
|
+
`agent_transcript_path`/`agentTranscriptPath`, valida identidade, sessão e `parent_thread_id`
|
|
17
|
+
contra um root comprovado e mantém `transcript_path` como contexto da sessão-mãe, permitindo
|
|
18
|
+
preencher `Subagents e workflows` no último filho sem aceitar sinais de outra cadeia.
|
|
19
|
+
- **O backfill não grava o turno Codex ainda em execução.** `hook session-backfill` exige
|
|
20
|
+
`task_complete`, separa `missingTurns` de `incompleteTurns`, permanece dry-run por padrão e aplica
|
|
21
|
+
somente turnos concluídos de forma idempotente. A CLI agora encaminha `--session`, `--vault`,
|
|
22
|
+
`--write` e demais argumentos ao hook executado. README e guias PT-BR/EN documentam o reparo.
|
|
23
|
+
- **O bloco gerenciado do `AGENTS.md` exige roteamento adaptativo antes de editar.** O harness
|
|
24
|
+
inspeciona o perfil-base, classifica a solicitação, registra uma lease temporária entre `FLOW`,
|
|
25
|
+
`GUIDE`, `GOVERN` e `ASSURE` e confirma o perfil efetivo; `OFF` nunca é escolhido pela LLM e a
|
|
26
|
+
escolha explícita do usuário prevalece.
|
|
27
|
+
- **O scanner de privacidade distingue configuração pública de identificadores privados.** Comandos
|
|
28
|
+
longos legítimos em `wendkeep.sensors.json` deixam de gerar falso positivo, sem permitir que UUID,
|
|
29
|
+
hash, token compacto, campo desconhecido ou path absoluto sejam ocultados pela exceção.
|
|
30
|
+
|
|
31
|
+
## [0.67.0] — 2026-08-01
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- **O harness da LLM pode selecionar uma rota Wend temporária por solicitação.**
|
|
36
|
+
`profile route <FLOW|GUIDE|GOVERN|ASSURE> --session <id> --reason <texto>` grava uma lease
|
|
37
|
+
auditável ligada ao prompt atual, sem alterar o perfil persistente do projeto ou da sessão.
|
|
38
|
+
`OFF` permanece exclusivamente humano e é rejeitado na seleção adaptativa. Contexto sem prompt
|
|
39
|
+
causal completo e coincidente no registry falha antes de mutar, e `profile status --session`
|
|
40
|
+
mostra perfil-base e estado da lease também na saída humana.
|
|
41
|
+
- **A lease expira causalmente sem interromper implementações longas.** Um Stop aceito a consome
|
|
42
|
+
por CAS; bloqueio/retry a preserva, e o próximo prompt restaura o perfil-base mesmo depois de
|
|
43
|
+
crash ou hook ausente. Skills e AGENTS gerados ensinam a matriz FLOW/GUIDE/GOVERN/ASSURE.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- **Sessões Obsidian não renderizam envelopes internos do assistente como HTML.** A captura remove
|
|
48
|
+
metadata completa ou truncada de citação somente das respostas do assistente e escapa tags
|
|
49
|
+
XML-like nas linhas geradas, preservando relatos do usuário e autolinks HTTP(S). Reimport e
|
|
50
|
+
`SessionStop` convergem no mesmo normalizador idempotente, e o encerramento migra somente campos
|
|
51
|
+
gerados reconhecíveis de notas antigas sem reescrever prosa autoral.
|
|
52
|
+
- **README e guias bilíngues explicam as letras `P/R/E/V/C` e a duração das escolhas.** A
|
|
53
|
+
documentação distingue `profile use` persistente de `profile route` por solicitação e deixa
|
|
54
|
+
explícito que a classificação semântica pertence ao harness, não a heurísticas do runtime.
|
|
55
|
+
- **Sensores vermelhos deixam diagnóstico acionável sem persistir logs verdes.** O runner captura
|
|
56
|
+
stdout/stderr com limite, redige segredos e grava no máximo 2.000 caracteres apenas na entrada
|
|
57
|
+
vermelha de `evidencia.json`, em vez de descartar a causa da falha.
|
|
58
|
+
|
|
7
59
|
## [0.66.5] — 2026-08-01
|
|
8
60
|
|
|
9
61
|
### Fixed
|
package/README.en.md
CHANGED
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
**Persistent memory for AI coding agents, built on your Obsidian vault.** Every Claude Code **and Codex** session is captured turn by turn into local Markdown — `init` wires both (Codex asks you to approve its hooks once; `import` backfills past sessions either way) — with token/cost tracking and automatically extracted decisions, bugs, and learnings. That always-on plane is **Keep Core**. On top of it, **Wend Runtime** provides a native, zero-dependency lifecycle (spec → change → TDD → sensor-gated archive), selected through the `OFF`, `FLOW`, `GUIDE`, `GOVERN`, and `ASSURE` Operating Profiles. 100% local, open-core.
|
|
17
17
|
|
|
18
|
+
When projecting sessions, trailing internal metadata is removed only from assistant responses;
|
|
19
|
+
user reports remain intact. XML-like tags are written as escaped text so Obsidian Reading view
|
|
20
|
+
does not interpret them as HTML.
|
|
21
|
+
|
|
18
22
|
The runtime is being separated into six physical boundaries — `cli`, `harness`, `vault`, `mcp`,
|
|
19
23
|
`integrations`, and `pi` — without fragmenting installation. The private `cli`, `harness`,
|
|
20
24
|
`vault`, `mcp`, and `integrations` workspaces now canonically own the executable runtime,
|
|
@@ -235,13 +239,82 @@ deliberate opt-in and runs that command's own validations:
|
|
|
235
239
|
| `GOVERN` | P → R → E → V | Current a2 loop and compatible fallback. |
|
|
236
240
|
| `ASSURE` | P → R → E → V → C | Governance with confirmation and handoff. |
|
|
237
241
|
|
|
242
|
+
A route is a sequence of work stages, not a list of command names:
|
|
243
|
+
|
|
244
|
+
- `P` = **Plan/Propose** — understand the request, bound the scope, and record the approach when a change is needed.
|
|
245
|
+
- `R` = **Review** — inspect the proposal/design before execution; this is the formal a2-loop review.
|
|
246
|
+
- `E` = **Execute** — edit the permitted code or artifacts.
|
|
247
|
+
- `V` = **Validate** — run tests, sensors, and checks and record evidence.
|
|
248
|
+
- `C` = **Confirm/hand off** — obtain explicit confirmation and complete the handoff.
|
|
249
|
+
|
|
250
|
+
Thus, `P → R → E → V` means “plan/propose, review, execute, and validate”. `FLOW` starts at the
|
|
251
|
+
execution/validation microcontract; `OFF` applies no automatic Wend route and returns process
|
|
252
|
+
ownership to the native LLM harness.
|
|
253
|
+
|
|
254
|
+
### Who selects the profile, and for how long?
|
|
255
|
+
|
|
256
|
+
The LLM harness (Codex, Claude, or another agent) **classifies the current implementation** and can
|
|
257
|
+
record a temporary choice with `wendkeep profile route`. Wend Runtime does not interpret prompt
|
|
258
|
+
text or use diff size, heuristics, or environment variables: it validates the choice, applies the
|
|
259
|
+
route in hooks, and expires the lease when the request ends. With no recorded route, the configured
|
|
260
|
+
base profile remains effective.
|
|
261
|
+
|
|
262
|
+
Resolution follows this order:
|
|
263
|
+
|
|
264
|
+
1. a valid lease for the current request in `SESSION_REGISTRY.json`;
|
|
265
|
+
2. a persistent session override in that registry;
|
|
266
|
+
3. `harness.profile` in the project's `.wendkeep.json`;
|
|
267
|
+
4. `GOVERN` when no valid setting exists.
|
|
268
|
+
|
|
269
|
+
Without `--session`, `profile use` changes the **project default** for conversations/hooks that do
|
|
270
|
+
not have a session override. With `--session <id>`, it changes only that session and leaves the
|
|
271
|
+
project default untouched. Therefore, `profile use OFF` without `--session` is not an isolated
|
|
272
|
+
test: it writes the project binding and can be shared if `.wendkeep.json` is committed.
|
|
273
|
+
|
|
274
|
+
`profile route` is different: it requires `--session` and `--reason`, accepts only `FLOW`, `GUIDE`,
|
|
275
|
+
`GOVERN`, or `ASSURE`, does not rewrite the project/persistent override, and applies only to the
|
|
276
|
+
current causal prompt. An accepted `Stop` consumes the lease; if the process dies first, the next
|
|
277
|
+
prompt advances the sequence and makes the old lease ineffective. `OFF` is never selected
|
|
278
|
+
automatically.
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
npx wendkeep profile status
|
|
282
|
+
npx wendkeep profile use GUIDE # project default
|
|
283
|
+
npx wendkeep profile use FLOW --session <id> # one session only
|
|
284
|
+
npx wendkeep profile route FLOW --session <id> --reason "local fix" # current request
|
|
285
|
+
npx wendkeep profile status --session <id> # session-effective profile
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
In human `status --session` output, `base=<profile>/<source>` and `lease=<state>` accompany the
|
|
289
|
+
effective profile; `--json` exposes the same data as `base_profile`, `base_source`, and
|
|
290
|
+
`task_lease`. `profile route` only accepts a session after `UserPromptSubmit` has recorded a
|
|
291
|
+
positive causal turn and sequence that agree in the registry.
|
|
292
|
+
|
|
293
|
+
### Which profile fits a simple request?
|
|
294
|
+
|
|
295
|
+
“Small” describes size, not risk. The harness uses this matrix to choose and record a temporary
|
|
296
|
+
route; semantic inference remains in the agent, not Wend Runtime:
|
|
297
|
+
|
|
298
|
+
| Situation | Suggested profile |
|
|
299
|
+
|---|---|
|
|
300
|
+
| Question, inspection, or diagnosis with no mutation | No profile transition |
|
|
301
|
+
| Local, reversible fix with an allowlist and no contract/spec change | `FLOW` (`E → V`) |
|
|
302
|
+
| Small behavior change that needs a change but not formal Wend Runtime review | `GUIDE` (`P → E → V`) |
|
|
303
|
+
| Normal, ambiguous, public-contract, security, dependency, CI/release, or policy change | `GOVERN` (`P → R → E → V`) |
|
|
304
|
+
| Work requiring explicit confirmation and handoff | `ASSURE` (`P → R → E → V → C`) |
|
|
305
|
+
|
|
306
|
+
If the harness does not record a lease, a small fix remains under the configured profile —
|
|
307
|
+
`GOVERN` by default. `OFF` does not mean “simple task”: it is a persistent human choice that hands
|
|
308
|
+
governance to the native harness. The LLM may temporarily elevate an `OFF` base to a Wend route,
|
|
309
|
+
but it can never select `OFF` on its own.
|
|
310
|
+
|
|
238
311
|
A corrupt binding never selects `OFF`: with one unambiguous explicit or legacy Vault, Keep Core
|
|
239
312
|
remains active under `GOVERN`, the error stays visible, and mutation guards fail closed. Additional
|
|
240
313
|
roots that FLOW must protect can be declared as project-relative paths under
|
|
241
314
|
`harness.flow.protectedRoots` in `.wendkeep.json`; any change below them requires promotion.
|
|
242
315
|
Invalid local config, marker, or identity never silently falls back to a parent/global Vault.
|
|
243
316
|
|
|
244
|
-
`wendkeep profile status/use` makes the choice observable; `wendkeep flow
|
|
317
|
+
`wendkeep profile status/use/route` makes the choice observable; `wendkeep flow
|
|
245
318
|
start/finish/promote` handles local adjustments without manufacturing an ADR and fails closed on
|
|
246
319
|
physical escapes, Git metadata/hidden flags, mutating sensors, protected surfaces, or incomplete
|
|
247
320
|
session projection. Bounded no-follow discovery sees empty/ignored protected aliases; Vault writes
|
|
@@ -312,7 +385,7 @@ acknowledgement pending on 0.66.4 or later, first run the targeted dry run
|
|
|
312
385
|
registry/checkpoint. See syntax, preconditions, and fail-closed behavior in
|
|
313
386
|
[memory and curation](docs/en/commands/memory.md).
|
|
314
387
|
|
|
315
|
-
Session notes use one live `## Agentes, tokens e custos` snapshot. Main-agent and subagent hooks recompose it atomically, with costs, token dimensions, reasoning tokens and effort per model/source. Every hook that rewrites a session note takes a per-file lock and writes through a temp file + rename, so the `SubagentStop` fan-out (one hook run per subagent) can never leave a note half-written; a note whose frontmatter reads back damaged is left untouched rather than patched.
|
|
388
|
+
Session notes use one live `## Agentes, tokens e custos` snapshot. Main-agent and subagent hooks recompose it atomically, with costs, token dimensions, reasoning tokens and effort per model/source. On Codex, subagent prompts register their rollout for observability without advancing the main agent's sequence; `SubagentStop` reads the child from `agent_transcript_path` and persists its signal only when `parent_thread_id` matches a validated session root. The main Stop uses the registry's causal `turn_id` mapping before falling back to local transcript order. To recover missing markers while a conversation is open, `hook session-backfill` is a dry-run by default and never writes a Codex turn without `task_complete`. Every hook that rewrites a session note takes a per-file lock and writes through a temp file + rename, so the `SubagentStop` fan-out (one hook run per subagent) can never leave a note half-written; a note whose frontmatter reads back damaged is left untouched rather than patched.
|
|
316
389
|
|
|
317
390
|
## Retroactive memory (`import`) — install today, remember yesterday
|
|
318
391
|
|
|
@@ -379,7 +452,7 @@ explore → propose → apply (TDD) → verify → archive
|
|
|
379
452
|
|
|
380
453
|
- **Propose** — `wendkeep change new <slug>` scaffolds `08-Mudanças/<slug>/` (`proposta.md`, `design.md`, `tarefas.md`; `--simple` skips the design). 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.
|
|
381
454
|
- **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.
|
|
382
|
-
- **Verify** — `wendkeep verify` runs the sensors your tasks declared (from `wendkeep.sensors.json` at the project root) and writes `evidencia.json`. A red `critical` fails the gate; a red `warning` is advisory. `verify --deep` builds a self-contained package with complete effective requirements (living contract + this change's delta), so the independent verifier never needs to reconstruct unarchived requirements from `07-Specs`. Every change needs a `verdict.json` to archive; `verify --deep` writes a trivial one automatically when the change declares no `[req:]`.
|
|
455
|
+
- **Verify** — `wendkeep verify` runs the sensors your tasks declared (from `wendkeep.sensors.json` at the project root) and writes `evidencia.json`. A red `critical` fails the gate; a red `warning` is advisory. Failures retain only a bounded, sanitized diagnostic; green output is not persisted. `verify --deep` builds a self-contained package with complete effective requirements (living contract + this change's delta), so the independent verifier never needs to reconstruct unarchived requirements from `07-Specs`. Every change needs a `verdict.json` to archive; `verify --deep` writes a trivial one automatically when the change declares no `[req:]`.
|
|
383
456
|
- **Archive** — `wendkeep change archive <slug>` **gates** on the evidence (blocks unless every declared critical sensor is green), promotes each capability's spec delta (`ADDED`/`MODIFIED`/`REMOVED`) into the living `07-Specs/<capability>.md`, moves the change to `_arquivo/`, and mints an ADR in `04-Decisões/`.
|
|
384
457
|
|
|
385
458
|
> The gate blocks unless the scaffold is filled, no task is open, evidence is fresh, and every declared requirement is covered. **`--force` waives exactly one of those — the open-task check — and is the human's call, never the agent's.** An unfilled scaffold, a red critical sensor, stale evidence, an orphan requirement or a missing verdict block regardless.
|
package/README.md
CHANGED
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
**Persistent memory for AI coding agents, built on your Obsidian vault.** Every Claude Code **and Codex** session is captured turn by turn into local Markdown — `init` wires both (Codex asks you to approve its hooks once; `import` backfills past sessions either way) — with token/cost tracking and automatically extracted decisions, bugs, and learnings. That always-on plane is **Keep Core**. On top of it, **Wend Runtime** provides a native, zero-dependency lifecycle (spec → change → TDD → sensor-gated archive), selected through the `OFF`, `FLOW`, `GUIDE`, `GOVERN`, and `ASSURE` Operating Profiles. 100% local, open-core.
|
|
17
17
|
|
|
18
|
+
When projecting sessions, trailing internal metadata is removed only from assistant responses;
|
|
19
|
+
user reports remain intact. XML-like tags are written as escaped text so Obsidian Reading view
|
|
20
|
+
does not interpret them as HTML.
|
|
21
|
+
|
|
18
22
|
The runtime is being separated into six physical boundaries — `cli`, `harness`, `vault`, `mcp`,
|
|
19
23
|
`integrations`, and `pi` — without fragmenting installation. The private `cli`, `harness`,
|
|
20
24
|
`vault`, `mcp`, and `integrations` workspaces now canonically own the executable runtime,
|
|
@@ -235,13 +239,82 @@ deliberate opt-in and runs that command's own validations:
|
|
|
235
239
|
| `GOVERN` | P → R → E → V | Current a2 loop and compatible fallback. |
|
|
236
240
|
| `ASSURE` | P → R → E → V → C | Governance with confirmation and handoff. |
|
|
237
241
|
|
|
242
|
+
A route is a sequence of work stages, not a list of command names:
|
|
243
|
+
|
|
244
|
+
- `P` = **Plan/Propose** — understand the request, bound the scope, and record the approach when a change is needed.
|
|
245
|
+
- `R` = **Review** — inspect the proposal/design before execution; this is the formal a2-loop review.
|
|
246
|
+
- `E` = **Execute** — edit the permitted code or artifacts.
|
|
247
|
+
- `V` = **Validate** — run tests, sensors, and checks and record evidence.
|
|
248
|
+
- `C` = **Confirm/hand off** — obtain explicit confirmation and complete the handoff.
|
|
249
|
+
|
|
250
|
+
Thus, `P → R → E → V` means “plan/propose, review, execute, and validate”. `FLOW` starts at the
|
|
251
|
+
execution/validation microcontract; `OFF` applies no automatic Wend route and returns process
|
|
252
|
+
ownership to the native LLM harness.
|
|
253
|
+
|
|
254
|
+
### Who selects the profile, and for how long?
|
|
255
|
+
|
|
256
|
+
The LLM harness (Codex, Claude, or another agent) **classifies the current implementation** and can
|
|
257
|
+
record a temporary choice with `wendkeep profile route`. Wend Runtime does not interpret prompt
|
|
258
|
+
text or use diff size, heuristics, or environment variables: it validates the choice, applies the
|
|
259
|
+
route in hooks, and expires the lease when the request ends. With no recorded route, the configured
|
|
260
|
+
base profile remains effective.
|
|
261
|
+
|
|
262
|
+
Resolution follows this order:
|
|
263
|
+
|
|
264
|
+
1. a valid lease for the current request in `SESSION_REGISTRY.json`;
|
|
265
|
+
2. a persistent session override in that registry;
|
|
266
|
+
3. `harness.profile` in the project's `.wendkeep.json`;
|
|
267
|
+
4. `GOVERN` when no valid setting exists.
|
|
268
|
+
|
|
269
|
+
Without `--session`, `profile use` changes the **project default** for conversations/hooks that do
|
|
270
|
+
not have a session override. With `--session <id>`, it changes only that session and leaves the
|
|
271
|
+
project default untouched. Therefore, `profile use OFF` without `--session` is not an isolated
|
|
272
|
+
test: it writes the project binding and can be shared if `.wendkeep.json` is committed.
|
|
273
|
+
|
|
274
|
+
`profile route` is different: it requires `--session` and `--reason`, accepts only `FLOW`, `GUIDE`,
|
|
275
|
+
`GOVERN`, or `ASSURE`, does not rewrite the project/persistent override, and applies only to the
|
|
276
|
+
current causal prompt. An accepted `Stop` consumes the lease; if the process dies first, the next
|
|
277
|
+
prompt advances the sequence and makes the old lease ineffective. `OFF` is never selected
|
|
278
|
+
automatically.
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
npx wendkeep profile status
|
|
282
|
+
npx wendkeep profile use GUIDE # project default
|
|
283
|
+
npx wendkeep profile use FLOW --session <id> # one session only
|
|
284
|
+
npx wendkeep profile route FLOW --session <id> --reason "local fix" # current request
|
|
285
|
+
npx wendkeep profile status --session <id> # session-effective profile
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
In human `status --session` output, `base=<profile>/<source>` and `lease=<state>` accompany the
|
|
289
|
+
effective profile; `--json` exposes the same data as `base_profile`, `base_source`, and
|
|
290
|
+
`task_lease`. `profile route` only accepts a session after `UserPromptSubmit` has recorded a
|
|
291
|
+
positive causal turn and sequence that agree in the registry.
|
|
292
|
+
|
|
293
|
+
### Which profile fits a simple request?
|
|
294
|
+
|
|
295
|
+
“Small” describes size, not risk. The harness uses this matrix to choose and record a temporary
|
|
296
|
+
route; semantic inference remains in the agent, not Wend Runtime:
|
|
297
|
+
|
|
298
|
+
| Situation | Suggested profile |
|
|
299
|
+
|---|---|
|
|
300
|
+
| Question, inspection, or diagnosis with no mutation | No profile transition |
|
|
301
|
+
| Local, reversible fix with an allowlist and no contract/spec change | `FLOW` (`E → V`) |
|
|
302
|
+
| Small behavior change that needs a change but not formal Wend Runtime review | `GUIDE` (`P → E → V`) |
|
|
303
|
+
| Normal, ambiguous, public-contract, security, dependency, CI/release, or policy change | `GOVERN` (`P → R → E → V`) |
|
|
304
|
+
| Work requiring explicit confirmation and handoff | `ASSURE` (`P → R → E → V → C`) |
|
|
305
|
+
|
|
306
|
+
If the harness does not record a lease, a small fix remains under the configured profile —
|
|
307
|
+
`GOVERN` by default. `OFF` does not mean “simple task”: it is a persistent human choice that hands
|
|
308
|
+
governance to the native harness. The LLM may temporarily elevate an `OFF` base to a Wend route,
|
|
309
|
+
but it can never select `OFF` on its own.
|
|
310
|
+
|
|
238
311
|
A corrupt binding never selects `OFF`: with one unambiguous explicit or legacy Vault, Keep Core
|
|
239
312
|
remains active under `GOVERN`, the error stays visible, and mutation guards fail closed. Additional
|
|
240
313
|
roots that FLOW must protect can be declared as project-relative paths under
|
|
241
314
|
`harness.flow.protectedRoots` in `.wendkeep.json`; any change below them requires promotion.
|
|
242
315
|
Invalid local config, marker, or identity never silently falls back to a parent/global Vault.
|
|
243
316
|
|
|
244
|
-
`wendkeep profile status/use` makes the choice observable; `wendkeep flow
|
|
317
|
+
`wendkeep profile status/use/route` makes the choice observable; `wendkeep flow
|
|
245
318
|
start/finish/promote` handles local adjustments without manufacturing an ADR and fails closed on
|
|
246
319
|
physical escapes, Git metadata/hidden flags, mutating sensors, protected surfaces, or incomplete
|
|
247
320
|
session projection. Bounded no-follow discovery sees empty/ignored protected aliases; Vault writes
|
|
@@ -312,7 +385,7 @@ acknowledgement pending on 0.66.4 or later, first run the targeted dry run
|
|
|
312
385
|
registry/checkpoint. See syntax, preconditions, and fail-closed behavior in
|
|
313
386
|
[memory and curation](docs/en/commands/memory.md).
|
|
314
387
|
|
|
315
|
-
Session notes use one live `## Agentes, tokens e custos` snapshot. Main-agent and subagent hooks recompose it atomically, with costs, token dimensions, reasoning tokens and effort per model/source. Every hook that rewrites a session note takes a per-file lock and writes through a temp file + rename, so the `SubagentStop` fan-out (one hook run per subagent) can never leave a note half-written; a note whose frontmatter reads back damaged is left untouched rather than patched.
|
|
388
|
+
Session notes use one live `## Agentes, tokens e custos` snapshot. Main-agent and subagent hooks recompose it atomically, with costs, token dimensions, reasoning tokens and effort per model/source. On Codex, subagent prompts register their rollout for observability without advancing the main agent's sequence; `SubagentStop` reads the child from `agent_transcript_path` and persists its signal only when `parent_thread_id` matches a validated session root. The main Stop uses the registry's causal `turn_id` mapping before falling back to local transcript order. To recover missing markers while a conversation is open, `hook session-backfill` is a dry-run by default and never writes a Codex turn without `task_complete`. Every hook that rewrites a session note takes a per-file lock and writes through a temp file + rename, so the `SubagentStop` fan-out (one hook run per subagent) can never leave a note half-written; a note whose frontmatter reads back damaged is left untouched rather than patched.
|
|
316
389
|
|
|
317
390
|
## Retroactive memory (`import`) — install today, remember yesterday
|
|
318
391
|
|
|
@@ -379,7 +452,7 @@ explore → propose → apply (TDD) → verify → archive
|
|
|
379
452
|
|
|
380
453
|
- **Propose** — `wendkeep change new <slug>` scaffolds `08-Mudanças/<slug>/` (`proposta.md`, `design.md`, `tarefas.md`; `--simple` skips the design). 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.
|
|
381
454
|
- **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.
|
|
382
|
-
- **Verify** — `wendkeep verify` runs the sensors your tasks declared (from `wendkeep.sensors.json` at the project root) and writes `evidencia.json`. A red `critical` fails the gate; a red `warning` is advisory. `verify --deep` builds a self-contained package with complete effective requirements (living contract + this change's delta), so the independent verifier never needs to reconstruct unarchived requirements from `07-Specs`. Every change needs a `verdict.json` to archive; `verify --deep` writes a trivial one automatically when the change declares no `[req:]`.
|
|
455
|
+
- **Verify** — `wendkeep verify` runs the sensors your tasks declared (from `wendkeep.sensors.json` at the project root) and writes `evidencia.json`. A red `critical` fails the gate; a red `warning` is advisory. Failures retain only a bounded, sanitized diagnostic; green output is not persisted. `verify --deep` builds a self-contained package with complete effective requirements (living contract + this change's delta), so the independent verifier never needs to reconstruct unarchived requirements from `07-Specs`. Every change needs a `verdict.json` to archive; `verify --deep` writes a trivial one automatically when the change declares no `[req:]`.
|
|
383
456
|
- **Archive** — `wendkeep change archive <slug>` **gates** on the evidence (blocks unless every declared critical sensor is green), promotes each capability's spec delta (`ADDED`/`MODIFIED`/`REMOVED`) into the living `07-Specs/<capability>.md`, moves the change to `_arquivo/`, and mints an ADR in `04-Decisões/`.
|
|
384
457
|
|
|
385
458
|
> 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.
|
|
@@ -14,9 +14,9 @@ opt-in and runs that command's own validations and gates.
|
|
|
14
14
|
|
|
15
15
|
## When to use
|
|
16
16
|
|
|
17
|
-
Use `profile`
|
|
18
|
-
|
|
19
|
-
change.
|
|
17
|
+
Use `profile use` for a persistent human selection and `profile route` for the harness to record
|
|
18
|
+
the temporary route for the current implementation. Use `FLOW` for local, reversible
|
|
19
|
+
`spec_impact:none` maintenance that fits an Execute → Validate microcontract without a change.
|
|
20
20
|
|
|
21
21
|
## When not to use
|
|
22
22
|
|
|
@@ -28,7 +28,8 @@ change.
|
|
|
28
28
|
## Prerequisites
|
|
29
29
|
|
|
30
30
|
- An initialized project whose `.wendkeep.json` is bound to the correct Vault.
|
|
31
|
-
- For
|
|
31
|
+
- For an override or temporary route, one unambiguous session in `SESSION_REGISTRY.json`; `route`
|
|
32
|
+
also requires the current prompt to have a recorded causal frontier.
|
|
32
33
|
- For FLOW, a Git repository, a path allowlist, a reason, and at least one existing sensor in
|
|
33
34
|
`wendkeep.sensors.json`.
|
|
34
35
|
|
|
@@ -37,6 +38,7 @@ change.
|
|
|
37
38
|
```bash
|
|
38
39
|
npx wendkeep profile status [--project <path>] [--vault <path>] [--session <id>] [--json]
|
|
39
40
|
npx wendkeep profile use <profile> [--project <path>] [--vault <path>] [--session <id>] [--json]
|
|
41
|
+
npx wendkeep profile route <FLOW|GUIDE|GOVERN|ASSURE> --session <id> --reason <text> [--project <path>] [--vault <path>] [--json]
|
|
40
42
|
npx wendkeep flow start <slug> --allow <path> [--allow <path>...] --sensor <id> [--sensor <id>...] --reason <text> [--session <id>]
|
|
41
43
|
npx wendkeep flow status [<id>]
|
|
42
44
|
npx wendkeep flow show <id> [--session <id>]
|
|
@@ -75,15 +77,42 @@ Harness. The workspaces remain private and are not published as independent npm
|
|
|
75
77
|
| `GOVERN` | P → R → E → V | Current a2 loop and conservative fallback. |
|
|
76
78
|
| `ASSURE` | P → R → E → V → C | Governance plus confirmation and handoff. |
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
### Route legend
|
|
81
|
+
|
|
82
|
+
The letters are work stages, not individual commands:
|
|
83
|
+
|
|
84
|
+
- `P` = **Plan/Propose** — understand the request, bound the scope, and record the approach.
|
|
85
|
+
- `R` = **Review** — inspect the proposal/design before execution; this is the formal a2-loop review.
|
|
86
|
+
- `E` = **Execute** — edit the permitted paths and artifacts.
|
|
87
|
+
- `V` = **Validate** — run tests, sensors, and checks and record evidence.
|
|
88
|
+
- `C` = **Confirm/hand off** — obtain explicit confirmation and complete the handoff.
|
|
89
|
+
|
|
90
|
+
So, `P → R → E → V` means “plan/propose, review, execute, and validate”. `FLOW` starts at the
|
|
91
|
+
execution/validation microcontract; `OFF` imposes no automatic Wend route and returns process
|
|
92
|
+
ownership to the native LLM harness.
|
|
93
|
+
|
|
94
|
+
- The LLM harness semantically classifies the request and records `profile route`; Wend Runtime
|
|
95
|
+
does not classify text, diff size, heuristics, or environment variables. It validates and applies
|
|
96
|
+
the deterministic lease.
|
|
97
|
+
- For a local, reversible fix with no contract/spec change, choose `FLOW`. For a compact behavior
|
|
98
|
+
change that needs a change but no formal review, choose `GUIDE`. For uncertainty, risk, security,
|
|
99
|
+
public contracts, dependencies, CI/release, or policy, choose `GOVERN`. Use `ASSURE` when
|
|
100
|
+
confirmation and handoff are part of the contract.
|
|
101
|
+
- `OFF` can never be an adaptive route; only a human persists it explicitly through
|
|
102
|
+
`profile use OFF`. An `OFF` base may still receive a temporary elevation to a Wend route.
|
|
103
|
+
|
|
104
|
+
- Resolution is active prompt lease → persistent session override → project
|
|
105
|
+
`harness.profile` → `GOVERN`. Invalid/expired leases and read failures never select `OFF`.
|
|
106
|
+
- `profile status` prints the effective profile and source. With `--session`, human output adds
|
|
107
|
+
`base=<profile>/<source>` and `lease=<state>`; `--json` emits the same data structurally. When an
|
|
108
|
+
explicit Vault preserves the selection despite a corrupt binding, output includes
|
|
82
109
|
`binding_error` and the diagnostic is also written to stderr.
|
|
83
110
|
- `profile use` validates names and flags strictly; a duplicate/incomplete singleton option or a
|
|
84
111
|
value beginning with `--` fails before I/O. Without `--session`, it atomically changes the
|
|
85
112
|
project binding; with `--session`, it records override, source, and timestamp without changing
|
|
86
113
|
session identity.
|
|
114
|
+
- `profile route` requires `--session` and `--reason`, accepts only the four adaptive profiles,
|
|
115
|
+
and records lease id, reason, turn/sequence, and timestamp without touching persistent profiles.
|
|
87
116
|
- `.wendkeep.json` stays on `schemaVersion: 1`; the additive field is, for example,
|
|
88
117
|
`"harness": { "profile": "GOVERN" }`. A legacy binding without it also resolves to `GOVERN`.
|
|
89
118
|
- A corrupt binding never means `OFF`. When the payload or legacy integration identifies one
|
|
@@ -127,13 +156,39 @@ Harness. The workspaces remain private and are not published as independent npm
|
|
|
127
156
|
- Exit `0` means a successful query or transition; exit `1` means a policy/red-sensor block; exit
|
|
128
157
|
`2` means invalid profile, session, flow, or arguments, with no partial mutation.
|
|
129
158
|
|
|
159
|
+
### Selection scope
|
|
160
|
+
|
|
161
|
+
Without `--session`, `profile use` writes `harness.profile` to `.wendkeep.json` and changes the
|
|
162
|
+
project default for conversations/hooks that have no session override. With `--session <id>`, it
|
|
163
|
+
writes an override only to that session's `SESSION_REGISTRY.json` and leaves the project default
|
|
164
|
+
unchanged. Therefore, `profile use OFF` without `--session` is not an isolated test; if
|
|
165
|
+
`.wendkeep.json` is committed, that choice is shared with other checkouts as well.
|
|
166
|
+
|
|
167
|
+
`profile route` creates a lease only for the current request. An accepted `Stop` consumes it by
|
|
168
|
+
CAS; if cleanup does not run, the next `UserPromptSubmit` advances the sequence and the lease is no
|
|
169
|
+
longer effective. A blocked Stop preserves it for a retry of the same request. There is no
|
|
170
|
+
wall-clock TTL that can interrupt long work. A session with no causal prompt recorded yet (missing
|
|
171
|
+
turn, zero sequence, or missing/mismatched causal map entry) is rejected before any mutation.
|
|
172
|
+
`status --session` includes the base profile and lease state in both human and `--json` output; in
|
|
173
|
+
JSON the fields are `base_profile`, `base_source`, and `task_lease.state` (`active`, `consumed`,
|
|
174
|
+
`expired`, `invalid`, or `absent`).
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
npx wendkeep profile status # project default
|
|
178
|
+
npx wendkeep profile use GUIDE # change the project default
|
|
179
|
+
npx wendkeep profile use FLOW --session <id> # one session only
|
|
180
|
+
npx wendkeep profile route FLOW --session <id> --reason "local adjustment" # current request
|
|
181
|
+
npx wendkeep profile status --session <id> # session-effective profile
|
|
182
|
+
```
|
|
183
|
+
|
|
130
184
|
## Examples
|
|
131
185
|
|
|
132
|
-
Inspect the effective default and
|
|
186
|
+
Inspect the effective default and route only the current implementation:
|
|
133
187
|
|
|
134
188
|
```bash
|
|
135
189
|
npx wendkeep profile status
|
|
136
|
-
npx wendkeep profile
|
|
190
|
+
npx wendkeep profile route FLOW --session 019abc-session-id --reason "fix local typo" --json
|
|
191
|
+
npx wendkeep profile status --session 019abc-session-id --json
|
|
137
192
|
```
|
|
138
193
|
|
|
139
194
|
Run FLOW maintenance while capturing the `flow_id` returned by `start`:
|
|
@@ -30,6 +30,7 @@ npx wendkeep hook <name>
|
|
|
30
30
|
npx wendkeep session list
|
|
31
31
|
npx wendkeep session show <id>
|
|
32
32
|
npx wendkeep session use <id>
|
|
33
|
+
npx wendkeep hook session-backfill --session <id> [--write]
|
|
33
34
|
npx wendkeep import [options]
|
|
34
35
|
```
|
|
35
36
|
|
|
@@ -38,19 +39,27 @@ npx wendkeep import [options]
|
|
|
38
39
|
- `wendkeep hook <name>` reads the agent payload from stdin; valid names are listed by `--help`.
|
|
39
40
|
- `SessionStart` opens an activation: an epoch that remains active across multiple `Stop` events;
|
|
40
41
|
only a new `SessionStart` supersedes the previous epoch.
|
|
41
|
-
- `UserPromptSubmit` advances the active activation's native turn.
|
|
42
|
-
with
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
- Main-agent `UserPromptSubmit` advances the active activation's native turn. A Codex rollout
|
|
43
|
+
prompt with `source.subagent` only registers its path for observability: it does not advance the
|
|
44
|
+
sequence, enter `turn_sequences`, or replace the main transcript. If a main prompt finds a
|
|
45
|
+
legacy registry with a closed epoch, it opens exactly one recovery activation; replaying the
|
|
46
|
+
same prompt does not open another one.
|
|
47
|
+
- On Codex, `session_id` and the native `turn_id` are enough to resolve the turn. Stop proves the
|
|
48
|
+
ID in the transcript and prefers `SESSION_REGISTRY.turn_sequences[turn_id]`; local transcript
|
|
49
|
+
order is the legacy-registry fallback. Interleaved subagent turns therefore cannot make the
|
|
50
|
+
parent's Stop artificially `stale_turn`. Hook payloads need no invented `activation_id` or
|
|
51
|
+
`turn_sequence` fields.
|
|
46
52
|
- `Stop` accepts only a transcript-proven turn from the compatible active activation. Duplicates
|
|
47
53
|
are no-ops; stale/superseded Stops neither publish memory nor overwrite a newer epoch's
|
|
48
54
|
checkpoint.
|
|
49
55
|
- `Stop` receives an absolute **45 s** deadline from hook entry. Reads check the clock between
|
|
50
56
|
rollouts and on every chunk; reaching the limit returns `degraded` before the host timeout.
|
|
51
|
-
- `SubagentStop` receives an absolute **15 s** deadline
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
- `SubagentStop` receives an absolute **15 s** deadline and resolves the child rollout from Codex's
|
|
58
|
+
official `agent_transcript_path` field (`agentTranscriptPath` is also accepted);
|
|
59
|
+
`transcript_path` continues to identify the parent session. Before any write, `source.subagent`,
|
|
60
|
+
ID, canonical session, and `parent_thread_id` are validated; the parent must match a proven
|
|
61
|
+
session root. Signals arriving within the **250 ms** window are coalesced: only the highest
|
|
62
|
+
sequence recomposes/publishes, without losing the last child.
|
|
54
63
|
- Observability is tri-state: `complete` publishes the full snapshot; `none` means zero proven by
|
|
55
64
|
a causal Stop or stable offline scan; `degraded` preserves the previous snapshot and allowlisted
|
|
56
65
|
diagnostics. An isolated `SubagentStop` never publishes `none`.
|
|
@@ -64,6 +73,10 @@ npx wendkeep import [options]
|
|
|
64
73
|
- `import` reconciles observability even when no `wk-turn` is missing: a legacy schema, stale
|
|
65
74
|
frontier, or unproven manifest triggers recomposition without duplicating iterations. A fresh
|
|
66
75
|
checkpoint remains byte-identical; `degraded` is reported and does not change the note.
|
|
76
|
+
- `hook session-backfill` recovers missing `wk-turn` markers for the selected session. Without
|
|
77
|
+
`--write`, it only reports. On Codex, `missingTurns` contains only turns with `task_complete`;
|
|
78
|
+
open turns appear under `incompleteTurns` and are never written. `--write` applies only completed
|
|
79
|
+
candidates, and a second run is idempotent.
|
|
67
80
|
- Exit `0` means consistent processing; non-zero reports invalid source/config/write instead of
|
|
68
81
|
presenting silent partial success.
|
|
69
82
|
|
|
@@ -72,6 +85,8 @@ npx wendkeep import [options]
|
|
|
72
85
|
```bash
|
|
73
86
|
npx wendkeep session list
|
|
74
87
|
npx wendkeep session show 019abc-session-id
|
|
88
|
+
npx wendkeep hook session-backfill --session 019abc-session-id
|
|
89
|
+
npx wendkeep hook session-backfill --session 019abc-session-id --write
|
|
75
90
|
npx wendkeep import --source codex --since 2026-07-01 --dry-run --json
|
|
76
91
|
```
|
|
77
92
|
|
|
@@ -81,7 +96,13 @@ Each canonical session points to the matching provider, transcript, note file, a
|
|
|
81
96
|
registry keeps one `SessionStart` epoch per activation plus the latest native turn; multiple
|
|
82
97
|
`Stop` events may acknowledge turns in that epoch without closing it. Repeated imports of the
|
|
83
98
|
same `session_id` deduplicate; human focus does not close or re-identify live hooks. Every
|
|
84
|
-
automatic iteration remains valid Markdown even when a message must be truncated.
|
|
99
|
+
automatic iteration remains valid Markdown even when a message must be truncated. Complete or
|
|
100
|
+
truncated trailing internal metadata is removed only from assistant messages; a reproduction
|
|
101
|
+
written by the user remains in the transcript. In the note, XML-like tags are encoded as visible
|
|
102
|
+
text — including placeholders such as `<session>` — without changing `<https://...>` autolinks.
|
|
103
|
+
Reimport and `SessionStop` share the same idempotent normalizer; when an older note is finalized,
|
|
104
|
+
only recognized generated fields under `Iterações` and `Encerramento` are migrated, without rewriting
|
|
105
|
+
authored prose.
|
|
85
106
|
Duplicate/stale hooks converge on the same frontier, and imports may refresh only observability
|
|
86
107
|
without creating a new turn block.
|
|
87
108
|
|
|
@@ -92,6 +113,10 @@ without creating a new turn block.
|
|
|
92
113
|
was found; the attempt remains observable but does not publish memory.
|
|
93
114
|
- A late Stop reports `stale_turn`/`superseded`: the newer epoch and checkpoint are preserved; do
|
|
94
115
|
not force the old payload to apply.
|
|
116
|
+
- `session-backfill` lists `incompleteTurns`: wait for that turn's `task_complete`/Stop and retry;
|
|
117
|
+
do not edit the note or force the partial turn. Once that turn receives `task_complete`, the next
|
|
118
|
+
run may treat it as eligible. Claude transcripts preserve their historical contract and do not
|
|
119
|
+
require this Codex event.
|
|
95
120
|
- Fork duplicates: bound source/date and inspect `forked_from_id`/`source.subagent`.
|
|
96
121
|
- Codex does not capture: approve hooks and start a new session after `sync`.
|
|
97
122
|
- Contaminated cost: validate `session_id → session_file → transcript_path → provider`.
|
|
@@ -73,15 +73,17 @@ npx wendkeep memory status --gate --vault .MyApp-vault
|
|
|
73
73
|
## Expected result
|
|
74
74
|
|
|
75
75
|
`evidencia.json` contains sensor results and a seal binds proof to the current `tarefas.md` hash.
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
When a sensor is red, its entry receives only a local, sanitized diagnostic bounded to 2,000
|
|
77
|
+
characters; stdout/stderr from green sensors is not persisted. Deep mode packages requirements,
|
|
78
|
+
tasks, and evidence for read-only review; the verdict covers every `[req:]` before archive.
|
|
78
79
|
|
|
79
80
|
## Common errors and diagnosis
|
|
80
81
|
|
|
81
82
|
- `no change`: this is exit 2 and a valid idle state; create/use a change or skip verify.
|
|
82
83
|
- Zero/missing sensors: inspect every same-line tag and `sensors list`; multiple tags on one task
|
|
83
84
|
are valid and all of them enter the gate.
|
|
84
|
-
- Red gate:
|
|
85
|
+
- Red gate: inspect the bounded `note` field on the `evidencia.json` entry, fix the cause, and
|
|
86
|
+
rerun; never choose `archive --force` on your own.
|
|
85
87
|
- Missing/stale verdict: regenerate `--deep` and request a fresh independent pass.
|
|
86
88
|
- Surviving mutants: strengthen the discriminating test; after three rounds, review manually.
|
|
87
89
|
|