* dream(memory): #3649 restore quantizer config/codebooks across HNSWIndex serialize/deserialize HNSWIndex.serialize()/deserialize() never persisted config.quantization or trained PQ codebooks, so this.quantizer came back null after any save/reload cycle — silently re-breaking the product-quantization distance dispatch fixed 2026-08-25 (#3093/#3094) every time AgentDBAdapter.saveToDisk()/ loadFromDisk() round-trips an index. Added a versioned magic header (v1/v2) so serialize() now writes quantization config + trained codebooks, and deserialize() restores them, while old-format snapshots still read correctly with no quantizer (unchanged pre-existing behavior). Evaluated: pre-serialize recall@10 0.270 -> post-deserialize 0.010 on baseline (bug reproduced) -> ~0.270 on candidate. 557/558 full suite both ways (1 pre-existing unrelated failure), tsc clean. Independent adversarial critic CONFIRMED, including a stronger real pre-fix v1-buffer repro. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01TfsQojjDGj9ZEgPo6qZvPc * docs(dream-cycle): fill candidate commit sha in 2026-10-03 gist witness table Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01TfsQojjDGj9ZEgPo6qZvPc * fix(memory): validate importCodebooks() input, reject malformed shape Addresses ruvnet's review on #3650: deserialize() fed JSON.parse() output straight into this.codebooks with no validation, so a corrupted v2 snapshot could either throw (invalid JSON) or silently adopt a wrong-shaped/non-finite codebooks array, poisoning every subsequent distance computed against it with garbage or NaN. importCodebooks() now validates shape (numSubquantizers sub-arrays, each numCentroids centroids of the expected per-subvector length) and that every value is a finite number, returning false and leaving the quantizer untrained on any mismatch -- same as the existing pre-training bootstrap state, not a new failure mode. deserialize() now guards the JSON.parse() call itself so corrupt JSON degrades to "untrained" instead of throwing. 2 new discriminating tests, both verified to fail against the pre-fix code via git-stash isolation (one throws on corrupt JSON, one silently accepted a wrong-shaped array). Full suite 559/560 (1 pre-existing unrelated failure), tsc --noEmit clean. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01TfsQojjDGj9ZEgPo6qZvPc * docs(dream-cycle): record post-review hardening in 2026-10-03 gist Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01TfsQojjDGj9ZEgPo6qZvPc * dream(intelligence): #4080 wire SONA learning-state persistence into LearningBridge (evaluated, ACCEPT) LearningBridge is the only production path that exercises SONAManager (via auto-memory-hook.mjs's SessionStart/SessionEnd hooks), and every short-lived hook invocation constructed a fresh, empty neural learning state. SONAManager.serialize()/deserialize() already existed but were never called. Wires that round-trip into LearningBridge.loadNeural() (restore) and destroy() (persist, synchronous since destroy() is called unawaited right before process exit), mirroring MoERouter's existing .swarm/moe-weights.json persistence pattern. This supersedes the handed-in candidate for tonight (fixing SONAManager's EWC key-mismatch), which an architecture review proved would be behaviorally inert: SONAManager.loraWeights.A/B are never updated by gradient descent anywhere, so aligning EWC's keys would only change internal telemetry, not real behavior. The persistence gap fixed here is the actual root cause making SONA's learning trigger (EWC included) practically unreachable in the first place. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01K7m7AnVWdCQRydcfxzK6ke * docs(dream-cycle): append 2026-10-12 intelligence ledger row Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01K7m7AnVWdCQRydcfxzK6ke * chore(release): bump neural/memory leaves for #4081's source change v3/@claude-flow/neural and v3/@claude-flow/memory are non-bundled leaf packages resolved from the registry, not shipped with the release train (CLAUDE.md "Publishing Rules") — a source change without a version bump would ship nobody the fix (ruvnet/ruflo#3335, #3390). Minor-bumps both (3.0.0->3.1.0, 3.0.4->3.1.0: backward-compatible additions, no breaking API change) and updates v3/@claude-flow/cli's exact pins + v3/pnpm-lock.yaml to match. Root claude-flow's own @claude-flow/neural dependency resolves from the real npm registry (not a workspace link, confirmed via package-lock.json's resolved tarball URL) — widened to "^3.0.0" rather than bumped to "3.1.0", since 3.1.0 isn't published yet and pinning to it would break `npm ci`. @claude-flow/memory isn't a direct dependency of the root package, so it needed no equivalent change there. Verified: audit-leaf-package-publish.mjs, audit-wrapper-dep-ranges.mjs, audit-plugin-packages.mjs, audit-package-dep-overlap.mjs, and audit-umbrella-version-lockstep.mjs all pass locally; `npm ci` and `pnpm install --frozen-lockfile` (in v3/) both succeed cleanly. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01K7m7AnVWdCQRydcfxzK6ke * fix(cli): widen neural/memory pins to ranges, not an unpublished exact version The previous commit exact-pinned @claude-flow/cli's neural/memory deps to 3.1.0 to match the leaf version bump — but the CLI package is consumed via real npm resolution when packed/installed (npx, or a real `npm install` of the published tarball), not via the pnpm workspace link that made the pin look fine locally. 3.1.0 isn't published, so smoke-cli-npx-install.mjs's real `npm install` of the packed CLI tarball failed: `ETARGET No matching version found for @claude-flow/neural@3.1.0`. Same fix as the prior commit's root package.json change: widen to "^3.0.0" rather than bump to the unpublished version. This still satisfies audit-leaf-package-publish.mjs's range-coverage check (^3.0.0 covers the workspace's 3.1.0) without requiring a real registry publish, and resolves correctly to whatever's actually published (3.0.0) when installed for real. CLAUDE.md documents this exact failure mode happening before (memory@3.0.0-alpha.27, 2026-09-28) — exact-pinning to vaporware breaks installs outright. Verified: ran scripts/smoke-cli-npx-install.mjs locally end-to-end (packs the real tarball, npm installs it, runs `cli --version`) — passes. All other audit scripts + both packages' test suites unchanged/green. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01K7m7AnVWdCQRydcfxzK6ke * fix(cli): restore exact memory pin to satisfy witness-marker guard (#2021/#1825) The previous commit widened @claude-flow/cli's "@claude-flow/memory" dep (both dependencies and optionalDependencies) to "^3.0.0" to avoid the same ETARGET problem neural hit. That broke a different, deliberate guard: `witness marker drift smoke (#2021)` flags any change to a line previously witnessed as a historical fix. #1825's fix (PR #1827) specifically pins this field to an exact "3.x" version after a `workspace:` protocol leak crashed npm's resolver entirely for ALL users — the marker `"@claude-flow/memory": "3.` guards against regressing that. memory doesn't need the same treatment neural got: it's listed in BOTH `dependencies` and `optionalDependencies` (pre-existing, not introduced here), and pnpm/npm treat a dependency declared in both as optional overall — confirmed empirically by running scripts/smoke-cli-npx-install.mjs locally with memory exact-pinned to the unpublished 3.1.0: npm installs the tarball cleanly, because an unresolvable optional dependency doesn't fail the install (unlike neural, which is required and must stay on a range that resolves to what's actually published). Restored the exact "3.1.0" pin (matching the new leaf version, satisfying both the witness marker's "3." substring and audit-leaf-package-publish.mjs's range-coverage) in both package.json fields and the pnpm-lock.yaml specifier; left neural's "^3.0.0" from the prior commit untouched. Verified: smoke-witness-marker-drift.mjs (0 drifted, was 1), smoke-cli-npx-install.mjs, audit-leaf-package-publish.mjs, audit-wrapper-dep-ranges.mjs, audit-plugin-packages.mjs, audit-package-dep-overlap.mjs, audit-umbrella-version-lockstep.mjs all pass; pnpm install --frozen-lockfile (v3/) succeeds; both affected packages' test suites unchanged. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01K7m7AnVWdCQRydcfxzK6ke * fix(memory,neural): harden SONA state persistence found in #4081 review - LearningBridge never follows a symlink at statePath (read or write) and never writes into a symlinked directory: the file lives in the project directory, so it is untrusted input (reproduced: a planted symlink was overwritten). - Atomic write (private 0600 temp file + rename); no torn files. - Persist only when something was learned: no stray .swarm/ in every cwd. - A file from another schema version is preserved, never overwritten. - A rejected restore is rolled back to the pre-restore snapshot; reads are size-capped. - SONAManager.deserialize validates the whole snapshot before assigning any field (reproduced: {"schemaVersion":1} left the manager half-applied and permanently unable to learn or self-heal). Known limitation, documented: concurrent processes are last-writer-wins (8 parallel processes kept 4 of 8 trajectories). Co-Authored-By: RuFlo <ruv@ruv.net> * dream(intelligence): #LOCAL wire ResearchMode.getConsolidationSnapshot() into SONA EWC++ (evaluated, ACCEPT-scoped) Continues 2026-10-27 (#4531/#4532) and 2026-11-01 (#4633 SCAN)'s own disclosed gap: BalancedMode was the only SONA learning mode wired into SONAManager's EWC++ consolidation path. ResearchMode already maintains real per-key gradient-shaped state (adamM/adamV, already read back by its own dormant computeEWCLoss()) so it can be wired honestly using the exact reviewed Balanced-mode delta-since-snapshot pattern, with zero sona-manager.ts changes needed (the hook is mode-agnostic). EdgeMode and RealTimeMode are explicitly NOT wired (no real gradient-shaped state exists to snapshot without fabricating it); BatchMode is also not wired (its accumulatedGradients map is zeroed on an independent 4-step flush cadence, making a direct port semantically ambiguous). 5 new tests (3 discriminating, 2 controls), stash-isolated baseline fails 3/5 exactly as predicted, candidate 5/5 pass. Full @claude-flow/neural suite 153/153 both ways except the 3 discriminating failures, 0 regressions. tsc --noEmit 0 errors both ways. Independent adversarial critique: CONFIRMED-WITH-CAVEATS (one test-strength nit, fixed forward same session). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH7BxmEedHJQP2wdfCq * docs(dream-cycle): fill in witness stamp for 2026-11-02 gist Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH7BxmEedHJQP2wdfCq * docs(dream-cycle): append 2026-11-02 ledger row (#4659/#4660) Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH7BxmEedHJQP2wdfCq * fix(ci): bump @claude-flow/neural to 3.0.3 for the leaf-package-publish audit CI's audit-leaf-package-publish.mjs correctly flagged this PR: @claude-flow/ neural is a non-bundled leaf (resolves from the registry, not shipped inside the release train tarballs), and this PR changed its publishable source (src/modes/research.ts) without bumping its package.json version — a release now would ship the old copy and the ResearchMode EWC fix would reach nobody. Bumps v3/@claude-flow/neural to 3.0.3 and the CLI's exact pin + lockfile specifier to match (the CLI pins an exact version, not a range, so both must move together). Verified locally: audit-leaf-package-publish.mjs now passes clean against the PR base; @claude-flow/neural suite still 153/153, tsc --noEmit still 0 errors. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH7BxmEedHJQP2wdfCq * fix(ci): bump root claude-flow umbrella's @claude-flow/neural pin to 3.0.3 audit-wrapper-dep-ranges.mjs flagged a second, independent pin: the root claude-flow umbrella's own dependencies block also pins @claude-flow/neural exactly, separately from the CLI's pin fixed in0e5b4a9. Bumped to 3.0.3 to match the workspace source version. package-lock.json's resolved tarball entry intentionally stays at the last-published 3.0.2 until neural is actually published alongside a future release -- that's expected pre-publish drift, not something this PR fixes, per CLAUDE.md's publishing rules. Verified locally: audit-wrapper-dep-ranges.mjs, audit-leaf-package-publish.mjs, and audit-umbrella-version-lockstep.mjs all pass clean. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH7BxmEedHJQP2wdfCq * Revert "fix(ci): bump root claude-flow umbrella's @claude-flow/neural pin to 3.0.3" This reverts commit9c060b680e. * Revert "fix(ci): bump @claude-flow/neural to 3.0.3 for the leaf-package-publish audit" This reverts commit0e5b4a9852. * dream(intelligence): #4972 SONAManager.triggerLearning() backlog-replay fix (post-critique scoped) triggerLearning() re-filtered the entire trajectories map every call with no "already learned from" marker, so trajectories surviving pruning got re-fed into gradient accumulation / EWC Fisher updates on every subsequent cycle, purely from replay. Disclosed-but-not-fixed 2026-10-27 (#4531/#4532); fixed here via a new Trajectory.learnedFrom gate. An independent adversarial critique found the fix is real but narrower than first claimed: it stops replay of stalled trajectories, but BalancedMode's gradientAccumulator/ewcState.means are never reset at all, so the same unbounded growth persists under ordinary continuous operation. Disclosed in both test docstrings and the gist, carried forward as the next priority candidate rather than shipped as fully fixed. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH6sq7KJoxGzn3ZSEAm * dream(intelligence): #4972 record PR #4973 in ledger Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH6sq7KJoxGzn3ZSEAm * dream(intelligence): #4972 bump @claude-flow/neural to 3.0.4 Patch bump for the triggerLearning() backlog-replay fix — neural is a non-bundled leaf resolved from the registry, so the CLI's pin must be raised and the leaf republished at actual release time for this fix to reach users (CLAUDE.md "Publishing Rules"; CI's audit-leaf-package-publish.mjs caught the unbumped version). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH6sq7KJoxGzn3ZSEAm * dream(memory): wire causalRecall into ControllerRegistry.initialize() ControllerRegistry declares `causalRecall` as an AgentDBControllerName with a real createController() case (dynamic agentdb import, built with the ADR-514-adapted embedder, same shape as its already-wired siblings causalGraph/learningSystem/explainableRecall) and includes it in the isControllerEnabled() "AgentDB-internal controllers" branch. But it was absent from every level of INIT_LEVELS, so initialize() never called createController() for it, and the public get() accessor's fallback path (agentdb[name] / agentdb.getController(name)) never runs this wrapper's own construction logic either. Net effect: registry.get('causalRecall') always returned null, silently. Disclosed-but-deferred by a 2026-10-28 session ("needs a human call on init-level ordering"). agentdb and its .database/.embedder/.vectorBackend are already populated before the INIT_LEVELS loop runs, so level placement doesn't affect correctness; grouped with construction-sibling causalGraph in level 4. Two discriminating tests added: a structural assertion that causalRecall appears in INIT_LEVELS, and an extension of the existing ADR-514 real-agentdb embedder-wiring integration test to cover causalRecall alongside its siblings. Both fail against the baseline exactly as predicted (toContain assertion; get() returns null) and pass against the candidate. Full package suite 717/718 with the fix (1 pre-existing, unrelated, environmental chmod-as-root failure in auto-memory-bridge.test.ts, confirmed byte-identical on the stashed baseline). tsc --noEmit clean both ways. Zero production call sites currently request causalRecall, so today's blast radius is zero — this makes a correctly-built, research-aligned capability (causal-provenance-conditioned memory recall) reachable for the first time rather than fixing a live breakage. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH5vDhjQF9zXr1xHT2a * fixup(memory): correct causalGraph construction claim in causalRecall comments Independent adversarial critique (Dream Cycle 2026-11-13) found the prior commit's comments overstated that causalRecall is "same shape as causalGraph" — causalGraph is actually built via agentdb's own getController() switch, not the dynamic-import-and-construct pattern causalRecall shares with learningSystem/explainableRecall. Cosmetic only; does not change behavior. Re-ran the targeted suite (94/94) and tsc --noEmit (clean) after this change. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH5vDhjQF9zXr1xHT2a * docs(dream-cycle): add 2026-11-13 memory SOTA gist Gist publishing blocked by the environment's proxy policy ("Gist writes are not permitted through this proxy", HTTP 403 on api.github.com/gists) -- a different root cause than prior nights' broken GH_TOKEN, same FALLBACK-for-remote-gist-publication outcome. Committed locally per established convention; full report embedded in the issue as well. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH5vDhjQF9zXr1xHT2a * docs(dream-cycle): append 2026-11-13 ledger row Issue #4982, PR #4983 (causalRecall wired into ControllerRegistry.initialize()). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH5vDhjQF9zXr1xHT2a * chore(memory): bump @claude-flow/memory to 3.3.3 for the causalRecall fix CI's audit-leaf-package-publish.mjs (added 2026-11-02, ruvnet/ruflo#3335/ #3390/#3327 Finding A) flags any non-bundled @claude-flow/* leaf whose publishable source changed without a version bump -- @claude-flow/memory is resolved from the registry by @claude-flow/cli, not bundled into the release tarball, so an unbumped source change here would silently never reach a fresh install. PATCH bump (bug fix, no API/schema change) per CLAUDE.md's semver policy. This does not, by itself, turn the check fully green: the CLI's exact pin (v3/@claude-flow/cli/package.json, still "3.3.2") now fails the sibling range-coverage check, since 3.3.3 is not yet published and the pin cannot honestly point at an unpublished version. Same unresolved shape as PR #4973 (2026-11-12), which hit the identical gap bumping @claude-flow/neural and left it to a human publish -- full resolution needs `npm publish @claude-flow/memory@3.3.3` plus a CLI-pin bump in a follow-up, which is outside this session's authority (see CLAUDE.md "Publishing to npm"). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH5vDhjQF9zXr1xHT2a * dream(intelligence): ReasoningBank.distill() discards failed trajectories, losing all pitfall-avoidance memory ReasoningBank.distill() judged every trajectory but only distilled successes into the retrievable memory pool; failures were judged then unconditionally discarded. An accepted ICLR 2026 paper (ReasoningBank, arXiv 2509.25140) measures that failure-aware distillation beats success-only memory on web/SWE benchmarks, and Ruflo already has a disconnected dual-track distiller (reasoningbank-adapter.ts) showing the team built this pattern once and never wired it in. - distill() now distills unsuccessful trajectories into a distinct memoryType: 'pitfall' memory (strategy framed as "AVOID: ...") instead of returning null, for any trajectory with at least one recorded step. - completeTask()'s call into PatternLearner.extractPattern() is now gated on memoryType === 'success', so a pitfall can never be promoted into a positive-exemplar Pattern (independently confirmed by adversarial critique to be load-bearing: PatternLearner's own qualityThreshold (0.5) and ReasoningBank's distillationThreshold (0.6) already diverge, so a ~0.55-quality trajectory could reach extractPattern with no prior memoryType field to stop it). - deduplicateMemories() is fixed forward: it would otherwise delete a pitfall memory that happens to share a near-identical embedding with a higher-quality success memory, treating opposite outcomes as duplicates -- a direct consequence of merging both types into one pool. Dedup now skips any pair whose memoryType differs. Evaluated: stash-isolated baseline fails exactly the new/changed tests (38/42 unaffected pass); candidate 43/43; full package 152/152, 0 regressions; related @claude-flow/memory learning-bridge suite 78/78; tsc --noEmit clean. Independently reproduced by an adversarial critic (verdict: CONFIRMED-WITH-CAVEATS -> forward-fixed -> re-verified). Human review required. Do not self-merge. * dream(intelligence): #5011 publish research gist (local, no gh gist access) docs/dream-cycle/dream-gist-2026-11-17.md -- full SOTA report, competitor comparison, hypothesis, evaluation receipt, and witness for issue #5011. * dream(intelligence): #5011 append ledger row (PR #5012) * dream(intelligence): #5011 bump @claude-flow/neural to 3.0.4 (CI: leaf-package-publish) The "Plugin package install-safety" CI gate (audit-leaf-package-publish.mjs) correctly flagged that this PR changes @claude-flow/neural's publishable source (index.ts, reasoning-bank.ts, types.ts) without a version bump -- it's a non-bundled leaf per CLAUDE.md's Publishing Rules, so an unbumped version means the fix would ship to nobody at release time. Bump to 3.0.4 (patch: bug fix, no breaking API removal) and keep @claude-flow/cli's exact pin in lockstep to avoid introducing new cli-pin/workspace drift. * dream(intelligence): #5011 sync v3/pnpm-lock.yaml for @claude-flow/neural@3.0.4 CI's "Smoke (no better-sqlite3)" and "Static regression guards" jobs both failed with ERR_PNPM_OUTDATED_LOCKFILE after the prior commit bumped @claude-flow/cli's @claude-flow/neural specifier without regenerating the lockfile in the same commit. @claude-flow/neural resolves via link:../neural regardless of specifier value (it's a local workspace link, not a registry/integrity entry), so this is a minimal, surgical specifier-only edit rather than a full `pnpm install --lockfile-only` regen -- the latter pulled in unrelated pre-existing drift (@claude-flow/codex and @claude-flow/memory switching to workspace links, a ruvector bump) that has nothing to do with this PR. Verified locally with pnpm@8.15.0 (matching CI's pinned version, not this environment's default pnpm@10.28, which produces a differently-shaped lockfile): `pnpm install --frozen-lockfile --lockfile-only` now passes clean. * dream(intelligence): #5011 bump root package.json's @claude-flow/neural range too audit-wrapper-dep-ranges.mjs caught a third pin location I'd missed: the root `claude-flow` umbrella package.json declares its own "@claude-flow/neural": "3.0.3" dependency range, separate from @claude-flow/cli's pin. Bumped to 3.0.4 to match. Did NOT touch package-lock.json: its @claude-flow/neural entry carries a real resolved/integrity hash from the npm registry for 3.0.3, and @claude-flow/neural@3.0.4 is not yet published there -- regenerating it would require either a real `npm install` (which fails ETARGET, same as the CLI npx-install smoke failure already reported on this PR) or fabricating a resolved URL/integrity for a tarball that doesn't exist, which would be unsafe. Any CI job that runs `npm ci` at the repo root will stay red for the same reason already documented on this PR: this needs an actual npm publish of @claude-flow/neural@3.0.4, which is a separate, human-authorized release action outside this session's scope. * Revert "dream(intelligence): #5011 bump root package.json's @claude-flow/neural range too" This reverts commit96f0a32e56. * dream(memory): #5033 CacheManager frequency-aware eviction (HTM-EAR-grounded) Adds an opt-in, Darwin-tuned frequencyWeight/evictionScanWindow blend to CacheManager's eviction policy. Default (unset/0) is byte-identical to the existing pure-LRU tail eviction via an early return - zero behavior change for every current caller (AgentDBAdapter, TieredCacheManager, ControllerRegistry's tieredCache). Motivated by HTM-EAR (arXiv:2603.10032, Feb 2026), which shows pure-LRU eviction permanently drops high-access-frequency entries under skewed access even though CachedEntry.accessCount already tracks exactly the signal needed. Evaluation: baseline 718/719 (1 pre-existing environmental failure) -> candidate 722/723, tsc clean both ways, stash-isolated discriminating tests fail on baseline exactly as predicted. Independently reproduced by a fresh-context adversarial critic (verdict: CONFIRMED). Bounded 3-gen x 4-candidate Darwin sweep over a new synthetic skewed-workload benchmark finds an interior optimum (frequencyWeight=0.85) that beats both the baseline and a naive frequencyWeight=1.0 - full lineage persisted. Full receipt in docs/dream-cycle/dream-gist-2026-11-18.md and issue #5033. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH4YtmHBfXwGDoLNB76 * dream(memory): #5033 witness finalization Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH4YtmHBfXwGDoLNB76 * dream(memory): #5033 ledger update Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH4YtmHBfXwGDoLNB76 * dream(memory): #5033 bump @claude-flow/memory 3.3.3 -> 3.4.0 + CLI pin audit-leaf-package-publish flagged that this PR changes publishable source in @claude-flow/memory (a non-bundled leaf that resolves from the registry, not the release tarball) without a version bump - per CLAUDE.md's Publishing Rules, that would ship nobody the fix. Minor bump (backward-compatible: two new optional CacheConfig fields, default-off). CLI's exact pin raised to match, mirroring PR #5021's documented precedent for @claude-flow/cli-core: the leaf needs an actual npm publish before a real release, which is a separately-authorized human action out of scope for this PR. v3/pnpm-lock.yaml is deliberately left unchanged (still resolving 3.3.3) until that publish happens - its integrity entries can't be computed for an unpublished tarball, same reasoning as #5021's "fill in the integrity after the publish". Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH4YtmHBfXwGDoLNB76 * dream(memory): #5033 sync pnpm-lock.yaml specifier for the memory bump pnpm install --frozen-lockfile was failing (ERR_PNPM_OUTDATED_LOCKFILE) across ~14 CI jobs (Smoke, Type Check V3, Test V3 Packages, Plugin hooks smoke, Windows hooks smoke, MCP paired-tool smoke, guard, etc.) because v3/pnpm-lock.yaml still specified @claude-flow/memory@3.3.3 for the cli importer after7423f32bumped package.json to 3.4.0. Minimal hand-edit (2 lines), not a full `pnpm install --no-frozen-lockfile` regeneration - that pulls in unrelated registry drift (ruvector/router version bumps, dropped platform-optional entries) with no connection to this change, which PR #5021 explicitly avoided for the same reason ("lockfiles are hand-edited to the minimum"). The cli importer's entry now resolves via workspace link (`link:../memory`), matching how every other importer in this lockfile already references @claude-flow/memory. Verified locally: `pnpm install --frozen-lockfile` passes. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01ReiDH4YtmHBfXwGDoLNB76 * fix(neural): keep distill()'s success-path threshold from #5012 #5012 dropped the distillationThreshold check for every trajectory. judge() already applies it to success verdicts, but a verdict set without judge() would now distill below threshold. Restore the check for successes only; pitfalls are unaffected. Co-Authored-By: RuFlo <ruv@ruv.net> * chore(release): bump @claude-flow/neural 3.1.0 and @claude-flow/memory 3.4.0 One bump per touched leaf for the integrated dream-cycle fixes (both add public surface: NeuralLearningSystem.serialize/deserialize, DistilledMemory.memoryType, Trajectory.learnedFrom; LearningBridge statePath, CacheConfig.frequencyWeight/evictionScanWindow). CLI and root umbrella pins follow. pnpm-lock edited by hand (specifiers only, plus memory now linking to the workspace since 3.4.0 is not yet on npm). The root package-lock.json still records neural 3.0.3 and needs a refresh after the leaves publish (same as68c8d74b23->3ce46cfa57). Co-Authored-By: RuFlo <ruv@ruv.net> * fix(neural): treat memories without memoryType as successes when deduplicating ReasoningBank snapshots saved before #5012 have no memoryType, so the new success/pitfall dedup guard never matched them against fresh success memories. They only ever held successes; default the field accordingly. Co-Authored-By: RuFlo <ruv@ruv.net> * chore(deps): root lockfile resolves published @claude-flow/neural 3.1.0 Co-Authored-By: RuFlo <ruv@ruv.net> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: r <r@x>
Ruflo
An agent meta-harness for Claude Code and Codex.
📖 RuFlo Explained — Build an AI Team That Plans, Remembers, Tests, and Improves A 14-chapter guide: from the basic idea to a first useful task, then memory, agent teams, plugins, cost and verification.
Agent = Model + Harness. The model writes; the harness gives it tools, memory, loops, sandboxes, and controls so it can actually work. Ruflo is the harness — the execution layer around Claude Code and Codex that adds 100+ specialized agents, coordinated swarms, self-learning memory, federated comms across machines, and enterprise security guardrails. So agents don't just run, they collaborate.
One npx ruflo init gives Claude Code a nervous system: agents self-organize into swarms, learn from every task, remember across sessions, and — with federation — securely talk to agents on other machines without leaking data. You keep writing code. Ruflo handles the coordination.
Self-Learning / Self-Optimizing Agent Architecture
User --> Ruflo (CLI/MCP) --> Router --> Swarm --> Agents --> Memory --> LLM Providers
^ |
+---- Learning Loop <-------+
New to Ruflo? You don't need to learn 406 MCP tools or 61 CLI commands. After
init, just use Claude Code normally — the hooks system automatically routes tasks, learns from successful patterns, and coordinates agents in the background.
📖 Background — where the name comes from
Claude Flow is now Ruflo — named by
rUv, who loves Rust, flow states, and building things that feel inevitable. The "Ru" is the rUv. The "flo" is working until 3am. Underneath, powered byCognitum.Oneagentic architecture, running a supercharged Rust-based AI engine, embeddings, memory, and plugin system.
Quick Start
Optional recipe: local vector search with RVF and MCP · Ruvnet ecosystem
There are two different install paths with very different surface areas. Pick based on what you need (#1744):
| Claude Code Plugin | CLI install (npx ruflo init) |
|
|---|---|---|
| What it gives you | Slash commands + a few skills + agent definitions per-plugin | Full Ruflo loop — 98 agents, 60+ commands, 30 skills, MCP server, hooks, daemon |
| Files in your workspace | Zero | .claude/, .claude-flow/, CLAUDE.md, helpers, settings |
| MCP server registered | Only if ruflo-core is installed (it ships its own .mcp.json) — most other plugins don't |
Yes |
| Hooks installed | No | Yes |
| Best for | Try a single plugin's commands without committing to the full install | Production use — everything works as documented |
Path A — Claude Code Plugins (lite, slash commands only)
# Add the marketplace
/plugin marketplace add ruvnet/ruflo
# Install core + any plugins you need
/plugin install ruflo-core@ruflo
/plugin install ruflo-swarm@ruflo
/plugin install ruflo-rag-memory@ruflo
/plugin install ruflo-neural-trader@ruflo
This adds slash commands and agent definitions. ruflo-core (installed above) does register its own MCP server on install — its tools are callable as mcp__plugin_ruflo-core_ruflo__* (e.g. mcp__plugin_ruflo-core_ruflo__memory_store), not the bare memory_store/swarm_init/agent_spawn names the CLI-track scaffold uses. Other plugins generally don't ship their own MCP server. For the full loop with the CLI-track tool names, use Path B below.
🔌 All 48 plugins
Core & Orchestration
| Plugin | What it does |
|---|---|
| ruflo-core | Foundation — server, health checks, plugin discovery |
| ruflo-swarm | Coordinate multiple agents as a team |
| ruflo-autopilot | Let agents run autonomously in a loop |
| ruflo-loop-workers | Schedule background tasks on a timer |
| ruflo-workflows | Reusable multi-step task templates |
| ruflo-federation | Agents on different machines collaborate securely |
| ruflo-console | Cockpit inside Claude Code, and the /ruflo command for ruflo mods |
| ruflo-mods | In-process Claude Code mod — routing, learning signals, and policy checks |
| ruflo-ai-team | Tenant-isolated team that divides work and returns evidence |
| ruflo-agntcy | AGNTCY/Outshift transport and intent-scoped tool authorization |
| ruflo-bbs-federation | AgentBBS rooms so agents on different hosts can coordinate |
| ruflo-chatgpt-federation | ChatGPT federation publisher with its own signing keys |
| ruflo-x-gateway | Signed federation messages, channels, and work claims |
| ruflo-business-pods | Business-domain pod templates and a dry-run tick runner |
Memory & Knowledge
| Plugin | What it does |
|---|---|
| ruflo-agentdb | Fast vector database for agent memory |
| ruflo-rag-memory | Smart retrieval — hybrid search, graph hops, diversity ranking |
| ruflo-rvf | Save and restore agent memory across sessions |
| ruflo-ruvector | ruvector — GPU-accelerated search, Graph RAG, 103 tools |
| ruflo-knowledge-graph | Build and traverse entity relationship maps |
Intelligence & Learning
| Plugin | What it does |
|---|---|
| ruflo-intelligence | Agents learn from past successes and get smarter |
| ruflo-graph-intelligence | Sublinear graph reasoning — PageRank, delta updates, complexity-aware execution (ADR-123) |
| ruflo-daa | Dynamic agent behavior and cognitive patterns |
| ruflo-ruvllm | Run local LLMs (Ollama, etc.) with smart routing |
| ruflo-goals | Break big goals into plans and track progress |
| ruflo-deepseek-harness | Agents, commands, and skills for DeepSeek-backed workflows |
Code Quality & Testing
| Plugin | What it does |
|---|---|
| ruflo-testgen | Find missing tests and generate them automatically |
| ruflo-browser | Automate browser testing with Playwright |
| ruflo-jujutsu | Analyze git diffs, score risk, suggest reviewers |
| ruflo-rure | Static analysis of a local JS/Electron app you are authorized to study, with file and line evidence |
| ruflo-docs | Generate and maintain documentation automatically |
Security & Compliance
| Plugin | What it does |
|---|---|
| ruflo-security-audit | Scan for vulnerabilities and CVEs |
| ruflo-aidefence | Block prompt injection, detect PII, safety scanning |
| ruflo-protector | Optional watchdog for unattended agents — learn, notify, or enforce |
Architecture & Methodology
| Plugin | What it does |
|---|---|
| ruflo-adr | Track architecture decisions with a living record |
| ruflo-ddd | Scaffold domain-driven design — contexts, aggregates, events |
| ruflo-sparc | Guided 5-phase development methodology with quality gates |
| ruflo-metaharness | Grade your agent setup, scan tool configs for security risks, and track changes over time (guide) |
| ruflo-arena | Competitive ruliology — pit agent strategies against each other in tournaments, hill-climb and co-evolve the winners (ADR-147/148) |
DevOps & Observability
| Plugin | What it does |
|---|---|
| ruflo-migrations | Manage database schema changes safely |
| ruflo-observability | Structured logs, traces, and metrics in one place |
| ruflo-cost-tracker | Track token usage, set budgets, get cost alerts |
| ruflo-ruos | Run swarm agents on your own ruOS cloud desktops |
Extensibility
| Plugin | What it does |
|---|---|
| ruflo-agent | Run agents — local WASM sandbox (rvagent) + Anthropic Claude Managed Agents (cloud) |
| ruflo-plugin-creator | Scaffold, validate, and publish your own plugins |
Domain-Specific
| Plugin | What it does |
|---|---|
| ruflo-iot-cognitum | IoT device management — trust scoring, anomaly detection, fleets |
| ruflo-neural-trader | neural-trader — AI trading with 4 agents, backtesting, 112+ tools |
| ruflo-market-data | Ingest market data, vectorize OHLCV, detect patterns |
| ruflo-music | Compose and generate music through a Cognitum Music account |
CLI Install
macOS / Linux / WSL / Git-Bash:
# One-line install (POSIX shells only — see Windows note below)
curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/ruflo@main/scripts/install.sh | bash
All platforms (including native Windows PowerShell / cmd):
# Interactive setup wizard — runs identically on every platform
npx ruflo@latest init wizard
# Quick non-interactive init
# npx ruflo@latest init
# Or install globally
npm install -g ruflo@latest
💡 Windows users: the
curl ... | bashform needs a POSIX shell (Git-Bash, WSL, MSYS). Thenpx ruflo@latest init wizardline works natively in PowerShell and cmd. If you hit an'bash' is not recognizederror, use thenpxline instead — both end up running the same init flow.
MCP Server
# Add Ruflo as an MCP server in Claude Code
claude mcp add claude-flow -- npx ruflo@latest mcp start
HTTP transport security
ruflo mcp start -t http exposes every registered tool over HTTP (/rpc, /mcp, /ws). The default stdio transport is not affected.
| Setting | Effect |
|---|---|
RUFLO_MCP_HTTP_TOKEN=<token> |
Require Authorization: Bearer <token> on every request. Failure is a bare 401. The token is compared in constant time and is never logged. Prefer this over --auth-token, which is visible in ps. |
--auth-token-file <path> |
Read the token from a file (one line). Takes precedence over the env var. |
--auth-token <token> |
Same, on the command line (visible in argv; highest precedence). |
RUFLO_MCP_ALLOW_UNAUTHENTICATED_HTTP=1 |
Allow an unauthenticated bind to a non-loopback --host. Only for a trusted network boundary or an authenticating reverse proxy. |
A token must be 16-512 printable ASCII characters (no spaces). GET /health stays public and returns only {"status":"ok"} when a token is set. Tokens are supported for -t http only; -t websocket rejects one.
--host |
no token | token set |
|---|---|---|
localhost, 127.0.0.1, ::1 |
starts, unauthenticated | starts, token required |
anything else (0.0.0.0, ::, a LAN IP, 127.0.0.2, [::1], LOCALHOST) |
refuses to start unless RUFLO_MCP_ALLOW_UNAUTHENTICATED_HTTP=1 |
starts, token required |
Without a token, a loopback server is still unauthenticated: any process on the machine, and any web page that can reach it via DNS rebinding, can call tools. Set RUFLO_MCP_HTTP_TOKEN whenever the HTTP transport is used.
Upgrading: binding off loopback (for example --host 0.0.0.0 in Docker) now needs a token or the opt-out above; otherwise the server exits with an error.
Startup checks report available updates without installing them. To opt in to
automatic patch installation, set RUFLO_AUTO_UPDATE=true (1, yes and on
also work). Minor and major updates remain manual; critical package priority
does not bypass an opt-out. CI detection and CLAUDE_FLOW_AUTO_UPDATE=false
still disable the update check.
What You Get
Companion helper refresh (session.cjs / memory.cjs) skips symlinked helper
directories and symlinked/non-file targets. Regular files are preserved on
startup and replaced on an explicit upgrade through an exclusive temporary
file and rename. A skipped companion is left in place; remove or repair the
unsafe path before retrying. These pathname checks do not protect against an
attacker concurrently replacing ancestor directories, and do not extend the
signed helper set or protect other state writers.
| Capability | Description |
|---|---|
| 🤖 100+ Agents | Specialized agents for coding, testing, security, docs, architecture |
| 📡 Comms Layer | Zero-trust federation — agents across machines/orgs discover, authenticate, and exchange work securely |
| 🐝 Swarm Coordination | Hierarchical, mesh, and adaptive topologies with consensus |
| 🧠 Self-Learning | SONA neural patterns, ReasoningBank, trajectory learning |
| 💾 Vector Memory | HNSW-indexed AgentDB — measured ~1.9x faster at N=20k, ~3.2x–4.7x at N=5k vs brute force (recall@10 ~0.99); ANN wins above the crossover, ties/loses at small N. See audit + scripts/benchmark-intelligence.mjs |
| ⚡ Background Workers | 12 auto-triggered workers (audit, optimize, testgaps, etc.) |
| 🧩 Plugin Marketplace | 48 native Claude Code plugins + 14 in-tree npm plugins |
| 🔌 Multi-Provider | Claude, GPT, Gemini, Cohere, Ollama with smart routing |
| 🛡️ Security | AIDefence, input validation, CVE remediation, path traversal prevention |
| 🌐 Agent Federation | Cross-installation agent collaboration with zero-trust security |
| 🔬 MetaHarness | Audit your AI agent setup before you ship. Grade readiness (1-100), scan tool configs for security issues, snapshot the whole project to catch regressions over time, and find templates that match your repo. ruflo eject turns a ruflo project into a standalone agent toolkit with its own name. Full guide. |
Agent Federation — Slack for Agents
Your Agent --> [ Remove secrets ] --> [ Sign message ] --> [ Encrypted channel ]
Emails, SSNs, Proves it came No one reads it
keys stripped from you in transit
|
v
Their Agent <-- [ Block attacks ] <-- [ Check identity ] <------+
Stops prompt Rejects forgeries
injection
Audit trail on both sides.
Trust builds over time. Bad behavior = instant downgrade.
Slack gave teams channels. Federation gives agents the same thing — shared workspaces across trust boundaries, where agents on different machines, orgs, or cloud regions can discover each other, prove who they are, and collaborate on tasks.
The difference: some channels are trusted, some aren't. @claude-flow/plugin-agent-federation handles that automatically. Your agents join a federation, get verified via mTLS + ed25519, and start exchanging work — with PII stripped before anything leaves your node and every message auditable. Untrusted agents can still participate at lower privilege: they see discovery info, not your memory. As they prove reliable, trust upgrades. If they misbehave, they get downgraded instantly — no human in the loop required.
You don't configure handshakes or manage certificates. You federation init, federation join, and your agents start talking. The protocol handles identity, the PII pipeline handles data safety, and the audit trail handles compliance.
📘 Full user guide:
docs/federation/— setup, MCP tools, trust levels, circuit breaker, and the (opt-in) WireGuard mesh layer that ties packet-layer reachability to federation trust. ADR-111 deep-dive atdocs/federation/phase7-mesh-bringup.md.
Federation capabilities
| Capability | How it works | |
|---|---|---|
| 🔒 | Zero-trust federation | Remote agents start untrusted. Identity proven via mTLS + ed25519 challenge-response. No API keys, no shared secrets. |
| 🛡️ | PII-gated data flow | 14-type detection pipeline scans every outbound message. Per-trust-level policies: BLOCK, REDACT, HASH, or PASS. Adaptive calibration reduces false positives. |
| 📊 | Behavioral trust scoring | Formula (0.4×success + 0.2×uptime + 0.2×threat + 0.2×integrity) continuously evaluates peers. Upgrades require history; downgrades are instant. |
| 📋 | Compliance built-in | HIPAA, SOC2, GDPR audit trails as compliance modes. Every federation event produces a structured record searchable via HNSW. |
| 🤝 | 9 MCP tools + 10 CLI commands | Full lifecycle: federation_init, federation_send, federation_trust, federation_audit, and more. |
Example: two teams sharing fraud signals without sharing customer data
# Team A: initialize federation and generate keypair
npx claude-flow@latest federation init
# Team A: join Team B's federation endpoint
npx claude-flow@latest federation join wss://team-b.example.com:8443
# Team A: send a task — PII is stripped automatically before it leaves
npx claude-flow@latest federation send --to team-b --type task-request \
--message "Analyze transaction patterns for account anomalies"
# Team A: check peer trust levels and session health
npx claude-flow@latest federation status
See issue #1669 for the complete architecture, trust model, and implementation roadmap.
# Claude Code plugin
/plugin install ruflo-federation@ruflo
# Or via CLI
npx claude-flow@latest plugins install @claude-flow/plugin-agent-federation
Claude Code: With vs Without Ruflo
| Capability | Claude Code Alone | + Ruflo |
|---|---|---|
| Agent Collaboration | Isolated, no shared context | Swarms with shared memory and consensus |
| Coordination | Manual orchestration | Queen-led hierarchy (Raft, Byzantine, Gossip) |
| Memory | Session-only | HNSW vector memory with sub-ms retrieval |
| Learning | Static behavior | SONA self-learning with pattern matching |
| Task Routing | You decide | Intelligent routing (89% accuracy) |
| Background Workers | None | 12 auto-triggered workers |
| LLM Providers | Anthropic only | 5 providers with failover |
| Security | Standard | CVE-hardened with AIDefence |
Architecture overview
User --> Claude Code / CLI
|
v
Orchestration Layer
(MCP Server, Router, 27 Hooks)
|
v
Swarm Coordination
(Queen, Topology, Consensus)
|
v
100+ Specialized Agents
(coder, tester, reviewer, architect, security...)
|
v
Memory & Learning
(AgentDB, HNSW, SONA, ReasoningBank)
|
v
LLM Providers
(Claude, GPT, Gemini, Cohere, Ollama)
Documentation
Four docs for four audiences:
| Doc | When to read it |
|---|---|
| Status | See what currently works — capability counts, test baselines, recent fixes, what's next. The is-it-ready doc. |
| User Guide | Daily reference — every command, every config flag, every plugin. The how-do-I doc. |
| MetaHarness Guide | How to grade your agent setup, scan tool configs for security, detect changes between runs, and eject a project into a standalone agent toolkit. The audit-my-setup doc. |
| Benchmarks | v3.8.0 SOTA matrix vs LangGraph / AutoGen / CrewAI on darwin-arm64 + linux-x64. ruflo wins cold start, single turn, RSS by 1.3×–1953×. The is-it-fast doc. |
| Verification | Cryptographically prove your installed bytes match the signed witness — ruflo verify. The trust-but-verify doc. |
| Team Gateway Checklist | Before-merge gates, dual-mode handoff, memory namespace sharing, and witness manifest entry per merge. The safer-team-workflows doc. |
Benchmark internals (for reproduction): sota-workload-spec.md · SOTA-PROGRESS.md · raw matrix JSON: darwin · linux
User Guide section index:
| Section | Topics |
|---|---|
| Quick Start | Installation, prerequisites, install profiles |
| Core Features | MCP tools, agents, memory, neural learning |
| Intelligence & Learning | Hooks, workers, SONA, model routing |
| Swarm & Coordination | Topologies, consensus, hive mind |
| Security | AIDefence, CVE remediation, validation |
| Ecosystem | RuVector, agentic-flow, Flow Nexus |
| Configuration | Environment variables, config schema |
| Plugin Marketplace | Browse and install plugins |
Support
| Resource | Link |
|---|---|
| Documentation | User Guide |
| Issues & Bugs | GitHub Issues |
| Enterprise | ruv.io |
| Community | Agentics Foundation Discord |
| Powered by | Cognitum.one |
License
MIT - RuvNet


