1992 Commits
Author SHA1 Message Date
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 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 2296215a95 Merge branch 'pr-3382' 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 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 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
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 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 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
Rudy Celekli 4c226bd19e fix(memory): preserve complete Claude memory sections 2026-09-25 17:20:52 -04:00
Rudy Celekli 38f68f78fa fix(init): honor Codex and skills.sh opt-out flags 2026-09-25 17:16:27 -04:00
Rudy Celekli 991caf68fb fix(daemon): load YAML config from ESM runtime 2026-09-25 14:26:00 -04:00
Rudy Celekli 6096bcaebf fix(doctor): check native AgentDB store integrity 2026-09-25 14:18:50 -04:00
Rudy Celekli a09464ce46 fix(browser): surface structured CLI errors on nonzero exit 2026-09-25 14:16:52 -04:00
Rudy Celekli 5ad9ceab0c fix(agents): honor configured instructions during execution 2026-09-25 14:14:39 -04:00
Rudy Celekli 72d2c10c78 fix(graph): report k-hop relation and depth limitations 2026-09-25 14:10:55 -04:00
Rudy Celekli 9ba1cfda75 fix(mcp): prevent late HTTP timeout responses 2026-09-25 14:09:58 -04:00
Rudy Celekli ea4661f815 fix(mcp): enforce opt-in policy in shipped stdio launchers 2026-09-25 14:01:48 -04:00
Rudy Celekli c273b8fc19 fix(workflows): interpolate default step output references 2026-09-25 13:59:54 -04:00
Rudy Celekli 6fc7e9b6bf fix(daemon): bound idle clock to current process start 2026-09-25 13:59:46 -04:00
rUv 88955d9fa9 Merge pull request #3414 from ruvnet/fix/pin-memory-3392
fix(cli): pin @claude-flow/memory exactly and warn in doctor on a stale copy (#3392)
2026-09-24 23:24:06 +00:00
ruv aab1d6258c chore(release): re-sign helpers manifest @ 3.45.0
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-24 18:47:56 -04:00
ruv d921b207e4 chore(release): 3.45.0
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-24 18:22:22 -04:00
ruv a35901de80 fix(cli): make the memory version verdict a warning and the test layout-independent (#3392)
CI's root `npm ci` hoists @claude-flow/memory alpha.21 (a transitive of the
bundled workspace packages), so the loaded copy legitimately differs from the
pin there. A `fail` would make doctor's exit code depend on which copy a
package manager happened to hoist, and it broke the real-resolution test. The
issue asked for a loud warning, not a gate, so the verdict is now `warn`, and
the real-resolution test asserts only the verdict's shape; the version
comparison itself is covered by the pure-function tests.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-24 18:22:06 -04:00
ruv 6ff6fded33 fix(cli): pin @claude-flow/memory exactly and warn in doctor on a stale copy (#3392)
`npx @claude-flow/cli@latest` reuses one npx cache directory across CLI
versions, and npm keeps an already-installed dependency that still satisfies
its range. With memory declared as `^3.0.0-alpha.23`, a cached alpha.24 was
never replaced by alpha.25, so a fix that shipped in both packages (#3390)
only half-applied, with no error and `agentdb_health` still reporting healthy.

- Pin `@claude-flow/memory` to `3.0.0-alpha.25` in both `dependencies` and
  `optionalDependencies` (npm resolves the optional entry; they must agree).
  A stale copy can no longer satisfy the spec, so npm has to replace it.
- `doctor` gains a `@claude-flow/memory version` check that compares the copy
  the CLI actually loads (its own module context, not cwd) against its declared
  range and fails with a cache-clear remediation when they diverge. It runs in
  the default suite, `--component memory` and `--component memory-package`.
- v3/pnpm-lock.yaml: minimal hand edit (importer specifier/version plus one
  new registry snapshot); proven with `pnpm@8 install --frozen-lockfile`
  passing on the new lock and failing on the old one.

Verified by reproduction: with memory alpha.24 already installed, adding the
registry cli@3.44.0 (caret) leaves alpha.24; adding a tarball of this branch
upgrades it to alpha.25.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-24 18:07:54 -04:00
ruv c815ccdeed test(cli): isolate HOME and stub codex in init-kebab-flags-2952 (#3370)
The test spawned the real `init` with only cwd isolated, so a local run
appended the Ruflo block to the developer's ~/.claude/CLAUDE.md, registered
[mcp_servers.ruflo] in ~/.codex/config.toml, and started a
`codex plugin marketplace add` clone that outlived init's 20 s timeout as an
orphan.

Each spawn now gets a throwaway HOME/USERPROFILE/CODEX_HOME and a fail-fast
`codex` stub first on PATH, which init treats as a non-fatal skip.

Verified with a decoy home: before, both files' checksums change; after, both
are byte-identical and no clone process is left behind.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-24 18:04:19 -04:00
ruv 0a96fb8857 chore(release): 3.44.0
Minor: new opt-in router embedder (CLAUDE_FLOW_ROUTER_EMBEDDER=minilm),
router.js becomes a signed critical helper.

- ADR-389: router.js refreshed on upgrade (installs get the #3401 word-boundary fix)
- ADR-390: opt-in MiniLM embedder for hooks_route; default stays hash
- ADR-391: blind 197-prompt corpus + benchmark; first run promotes nothing
- typesafe-router test (e) fixed (was red on main since #3402)

Helpers manifest re-signed @ 3.44.0 — now 5 helpers (router.js added).
No non-bundled leaf changed.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-23 14:40:54 -04:00
rUv 82dac70fd7 feat(router): ADR-389–391 — refresh router helper, opt-in MiniLM embedder, benchmark gate (no default change) (#3410)
* docs(adr): ADR-389..391 — router: refresh the helper, use the real embedder, change defaults only on a measured win

ADR-389: add router.js to CRITICAL_HELPERS + re-sign, so installed copies get
the word-boundary fix (#3401); today they are frozen at first write.
ADR-390: hooks_route embeds patterns and tasks with the local MiniLM chain
(generateLocalEmbedding), hash embedder as the reported fallback.
ADR-391: frozen, labelled 150-200 prompt corpus; A/B/C/D (current, MiniLM,
typesafe-hash, typesafe-onnx); ADR-150-style AND-gate for promotion.

Co-Authored-By: RuFlo <ruv@ruv.net>

* feat(init): refresh router.js as a critical helper on upgrade (ADR-389, #3401)

Installed copies of .claude/helpers/router.js never received the #2257
word-boundary fix: helper-refresh only re-copies CRITICAL_HELPERS and
router.js was not on the list, so an April substring router kept routing
"sync and review latest issues" to tester.

- helper-refresh.ts: add router.js to CRITICAL_HELPERS; generator
  fallback also emits it (generateAgentRouter).
- sign-helpers.mjs / verify-helpers.mjs / executor.ts executeUpgrade /
  smoke-helper-signing-security.mjs: keep their copies of the list in sync.
- New test: stale April router.js is replaced by the package copy via the
  signed refresh path (throwaway key), after which the prompt no longer
  routes to tester.

helpers.manifest.json is NOT re-signed here. Until it is, verify-helpers
fails ("manifest has no entry for router.js") and the production refresh
is fail-closed blocked for all helpers.

Co-Authored-By: RuFlo <ruv@ruv.net>

* bench(router): ADR-391 labelled evaluation corpus (197 prompts, frozen)

Blind-labelled corpus for comparing routing candidates: 11 labels incl. none,
64 adversarial trap cases, deterministic stratified dev/test split (i%5 in
{0,2} -> dev), dependency-free validator that recomputes the split and prints
the sha256. Frozen at sha256 b0c1923b2813b61907304dff56c53d199b709797bfb9600a7c1f496cf0c0bf04.

Co-Authored-By: RuFlo <ruv@ruv.net>

* feat(hooks): ADR-390 — semantic router can use the real MiniLM embedder

hooks_route compared tasks with pattern keywords using a character hash
(generateSimpleEmbedding), which measures spelling, not meaning. This adds a
router-embedder abstraction (src/ruvector/router-embedder.ts):

- embedForRouter(texts, kind) -> { vectors, embedder: 'minilm'|'hash', reason? }
- MiniLM path uses generateLocalEmbedding ONLY (never the bridge-first
  generateEmbedding, #2312). backend !== 'onnx', a throw, or a non-384-d
  vector degrades EVERY text in the call to the hash, with a reason.
- Selection: CLAUDE_FLOW_ROUTER_EMBEDDER=minilm|hash; DEFAULT_ROUTER_EMBEDDER
  stays 'hash' until ADR-391's benchmark decides.

getSemanticRouter builds both the native VectorDb and pure-JS indexes from one
embedder, records which one actually built the index, embeds the query with
that same embedder, rebuilds when the requested embedder changes, and shares
one in-flight build between concurrent callers. If the query fails on MiniLM
after a MiniLM index was built, the index is rebuilt with the hash so the two
spaces never mix. hooks_route results gain `embedder` (+ `embedderReason` when
degraded); existing fields are unchanged.

routeTaskForBench(task, { embedder }) is an internal, bench-only entry that
runs the same local path as hooks_route (skipping the AgentDB pre-route and
the opt-in typesafe wrapper) for ADR-391.

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(audit): register CLAUDE_FLOW_ROUTER_EMBEDDER as a known env escape hatch

ADR-390's router embedder selector is process-lifetime MCP router state, like
CLAUDE_FLOW_DISABLE_NATIVE_ROUTER; the ADR-391 bench passes the embedder
explicitly rather than through a CLI flag.

Co-Authored-By: RuFlo <ruv@ruv.net>

* bench(router): ADR-391 first run — no candidate promoted; fix typesafe-router test (e)

Benchmark (run-bench.mjs) on the frozen 197-prompt corpus
(sha256 b0c1923b…), test split n=113:
  A current (hash)   25.7% acc, p95 1.06 ms
  B MiniLM (ADR-390) 36.3% acc, p95 6.21 ms   (+10.6 pts, +485% p95)
  C typesafe hash    26.5% acc, p95 1.20 ms
  D typesafe onnx    29.2% acc, p95 8.35 ms   (raw pick 44.3%, gated to 5.6%)
No candidate passes the ADR-391 AND-gate (B fails the relative latency
bound), so DEFAULT_ROUTER_EMBEDDER stays 'hash' and typesafe stays opt-in.
Receipt committed under benchmarks/router/results/. ADR-391 gains a Results
section with the findings (structural ceiling: no pattern returns
researcher/reviewer/none; latency criterion mis-specified for a ~1 ms base;
typesafe gate too tight) as owner decisions, not applied.

ADR-389 -> Implemented; ADR-390 -> Implemented as opt-in; ADR-391 -> Implemented.

typesafe-router test (e) was red on main since #3402 made the keyword
fallback word-bounded: it still asserted the old "latest"->tester fallback.
It now asserts the typesafe override and that a legacy fallback is kept.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-23 18:39:18 +00:00
ruv 025842bb0f chore(release): 3.43.0
Minor: new opt-in @ruvector/typesafe task router (CLAUDE_FLOW_ROUTER_TYPESAFE=1)
and `doctor --component typesafe`. Ships:

- #3399 @ruvector/router floor ^0.1.31 (HNSW recall@10 0.071 -> 1.000)
- #3406 opt-in typesafe router, removable, falls back to the existing router
- #3402 keyword routers match on word boundaries (#3401)
- #3403 hooks post-task reports observed learning counts (#3353)
- #3400 memory tools reject missing required query/key (#3374)
- #3407 embedder rescue reachable + no silent NULL embeddings (#3375, #3325)
- #3404 writeJsonAtomic retries transient Windows rename errors (#3398)
- #3405 graph-edge-writer releases its native WAL handle (#3397)
- capability brain classifies seraphina_/x_federation_ tools (release gate)

All changes are @claude-flow/cli source or the umbrella's own dependency
range; no non-bundled leaf (cli-core/neural/shared/memory) changed, so no
standalone publish is needed. Helpers manifest re-signed @ 3.43.0 (ADR-174).

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-23 11:00:55 -04:00
ruv c73d127cfe fix(guidance): classify seraphina_* and x_federation_* tools in the capability brain
The stable-release gate `guidance-brain.test.ts › classifies every live
registered MCP tool without duplicates` has been failing on main since the
x.ruv.io federation and Seraphina tools landed: 15 tools
(seraphina_guidance + 14 x_federation_*) only reached a domain through the
runtime-services fallback, which the gate treats as a coverage gap.

- seraphina_ -> guidance domain (it is capability guidance), owner @claude-flow/cli / ruflo-core
- x_federation_ -> AgentBBS & federation domain alongside federation_bbs_, owner @claude-flow/cli / ruflo-x-gateway

guidance-brain + mcp-client-guardrail: 12/12; x-federation + seraphina tool tests 25/25; tsc clean.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-23 11:00:22 -04:00
rUv 7d801171d5 feat(hooks): opt-in @ruvector/typesafe task router (CLAUDE_FLOW_ROUTER_TYPESAFE=1) (#3406)
* feat(hooks): opt-in @ruvector/typesafe task router (CLAUDE_FLOW_ROUTER_TYPESAFE=1)

hooks_route can now ask @ruvector/typesafe (local typed decisions over
sentence embeddings) to pick the agent. Off by default; optional peer;
removable (dynamic import, any load/decide error falls back silently).

- src/ruvector/typesafe-router.ts: adapter. Builds choice options from
  TASK_PATTERNS with not_for hints (tester/reviewer/researcher). Gates:
  abstain <= 0.30, lift (top-1 x options) >= 1.2, top-1 margin >= 0.005,
  all env-tunable. Surfaces routedBy, confidence, abstain, calibrated,
  lift; keeps the built-in pick under fallbackRoute; never copies
  uncalibrated confidence into successProbability.
- hooks-tools.ts: hooks_route handler wrapped; body untouched. With the
  flag unset the legacy result object is returned as-is.
- doctor --component typesafe: install + gate status.
- package.json: @ruvector/typesafe ^0.1.0 as an optional peer.
- USERGUIDE: routing section documents flag, gates, limitations.

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(lock): record optional peer @ruvector/typesafe in v3 pnpm lockfile

v3 sets autoInstallPeers, so the new optional peer must be recorded in
the cli importer or `pnpm install --frozen-lockfile` fails with
ERR_PNPM_OUTDATED_LOCKFILE (verified: fails without this change, passes
with it).

Minimal: only the @ruvector/typesafe importer + package entries (9 lines).
A full `pnpm install --lockfile-only` would also flip @claude-flow/memory
from the registry build to link:../memory; that changes what CI tests the
CLI against and is left out of this PR deliberately.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(doctor): keep 'metaharness)' at the end of the --component help list (smoke 17h anchor)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-23 14:57:45 +00:00
rUv 72e17533ca fix(memory): release graph-edge-writer's native WAL handle so sql.js memory_store isn't refused (#3397) (#3405)
* fix(memory): release graph-edge-writer's native WAL handle so sql.js memory_store isn't refused (#3397)

graph-edge-writer cached its better-sqlite3 WAL handle in a module
singleton for the whole MCP server lifetime; nothing but the test-only
_resetBridgeDb ever closed it. Its -wal/-shm sidecars therefore stayed on
disk forever, and the #2735 sidecar guard (correctly) refused every later
sql.js whole-image write. On Windows, where the native AgentDB bridge is
off by default (#3024), that turned one hooks_post-task into a permanent
memory_store outage for the server.

- getBridgeDb() arms an unref'd idle timer (1s, CLAUDE_FLOW_GRAPH_EDGE_IDLE_MS)
  that checkpoints (TRUNCATE) and closes the handle; re-armed on every use.
- New releaseBridgeDb(dbPath?) is called by memory-initializer right before
  each #2735 guard, so a store immediately after an edge write works and the
  edge is checkpointed into the image sql.js rewrites.
- process 'exit' hook releases the handle so a clean shutdown does not leave
  stale sidecars for the next process. No signal handlers (would change
  Node's default termination).
- The guard itself is unchanged: an open WAL connection makes a whole-image
  write unsafe even in-process until its WAL is checkpointed.

Fixes #3397

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(audit): register CLAUDE_FLOW_GRAPH_EDGE_IDLE_MS as an env-only tuning knob (ADR-125)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-23 14:57:35 +00:00