ruvnet-brain 4.0.2 → 4.0.5

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 (46) hide show
  1. package/README.md +1 -1
  2. package/bin/install.mjs +215 -31
  3. package/docs/RELEASE-NOTES-4.0.md +1 -1
  4. package/package.json +1 -1
  5. package/plugin/.claude-plugin/plugin.json +1 -1
  6. package/plugin/.codex-plugin/plugin.json +1 -1
  7. package/plugin/commands/whats-new.md +6 -6
  8. package/plugin/docs/RELEASE-NOTES-4.0.md +88 -0
  9. package/plugin/mcp/server.mjs +70 -33
  10. package/plugin/scripts/hook-shim.mjs +27 -22
  11. package/plugin/scripts/lesson-command-scope.mjs +133 -0
  12. package/plugin/scripts/lesson-gate.mjs +401 -0
  13. package/plugin/scripts/lesson-presentation.mjs +99 -0
  14. package/plugin/scripts/lesson-store.mjs +452 -0
  15. package/plugin/scripts/route-dispatch.sh +1 -0
  16. package/plugin/scripts/session-start-core.mjs +28 -2
  17. package/plugin/scripts/verify-interface.sh +1 -0
  18. package/plugin/scripts/whats-new.mjs +42 -0
  19. package/plugin/skills/release-proof/SKILL.md +21 -4
  20. package/plugin/skills/release-proof/references/receipt-contract.md +8 -2
  21. package/plugin/skills/release-proof/scripts/release-proof.mjs +77 -1
  22. package/plugin/skills/ruvnet-brain/SKILL.md +22 -7
  23. package/plugin/skills/whats-new/SKILL.md +4 -4
  24. package/scripts/build-bundle.mjs +34 -25
  25. package/scripts/fix-workstream.mjs +291 -0
  26. package/scripts/health-repair.mjs +14 -27
  27. package/scripts/issue-fix.mjs +135 -216
  28. package/scripts/learning-replay-cli.mjs +236 -0
  29. package/scripts/learning-replay-contract.mjs +255 -0
  30. package/scripts/learning-replay-execution.mjs +193 -0
  31. package/scripts/learning-replay-fixture.mjs +380 -0
  32. package/scripts/learning-replay-proof.mjs +459 -0
  33. package/scripts/learning-replay.mjs +10 -1565
  34. package/scripts/lesson-gate.mjs +3 -679
  35. package/scripts/lesson-store.mjs +4 -447
  36. package/scripts/memory-doctor.mjs +80 -9
  37. package/scripts/nightly-wrapper.sh +20 -28
  38. package/scripts/onboarding-console.mjs +302 -95
  39. package/scripts/protected-release-invocation.mjs +76 -0
  40. package/scripts/publication-receipt.mjs +307 -0
  41. package/scripts/release-authority.mjs +93 -0
  42. package/scripts/release-vector.mjs +49 -25
  43. package/scripts/release.mjs +55 -11
  44. package/scripts/self-update.mjs +15 -227
  45. package/scripts/stabilization-receipt.mjs +108 -0
  46. package/scripts/wired-check.mjs +3 -0
@@ -41,8 +41,8 @@ echo $$ > "$LOCK"
41
41
  trap 'rm -f "$LOCK"' EXIT
42
42
 
43
43
  # NIGHTLY_SMOKE=1 — prove this whole chain (launchd -> heartbeat wrapper -> here -> node -> the repo
44
- # scan -> the log) WITHOUT a multi-hour rebuild or a real Release publish. self-update.mjs is dry-run
45
- # by default, so dropping --apply --publish exercises every link except the build itself.
44
+ # scan -> the log) WITHOUT a multi-hour rebuild. self-update.mjs is dry-run by default, so dropping
45
+ # --apply exercises every link except the build itself. Publication is never part of this job.
46
46
  # WHY IT EXISTS (2026-07-13): the 03:15 fire on 07-12 died before it could even write its own log
47
47
  # ("/bin/bash: logs/nightly.log: No such file or directory" — relative path, no working directory) and
48
48
  # NOBODY KNEW, because the only way to test this chain was to wait until 03:15 and hope. A scheduled job
@@ -51,40 +51,32 @@ trap 'rm -f "$LOCK"' EXIT
51
51
  SMOKE="${NIGHTLY_SMOKE:-0}"
52
52
 
53
53
  run_once() {
54
- local before after rc tail
55
- before=$(gh release view --json tagName -q .tagName 2>/dev/null || echo "unknown")
56
- { echo "===== nightly-wrapper attempt $1 — $(date -u +%FT%TZ) — before: $before ====="
54
+ local rc
55
+ { echo "===== nightly-wrapper rebuild attempt $1 — $(date -u +%FT%TZ) ====="
57
56
  if [ "$SMOKE" = "1" ]; then
58
- echo "[SMOKE] dry-run: exercising the full chain, NOT building or publishing"
57
+ echo "[SMOKE] dry-run: exercising the full chain, NOT building"
59
58
  /usr/local/bin/node scripts/self-update.mjs --fresh-window 60
60
59
  else
61
- /usr/local/bin/node scripts/self-update.mjs --apply --publish --fresh-window 60
60
+ /usr/local/bin/node scripts/self-update.mjs --apply --fresh-window 60
62
61
  fi
63
62
  } >> "$LOG" 2>&1
64
63
  rc=$?
65
- if [ "$SMOKE" = "1" ]; then
66
- # A smoke run must never claim a real outcome, touch the failure marker, or alter the tag story.
67
- if [ "$rc" -eq 0 ]; then echo "===== attempt $1: SMOKE OK — chain intact (no build, no publish) =====" >> "$LOG"; return 0; fi
68
- echo "===== attempt $1: SMOKE FAILED exit $rc — the chain is BROKEN, fix before 03:15 =====" >> "$LOG"
64
+ if [ "$rc" -ne 0 ]; then
65
+ echo "===== attempt $1: FAILED exit $rc — rebuild/candidate preparation did not complete =====" >> "$LOG"
69
66
  return 1
70
67
  fi
71
- after=$(gh release view --json tagName -q .tagName 2>/dev/null || echo "unknown")
72
- if [ "$after" != "$before" ] && [ -n "$after" ] && [ "$after" != "unknown" ]; then
73
- echo "===== attempt $1: VERIFIED SUCCESS $before -> $after =====" >> "$LOG"
74
- rm -f "$MARKER"
75
- return 0
76
- elif [ "$rc" -eq 0 ]; then
77
- echo "===== attempt $1: CLEAN NO-OP, tag unchanged at $after =====" >> "$LOG"
78
- rm -f "$MARKER"
68
+ if [ "$SMOKE" = "1" ]; then
69
+ # A smoke run must never claim a real outcome, touch the failure marker, or alter the tag story.
70
+ echo "===== attempt $1: SMOKE OK — chain intact (no build, no publish) =====" >> "$LOG"
79
71
  return 0
80
- else
81
- echo "===== attempt $1: FAILED exit $rc, tag stuck at $after =====" >> "$LOG"
82
- return 1
83
72
  fi
73
+ echo "===== attempt $1: REBUILD COMPLETE — candidate bytes prepared; no release channel was promoted =====" >> "$LOG"
74
+ rm -f "$MARKER"
75
+ return 0
84
76
  }
85
77
 
86
78
  # Memory distillation (ADR-174) had gone stale 3 days — same silent-death pattern as everything
87
- # else tonight. Independent of publish success/failure: mine raw memory_entries into structured
79
+ # else tonight. Independent of rebuild success/failure: mine raw memory_entries into structured
88
80
  # episodes/reasoning_patterns on every nightly run. Best-effort, never blocks the real job.
89
81
  RUFLO_DAEMON_AUTOSTART=0 ~/.npm-global/bin/ruflo memory distill run --path .swarm/memory.db >> "$LOG" 2>&1 || true
90
82
  # Durability: was a one-off manual snapshot before tonight. Now recurring — WAL-safe, rotates
@@ -94,7 +86,7 @@ RUFLO_DAEMON_AUTOSTART=0 ~/.npm-global/bin/ruflo memory backup --db .swarm/memor
94
86
  # AgentDB drift canary (2026-07-23, P7 wiring sweep) — scripts/memdb-health.sh existed unwired since
95
87
  # 2026-07-09/10, the exact nights idx_bridge_key/idx_bridge_ns corruption recurred 3x on this very DB
96
88
  # while in WAL mode. Best-effort, same shape as its brain-health/key-health siblings below: never
97
- # blocks the real publish, just makes a WAL-mode/integrity regression loud instead of silent.
89
+ # blocks the real rebuild, just makes a WAL-mode/integrity regression loud instead of silent.
98
90
  echo "===== memdb-health canary — $(date -u +%FT%TZ) =====" >> "$LOG"
99
91
  sh scripts/memdb-health.sh .swarm/memory.db >> "$LOG" 2>&1 \
100
92
  && echo "===== memdb-health canary: OK =====" >> "$LOG" \
@@ -109,7 +101,7 @@ sh scripts/memdb-health.sh .swarm/memory.db >> "$LOG" 2>&1 \
109
101
  # is the currency gate on the artifact this writes; if this step stops running, that workflow goes red
110
102
  # on staleness rather than everything staying quietly green.
111
103
  #
112
- # Best-effort, same shape as the canaries below: it never blocks the publish. Its exit code is not
104
+ # Best-effort, same shape as the canaries below: it never blocks the rebuild. Its exit code is not
113
105
  # thrown away though — it is written to the log by name, because 0/1/3/4 are four different facts
114
106
  # (PASS / the lesson stopped transferring / the trap was invalidated / it could not be measured) and
115
107
  # collapsing them into "failed" is how the seven prior silent-death bugs in this file happened.
@@ -126,7 +118,7 @@ esac
126
118
  # ── GONG LAYER 3: brain-health canary (Stuart, 2026-07-12 — the brain must NEVER be dark silently).
127
119
  # One real query against the LIVE cache brain every night. forge-ask-all.mjs exits non-zero on a
128
120
  # total retrieval failure (all repos erroring) and rings kb/brain-alarm.mjs itself; this adds the
129
- # guaranteed-nightly cadence plus its own urgent push, independent of the publish job's outcome.
121
+ # guaranteed-nightly cadence plus its own urgent push, independent of the rebuild job's outcome.
130
122
  BRAIN_KB="$HOME/.cache/ruvnet-brain/kb"
131
123
  if [ -f "$BRAIN_KB/forge-ask-all.mjs" ]; then
132
124
  echo "===== brain-health canary — $(date -u +%FT%TZ) =====" >> "$LOG"
@@ -170,11 +162,11 @@ python3 -c "
170
162
  import json, datetime
171
163
  json.dump({
172
164
  'at': datetime.datetime.utcnow().isoformat() + 'Z',
173
- 'tag_stuck_at': '$AFTER',
165
+ 'last_release_tag_observed': '$AFTER',
174
166
  'tail': '''$TAIL''',
175
167
  'note': 'Nightly failed twice (immediate + 3min retry). Needs a live session to diagnose — see logs/nightly.log.'
176
168
  }, open('$MARKER', 'w'), indent=2)
177
169
  "
178
- sh scripts/notify.sh "🔴 Nightly FAILED twice — needs you" "tag stuck at $AFTER after retry. Last: $TAIL" urgent "rotating_light"
170
+ sh scripts/notify.sh "🔴 Nightly FAILED twice — needs you" "candidate rebuild failed; last release remains $AFTER. Last: $TAIL" urgent "rotating_light"
179
171
  echo "===== ESCALATED: marker written at $MARKER =====" >> "$LOG"
180
172
  exit 1