7635 Commits
Author SHA1 Message Date
rUv a5adb5aadc fix(browser): keep tool-supplied text out of the Windows shell; release 3.46.1 (#3451)
ADR-401. Resolves the npm shims to the process behind them and spawns with an argv array; no shell option remains in the browser tools. Patch release 3.46.1.

Co-Authored-By: RuFlo <ruv@ruv.net>
v3.46.1
2026-09-26 18:24:02 -05:00
rUv 4f66bd930f chore(release): @claude-flow/swarm 3.0.0-alpha.9 (#3452)
Ships the swarm fixes merged since alpha.8 (#3357 hierarchical leader
edges, #3378 event-driven UnifiedSwarmCoordinator wait, #3123, #3086,
#3243, #3062). The CLI does not depend on @claude-flow/swarm, so they
reach users only through this standalone publish.

Publishability fixes found while preparing the tarball:
- coordination/{agent-registry,task-orchestrator,swarm-hub}.ts used
  extensionless relative imports, so a plain `tsc` build of main
  throws ERR_MODULE_NOT_FOUND on `import('@claude-flow/swarm')`.
  Add the `.js` suffixes (the package is "type": "module").
- Restore the ADR-095 G2.2 transport re-exports on the root entry.
  alpha.8 was published from main@f8ab5a325 plus uncommitted work
  (later dacbe0ec5, never merged) that exported LocalTransport,
  FederationTransport, signMessage, etc. from the root. Without this,
  alpha.9 would silently drop 9 runtime exports alpha.8 users have.
- Add a `files` allowlist (dist, README.md, MIGRATION.md). alpha.8
  shipped src/, __tests__/, tmp.json, tsconfig.tsbuildinfo, a 1.5 MB
  ruvector.db and .claude-flow/ runtime state from a contributor's
  machine.
- Record the repo version as alpha.9 (repo was stuck at alpha.7 while
  npm had alpha.8).
2026-09-26 18:22:58 -05:00
ruv 455ce575f5 fix(witness): re-anchor package.json markers for 3.46.1 and re-sign manifests
Regenerated on a clean, fully built tree: 117/117 entries verify on each OS.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-26 18:49:31 -04:00
ruv d6542a9b7a chore(release): re-sign helpers manifest @ 3.46.1
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-26 18:48:58 -04:00
ruv 32c4570e36 chore(release): 3.46.1
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-26 18:48:57 -04:00
ruv 6adbb393e8 fix(browser): never pass tool-supplied text through a Windows shell (ADR-401)
The npx fallback in execBrowserCommand set shell: process.platform === 'win32'
so cmd.exe could resolve npx.cmd. Its safety comment assumed hard-coded
arguments, but fill values, eval scripts and selectors now flow through it, so
on Windows hosts without a global agent-browser those values were shell syntax.

Resolve the npm shims to the process behind them (native .exe or node <entry>,
and node <npm>/bin/npx-cli.js for the fallback) and spawn with an argv array.
.cmd and .bat targets are refused, bin paths that escape the package are
rejected, and an unresolvable launcher reports the install hint instead of
falling back to a shell. POSIX behaviour is unchanged.

Tests fail on the previous implementation; a static guard fails if a shell
option is reintroduced.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-26 18:48:20 -04:00
rUv 39ea61fda9 release: 3.46.0 integration train (#3443)
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>
v3.46.0
2026-09-26 17:31:19 -05:00
ruv 3b00a3398d fix(witness): re-anchor package.json markers for the 3.46.0 pins and re-sign manifests
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>
2026-09-26 11:41:29 -04:00
ruv f9c49c9630 chore(release): re-sign helpers manifest @ 3.46.0
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-26 11:41:08 -04:00
ruv fe022cce27 chore(release): 3.46.0
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>
2026-09-26 11:40:47 -04:00
ruv 582d7d9318 chore(release): bump unbundled leaves memory alpha.26, neural alpha.10, cli-core alpha.6
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>
2026-09-26 11:37:06 -04:00
ruv 8490824027 fix(cli): alias @claude-flow/security/safe-git ahead of the bare-package vitest alias
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>
2026-09-26 11:33:48 -04:00
ruv 9f3ac3b801 Merge branch 'pr-3412' into integ/train-3.45.1 2026-09-26 11:32:48 -04:00
ruv 39df331e73 Merge branch 'pr-3316' into integ/train-3.45.1 2026-09-26 11:32:48 -04:00
ruv 012daa5fed Merge branch 'pr-3389' into integ/train-3.45.1 2026-09-26 11:32:48 -04:00
ruv f13a853749 Merge branch 'pr-3378' into integ/train-3.45.1
# Conflicts:
#	docs/dream-cycle/LEDGER.md
2026-09-26 11:32:48 -04:00
ruv 2296215a95 Merge branch 'pr-3382' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 43901973b6 Merge branch 'pr-3343' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 4a6e063de7 Merge branch 'pr-3391' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 71ff566155 Merge branch 'pr-3386' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 72a39572f2 Merge branch 'pr-3383' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 851e6f5adf Merge branch 'pr-3379' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 2f192d4eb9 Merge branch 'pr-3367' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 3c6bf66a93 Merge branch 'pr-3365' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 0f9190894e Merge branch 'pr-3363' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 5706bbcb26 Merge branch 'pr-3361' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 780df63aad Merge branch 'pr-3347' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv d40bc64a5e Merge branch 'pr-3441' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 454d0dde46 Merge branch 'pr-3439' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 92fb3b0269 Merge branch 'pr-3436' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 856249ed7e Merge branch 'pr-3434' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 067d34d76b Merge branch 'pr-3431' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 268463bc73 Merge branch 'pr-3430' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 7a8859997a Merge branch 'pr-3429' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv ccec80e4b6 Merge branch 'pr-3427' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv cec21efafa Merge branch 'pr-3426' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 227af0b969 Merge branch 'pr-3424' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 9be73667da Merge branch 'pr-3423' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv aaac934506 Merge branch 'pr-3422' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv e45eeead28 Merge branch 'pr-3421' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
ruv 9698f68d2d Merge branch 'pr-3420' into integ/train-3.45.1 2026-09-26 11:32:47 -04:00
Rudy Celekli 7f6fd2d76a fix(memory): preserve distinct namespace and key tuples in upserts 2026-09-26 11:32:37 -04:00
rUvandClaude a91db6768b dream(intelligence, evaluated): #3394 fix inverted EMA direction in EWCConsolidator.updateFisherFromConfidences() (ACCEPT) (#3395)
* 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>
2026-09-26 10:09:09 -05:00
rUvandClaude 4760c21345 dream(swarm): #3356 mirror leader edges for hierarchical/centralized/hybrid topologies (evaluated, ACCEPT-scoped) (#3357)
* 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>
2026-09-26 10:08:44 -05:00
rUvandClaude 34e4bb400a dream(memory): #3351 fix AgentDBAdapter.store() same-key upsert orphaning (evaluated, ACCEPT-scoped) (#3352)
* 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>
2026-09-26 10:08:29 -05:00
rUvandClaude 4c2c62df27 dream(intelligence, evaluated): wire CLAUDE_FLOW_PRIOR_DECAY env override for ModelRouter's dormant decay primitive (#3349) (#3350)
* 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>
2026-09-26 10:08:14 -05:00
rUvandClaude 47c5dd408a dream(performance): #3329 wire MoE gate's load-balance loss into the actual weight update (evaluated, ACCEPT-scoped) (#3330)
* 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>
2026-09-26 10:07:59 -05:00
rUvandClaude 1e7a33a768 dream(security): #3384 add PATH/search-path family to validateEnv() denylist (evaluated, ACCEPT-scoped) (#3385)
* 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>
2026-09-26 10:07:43 -05:00
Rudy Celekli 51cab2cba5 fix(doctor): report agent-browser runtime compatibility 2026-09-25 17:32:52 -04:00
Rudy Celekli 11e04bfc52 fix(learning): report SONA trajectory scope and live count honestly 2026-09-25 17:26:59 -04:00