ruvnet-brain 4.3.37 β†’ 4.3.39

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 (41) hide show
  1. package/README.md +2 -2
  2. package/bin/install.mjs +32 -9
  3. package/kb/forge-update.mjs +1884 -0
  4. package/package.json +3 -1
  5. package/plugin/.claude-plugin/plugin.json +1 -1
  6. package/plugin/.codex-plugin/plugin.json +1 -1
  7. package/plugin/hooks/codex-hooks.json +4 -4
  8. package/plugin/hooks/hook-contracts.json +7 -7
  9. package/plugin/hooks/hooks.json +2 -2
  10. package/plugin/scripts/capability-claim-evidence.mjs +11 -2
  11. package/plugin/scripts/capacity-aware-parallel-work.mjs +71 -15
  12. package/plugin/scripts/codex-hook-wrapper.mjs +3 -0
  13. package/plugin/scripts/completion-claim-evidence.mjs +262 -0
  14. package/plugin/scripts/continuation-gate.mjs +105 -21
  15. package/plugin/scripts/continuation-objective.mjs +15 -0
  16. package/plugin/scripts/decision-gate.mjs +22 -2
  17. package/plugin/scripts/duplicate-gate.mjs +503 -0
  18. package/plugin/scripts/grounding-turn-evidence.mjs +339 -0
  19. package/plugin/scripts/grounding-turn-gate.mjs +77 -25
  20. package/plugin/scripts/grounding-turn-mark.mjs +61 -14
  21. package/plugin/scripts/hook-input.mjs +15 -0
  22. package/plugin/scripts/host-update.mjs +45 -0
  23. package/plugin/scripts/nightly-scheduler.mjs +34 -0
  24. package/plugin/scripts/session-start-budget.mjs +1 -0
  25. package/plugin/scripts/session-start-core.mjs +15 -2
  26. package/plugin/scripts/session-start-health.mjs +101 -1
  27. package/plugin/scripts/session-start-update-plane.mjs +71 -1
  28. package/scripts/approved-runtime.mjs +1 -1
  29. package/scripts/completion-claim-replay.mjs +114 -0
  30. package/scripts/corpus-canary.mjs +396 -0
  31. package/scripts/corpus-dispatch-decision.mjs +2 -2
  32. package/scripts/corpus-promotion.mjs +49 -0
  33. package/scripts/corpus-reconcile.mjs +27 -3
  34. package/scripts/corpus-watchdog.mjs +45 -6
  35. package/scripts/duplicate-gate-replay.mjs +98 -0
  36. package/scripts/grounding-turn-replay.mjs +131 -0
  37. package/scripts/nightly-watchdog.mjs +3 -3
  38. package/scripts/protected-release-invocation.mjs +1 -1
  39. package/scripts/release.mjs +180 -77
  40. package/scripts/single-source-check.mjs +12 -6
  41. package/scripts/wired-check.mjs +2 -0
package/README.md CHANGED
@@ -7,7 +7,7 @@ Created: 2026-06-29 22:36:38 EDT
7
7
 
8
8
  # 🧠 RuvNet Brain
9
9
 
10
- ### 🧠 RuvNet Brain β€” [![RuvNet Brain version 4.3.37 β€” updated 2026-07-30 03:24 EDT](https://img.shields.io/badge/version_4.3.37-updated_2026--07--30_03:24_EDT-1E90FF?style=for-the-badge&labelColor=0757BA)](https://github.com/stuinfla/ruvnet-brain/blob/main/plugin/.claude-plugin/plugin.json)
10
+ ### 🧠 RuvNet Brain β€” [![RuvNet Brain version 4.3.39 β€” updated 2026-07-30 03:24 EDT](https://img.shields.io/badge/version_4.3.39-updated_2026--07--30_03:24_EDT-1E90FF?style=for-the-badge&labelColor=0757BA)](https://github.com/stuinfla/ruvnet-brain/blob/main/plugin/.claude-plugin/plugin.json)
11
11
 
12
12
  **A portable, source-grounded brain over Reuven Cohen's (rUv's) RuvNet stack β€” delivered as a Claude Code plugin that makes Claude _use_ the stack instead of fighting it.**
13
13
 
@@ -562,7 +562,7 @@ node forge-ask-all.mjs --dir . --q "How does RuVector implement HNSW vector sear
562
562
 
563
563
  This project versions in the open (see the live badge up top for the exact plugin version; the downloadable knowledge bundle is a separate track) β€” we don't claim β€œdone,” β€œcomplete,” or β€œzero hallucinations.” Where it stands:
564
564
 
565
- - βœ… **The grounding brain is real and proven** β€” 199 public stores Β· 160,685 public source chunks, dual embeddings, cross-encoder rerank, plugin (MCP tool + explicit skills; automatic hooks retired), all re-runnable.
565
+ - βœ… **The grounding brain is real and proven** β€” 199 public stores Β· 161,322 public source chunks, dual embeddings, cross-encoder rerank, plugin (MCP tool + explicit skills; automatic hooks retired), all re-runnable.
566
566
  - βœ… **Code-level depth** β€” the code-rich repos are indexed to full function bodies; β€œhow is it implemented?” returns the implementation. Verified in the shipped bundle (clean-room 3/3).
567
567
  - βœ… **Routing holds** β€” named 47/48, described 26/28, scenario 7/8; behavioral L1–L3 all pass (**L4 downgraded β€” it measures that the brain spoke, not that anything listened**); private stores fenced out of the public bundle (zero-leak verified).
568
568
  - ⚠️ **Two routing residuals** (above) β€” surfaced, not hidden.
package/bin/install.mjs CHANGED
@@ -528,21 +528,42 @@ export function copyLocalBundleInto(sourceDir, cacheDir) {
528
528
  // which a private-overlay brain refuses. Idempotent, byte-compared, atomic; a symlink is replaced by
529
529
  // a real file because a link is not a trusted regular file.
530
530
  const TRUSTED_VALIDATOR_SOURCE = path.join(REPO_ROOT, 'plugin', 'scripts', 'coverage-integrity.mjs');
531
- export function placeTrustedCoverageValidator(kbDir, { source = TRUSTED_VALIDATOR_SOURCE,
532
- brainVersion = PACKAGE_VERSION } = {}) {
533
- let bytes;
534
- try { bytes = fs.readFileSync(source); }
535
- catch (error) { throw new Error(`trusted coverage validator is missing from this package (${source}): ${error.message}`); }
536
- const target = path.join(kbDir, 'coverage-integrity.mjs');
531
+ // Byte-compared, atomic, symlink-safe placement of one file the installer owns inside the KB.
532
+ function placeFileAtomic(target, bytes) {
537
533
  let existing = null;
538
534
  try { existing = fs.lstatSync(target); } catch (error) { if (error.code !== 'ENOENT') throw error; }
539
- const unchanged = existing && existing.isFile() && !existing.isSymbolicLink() && fs.readFileSync(target).equals(bytes);
535
+ const unchanged = !!(existing && existing.isFile() && !existing.isSymbolicLink() && fs.readFileSync(target).equals(bytes));
540
536
  if (!unchanged) {
541
537
  const staged = `${target}.${process.pid}.${Date.now()}.tmp`;
542
538
  fs.writeFileSync(staged, bytes, { mode: 0o644 });
543
539
  if (existing && existing.isSymbolicLink()) fs.unlinkSync(target); // never write through a link
544
540
  fs.renameSync(staged, target);
545
541
  }
542
+ return { existing, unchanged };
543
+ }
544
+ // The updater that runs on a customer is the forge-update.mjs inside their OWN installed KB, which only
545
+ // changes when a bundle replaces it β€” so a fix to the updater never reached installs that already had
546
+ // one. The signed npm package carries the updater and the sibling modules it imports; the `--update`
547
+ // preflight places them (same trust as the validator) so a stale updater upgrades itself before it runs.
548
+ const UPDATER_FILES = ['forge-update.mjs', 'zip-extract.mjs', 'brain-profile.mjs', 'refresh-run.mjs',
549
+ 'update-storage-transaction.mjs', 'lifecycle-evidence-retention.mjs', 'corpus-release-identity.mjs'];
550
+ export function placeUpdater(kbDir, { sourceDir = path.join(REPO_ROOT, 'kb') } = {}) {
551
+ const placed = {};
552
+ for (const name of UPDATER_FILES) {
553
+ let bytes;
554
+ try { bytes = fs.readFileSync(path.join(sourceDir, name)); }
555
+ catch (error) { throw new Error(`updater file ${name} is missing from this package (${sourceDir}): ${error.message}`); }
556
+ placed[name] = placeFileAtomic(path.join(kbDir, name), bytes).unchanged ? 'unchanged' : 'placed';
557
+ }
558
+ return placed;
559
+ }
560
+ export function placeTrustedCoverageValidator(kbDir, { source = TRUSTED_VALIDATOR_SOURCE,
561
+ brainVersion = PACKAGE_VERSION } = {}) {
562
+ let bytes;
563
+ try { bytes = fs.readFileSync(source); }
564
+ catch (error) { throw new Error(`trusted coverage validator is missing from this package (${source}): ${error.message}`); }
565
+ const target = path.join(kbDir, 'coverage-integrity.mjs');
566
+ const { existing, unchanged } = placeFileAtomic(target, bytes);
546
567
  // STAMP THE APPROVED RUNTIME IN THE SAME BREATH AS PLACING ITS EXECUTABLES (ADR-086 step 16).
547
568
  //
548
569
  // This is the one moment where "which runtime is this brain running" is a measured fact rather
@@ -558,7 +579,7 @@ export function placeTrustedCoverageValidator(kbDir, { source = TRUSTED_VALIDATO
558
579
  /** `--update` preflight: place the validator only where an updater exists to consume it. */
559
580
  export function ensureUpdaterPrerequisites(kbDir) {
560
581
  if (!fs.existsSync(path.join(kbDir, 'forge-update.mjs'))) return { updater: false, validator: null };
561
- return { updater: true, validator: placeTrustedCoverageValidator(kbDir) };
582
+ return { updater: true, files: placeUpdater(kbDir), validator: placeTrustedCoverageValidator(kbDir) };
562
583
  }
563
584
 
564
585
  export async function unzipInto(zipPath, cacheDir, sourceDir = null, { releaseTag = null, activate = true } = {}) {
@@ -2729,10 +2750,12 @@ async function doctor() {
2729
2750
  ok(`nightly scheduler: ${nightlyHealth.evidence}`);
2730
2751
  if (nightlyHealth.runHealth?.state === 'ok' || nightlyHealth.runHealth?.state === 'running') {
2731
2752
  ok(`nightly execution: ${nightlyHealth.runHealth.evidence}`);
2753
+ } else if (nightlyHealth.runHealth?.state === 'failed') {
2754
+ warn(`nightly refresh FAILED β€” the brain is not updating: ${nightlyHealth.runHealth.evidence}`);
2732
2755
  } else warn(`nightly execution unproven: ${nightlyHealth.runHealth?.evidence || 'no run receipt'}`);
2733
2756
  }
2734
2757
  else if (nightlyHealth.state === 'degraded') warn(`nightly scheduler degraded: ${nightlyHealth.evidence}`);
2735
- else if (nightlyHealth.state === 'off') info('nightly scheduler is off (optional; enable with --enable-nightly)');
2758
+ else if (nightlyHealth.state === 'off') warn('nightly scheduler is OFF β€” knowledge updates only when a session starts (SessionStart retries at most every 6h); for nightly updates run npx ruvnet-brain --enable-nightly (skip if agentic-kit manages this machine)');
2736
2759
  else info(`nightly scheduler status unavailable: ${nightlyHealth.evidence}`);
2737
2760
  have('node') ? ok('node present') : warn('node missing');
2738
2761
  have('npm') ? ok('npm present') : warn('npm missing');