29 reviewed PRs plus the #3359 fix; memory alpha.26, neural alpha.10, cli-core alpha.6 published standalone first. Merge commit, not squash, so the included PR heads stay ancestors.
Co-Authored-By: RuFlo <ruv@ruv.net>
Regenerated on a clean, fully built tree, so all 117 entries verify on each OS
(no dist entries carried forward unattested). Regen was run per OS with the
manifest os field set explicitly, since regen.mjs stamps the runner's OS.
Co-Authored-By: RuFlo <ruv@ruv.net>
Pin the three standalone-published leaves exactly (memory alpha.26 in both
dependencies and optionalDependencies, neural alpha.10, cli-core alpha.6) and
hand-edit the lockfiles minimally: pnpm importer specifiers plus one new
memory registry snapshot, and the root package-lock cli-core/neural entries.
Co-Authored-By: RuFlo <ruv@ruv.net>
These three resolve from the registry, not the train tarballs, so the source
changes already on main (#3352+#3359 memory upsert, #3330 MoE load-balance,
#3385 validateEnv denylist) reach nobody without a standalone publish.
Co-Authored-By: RuFlo <ruv@ruv.net>
Vite alias keys prefix-match, so the bare '@claude-flow/security' alias rewrote
the safe-git subpath import to '.../src/index.ts/safe-git' (ENOTDIR) and failed
about ten cli test files once #3382 added the import.
Co-Authored-By: RuFlo <ruv@ruv.net>
* dream(intelligence): #3394 fix inverted EMA direction in EWCConsolidator.updateFisherFromConfidences()
EWCConsolidator.updateFisherFromConfidences() (v3/@claude-flow/cli/src/memory/ewc-consolidation.ts),
the Fisher-matrix EMA update wired into production at intelligence.ts:413 after every SONA
distillLearning() pass, used globalFisher[i] = alpha*old + (1-alpha)*new with alpha=fisherDecayRate
(0.01) -- giving the new batch 99% weight and the accumulated Fisher signal only 1%, discarding
~99% of accumulated importance on every call. Inverted vs. the two sibling globalFisher-updating
methods in the same class (computeFisherMatrix(), recordGradient()), which correctly do
(1-decay)*old + decay*new. Confirmed against the standard online-EWC/EWC++ convention (Chaudhry
et al., ECCV 2018, arXiv:1801.10112).
Fixed to match the sibling sites. Added a discriminating regression test
(__tests__/ewc-fisher-ema-direction.test.ts): baseline-fails/candidate-passes verified via git
stash isolation, independently reproduced by an adversarial critic. Full @claude-flow/cli suite
byte-identical failure set both ways (96 pre-existing, unbuilt-dist class); 155/155 in EWC-adjacent
tests; tsc --noEmit identical (463 pre-existing errors, none in changed files).
Darwin skipped (binary correctness fix, no fitness gradient to search). No Flywheel state exists
in this repo; evidence retained as tests + issue + gist + stash-isolated proof, per every accepted
night since 2026-08-18.
See issue #3394 for the full evaluation receipt, adversarial critique, and witness stamp.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_0183FfWhMHJ2EjZb2MjxZfpJ
* dream(intelligence): #3394 update ledger with 2026-09-22 row + 09-15..09-21 backlog note
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_0183FfWhMHJ2EjZb2MjxZfpJ
* dream(intelligence): #3394 harden updateFisherFromConfidences() per review
Addresses ruvnet's REJECT review on #3395 (evidence-gate review at 1cc7231):
the EMA-direction fix itself was confirmed correct (retention 1.01e-8% ->
95.099% after 5 low-signal updates), but the function had no defenses
against malformed input or a corrupted persisted state file.
- updateFisherFromConfidences(): drop a sample whose embedding or
oldConf/newConf is non-finite (NaN/Infinity) instead of letting it poison
the shared globalFisher accumulator for every other pattern in the batch;
a batch where no sample contributes (all filtered out, or every delta was
zero) now leaves globalFisher and persisted state untouched instead of
decaying accumulated importance toward an empty no-op batch and writing
that no-op to disk.
- loadFromDisk(): validate the loaded globalFisher (exact dimensions, every
entry a finite non-negative number -- Fisher values are sums of squares
and can never legitimately be negative) and quarantine (reset to zero)
the whole array if invalid, rather than silently resuming with corrupted
entries (e.g. a non-finite value that round-tripped through JSON as
`null`).
- 3 new regression tests: non-finite input dropped without poisoning state,
no-op update doesn't persist, corrupted persisted state is quarantined
on load. All 3 independently confirmed to fail against the pre-hardening
code via git stash isolation.
158/158 EWC-adjacent tests passing (153 pre-existing + 5 EMA-direction +
3 new hardening); tsc --noEmit identical (463 pre-existing errors, none in
changed files).
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_0183FfWhMHJ2EjZb2MjxZfpJ
* dream(intelligence): #3394 rebind witness to the hardened candidate commit
Addresses the last item of ruvnet's REJECT review on #3395: the original
witness bound "session commit" to the pre-session base commit
(9c61c86, computed at STEP 0 before any diff existed), which didn't
actually bind the receipt to the candidate that was reviewed. Rebound to
290959f (the hardened candidate commit from the previous push) and
recomputed the gist SHA-256 + witness stamp against it.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_0183FfWhMHJ2EjZb2MjxZfpJ
* dream(intelligence): #3394 update ledger with post-review hardening outcome
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_0183FfWhMHJ2EjZb2MjxZfpJ
---------
Co-authored-by: Claude <noreply@anthropic.com>
* dream(swarm): #3356 mirror leader edges for hierarchical/centralized/hybrid topologies (evaluated, ACCEPT-scoped)
TopologyManager.createEdgesForNode() only mirrored a new node's edge onto
its connection target when config.type === 'mesh'. For hierarchical,
centralized, and hybrid topologies, a worker's initial connection to the
queen/coordinator was therefore never mirrored back, and neither
shouldRebalance() (no non-mesh logic) nor any rebalance*() function's
"connect worker to leader" guard (checks the worker's already-populated
connections instead of the leader's) can repair it later. Net effect on
main: the queen/coordinator's own connections/adjacencyList permanently
never include any worker, in steady-state operation, for every
hierarchical/centralized/hybrid swarm.
Fixed by mirroring the edge whenever the connection target already exists
in the topology, matching what mesh already did. 3 new discriminating
regression tests added (hierarchical/centralized/hybrid) — the 2 existing
tests meant to catch this asserted connections.length >= 0, a tautology
that can never fail.
Full evaluation receipt, independent adversarial critique, research (5-role
fan-out), and ruview/ruvector-integration scan findings in
docs/dream-cycle/dream-gist-2026-09-19.md and issue #3356.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01CYAixUoh41N5DK5rDA3EAj
* docs(dream-cycle): append 2026-09-19 swarm ledger row (#3356/#3357)
Also records verified fates for the trailing 7 nights (09-10..09-18) and
notes the still-unmerged 09-15..09-18 drafts, none stale.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01CYAixUoh41N5DK5rDA3EAj
---------
Co-authored-by: Claude <noreply@anthropic.com>
* dream(memory): #3351 fix AgentDBAdapter.store() same-key upsert orphaning
AgentDBAdapter.store() never checked for an existing entry under the same
(namespace, key) before writing. Since entry.id is always a fresh random id
(generateMemoryId()), a second store() for the same logical key left the
prior occupant as a permanent orphan: unreachable via getByKey(), but still
live in entries/namespaceIndex/tagIndex and, for embedded entries, still a
point in the HNSW index -- so search()/semanticSearch() returned stale
duplicates forever.
Fixed by evicting the prior (namespace,key) occupant via the adapter's own
existing, already-tested delete() path before storing the new entry.
Independent adversarial critique: CONFIRMED-WITH-CAVEATS. Disclosed gap:
the fix covers sequential re-stores; concurrent store() calls for the same
key can still race (no mutex) -- flagged as a follow-up, not fixed tonight.
4 new regression tests (agentdb-adapter-upsert.test.ts): 2/4 fail against
baseline for the predicted reason, 4/4 pass against the candidate. Full
@claude-flow/memory suite: 517->521 passed, 1 pre-existing unrelated
failure unchanged. tsc --noEmit clean both ways.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01QYZ8XEAXBWp8HVni2enLcY
* dream(memory): #3351 record PR #3352 in ledger
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01QYZ8XEAXBWp8HVni2enLcY
* dream(memory): #3351 post-review hardening — bulkInsert() + failure atomicity
Addresses ruvnet's review on PR #3352 (2 blocking findings):
1. AgentDBAdapter.bulkInsert() bypassed store()'s same-key dedup entirely --
UnifiedMemoryService.bulkInsert() forwards to it, so a batch containing
duplicate (namespace,key) values, or replacing an already-stored key,
left old ids reachable via get()/query() while only keyIndex pointed at
the newest id. Fixed: bulkInsert() now computes superseded ids (both
pre-existing occupants and intra-batch duplicate-key losers, last entry
per key wins) from a pre-mutation snapshot, and evicts them via the same
evictEntry() primitive store() uses, after the batch's embeddings are
safely indexed.
2. store() deleted the prior (namespace,key) occupant BEFORE validating the
replacement's embedding via HNSWIndex.addPoint() (which can throw on a
dimension mismatch or a full index). A rejected write therefore lost the
prior value outright instead of merely failing. Fixed: addPoint() now
runs first; the prior occupant is only evicted once the replacement is
confirmed indexable.
delete() is refactored into a shared evictEntry(id, {touchKeyIndex}) private
primitive, used by delete() (touchKeyIndex: true) and by both same-key
upsert paths (touchKeyIndex: false, since those callers are about to
repoint keyIndex themselves).
5 new tests per the review's request: failed-replacement-preserves-prior-
value, bulkInsert duplicate-key-within-batch, bulkInsert pre-existing-vs-
batch replacement, a same-key replacement surviving a persisted save/
reload, and a disclosed-not-fixed concurrent-store race (documents the
still-open gap rather than silently omitting it -- see PR discussion for
why a per-key lock is a follow-up, not part of tonight's patch).
Full @claude-flow/memory suite: 521->526 passed (+5 new), 1 pre-existing
unrelated failure unchanged. tsc --noEmit clean.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01QYZ8XEAXBWp8HVni2enLcY
* dream(memory): #3351 post-review addendum in gist/ledger, recompute witness
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01QYZ8XEAXBWp8HVni2enLcY
---------
Co-authored-by: Claude <noreply@anthropic.com>
* dream(intelligence): #3349 wire CLAUDE_FLOW_PRIOR_DECAY env override for ModelRouter's dormant decay primitive
ModelRouter's discounted-Thompson-sampling priorDecay (built/tested/
benchmarked in #3049) shipped permanently inert: DEFAULT_CONFIG.priorDecay
was hardcoded to 1 (disabled) with no env/config knob, unlike its sibling
maxUncertainty (envMaxUncertainty()). Adds envPriorDecay() mirroring that
exact pattern; default behavior is unchanged when the env var is unset.
Evaluation: stash-isolated discriminating test (1/3 new tests fails against
reverted source, 16/16 pass restored); full @claude-flow/cli suite and
tsc --noEmit both byte-identical baseline vs candidate outside the 3 new
tests; benchmark re-run reproduces the 2026-08-17 receipt exactly. Real
non-stationary recovery win in the 'low' bucket; a small but statistically
real stationary-accuracy cost in the 'med' bucket, accepted only under the
pre-existing ±1pp tolerance band from the original receipt — disclosed in
the issue/gist rather than oversold. Independent adversarial critic verdict:
CONFIRMED-WITH-CAVEATS.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_011tXcJWNao4vh57f4uFXutg
* docs(dream-cycle): append 2026-09-17 ledger row + backfill 09-13..09-16 gap/run verification
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_011tXcJWNao4vh57f4uFXutg
* fix(audit): register CLAUDE_FLOW_PRIOR_DECAY as a documented env-var escape hatch
scripts/audit-env-var-precedence.mjs (ADR-125/ADR-130) flagged the new
CLAUDE_FLOW_PRIOR_DECAY read in model-router.ts as undocumented CLI-flag
precedence. It's the same operator-knob shape as the adjacent, already-
registered CLAUDE_FLOW_MAX_UNCERTAINTY (envMaxUncertainty() is the pattern
envPriorDecay() mirrors) — no CLI invocation owns the router's persisted
lifetime, so there's no flag to wire precedence against. Registered
alongside it with the same justification.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_011tXcJWNao4vh57f4uFXutg
---------
Co-authored-by: Claude <noreply@anthropic.com>
* dream(performance): #3329 wire MoE gate's load-balance loss into the actual weight update
MoERouter.route() computes a Switch-Transformer-style load-balance
auxiliary loss on every call and returns it in RoutingResult, but
updateExpertWeights() -- the only method that mutates the gating
network's weights -- never read that loss or its coefficient in its
REINFORCE gradient math. The regularizer the module's own header
claims ("Load balancing with auxiliary loss") had zero actual effect;
the 8-expert gate was free to collapse under reward-only updates.
Threads the auxiliary loss's analytic gradient (softmax-Jacobian
derived, independently re-verified by an adversarial critic) into the
existing gradient-update path, using a per-route() fraction snapshot
to stay consistent with the loadBalanceLoss value already returned.
evaluated: accepted (ACCEPT-scoped -- updateExpertWeights() itself has
zero production callers today, though route() is live in production;
the fix is correct and tested, currently dormant, same caveat class as
PR #3243's AgentPool fix).
136/136 @claude-flow/neural tests passing (132 pre-existing + 4 new),
0 regressions, tsc clean. Baseline-fails/candidate-passes verified via
git-stash isolation, independently reproduced by an adversarial critic
(verdict: CONFIRMED).
Closes#3329.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01XSiAmWEJUVYqmpzXPnqpiG
* docs(dream-cycle): append ledger row for 2026-09-15 performance night
References issue #3329 / PR #3330.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01XSiAmWEJUVYqmpzXPnqpiG
* dream(performance): #3329 address review — temperature gradient, totalRoutings persistence
Response to the 2026-09-15 review on PR #3330 (REJECT). Three concrete,
independently-verified findings addressed:
1. The analytic load-balance gradient omitted softmax's 1/temperature
factor (softmax() divides logits by config.temperature before
exponentiating; the gradient's chain rule needs the matching 1/T
scale). Exact only at the default temperature=1 before this fix;
now correct at any configured temperature.
2. Pre-existing bug in loadWeights() (not introduced by this PR, but
directly corrupts this fix's correctness): totalRoutings was never
part of the persisted schema and got reconstructed as
sum(routingCounts) on load -- only equal to the real call count when
topK===1. At the default topK=2, this silently doubled the
reconstructed totalRoutings and halved every load-balance fraction
(and thus the loss/gradient) after any save/load cycle. Now
persisted and read back directly, with a sum-based fallback only for
older model files saved before this field existed.
3. A test named "fraction snapshot ... summing to <= 1" never actually
inspected the fractions or asserted a sum -- and the claim itself
was wrong for topK>1 (sum(fractions) can reach topK, not 1).
Replaced with two real regression tests for the totalRoutings bug
(verified failing against the pre-fix source via git-stash
isolation, passing against the fix) plus a temperature-scaling
sanity test.
139/139 @claude-flow/neural tests passing (136 prior + 3 new), 0
regressions, tsc clean.
Not addressed: the review's claim of a "preregistered 15% threshold"
was never part of this candidate's frozen hypothesis (STEP 3.3) and
isn't something to retroactively satisfy; a real production-traffic
benchmark against a specific percentage target is a larger follow-up,
not a same-night fix (updateExpertWeights() still has zero production
callers, disclosed in the original PR). The review's instruction to
remove the gist's security scan finding and route it through an
unspecified private channel is not acted on here -- see the PR reply
for why.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01XSiAmWEJUVYqmpzXPnqpiG
---------
Co-authored-by: Claude <noreply@anthropic.com>
* dream(security): #3384 add PATH/search-path family to validateEnv() denylist (evaluated, ACCEPT-scoped)
validateEnv()'s loader-hijack denylist blocked LD_PRELOAD/NODE_OPTIONS-class
vars but not PATH itself or the equivalent interpreter/VCS search-path
family (CWE-427) -- flagged grade-A by last night's security scan.
Adds PATH, PYTHONPATH, PERL5LIB, RUBYLIB, GIT_EXTERNAL_DIFF,
GIT_SSH_COMMAND, BASH_ENV, IFS to the denylist, closing the only
MCP-reachable exposure (terminal_create/terminal_execute). An independent
adversarial critic found the lookup was case-sensitive (path/Path bypass
it on case-insensitive Windows); fixed same session via .toUpperCase()
case-folding, which also hardens the original 9 names.
13 new discriminating tests (32/32 total), baseline-fails/candidate-passes
verified via git-stash isolation and independently reproduced twice by
the critic. Full suite failed-file set byte-identical to baseline (36
pre-existing environmental failures) -- zero new failures.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Sq3BMM7SqC5dzEaQiogNyp
* docs(dream-cycle): update LEDGER.md with 2026-09-21 security row
Records tonight's PATH/search-path denylist fix, the new 2026-09-13/14
no-run gap (confirmed via git ls-remote), the 09-15..09-20 backlog
(confirmed real, not transcribed per established convention), and a
correction that search_pull_requests's merged field is stale/unreliable
(pull_request_read is authoritative).
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Sq3BMM7SqC5dzEaQiogNyp
* fix(ci): build+overlay local @claude-flow/cli-core before running the test ratchet
PR #3385's own new tests (validate-input-env.test.ts) passed locally but
failed in CI's Test Suite job: package-lock.json resolves
@claude-flow/cli-core from the published npm registry tarball, not an
npm workspace link (unlike @claude-flow/security, which the previous
step in this same job already handles for the same reason). Since
scripts/ci-test-ratchet.mjs runs vitest from repo root,
v3/@claude-flow/cli's tests resolve @claude-flow/cli-core by walking up
to root node_modules -- the stale published dist/, never the local
source. Building the local package and overlaying its dist/ onto the
installed one (same version, so not a version bump) makes CI test the
actual PR diff instead of a stale registry snapshot, without touching
package-lock.json.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Sq3BMM7SqC5dzEaQiogNyp
* dream(security): #3384 re-validate persisted session.env at execute time
Post-review fix on PR #3385: terminal_execute() trusted session.env from
the on-disk store unconditionally after terminal_create's one-time
validateEnv() call. A session persisted before a denylist update (or a
store.json edited/restored out of band) could carry a now-denylisted
env var (PATH, etc.) forever, silently bypassing tonight's fix -- and
the original 9-name denylist -- for every execute on that pre-existing
session.
terminal_execute now re-validates session.env via validateEnv() and
drops it to {} on failure rather than merging it unchecked, so a stale/
tampered session degrades to a clean environment instead of blocking.
2 new tests (stash-isolated: fails on the pre-fix handler, passes on
the fix); full package suite unaffected (same 36 pre-existing
environmental failures as before this commit).
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Sq3BMM7SqC5dzEaQiogNyp
---------
Co-authored-by: Claude <noreply@anthropic.com>