The repo-root CI run (npm workspaces) does not install @claude-flow/memory's
optional dependencies, so the backend assertions for sublinear-core failed
there. The in-tree cases still run everywhere; the sublinear-core cases run
in the package's own suite.
Co-Authored-By: claude-flow <ruv@ruv.net>
MemoryGraph.computePageRank (memory-graph.ts) stopped on a per-node change
below 1e-6 within 50 iterations. On a 10k-node graph it exited after 10
iterations with an L1 error of 1.46e-4 (max 3.95e-7) against an exact
solution. It now stops on the L1 change (default 1e-10, up to 200
iterations): 30 iterations, L1 error 2.76e-11.
GraphOperations.pageRank (plugins gnn.ts) had three mass leaks:
- personalization: nodes missing from the map still got the uniform 1/n
teleport on top of the personalization weights, so a single-seed run
summed to 1.98;
- isolated nodes lost their mass (global runs summed to 0.983);
- weighted runs divided by the neighbour count instead of the neighbour's
total edge weight (scores summed to ~8e12 on a weighted test graph).
Teleport is now the normalized personalization restricted to graph nodes,
dangling mass is redistributed by it, and weights are normalized by
out-strength.
Both use @ruvnet/sublinear-core (^1.0.1, zero deps) as an optional
dependency, loaded lazily via createRequire, with an in-tree fallback of
the same semantics (pagerank.ts, one copy per package).
Tests: both backends sum to 1 and match an independent power iteration
within 1e-9 (global, personalized, weighted, MemoryGraph), and the fallback
is used when the package is absent.
Co-Authored-By: claude-flow <ruv@ruv.net>
agentdb ^3.0.0-alpha.20 -> ^3.7.2 (filtered search and in-memory
isolation the backends rely on). Workspace lockfile now resolves agentdb
3.7.2 everywhere. memory@3.2.5 is published before merge, which
audit-leaf-versions-published requires.
Co-Authored-By: claude-flow <ruv@ruv.net>
search() fetched k*2 neighbours from the HNSW graph and then dropped
entries that failed the namespace/tags/type filters, and
query({type: 'semantic'}) intersected a fixed top-`limit` with the
filter (and returned the survivors in insertion order). Selective filters
therefore returned fewer than k results.
Measured on 3,000 random 64-dim unit vectors, 25 queries, k=10:
- 1% namespace filter: 2/250 results, recall@10 0.008 -> 250/250, 1.000
- 35% tag filter: 178/250, 0.712 -> 250/250, 1.000
- query({type:'semantic', namespace}) with 1% selectivity: 0 hits -> 10,
ranked by similarity
Both paths now rank the filtered candidates. Candidate sets up to
max(1000, 8k) are scored exactly with the index metric. Larger ones widen
the HNSW fetch (k*2, then x4) until k candidates are found or the index is
exhausted. search() and the brute-force path now honour the same filter
fields as query() (they ignored memoryType, keyPrefix, ownerId, ...).
Expiry handling in search() is unchanged.
Co-Authored-By: claude-flow <ruv@ruv.net>
The SQLiteBackend migration is in @claude-flow/memory, which the CLI
resolves from the registry, so the leaf-package publish audit (#3335)
requires a bump and a matching CLI pin. memory@3.2.4 is published right
after this merges. The federation pin moves to the 1.0.7 already on npm
(GHSA-vcv2 peer range, #4890).
Co-Authored-By: claude-flow <ruv@ruv.net>
Re-applies dskarasev's #1426 on current main.
SQLiteBackend: a memory.db created by the CLI's memory-initializer DDL has no
access_level, version or "references" column. CREATE TABLE IF NOT EXISTS left
that table alone, so every store() failed with "table memory_entries has no
column named access_level". initialize() now adds the missing columns (and
access_count / last_accessed_at for older DDLs) with createDefaultEntry()
defaults.
memory_store: accepts an optional `metadata` object and persists it on both
write paths (AgentDB bridge and sql.js fallback), which both hard-coded '{}'.
Arrays, null and scalars are rejected at the MCP boundary.
Tests: sqlite-backend-legacy-schema.test.ts (fails on main with the
no-such-column error) and memory-store-metadata-1426.test.ts (sql.js path,
bridge path, input check; 6 of 7 fail on main).
Co-Authored-By: dskarasev <dskarasev@users.noreply.github.com>
Co-Authored-By: claude-flow <ruv@ruv.net>
* fix(memory): RvfBackend search through hnsw-index.ts (recall@10 0.09 -> 0.89)
RvfBackend's inlined HnswLite seeded every search from the first
efConstruction vectors in insertion order and BFS'd a flat neighbour graph,
and each insert was an O(n) brute-force scan. Measured against exact search
on 5,000 random unit vectors (cosine, 200 queries, seed 42):
index 384-dim recall@10 1536-dim clustered 384
HnswLite (before) 0.091 0.079 0.999
@ruvector/diskann 0.1.3 0.896 0.739 1.000
hnsw-index.ts, ef=200 0.888 0.744 0.990
DiskANN matched HNSWIndex on recall but a vector inserted after build() is
not searchable until a full rebuild (3.6-4.3 s at 1k vectors), which breaks
store()-then-search(). HNSWIndex is incremental and is the single HNSW
implementation ADR-125 asks for, so RvfBackend now uses it through a private
RvfVectorIndex (not exported; the prepublishOnly surface check still passes).
- indexes of <= 1000 vectors and dimension-mismatched queries use an exact scan
- distances map back to the old similarity scale; threshold filter unchanged
- re-storing an entry without an embedding removes its old vector
- update() re-indexes when an untyped caller passes an embedding
New rvf-backend-recall.test.ts drives the real RvfBackend.search: recall@10
>= 0.9 on 2000 random 64-dim vectors (HnswLite scored 0.294 there), exact
results at 300 vectors, delete/re-store correctness, recall after reopen.
@claude-flow/memory 3.2.2 -> 3.2.3.
Co-Authored-By: claude-flow <ruv@ruv.net>
* chore(memory): leave the version at 3.2.2 in this PR
audit-leaf-package-publish requires the CLI pin to cover the workspace
version, and audit-leaf-versions-published requires that pin to exist on the
registry. The 3.2.3 bump, its publish and the CLI pin move together in the
release that follows.
Co-Authored-By: claude-flow <ruv@ruv.net>
* release(memory): @claude-flow/memory 3.2.3, CLI pins it
The RvfBackend change has to reach users through a standalone publish:
memory is not bundled into the release tarballs (Publishing Rules).
@claude-flow/memory@3.2.3 is published from this branch's tree; the CLI pin
(dependencies + optionalDependencies) moves to it so audit-leaf-package-publish
and audit-leaf-versions-published both hold. The lockfile also gains the
@ruvector/sona 0.1.10 package entries pnpm reported missing.
Co-Authored-By: claude-flow <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* fix(memory,neural): persist AgentDB SQL fallback, reuse cached sizes, average MoE P_i
- memory (#4410): AgentDBBackend's SQL fallback gated on db.run/db.get, which
agentdb's prepare/exec handle never has, so no table was created and every
write was a silent no-op. Use prepare().run/get with spread params (safe on
better-sqlite3 and agentdb's sql.js shim) and quote the "references" column.
- memory (#4481): CacheManager stores each entry's size on its LRU node and
refunds that number on overwrite/delete/eviction instead of re-serializing.
- neural (#4381): computeLoadBalanceLoss() uses the mean gate probability over
the same route() history as f_i, persisted and reset with the routing stats.
- Bump @claude-flow/memory 3.2.2, @claude-flow/neural 3.0.2.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(cli): pin @claude-flow/memory 3.2.2 and @claude-flow/neural 3.0.2 (both published)
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* fix(aidefence): restore the ADR-118 wider-detection pass to source (3.0.4)
@claude-flow/aidefence 3.0.3 (npm latest) was published from an uncommitted
tree carrying the ADR-118 / #2004 patterns, so main never had them, and
main's #3177 ReDoS bounds never reached npm. 3.0.4 is a true superset:
the verb-noun override window, behave-as role hijack and god/root/admin/sudo
mode jailbreak markers, on top of main's bounded PII/marker regexes.
Parity against the published 3.0.3 dist: 24-input corpus, 0 regressions.
Drops publishConfig.tag=alpha. Refs #4625.
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(aidefence): merge AIMDS pattern packs into ThreatDetectionService (3.1.0)
Vendors the AIMDS pack engine (normalize, decoders, pattern-loader, engine)
and its six pattern packs (53 patterns) from midstream AIMDS at abe78d6 into
src/domain/services/packs/. Packs are embedded as TS modules, so they load
from the published ESM dist with no fs path lookup; the files allowlist is
unchanged.
ThreatDetectionService.detect() runs the packs in a second pass over the raw
input and merges findings into the existing result shape (one threat per
type, as before). Built-in patterns, including the ADR-118 extras, stay and
their confidences are unchanged. Packs are on by default; disable or select
them with createThreatDetectionService({ packs }) or createAIDefence({ packs }).
The legacy pattern-array argument still works.
- ThreatType gains tool_invocation, data_exfiltration, markup_forgery;
Threat gains an optional ruleId (e.g. EX-001) for pack findings.
- Packs are validated, compiled and regex-warmed once per process, so
isSafe()/checkThreats() no longer pay a compile per call and the first
detect() is not charged ~17 ms of lazy regex compilation.
- Fixes a quadratic regex in the vendored normaliser (undoLeet): 100 KB of
hex digits took 1.8 s; now 6 ms. Decoders cap each blob before decoding.
Corpus (55 attacks / 30 legit): built-ins only 8/55, packs on 55/55; false
positives F13 and F27 in both modes (built-in encoding_attack), pinned.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(memory): build AgentDB controllers with an embedder and the shared vector backend
LearningSystem, NightlyLearner, ExplainableRecall and the graph transformer's
CausalMemoryGraph take (db, embedder, ...). The registry passed only the
database, so the first predict/discover/recall threw on this.embedder (the
#3327 Finding A class, fixed for ReasoningBank only). Real-agentdb test fails
on the old source (learningSystem.embedder undefined). memory suite 659/659.
Adds ADR-513 (stable versions, convergence) and ADR-516 (aidefence recovery).
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(cli): move to agentic-flow ^2.2.0 (main line); stable-only tag policy
- agentic-flow ^3.0.0-alpha.1 resolved to the March 3.0.0-alpha.2, which
pulled @xenova/transformers -> onnx-proto -> protobufjs 6 (critical).
2.2.0 is agentic-flow's main line (ADR-515). The update validator and the
init doc table follow.
- neural-tools: computeEmbedding returns a Float32Array, which JSON.stringify
writes as {"0":...}; convert to an array before the neural store.
- CLAUDE.md: no more alpha/v3alpha/next dist-tags (ADR-513); overrides do not
reach users; examples use ruflo@latest.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(cli): pin @claude-flow/aidefence 3.1.0 (AIMDS pattern packs)
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(cli): target agentic-flow ^3.0.0 (first stable 3.x, ADR-515)
agentic-flow's security defaults change in a breaking way (agents no longer
bypass permissions by default, proxies need a token), so the main line ships
as 3.0.0 rather than 2.2.0. That also gives the 3.x alpha line a stable head:
existing ^3.0.0-alpha.1 installs resolve to it and drop the March alpha's
protobufjs 6 (critical).
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(memory): capture AgentDB's backend failure reason from stderr too
agentdb 3.0.0 moves library diagnostics off stdout (they corrupted stdio MCP
JSON-RPC), so the #4622 lock-reason capture patches console.error as well.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-514 agentdb 3.0.0, ADR-515 agentic-flow 3.0.0, ADR-517 AIMDS pattern packs
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(memory): 3.2.1 (embedder wiring, stderr reason capture)
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(release): 3.67.0 — agentdb 3.0.0, agentic-flow 3.0.0, aidefence 3.1.0, memory 3.2.1
- CLI and the claude-flow umbrella declare agentic-flow ^3.0.0 (root lock and
v3 pnpm lock resolve 3.0.0 / agentdb 3.0.0).
- CHANGELOG 3.67.0.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test/docs: dated ADRs 513-517; scope the bracket/DAN timing test to built-ins
- ADRs 513-517 gain Date lines (the console ADR parser expects >97% dated)
and ADR-513/516 name the versions that shipped (agentic-flow 3.0.0,
aidefence 3.1.0).
- threat-detection 'bounds the bracket and DAN patterns' measures the
built-in regexes it was written for ({ packs: false }); the AIMDS packs
have their own 100 KB adversarial timing test. Full detector on that input:
86 ms locally, 301 ms on the CI runner (linear, budget was 200 ms).
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(deps): stop pinning ruvector 0.2.27 under agentdb 3.0.0; CLI agentdb ^3.0.0
The root (and ruflo wrapper) overrides pinned ruvector ^0.2.27 from the BEIR
work (3.10.29). npm applies overrides inside this repo's tree, so CI ran
agentdb 3.0.0 on ruvector 0.2.27, below agentdb's own ^0.2.40: a pairing no
user ever installs (published overrides are ignored), and the one where #2226
pattern recall failed on CI. Raised to ^0.2.41.
The CLI's agentdb range moves to ^3.0.0 (stable; no alpha ranges, ADR-513),
so the v3 pnpm lock resolves 3.0.0 and the v3 test job exercises what users
get instead of 3.0.0-alpha.20. 115 agentdb/memory-related CLI test files:
868/868 on 3.0.0.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
- ControllerRegistry keeps the first backend failure AgentDB logs (e.g. a
native vector store locked by another process) instead of only the last
fallback's format rejection, exposed as getAgentDBInitError(), with the
single-owner HTTP remedy. @claude-flow/memory 3.2.0.
- The CLI bridge records that reason, so the sql.js fallback's refusal names
it, and isBridgeAvailable() is false when AgentDB did not open.
- memory_list returns success:false with the error on a failed query instead
of an empty inventory.
- Release 3.66.1 with plugin-agent-federation 1.0.4 (#4619 trust thresholds).
Co-authored-by: r <r@x>
* dream(memory): wire ControllerRegistry.set() so MutationGuard/AttestationLog activation stops being dead code
memory-bridge.ts's post-init controller-activation wiring (reasoningBank,
learningSystem, skills, semanticRouter, gnnService, rvfOptimizer,
mutationGuard, attestationLog, guardedVectorBackend) has always gated
registration on `typeof reg.set === 'function'`, falling back to an
unread `reg._controllers` property otherwise. ControllerRegistry never
implemented a public set() method, so every external activation silently
took the dead fallback: registry.get('mutationGuard')/get('attestationLog')
always returned null, permanently disabling write-mutation validation
(fail-open "no guard installed = allow") and audit logging (silent no-op)
on the real store/delete/purge paths. Same bug shape as the already-fixed
#3327 Finding A (reasoningBank.store never existed, so its own
typeof-guard was dead too).
Adds ControllerRegistry.set<T>(name, instance) mirroring the shape
initController() already produces internally. Zero changes needed at any
of the 9 memory-bridge.ts call sites.
5 new discriminating tests reproduce memory-bridge.ts's exact activation
pattern; stash-isolated baseline fails all 5 (TypeError: registry.set is
not a function), candidate passes all 5. Full @claude-flow/memory suite:
650/651 both ways (1 pre-existing environmental failure, byte-identical,
unrelated chmod/root-bypass test). tsc --noEmit: 0 errors.
Evaluated, pending independent adversarial critique.
* dream(memory): close prior instance on ControllerRegistry.set() (post-critique)
Independent adversarial critique of afe2cdd found set() silently dropped
a reference to any pre-existing resource-holding instance on overwrite,
reintroducing the exact leak class #2432 fixed for initController()'s own
replacement path (unclosed sql.js/WASM resources, ~36GB over 6 weeks in
production per that commit's own account). Not currently triggerable
through the shipped memory-bridge.ts wiring (every real call site guards
with `if (!reg.get(name))` first), but the set() API itself offered no
protection.
Fix: dispatch the existing closePriorIfAny(name) before overwriting the
map entry, same as initController() does. Intentionally not awaited, so
get(name) still reflects the new instance synchronously; the old
instance's close()/dispose() (best-effort, errors swallowed) runs in the
background — matches every other call site's synchronous-looking
registration contract.
1 new discriminating test added. Full @claude-flow/memory suite:
651/652 (1 pre-existing environmental failure, unchanged). tsc --noEmit:
0 errors.
Known, disclosed, not-fixed-tonight limitation (out of scope, needs a
human call on correct init ordering): `causalRecall` is the one
ControllerName absent from every INIT_LEVELS entry, so shutdown()'s
by-static-list lookup would never find/close a controller registered
under that name via set() — unexercised today (no call site uses it).
Flagged for a future night rather than guessed at here.
* dream(memory): add 2026-10-28 SOTA research gist (gist publishing unavailable, FALLBACK)
No gh CLI / gist-creation tool reachable this session — same disclosed
FALLBACK as every night since 2026-09-30. Full SOTA report committed to
docs/dream-cycle/ instead of a gist.github.com URL.
* dream(memory): #4549 update LEDGER for 2026-10-28
* dream(memory): bump @claude-flow/memory to 3.1.0 (CI: leaf-package-publish audit)
CI's "Plugin package install-safety" job (scripts/audit-leaf-package-publish.mjs,
guarding ruvnet/ruflo#3335 and #3390/#3327 Finding A) correctly failed: this PR's
source change to v3/@claude-flow/memory/src/controller-registry.ts is publishable
(adds a new public method) but @claude-flow/memory's own package.json version was
unchanged at 3.0.9 — @claude-flow/memory is not bundled into the release train, so
publishing cli/claude-flow/ruflo without also bumping+publishing this leaf would
ship the OLD copy and this fix would reach nobody.
Bumped @claude-flow/memory 3.0.9 -> 3.1.0 (MINOR: backward-compatible new public
method). Updated the two exact pins in v3/@claude-flow/cli/package.json
(dependencies + optionalDependencies) to match, and regenerated v3/pnpm-lock.yaml
via `pnpm install` (never hand-edited) so the lockfile's specifier stays in sync.
Verified locally: node scripts/audit-leaf-package-publish.mjs --base origin/main
now reports "ok: every non-bundled leaf is covered by the CLI range and carries a
bump if changed". Full @claude-flow/memory suite re-confirmed 651/652 (same
pre-existing environmental failure), tsc --noEmit 0 errors.
Note for a future release: per CLAUDE.md's publishing rules, @claude-flow/memory
must be published standalone alongside the next @claude-flow/cli release for this
fix to actually reach consumers — not done as part of this draft PR.
---------
Co-authored-by: Claude <noreply@anthropic.com>
* fix(memory): distinguish recent dead locks from live writers
inspectAgentdbLock() labeled a dead holder as 'live' when the lock was younger than the 10s stale threshold. The same state then produced 'another process is writing this database' guidance, so callers could wait for a writer that did not exist or leave a recoverable lock in place indefinitely (#3979 item 5).\n\nAdd a distinct 'recent' LockState for dead-PID locks still inside the stale window, clamp clock-skewed ages to zero, and give withAgentdbLockRecovery a precise retry message. The guard still refuses to clear the lock until it is old enough; only the diagnosis changes.
* chore(memory): bump @claude-flow/memory to 3.0.9
The leaf-package-publish audit correctly requires a version bump whenever publishable @claude-flow/memory source changes. Bump the leaf and both CLI dependency pins, and update the pnpm importer specifier, matching the #4279/#4152 release pattern.
* fix(memory): adapt real AgentDB HNSWIndex with safe fallback
Verify actual native search, mutation lifecycle, concurrency and exact fallback.
Include source-bound regression and bounded benchmark evidence for #4249.
No persistence or package-release claim.
* fix(memory): preserve expiry and vector ownership across native search
Keep TTL-bearing semantic queries exact and detach stored/returned vectors.
Snapshot query vectors before awaits. Add three real-native regressions and
refresh the verification receipt: 645 tests pass; disclose transient timing miss.
* fix(memory): bump @claude-flow/memory to 3.0.8 for the real HNSW adapter
#4249's leaf-package-publish audit correctly flagged that
agentdb-backend.ts/agentdb-hnsw-adapter.ts changed source but the
package version was still 3.0.7. Bumps the leaf, the CLI's exact pin,
and the pnpm-lock.yaml specifier together so the fix actually ships.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* dream(memory): #4137 AutoMemoryBridge was additive-only, never delete-synced removed/vanished source content
importFromAutoMemory() diffed new content against AgentDB by content-hash
to insert/skip, but never detected or deleted an entry whose source
heading (or whole source file) was removed — deleted memory content
stayed retrievable via semantic search indefinitely. Adds a per-source-
file key diff (reusing the existing single bulk query, zero schema
change) plus a second pass for files removed entirely from disk, each
with a false-full-wipe guard. Evaluated: 7 new discriminating tests,
baseline-fails/candidate-passes via stash isolation; full suite and tsc
clean modulo pre-existing/unrelated flakes. Adversarial critique found
and this session fixed forward the whole-file-removed gap and a vacuous
test assertion before this commit.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
* dream(memory): #4137 append 2026-10-13 ledger row
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
* fix(memory): #4137 bump @claude-flow/memory to 3.0.5 for the delete-sync change
CI's leaf-package-publish audit caught this: @claude-flow/memory is a
non-bundled leaf that resolves from the registry for the release train,
so a publishable source change (auto-memory-bridge.ts) must bump the
leaf's own version or the fix silently never reaches a release. Bumps
the leaf's package.json, the CLI's exact pin (dependencies +
optionalDependencies), and the matching pnpm-lock.yaml specifier.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
* fix(memory): #4137 scope delete-sync to the writing memoryDir, avoid version collision with #4183
Review finding: the backend can be shared across multiple memory dirs
(e.g. the SessionStart hook's main dir vs. a worktree dir from
worktreeMemoryDir()). Without recording which memoryDir wrote an entry,
importing one dir could see another dir's same-named file/heading as
"gone" and delete it. Entries now carry metadata.memoryDir, and both
delete-sync passes (per-heading diff and whole-file-removed) only
consider entries whose memoryDir matches the importing bridge's own —
legacy entries written before this field existed (no memoryDir at all)
are therefore never delete-sync eligible. Two new discriminating tests
cover cross-dir isolation and the legacy-entry case; all 9 existing
delete-sync fixtures updated to carry memoryDir so they still exercise
the intended "same dir" path rather than being silently excluded.
Also bumps @claude-flow/memory to 3.0.6 (CLI pins + lockfile specifier)
since #4183 independently claimed 3.0.5 for the same leaf — whichever
of the two PRs lands second needs a version past the other's.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
* fix(memory): #4137 revert stray codex/security/shared lockfile drift
An earlier `pnpm install` run in this session (unrelated to this PR's
own change) left pnpm-lock.yaml recording codex/security/shared at
specifier 3.0.6 while v3/@claude-flow/cli/package.json still pins them
at 3.0.5 — a mismatch that got swept into a prior commit by staging the
whole lockfile file. `pnpm install --frozen-lockfile` (what CI runs)
fails on that drift regardless of this PR's actual content. Reverted
those three specifiers back to 3.0.5 to match package.json; the memory
specifier bump to 3.0.6 (this PR's real change) is untouched. Verified
locally: `pnpm install --frozen-lockfile` now succeeds.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
* chore(memory): untrack test-generated agentdb.rvf.idmap.json
Swept into the previous merge commit by running the test suite to
verify the merge; it's a fresh-run artifact (empty idToLabel/labelToId
maps), not source. Added to .gitignore alongside the other *.rvf
test-pollution exclusions in this package.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(memory): bump @claude-flow/memory to 3.0.7 for the delete-sync fix
AutoMemoryBridge.importFromAutoMemory()'s delete-sync fix in this PR
changed v3/@claude-flow/memory/src/auto-memory-bridge.ts without
bumping the package version. @claude-flow/memory is not bundled into
the release tarballs — it resolves from the registry — so publishing
the three train packages without this bump would ship the old 3.0.6
copy and the fix would reach nobody (ruvnet/ruflo#3335, #3390).
Will publish @claude-flow/memory@3.0.7 standalone once this merges.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(memory): #4137 bump CLI pins + lockfile specifier to match memory@3.0.7
761b8386 bumped the leaf's own package.json version to 3.0.7 but left
v3/@claude-flow/cli/package.json's exact pin (dependencies +
optionalDependencies) and the matching pnpm-lock.yaml specifier at
3.0.6 — the leaf-package-publish audit catches this: an exact pin of
"3.0.6" is not satisfied by workspace version 3.0.7, so a release would
resolve to an older published copy than the source in this repo.
Verified: audit script passes, `pnpm install --frozen-lockfile`
succeeds.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01UkpQrJUNdFzDJVnY2FzXh8
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: r <r@x>
* chore(release): 3.58.0 version bumps and changelog
Minor release: new memory peek command, Codex activity viewer, configurable
MCP rate limits, plus the #4303 install-breaking fix and a round of
correctness fixes merged since 3.57.2. Also bumps ruflo-console 0.44.4 ->
0.44.5 for the #4305 TUI fix, which shipped to main without a plugin version
bump (the same gap already documented as a past mistake in the console's own
changelog for 0.44.3/0.44.4).
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ruflo-console): update smoke.sh's hardcoded version check to 0.44.5
The plugin.json version bump to 0.44.5 (for the #4305 TUI fix) broke the
smoke contract's own hardcoded expectation of 0.44.4 in step 1. Update the
step name and grep pattern to match.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): sync the smoke-workflow regression test to the real 15-minute timeout
#3950 bumped .github/workflows/all-plugins-smoke.yml's smoke-all job from
timeout-minutes 10 to 15 (the job now also checks out and smokes the first
external git-subdir marketplace entry, agentic-qe-fleet) but never updated
this test's hardcoded expectation of 10, breaking the Test Suite job on
every PR since.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(memory): resolve sql.js's wasm dist path directly, not via package.json
fts5.test.ts located sql-wasm.wasm via require.resolve('sql.js/package.json')
then string-replaced the suffix. sql.js 1.14 tightened its exports map to
"." and "./dist/*" only, so that package.json subpath resolve throws
ERR_PACKAGE_PATH_NOT_EXPORTED even though the wasm file is present on disk —
caught by the existing try/catch and misreported as "sql.js isn't installed",
failing all 4 SqlJsBackend FTS5 tests with "sql.js/dist/sql-wasm.wasm not
found". Resolve 'sql.js/dist/sql-wasm.wasm' directly instead, which the
"./dist/*" export already permits.
Verified: 6/6 passing locally (was 4 failed before the fix).
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): move pod-tick.test.mjs to the node:test exclusion list
Same fix as #4308: this file imports test() from node:test (not vitest)
and documents itself as "Run with: node --test" in its own header, but
was miscategorized into ci-test-baseline.txt. Running it under vitest's
shared worker process correlates strongly with the ERR_IPC_CHANNEL_CLOSED
crash hit 4/6 times on this PR's own CI (#4307). Applying here directly so
this release doesn't wait on #4308 to merge first.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): cap the ratchet's vitest worker count to 2
#4307: Test Suite (ubuntu-latest) intermittently crashes with tinypool's
ERR_IPC_CHANNEL_CLOSED at three different, unrelated points across 7 runs
on this PR, after ruling out any specific file as the cause (one
candidate, pod-tick.test.mjs, was fixed separately for an unrelated
reason and the crash still recurred at a different file). The pattern
(crash location varies, happens ~60-90s into a ~9500-test run) is more
consistent with cumulative memory pressure across the default fork
pool (one fork per CPU, ~4 on a standard runner) than a single bad
test. Capping workers at 2 trades some wall-clock time for headroom
while the real cause is still open in #4307.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(graph-intelligence): build the optional cli import specifier from parts
#4307 investigation, round 8: once the worker-cap fix (3739f3a9) stopped
the random tinypool crash, Test Suite started failing deterministically
on plugins/ruflo-graph-intelligence/tests/phase4-adapters.spec.ts —
"./src/memory/graph-edge-writer.js" is not exported, even though that
spec file's own tests never execute the real GraphEdgesSource.listEdges()
(they all use inline fake listEdges() test doubles). The spec file does
statically import knowledge-graph-adapter.ts at module level, though, so
vitest's module-graph crawl sees the string literal and (CI-only, not
reproduced locally in 2/2 attempts) appears to eagerly resolve it outside
this method's own try/catch during collection.
Build both the primary and fallback specifiers from joined array parts
instead of literals, so no bundler's static import-specifier scan can
find and pre-resolve them — the actual resolution still only happens at
the real `await import(...)` call site, same as before.
Verified: full plugin suite green, 104/104 (was 8/8 on the one affected
file already — this closes the only CI-only gap).
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): baseline token-optimizer.test.ts — real, pre-existing, unrelated bug
v3/@claude-flow/integration/src/token-optimizer.ts calls
this.agentBooster.editCode(...), but the real agentic-flow/agent-booster
module's AgentBooster/EnhancedAgentBooster class has no editCode method
at all (its real API is apply/applyBatch/prefetch/...). Confirmed by
enumerating the class prototype directly. Not a version-pin issue, not
caused by anything in this release — @claude-flow/integration isn't even
part of the release train. Filed as #4311 with the real-fix suggestion
(rewrite optimizedEdit() against the actual API) for whoever owns that
integration layer; baselining here so the Test Suite ratchet reflects
reality instead of blocking an unrelated release on pre-existing debt.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(changelog): record the CI-reliability fixes found validating 3.58.0
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
The leaf-package-publish audit requires a version bump when publishable
memory source changes. Same shape as #4152: memory/package.json, both CLI
dependency entries, and the CLI importer's specifier in v3/pnpm-lock.yaml.
Co-Authored-By: RuFlo <ruv@ruv.net>
tryNativeInit() called an instance open() that the @ruvector/rvf SDK
doesn't have (it only has the static RvfDatabase.create/open), so init
always threw, the catch swallowed it, and every install ran pure-TS.
Correcting only that call would turn a silent fallback into silent data
loss: initialize() skipped loadFromDisk() on the native path, while store,
search and persist still went through the in-memory map, so the next
persistToDisk() would overwrite databasePath with only the new entries.
The SDK is a vector index (u64 ids, {id, distance} results, no payloads),
so it can't be the store for MemoryEntry records. Remove the branch and
keep the pure-TS backend that already runs everywhere. healthCheck() no
longer recommends installing @ruvector/rvf.
Adds rvf-backend.test.ts: reopen reloads and keeps the snapshot even when
an @ruvector/rvf whose factories succeed is importable. It fails against
main and against the open()-only fix.
Fixes#4279
Co-Authored-By: RuFlo <ruv@ruv.net>
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).
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.
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.
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.
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>
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
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>
* 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>
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>
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>