wendkeep 0.58.1 → 0.59.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 +120 -0
- package/README.en.md +70 -40
- package/README.md +70 -40
- package/bin/wendkeep.mjs +54 -6
- package/docs/en/commands/changes-and-verification.md +85 -0
- package/docs/en/commands/costs-and-observability.md +65 -0
- package/docs/en/commands/getting-started.md +86 -0
- package/docs/en/commands/maintenance-and-diagnostics.md +77 -0
- package/docs/en/commands/memory-migration.md +73 -0
- package/docs/en/commands/memory.md +102 -0
- package/docs/en/commands/notes-and-knowledge.md +70 -0
- package/docs/en/commands/operating-profiles.md +173 -0
- package/docs/en/commands/retroactive-import.md +67 -0
- package/docs/en/commands/sessions-and-import.md +89 -0
- package/docs/en/commands/verify.md +92 -0
- package/docs/pt-BR/commands/changes-and-verification.md +85 -0
- package/docs/pt-BR/commands/costs-and-observability.md +65 -0
- package/docs/pt-BR/commands/getting-started.md +87 -0
- package/docs/pt-BR/commands/maintenance-and-diagnostics.md +77 -0
- package/docs/pt-BR/commands/memory-migration.md +73 -0
- package/docs/pt-BR/commands/memory.md +99 -0
- package/docs/pt-BR/commands/notes-and-knowledge.md +69 -0
- package/docs/pt-BR/commands/operating-profiles.md +171 -0
- package/docs/pt-BR/commands/retroactive-import.md +67 -0
- package/docs/pt-BR/commands/sessions-and-import.md +89 -0
- package/docs/pt-BR/commands/verify.md +93 -0
- package/hooks/brain-core.mjs +159 -159
- package/hooks/brain-inject.mjs +83 -26
- package/hooks/brain-recall.mjs +32 -32
- package/hooks/brain-reindex.mjs +13 -13
- package/hooks/change-context.mjs +24 -10
- package/hooks/change-core.mjs +174 -37
- package/hooks/change-guard.mjs +115 -16
- package/hooks/change-nag.mjs +20 -5
- package/hooks/change-warn.mjs +27 -9
- package/hooks/decision-capture.mjs +1 -1
- package/hooks/derived-sections.mjs +1 -1
- package/hooks/flow-core.mjs +891 -0
- package/hooks/flow-protected-policy.mjs +218 -0
- package/hooks/frontmatter-repair.mjs +3 -1
- package/hooks/git-snapshot.mjs +722 -0
- package/hooks/import-sessions.mjs +10 -5
- package/hooks/memory-mode.mjs +63 -13
- package/hooks/memory-store.mjs +309 -69
- package/hooks/obsidian-common.mjs +119 -84
- package/hooks/operating-profile-runtime.mjs +157 -0
- package/hooks/plan-capture.mjs +14 -3
- package/hooks/sensors-core.mjs +15 -3
- package/hooks/session-backfill.mjs +7 -2
- package/hooks/session-ensure.mjs +21 -12
- package/hooks/session-iteration.mjs +65 -0
- package/hooks/session-memory-lifecycle.mjs +335 -0
- package/hooks/session-note-io.mjs +130 -15
- package/hooks/session-observability.mjs +4 -2
- package/hooks/session-stop.mjs +181 -59
- package/hooks/spec-core.mjs +91 -12
- package/hooks/subagent-stop.mjs +4 -1
- package/hooks/subagent-usage.mjs +2 -2
- package/hooks/task-log.mjs +3 -1
- package/hooks/token-usage.mjs +1 -1
- package/hooks/vault-health.mjs +268 -25
- package/hooks/vault-path-safety.mjs +558 -0
- package/hooks/vault-runtime-store.mjs +558 -0
- package/package.json +5 -3
- package/src/change.mjs +2 -1
- package/src/flow.mjs +232 -0
- package/src/init.mjs +26 -3
- package/src/memory.mjs +785 -35
- package/src/operating-profile.mjs +133 -0
- package/src/profile.mjs +224 -0
- package/src/project-vault.mjs +110 -5
- package/src/rebuild-costs.mjs +11 -4
- package/src/skills-seed.mjs +38 -16
- package/src/sync-defs.mjs +16 -7
- package/src/sync.mjs +9 -1
- package/src/taxonomy.mjs +9 -0
- package/src/validate-memory.mjs +21 -8
- package/src/verify.mjs +12 -2
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Operating profiles and FLOW
|
|
2
|
+
|
|
3
|
+
**English** · [Português](../../pt-BR/commands/operating-profiles.md)
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Choose how much Wend Runtime governance an execution needs without disabling **Keep Core**.
|
|
8
|
+
Keep Core is always active: the Vault, session, identity, CORE/SHARED, lessons, costs, and
|
|
9
|
+
persistence integrations continue working under every profile.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
|
|
13
|
+
Use `profile` to inspect or explicitly select an Operating Profile. Use `FLOW` for local,
|
|
14
|
+
reversible `spec_impact:none` maintenance that fits an Execute → Validate microcontract without a
|
|
15
|
+
change.
|
|
16
|
+
|
|
17
|
+
## When not to use
|
|
18
|
+
|
|
19
|
+
Do not select `OFF` to bypass policy: it hands execution to the LLM's native harness and can only
|
|
20
|
+
be selected explicitly. Do not finish public-contract, security/auth, migration/schema,
|
|
21
|
+
dependency, CI/release, spec, or WendKeep gate/policy changes in FLOW; promote the work to a
|
|
22
|
+
change.
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
26
|
+
- An initialized project whose `.wendkeep.json` is bound to the correct Vault.
|
|
27
|
+
- For a session override, one unambiguous session in `SESSION_REGISTRY.json`.
|
|
28
|
+
- For FLOW, a Git repository, a path allowlist, a reason, and at least one existing sensor in
|
|
29
|
+
`wendkeep.sensors.json`.
|
|
30
|
+
|
|
31
|
+
## Syntax
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx wendkeep profile status [--project <path>] [--vault <path>] [--session <id>] [--json]
|
|
35
|
+
npx wendkeep profile use <profile> [--project <path>] [--vault <path>] [--session <id>] [--json]
|
|
36
|
+
npx wendkeep flow start <slug> --allow <path> [--allow <path>...] --sensor <id> [--sensor <id>...] --reason <text> [--session <id>]
|
|
37
|
+
npx wendkeep flow status [<id>]
|
|
38
|
+
npx wendkeep flow show <id> [--session <id>]
|
|
39
|
+
npx wendkeep flow finish <id> [--session <id>]
|
|
40
|
+
npx wendkeep flow promote <id> [--change-slug <slug>] [--session <id>]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Every FLOW subcommand also accepts `--project <path>`, `--vault <path>`, and `--json`. When
|
|
44
|
+
provided, `--session` scopes ID-based reads and mutations to the session that owns the FLOW; an
|
|
45
|
+
ID from another session fails without mutation.
|
|
46
|
+
|
|
47
|
+
## Options and exit codes
|
|
48
|
+
|
|
49
|
+
| Profile | Route | Contract |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `OFF` | LLM-native harness | Wend Runtime off; Keep Core intact. |
|
|
52
|
+
| `FLOW` | E → V | Microcontract with Git baseline, allowlist, sensors, and receipt, without a change. |
|
|
53
|
+
| `GUIDE` | P → E → V | Compact change; policy recognized for compatible evolution. |
|
|
54
|
+
| `GOVERN` | P → R → E → V | Current a2 loop and conservative fallback. |
|
|
55
|
+
| `ASSURE` | P → R → E → V → C | Governance plus confirmation and handoff. |
|
|
56
|
+
|
|
57
|
+
- Resolution is explicit session override → project `harness.profile` → `GOVERN`. Heuristics,
|
|
58
|
+
diff size, prompt text, environment variables, or read failures never select `OFF`.
|
|
59
|
+
- `profile status` prints the effective profile and source; `--json` emits structured output. When
|
|
60
|
+
an explicit Vault preserves the selection despite a corrupt binding, output includes
|
|
61
|
+
`binding_error` and the diagnostic is also written to stderr.
|
|
62
|
+
- `profile use` validates names and flags strictly; a duplicate/incomplete singleton option or a
|
|
63
|
+
value beginning with `--` fails before I/O. Without `--session`, it atomically changes the
|
|
64
|
+
project binding; with `--session`, it records override, source, and timestamp without changing
|
|
65
|
+
session identity.
|
|
66
|
+
- `.wendkeep.json` stays on `schemaVersion: 1`; the additive field is, for example,
|
|
67
|
+
`"harness": { "profile": "GOVERN" }`. A legacy binding without it also resolves to `GOVERN`.
|
|
68
|
+
- A corrupt binding never means `OFF`. When the payload or legacy integration identifies one
|
|
69
|
+
unambiguous Vault, Keep Core remains active under `GOVERN` and the hook exposes a diagnostic;
|
|
70
|
+
mutation guards fail closed until the binding is repaired. Invalid local configuration, a
|
|
71
|
+
missing marker, or a mismatched identity never silently inherits a parent/global Vault.
|
|
72
|
+
- `harness.flow.protectedRoots` accepts an array of project-relative roots, without globs or `..`
|
|
73
|
+
escapes. Each root extends FLOW's protected surfaces; any change below it requires
|
|
74
|
+
`flow promote`.
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"harness": {
|
|
79
|
+
"profile": "FLOW",
|
|
80
|
+
"flow": {
|
|
81
|
+
"protectedRoots": ["src/internal-api", "infra/releases"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- `flow start` captures HEAD, pre-existing Git state, allowlist, sensors, reason, and session under
|
|
88
|
+
`.brain/runtime/flows/`; it creates no `08-Mudanças`, ADR, verdict, spec, or
|
|
89
|
+
`CURRENT_CHANGE.md`.
|
|
90
|
+
- `flow finish` compares the real diff with the Git baseline and allowlist, including submodule
|
|
91
|
+
changes, Git metadata/config/hidden flags, and ignored protected surfaces. The projectRoot is
|
|
92
|
+
frozen and sensors run in that cwd. A bounded, no-follow physical discovery keeps empty or
|
|
93
|
+
ignored protected aliases visible without entering `.git`, the effective Vault, or local caches;
|
|
94
|
+
ambiguity or a limit breach blocks. It rejects symlink/junction/reparse/hardlink paths in both
|
|
95
|
+
the worktree and Vault destinations, revalidates before/after sensors, and recaptures the snapshot
|
|
96
|
+
immediately before the receipt, blocking any sensor that mutates the repository. A terminal
|
|
97
|
+
receipt and idempotent
|
|
98
|
+
session iteration count as success only together; a temporarily
|
|
99
|
+
busy projection exits `1` and can be retried safely.
|
|
100
|
+
- `flow promote` creates a normal change while preserving session, reason, paths, sensors, and
|
|
101
|
+
evidence. A cross-process owner+lease slug lock, reservation, and durable `promoting` state elect
|
|
102
|
+
one owner; contract, reservation, attempts, receipt, and origin remain semantically bound. The
|
|
103
|
+
loser remains active and can retry with `--change-slug`. Retries idempotently resume the same
|
|
104
|
+
promotion instead of creating another change.
|
|
105
|
+
No FLOW command accepts `--force`.
|
|
106
|
+
- Exit `0` means a successful query or transition; exit `1` means a policy/red-sensor block; exit
|
|
107
|
+
`2` means invalid profile, session, flow, or arguments, with no partial mutation.
|
|
108
|
+
|
|
109
|
+
## Examples
|
|
110
|
+
|
|
111
|
+
Inspect the effective default and apply an override only to the current session:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx wendkeep profile status
|
|
115
|
+
npx wendkeep profile use OFF --session 019abc-session-id --json
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Run FLOW maintenance while capturing the `flow_id` returned by `start`:
|
|
119
|
+
|
|
120
|
+
```powershell
|
|
121
|
+
$flow = npx wendkeep flow start fix-copy --allow README.md --sensor docs-bilingual --reason "Fix copy without changing the contract" --json | ConvertFrom-Json
|
|
122
|
+
$flowId = $flow.contract.flow_id
|
|
123
|
+
npx wendkeep flow status $flowId
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
If the work remains local and inside the microcontract, finish it with the returned ID:
|
|
127
|
+
|
|
128
|
+
```powershell
|
|
129
|
+
npx wendkeep flow finish $flowId
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
If the scope grows before `finish`, promote instead of finishing:
|
|
133
|
+
|
|
134
|
+
```powershell
|
|
135
|
+
npx wendkeep flow promote $flowId
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
If another session already claimed the original slug, the FLOW stays active and can be promoted
|
|
139
|
+
again with an explicit destination:
|
|
140
|
+
|
|
141
|
+
```powershell
|
|
142
|
+
npx wendkeep flow promote $flowId --change-slug another-slug
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Expected result
|
|
146
|
+
|
|
147
|
+
Changing profile neither creates a new session nor interrupts the Vault. In `OFF`, memory and
|
|
148
|
+
lessons are still injected and Stop still persists the session/memory lifecycle, while the
|
|
149
|
+
router, skill gate, change context/warn/nag/guard, and plan capture are inactive. A completed FLOW
|
|
150
|
+
leaves a durable, inspectable receipt; a promoted FLOW enters the normal change lifecycle.
|
|
151
|
+
|
|
152
|
+
## Common errors and diagnosis
|
|
153
|
+
|
|
154
|
+
- Unknown profile: use exactly `OFF`, `FLOW`, `GUIDE`, `GOVERN`, or `ASSURE`.
|
|
155
|
+
- `OFF` appeared without explicit selection: treat it as an error; missing/invalid reads must fall
|
|
156
|
+
back to `GOVERN`.
|
|
157
|
+
- Missing or ambiguous session: inspect `session list` and pass `--session <id>` without retrying
|
|
158
|
+
against a different target.
|
|
159
|
+
- FLOW without allowlist, reason, or sensor: complete the microcontract before editing.
|
|
160
|
+
- Out-of-scope path, protected surface, or red sensor: fix/abandon the FLOW or use
|
|
161
|
+
`flow promote`; there is no bypass.
|
|
162
|
+
- A sensor changed the repository, the allowlist crosses a symlink/junction, or a sensitive
|
|
163
|
+
ignored surface changed: restore the state and promote when the change is not strictly local.
|
|
164
|
+
FLOW sensors must be read-only.
|
|
165
|
+
- Session projection is `missing`, `invalid-frontmatter`, or `busy`: restore/unlock the note and
|
|
166
|
+
retry `flow finish` or `flow promote`; the idempotent marker prevents duplication.
|
|
167
|
+
- Pre-existing dirt appeared in the diff: it must match the initial fingerprint and must never be
|
|
168
|
+
silently attributed to the FLOW.
|
|
169
|
+
|
|
170
|
+
## Next steps
|
|
171
|
+
|
|
172
|
+
Read [changes and verification](changes-and-verification.md), the deep
|
|
173
|
+
[verify guide](verify.md), and [sessions and import](sessions-and-import.md).
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Safe retroactive import
|
|
2
|
+
|
|
3
|
+
**English** · [Português](../../pt-BR/commands/retroactive-import.md)
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Import historical Claude and Codex sessions with bounded scope, stable identity, and review before
|
|
8
|
+
writes.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
Use when installing WendKeep in an existing project, recovering a date range, or rescanning
|
|
13
|
+
decisions without importing every transcript on the machine.
|
|
14
|
+
|
|
15
|
+
## When not to use
|
|
16
|
+
|
|
17
|
+
Do not use `--source all` without dry-run on machines with many projects, forks, or subagent
|
|
18
|
+
rollouts. Do not treat imported conversation history as current implementation evidence.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
Confirm project, vault, provider, source directory, and date window. Back up the registry if it
|
|
23
|
+
already contains manual repairs.
|
|
24
|
+
|
|
25
|
+
## Syntax
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx wendkeep import --dry-run --json
|
|
29
|
+
npx wendkeep import --source claude|codex|all [--since <date>] [--limit <n>]
|
|
30
|
+
npx wendkeep import --from <claude-dir> --codex-from <codex-dir>
|
|
31
|
+
npx wendkeep import --stamp-ids | --rescan-decisions
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Options and exit codes
|
|
35
|
+
|
|
36
|
+
- `--source` bounds provider; `--since` and `--limit` bound volume.
|
|
37
|
+
- `--from`/`--codex-from` override discovered directories.
|
|
38
|
+
- `--dry-run` performs zero writes; `--json` emits an auditable report.
|
|
39
|
+
- `--stamp-ids` fills IDs in existing notes; `--rescan-decisions` reruns prose extraction.
|
|
40
|
+
- Exit `0` means a consistent scan/import; non-zero requires fixing source, parsing, or identity
|
|
41
|
+
before retrying.
|
|
42
|
+
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx wendkeep import --source codex --since 2026-07-20 --limit 20 --dry-run --json
|
|
47
|
+
# inspect accepted/skipped/forks
|
|
48
|
+
npx wendkeep import --source codex --since 2026-07-20 --limit 20
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Expected result
|
|
52
|
+
|
|
53
|
+
Accepted sessions enter once per `session_id` with matching provider/transcript. Canonical
|
|
54
|
+
duplicates are skipped; forks/subagents retain origin relationships instead of copying inherited
|
|
55
|
+
history into another full independent conversation.
|
|
56
|
+
|
|
57
|
+
## Common errors and diagnosis
|
|
58
|
+
|
|
59
|
+
- Cross-project contamination: stop and verify cwd, binding, and filters before cleaning notes.
|
|
60
|
+
- Ordinary fork imported as full session: inspect `forked_from_id` and source payload.
|
|
61
|
+
- Note without `session_id`: use `--stamp-ids` only after dry-run.
|
|
62
|
+
- Missing decisions in an imported note: prefer `--rescan-decisions` over duplicating the session.
|
|
63
|
+
|
|
64
|
+
## Next steps
|
|
65
|
+
|
|
66
|
+
Return to [sessions and hooks](sessions-and-import.md), generate [costs](costs-and-observability.md),
|
|
67
|
+
and review [derived notes](notes-and-knowledge.md).
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Sessions, hooks, and import
|
|
2
|
+
|
|
3
|
+
**English** · [Português](../../pt-BR/commands/sessions-and-import.md)
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Understand how hooks capture live sessions, how activation/turn state preserves causality in the
|
|
8
|
+
registry, and when to use retroactive import. Under `OFF`, the Vault remains active: session,
|
|
9
|
+
identity, memory, cost, and persistence hooks belong to Keep Core, not Wend Runtime.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
|
|
13
|
+
Use `session` to inspect/focus a conversation and `import` to recover sessions from before setup or
|
|
14
|
+
outside the current registry.
|
|
15
|
+
|
|
16
|
+
## When not to use
|
|
17
|
+
|
|
18
|
+
Do not invoke hooks manually without their expected JSON envelope. Do not run broad imports before
|
|
19
|
+
a preview when forks/subagents may duplicate history.
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
Installed hooks for live capture; for imports, local access to Claude/Codex transcript directories
|
|
24
|
+
and a vault bound to the correct project.
|
|
25
|
+
|
|
26
|
+
## Syntax
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx wendkeep hook <name>
|
|
30
|
+
npx wendkeep session list
|
|
31
|
+
npx wendkeep session show <id>
|
|
32
|
+
npx wendkeep session use <id>
|
|
33
|
+
npx wendkeep import [options]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Options and exit codes
|
|
37
|
+
|
|
38
|
+
- `wendkeep hook <name>` reads the agent payload from stdin; valid names are listed by `--help`.
|
|
39
|
+
- `SessionStart` opens an activation: an epoch that remains active across multiple `Stop` events;
|
|
40
|
+
only a new `SessionStart` supersedes the previous epoch.
|
|
41
|
+
- `UserPromptSubmit` advances the active activation's native turn. If it finds a legacy registry
|
|
42
|
+
with a closed epoch, it opens exactly one recovery activation; replaying the same prompt does
|
|
43
|
+
not open another one.
|
|
44
|
+
- On Codex, `session_id`, the native `turn_id`, and observed transcript order are enough to resolve
|
|
45
|
+
the turn. Hook payloads do not need invented `activation_id` or `turn_sequence` fields.
|
|
46
|
+
- `Stop` accepts only a transcript-proven turn from the compatible active activation. Duplicates
|
|
47
|
+
are no-ops; stale/superseded Stops neither publish memory nor overwrite a newer epoch's
|
|
48
|
+
checkpoint.
|
|
49
|
+
- When compacting conversations into `## Iterações`, the hook escapes code delimiters cut by the
|
|
50
|
+
size limit; inline backticks and fences never remain open and consume the following line.
|
|
51
|
+
- `session list` reads `SESSION_REGISTRY`; `show` displays one session and `use` only changes human
|
|
52
|
+
focus in `CURRENT_SESSION.md`.
|
|
53
|
+
- `import --source all|claude|codex`, `--since`, `--limit`, `--from`, and `--codex-from` bound scope.
|
|
54
|
+
- `--dry-run`/`--json` support audit before writes; `--stamp-ids` and `--rescan-decisions` address
|
|
55
|
+
specific historical gaps.
|
|
56
|
+
- Exit `0` means consistent processing; non-zero reports invalid source/config/write instead of
|
|
57
|
+
presenting silent partial success.
|
|
58
|
+
|
|
59
|
+
## Examples
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx wendkeep session list
|
|
63
|
+
npx wendkeep session show 019abc-session-id
|
|
64
|
+
npx wendkeep import --source codex --since 2026-07-01 --dry-run --json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Expected result
|
|
68
|
+
|
|
69
|
+
Each canonical session points to the matching provider, transcript, note file, and costs. The
|
|
70
|
+
registry keeps one `SessionStart` epoch per activation plus the latest native turn; multiple
|
|
71
|
+
`Stop` events may acknowledge turns in that epoch without closing it. Repeated imports of the
|
|
72
|
+
same `session_id` deduplicate; human focus does not close or re-identify live hooks. Every
|
|
73
|
+
automatic iteration remains valid Markdown even when a message must be truncated.
|
|
74
|
+
|
|
75
|
+
## Common errors and diagnosis
|
|
76
|
+
|
|
77
|
+
- Missing session: verify provider, transcript path, and registry before importing again.
|
|
78
|
+
- `Stop ambiguous`: the transcript did not prove the `turn_id`, or no compatible active activation
|
|
79
|
+
was found; the attempt remains observable but does not publish memory.
|
|
80
|
+
- A late Stop reports `stale_turn`/`superseded`: the newer epoch and checkpoint are preserved; do
|
|
81
|
+
not force the old payload to apply.
|
|
82
|
+
- Fork duplicates: bound source/date and inspect `forked_from_id`/`source.subagent`.
|
|
83
|
+
- Codex does not capture: approve hooks and start a new session after `sync`.
|
|
84
|
+
- Contaminated cost: validate `session_id → session_file → transcript_path → provider`.
|
|
85
|
+
|
|
86
|
+
## Next steps
|
|
87
|
+
|
|
88
|
+
Read [Operating profiles](operating-profiles.md), [retroactive import](retroactive-import.md),
|
|
89
|
+
[costs and observability](costs-and-observability.md), and [notes](notes-and-knowledge.md).
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Verify and independent verification
|
|
2
|
+
|
|
3
|
+
**English** · [Português](../../pt-BR/commands/verify.md)
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Run the sensors required by a change's tasks, persist fresh evidence, and assemble the
|
|
8
|
+
self-contained package consumed by the independent `wk-verify` pass.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
Run after implementing tasks and again whenever tasks, specs, or tests change.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
|
|
16
|
+
Do not use it as a post-install health check or when no change exists. Run `wendkeep doctor` and
|
|
17
|
+
`wendkeep memory status --gate` instead. In `FLOW`, validation and the receipt belong to
|
|
18
|
+
`flow finish`; under `OFF`, `verify` remains available only when the user chooses to run the
|
|
19
|
+
lifecycle manually.
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
- An open change selected through `CURRENT_CHANGE.md` or `--change <slug>`.
|
|
24
|
+
- A placeholder-free `tarefas.md` with `[req:]` and one or more `[sensor:]` tags on checkbox lines;
|
|
25
|
+
every distinct sensor ID is required once, in declaration order.
|
|
26
|
+
- Sensors declared in `wendkeep.sensors.json`.
|
|
27
|
+
|
|
28
|
+
## Syntax
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx wendkeep verify [--change <slug>] [--project <root>] [--vault <vault>]
|
|
32
|
+
npx wendkeep verify --deep [--change <slug>]
|
|
33
|
+
npx wendkeep change use <slug>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Options and exit codes
|
|
37
|
+
|
|
38
|
+
- `--change <slug>` targets a change without changing the active pointer.
|
|
39
|
+
- `change use <slug>` persists focus for following commands.
|
|
40
|
+
- `--project <root>` selects the sensor cwd; `--vault` selects where proof is stored and is passed
|
|
41
|
+
to sensors as `OBSIDIAN_VAULT_PATH`, including `memory-health`.
|
|
42
|
+
- **Exit 0:** all required sensors passed and evidence was written.
|
|
43
|
+
- **Exit 1:** the gate ran, but at least one critical sensor was red or a mutant survived.
|
|
44
|
+
- **Exit 2:** invalid usage/context, including `no change (--change or active)`, missing vault,
|
|
45
|
+
unknown change, or invalid `wendkeep.sensors.json`.
|
|
46
|
+
|
|
47
|
+
`verify --deep` writes `verificacao.json`; it does not replace the reviewer. The `wk-verify` skill
|
|
48
|
+
must be run by a different author and writes `verdict.json`.
|
|
49
|
+
|
|
50
|
+
## Examples
|
|
51
|
+
|
|
52
|
+
Active change:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx wendkeep verify
|
|
56
|
+
npx wendkeep verify --deep
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Explicit change:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx wendkeep verify --change tenant-login
|
|
63
|
+
npx wendkeep verify --deep --change tenant-login
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Project with no open change:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx wendkeep doctor --vault .MyApp-vault
|
|
70
|
+
npx wendkeep memory status --gate --vault .MyApp-vault
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Expected result
|
|
74
|
+
|
|
75
|
+
`evidencia.json` contains sensor results and a seal binds proof to the current `tarefas.md` hash.
|
|
76
|
+
Deep mode packages requirements, tasks, and evidence for read-only review; the verdict covers every
|
|
77
|
+
`[req:]` before archive.
|
|
78
|
+
|
|
79
|
+
## Common errors and diagnosis
|
|
80
|
+
|
|
81
|
+
- `no change`: this is exit 2 and a valid idle state; create/use a change or skip verify.
|
|
82
|
+
- Zero/missing sensors: inspect every same-line tag and `sensors list`; multiple tags on one task
|
|
83
|
+
are valid and all of them enter the gate.
|
|
84
|
+
- Red gate: fix the cause and rerun; never choose `archive --force` on your own.
|
|
85
|
+
- Missing/stale verdict: regenerate `--deep` and request a fresh independent pass.
|
|
86
|
+
- Surviving mutants: strengthen the discriminating test; after three rounds, review manually.
|
|
87
|
+
|
|
88
|
+
## Next steps
|
|
89
|
+
|
|
90
|
+
Return to the [change lifecycle](changes-and-verification.md) for archive, review
|
|
91
|
+
[Operating profiles](operating-profiles.md), or use [maintenance](maintenance-and-diagnostics.md)
|
|
92
|
+
when no change exists.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Changes, specs, sensores e archive
|
|
2
|
+
|
|
3
|
+
**PT-BR** · [English](../../en/commands/changes-and-verification.md)
|
|
4
|
+
|
|
5
|
+
## Objetivo
|
|
6
|
+
|
|
7
|
+
Conduzir uma mudança desde a intenção registrada até uma decisão arquivada, ligando requisitos,
|
|
8
|
+
tarefas, sensores, evidência e verdict no grafo do cofre.
|
|
9
|
+
|
|
10
|
+
## Quando usar
|
|
11
|
+
|
|
12
|
+
Use para qualquer implementação não trivial ou correção que precise deixar prova auditável.
|
|
13
|
+
|
|
14
|
+
## Quando não usar
|
|
15
|
+
|
|
16
|
+
Não crie uma change para consultar saúde, importar sessões ou executar manutenção read-only.
|
|
17
|
+
Para manutenção local elegível ao perfil `FLOW`, use o microcontrato descrito em
|
|
18
|
+
[Perfis de Operação](operating-profiles.md); em `OFF`, o lifecycle permanece disponível, mas não
|
|
19
|
+
é imposto pelo Wend Runtime.
|
|
20
|
+
|
|
21
|
+
## Pré-requisitos
|
|
22
|
+
|
|
23
|
+
Tenha o projeto inicializado, um vault saudável e `wendkeep.sensors.json` válido na raiz.
|
|
24
|
+
|
|
25
|
+
## Sintaxe
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx wendkeep change new <slug>
|
|
29
|
+
npx wendkeep change status [slug]
|
|
30
|
+
npx wendkeep spec effective --change <slug>
|
|
31
|
+
npx wendkeep sensors list
|
|
32
|
+
npx wendkeep verify [--deep] [--change <slug>]
|
|
33
|
+
npx wendkeep change archive <slug>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Opções e códigos de saída
|
|
37
|
+
|
|
38
|
+
- `wendkeep change new <slug> [--simple]` cria uma change; `--simple` só pula o design, não é nem
|
|
39
|
+
equivale a `FLOW` e preserva o lifecycle/ADR legado.
|
|
40
|
+
- `change use`, `list`, `show`, `status`, `diff`, `done` e `undone` inspecionam ou atualizam o
|
|
41
|
+
trabalho sem arquivar.
|
|
42
|
+
- `change continue <arquivada> <nova>` abre continuação sem herdar evidência antiga.
|
|
43
|
+
- `change bind <slug> --session <id>` liga uma sessão existente.
|
|
44
|
+
- `change relink [--apply]` e `change backlink [--apply]` reparam o grafo; dry-run é o padrão.
|
|
45
|
+
- `change abandon <slug>` descarta sem ADR; `archive --force` exige decisão humana explícita.
|
|
46
|
+
- `wendkeep spec list|show|effective|migrate|rebase` administra contratos vivos e deltas.
|
|
47
|
+
- `wendkeep sensors list|add` administra provas executáveis.
|
|
48
|
+
- Exit `0` indica comando concluído; os gates usam exit `1` para prova vermelha e exit `2` para
|
|
49
|
+
contexto/uso inválido.
|
|
50
|
+
|
|
51
|
+
## Exemplos
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx wendkeep change new login-tenant
|
|
55
|
+
npx wendkeep spec effective --change login-tenant
|
|
56
|
+
npx wendkeep change done 1.1 --change login-tenant
|
|
57
|
+
npx wendkeep verify --change login-tenant
|
|
58
|
+
npx wendkeep verify --deep --change login-tenant
|
|
59
|
+
npx wendkeep change archive login-tenant
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Para adicionar um sensor:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx wendkeep sensors add api-contracts "npm run test:contracts" --severity critical
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Resultado esperado
|
|
69
|
+
|
|
70
|
+
A change arquivada move seu delta para o spec vivo, preserva proposta/design/tarefas/evidência e
|
|
71
|
+
gera um ADR. O archive só passa com tarefas fechadas, sensores exigidos verdes e verdict atual.
|
|
72
|
+
|
|
73
|
+
## Erros comuns e diagnóstico
|
|
74
|
+
|
|
75
|
+
- `no change`: selecione com `change use <slug>` ou informe `--change`.
|
|
76
|
+
- `spec_impact: pending`: defina `required` com delta ou `none` com justificativa real.
|
|
77
|
+
- Sensor não executado: mantenha uma ou mais tags `[sensor:id]` na mesma linha do checkbox. Todos
|
|
78
|
+
os IDs distintos dessa linha são exigidos e executados uma vez, na ordem declarada.
|
|
79
|
+
- Evidência stale: rode novamente `verify` e `verify --deep` depois de alterar tarefas/spec.
|
|
80
|
+
- Rebase em conflito: resolva o delta ou use `--accept-current` apenas quando isso for a decisão.
|
|
81
|
+
|
|
82
|
+
## Próximos passos
|
|
83
|
+
|
|
84
|
+
Leia [Perfis de Operação](operating-profiles.md), o guia profundo de [verify](verify.md) e a
|
|
85
|
+
referência de [manutenção e diagnóstico](maintenance-and-diagnostics.md).
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Custos e observabilidade
|
|
2
|
+
|
|
3
|
+
**PT-BR** · [English](../../en/commands/costs-and-observability.md)
|
|
4
|
+
|
|
5
|
+
## Objetivo
|
|
6
|
+
|
|
7
|
+
Medir sessões, prompts, modelos e custo de IA, além de reconstruir históricos a partir dos
|
|
8
|
+
transcripts canônicos quando necessário.
|
|
9
|
+
|
|
10
|
+
## Quando usar
|
|
11
|
+
|
|
12
|
+
Use `stats` para visão rápida, `cost` para análise e `cost rebuild` quando notas antigas não têm
|
|
13
|
+
custos confiáveis.
|
|
14
|
+
|
|
15
|
+
## Quando não usar
|
|
16
|
+
|
|
17
|
+
Não aplique rebuild antes de validar provider e transcript de cada sessão. Não compare custos de
|
|
18
|
+
projetos com registries misturados.
|
|
19
|
+
|
|
20
|
+
## Pré-requisitos
|
|
21
|
+
|
|
22
|
+
Registry consistente, tabela de preços completa e acesso aos transcripts das sessões reconstruídas.
|
|
23
|
+
|
|
24
|
+
## Sintaxe
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx wendkeep stats [--vault <cofre>] [--json]
|
|
28
|
+
npx wendkeep cost [--since <data>] [--top [N]] [--trend day|week|month] [--write] [--json]
|
|
29
|
+
npx wendkeep cost rebuild [--session <id|arquivo>] [--limit N] [--apply] [--json]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Opções e códigos de saída
|
|
33
|
+
|
|
34
|
+
- `wendkeep stats` gera uma linha compartilhável ou JSON.
|
|
35
|
+
- `wendkeep cost` agrega total/modelo/dia; `--trend` inclui projeção e `--write` atualiza
|
|
36
|
+
`00-Custo.md`.
|
|
37
|
+
- `wendkeep cost rebuild` é dry-run por padrão; `--apply` grava notas e
|
|
38
|
+
`.brain/COST_REBUILD.json`.
|
|
39
|
+
- Exit `0` indica cálculo consistente; não zero indica registry, preço, transcript ou parsing
|
|
40
|
+
insuficiente.
|
|
41
|
+
|
|
42
|
+
## Exemplos
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx wendkeep stats --vault .MeuApp-vault
|
|
46
|
+
npx wendkeep cost --since 2026-07-01 --top 10 --trend week
|
|
47
|
+
npx wendkeep cost rebuild --session 019abc --json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Resultado esperado
|
|
51
|
+
|
|
52
|
+
Totais preservam dimensões de input/output/cache/reasoning por modelo e período. Rebuild mostra a
|
|
53
|
+
prévia antes de alterar notas e deixa um relatório reproduzível quando aplicado.
|
|
54
|
+
|
|
55
|
+
## Erros comuns e diagnóstico
|
|
56
|
+
|
|
57
|
+
- Modelo sem preço: atualize a tabela antes de aceitar o total.
|
|
58
|
+
- Custos de provider errado: valide a cadeia de identidade da sessão.
|
|
59
|
+
- Transcript ausente: não estime silenciosamente; mantenha a lacuna visível.
|
|
60
|
+
- Total duplicado por subagent/fork: confirme relação pai/subagent e deduplicação do registry.
|
|
61
|
+
|
|
62
|
+
## Próximos passos
|
|
63
|
+
|
|
64
|
+
Veja [sessões e importação](sessions-and-import.md), [importação retroativa](retroactive-import.md)
|
|
65
|
+
e [manutenção](maintenance-and-diagnostics.md).
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Instalação e primeiro uso
|
|
2
|
+
|
|
3
|
+
**PT-BR** · [English](../../en/commands/getting-started.md)
|
|
4
|
+
|
|
5
|
+
## Objetivo
|
|
6
|
+
|
|
7
|
+
Instalar o WendKeep, vincular o projeto ao cofre correto e ativar captura, memória e skills sem
|
|
8
|
+
sobrescrever configurações existentes.
|
|
9
|
+
|
|
10
|
+
## Quando usar
|
|
11
|
+
|
|
12
|
+
Use `wendkeep init` na primeira instalação e `wendkeep sync` depois de atualizar o pacote.
|
|
13
|
+
|
|
14
|
+
## Quando não usar
|
|
15
|
+
|
|
16
|
+
Não rode `init --force` para tentar reparar memória ou uma configuração ilegível. Use primeiro
|
|
17
|
+
`wendkeep doctor` e o comando de reparo indicado.
|
|
18
|
+
|
|
19
|
+
## Pré-requisitos
|
|
20
|
+
|
|
21
|
+
- Node.js 18 ou mais recente.
|
|
22
|
+
- Projeto local e permissão de escrita no cofre.
|
|
23
|
+
- Claude Code ou Codex; Obsidian é opcional para execução e recomendado para navegar no grafo.
|
|
24
|
+
|
|
25
|
+
## Sintaxe
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install --save-dev wendkeep
|
|
29
|
+
npx wendkeep init [opções]
|
|
30
|
+
npx wendkeep sync [--project <raiz>] [--vault <cofre>] [--profile <perfil>] [--yes]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Opções e códigos de saída
|
|
34
|
+
|
|
35
|
+
- `--vault <path>` escolhe o cofre; sem ele, o vínculo local `.wendkeep.json` prevalece.
|
|
36
|
+
- `--project <path>` aponta a raiz do projeto.
|
|
37
|
+
- `--profile <OFF|FLOW|GUIDE|GOVERN|ASSURE>` seleciona o Perfil de Operação; instalação nova usa
|
|
38
|
+
`GOVERN`, re-init/sync sem a flag preserva a escolha existente e `OFF` nunca é inferido.
|
|
39
|
+
- `--no-mcp`, `--no-colors` e `--no-companions` desativam integrações opcionais.
|
|
40
|
+
- `--companions <csv>` habilita companions explicitamente.
|
|
41
|
+
- `--yes` aceita defaults não interativos; `--force` atualiza apenas blocos gerenciados.
|
|
42
|
+
- Exit `0` indica instalação/sincronização concluída; exit diferente de zero identifica a etapa
|
|
43
|
+
que falhou. `sync` para em `init`, `sync-defs` ou `doctor`, sem esconder o erro.
|
|
44
|
+
- `sync` não pré-resolve o Vault antes de `init`: um vínculo inválido falha fechado nessa primeira
|
|
45
|
+
etapa, e apenas um vínculo validado segue para `sync-defs` e `doctor`; nunca há fallback global.
|
|
46
|
+
|
|
47
|
+
## Exemplos
|
|
48
|
+
|
|
49
|
+
Primeira instalação no projeto atual:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install --save-dev wendkeep
|
|
53
|
+
npx wendkeep init --profile GOVERN --no-companions
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Atualização posterior:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install --save-dev wendkeep@latest
|
|
60
|
+
npx wendkeep sync --yes
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Com pnpm, informe uma versão concreta porque políticas de idade mínima podem manter `latest`
|
|
64
|
+
atrasado silenciosamente:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pnpm add -D wendkeep@X.Y.Z --config.minimumReleaseAge=0
|
|
68
|
+
pnpm exec wendkeep sync --yes
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Resultado esperado
|
|
72
|
+
|
|
73
|
+
O projeto recebe `.wendkeep.json`, hooks gerenciados de Claude/Codex, definições de skills e um
|
|
74
|
+
cofre inicializado. Arquivos preexistentes são mesclados ou preservados; o comando informa o
|
|
75
|
+
cofre efetivamente selecionado.
|
|
76
|
+
|
|
77
|
+
## Erros comuns e diagnóstico
|
|
78
|
+
|
|
79
|
+
- Cofre errado: confira `.wendkeep.json` e rode `wendkeep doctor --vault <path>`.
|
|
80
|
+
- Hooks do Codex não executam: aprove o aviso **Hooks need review** no próximo startup.
|
|
81
|
+
- `defs stale`: rode `wendkeep sync-defs --reseed` e reinicie os agentes.
|
|
82
|
+
- `sync` para no doctor: leia a seção que falhou; não repita com `--force` sem entender a causa.
|
|
83
|
+
|
|
84
|
+
## Próximos passos
|
|
85
|
+
|
|
86
|
+
Veja [manutenção e diagnóstico](maintenance-and-diagnostics.md),
|
|
87
|
+
[sessões e importação](sessions-and-import.md) e [memória compartilhada](memory.md).
|