ruvnet-brain 4.6.4 → 4.7.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.
Files changed (82) hide show
  1. package/README.md +1 -1
  2. package/bin/install.mjs +65 -54
  3. package/config/practical-rule-catalog.json +22 -22
  4. package/console/app.js +1 -1
  5. package/console/architecture.html +2 -2
  6. package/package.json +1 -2
  7. package/plugin/.claude-plugin/plugin.json +1 -1
  8. package/plugin/.codex-plugin/plugin.json +1 -1
  9. package/plugin/.grok-plugin/plugin.json +12 -0
  10. package/plugin/commands/checkpoint.md +22 -40
  11. package/plugin/commands/rnb-brief.md +18 -15
  12. package/plugin/hooks/codex-hooks.json +1 -28
  13. package/plugin/hooks/grok-hooks.json +95 -0
  14. package/plugin/hooks/hook-contracts.json +6 -127
  15. package/plugin/hooks/hooks.json +1 -40
  16. package/plugin/host-adapters/grok.json +11 -0
  17. package/plugin/mcp/managed-cli-interface.mjs +0 -56
  18. package/plugin/scripts/agentdb-recall-reader.mjs +29 -9
  19. package/plugin/scripts/agentdb-recall.mjs +35 -27
  20. package/plugin/scripts/automated-run.mjs +42 -0
  21. package/plugin/scripts/brain-footprint.mjs +1 -1
  22. package/plugin/scripts/checkpoint-keys.mjs +46 -0
  23. package/plugin/scripts/codex-hook-wrapper.mjs +13 -3
  24. package/plugin/scripts/completion-claim-evidence.mjs +1 -1
  25. package/plugin/scripts/continuation-gate.mjs +6 -0
  26. package/plugin/scripts/continuity-events.mjs +90 -2
  27. package/plugin/scripts/continuity-hook-policy.mjs +5 -14
  28. package/plugin/scripts/decision-gate.mjs +2 -2
  29. package/plugin/scripts/decision-record.mjs +11 -40
  30. package/plugin/scripts/grok-hook-adapter.mjs +155 -0
  31. package/plugin/scripts/hook-failures.mjs +16 -0
  32. package/plugin/scripts/hook-shim.mjs +1 -2
  33. package/plugin/scripts/learn-capture.mjs +60 -42
  34. package/plugin/scripts/learning-store.mjs +70 -60
  35. package/plugin/scripts/node-sqlite.mjs +1 -1
  36. package/plugin/scripts/ruflo-bin.mjs +71 -1
  37. package/plugin/scripts/ruflo-memory-hooks.mjs +204 -0
  38. package/plugin/scripts/runtime-preferences.mjs +1 -1
  39. package/plugin/scripts/session-snapshot-hook.mjs +85 -341
  40. package/plugin/scripts/session-start-core.mjs +2 -12
  41. package/plugin/scripts/signal-watch.mjs +1 -1
  42. package/plugin/scripts/substitution-wall.mjs +222 -0
  43. package/plugin/scripts/turn-outcome-capture.mjs +68 -74
  44. package/scripts/codex-host-execution-proof.mjs +1 -1
  45. package/scripts/console-engine.mjs +0 -32
  46. package/scripts/health-repair.mjs +1 -81
  47. package/scripts/hook-qualify-core.mjs +2 -2
  48. package/scripts/model-managed-workflow-service.mjs +9 -10
  49. package/scripts/model-native-qualification.mjs +17 -5
  50. package/scripts/model-routing-controller.mjs +9 -8
  51. package/scripts/model-routing-execution-adapters.mjs +24 -2
  52. package/scripts/model-weekly-cycle.mjs +13 -12
  53. package/scripts/no-silent-substitution.mjs +65 -1
  54. package/scripts/onboarding-console.mjs +8 -23
  55. package/scripts/product-integrity-contract.mjs +1 -1
  56. package/scripts/release-qualification-contract.mjs +21 -30
  57. package/scripts/remedy-registry.mjs +0 -18
  58. package/scripts/user-model-prompt-hook.mjs +11 -10
  59. package/scripts/wired-check.mjs +1 -5
  60. package/plugin/scripts/continuity-brief.mjs +0 -351
  61. package/plugin/scripts/continuity-journal.mjs +0 -553
  62. package/plugin/scripts/learn-flush.mjs +0 -96
  63. package/plugin/scripts/learning-observation.mjs +0 -51
  64. package/plugin/scripts/learning-queue.mjs +0 -135
  65. package/plugin/scripts/learning-worker-supervisor.mjs +0 -79
  66. package/plugin/scripts/project-capture-queue.mjs +0 -357
  67. package/plugin/scripts/project-memory-enrollment.mjs +0 -203
  68. package/plugin/scripts/project-progression-checkpoint.mjs +0 -145
  69. package/plugin/scripts/project-progression-contract.mjs +0 -496
  70. package/plugin/scripts/project-progression-hook.mjs +0 -233
  71. package/plugin/scripts/project-progression-outbox.mjs +0 -225
  72. package/plugin/scripts/project-progression-producer.mjs +0 -309
  73. package/plugin/scripts/project-progression-reader.mjs +0 -304
  74. package/plugin/scripts/project-progression-session-start.mjs +0 -320
  75. package/plugin/scripts/project-progression-sources.mjs +0 -246
  76. package/plugin/scripts/project-progression-store.mjs +0 -723
  77. package/plugin/scripts/project-progression-suspension.mjs +0 -60
  78. package/plugin/scripts/project-transition-hook.mjs +0 -267
  79. package/plugin/scripts/session-snapshot-contract.mjs +0 -105
  80. package/plugin/scripts/turn-transport-journal.mjs +0 -108
  81. package/scripts/qa/progression-validation-benchmark.mjs +0 -66
  82. package/scripts/session-snapshot-contract.mjs +0 -1
@@ -1,61 +1,43 @@
1
1
  ---
2
- description: "Write a full project checkpoint to this project's canonical AgentDB store — the goal, the acceptance contract, the decisions, what is done, what is blocked, and the exact next action — so the next session (in Claude Code or Codex) resumes from a verified record instead of from nothing. Prints a read-back receipt."
3
- updated: 2026-09-11
2
+ description: "Write a project checkpoint to this project's AgentDB store with `ruflo memory store` — the goal, the acceptance contract, the decisions, what is done, what is blocked, and the exact next action — and prove it by exact-key `ruflo memory retrieve`. The next session (Claude Code or Codex) restores the newest checkpoint by exact key."
3
+ updated: 2026-10-12
4
4
  ---
5
5
 
6
6
  # RuvNet-Brain: checkpoint
7
7
 
8
8
  The user is asking you to **persist the state of this project** so the next session can resume it.
9
9
 
10
- Automatic capture already runs at Stop, PreCompact and SessionEnd, and it records everything that can
11
- be READ from the machine: the git tree, their work ledger, their newest `project-state-current` note,
12
- a bounded transcript reference. **It cannot read what only you know** — the acceptance contract you
13
- are working to, the decision you just made and why, the exact next action. That is what this command
14
- is for, and it is why a checkpoint is worth more than another automatic snapshot.
10
+ PreCompact and SessionEnd already store a small automatic `project-state-auto-<ms>` marker (event,
11
+ branch, head). **It cannot record what only you know** — the acceptance contract, the decision you
12
+ just made and why, the exact next action. That is what this command is for.
15
13
 
16
14
  ## Do this
17
15
 
18
- **1. Write down the real state — from THIS session, not from a template.**
16
+ **1. Write down the real state — from THIS session, not from a template.** Plain text or JSON with the
17
+ fields you can honestly fill: current goal, acceptance contract, next action, decisions (and why),
18
+ completed / in progress / blockers, failures, changed files, proof artifacts, and what is UNTESTED.
19
+ Empty is better than invented: a fabricated "next action" is worse than none.
19
20
 
20
- Build a JSON object with the fields you can honestly fill. Every field is optional; set at least one.
21
- Empty is better than invented: a fabricated "next action" is worse than no next action, because the
22
- next session will act on it.
23
-
24
- | field | what goes in it |
25
- |---|---|
26
- | `currentGoal` | one sentence: what this work is actually for |
27
- | `acceptanceContract` | what would make it DONE — the conditions, not the vibe |
28
- | `nextAction` | the single next concrete step, specific enough to start cold |
29
- | `decisions` | decisions made and WHY; include the ones you'd otherwise have to re-derive |
30
- | `completed` / `inProgress` / `blockers` | honest status; a blocker named is a blocker halved |
31
- | `failures` | what was tried and did not work, so it is not tried again |
32
- | `changedFiles` | the files this work touched |
33
- | `proofArtifacts` | commands run, outputs seen, receipts — the evidence, not the claim |
34
- | `untested` | what was built but NOT verified. Do not omit this one. |
35
-
36
- **2. Store it.**
21
+ **2. Store it with rUv's own tool** (append-only: a new key every time, never an update), in the
22
+ project's namespace (the repository directory name):
37
23
 
38
24
  ```bash
39
- node "${CLAUDE_PLUGIN_ROOT}/scripts/project-progression-checkpoint.mjs" --json '<your JSON>'
25
+ KEY="project-state-current-$(node -e 'process.stdout.write(String(Date.now()))')"
26
+ ruflo memory store -k "$KEY" -n "<project-dir-name>" --path "<project>/.swarm/memory.db" --value "<the checkpoint text>"
40
27
  ```
41
28
 
42
- For anything longer than a line or two, write the JSON to a temp file first and use
43
- `--json-file <path>` — a large single-quoted argument is how a shell mangles a checkpoint.
44
-
45
- **3. Report the receipt, not a claim.**
29
+ **3. Prove it, then report the receipt, not a claim.**
46
30
 
47
- The command prints the exact event key, the payload digest, and the digest of the row **read back
48
- from the store by that exact key**. Tell the user it is stored only when `readbackVerified` is
49
- `true`. If the command exits non-zero, say exactly what it printed — an unstored checkpoint that is
50
- reported as stored is the specific failure this whole system exists to prevent.
31
+ ```bash
32
+ ruflo memory retrieve -k "$KEY" -n "<project-dir-name>" --path "<project>/.swarm/memory.db" --value-only
33
+ ```
51
34
 
52
- If it reports `replayedPending`, say so: those were snapshots a previously interrupted session had
53
- made durable but never committed, and this checkpoint settled them.
35
+ Say it is stored only when the retrieved value is exactly what you stored. If either command exits
36
+ non-zero, quote what it printed.
54
37
 
55
38
  ## What NOT to do
56
39
 
57
40
  - **Do not** invent progress, decisions, or proof to make the checkpoint look complete.
58
- - **Do not** write the user's secrets into it. Redaction runs anyway, but do not rely on it.
59
- - **Do not** hand-write rows into `.swarm/memory.db` or call `ruflo memory store` yourself. This
60
- command is the one writer; a second path is how two stores drift apart.
61
- - **Do not** claim the next session "will remember" anything the receipt did not confirm.
41
+ - **Do not** write secrets into it.
42
+ - **Do not** reuse a key: `project-state-current-<epochms>` is append-only, so concurrent sessions never
43
+ overwrite each other. SessionStart restores the newest one by exact key.
@@ -1,41 +1,44 @@
1
1
  ---
2
- description: "Come up to speed on this project from AgentDB: the brief (state, what changed, decisions, standing rules, open items, gate outcomes, agent findings) and, on request, the full recorded history. Also records a decision, lesson or open item explicitly, with a read-back receipt."
3
- updated: 2026-10-01
2
+ description: "Come up to speed on this project from AgentDB with rUv's own tools: the newest project-state-current checkpoint, lessons, recent turn outcomes and decisions, read by exact key with `ruflo memory list|retrieve|search`. Also records a decision, lesson or open item with a read-back receipt."
3
+ updated: 2026-10-12
4
4
  ---
5
5
 
6
6
  # RuvNet-Brain: rnb-brief
7
7
 
8
8
  The user wants to know **what has happened on this project**, from the record — not from your memory.
9
+ Every command below is `ruflo` (the global binary); `<db>` is `<project>/.swarm/memory.db` and `<ns>` is
10
+ the project directory name.
9
11
 
10
12
  ## Do this
11
13
 
12
- **1. Show the brief.** Run it and show the output as-is:
14
+ **1. The newest checkpoint.** List, pick the newest `project-state-current-*` key, read it exactly:
13
15
 
14
16
  ```bash
15
- node "${CLAUDE_PLUGIN_ROOT}/scripts/continuity-brief.mjs"
17
+ ruflo memory list -n <ns> --limit 1000 --format json --path <db>
18
+ ruflo memory retrieve -k <newest project-state-current-key> -n <ns> --value-only --path <db>
16
19
  ```
17
20
 
18
- **2. If they asked for more** (history, "everything", one kind of thing, a time window), pull it:
21
+ **2. Lessons, decisions and recent turns.**
19
22
 
20
23
  ```bash
21
- node "${CLAUDE_PLUGIN_ROOT}/scripts/continuity-brief.mjs" --full [--kind decision|lesson|commit|release|gate|finding|open-item] [--since 7d] [--limit 200]
24
+ ruflo memory list -n lessons --format json --path <db>
25
+ ruflo memory list -n turns --limit 20 --format json --path <db>
26
+ ruflo memory search -q "<what the user asked about>" -n continuity-events --limit 10 --path <db>
22
27
  ```
23
28
 
24
- Every line carries its provenance (the AgentDB key and time, or the commit SHA). Quote it when you
25
- rely on an item. A line marked `detected` was inferred from the transcript, not stated explicitly —
26
- say so. A line marked `PENDING` is durable in the outbox but not yet committed to AgentDB.
29
+ Quote the key of every item you rely on. Search hits are ranked previews: read the exact value with
30
+ `ruflo memory retrieve` before asserting it.
27
31
 
28
32
  **3. If they asked you to record something** (a decision, a standing rule, an open item):
29
33
 
30
34
  ```bash
31
- node "${CLAUDE_PLUGIN_ROOT}/scripts/continuity-brief.mjs" --record --kind decision|lesson|open-item --text "<exactly what was decided>" [--owner "<who>"]
35
+ ruflo memory store -k "<decision|lesson|open-item>-$(node -e 'process.stdout.write(String(Date.now()))')" -n continuity-events --path <db> --value "<exactly what was decided>"
36
+ ruflo memory retrieve -k <that key> -n continuity-events --value-only --path <db>
32
37
  ```
33
38
 
34
- Report it as stored only when it prints `stored-and-read-back`. `durable-pending` means it is safe in the
35
- outbox and will commit at the next capture boundary — say exactly that, not "stored".
39
+ Report it as stored only when the retrieved value matches exactly.
36
40
 
37
41
  ## What NOT to do
38
42
 
39
- - Do not summarize the history from memory or from the conversation instead of running the command.
40
- - Do not hand-write rows into `.swarm/memory.db` or call `ruflo memory store` for these yourself.
41
- - If the last line says `AgentDB: recording stuck`, tell the user that line verbatim before anything else.
43
+ - Do not summarize the history from memory or from the conversation instead of running the commands.
44
+ - Do not use the MCP `agentdb_hierarchical-*` tools for this: they read a different store.
@@ -1,5 +1,5 @@
1
1
  {
2
- "description": "RuvNet Brain continuity plane for Codex. Broad legacy automatic gates remain retired. Registrations here are MEASURED, not assumed: a probe hook was registered on all twelve event names the installed codex-cli 0.154.0 binary declares and a real `codex exec` run was observed (2026-09-11). SessionStart, UserPromptSubmit and SessionEnd FIRED and carry handlers. Stop keeps the pre-existing, project-scoped continuation gate; session-snapshot was added at Stop on 2026-09-29 to record each turn's outcome (turn-outcome-capture.mjs) — Codex SessionEnd carries no last_assistant_message, so Stop is the only boundary that can. Its delivery rests on codex-cli 0.158.0's declared stop.command.input schema and the other Codex Stop handlers; it has NOT been live-observed and fails open. PreCompact uses the existing session-snapshot capture handler: Codex0.160.1 declares this native boundary. Registration is not proof of native delivery; manual/automatic delivery remains separately evidenced. All handlers are bounded and fail open. Amended 2026-09-11: UserPromptSubmit also runs ground-ruvnet (grounding injection, ADR-040 §Amendment). Amended 2026-09-12: the 2026-09-11 PreToolUse/PostToolUse \"not observed\" note was measured with a prompt (`codex exec \"reply OK\"`) that never invoked a tool, so neither event had anything to fire on — that was an untested path, not a failing one. Re-probed with prompts that actually call a tool: a real apply_patch write fired PreToolUse/PostToolUse with tool_name \"apply_patch\", and a real MCP call to this repo's own search_ruvnet server fired both with tool_name \"mcp__ruvnet_brain__search_ruvnet\". Both are now registered below: decision-gate's write route (matcher includes apply_patch, Codex's raw write-tool name) and grounding-stamp (unchanged matcher already recognizes the mcp__..__search_ruvnet shape). The bash route (exec_command) remains unregistered — today's measurement covered a write and an MCP call, not exec_command, and extending on that evidence would be the same unproven leap this note replaces. Also added 2026-09-12: grounding-turn-mark (UserPromptSubmit) and grounding-turn-gate (Stop), the \"answered without searching\" pair — a prompt-level grounding directive is advisory, so this records whether it fired and forces continuation at Stop if no search_ruvnet call was recorded since (reusing grounding-stamp's own stamp evidence). Both are registered on Codex identically to Claude: the Stop-block contract (hookSpecificOutput.additionalContext) already has a proven Codex translation via codex-hook-adapter.mjs's Stop branch (see tests/unit/codex-lifecycle-hooks.test.mjs), the same path continuation-gate already uses. Capacity-aware parallel-work guidance is also registered at UserPromptSubmit: it advises the coordinator to launch only real independent workers within sampled resource headroom and the live runtime/tool cap; it never spawns workers or claims execution. Automatic normalized project observations are captured at prompt, pre-tool, post-tool and child completion; Claude also observes PostToolUseFailure. Queued memory is silent (the normal state at prompt and tool boundaries); a stuck queue (queued work older than 10 minutes), an unwritable queue and a hook that failed or timed out internally are disclosed; this does not establish synchronous ADR-073 conformance or native Grok recall. SessionStart has an 8-second measured replay/restore envelope. Issue377: consent-eligible learning captures only fixed workflow metadata; lifecycle recovery schedules one finite worker. Original records remain retained with hash-bound acknowledgments. Native delivery must be separately evidenced; registration is not proof. Amended 2026-10-11 (ADR-106): learning capture and recovery no longer have their own registrations; session-snapshot PostToolUse captures in-process, and session-start and session-snapshot SessionEnd schedule learn-flush detached, with learningContext() owning consent and brain-off. A failed advisory body is recorded by the shim and summarized once at SessionStart. decision-gate also consults decision-recall (a new ADR or ADR status change needs a fresh AgentDB consult) and continuation-gate asks once for a decision record after a new ADR.",
2
+ "description": "RuvNet Brain continuity plane for Codex. Broad legacy automatic gates remain retired. Registrations here are MEASURED, not assumed: a probe hook was registered on all twelve event names the installed codex-cli 0.154.0 binary declares and a real `codex exec` run was observed (2026-09-11). SessionStart, UserPromptSubmit and SessionEnd FIRED and carry handlers. Stop keeps the pre-existing, project-scoped continuation gate; session-snapshot was added at Stop on 2026-09-29 to record each turn's outcome (turn-outcome-capture.mjs) — Codex SessionEnd carries no last_assistant_message, so Stop is the only boundary that can. Its delivery rests on codex-cli 0.158.0's declared stop.command.input schema and the other Codex Stop handlers; it has NOT been live-observed and fails open. PreCompact uses the existing session-snapshot capture handler: Codex0.160.1 declares this native boundary. Registration is not proof of native delivery; manual/automatic delivery remains separately evidenced. All handlers are bounded and fail open. Amended 2026-09-11: UserPromptSubmit also runs ground-ruvnet (grounding injection, ADR-040 §Amendment). Amended 2026-09-12: the 2026-09-11 PreToolUse/PostToolUse \"not observed\" note was measured with a prompt (`codex exec \"reply OK\"`) that never invoked a tool, so neither event had anything to fire on — that was an untested path, not a failing one. Re-probed with prompts that actually call a tool: a real apply_patch write fired PreToolUse/PostToolUse with tool_name \"apply_patch\", and a real MCP call to this repo's own search_ruvnet server fired both with tool_name \"mcp__ruvnet_brain__search_ruvnet\". Both are now registered below: decision-gate's write route (matcher includes apply_patch, Codex's raw write-tool name) and grounding-stamp (unchanged matcher already recognizes the mcp__..__search_ruvnet shape). The bash route (exec_command) remains unregistered — today's measurement covered a write and an MCP call, not exec_command, and extending on that evidence would be the same unproven leap this note replaces. Also added 2026-09-12: grounding-turn-mark (UserPromptSubmit) and grounding-turn-gate (Stop), the \"answered without searching\" pair — a prompt-level grounding directive is advisory, so this records whether it fired and forces continuation at Stop if no search_ruvnet call was recorded since (reusing grounding-stamp's own stamp evidence). Both are registered on Codex identically to Claude: the Stop-block contract (hookSpecificOutput.additionalContext) already has a proven Codex translation via codex-hook-adapter.mjs's Stop branch (see tests/unit/codex-lifecycle-hooks.test.mjs), the same path continuation-gate already uses. Capacity-aware parallel-work guidance is also registered at UserPromptSubmit: it advises the coordinator to launch only real independent workers within sampled resource headroom and the live runtime/tool cap; it never spawns workers or claims execution. Automatic normalized project observations are captured at prompt, pre-tool, post-tool and child completion; Claude also observes PostToolUseFailure. Queued memory is silent (the normal state at prompt and tool boundaries); a stuck queue (queued work older than 10 minutes), an unwritable queue and a hook that failed or timed out internally are disclosed; this does not establish synchronous ADR-073 conformance or native Grok recall. SessionStart has an 8-second measured replay/restore envelope. Issue377: consent-eligible learning captures only fixed workflow metadata; lifecycle recovery schedules one finite worker. Original records remain retained with hash-bound acknowledgments. Native delivery must be separately evidenced; registration is not proof. Amended 2026-10-12 (ADR-106): lifecycle memory only calls ruflo; no local queue, journal or outbox; a refused write is a hook-failures row.",
3
3
  "hooks": {
4
4
  "SessionStart": [
5
5
  {
@@ -36,16 +36,6 @@
36
36
  }
37
37
  ],
38
38
  "PreToolUse": [
39
- {
40
- "matcher": "*",
41
- "hooks": [
42
- {
43
- "type": "command",
44
- "command": "node -e \"const f=require('node:fs'),o=require('node:os'),p=require('node:path'),c=require('node:child_process'),d=process.env.CODEX_HOME||p.join(o.homedir(),'.codex'),b=process.env.RUVNET_BRAIN_HOME||p.join(p.dirname(d),'.cache','ruvnet-brain'),w=p.join(b,'codex-hook.mjs');let s;try{s=f.statSync(w)}catch{}if(!s?.isFile())process.exit(0);const r=c.spawnSync(process.execPath,[w,...process.argv.slice(2)],{stdio:['inherit','pipe','pipe'],encoding:'utf8',env:process.env,timeout:Number(process.argv[1]),killSignal:'SIGKILL'});if(r.status===0||r.status===2){if(r.stdout)process.stdout.write(r.stdout);if(r.stderr)process.stderr.write(r.stderr)}process.exit(r.status===2?2:0)\" 9000 session-snapshot PreToolUse",
45
- "timeout": 10
46
- }
47
- ]
48
- },
49
39
  {
50
40
  "matcher": "^(Write|Edit|MultiEdit|NotebookEdit|apply_patch)$",
51
41
  "hooks": [
@@ -83,11 +73,6 @@
83
73
  {
84
74
  "matcher": "*",
85
75
  "hooks": [
86
- {
87
- "type": "command",
88
- "command": "node -e \"const f=require('node:fs'),o=require('node:os'),p=require('node:path'),c=require('node:child_process'),d=process.env.CODEX_HOME||p.join(o.homedir(),'.codex'),b=process.env.RUVNET_BRAIN_HOME||p.join(p.dirname(d),'.cache','ruvnet-brain'),w=p.join(b,'codex-hook.mjs');let s;try{s=f.statSync(w)}catch{}if(!s?.isFile())process.exit(0);const r=c.spawnSync(process.execPath,[w,...process.argv.slice(2)],{stdio:['inherit','pipe','pipe'],encoding:'utf8',env:process.env,timeout:Number(process.argv[1]),killSignal:'SIGKILL'});if(r.status===0||r.status===2){if(r.stdout)process.stdout.write(r.stdout);if(r.stderr)process.stderr.write(r.stderr)}process.exit(r.status===2?2:0)\" 9000 session-snapshot UserPromptSubmit",
89
- "timeout": 10
90
- },
91
76
  {
92
77
  "type": "command",
93
78
  "command": "node -e \"const f=require('node:fs'),o=require('node:os'),p=require('node:path'),c=require('node:child_process'),d=process.env.CODEX_HOME||p.join(o.homedir(),'.codex'),b=process.env.RUVNET_BRAIN_HOME||p.join(p.dirname(d),'.cache','ruvnet-brain'),w=p.join(b,'codex-hook.mjs');let s;try{s=f.statSync(w)}catch{}if(!s?.isFile())process.exit(0);const r=c.spawnSync(process.execPath,[w,...process.argv.slice(2)],{stdio:['inherit','pipe','pipe'],encoding:'utf8',env:process.env,timeout:Number(process.argv[1]),killSignal:'SIGKILL'});if(r.status===0||r.status===2){if(r.stdout)process.stdout.write(r.stdout);if(r.stderr)process.stderr.write(r.stderr)}process.exit(r.status===2?2:0)\" 9000 unprompted-speech UserPromptSubmit",
@@ -123,18 +108,6 @@
123
108
  ]
124
109
  }
125
110
  ],
126
- "SubagentStop": [
127
- {
128
- "matcher": "*",
129
- "hooks": [
130
- {
131
- "type": "command",
132
- "command": "node -e \"const f=require('node:fs'),o=require('node:os'),p=require('node:path'),c=require('node:child_process'),d=process.env.CODEX_HOME||p.join(o.homedir(),'.codex'),b=process.env.RUVNET_BRAIN_HOME||p.join(p.dirname(d),'.cache','ruvnet-brain'),w=p.join(b,'codex-hook.mjs');let s;try{s=f.statSync(w)}catch{}if(!s?.isFile())process.exit(0);const r=c.spawnSync(process.execPath,[w,...process.argv.slice(2)],{stdio:['inherit','pipe','pipe'],encoding:'utf8',env:process.env,timeout:Number(process.argv[1]),killSignal:'SIGKILL'});if(r.status===0||r.status===2){if(r.stdout)process.stdout.write(r.stdout);if(r.stderr)process.stderr.write(r.stderr)}process.exit(r.status===2?2:0)\" 9000 session-snapshot SubagentStop",
133
- "timeout": 10
134
- }
135
- ]
136
- }
137
- ],
138
111
  "PreCompact": [
139
112
  {
140
113
  "hooks": [
@@ -0,0 +1,95 @@
1
+ {
2
+ "description": "RuvNet Brain lifecycle plane for Grok CLI. Grok selects this file through plugin/.grok-plugin/plugin.json (measured on grok 1.0.50: a plugin directory carrying that manifest registers ONLY this file, so the Claude registry plugin/hooks/hooks.json is not also run). Every command enters plugin/scripts/grok-hook-adapter.mjs, which normalizes the Grok payload, withholds Grok's non-Claude transcript, skips the session-end Stop fire, runs the SAME hook-shim.mjs bodies as Claude and Codex, and returns Grok-valid output. Registered: decision-gate write route (PreToolUse, the only refuser), session-snapshot and grounding-stamp (PostToolUse), grounding-turn-mark (UserPromptSubmit, a marker file only), continuation-gate + session-snapshot + grounding-turn-gate (Stop), session-snapshot (PreCompact, SessionEnd). Deliberately NOT registered on Grok: session-start, ground-ruvnet, unprompted-speech and capacity-aware-parallel-work. Grok ignores SessionStart stdout and discards an allowing UserPromptSubmit hook's stdout (~/.grok/docs/user-guide/10-hooks.md:113, :507, :531), so they would spend time on every session or prompt and deliver nothing, and session-start would consume the once-only hook-failure summary where nobody sees it. UNVERIFIED (docs silent, not measured): whether Grok honours a SessionEnd timeout above its 1.5 s default (10-hooks.md:477-478); the payload tool_name of an MCP search_ruvnet call and whether grounding-stamp accepts Grok's toolResult shape; PreCompact delivery (no compaction was driven); Windows expansion of ${GROK_PLUGIN_ROOT} (10-hooks.md:581 describes it; not measured).",
3
+ "hooks": {
4
+ "PreToolUse": [
5
+ {
6
+ "matcher": "^(write|search_replace|Write|Edit|MultiEdit|NotebookEdit)$",
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "node \"${GROK_PLUGIN_ROOT}/scripts/grok-hook-adapter.mjs\" decision-gate write",
11
+ "timeout": 8
12
+ }
13
+ ]
14
+ }
15
+ ],
16
+ "PostToolUse": [
17
+ {
18
+ "matcher": "*",
19
+ "hooks": [
20
+ {
21
+ "type": "command",
22
+ "command": "node \"${GROK_PLUGIN_ROOT}/scripts/grok-hook-adapter.mjs\" session-snapshot PostToolUse",
23
+ "timeout": 10
24
+ }
25
+ ]
26
+ },
27
+ {
28
+ "matcher": "^(?:.*__)?search_ruvnet$",
29
+ "hooks": [
30
+ {
31
+ "type": "command",
32
+ "command": "node \"${GROK_PLUGIN_ROOT}/scripts/grok-hook-adapter.mjs\" grounding-stamp",
33
+ "timeout": 5
34
+ }
35
+ ]
36
+ }
37
+ ],
38
+ "UserPromptSubmit": [
39
+ {
40
+ "hooks": [
41
+ {
42
+ "type": "command",
43
+ "command": "node \"${GROK_PLUGIN_ROOT}/scripts/grok-hook-adapter.mjs\" grounding-turn-mark",
44
+ "timeout": 5
45
+ }
46
+ ]
47
+ }
48
+ ],
49
+ "Stop": [
50
+ {
51
+ "hooks": [
52
+ {
53
+ "type": "command",
54
+ "command": "node \"${GROK_PLUGIN_ROOT}/scripts/grok-hook-adapter.mjs\" continuation-gate",
55
+ "timeout": 10
56
+ },
57
+ {
58
+ "type": "command",
59
+ "command": "node \"${GROK_PLUGIN_ROOT}/scripts/grok-hook-adapter.mjs\" session-snapshot Stop",
60
+ "timeout": 10
61
+ },
62
+ {
63
+ "type": "command",
64
+ "command": "node \"${GROK_PLUGIN_ROOT}/scripts/grok-hook-adapter.mjs\" grounding-turn-gate",
65
+ "timeout": 10
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ "PreCompact": [
71
+ {
72
+ "matcher": "*",
73
+ "hooks": [
74
+ {
75
+ "type": "command",
76
+ "command": "node \"${GROK_PLUGIN_ROOT}/scripts/grok-hook-adapter.mjs\" session-snapshot PreCompact",
77
+ "timeout": 10
78
+ }
79
+ ]
80
+ }
81
+ ],
82
+ "SessionEnd": [
83
+ {
84
+ "matcher": "*",
85
+ "hooks": [
86
+ {
87
+ "type": "command",
88
+ "command": "node \"${GROK_PLUGIN_ROOT}/scripts/grok-hook-adapter.mjs\" session-snapshot SessionEnd",
89
+ "timeout": 3
90
+ }
91
+ ]
92
+ }
93
+ ]
94
+ }
95
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "_note": "The legacy automatic gate collection remains retired. What is permitted is the continuity plane below and nothing else: SessionStart restores the canonical project checkpoint; UserPromptSubmit runs the single unprompted-speech chokepoint; Stop may nudge one explicitly authorized project-scoped objective AND capture a project snapshot; PreCompact and SessionEnd capture a project snapshot. Version 3 of this file permitted exactly two handlers, which was not a safety property but a contradiction: it demanded a restore while forbidding any event that could WRITE the journal the restore reads, so the canonical store held zero progression rows. Adding to this list is still a deliberate act that must pass `npm run hooks:check`; what changed is that the shape can now express the plane that actually works. Amended 2026-09-11 (Stuart): the continuity-only charter had retired the ONLY enforcement of ADR-0012 — never write rUv-product code the brain has not seen — and the failure it exists to prevent recurred the day it was measured absent. The plane now also carries three grounding registrations: ground-ruvnet (UserPromptSubmit, grounding injection — a second owner of that event, scoped by ADR-040 §Amendment 2026-09-11 to directives rather than speech), decision-gate’s write route (PreToolUse, the one refuser, ADR-067), and grounding-stamp (PostToolUse on a successful search_ruvnet, the receipt that opens the write gate). Amended 2026-09-12: the 2026-09-11 claim that Codex PreToolUse/PostToolUse delivery had never been observed was measured with a prompt that never invoked a tool (`codex exec \"reply OK\"`), so it was an untested path, not a failing one. Re-measured with prompts that actually call a tool (a real apply_patch write, a real MCP search_ruvnet call against this repo's own server): both events FIRED on codex-cli 0.154.0 with real payloads. decision-gate's write route and grounding-stamp are now dual-host (see _codexCapture and contracts below); the bash route (exec_command) remains Claude-only — today's measurement did not exercise it. Also amended 2026-09-12: added grounding-turn-mark (UserPromptSubmit) and grounding-turn-gate (Stop), the \"answered without searching\" pair — ground-ruvnet's Gate 1 directive is advisory, so nothing previously checked whether the model complied before the turn ended. grounding-turn-mark records that Gate 1 fired for a turn; grounding-turn-gate forces continuation at Stop if grounding-stamp's own evidence shows no search_ruvnet call happened since. Both dual-host from the start (the Stop-block contract is already proven on Codex via continuation-gate). Added capacity-aware-parallel-work at UserPromptSubmit on both measured hosts: it is context-only, resource-bounded, and requires the coordinator to check actual tool/runtime slots; it does not spawn or claim workers. Amended 2026-09-30 (ADR-0030 decision point #1, no new registration): grounding-turn-mark also arms a turn when the prompt asks a capability/feasibility/architecture question about any tool or platform, and grounding-turn-gate then requires every capability claim in the final answer to be bound to a relevant STRONG source read this turn after the last weak one (a WebFetch body is a small model's summary: weak); on Claude it reads the transcript instead of stamp mtimes, which removed the measured 'no search recorded' false alarms. ADR-0030 #2/#3 run in shadow only. Amendment 2026-10-03: normalized prompt/tool/failure/child observations are automatic; startup replays before restoring. Queued and unavailable evidence remain distinct from exact committed readback. Native Grok prompt recall is unsupported. Amendment 2026-10-11 (ADR-106): learn-flush (SessionStart, SessionEnd) and learn-capture (PostToolUse) are no longer separate registrations; session-start, session-snapshot SessionEnd and session-snapshot PostToolUse run them in-process or detached, with learningContext() still owning consent and brain-off. All three were trailing groups, so no surviving Codex trust position or hash moved. decision-gate gained the decision-recall policy and continuation-gate the decision-record check (ADR-105 §8) without new registrations; the shim records failed advisory bodies for one SessionStart summary.",
2
+ "_note": "The legacy automatic gate collection remains retired. What is permitted is the continuity plane below and nothing else: SessionStart restores the canonical project checkpoint; UserPromptSubmit runs the single unprompted-speech chokepoint; Stop may nudge one explicitly authorized project-scoped objective AND capture a project snapshot; PreCompact and SessionEnd capture a project snapshot. Version 3 of this file permitted exactly two handlers, which was not a safety property but a contradiction: it demanded a restore while forbidding any event that could WRITE the journal the restore reads, so the canonical store held zero progression rows. Adding to this list is still a deliberate act that must pass `npm run hooks:check`; what changed is that the shape can now express the plane that actually works. Amended 2026-09-11 (Stuart): the continuity-only charter had retired the ONLY enforcement of ADR-0012 — never write rUv-product code the brain has not seen — and the failure it exists to prevent recurred the day it was measured absent. The plane now also carries three grounding registrations: ground-ruvnet (UserPromptSubmit, grounding injection — a second owner of that event, scoped by ADR-040 §Amendment 2026-09-11 to directives rather than speech), decision-gate’s write route (PreToolUse, the one refuser, ADR-067), and grounding-stamp (PostToolUse on a successful search_ruvnet, the receipt that opens the write gate). Amended 2026-09-12: the 2026-09-11 claim that Codex PreToolUse/PostToolUse delivery had never been observed was measured with a prompt that never invoked a tool (`codex exec \"reply OK\"`), so it was an untested path, not a failing one. Re-measured with prompts that actually call a tool (a real apply_patch write, a real MCP search_ruvnet call against this repo's own server): both events FIRED on codex-cli 0.154.0 with real payloads. decision-gate's write route and grounding-stamp are now dual-host (see _codexCapture and contracts below); the bash route (exec_command) remains Claude-only — today's measurement did not exercise it. Also amended 2026-09-12: added grounding-turn-mark (UserPromptSubmit) and grounding-turn-gate (Stop), the \"answered without searching\" pair — ground-ruvnet's Gate 1 directive is advisory, so nothing previously checked whether the model complied before the turn ended. grounding-turn-mark records that Gate 1 fired for a turn; grounding-turn-gate forces continuation at Stop if grounding-stamp's own evidence shows no search_ruvnet call happened since. Both dual-host from the start (the Stop-block contract is already proven on Codex via continuation-gate). Added capacity-aware-parallel-work at UserPromptSubmit on both measured hosts: it is context-only, resource-bounded, and requires the coordinator to check actual tool/runtime slots; it does not spawn or claim workers. Amended 2026-09-30 (ADR-0030 decision point #1, no new registration): grounding-turn-mark also arms a turn when the prompt asks a capability/feasibility/architecture question about any tool or platform, and grounding-turn-gate then requires every capability claim in the final answer to be bound to a relevant STRONG source read this turn after the last weak one (a WebFetch body is a small model's summary: weak); on Claude it reads the transcript instead of stamp mtimes, which removed the measured 'no search recorded' false alarms. ADR-0030 #2/#3 run in shadow only. Amendment 2026-10-03: normalized prompt/tool/failure/child observations are automatic; startup replays before restoring. Queued and unavailable evidence remain distinct from exact committed readback. Native Grok prompt recall is unsupported. Amendment 2026-10-12 (ADR-106): the hand-rolled progression store, outbox, capture queue, continuity journal, turn journal and learning queue are deleted; session-snapshot keeps Stop (turn outcome), PreCompact/SessionEnd (checkpoint + distill) and PostToolUse (opted-in learning), each a direct `ruflo memory store` with exact-key readback, and a refusal is a hook-failures row.",
3
3
  "_version": 12,
4
4
  "_eventOwners": [
5
5
  {
@@ -10,7 +10,7 @@
10
10
  "claude",
11
11
  "codex"
12
12
  ],
13
- "responsibility": "Replay consent-eligible pending canonical memory within the shared startup budget, then restore only verified coherent state; disclose pending or unavailable rather than silently treating an older checkpoint as latest."
13
+ "responsibility": "Restore the newest project-state-current-* checkpoint (and a newer project-state-auto-* one) by exact-key `ruflo memory retrieve`, list lesson keys, and summarize hook failures once; disclose unknown rather than claim a restore."
14
14
  },
15
15
  {
16
16
  "event": "UserPromptSubmit",
@@ -40,7 +40,7 @@
40
40
  "claude",
41
41
  "codex"
42
42
  ],
43
- "responsibility": "Persist redacted turn outcomes through the fsynced canonical-project journal; queued is not recorded. No global fallback. Exact-key content readback commits transport; terminal boundaries also distill eligible records."
43
+ "responsibility": "Write the redacted turn outcome with one bounded `ruflo memory store` in namespace turns and prove it by exact-key readback; a refusal is a hook-failures row. No journal, outbox or replay."
44
44
  },
45
45
  {
46
46
  "event": "PreCompact",
@@ -50,7 +50,7 @@
50
50
  "claude",
51
51
  "codex"
52
52
  ],
53
- "responsibility": "The boundary at which context is about to be lost — capture before it is."
53
+ "responsibility": "Store one append-only project-state-auto-<ms> checkpoint through `ruflo memory store` and read it back by exact key; start turn distillation (`ruflo memory distill run`)."
54
54
  },
55
55
  {
56
56
  "event": "SessionEnd",
@@ -60,7 +60,7 @@
60
60
  "claude",
61
61
  "codex"
62
62
  ],
63
- "responsibility": "The boundary at which the session is about to be gone — capture before it is."
63
+ "responsibility": "Store one append-only project-state-auto-<ms> checkpoint through `ruflo memory store` and read it back by exact key; start turn distillation (`ruflo memory distill run`)."
64
64
  },
65
65
  {
66
66
  "event": "UserPromptSubmit",
@@ -122,26 +122,6 @@
122
122
  ],
123
123
  "responsibility": "The 'answered without searching' gate (2026-09-12): if grounding-turn-mark's marker shows Gate 1 fired this turn and grounding-stamp's own stamp evidence shows no search_ruvnet call happened since, forces continuation via the same hookSpecificOutput.additionalContext contract continuation-gate already uses on both hosts. A separate registration from continuation-gate — see grounding-turn-gate.mjs's header for why folding it into that file's ledger/cooldown semantics would corrupt them rather than extend them. Consumes its marker unconditionally so a stale one can never pressure an unrelated later turn. Amended 2026-09-30 (ADR-0030 #1): on Claude, 'was search_ruvnet called' is read from the transcript, and on an armed turn each capability claim in the final answer must be bound to a relevant strong source read this turn after the last weak one, else ONE correction naming the claim and what was read; on Codex (rollout not parsed) only rUv-term claims are judged, from stamps, and the rest are UNKNOWN. Gates #2/#3 are shadow-logged, never delivered."
124
124
  },
125
- {
126
- "event": "UserPromptSubmit",
127
- "owner": "session-snapshot",
128
- "class": "normalized continuity observation",
129
- "hosts": [
130
- "claude",
131
- "codex"
132
- ],
133
- "responsibility": "Capture bounded redacted observable intent or outcome through the canonical progression bridge; retain pending/failed status and do not infer success from pre-tool intent."
134
- },
135
- {
136
- "event": "PreToolUse",
137
- "owner": "session-snapshot",
138
- "class": "normalized continuity observation",
139
- "hosts": [
140
- "claude",
141
- "codex"
142
- ],
143
- "responsibility": "Capture bounded redacted observable intent or outcome through the canonical progression bridge; retain pending/failed status and do not infer success from pre-tool intent."
144
- },
145
125
  {
146
126
  "event": "PostToolUse",
147
127
  "owner": "session-snapshot",
@@ -150,26 +130,7 @@
150
130
  "claude",
151
131
  "codex"
152
132
  ],
153
- "responsibility": "Capture bounded redacted observable intent or outcome through the canonical progression bridge; retain pending/failed status and do not infer success from pre-tool intent."
154
- },
155
- {
156
- "event": "PostToolUseFailure",
157
- "owner": "session-snapshot",
158
- "class": "normalized continuity observation",
159
- "hosts": [
160
- "claude"
161
- ],
162
- "responsibility": "Capture bounded redacted observable intent or outcome through the canonical progression bridge; retain pending/failed status and do not infer success from pre-tool intent."
163
- },
164
- {
165
- "event": "SubagentStop",
166
- "owner": "session-snapshot",
167
- "class": "normalized continuity observation",
168
- "hosts": [
169
- "claude",
170
- "codex"
171
- ],
172
- "responsibility": "Capture bounded redacted observable intent or outcome through the canonical progression bridge; retain pending/failed status and do not infer success from pre-tool intent."
133
+ "responsibility": "When learning is opted in, write one minimized workflow observation with `ruflo memory store` + exact-key readback; a refusal is a hook-failures row. No queue."
173
134
  }
174
135
  ],
175
136
  "_notInThisPlane": [
@@ -358,30 +319,6 @@
358
319
  "matcher": "*",
359
320
  "timeout": 10
360
321
  },
361
- {
362
- "id": "session-snapshot",
363
- "event": "UserPromptSubmit",
364
- "hosts": [
365
- "claude",
366
- "codex"
367
- ],
368
- "mode": "advisory",
369
- "offBehavior": "run",
370
- "matcher": "*",
371
- "timeout": 10
372
- },
373
- {
374
- "id": "session-snapshot",
375
- "event": "PreToolUse",
376
- "hosts": [
377
- "claude",
378
- "codex"
379
- ],
380
- "mode": "advisory",
381
- "offBehavior": "run",
382
- "matcher": "*",
383
- "timeout": 10
384
- },
385
322
  {
386
323
  "id": "session-snapshot",
387
324
  "event": "PostToolUse",
@@ -393,29 +330,6 @@
393
330
  "offBehavior": "run",
394
331
  "matcher": "*",
395
332
  "timeout": 10
396
- },
397
- {
398
- "id": "session-snapshot",
399
- "event": "PostToolUseFailure",
400
- "hosts": [
401
- "claude"
402
- ],
403
- "mode": "advisory",
404
- "offBehavior": "run",
405
- "matcher": "*",
406
- "timeout": 10
407
- },
408
- {
409
- "id": "session-snapshot",
410
- "event": "SubagentStop",
411
- "hosts": [
412
- "claude",
413
- "codex"
414
- ],
415
- "mode": "advisory",
416
- "offBehavior": "run",
417
- "matcher": "*",
418
- "timeout": 10
419
333
  }
420
334
  ],
421
335
  "matcherAllowlist": [
@@ -468,13 +382,6 @@
468
382
  "reason": "The grounding tool with or without an MCP server prefix (mcp__plugin_ruvnet-brain_ruvnet-brain__search_ruvnet, or Codex's mcp__ruvnet_brain__search_ruvnet, measured live 2026-09-12). Only a successful search may mint a stamp; the body checks the result banner.",
469
383
  "retiredBy": "not retired — registered 2026-09-11 (ADR-0012); Codex host proven reachable 2026-09-12, matcher unchanged"
470
384
  },
471
- {
472
- "layer": "plugin",
473
- "event": "PreToolUse",
474
- "matcher": "*",
475
- "reason": "Observe normalized lifecycle transitions independently of the write-refusal and grounding matchers; the body enforces canonical identity, consent and bounded non-authoritative semantic observations.",
476
- "retiredBy": "not retired - owner automatic AgentDB mandate 2026-10-03"
477
- },
478
385
  {
479
386
  "layer": "plugin",
480
387
  "event": "PostToolUse",
@@ -482,27 +389,6 @@
482
389
  "reason": "Observe normalized lifecycle transitions independently of the write-refusal and grounding matchers; the body enforces canonical identity, consent and bounded non-authoritative semantic observations.",
483
390
  "retiredBy": "not retired - owner automatic AgentDB mandate 2026-10-03"
484
391
  },
485
- {
486
- "layer": "plugin",
487
- "event": "PostToolUseFailure",
488
- "matcher": "*",
489
- "reason": "Observe normalized lifecycle transitions independently of the write-refusal and grounding matchers; the body enforces canonical identity, consent and bounded non-authoritative semantic observations.",
490
- "retiredBy": "not retired - owner automatic AgentDB mandate 2026-10-03"
491
- },
492
- {
493
- "layer": "plugin",
494
- "event": "SubagentStop",
495
- "matcher": "*",
496
- "reason": "Observe normalized lifecycle transitions independently of the write-refusal and grounding matchers; the body enforces canonical identity, consent and bounded non-authoritative semantic observations.",
497
- "retiredBy": "not retired - owner automatic AgentDB mandate 2026-10-03"
498
- },
499
- {
500
- "layer": "codex",
501
- "event": "PreToolUse",
502
- "matcher": "*",
503
- "reason": "Canonical observation owner sees tool transitions before normalization; bounded body selects substantive observations. The independent anchored decision and grounding matchers remain unchanged.",
504
- "retiredBy": "not retired - automatic memory mandate 2026-10-03"
505
- },
506
392
  {
507
393
  "layer": "codex",
508
394
  "event": "PostToolUse",
@@ -552,13 +438,6 @@
552
438
  "reason": "Explicit supported Codex lifecycle registration, corresponding to the host-filtered continuity policy; its enforcing handler and live registration are checked independently.",
553
439
  "retiredBy": "not retired - canonical continuity host parity"
554
440
  },
555
- {
556
- "layer": "codex",
557
- "event": "SubagentStop",
558
- "matcher": "*",
559
- "reason": "Explicit supported Codex lifecycle registration, corresponding to the host-filtered continuity policy; its enforcing handler and live registration are checked independently.",
560
- "retiredBy": "not retired - canonical continuity host parity"
561
- },
562
441
  {
563
442
  "layer": "codex",
564
443
  "event": "PreCompact",
@@ -1,5 +1,5 @@
1
1
  {
2
- "description": "RuvNet Brain lifecycle plane. The broad legacy routing, learning, and release interceptors remain retired. What is automatic is exactly: SessionStart restores the canonical project checkpoint; UserPromptSubmit runs the single unprompted-speech chokepoint, ground-ruvnet grounding injection, and a capacity-aware context hint for clearly large independent work. The capacity hook uses bounded CPU/memory-pressure evidence, never starts agents, and tells the coordinator to check live tools and clamp to the runtime cap; it is not user-facing speech. ground-ruvnet remains a directive to the model, not speech — ADR-040 §Amendment 2026-09-11. PreToolUse runs decision-gate's write route, the ONE process that may refuse a Write/Edit/MultiEdit/NotebookEdit/apply_patch (ADR-067, composing ground-before-write per ADR-0012); PostToolUse on a successful search_ruvnet mints the grounding stamp that opens that gate. grounding-turn-mark (UserPromptSubmit) records that the grounding directive fired this turn, and grounding-turn-gate (Stop) forces continuation if the final answer asserts a rUv capability and no search_ruvnet call was recorded since. Stop also runs the ledger-scoped continuation handler and captures a project snapshot; PreCompact and SessionEnd capture a project snapshot. Every capture is bounded and fails open; only decision-gate may block on exit code, and it fails open on its own errors — the Stop stdout envelopes are advisory at the shim boundary but keep the agent working. Automatic normalized project observations are captured at prompt, pre-tool, post-tool and child completion; Claude also observes PostToolUseFailure. Queued memory is silent (the normal state at prompt and tool boundaries); a stuck queue (queued work older than 10 minutes), an unwritable queue and a hook that failed or timed out internally are disclosed; this does not establish synchronous ADR-073 conformance or native Grok recall. SessionStart has an 8-second measured replay/restore envelope. Issue377: consent-eligible learning captures only fixed workflow metadata; lifecycle recovery schedules one finite worker. Original records remain retained with hash-bound acknowledgments. Native delivery must be separately evidenced; registration is not proof. Amended 2026-10-11 (ADR-106): learning capture and recovery no longer have their own registrations; session-snapshot PostToolUse captures in-process, and session-start and session-snapshot SessionEnd schedule learn-flush detached, with learningContext() owning consent and brain-off. A failed advisory body is recorded by the shim and summarized once at SessionStart. decision-gate also consults decision-recall (a new ADR or ADR status change needs a fresh AgentDB consult) and continuation-gate asks once for a decision record after a new ADR.",
2
+ "description": "RuvNet Brain lifecycle plane. The broad legacy routing, learning, and release interceptors remain retired. Lifecycle memory only CALLS ruflo (owner ruling 2026-10-12, ADR-106): there is no hand-rolled store, queue, journal or outbox. SessionStart restores the newest project-state-current-* checkpoint (and a newer project-state-auto-* one) and lists lesson keys by exact-key `ruflo memory list|retrieve`, and summarizes hook failures once. UserPromptSubmit runs the single unprompted-speech chokepoint, ground-ruvnet grounding injection (with one bounded AgentDB recall search), a capacity-aware context hint, and grounding-turn-mark. PreToolUse runs decision-gate's write route, the ONE process that may refuse a Write/Edit/MultiEdit/NotebookEdit/apply_patch (ADR-067, ADR-0012); PostToolUse on a successful search_ruvnet mints the grounding stamp that opens that gate, and session-snapshot PostToolUse writes an opted-in learning observation with `ruflo memory store`. Stop runs the continuation gate, writes the turn outcome with `ruflo memory store` in namespace turns proven by exact-key readback, and runs grounding-turn-gate. PreCompact and SessionEnd store one append-only project-state-auto-<ms> checkpoint with exact-key readback and start `ruflo memory distill run`. Every body is advisory and fails open except decision-gate; a refused or unverified ruflo write, or a body stopped by the shim watchdog, is one row in hook-failures.jsonl, summarized at the next SessionStart.",
3
3
  "hooks": {
4
4
  "SessionStart": [
5
5
  {
@@ -17,11 +17,6 @@
17
17
  {
18
18
  "matcher": "*",
19
19
  "hooks": [
20
- {
21
- "type": "command",
22
- "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-shim.mjs\" session-snapshot UserPromptSubmit || true",
23
- "timeout": 10
24
- },
25
20
  {
26
21
  "type": "command",
27
22
  "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-shim.mjs\" unprompted-speech UserPromptSubmit",
@@ -46,16 +41,6 @@
46
41
  }
47
42
  ],
48
43
  "PreToolUse": [
49
- {
50
- "matcher": "*",
51
- "hooks": [
52
- {
53
- "type": "command",
54
- "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-shim.mjs\" session-snapshot PreToolUse || true",
55
- "timeout": 10
56
- }
57
- ]
58
- },
59
44
  {
60
45
  "matcher": "^(Write|Edit|MultiEdit|NotebookEdit|apply_patch)$",
61
46
  "hooks": [
@@ -134,30 +119,6 @@
134
119
  }
135
120
  ]
136
121
  }
137
- ],
138
- "SubagentStop": [
139
- {
140
- "matcher": "*",
141
- "hooks": [
142
- {
143
- "type": "command",
144
- "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-shim.mjs\" session-snapshot SubagentStop || true",
145
- "timeout": 10
146
- }
147
- ]
148
- }
149
- ],
150
- "PostToolUseFailure": [
151
- {
152
- "matcher": "*",
153
- "hooks": [
154
- {
155
- "type": "command",
156
- "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-shim.mjs\" session-snapshot PostToolUseFailure || true",
157
- "timeout": 10
158
- }
159
- ]
160
- }
161
122
  ]
162
123
  }
163
124
  }