mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
ffd66d59fc8a39d56ff5efdbdfd06f6653132d2f
225
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a46e49cbc5 |
test(memory): apply each agentdb mock change before queueing the next
vitest applies queued doMock/doUnmock entries for one path in resolve order, so an afterEach doUnmock could win over the next test's doMock and the stale-lock retry test saw the real agentdb (CI: 0 fake instances). |
||
|
|
c536e77fda |
fix(memory): reroute the stale-lock retry AgentDB too; memory 3.0.4
Rebased onto main, where ControllerRegistry and AgentDBBackend build AgentDB inside withAgentdbLockRecovery(); useHostSqliteDriver() now runs inside that closure right after each `new AgentDB`, so the instance a stale-lock retry creates also opens its handle with getHostSqliteDriver(). Tests drive the retry path for both sites. @claude-flow/memory 3.0.3 was published by 3.56.3 without the driver, so this ships as 3.0.4 and the CLI pins 3.0.4. The #3693 memory-owner test now reports a skip when no native addon is available instead of passing. |
||
|
|
d4458abdff |
fix(memory,cli): keep the CLI's better-sqlite3 handles on AgentDB's copy
Follow-up to the AgentDB driver change. shared-sqlite.ts (#3693/#3883) resolved better-sqlite3 from agentdb's location so CLI handles share AgentDB's native copy. With AgentDB now opened through @claude-flow/memory's better-sqlite3, that put graph-edge-writer, the memory-initializer repair paths, backup restore, distillation, tuning and the attestation log back on agentdb's nested 11.x: `hooks post-task` still loaded both addons (and aborted on Node 24), and mixing copies on one file can delete the -wal/-shm sidecars under AgentDB's live handle. - @claude-flow/memory exports getHostSqliteDriver(), the one source of the constructor; useHostSqliteDriver() opens AgentDB with it and reports whether it replaced the loader. - shared-sqlite resolves better-sqlite3 from @claude-flow/memory when the installed memory carries agentdb-native-driver.js, else from agentdb as before, so either memory version keeps one copy per process. - @claude-flow/memory 3.0.3, CLI pin 3.0.3 (leaf-publish gate). Tests: identity between AgentDB's handle constructor and loadBetterSqlite3(); #3693 owner model for the memory holder and the pre-3.0.3 fallback; both AgentDB construction sites; routing against a real nested copy; a drift guard on agentdb's initializeDatabase contract. |
||
|
|
b1645c6f47 |
fix(memory): open AgentDB with our better-sqlite3 so Node 24 does not abort
On Node 24.19+, `memory search`, `memory_store` and the AgentDB MCP tools abort intermittently with `Assertion failed: (env) != nullptr` in node::RemoveEnvironmentCleanupHook, from Statement::~Statement() in agentdb/node_modules/better-sqlite3 (exit 134 / "Connection closed"). agentdb 3.0.0-alpha.x pins better-sqlite3 ^11.8.1. 11.x has no Node 24 prebuild, so npm compiles it against the local Node headers, and 24.19+ headers carry a partial ObjectWrap cleanup-hook backport (nodejs/node#65446) that aborts when a Statement is collected outside an Environment. Our own better-sqlite3 12.x ships a Node 24 prebuild built before that header change. The `better-sqlite3` override in the published package.json files does not reach agentdb: npm ignores overrides in a dependency, and `npm i -g ruflo` still installs the nested 11.10.0. ControllerRegistry and AgentDBBackend now replace the AgentDB instance's initializeDatabase() so its handle is opened with this package's better-sqlite3; AgentDB's own loader stays as the fallback and forceWasm is untouched. |
||
|
|
dffb5171e0 |
chore(release): 3.56.3 versions and changelog (memory 3.0.3, AgentDB alpha.20)
Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
dd8fd3cda8 |
fix(memory): settle hybrid shutdown, real-path sql.js lock test for AgentDBBackend
Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
01fa240e7c |
wip(memory): agentdb alpha.20 floor + sql.js lock/concurrency guard
Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
ec00eed619 |
chore(release): bump leaf packages for 3.56.0 (memory 3.0.2, security 3.0.3)
Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
74b8e7bf1c | Merge branch 'pr-3687' into feat/release-3.56.0-batch | ||
|
|
20f91b0e8b | Merge branch 'pr-3679' into feat/release-3.56.0-batch | ||
|
|
681f0b488b |
fix(memory): preserve frozen non-stateful invalidation patterns
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> |
||
|
|
f6ad57ba8a |
chore(release): bump leaf packages for 3.55.0 (memory 3.0.1, swarm 3.0.1, security 3.0.2, mcp 3.1.0, plugin-agent-federation 1.0.1)
Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
948239cfb1 | Merge remote-tracking branch 'origin/main' into dream/2026-09-28-memory | ||
|
|
097974836a |
fix(release): defer unpublished dependency pins for maintainer coordination
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> |
||
|
|
d67d441072 |
fix(release): defer unpublished dependency pins for maintainer coordination
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> |
||
|
|
28d94e02d1 |
fix(release): align memory patch version and exact CLI dependency
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> |
||
|
|
2d97412c0f |
fix(release): align memory patch version and exact CLI dependency
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> |
||
|
|
e0fb4ebd74 |
fix(memory): match each cache key independently during invalidation
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> |
||
|
|
e36ec17c78 |
fix(memory): account for replacement sizes before cache admission
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> |
||
|
|
7307d1d86a |
chore(release): move 18 internal leaf packages from alpha to stable semver
Every @claude-flow/* leaf still on X.Y.Z-alpha.N moves to its stable X.Y.Z (3.0.0, cli-core 3.7.0, the two plugins 1.0.0), matching the public train's move to stable at 3.7.0. @claude-flow/embeddings is deliberately excluded: its registry `latest` (3.0.0-alpha.45) was built from a branch not on main, and publishing from main would drop 139 exported names. Validated before publish: - API surface: each package's main build compared against its published `latest` tarball (files, exports/bin keys, exported names). All 18 are equal-or-superset; no export removed. - Every package builds; ~7.8k tests across 17 suites pass (cli-core has no suite of its own and is exercised through the CLI's). Packaging fixes made along the way: - publishConfig.tag v3alpha/alpha removed so stable versions land on `latest` rather than only the legacy channel tag. - `files` allowlists (dist + README) on the 7 packages that had none. Their published tarballs shipped local runtime state: .claude-flow daemon logs and pids, settings.json, .swarm/memory.db, headless-worker prompt logs. A secret scan of every affected published version found no credentials. mcp shrinks from 335 files to 70, and no longer ships the .claude/ helpers copy that #3411 concerned. - plugins/providers/testing pointed every `types` condition at a nonexistent `.d.js` file; now `.d.ts`, so consumer type resolution works. - Removed three subpath exports whose targets were never built (plugins ./examples/*, performance ./benchmarks/*); they could only throw ERR_MODULE_NOT_FOUND. - Intra-leaf ranges normalised to ^<stable>, including a `file:../security` and a `workspace:*` devDependency that npm publish would ship verbatim. Security: harden attention toSQL against injection (plugins) The 13 attention SQL builders interpolated caller-supplied vectors and config values into SQL that AttentionExecutor executes. TypeScript types do not exist at runtime, so a string element could break out of the quoted vector literal. Every interpolated value is now proven finite-numeric or boolean. A differential run of 195 legitimate inputs across all 13 mechanisms produced byte-identical SQL; the new test fails 11/13 on the original code (which emitted DROP TABLE for 5 payloads) and passes 13/13. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
02bfa26622 |
dream(memory): #3516 cache mmrRerank() cosine max-similarity across rounds
O(candidates x selected^2) -> O(candidates x selected): a running per- candidate max-similarity-to-selected cache replaces the full re-walk of the selected set on every outer MMR loop pass. Byte-identical selection order (max is associative; zero-floor semantics preserved exactly), >2x measured wall-clock at N=200/limit=100, 20/20 MMR tests green, stash-isolated baseline-vs-candidate proof included. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01NQn4ZDMLEVvSwbgKEfVgwg |
||
|
|
44ac70aa39 | fix(memory): align leaf version and CLI dependency pins | ||
|
|
e9f8ba7bac | test(memory): preserve significant index indentation | ||
|
|
5350afae99 | fix(memory): preserve user index content when generated views grow | ||
|
|
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> |
||
|
|
7f6fd2d76a | fix(memory): preserve distinct namespace and key tuples in upserts | ||
|
|
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> |
||
|
|
cf9aebf21e |
chore(release): 3.42.5 + @claude-flow/memory 3.0.0-alpha.25
Ships #3390 (#3327 Finding A). The fix spans two packages and only one of them rides the release train, so memory is bumped and published alongside: - cli/src/memory/memory-bridge.ts -> @claude-flow/cli 3.42.5 (train) - memory/src/controller-registry.ts -> @claude-flow/memory 3.0.0-alpha.25 Without the memory publish the embedder half of the fix never reaches users and reasoningBank stays inert, since @claude-flow/memory is NOT in INTERNAL_RUNTIME_PACKAGES and resolves from the registry via ^3.0.0-alpha.23. CLAUDE.md: correct the Publishing Rules claim that internal @claude-flow/* components are all bundled. Only four are (security, codex, mcp, plugin-agent-federation); cli-core, neural, shared and memory resolve from the registry and need a standalone publish when their source changes. Adds a semver-aware pre-tag drift check that fails loudly if it inspects zero leaves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
11ce88327b |
fix(memory): activate reasoningBank — wire the real embedder + correct the bridge contract (#3327 Finding A) (#3390)
Activates reasoningBank end-to-end (#3327 Finding A). - memory/controller-registry.ts: hand agentdb's ReasoningBank an embedder that satisfies its asymmetric embedQuery/embedPassage contract; adapt agentdb's mock embedder rather than passing it through; flag the zero-vector stub. - cli/memory-bridge.ts: call the real storePattern(), map agentdb's ReasoningPattern shape (approach/similarity) instead of content/score, and record the swallowed error so health can name the cause. Verified: 77/77 controller-registry tests pass; negative control (new tests vs main's source) fails 8/9, confirming the tests are load-bearing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
79529c6cf6 | fix(memory): preserve retrieval relevance in smart search results | ||
|
|
a65bdf683a |
fix(memory): pass a bare mode string to NeuralLearningSystem, not an object (#3336)
learning-bridge.ts's loadNeural() called
`new NeuralLearningSystem({ mode, ewcLambda })`, but the real constructor
signature is `constructor(mode: SONAMode = 'balanced')` — a bare string
(see @claude-flow/neural/src/index.ts and the CLI's own reference-correct
call site in memory/neural-package-bridge.ts). This never threw: SONAManager
resolves `MODE_CONFIGS[mode]`, which for an object argument coerces to the
key "[object Object]", finds nothing, and `{...undefined}` silently produces
an empty config instead of the intended mode's settings — so every
LearningBridge-driven neural session has been running with an unset,
default-less SONA config regardless of `sonaMode`/`RUFLO_INTELLIGENCE_MODE`.
`ewcLambda` was never a real constructor parameter either — each mode
carries its own fixed lambda via MODE_CONFIGS, with no override mechanism —
so it's dropped from the call rather than papered over.
Added a regression test that mocks the real `@claude-flow/neural` import
path (the existing 67 tests all inject a `neuralLoader`, which bypasses this
code path entirely — that's why this went uncaught). Confirmed the new test
fails against the pre-fix constructor call and passes with the fix.
Claude-Session: https://claude.ai/code/session_01SjxUvZnyBdwtx4Y1jKAqt6
|
||
|
|
90889f4772 |
feat(sona): default the learning mode from RUFLO_INTELLIGENCE_MODE (#3334)
* feat(sona): default the learning mode from RUFLO_INTELLIGENCE_MODE The SONA learning mode was only settable per call (`config.mode`), defaulting to `balanced` otherwise. A deployment that wants every session to learn in a specific profile — a managed desktop fleet running `research` for +55% quality, or `edge` on constrained hosts — had no way to set that default short of threading `mode` through every call site or patching a generated helper. This reads `RUFLO_INTELLIGENCE_MODE` as the fleet-wide default in both the SONA config merge (`@claude-flow/integration` sona-adapter) and the memory learning bridge (`@claude-flow/memory`). Precedence is unchanged where a caller is explicit: `config.mode` (or `sonaMode`) still wins; the env only fills the former default slot; and an unset or unrecognised value returns undefined so the code falls through to `balanced` — a typo can never silently select a profile nobody asked for. Validated against the mode enum in each package. Co-Authored-By: claude-flow <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01MUrJdDHhQ91hwpUBQhV4fC * fix(sona): resolve sonaMode per-instance in LearningBridge, not at module load learning-bridge.ts captured sonaModeFromEnv() into a module-scope DEFAULT_CONFIG constant, evaluated once on first import — so any RUFLO_INTELLIGENCE_MODE set later in the same process (including test setup) was permanently missed. sona-adapter.ts's equivalent (mergeConfig()) already re-reads the env var on every call; this brings LearningBridge's constructor in line with that behavior, preserving the same precedence (explicit config.sonaMode > env > default). Adds regression tests for both packages (sona-adapter.ts had none previously) and registers RUFLO_INTELLIGENCE_MODE in KNOWN_ESCAPE_HATCHES per the audit script's existing requirement for operator-knob env vars outside its SCAN_ROOTS. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01SjxUvZnyBdwtx4Y1jKAqt6 |
||
|
|
955510695f |
fix(memory): replace the drive colon when deriving the auto memory key (#3305)
resolveAutoMemoryDir mirrors Claude Code's project key, which replaces `/`, `_` and `:` with dashes. The colon was missing, so a Windows git root of D:\projects\elearning\v3_26 produced the key D:-projects-elearning-v3-26 instead of D--projects-elearning-v3-26. A colon is not legal inside a Windows path segment, so ensureMemoryDir() failed with ENOENT and doSync() swallowed it as "Sync failed (non-critical)": the auto memory sync had never run on Windows, and reported success while doing nothing. It also wrote to a different key than Claude Code reads, so even a successful write would have been invisible. POSIX paths carry no colon, so nothing changes there. Co-authored-by: rUv <ruv@ruv.net> |
||
|
|
f13b8567de |
dream(performance): #3265 stop re-tokenizing MMR candidates that PR #3169 mostly stopped needing (evaluated, ACCEPT) (#3266)
* dream(performance): #3265 stop re-tokenizing MMR candidates that PR #3169 mostly stopped needing mmrRerank() eagerly re-tokenized every remaining candidate's content on every outer-loop pass (O(N x limit) tokenize() calls), a pattern that predates and survived PR #3169 unchanged. #3169 made embedding-cosine the preferred, now-common pairSimilarity path, so most of that tokenization was computed and then discarded. Tokens are now computed lazily and cached per-candidate, only when the Jaccard fallback is actually needed. Evaluated: tokenize() calls 400 -> 0 on a 30-candidate/limit-20 all-embedded corpus (stash-isolated: fails against real baseline, passes against candidate); vitest bench shows the candidate 5.88x faster (independently reproduced at 5.96x by an adversarial critic). Selection output is byte-for-byte identical to baseline across all-embedded/no-embedding/mixed scenarios. 473/474 full package suite both ways (1 pre-existing, unrelated environmental failure), tsc clean. Evaluated, ACCEPT. Full research (5-role parallel fan-out), evaluation receipt, adversarial critique, Darwin/Flywheel scoping, reward-hack check, and security/hive-mind scan findings in the linked issue and gist. Closes #3265 Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01P5UJ62RVAbq8DLEEXPrwvU * dream(performance): append 2026-09-10 ledger row (#3265, #3266) Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01P5UJ62RVAbq8DLEEXPrwvU --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
e036e35dd7 |
dream(memory): #3231 wire embedding near-dup detection into MemoryConsolidator.dedup() (evaluated, ACCEPT) (#3232)
* dream(memory): wire embedding near-duplicate detection into MemoryConsolidator.dedup()
MemoryConsolidator.dedup() only ever deduplicated entries via byte-exact
SHA-256 content hashing, even though every entry already carries a
computed .embedding and the adapter's HNSWIndex (already held in scope
for removal bookkeeping) is incrementally kept in sync. Paraphrases and
reformattings of the same memory were never caught.
Adds a second pass: for hash-pass survivors with an embedding, query the
already-populated HNSWIndex for cosine-similarity neighbors above a
configurable similarityThreshold (default 0.95, matching the unwired
domain-layer consolidator's own constant), and merge using the same
keeper-selection strategies (now factored into shared selectKeeper/
mergeGroup helpers). Guarded to cosine-metric indexes only; disabled via
similarityThreshold >= 1.
Evaluation: 471/472 passing in @claude-flow/memory (1 pre-existing,
unrelated, environmental failure); baseline (git-stash-isolated source)
fails exactly the 2 new discriminating tests and passes the rest,
confirming the fix is additive and non-regressive. tsc --noEmit clean.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01H4kfasS4XkYaSGYXFLSSEG
* dream(memory): fix-forward — converge near-dup pass to a fixed point in one dedup() call
Independent adversarial critique (STEP 10) reproduced a real, bounded gap
in the prior commit: a near-duplicate cluster larger than
NEAR_DUP_SEARCH_K (8) split into multiple leftover sub-group survivors
within a single dedup() call, because each round's `consumed` bookkeeping
permanently excluded a group's keeper from further matching even though
it was still fully present in the index. 15 pairwise-identical-embedding
entries collapsed to 2 survivors (merged: 13) instead of 1 (merged: 14).
It self-healed across repeated runAll() calls (background timer /
nightlyLearner), so this was never a permanent-data-loss bug, but a
single manual dedup() call under-converged relative to its documented
"collapse duplicates" contract.
Fix: loop pass 2 to a fixed point (re-scan until a full round produces
zero merges) instead of a single scan. Always terminates — entries
strictly decrease each round that merges anything. `groups` now counts
merge operations across all rounds, which can exceed the number of
underlying duplicate clusters when one needed more than one round;
documented in the method's doc comment.
Added a discriminating regression test reproducing the critic's exact
15-entry scenario; confirmed it fails against the pre-fix single-round
code (merged: 13) and passes against this fix (merged: 14, single
survivor). Full package suite: 472/473 passing (1 pre-existing,
unrelated, environmental failure, unchanged from before this commit).
tsc --noEmit clean.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01H4kfasS4XkYaSGYXFLSSEG
* dream(memory): 2026-09-08 research gist — embedding near-dup consolidation
Full SOTA report: 5-role parallel research fan-out, ledger check with
GitHub-verified fates for the last 14 rows (3 merged since 09-03, one PR
now crossing the 14-day stale threshold for the first time this cycle),
competitor comparison (CrewAI/Mem0/Zep/LangMem/Qdrant/SemDedup), plugins
and automation scan findings, adversarial critique with a real bug found
and fixed, and witness stamp.
No gist-creation MCP tool available in this session (GitHub MCP tools
cover issues/PRs/repos, not gists) — committing to docs/dream-cycle/
instead, matching every dream-cycle night since 2026-08-14.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01H4kfasS4XkYaSGYXFLSSEG
* dream(memory): #3231 update LEDGER.md for 2026-09-08
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01H4kfasS4XkYaSGYXFLSSEG
* dream(memory): #3231 empirical receipts for dedup() near-dup pass (response to review)
Response to PR #3232's INCONCLUSIVE review, which asked for a threshold
contract rather than a smoke fixture: a contamination-checked embedding
corpus with pinned model, precision/recall including hard negatives and
cross-namespace cases, baseline vs. candidate latency/memory at realistic
cardinality, and deterministic replay + unchanged exact-dedup behavior.
Real pinned-model corpus: attempted directly against both ONNX backends
this monorepo ships. Both fail for reasons unrelated to this candidate,
reproduced on an unmodified checkout before writing anything:
- @huggingface/transformers@4.2.0: transformers.node.mjs does
`import { Tensor } from "onnxruntime-common"` against a CJS module — a
real ESM/CJS interop break under this sandbox's Node version.
- @xenova/transformers@2.17.0: pulls in sharp@0.32.6, whose native
binding (sharp-linux-x64.node) isn't present for this platform — the
same failure independently reproduced moments later by this package's
own nightlyLearner test, which falls back to mock embeddings.
Neither is fixable within this PR's scope without touching unrelated,
pre-existing native/module-resolution infrastructure. Documented in
detail at the top of the new test file rather than silently worked
around or omitted.
What's delivered instead, in
v3/@claude-flow/memory/src/consolidator-embedding-benchmark.test.ts:
- A deterministic synthetic corpus where pairwise cosine similarity is
constructed EXACTLY via vectorAtSimilarity() (Gram-Schmidt against a
random orthogonal vector), not measured after the fact — a rigorous
instrument for threshold mechanics specifically, disclosed as not
validating real-world semantic accuracy.
- Precision/recall/false-merge-rate across a 5-point threshold sweep,
every point at a deliberate margin from every corpus similarity value
after an exact-boundary collision (sweep value == corpus value) proved
float32-jitter-sensitive while writing this — documented as a finding,
not silently patched around.
- Namespace isolation: proved cross-namespace near-dup merging matches
cross-namespace hash-exact merging exactly (both pre-existing,
unscoped-by-namespace behavior — this candidate doesn't change it).
- Determinism: 3 independent runs, compared by deterministic entry KEY
(not raw id, which is randomly generated per store() and was a second
bug this file's own first draft had to fix).
- Latency/memory at N=5000 (matching this repo's own HNSW-benchmark
convention): initially measured 9.8s for the candidate pass, which
traced to an unset `ef` search parameter defaulting to efConstruction
(200) — every dedup() search traversed a 200-candidate list for a
duplicate-detection task that only needs very-close neighbors. Fixed
by passing an explicit NEAR_DUP_SEARCH_EF=32 in consolidator.ts,
re-measured at 3.7s (~2.7x), precision/recall unchanged (still exact).
Real numbers logged in the test output either way, not asserted away.
Full package suite: 478/479 passing (472 pre-existing + 7 new; same 1
pre-existing unrelated environmental failure as every prior commit on
this branch). tsc --noEmit clean.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01H4kfasS4XkYaSGYXFLSSEG
* dream(memory): #3231 add new benchmark file to CI test-ratchet baseline
CI on a2e99cf failed with "1 unexpected failing file(s): +
v3/@claude-flow/memory/src/consolidator-embedding-benchmark.test.ts".
Root-caused via the vitest JSON report artifact (test-results-ubuntu-latest,
downloaded and parsed directly, not guessed): a suite-level collection
failure, "Cannot find package '@claude-flow/security' imported from
'.../v3/@claude-flow/memory/src/agentdb-retrieval-guard.ts'" — the same
unbuilt-sibling-package gap already accepted in scripts/ci-test-baseline.txt
for 9 other @claude-flow/memory test files, including consolidator.test.ts
itself (line 95). Every file in this package fails identically in this CI
checkout state; my new file just wasn't in the baseline yet because it's
new. Not a regression this PR introduced — confirmed by the failure being
a pre-import-time module-resolution error, not a test assertion in the
new file's own logic (which passes locally in a checkout with @claude-flow/
memory's dependencies actually built: see the 6/6 local run in the prior
commit's message).
Fix: add the new file to the baseline, alongside its 9 memory-package
siblings already there, matching this repo's own established convention
for this exact gap rather than working around it some other way.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01H4kfasS4XkYaSGYXFLSSEG
* dream(memory): #3231 baseline 2 more federation/gateway plugin test files
CI on
|
||
|
|
755b6720c5 |
dream(intelligence): #3159 LearningBridge.consolidate() reward-blind fix (evaluated, ACCEPT) (#3160)
LearningBridge.consolidate() reported every completed trajectory's reward as a hardcoded 1.0, regardless of the underlying insight's actual quality. Now resolves the real confidence via backend.getByKey(namespace, key) — the entryId flowing through this bridge is the caller's key, not the backend's internal id, a distinction the round-1 fix got wrong and an adversarial critic caught before this PR. Baseline 56/56 -> candidate 62/62 tests; full package 464/465 (1 pre-existing environmental failure, unrelated). Also recovers 9 nights (2026-08-24..2026-09-01) of missing ledger rows — pipeline ran to completion each night but the ledger-append step silently failed, same pattern as the 08-14..08-19 gap recovered on 08-19. Claude-Session: https://claude.ai/code/session_014pTYiv93Ft6xAN8FAaWH5s Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
fde5b3b88b |
dream(memory): #3118 wire HybridBackend's dead weights field into weighted-RRF fusion (evaluated, ACCEPT) (#3119)
* dream(memory): #3118 wire HybridBackend's dead weights field into real weighted-RRF fusion HybridQuery.weights was computed and then discarded by queryHybrid's 'union' strategy (combineUnion did a plain set-union, no score math, and no caller ever set weights either). Adds combineWeighted: per-arm-weighted reciprocal-rank fusion matching the pattern documented for Qdrant/ Weaviate/Azure AI Search. Evaluated via deterministic Vitest, baseline isolated via git stash: the weight-sensitivity test fails on baseline, passes on candidate. 461/462 full memory-package suite green (1 pre-existing, unrelated environmental failure, confirmed identical on baseline). tsc --noEmit clean. Also backfills docs/dream-cycle/LEDGER.md rows for 2026-08-20..23 (genuine no-run gap) and 2026-08-24..27 (ran to completion but stuck on unmerged draft PRs, not a repeated ledger-append failure — see issue #3118 §11). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01AjuAxfhZi6eZXnLbLC14Ay * fix(memory): validate weights + deterministic tie-break; port #3104 lockfile fix Per ruvnet's review on #3119: - weighted RRF fusion previously had undefined ranking semantics for malformed weights (NaN poisons the sort comparator, negative/Infinity invert or swamp the intended ordering). Each weight component now validates independently (finite, >= 0) and falls back to its own documented default otherwise, same degradation as an omitted weights field already had. - rrf ties now break deterministically by entry.id (explicit secondary sort key) instead of relying on Array.sort's stability plus Map insertion order as an undocumented side effect. - 4 new tests: 3 malformed-weight fallback cases + 1 genuine-tie (weights: {semantic:0, structured:0}) deterministic-order case. Also ports PR #3104's fix verbatim (v3/pnpm-lock.yaml: @claude-flow/mcp specifier ^3.0.0-alpha.9 -> 3.0.0-alpha.10, matching the CLI manifest's exact pin) to unblock the install-dependent CI gates this PR needs to actually execute (issue #3101, also flagged in the review). Root-level npm ETARGET (issue #3095, package-lock.json) is a separate, still-open, maintainer-flagged issue with no proposed fix yet -- not addressed here. Validated: `corepack pnpm install --frozen-lockfile --lockfile-only` and `--ignore-scripts` both succeed from v3/; full @claude-flow/memory suite 465/466 (same 1 pre-existing unrelated env failure); tsc --noEmit clean. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01AjuAxfhZi6eZXnLbLC14Ay * fix(test): stop hybrid-backend's rrf tie-break test from flaking on id/key mismatch The tie-break test asserted a hardcoded key-alphabetical expected order, but combineWeighted's tie-break is entry.id.localeCompare(), not key. generateMemoryId() produces `mem_<ms-timestamp>_<random>` — the two fixture entries are frequently created in the same millisecond, so which id sorts first is decided by the random suffix, with no fixed relationship to which key sorts first. Confirmed empirically: 1/5 runs failed before this fix, 10/10 pass after. Fix: capture each entry's actual generated id in beforeEach, and compute the test's expected order from those ids (matching the code's actual documented contract) instead of assuming id-order equals key-order. Full @claude-flow/memory suite still 475/475, tsc clean. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01RYP825phHMjPRmmjkcAWpq --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
2d6227005e |
dream(performance): #3093 wire productQuantizeDistance() into HNSW search path (evaluated, ACCEPT) (#3094)
* dream(performance): #3093 wire productQuantizeDistance() into HNSW search path Quantizer.productQuantize()/productQuantizeDistance() correctly implement codebook-aware PQ encoding and distance, but HNSWIndex.distance()/ distanceOptimized() never called productQuantizeDistance() - generic cosine/euclidean/dot/manhattan distance was computed directly on raw PQ centroid-index arrays, which is numerically meaningless. Zero callers of productQuantizeDistance() existed anywhere in v3/ before this change. Wires the dispatch in, guarded by a new isValidPQEncoding() check to avoid crashing/corrupting on vectors added before PQ codebook training completes (a separate, disclosed, pre-existing limitation not fully solved here - see hnsw-index.ts comments and docs/dream-cycle/dream-gist-2026-08-25.md). Measured on a deterministic synthetic corpus: recall@10 recovers from 0.097 (pre-fix) to 0.270 (post-fix), independently reproduced by an adversarial critic across 3 additional corpus shapes. Full evaluation receipt, hypothesis, and adversarial critique in the linked gist and issue #3093. Also backfills the 2026-08-24 ledger row (branch/issue/PR existed but the row was never appended - recovery per this pipeline's STEP 1 convention). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01Aor8qaXa8T3ZCGgRmjc4VG * dream(performance): append 2026-08-25 ledger row (#3093/#3094) Follow-up to a8b527105 now that the issue and PR numbers exist. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01Aor8qaXa8T3ZCGgRmjc4VG --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
13880e3aa4 |
fix(memory,daemon): stop destroying a user index, honour autoStart:false, and finish the sibling disclosure (#3282)
Three from the current issue backlog, all confirmed in source before touching anything, and all with a test that fails without the fix. #3224 — curateIndex() rebuilt MEMORY.md from the bridge's own topic files and overwrote whatever was there. The #1556 guard only skips the write when NOTHING matched, but the bridge writes the first topic file itself, so after the first insight the guard stops applying and the rebuild replaces a hand-maintained index with a stub: 75 curated lines and 49 links down to 6 in the reported case. The bridge only knows its own topic files, so everything else looks like nothing to it. A curate may now grow or reorder the index and never shrink it; when the generated view is smaller it is written beside the file as MEMORY.generated.md and the bridge emits index:preserved rather than going quiet. #3278 — the autostart disable check read claude-flow.config.json with the key daemon.autostart, while init generates .claude/settings.json with claudeFlow.daemon.autoStart. A different file AND a different capital S, so the one setting a fresh project actually ships was never consulted. It is written false under the comment "Opt-in only — prevents unintended token consumption (#1427, #1330)", which the runtime then ignored. Both files and both spellings are now read: someone who wrote autostart false anywhere sensible meant it. #3228 (half) — 3.41.1 disclosed the sibling AgentDB store from `memory list` only. retrieve, search and an empty list kept returning a clean negative while the rows sat in the file this interface does not read; the reported Windows install has 31,673 rows in that other store answering found:false. A confident negative is worse than an error, because nothing prompts anyone to look further. That was a gap in my own fix, not a new defect. Verified the tests are worth having by reverting each fix and re-running: #3224 fails 1/2, #3278 fails 2/4, and all six pass again restored. Claude-Session: https://claude.ai/code/session_013u4pmL9ZUAXb6usVQgNo67 |
||
|
|
277c7bc03a |
dream(memory): #3168 wire embedding-cosine into SmartRetrieval's MMR step (evaluated, ACCEPT) (#3169)
* dream(memory): wire embedding-cosine into SmartRetrieval's MMR step (evaluated, ACCEPT) smart-retrieval.ts's MMR diversity re-ranking used token-Jaccard text overlap as its "similarity to already-selected" term, even though memory-initializer.ts's searchEntries() already computes real ONNX-embedding cosine similarity for the primary relevance score and discards it before returning. 2025-2026 production practice (LangChain's reference maximal_marginal_relevance, Qdrant's native Mmr query shipped Sept 2025, Weaviate's MMR reranker shipped in 1.37) universally uses embedding-cosine for this term; token overlap misses low-token-overlap paraphrases embeddings correctly flag as near-duplicates. Threads the embedding through: searchEntries()'s two live compute sites (RaBitQ rerank, brute-force SQL) now return it instead of discarding it; the two CLI/MCP bridge mappers (memory-tools.ts, commands/memory.ts) pass it through; SearchCandidate gains an optional `embedding` field; mmrRerank uses cosine when both candidates have one, falling back to token-Jaccard otherwise (existing callers/tests without embeddings are unaffected). controller-registry.ts's separate toCands()/applyMMR path had the same gap for a different reason (embedding available on r.entry.embedding but never copied) — fixed the same way. Evaluated via deterministic Vitest, zero LLM calls, $0 cost. New discriminating test: a low-token-overlap paraphrase (near-1.0 cosine to the seed) vs. a genuinely different topic (near-0 cosine). Baseline (git stash-isolated): picks the paraphrase second (Jaccard can't tell "low overlap because paraphrase" from "low overlap because unrelated"). Candidate: correctly picks the different topic second. Full @claude-flow/memory suite: 460/461 passing identically with/without the candidate (1 pre-existing chmod-based environmental failure, same class documented since 2026-08-15). tsc --noEmit: zero new errors (verified @claude-flow/cli's 455 pre-existing errors, from unbuilt workspace packages, are identical with and without this diff). Darwin: skipped, scope mismatch (correctness/similarity-metric fix with a discriminating unit test, not a continuous parameter with a gold-labeled corpus). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01Qho5K4p5ACBt4yzCWjkBGe * dream(memory): address review remediation — split CI, real benchmark, hardening Response to ruvnet's REJECT review on #3169: 1. Split — dream-cycle-backlog-guard.yml moved out to #3205; this branch now carries only the MMR fix, rebased onto main (which already includes the merged #3203 CI fix). 2. Real benchmark (new src/mmr-benchmark.test.ts): 18-doc/6-topic labeled corpus (1 canonical + 2 low-token-overlap paraphrases per topic), run through the actual smartSearch/mmrRerank code, swept across mmrLambda in {0.3, 0.5, 0.7, 0.9} rather than one favorable value. Honest finding: at diversity-heavy lambda, candidate's recall/nDCG drop sharply vs. baseline, because cosine correctly suppresses same-topic near-duplicates that Jaccard fails to detect at all (and so "accidentally" keeps full recall). At smart-retrieval.ts's own default (lambda=0.7), recall@6/nDCG@6 are identical to baseline (1.000/0.777 both) while topic-diversity improves 0.472->0.667 and ground-truth duplicate-rate drops 0.289->0.200. Reports latency (sub-ms both paths at this corpus size) and a memory-overhead estimate. 3. Malformed/dimension-mismatch: found and fixed a real bug while writing these cases. A NaN/Infinity-poisoned embedding component reached cosineSimilarity unguarded; the poisoned NaN score meant `mmr > bestMmr` was never true (NaN comparisons are always false in JS), which could silently break MMR's selection loop and under-fill results below the requested limit. Added isWellFormedEmbedding() so malformed/empty embeddings fall back to token-Jaccard, same as absent/mismatched ones. 3 new cases (NaN/Infinity, empty array, explicit dimension-mismatch) plus a test mirroring the two real CLI/MCP output whitelists (memory-tools.ts:559-569, commands/memory.ts:633-639) to assert `embedding` cannot appear in either shape. 4. Determinism: new test runs the same input through smartSearch 5 times concurrently, asserts byte-identical result ordering every time, including a genuine same-embedding tie. Full @claude-flow/memory suite: 465/466 (1 pre-existing, unrelated environmental failure). tsc --noEmit: zero errors. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01Qho5K4p5ACBt4yzCWjkBGe --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
127a6546c4 |
chore(release): 3.38.17 -> 3.38.18, @claude-flow/memory 3.0.0-alpha.22 -> alpha.23
3.38.17 was published by a concurrent session mid-race with a stale
package.json (the @claude-flow/mcp pin had been reverted to the broken
3.0.0-alpha.10 by a background helper-refresh process just before publish;
see #3005). npm forbids republishing over an existing version, so cutting
3.38.18 with the verified-correct pin instead of trying to fix 3.38.17.
Also discovered @claude-flow/memory is NOT in @claude-flow/cli's
bundleDependencies (unlike @claude-flow/mcp/codex/security/plugin-agent-federation)
-- it's resolved from the registry via a normal ^3.0.0-alpha.22 semver range,
and that exact version is what's currently published, without the #2977 fix
from
|
||
|
|
8a85001942 |
fix: Windows CI build, dead agentdb controller exports, memory driver doctor check
- #2992: pin windows-latest -> windows-2022 for the Build V3 matrix job. windows-latest moved to VS2026, which node-gyp can't detect, breaking native builds for hnswlib-node and better-sqlite3. - #2977: remove dead agentdb import attempts in controller-registry.ts for 8 exports no installable agentdb range provides. Promote the working tieredMemoryFallback/createConsolidationStub implementations to first-class for hierarchicalMemory/memoryConsolidation; the other 6 controllers (semanticRouter, mutationGuard, attestationLog, gnnService, rvfOptimizer, guardedVectorBackend) have no fallback and now return null directly instead of attempting an import that never resolves. The consolidation stub now reports source:'stub' and an explicit note so agentdb_consolidate reads as "did not run" rather than "nothing to do". - #2968: add a read-only doctor check (checkMemoryPersistenceDriver) that reports whether the active SQLite driver is native better-sqlite3 (durable, WAL-capable) or the sql.js fallback (silently drops wal_checkpoint writes), using the table-count signal from the issue (~47 native vs ~10 fallback). Warns, never fails; does not touch install behavior. #2990 (MCP HTTP transport protocolVersion/tools-list/IPv6 bind) required no code change — all three fixes are already present on main; the bug in published ruflo/@claude-flow/cli only persists because no release has been cut since they landed. #3002 (ruvocal hidden-tab stream freeze) also required no code change — already fixed on main. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_018ZkgSrVRWNMcXmaFiMZ7Z8 |
||
|
|
41efca8be3 |
dream(memory): #3056 hybridSearch reachable via explicit opt-in (evaluated, ACCEPT-scoped) (#3057)
* dream(memory): #3056 hybridSearch reachable via explicit opt-in without memoryService The ADR-125 Phase 5 three-arm (dense+sparse+entity) RRF/MMR fusion controller was fully built and tested but unreachable from any production call site: its explicit-enable config override worked at the isControllerEnabled() gate but the createController() factory still unconditionally required a hand-built UnifiedMemoryService, silently returning null otherwise. Falls back to the existing this.backend when it type-guards as AgentDBAdapter-compatible, reachable only via explicit controllers: { hybridSearch: true } -- default auto-enable behavior is unchanged. New deterministic $0 benchmark quantifies the feature's actual retrieval-quality effect for the first time (previously only functional/unit tests existed): +0.267 aggregate recall@10, with a disclosed, statistically significant regression on pure-paraphrase queries where fusion noise dilutes an already-perfect dense signal. Independent adversarial critic (fresh subagent): CONFIRMED-SAFE, reproduced bit-for-bit. 75/75 tests passing in touched files, 458/459 in the full package (1 pre-existing environmental failure, unrelated). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_016T1JRz8NBeGGmxQJVPReWa * dream(memory): #3056 update ledger with 2026-08-14..18 nights + PR #3057 Reconstructs the v2 live-entries table from PR/issue history since each night's own LEDGER.md edit lives only on its unmerged branch and never reaches main (0% merge rate). Adds tonight's row (memory, hybridSearch reachability fix, ACCEPT scoped, witness b28714fb...). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_016T1JRz8NBeGGmxQJVPReWa --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
efd0406e7a |
chore: sync committed versions to already-published 3.36.0 / memory@alpha.22
@claude-flow/cli, claude-flow, and ruflo were published at 3.36.0 (and @claude-flow/memory at 3.0.0-alpha.22, carrying the #2887 durability fix) without the version bump landing back in git — this just reconciles the committed package.json versions with what's actually live on npm, and bumps the cli's @claude-flow/memory floor to the version that has the fix. No code changes. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
1d365d4a65 |
fix: silent memory-write loss + daemon lock cwd bypass (#2887, #2878, #2877) (#2966)
Three independent data-integrity/correctness bugs in the memory and daemon subsystems: #2887 — agentdb_hierarchical-store reported success:true for writes that were never persisted. Root cause: agentdb dropped its HierarchicalMemory export at 3.0.0-alpha.17, so every call was silently landing on an in-process-only TieredMemoryStore fallback. The fallback now writes through to a `tiered_memory` SQLite table when given a db handle, and the bridge refuses to report success for a write that isn't durable — it names the fallback controller and reason instead. agentdb_health now reports the real persisted row count so a claimed write vs. an empty table is visible. #2878 — concurrent sql.js writers lost updates while reporting success (measured 10/12 lost in a 12-way concurrent repro), because storeEntry, getEntry, deleteEntry, applyTemporalDecay, and ensureSchemaColumns did unlocked whole-image read-modify-write against memory.db. All five now run under the existing withMemoryDbLock primitive (previously only used by purgeNamespace). Made the lock reentrant via AsyncLocalStorage, since every mutator calls ensureSchemaColumns internally and a plain O_EXCL lock isn't reentrant. Also fixed a path-normalization bug where different callers spelled the same db path differently and so serialized against nothing. #2877 — the daemon lock/PID file was keyed to raw process.cwd(), so `daemon start` from a project subdirectory span its own lock/PID pair instead of contending with one from the project root, bypassing the #2407/#2484 dedup. Added resolveDaemonProjectRoot(), which walks up from cwd to the nearest directory carrying a real Ruflo marker (not just any package.json, so independently-initialized nested sub-projects in a monorepo keep their own daemon), stopping at a .git boundary so the walk can't escape into an unrelated ancestor project. Wired into every daemon command that previously used process.cwd() directly. Tests: 123 passing across affected suites (controller-registry.test.ts, tiered-memory.test.ts, hierarchical-store-durability-2887.test.ts, memory-concurrent-write-loss-2878.test.ts, daemon-autostart.test.ts). Both packages typecheck clean. Pre-existing failures in unrelated suites (ruvector wasm bindings, agenticow, memory-search-recall-2558) reproduce identically with these changes reverted — confirmed not regressions. Fixes #2887, #2878, #2877 |
||
|
|
f074987ea0 |
feat(security): implement ADR-377 — AgentDB Retrieval Security Layer (#2874)
Implements all 3 phases of ADR-377 (ruvnet/ruflo#2516, tracked in #2873): AgentDB's retrieval and write paths had zero certified defenses against memory poisoning — SMSR (arXiv:2606.12703) shows 93-100% undefended attack success. All three phases are off by default; enabling each is opt-in via env flag until independently benchmarked, per the ADR's own gate criteria. Phase 1 — AgentDbRetrievalGuard (@claude-flow/memory) - New `agentdb-retrieval-guard.ts`, wired into `AgentDBBackend.search()` (covers `query()`'s semantic path too, since it calls `search()` internally). Reuses `@claude-flow/security`'s `ToolOutputGuardrail` (ADR-131) for the actual OWASP LLM01/LLM08 pattern scan rather than duplicating it — `@claude-flow/memory` now depends on `@claude-flow/security` (no cycle: security has zero workspace deps). - Size gate + guardrail scan per retrieved chunk. Flag-only by default; `CLAUDE_FLOW_RETRIEVAL_GUARD_STRICT=true` drops unsafe/oversized chunks instead of just annotating them. Both flags off by default (`CLAUDE_FLOW_RETRIEVAL_GUARD=true` to enable scanning at all). Phase 2 — MemoryPoisonForensics (@claude-flow/hooks) - New `workers/memory-poison-forensics.ts`: rolling-window z-score anomaly detection on write-interval and content-length features per (agentId, namespace), reproducing the Forensic Trajectory Signatures (arXiv:2606.30566) shape (behavioral features on write *sequences*, not content). Opt-in `HookEvent.PostToolUse` handler for memory-write tools; `CLAUDE_FLOW_POISON_FORENSICS=0` disables recording. - NOT wired into any of this repo's three separate "worker" dispatch systems (hooks' own workers/index.ts codebase-analyzers, @claude-flow/swarm's worker-dispatch.ts 12-trigger table, or the CLI's scheduled daemon) — @claude-flow/swarm is a deliberately zero-workspace-dependency package and adding hooks there would break that property; picking the wrong one of three ambiguous dispatch tables seemed worse than leaving that integration as an explicit follow-up. See the file header for detail. Phase 3 — McpCallerIdentity (@claude-flow/security) - New `mcp-caller-identity.ts`: per-invocation Ed25519-signed capability tokens (callerId + toolName + nonce + 30s TTL by default), native node:crypto sign/verify following the same pattern already used by `@claude-flow/browser`'s witness-signer.ts (reimplemented rather than cross-imported — a security-primitives module depending on the browser package would be a backwards layering dependency). - Standalone issue/verify API; deliberately NOT wired into `AgentAuthorizationPropagator.checkToolCall` (ADR-144) or any tool dispatcher — this repo has at least 3 distinct `ToolRegistry` implementations and guessing which is authoritative risked silently wiring the wrong path. `CLAUDE_FLOW_MCP_CALLER_AUTH` defaults to disabled, matching the ADR's own text: key distribution needs a follow-on ADR before this ships enabled. Deviations from the ADR's guessed file paths/class names (documented inline where relevant): the ADR was written against aspirational paths (`agentdb/retrieval-guard.ts`, a `BackgroundWorker` interface, `SafeExecutor`) that don't match the real repo layout — implementation targets the actual `AgentDBBackend`, the actual worker systems, and the actual `AgentAuthorizationPropagator`/tool-registries respectively. Tests: 31 new tests across the three packages (9 + 11 + 11), all passing; full existing suites re-run clean (memory 451, hooks 145, security 570 — zero regressions). |
||
|
|
d012042800 |
feat: review-driven upgrades — perf, security, SOTA capabilities (6-agent concurrent implementation) (#2547)
* chore(arch): untrack the prepublish plugin mirror — build artifact, not source
v3/@claude-flow/cli/plugins/ is regenerated by prepublishOnly from
plugins/ruflo-metaharness/ at publish time. Keeping it committed caused
silent drift between publishes (4 files diverged this week alone) and
every source edit required a manual mirror sync. npm pack still bundles
it — the files array + prepublish copy are unaffected by gitignore.
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(gaia): submission integrity checklist — fail-closed pre-submit audit (Berkeley RDI hardening)
Adds a 4-part integrity section to the gaia-validate pre-submit gate,
motivated by UC Berkeley RDI's 'Agents' Last Exam' (April 2026), which
gamed all 8 major agent benchmarks to near-100% without solving tasks.
- scripts/gaia-integrity.mjs: (A) answer-key-shaped path reads outside
the sanctioned dataset dir — FAIL-CLOSED exit 2; (B) eval()/new
Function()/exec-of-non-literal strings in gaia-bench runner code
paths — FAIL-CLOSED exit 2; (C) judge-prompt-injection markers in
produced answers/trajectories — WARN; (D) provenance stamp (results
+ git SHA + dataset content hash) written for gaia-submit to embed.
- --allow-integrity-override suppresses the exit code but records
'overridden: true' in the stamp — never silent.
- --self-test plants a fake answer-key read, an eval-of-task runner,
and injection markers in temp fixtures and proves fail-closed/pass/warn.
- gaia-validate.md: new check 7 documenting the checklist + flags.
- gaia-submit.md: package now embeds integrity.json under the Ed25519
witness manifest (tamper-evident attestation); stale/failed stamps block
packaging.
- smoke-gaia.sh: 3 new steps (script wired, self-test green, repo scan
clean); plugin bumped to 0.5.0.
Co-Authored-By: RuFlo <ruv@ruv.net>
* perf(cli): lazy ONNX embedder init + local-first ruvector resolution
Fix 1 — lazy ONNX init (measured, biggest win):
neural-tools.ts had a module-level try/catch with TOP-LEVEL AWAIT that ran
`await import('ruvector')` + `initOnnxEmbedder()` + a probe embed at import
time. Because mcp-client statically imports neural-tools, this added the
full ONNX startup to every CLI command. The block is now a memoized
`ensureEmbeddings()` (module-level promise guard) invoked from
generateEmbedding() and from the three handlers that report the provider
without embedding (neural_compress / neural_status / neural_optimize), so
degraded/fallback semantics and provider reporting are byte-identical.
The probe embed moved inside ensureEmbeddings() — it still guards the
ADR-086 type-load-success-but-runtime-fails trap, but only on first use.
Measured (warm, darwin-arm64):
node bin/cli.js --help 0.50s -> 0.09s
node bin/cli.js status 0.64s -> 0.24s
import(mcp-client.js) 438ms -> 30ms
"Loading ONNX model" no longer appears on non-embedding commands;
appears exactly once on first embed (neural_predict / memory search).
Fix 2 — ruvector pin + local-first resolution:
browser-session-tools.ts pinned `npx -y ruvector@0.2.25` while 0.2.27 is
what the package installs, forcing cold npx downloads of a second version
(4 per browser session). The pin is now 0.2.27 and a memoized
resolveLocalRuvectorCli() (createRequire + package.json bin walk) spawns
`node <local-cli>` directly, falling back to the npx pin only when no
local install exists.
While verifying the 0.2.27 subcommand surface (required before bumping),
found the trajectory-* flags passed here were never valid on 0.2.25 OR
0.2.27 (`--session-id/--task/--args/--verdict` vs the real
`--context/--agent`, `--action/--result`, `--success/--quality`) — every
trajectory call exited with commander "unknown option", same bug class as
the #2015 `rvf create --kind` fix documented in this file. Flags are now
mapped correctly; browser_session_record and browser_session_end verified
end-to-end (rvf create + trajectory-begin/step/end + rvf compact all pass).
Fix 3 — lazy heavy MCP tool groups: profiled and NOT converted.
Per-module timed dynamic imports of all 36 tool modules show neural-tools
was 469.6ms and every other group is 0.3-5.5ms (hooks-tools 3.5ms,
agentdb-tools 2.5ms, embeddings 0.9ms, wasm-agent 0.6ms). After fix 1 the
whole registry builds in ~30ms; converting handler dispatch to lazy
import() would add risk for <6ms of residual win, so mcp-client.ts is
intentionally untouched.
Validation:
- tsc build clean
- plugins/ruflo-metaharness/scripts/test-mcp-tools.mjs: 171/171 passed
- memory search / neural predict still work; ONNX loads lazily then
Co-Authored-By: RuFlo <ruv@ruv.net>
* security(deps): lift OTel floor-became-ceiling pins — core >=2.8.0, otlp family >=0.220.0
The exact pins @opentelemetry/{core,resources,sdk-trace-base}@1.25.1 and
the otlp exporter/transformer family@0.52.1 (root + ruflo wrapper
overrides) were added in #1997/#2112 as a 'fewer-knobs-for-arborist'
defense against the npm arborist Invalid Version crash (empty-version
placeholder from optionalDependencies/peerDependencies overlap). They
were never API-compat pins — but they became a ceiling that forces the
tree onto @opentelemetry/core <2.8.0, which npm audit flags for
GHSA-8988-4f7v-96qf (unbounded memory allocation in W3C Baggage
parsing), and they blocked every upstream fix.
Convert to floors while keeping the lockstep families coherent:
- stable line: core / resources / sdk-trace-base -> >=2.8.0
- otlp line: sdk-node, exporter-prometheus, the three
exporter-trace-otlp-* packages, otlp-exporter-base,
otlp-grpc-exporter-base, otlp-transformer -> >=0.220.0
(sdk-node@0.220.0 declares exactly core@2.9.0 + otlp@0.220.0, so the
floors resolve to one mutually consistent set; verified in both the
root lockfile and a fresh ruflo/ resolution: core 2.9.0 everywhere,
otlp 0.220.0 everywhere.)
The arborist defense is preserved — every package in both families is
still forced to a single resolution via overrides; the override set is
now broader (whole otlp family at root too), which gives arborist fewer
ambiguous nodes than before, not more.
Also adds the exporter family overrides to the root manifest so root
and the published ruflo wrapper stay aligned (#2112 lesson: root
overrides do not propagate to the published wrapper).
Validation:
- root: npm audit --omit=dev 30 moderate -> 0 vulnerabilities
- ruflo: npm install --package-lock-only succeeds, 0 vulnerabilities
- runtime probe: new NodeSDK({}) via @opentelemetry/sdk-node@0.220.0
with core@2.9.0 loads and exposes start(); OTLPTraceExporter loads
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01S7GYqnVUVxBfZ5W8znqry3
* security(deps): npm audit fix on v3 workspace lock — grpc-js, hono/node-server, brace-expansion
Plain `npm audit fix --omit=dev --package-lock-only` (no --force) on the
v3 npm workspace lockfile. Clears the three targeted advisories:
- @grpc/grpc-js 1.14.3 -> 1.14.4 GHSA-5375-pq7m-f5r2 (+GHSA-99f4-grh7-6pcq)
- @hono/node-server 1.19.9 -> 1.19.14 GHSA-wc8c-qw6v-h7f6 (+GHSA-92pp-h63x-v22m)
- @isaacs/brace-expansion 5.0.0 removed/deduped GHSA-7h2j-956f-4vf2
Audit summary: 82 vulnerabilities (2 low, 56 moderate, 24 high)
-> 55 vulnerabilities (50 moderate, 5 high).
The remainder needs --force / dependency swaps and is out of scope for
this pass.
Note: the reify was run with the two pnpm-style `workspace:*` devDep
specs (plugin-agent-federation, plugin-iot-cognitum) temporarily
substituted with the registry pins the lockfile already records
(@claude-flow/shared@3.0.0-alpha.8, @claude-flow/security@3.0.0-alpha.10),
because npm's arborist does not support the workspace: protocol; the
manifests themselves are unchanged. The v3 workspace is otherwise
pnpm-driven (`pnpm -r build`).
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01S7GYqnVUVxBfZ5W8znqry3
* security(deps): align agentdb floor in @claude-flow/memory — ^3.0.0-alpha.17
Root overrides force agentdb >=3.0.0-alpha.17, but @claude-flow/memory
declared ^3.0.0-alpha.16, so its nested/published tree could still
resolve alpha.16 (the #2112 lesson: overrides do not propagate to
nested or published trees). The v3 pnpm lock indeed had memory pinned
to agentdb 3.0.0-alpha.16 — bumping the package's own floor makes both
branches resolve the same version regardless of the consumer's
override set.
pnpm-lock.yaml is regenerated by `pnpm install`; besides the
agentdb 3.0.0-alpha.16 -> 3.0.0-alpha.17 move under memory, it also
reconciles previously committed manifest bumps (metaharness family)
that had drifted from the stale lock.
Verified: `npm ls agentdb` from root shows a single deduped
agentdb@3.0.0-alpha.17 across direct, @claude-flow/memory,
@claude-flow/neural, and agentic-flow branches.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01S7GYqnVUVxBfZ5W8znqry3
* security(deps): correct FEDERATION_BIND_HOST doc default — 127.0.0.1 (ADR-166 Phase 3d)
The bin.ts header JSDoc still advertised `default: 0.0.0.0`, but the
code (makeContext) has defaulted to 127.0.0.1 since the ADR-166
Phase 3d loopback-by-default hardening. Doc-only change.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01S7GYqnVUVxBfZ5W8znqry3
* fix(memory): drop vitest-4 style vi.fn generic that breaks tsc build
The hoisted vitest 1.x types Mock as Mock<Args extends any[], Returns>,
so the single-generic vi.fn<SearchFn> form fails the package build
(pre-existing baseline failure). Annotate the variable instead — the
inferred mock signature is identical.
Co-Authored-By: RuFlo <ruv@ruv.net>
* perf(memory): batch embeddings in the migration import path
MemoryMigrator.processBatch batched entries (batchSize=100) but then
awaited this.embeddingGenerator(content) ONE ENTRY AT A TIME inside the
loop — N sequential ONNX inferences per batch on the
memory_import_claude hot path.
Now:
- New BatchEmbeddingGenerator type ((contents: string[]) =>
Promise<Float32Array[]>) accepted as an optional 4th constructor /
factory param — one true batch call per migration batch when the
embedder supports it (e.g. bge-embedder's single padded forward pass).
- Fallback: bounded concurrency over the single-text generator
(MigrationConfig.embeddingConcurrency, default 8 — never unbounded;
set 1 to restore sequential behavior).
- If the batch call fails, falls back to per-entry embedding so one
backend hiccup doesn't strand the batch.
Per-entry error semantics preserved: validation failures skip, store
failures fail, embedding failures warn and store the entry without a
vector — one bad entry never fails the batch.
Measured (200 synthetic entries, 5ms simulated single-embed latency):
sequential 1220ms -> concurrency-8 156ms (7.8x) -> true batch 115ms
(10.6x).
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(memory): temporal validity on hierarchical memory (Zep/Graphiti-style)
Facts in hierarchical memory can now carry validity windows and are
INVALIDATED on conflict instead of overwritten:
- New TieredMemoryStore module (@claude-flow/memory) promotes the inline
controller-registry stub to a first-class, tested store with optional
validFrom / validUntil (ISO) + supersededBy fields.
- store accepts supersedes=<entryId|key>: the old entry is stamped
validUntil=now + supersededBy=<newId> and archived — never deleted.
- recall filters temporally-invalid entries (expired, superseded, or
not-yet-valid) by default; includeExpired=true is the audit escape
hatch.
- Backward compatible: entries without the fields behave exactly as
before (always valid); legacy store(key,value,tier) / recall(query,
topK) call shapes unchanged; same-key stores still overwrite; the
bridge's real-vs-stub detection signal (getStats+promote) is
preserved.
- CLI bridge passes the new optional fields through
bridgeHierarchicalStore/-Recall. On the native agentdb
HierarchicalMemory backend, validFrom/validUntil ride in metadata and
are filtered at recall; supersedes is reported as unsupported there
(no public update API) rather than silently dropped.
- MCP inputSchemas for agentdb_hierarchical-store (validFrom,
validUntil, supersedes) and agentdb_hierarchical-recall
(includeExpired) expose the fields to agents, with ISO-8601
validation.
Tests: supersede flow (including same-key supersede preserving
history), expired + not-yet-valid filtering, includeExpired escape
hatch, legacy entries untouched, unparseable timestamps fail open.
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(routing): confidence-gated tier escalation — hooks_model-verify ($0 post-generation verifier)
ADR-026/143 classify BEFORE generation only. This adds the 2026-SOTA
post-generation gate: attempt the cheap tier, verify the output with
CHEAP structural signals (no LLM call), escalate only on failure.
- src/ruvector/output-verifier.ts — pure verifier: empty/truncated
output, refusal patterns, degenerate repetition, unbalanced
delimiters, and a real syntax parse for code/JSON tasks (TypeScript
transpileModule diagnostics / JSON.parse, graceful degradation when
typescript is absent). Returns {confident, reasons[], suggestedTier,
suggestedModel, escalate}; ladder haiku→sonnet→opus, tier 2→3.
- hooks_model-verify MCP tool (hooks-tools.ts, surgical) — wraps the
verifier and feeds the verdict into the SAME learning stream as
hooks_model-outcome (ModelRouter.recordOutcome: success when
confident, escalated when not) so the Thompson priors learn which
task shapes the cheap tier fails on. A dedicated tool (not a verify
mode on hooks_model-outcome) because verify is a mid-loop decision
point returning a verdict the agent acts on, while outcome is a
terminal write — the sequence is route → generate → verify →
(escalate) → outcome.
- __tests__/output-verifier.test.ts — refusal/truncation/parse/
escalation-ladder coverage + MCP handler tests (18 tests).
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01S7GYqnVUVxBfZ5W8znqry3
* feat(federation): A2A Agent Cards — spec-1.0 discovery adapter over the bespoke federation schema
Implements the Agent2Agent (A2A, Linux Foundation) Agent Card layer as an
ADAPTER over the existing federation registration/discovery shapes. Cards
only — A2A Tasks/messaging are deliberately out of scope this iteration.
Spec: A2A Protocol 1.0.0 (a2a-protocol.org; schema source of truth
specification/a2a.proto in a2aproject/A2A). Required AgentCard fields per
spec 4.4.1: name, description, supportedInterfaces, version, capabilities,
defaultInputModes, defaultOutputModes, skills. Well-known discovery path
per 8.2 + IANA registration: /.well-known/agent-card.json.
- src/a2a/agent-card.ts: toAgentCard() maps FederationManifest -> spec-
compliant card (agent types -> AgentSkills; federation endpoint -> open-
form RUFLO-FEDERATION AgentInterface; bespoke identity rides in a spec
4.6 extension urn:ruflo:federation:manifest:v1 for lossless round-trip);
validateAgentCard() enforces the 1.0 required-field shape;
fromAgentCard() maps a remote card into a FederationNode — ALWAYS
TrustLevel.UNTRUSTED (cards are self-asserted metadata; trust is earned
via the normal handshake + TrustEvaluator path).
- src/a2a/well-known.ts: minimal node:http endpoint serving GET/HEAD on
the exact well-known path with spec 8.6 Cache-Control + ETag/304.
Binds 127.0.0.1 by default and REFUSES non-loopback binds without an
explicit allowNonLoopback opt-in (ADR-166 posture preserved — no
loosening of federation bind or auth).
- src/a2a/consume.ts: fetchAgentCard (injectable fetch, timeout, size cap,
structural validation) + consumeAgentCard registering the peer into
DiscoveryService so A2A peers appear in federation discovery.
- DiscoveryService: new 'a2a-card' discovery mechanism +
registerExternalPeer() (refresh-not-replace preserves trust state).
- plugin.ts: opt-in wiring via config.a2aCard/a2aCardPort/a2aCardHost;
bind failure degrades gracefully; server closed on shutdown.
- 40 new unit tests incl. golden-file card fixture
(__tests__/fixtures/a2a-agent-card.golden.json), foreign-card mapping,
round-trip, loopback guard, and a live serve->consume e2e over HTTP.
- plugin.test.ts: fixed pre-existing stale assertion (10 -> 11 CLI
commands; 'federation trust elevate' was added without updating the
count) — baseline suite failed before this change.
Build clean; 600/600 tests green.
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(intelligence): execution-state-tree retrieval prototype (MAGE-style positional recall)
Research basis: MAGE (arXiv 2606.06090) — semantic-similarity retrieval
fragments decision trajectories on long-horizon tasks; retrieving by
POSITION in a hierarchical execution-state tree (root→current path)
preserves coherence.
- src/ruvector/trajectory-tree.ts — TrajectoryTree prototype:
trajectory-start opens a node under the session root (nesting under
the deepest open trajectory), steps append children, end closes and
pops the current position. recallPath({sessionId, depth}) returns
the exact root→current path + recent siblings — no embedding search.
Best-effort JSON snapshot at .claude-flow/intelligence/
trajectory-tree.json, ALONGSIDE existing trajectory storage (no
migration). Limitations documented in the module header.
- hooks-tools.ts (surgical): non-fatal tree mirrors in
hooks_intelligence_trajectory-start/step/end (+ optional sessionId
param on start), and an opt-in strategy:"state-tree" on
hooks_intelligence_pattern-search (+ sessionId/depth params).
Default strategy stays "semantic" — zero behavior change unless
opted in.
- __tests__/trajectory-tree.test.ts — synthetic 3-level trajectory
path assertions, nesting/pop, sibling window, persistence
round-trip, and default-strategy-untouched checks (12 tests).
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01S7GYqnVUVxBfZ5W8znqry3
* fix(metaharness): kill third-party @latest, extract shared _invoke.mjs, derive smoke counts
Three of the four converged security/perf/arch review fixes:
1. SECURITY (HIGH) + PERF — _harness.mjs no longer shells to
`npx -y metaharness@latest` (a compromised upstream publish would have
executed arbitrary code on user machines, and @latest forced a registry
check per call). Resolution is now: (a) locally installed metaharness
satisfying the PINNED range ~0.3.0 (walk-up node_modules), then (b) a
one-time `npm install --prefix ~/.ruflo/metaharness-cache-0.3.0`, then
plain `node <abs-path-to-cli>` spawns — zero network per call. Both bins
(metaharness + harness) are read from the resolved package.json bin map.
The {stdout, stderr, exitCode, json, degraded, reason, durationMs}
contract and ADR-150 graceful degradation are preserved; timeouts now
report 'metaharness-timeout' (matching _darwin/_redblue) instead of being
conflated with 'metaharness-not-available'.
Measured: `score.mjs --path .` completes in ~0.35s via the cache.
2. ARCH — new scripts/_invoke.mjs consolidates the copy-pasted plumbing:
DEGRADED_RX (superset incl. `npm ERR`), classifyDegraded (keeps the
-timeout vs -not-available distinction), injectJson, parseTrailingJson
(the LAST-{...}-block variant from _darwin — the old _harness first-block
parse was a live bug), ensureCachedInstall (generalizes gepa/_redblue,
cache-dir naming kept compatible so existing caches keep serving),
importOptionalLibrary, findLocalPackageDir, makeDegradedEmitter.
_harness/_darwin/_redblue/gepa are now thin adapters with IDENTICAL
exported signatures; their genuinely-different parts stay (redblue's
node-direct isMain workaround, darwin's async streaming for evolve,
harness's dual binaries). test-graceful-degradation.mjs gains
RUFLO_METAHARNESS_CACHE_BASE / RUFLO_METAHARNESS_SKIP_LOCAL seams so the
ADR-150 drill still exercises the degraded path on warm-cache machines.
3. ARCH — smoke.sh derives EXPECTED_TOOLS / EXPECTED_SUBS once from
metaharness-tools.ts / metaharness.ts and replaces the 7 independently
hardcoded literals (15 at :750/:829/:2046, 13 at :725/:851, 16 footnote,
15 success-pattern). Cross-surface value preserved: independent surfaces
(CLAUDE.md catalog, test-mcp-tools' own `tools.length === 15` literal,
footnote appends, runScript refs) are compared against the derived count,
never a surface against itself; a >=15/>=13 floor step catches
extraction-regex rot.
Validation: smoke.sh 122/122, test-graceful-degradation 16/16,
test-mcp-tools 171/171.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(metaharness): add --diagnose GEPA failure diagnosis to evolve
GEPA's key trick — natural-language failure diagnosis from execution traces
feeding the next mutation, not just scalar fitness — scoped modestly into
the evolve wrapper as an opt-in flag.
`evolve.mjs --diagnose` now appends a `diagnosis` section to the emitted
JSON after the run completes: losing/failed variants' transcripts are run
through darwin's gepa `analyzeTranscript` + `classifyFailure` ops (via the
shared importGepa resolver, moved to _darwin.mjs because gepa.mjs runs
main() on import) and aggregated into failure classes + counts + dominant
class per variant.
Upstream shape findings (verified against @metaharness/darwin@0.8.0 with a
tiny mock-sandbox evolve):
- `metaharness-darwin evolve --json` emits a TEXT leaderboard — stdout
carries no JSON and no transcripts (r.json has always been null here).
- Per-variant run records live at <repo>/.metaharness/runs/<id>.json as
sandbox exec traces ({taskId, exitCode, stdout, stderr}) — NOT gepa
{actionRaw, obs} transcripts.
Diagnosis therefore layers: gepa-shaped transcripts when a run record
embeds them (agent sandbox / future upstream) → champion-transcript
fallback → `diagnosis: {available: false, reason, traceSummary}` with a
mechanical per-variant tally. Never fails the run — internal errors
degrade to {available: false, reason: 'diagnosis-failed: ...'}.
Both paths exercised end-to-end: mock evolve yields the traceSummary
fallback; a seeded gepa-shaped run record yields
{available: true, scope: 'losing-variants', failureClasses:
{exploration-loop: 1, edit-mechanics: 1}, dominantClass: 'exploration-loop'}.
Documented in skills/harness-evolve/SKILL.md.
Co-Authored-By: RuFlo <ruv@ruv.net>
* Revert "feat(gaia): submission integrity checklist — fail-closed pre-submit audit (Berkeley RDI hardening)"
This reverts commit
|
||
|
|
402b701a9d |
fix(security): ADR-165 Phase 1 — close 5 critical CVEs + refresh registry + audit CI gate (#2508)
* fix(security): ADR-165 Phase 1 — close all critical CVEs, refresh registry, add CI gate Closes ADR-165 Phase 1. Both workspaces pass `npm audit --audit-level=critical`. ## Before (2026-06-29) | Workspace | Critical | High | Moderate | Total | |-----------|----------|------|----------|-------| | Root | **1** | 6 | 31 | 38 | | v3 | **4** | 33 | 57 | 97 | ## After | Workspace | Critical | High | Moderate | Total | |-----------|----------|------|----------|-------| | Root | **0** | 0 | 31 | 31 | | v3 | **0** | 27 | 58 | 88 | All 5 critical advisories closed (vitest GHSA-5xrq, handlebars prototype-pollution, protobufjs constructor-pollution, plus 2 more in v3). 12 of 39 high advisories closed via overrides; the remaining 27 v3 highs are deeper transitive chains that would require breaking-change major bumps — flagged for ADR-165 Phase 2. ## Changes ### Root workspace overrides (package.json) - `vitest`: `^1.0.0` → `^3.2.6` (closes critical GHSA-5xrq CVSS 9.8) - `hono`: `>=4.11.4` → `>=4.12.25` (closes 6 hono advisories) - `undici`: `>=7.18.0` → `>=8.5.0` (closes 7 undici advisories — bumps the stale pin that ADR-165 flagged as still-in-vulnerable-range) - `vite`: `>=6.4.6` → `>=8.0.16` (closes 2 vite advisories) - NEW `@grpc/grpc-js`: `>=1.14.4` - NEW `form-data`: `>=4.0.6` - NEW `http-proxy-middleware`: `>=3.0.7` - `@hono/node-server`: `>=1.19.10` → `>=1.19.14` ### v3 workspace overrides (v3/package.json + pnpm.overrides) - `vitest`: `^4.0.16` → `^4.1.0` (and `@vitest/coverage-v8` matched) - Top-level + pnpm overrides: `handlebars: >=4.7.9`, `protobufjs: >=8.6.0` - 27 sub-package `package.json` updated to `vitest ^4.1.0` ### CVE registry refresh (v3/@claude-flow/security/src/CVE-REMEDIATION.ts) Rewritten from 5 stale Jan-2026 entries to 16 total: 15 fixed, 1 open (ADR165-OPEN-01 — PII pipeline wiring per ADR-164 §6.1 not yet on dispatch-layer). `SECURITY_SUMMARY` is now computed dynamically from the registry; `validateRemediation()` correctly returns `allFixed: false` with 1 issue. ADR-165 §5 flagged this as THE Phase 2 priority — now closed. ### New CI gate `.github/workflows/cve-audit.yml`: - `audit-root` — `npm audit --audit-level=critical` in root, blocking - `audit-v3` — same in v3, blocking - `audit-high-report` — warn-only summary on high-severity drift - Triggers: PR, push to main, daily cron ### ADR-165 §9 evidence ledger addendum Captures AFTER-remediation `npm audit --json` metadata for both workspaces. The diff between BEFORE (already in §9) and AFTER makes Phase 1 verifiable. Also CORRECTED one prior surprise in §9: the `validate-input.ts` in `mcp-tools/` is NOT a 9-line shim. It's 269 lines of real implementation. (That was an inaccurate findings note from the initial audit.) ### §7.3 research items resolved - `protobufjs` v3 chain confirmed gone after override pins - `handlebars` v3 chain confirmed not user-reachable on the workflow path (toolchain-only; override sufficient) - `validate-input.ts` confirmed real implementation, not a shim (registry entry corrected) - CORS surface check: no `cors()` / `app.use(cors` call sites — the hono CORS-wildcard advisory is not exploitable on the current server - ADR-164 §6.1 PII pipeline NOT wired in current agentbbs dispatch — recorded as ADR165-OPEN-01 (Phase 3 work) ## Gates (all PASS) - `npm audit --audit-level=critical` root: exit 0 (was non-zero) - `npm audit --audit-level=critical` v3: exit 0 (was non-zero) - vitest suites: 105/109 pass (4 skip-conditional — same as before) - ADR-112 audit: 352/352 tools with guidance - business-pods smoke: 11/11 PASS - agentbbs smoke: 8/8 PASS - agenticow smoke: 8/8 PASS - cli build: clean (tsc) ## Phase 2+ deferred The 27 v3 high-severity advisories that remain are transitive chains with no patched-in-range version. ADR-165 §6 Phase 2 picks these up after the `cve-watch.yml` automation in §6 lands (NEW PR — not in scope here). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01WbBa4nccx5aGhXphoHxcni * chore(lock): regen v3/pnpm-lock.yaml after override updates (PR #2508 CI fix) PR #2508 added handlebars + protobufjs to v3 overrides + bumped vitest pin, but v3/pnpm-lock.yaml wasn't regenerated. CI surfaced ERR_PNPM_LOCKFILE_CONFIG_MISMATCH on every install step. Same pattern as the previous lockfile-drift fixes on PR #2500 and #2503. * fix(ci): cve-audit.yml jq-only + regen witness manifests for #1609 marker drift Two PR #2508 CI failures fixed: 1. Static-regression-guard tripped on cve-audit.yml line 52: the static YAML strict-parser sees `if high > 0:` inside the `run: |` block as a YAML block-mapping key indicator. Refactored all 3 inline-python blocks to use jq (preinstalled on ubuntu-latest) — no embedded `if x > 0:` lines, so the YAML guard passes. 2. Witness marker drift smoke flagged fix-marker #1609 — the Phase 1 vitest bump (4.0.16 → 4.1.0) drifted the cited marker string in v3/@claude-flow/aidefence/package.json. Updated `marker` field in all 3 platform manifests + `desc` to reference ADR-165 Phase 1, then re-signed via plugins/ruflo-core/scripts/witness/regen.mjs. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
d112d4fc8b |
fix(memory): #2432 #2431 + release 3.13.1 — close prior controllers, WAL-safe graph-edge writes
PATCH per semver — pure bug fixes, no API changes. Fixes: #2432 — Unbounded sql.js MEMFS leak (~36 GB observed in production) Root cause: ControllerRegistry.initController() called controllers.set(name, ...) without closing the prior instance. SqlJsRvfBackend wrappers held an Emscripten MEMFS file (~11 MB each = sizeof memory.db) that only releases on explicit .close() — JS GC of the wrapper does NOT reclaim MEMFS because the sql.js module is a process singleton. Fix: added closePriorIfAny(name) helper, called before every controllers.set() site in v3/@claude-flow/memory/src/controller-registry.ts. Best-effort close (catches errors so replacement always proceeds). #2431 — graph-edge-writer.ts dual-write corrupts memory.db (ADR-130 regression) Root cause: sql.js opened memory.db, did in-memory writes, then called fs.writeFileSync(dbPath, db.export()) after every edge insert. This whole-file flush overwrote memory.db while the better-sqlite3 bridge was writing through its WAL — exactly the dual-write race that ADR-068 (#1257) removed. Symptom: PRAGMA integrity_check reports "database disk image is malformed (11)" after a single memory_store + causal-edge sequence. Fix: ported v3/@claude-flow/cli/src/memory/graph-edge-writer.ts from sql.js to better-sqlite3 + WAL mode. Same native engine as the bridge, no whole-file fsync, no race. Public API unchanged. Smoke-tested: 50 concurrent insertGraphEdge() calls + PRAGMA integrity_check → ok. Note: this is the minimum-safe fix. The architecturally cleaner fix (route edge writes through the bridge's controller layer per ADR-068) is deferred to a future ADR. The current fix removes the race by ensuring both writers share the same WAL-coordinated SQLite engine. Version bumps: - @claude-flow/memory 3.0.0-alpha.20 → 3.0.0-alpha.21 - @claude-flow/cli 3.13.0 → 3.13.1 (pins memory ^3.0.0-alpha.21) - claude-flow umbrella 3.13.0 → 3.13.1 - ruflo wrapper 3.13.0 → 3.13.1 Published to npm with all three dist-tags (latest, alpha, v3alpha) for each of the four packages. Verified post-publish: every package × every tag = 3.13.1 (memory at alpha.21). Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
5681939173 |
chore(release): 3.10.39 — ADR-147 entity arm + signal provenance (#2317 #2327)
@claude-flow/memory 3.0.0-alpha.19 → 3.0.0-alpha.20. Adds the entity arm
to hybridSearch alongside the existing dense + sparse RRF fusion, plus
per-result signals: ('vector'|'bm25'|'entity')[] provenance.
End-to-end capability smoke against built dist confirmed: Alice needle in
31-doc corpus ranks #1 with all three signals; runner-up has only
vector+bm25 — RRF score gap of ~47%.
@claude-flow/cli, claude-flow, ruflo 3.10.38 → 3.10.39. CLI also pins
@claude-flow/memory to ^3.0.0-alpha.20 so the wrapper users pick up the
entity arm automatically.
All four packages published with latest+alpha+v3alpha aligned.
Lockfile regen included (lesson from #2311 — bumping a workspace dep
without regenerating v3/pnpm-lock.yaml breaks frozen-lockfile CI).
Co-Authored-By: RuFlo <ruv@ruv.net>
|