Add cryptographic tamper-evidence to the paper→live promotion gate.
Mirrors the CWE-347 plugin-registry pattern (#1922): canonical body =
JSON.stringify without signature fields; verifier pins to a caller-
supplied trustedPublicKey, NOT to the served self-asserted
witnessPublicKey (which an attacker can swap freely).
- src/signed-artifact.{ts,mjs}: SignedBacktestArtifact schema + signer
+ verifier. Both files kept in sync; .mjs is the runtime the smoke
imports directly (plugin has no build step).
- skills/trader-backtest: signs the artifact before store. Resolves
the key via RUFLO_WITNESS_KEY_PATH → verification/witness-key.json
→ loud degraded-unsigned warning. Never silent.
- skills/trader-cloud-backtest: verifies the artifact against the
pinned trusted pubkey BEFORE promoting to a live strategy. Refuses
to promote on verify failure (fail-closed).
- scripts/smoke-neural-trader-backtest-signing.mjs: three-layer smoke
modeled on smoke-plugin-registry-signature.mjs. Static contract,
crypto round-trip (tampered/empty/swapped-served-key/wrong-trusted-key),
and call-site byte check on the SKILL.md files.
- .github/workflows/v3-ci.yml: neural-trader-backtest-signing-smoke job
+ path triggers for the artifact files + both skill SKILL.md files.
Smoke output: 21/21 checks pass. Phase 3 portfolio-CG smoke unchanged.
Plugin smoke (scripts/smoke.sh): 11/11 still pass.
Refs #2068
Co-Authored-By: RuFlo <ruv@ruv.net>
Wires the Conjugate-Gradient mean-variance solve `Σ · x = μ` that ADR-123
Wedge 8 promises a 40-60× speedup over the legacy Neumann series. Ships:
- `src/sublinear-adapter.ts` — `SublinearAdapter` class per the ADR-123
§262-289 contract: `solveCG(matrix, vector, opts)`, `isMcpAvailable()`,
`SolveResult` shape, SPD/symmetric sanity checks, graceful degrade with
`degraded: true` for malformed inputs.
- `src/sublinear-adapter.mjs` — runtime mirror so the smoke + bench
import the adapter directly (the plugin has no build step). Both files
ship a self-contained ~50-LOC CG kernel + Jacobi/Neumann baseline; the
same call site picks up the full native-WASM speedup automatically
once `mcp__ruflo-sublinear__solve` is registered.
- `skills/trader-portfolio-cg/SKILL.md` — declares `mcp__ruflo-sublinear__solve`
in allowed-tools, writes weights with provenance metadata
(`method: 'cg-sublinear' | 'cg-local' | 'neumann-fallback'`) to the
canonical `trading-risk` namespace (ADR-126 Phase 1 alignment),
documents the `RUFLO_NEURAL_TRADER_DISABLE_CG` disable flag, defines
the legacy `npx neural-trader --portfolio optimize` fallback.
- `benchmarks/portfolio-cg.bench.mjs` — CG vs Neumann on synthetic SPD
covariance at n ∈ {16, 64, 256}. Fixed-seed parity check
(`||cg − neumann||_∞ < 1e-4`) and per-size latency table.
- `benchmarks/results/cg-baseline-20260520T022220Z.md` — captured
baseline numbers. CG at n=256 is sub-ms (0.31 ms). The JS-vs-JS gap is
~1.5-1.9× because both kernels JIT to similar efficiency; the upstream
40-60× figure is for native-CG vs native-Neumann in
`sublinear-time-solver@1.7.0`, which the skill picks up automatically
through the MCP dispatch.
- `scripts/smoke-neural-trader-portfolio-cg.mjs` — three-layer regression
smoke: static adapter contract (class shape, method signatures, MCP
tool name), static skill contract (allowed-tools, namespace, disable
flag, fallback path), runtime correctness (textbook 2×2 SPD case
A=[[4,1],[1,3]], b=[1,2] → x=[1/11, 7/11] within 1e-6, plus degraded
paths for non-square / non-symmetric input).
- `.github/workflows/v3-ci.yml` — `neural-trader-portfolio-cg-smoke` job
on the same shape as the kg-extract guard; triggers on adapter, skill,
or smoke changes.
- `README.md` + plugin-smoke skill-count bumped from 7 → 8.
Acceptance:
- `bash plugins/ruflo-neural-trader/scripts/smoke.sh` → 11/11 pass.
- `node scripts/smoke-neural-trader-portfolio-cg.mjs` → all 17 checks pass.
- Bench parity: `||cg − neumann||_∞ < 1e-4` at every n ∈ {16, 64, 256}.
Refs: #2068, ADR-126 Phase 3, ADR-123 §162 Row 8 (Wedge 8).
Co-Authored-By: RuFlo <ruv@ruv.net>
Wires the plugin into the ADR-125 lifecycle guarantees shipped in
@claude-flow/memory@3.0.0-alpha.18 (already published). No new code,
just three lifecycle hooks:
1. trader-signal/SKILL.md
- Adds `expiresAt: Date.now() + 24h` to the signal memory_store call.
Rationale: intraday signals shouldn't pollute long-running memory;
the MemoryConsolidator.sweepExpired() pass (ADR-125 Phase 4) clears
them from all indexes — including HNSW — after they expire.
- Adds `mcp__claude-flow__memory_delete` to allowed-tools (for
symmetry with the dedup path; trader-signal itself doesn't delete
today, but the allowed-tools surface is shared across the lifecycle
story so consumers don't have to mentally re-derive permissions).
2. trader-backtest/SKILL.md
- New step 5: search for prior entries with the same (strategyId,
paramsHash) and memory_delete them before writing the fresh result.
Inline dedup keeps memory_search deterministic right after a re-run.
- Documents that the MemoryConsolidator.dedup('keep-newest') pass
achieves the same convergence asynchronously every 6h, so the
inline step is an optimization not a correctness requirement.
- Adds `mcp__claude-flow__memory_delete` to allowed-tools.
- Renumbers subsequent steps.
3. README.md — new "Memory lifecycle (ADR-125 integration)" subsection
under "Namespace coordination". Covers:
- Warm HNSW restart (Phase 3 — automatic via MemoryService)
- Hybrid retrieval RRF+MMR (Phase 5 — automatic, graceful FTS5
degrade)
- Signal TTL (24h)
- Backtest dedup (inline + 6h consolidator)
- Consolidator schedule
Smoke: 11 passed, 0 failed.
Refs #2068
Co-Authored-By: RuFlo <ruv@ruv.net>
Resolves the three-way namespace mismatch surfaced by the ADR-126 dossier:
- README.md L198-205 previously claimed 4 (-strategies/-backtests/-risk/-analysis)
- docs/adrs/0001 L63 previously claimed 4 (-backtests/-risk/-signals/-models)
- skills/trader-signal/SKILL.md L35 actually writes to `trading-signals`
- skills/trader-train/SKILL.md L28 actually writes to `trading-models`
The smoke test previously validated only the README's four, so signal data
silently landed in `trading-signals` (undeclared) and model results landed
in `trading-models` (undeclared), invisible to any downstream consumer
scoped to the documented namespace surface.
Aligns README, ADR-0001, smoke.sh, and trader-train on the canonical 5
defined by ADR-126 Phase 1:
trading-strategies — strategy definitions, parameters, regime mappings
trading-backtests — backtest results (long-lived; signed in Phase 4)
trading-risk — risk model state, VaR/CVaR, circuit-breaker triggers
trading-analysis — regime classifications + model-training results
trading-signals — short-lived signal events (TTL in Phase 2)
trader-train now stores model results to `trading-analysis` (was the
undeclared `trading-models`). smoke.sh check 8 now asserts the fifth
namespace claim. All 11 smoke checks still pass.
Refs #2068
Co-Authored-By: RuFlo <ruv@ruv.net>
Two plugin-list updates to root + ruflo READMEs:
1. Added `ruflo-graph-intelligence` (ADR-123 — sublinear graph
reasoning, PageRank, delta updates, complexity-aware execution)
under the Intelligence & Learning category. Count: 32 → 33.
2. Reshuffled the Path A featured install snippet to highlight the
capabilities users most often ask about today:
- Kept: `ruflo-core`, `ruflo-swarm`
- Added: `ruflo-rag-memory` (smart retrieval substrate built
on top of the ADR-125 memory consolidation we just shipped)
and `ruflo-neural-trader` (the headline domain-specific
plugin per ADR-117)
- Removed: `ruflo-autopilot`, `ruflo-federation` (still in the
33-list — just less of a first-touch story than memory +
neural-trader for the typical drop-in user)
Co-Authored-By: RuFlo <ruv@ruv.net>
Removed three badges that are now redundant after the ecosystem-
downloads badge landed in PR #2065:
- `npm downloads (ruflo)`
- `npm version (claude-flow)`
- `npm downloads (claude-flow)`
Keeping only `npm version (ruflo)` (the install-target users actually
type) + `ecosystem downloads 22.2M+` + `git clones 14d 115k` for the
ruflo-published-network signal. The `claude-flow` legacy umbrella is
still installable but doesn't need separate badge real estate.
Co-Authored-By: RuFlo <ruv@ruv.net>
Auto-generated by .github/workflows/clone-tracker.yml.
Source: GitHub Traffic API (14-day rolling window).
Co-Authored-By: ruflo-bot <ruflo-bot@users.noreply.github.com>
Three small fixes:
- memory README: switched the two new badges' hrefs from relative
(`../../../data/clone-data.proof.json`) to absolute GitHub URLs
so they render correctly on the npm.js package page (npm strips
relative links in README markdown)
- root README: added the same `ecosystem downloads 22.2M+` and
`git clones 14d 115k` badges alongside the existing per-package
ruflo/claude-flow download badges
- ruflo/README.md: same addition, since it's the umbrella that
users see first via `npx ruflo@latest`
All three badge URLs point to `data/clone-data.{proof,ledger}.json`
which the 13-day cron in .github/workflows/clone-tracker.yml will
keep updating.
Co-Authored-By: RuFlo <ruv@ruv.net>
GitHub only retains 14 days of clone-traffic data, and there's no
third-party archive of historic clones. So we ship our own tracker:
- `scripts/track-clones.mjs` — fetches clones for 5 ruflo-ecosystem
repos (ruflo, agentdb, agentic-flow, ruvector, ruv-FANN) and npm
downloads for headline packages. Produces three artifacts:
- `data/clone-data.rvf` — RuVector vector store (RvfDatabase,
10-dim per snapshot for similarity search across time)
- `data/clone-data.ledger.json` — append-only chronology with
per-repo breakdown (human-readable in PR diffs)
- `data/clone-data.proof.json` — provenance manifest with
SHA-256 over the ledger
- `.github/workflows/clone-tracker.yml` — runs every 13 days at
06:17 UTC + on workflow_dispatch + on edits to the tracker.
Commits the new snapshot back to main as `ruflo-bot`.
README badges now show:
- `ecosystem downloads 22.2M+` (sum across claude-flow + ruflo +
@claude-flow/* + agentdb + agentic-flow + ruvector/* — 152 npm
packages, last 12 months: 22,275,946 as of 2026-05-19)
- `git clones 14d 115k` (linked to the live ledger)
Initial snapshot captured at run time. Sources/formula documented
in `data/clone-data.proof.json` so any reader can verify the
claim by re-running the script.
Co-Authored-By: RuFlo <ruv@ruv.net>
Updated tally now includes `agentdb` (1.46M) and `agentic-flow`
(0.92M) — the two upstream packages this module depends on and
that the broader Ruflo ecosystem ships through. Last-year total
across all ruvnet-published packages (claude-flow + ruflo +
@claude-flow/* + agentdb + agentic-flow) is 5,610,780 as of
2026-05-19. Rounded down to 5.6M+ for conservative display.
Re-labeled "ecosystem downloads" to be clear this counts the
whole ruflo/claude-flow surface, not just @claude-flow/memory.
Links to ruvnet's npm profile page so the figure ages well.
Co-Authored-By: RuFlo <ruv@ruv.net>
Static badge citing the sum of last-year downloads across all
claude-flow + ruflo + @claude-flow/* packages (3,229,573 as of
2026-05-19 per npm registry API). Links to the org page so the
visual stays accurate even as the number grows.
Not using the dynamic `npm downloads` badge because it shows
single-package counts which understate the actual org reach.
Co-Authored-By: RuFlo <ruv@ruv.net>
The previous README pre-dated ADR-125 and showed `AgentDBAdapter` as
the canonical entry point with no mention of `MemoryService`, the real
hybrid default, persistent HNSW, the consolidator, or graceful FTS5
fallback. Perf claims ("150x-12,500x") had no committed referent.
Updated:
- Replace the "150x-12,500x Faster" badge with a real-measured one
citing the HNSW baseline (0.53 ms / 1,889 ops/s).
- Add a `What's new in 3.0.0-alpha.18` summary up top covering all
six ADR-125 deliverables plus the #1867 Node 26 install fix.
- Refresh Features list — drop dead claims, add the four new
capabilities (canonical service, real hybrid default, persistence,
consolidator, graceful FTS5), call out cross-platform install.
- Rewrite Quick Start to lead with `createHybridService` + showing
the new persist/restore round-trip; keep the raw `HNSWIndex` recipe
as the lower-level option (with `serialize`/`deserialize`).
- Add a `Migrating from 3.0.0-alpha.17` section documenting the
`UnifiedMemoryService` → `MemoryService` rename, the now-real
`createHybridService` semantics, and the no-throw `semanticSearch`
behavior change with the `health.embedder` event replacement.
- Add four new top-level sections — Persistence, Memory consolidation,
Graceful retrieval (FTS5 fallback), and a Performance Benchmarks
block that cites the committed `benchmarks/results/baseline-*.md`.
- Fix `MemoryMigration` → `MemoryMigrator` / `createMigrator` (the
old README referenced a class that didn't exist).
- Update Dependencies block to reflect `agentdb@^3.0.0-alpha.14`,
optional `better-sqlite3` for Node 24/26 install support, optional
`@claude-flow/embeddings` with the new graceful-degradation behavior.
- Remove `npm downloads` badge per maintainer preference.
Doc-only change. No code touched.
Refs #2061 (ADR-125)
Refs #1867 (Node 26 install support)
Co-Authored-By: RuFlo <ruv@ruv.net>
Closes the last gap from ADR-125's hardening pass: when the embedder is
unavailable the memory subsystem returns FTS-ranked keyword results
instead of throwing, and the previously-stubbed `hybridSearch` controller
finally returns real fused results.
- `AgentDBAdapter.semanticSearch` — wraps the embedder call in try/catch.
On no-generator OR generator-throws: emits
`health:embedder { status: 'degraded' }` then delegates to
`searchKeyword(query, opts)` (Acceptance Criterion #5).
- `AgentDBAdapter.searchKeyword` — new in-memory token-overlap ranking
with a dependency-free `tokenize` helper. Used both as the embedder
fallback and as the sparse arm of `hybridSearch`.
- `SQLiteBackend` + `SqlJsBackend` — both gain a FTS5 virtual table
(`memory_fts USING fts5(id UNINDEXED, content, tokenize='porter
unicode61')`), mirror writes on `store()`, prune on `delete()`, and a
`searchKeyword(query, limit)` method that queries `memory_fts MATCH`
ranked by FTS5's BM25 and joins back to `memory_entries`. Both fall
back to `LIKE` when FTS5 isn't available on the build.
- `controller-registry.ts` `hybridSearch` controller — replaces the
`return null` placeholder with a real RRF + MMR pipeline:
1. Run `semanticSearch` (which itself degrades) AND `searchKeyword`
independently with fanOutK = limit * 3.
2. Fuse via Reciprocal Rank Fusion (k=60) using the new public
`applyRRF` helper exported from `smart-retrieval.ts`.
3. Diversify via MMR (lambda=0.7) using the new public `applyMMR`
helper (re-export of the existing `mmrRerank`).
Auto-enables when a `MemoryService` is registered.
Tests:
- `src/graceful-retrieval.test.ts` — 3 cases covering Acceptance
Criterion #5 (no embedder → keyword + degraded event), embedder-throws
fallback, and the `hybridSearch` controller's fused output shape.
- `src/fts5.test.ts` — 6 cases covering sqljs FTS5 insert/match/delete/
update and gated sqlite FTS5 tests (skip when `better-sqlite3` isn't
installable in the env).
403/15 tests pass (was 394/13).
Refs: #2061, ADR-125 §Phase 5, Acceptance Criterion #5.
Co-Authored-By: RuFlo <ruv@ruv.net>
Promotes the Phase 3 consolidator placeholder to a real maintenance pass:
- `MemoryConsolidator.sweepExpired()` — drops entries past `expiresAt`
from `entries`/`namespaceIndex`/`keyIndex`/`tagIndex` AND from the HNSW
index (`HNSWIndex.removePoint`). Cleans up emptied namespace/tag sets.
- `MemoryConsolidator.dedup(strategy)` — SHA-256 content hash, then one
of `keep-newest | keep-oldest | merge-tags`. `merge-tags` unions tag
sets across duplicates and updates `tagIndex` for newly-added tags.
- `MemoryConsolidator.compactHnsw()` — rebuilds a fresh `HNSWIndex` from
the current `entries` and swaps pointers atomically. Uses the new
`HNSWIndex.getConfig()` accessor instead of reaching into private state.
- `MemoryConsolidator.runAll()` — sweep → dedup → compact, returning the
full `ConsolidationResult` breakdown.
Wiring:
- `UnifiedMemoryService` lazy-loads + memoizes the consolidator via
`getConsolidator()`. With `consolidator.autoRun: true` a `setInterval`
fires `runAll()` every 6h (configurable, unref'd to allow process
exit). `close()` clears the timer before snapshotting.
- `controller-registry.ts` `nightlyLearner` controller now returns a
thin wrapper bound to `consolidator.runAll()` when a `memoryService`
is registered (`RuntimeConfig.memoryService`). Falls back to the
upstream AgentDB `NightlyLearner` when only `agentdb` is registered.
`isControllerEnabled('nightlyLearner')` updated to enable on either
signal.
Tests: `src/consolidator.test.ts` covers Acceptance Criterion #4 (1000
expired → 0 remaining + HNSW emptied), all three dedup strategies,
compact-after-sweep size invariant, auto-run timer firing, close()
timer cleanup, and the nightlyLearner controller delegation.
394/13 tests pass (was 385/12).
Refs: #2061, ADR-125 §Phase 4, Acceptance Criterion #4.
Co-Authored-By: RuFlo <ruv@ruv.net>
Adds the first end-to-end durability path for `@claude-flow/memory`:
- `HNSWIndex.serialize() / static deserialize()` — length-prefixed binary
format with magic header `HNSW\x01`. Round-trips graph topology + node
vectors + normalized cache + per-level neighbor sets. Asserts header on
read and throws on truncated payloads.
- `AgentDBAdapter.loadFromDisk / saveToDisk / saveSnapshot` — replaces the
placeholder stubs (around `agentdb-adapter.ts:1025-1034`). Sidecars are
`<persistencePath>.hnsw` (binary HNSW) and `<persistencePath>.meta.json`
(stable JSON for entries + namespace/key/tag indices). Atomic write via
temp-and-rename. Emits `persistence:loaded` with
`status: restored | fresh | corrupt` so callers can observe state.
- `UnifiedMemoryService` — adds `snapshotInterval` config (default 1000,
configurable, 0/Infinity disables). Triggers `saveSnapshot()` every
Nth `store()` / per-entry in `bulkInsert`, and on `close() / shutdown()`.
`close()` is added as a lifecycle alias.
- `HnswLite` deletion — `src/hnsw-lite.ts` is removed; its
brute-force-degrading implementation is inlined into `rvf-backend.ts` as
a private helper (RvfBackend is the only user). The
`cosineSimilarity` re-export from the package surface is removed; users
who want it should pull from `@claude-flow/embeddings`.
Tests: `src/hnsw-persistence.test.ts` covers serialize round-trip,
truncation/magic checks, full restart-restore (Acceptance Criterion #3),
sidecar corruption fallback, and snapshot-every-N triggering.
A `MemoryConsolidator` stub lands in `src/consolidator.ts` so the index
compiles; the real implementation arrives with Phase 4.
385/12 tests pass (was 378/11).
Refs: #2061, ADR-125 §Phase 3, Acceptance Criterion #3.
Co-Authored-By: RuFlo <ruv@ruv.net>
The agentdb / @ruvector/rvf native bindings write `ruvector.db` (and
friends) to the package cwd as a side-effect. There is no source
reference to `ruvector.db` in `src/**`, so this is test pollution, not a
runtime dependency. ADR-125 Phase 7 closes the boundary:
Additions:
- `v3/@claude-flow/memory/.gitignore` — package-local gitignore so the
package is self-contained. Lists `ruvector.db`, `*.rvf`, `*.redb`,
test artifacts, and build output. (The repo root already ignores
`*.db`; this file makes the policy explicit at the package level.)
- `v3/@claude-flow/memory/vitest.setup.ts` — wipes known leak files
(`ruvector.db`, `test-database-provider.rvf`, `agentdb.rvf.lock`) and
any stray `*.db`/`*.rvf`/`*.redb` from the package root before AND
after every test run.
- Wired into `vitest.config.ts` via `setupFiles: ['./vitest.setup.ts']`.
- `scripts/smoke-memory-no-stray-db.mjs` — CI guard that runs `npm test`
in the package and fails if any *.db / *.rvf / *.redb file appears in
`git status --porcelain` afterwards.
The smoke is intentionally diff-based (compares before / after status)
so it doesn't fail on pre-existing untracked files unrelated to the
test run.
Verified locally: smoke exits 0, `git status` clean after test run,
378 tests passing.
Refs: ADR-125 Phase 7
Closes: part of #2061
Co-Authored-By: RuFlo <ruv@ruv.net>
Previously `npm run bench` matched no files because `vitest.config.ts`
restricts include to `src/**/*.test.ts`. ADR-125 Phase 6 lands a dedicated
`vitest.bench.config.ts` that discovers `benchmarks/**/*.bench.ts`, and
the `bench` script now points at it.
Additions:
- `vitest.bench.config.ts` — bench discovery config; legacy custom-framework
bench files (cache-hit-rate, hnsw-indexing, memory-write, vector-search)
are excluded for now and will be ported in a follow-up alongside Phase 3.
- `benchmarks/hnsw-search.bench.ts` — first real vitest `bench()` suite.
Measures `HNSWIndex.search` (k=10, k=50) and `addPoint` against 1k random
128-dim vectors.
- `benchmarks/results/baseline-20260519T212453Z.md` — first measured baseline,
committed so the README perf table has a real referent.
- `benchmarks/results/scripts/run-baseline.mjs` — companion script that
produces the JSON blob the baseline.md references.
Measured baseline on Darwin / M-series:
build_time_ms: 533.42 (1k vectors, 128-dim)
search_k10_avg_ms: 0.5294 (~1.9k ops/s)
search_k50_avg_ms: 0.5235
add_avg_ms: 0.8656
378 tests still passing — no regression.
Refs: ADR-125 Phase 6
Closes: part of #2061
Co-Authored-By: RuFlo <ruv@ruv.net>
ADR-009 promised `HybridBackend` as the default. Until now,
`createHybridService` silently downgraded to AgentDB-only with a comment
admitting the gap. This commit delivers the wiring:
- `createDatabase` gains `'hybrid'` and `'agentdb'` provider cases.
`'hybrid'` returns a `HybridBackend` (SQLite + AgentDB) and `'agentdb'`
returns an `AgentDBBackend` directly.
- `MemoryService` now exposes a public `backend: IMemoryBackend` field
and a `withBackend(backend)` method. The default backend stays the
legacy `AgentDBAdapter`; `createHybridService` swaps in a real
HybridBackend created via `createDatabase({ provider: 'hybrid' })`.
- All `IMemoryBackend` methods on `MemoryService` now route through
`this.backend` rather than hardcoding `this.adapter`.
- `storeEntry` and `semanticSearch` keep the AgentDBAdapter fast-path
but gain a generic fallback for custom backends.
- `createHybridService` is now async (returns `Promise<MemoryService>`)
because `createDatabase` is async. No external callers existed.
Acceptance criterion #2 from ADR-125 now holds:
`(svc as any).backend instanceof HybridBackend` is `true`.
Tests:
- 2 new cases in `database-provider.test.ts` for `'hybrid'` and `'agentdb'`.
- 2 new cases in `index.test.ts` for `createHybridService`.
378 tests passing (was 374, +4 new).
Refs: ADR-125 Phase 2, ADR-009
Closes: part of #2061
Co-Authored-By: RuFlo <ruv@ruv.net>
Land Phase 1 of ADR-125. Public API now exports `MemoryService` as the
canonical entry point, with `UnifiedMemoryService` preserved as an
`@deprecated` alias (same class) until 3.0.0-rc.
Removed from the public surface:
- `HnswLite` — internal to RvfBackend; reachable via explicit module path.
- `RvfBackend` — selected through `createDatabase({ provider: 'rvf' })`.
Updates:
- `prepublishOnly` now requires `MemoryService` + `UnifiedMemoryService`
AND fails if `HnswLite` / `RvfBackend` re-appear on the top-level surface.
- New `src/index.test.ts` (7 tests) asserts the canonical surface.
- New `docs/migration-3.0.0-alpha.18.md` documents rename + deprecation.
No runtime behavior change. All 367 existing tests still pass; +7 new.
Refs: ADR-125 Phase 1, ADR-006, ADR-009
Closes: part of #2061
Co-Authored-By: RuFlo <ruv@ruv.net>
The plugin-registry signature verifier in
`v3/@claude-flow/cli/src/plugins/store/discovery.ts` was a stub that
returned `true` whenever the served `registryPublicKey` field started
with `"ed25519"`. The call site only `console.warn`ed on failure and
continued to use the unverified registry. With `requireVerification:
true` (the default), a network adversary on the path to an IPFS
gateway could swap the served registry and have a user install
attacker-controlled plugin tarballs with filesystem+network+hooks
permissions.
Patch (originally proposed in #1922 by @aaronjmars; CWE-347):
- Import `verifyEd25519Signature` from `transfer/ipfs/client.ts` (the
real Ed25519 verifier already lived there, just wasn't wired in).
- Replace the stub with an async verifier that mirrors `signRegistry()`
in `scripts/publish-registry.ts:127-151`: strip `registrySignature` +
`registryPublicKey` from the registry copy, `JSON.stringify`, verify
signature against `expectedPublicKey`.
- Pin verifier to the caller-supplied `expectedPublicKey` (the trusted
pinned key from `DEFAULT_PLUGIN_STORE_CONFIG`), NOT the self-asserted
`registry.registryPublicKey` (which an attacker can swap too).
- Update call site to `await` the now-async verifier AND fail closed
(return demo registry on failure rather than warn+continue).
CI guards (this commit):
1. `scripts/smoke-plugin-registry-signature.mjs` — 13-check regression
smoke covering: (a) static contract on discovery.ts (correct import,
canonicalization, pinned-key call, no stub revival), (b) Ed25519
crypto round-trip matching signRegistry()'s scheme (valid passes,
tampered fails, empty fields fail, swapped served key cannot defeat
the trusted pin), (c) call-site byte check (await + fail-closed).
2. `plugin-registry-signature-smoke` job in `v3-ci.yml` runs the smoke
on push + PR (including from forks now that pull_request branches
include `develop`).
3. Path filters added for `discovery.ts`, `transfer/ipfs/client.ts`,
`publish-registry.ts`, and the smoke itself so any future drift in
the signing scheme triggers re-verification.
Acceptance:
- `node scripts/smoke-plugin-registry-signature.mjs` → 13/13 pass
- Build of `@claude-flow/cli` clean (no new typecheck errors)
- Root npm audit: 0 vulnerabilities
- Supply-chain audit (5 layers): no hard-fail findings
Sibling `verifyRegistrySignature` stub at
`transfer/store/registry.ts:278` is dead code today; tracked as a
follow-up (delete-if-dead or rewrite when wired up).
Co-Authored-By: Aeon (aaronjmars) <aeon@aaronjmars.com>
Co-Authored-By: RuFlo <ruv@ruv.net>
agentic-flow@2.0.13 moves the onnxruntime-node native binding load out of
module-import time and into an on-demand `loadOrt()` helper called from
`initializeSession()`. This fixes ruflo#2048 — `import('agentic-flow/reasoningbank')`
on Windows crashed with "OS cannot run %1" because router/providers/onnx-local.ts
used a top-level `await import('onnxruntime-node')` which forced the native binding
to load before any user code ran, even when the consumer never intended to run
local ONNX inference.
Upstream PR: ruvnet/agentic-flow#155
Upstream release: agentic-flow@2.0.13 (now `latest` on npm)
Changes
- root package.json + package-lock.json: ^2.0.12 → ^2.0.13
- v3/@claude-flow/browser/package.json + package-lock.json: ^2.0.12 → ^2.0.13
- v3/pnpm-lock.yaml: regen → resolves 2.0.13
- .github/supply-chain/follow-ups.md: mark #2048 as fixed, link upstream PR + this PR
- .github/supply-chain/accepted-findings.json: add fixedDirectly entry for 2.0.13
Verification
- root npm audit: 0 vulnerabilities
- supply-chain audit (5 layers): OK, no hard-fail findings
- @claude-flow/browser tests: 230 passed | 12 skipped
- ruflo-graph-intelligence tests: 104 passed
- Acceptance test (run against published 2.0.13):
node -e "import('agentic-flow/reasoningbank').then(()=>console.log('OK'))"
node -e "import('agentic-flow/router').then(()=>console.log('OK'))"
Both succeed under default install AND under --omit=optional.
Follow-up CI guard (separate PR):
- Add Windows-runner smoke job that imports agentic-flow/reasoningbank under
--omit=optional to lock the lazy-load contract.
Co-Authored-By: RuFlo <ruv@ruv.net>
Three coupled fixes for ruvnet/ruflo#2049:
1. `kg-extract/SKILL.md` step 3 now declares a separate `type-depends-on`
relation (weight 0.1) for TypeScript `import type` and inline
`import { type Foo, value }` specifiers. Includes the regex carve-out
pattern so future agents implementing the skill correctly classify
the three import shapes. Previously the skill said "follow
import/require statements" with no carve-out, and a naive grep
produced phantom runtime cycles (a 51-service codebase reported a
non-existent `findings ⇄ finding-actions` cycle driven entirely by
a one-way `import type { Finding }` edge).
2. `kg-traverse/SKILL.md` step 3 now calls `agentdb_pattern-search`
(enabled in current AgentDB builds) instead of
`agentdb_semantic-route` (`enabled: false` — controller is
compiled out, returns "SemanticRouter not available in current
agentdb build"). Both skills' `allowed-tools` lines updated to
drop the disabled controller.
3. New CI smoke at `scripts/smoke-kg-extract-type-imports.mjs` +
new workflow job `kg-extract type-import classification smoke (#2049)`
in `.github/workflows/v3-ci.yml`. Two layers:
- Static contract check on both SKILL.md files — asserts
`type-depends-on` relation is declared, weight ≤ 0.1, regex
carve-out is present, and no skill lists the disabled
`agentdb_semantic-route` in allowed-tools.
- Behavioural fixture test: writes a tiny TS scenario with one
type-only cycle + one value-import edge to /tmp, runs the
documented regex classifier, and asserts the cycle is NOT counted
as a value edge. If a future PR softens any of these contracts,
the smoke catches it before merge.
Path filters in v3-ci.yml expanded to include
`plugins/ruflo-knowledge-graph/**` + the new smoke script so the job
fires on every relevant edit.
Plus `.github/supply-chain/follow-ups.md` documents:
- #2047 (witness drift HIGH) — upstream scheduled-runner fix needed +
the interim CI guards already in place.
- #2048 (agentic-flow Windows onnxruntime binding) — needs the same
shape of upstream patch as ADR-124 shipped for @xenova/transformers
in agentic-flow 2.0.12; documented workaround for users and the
CI guard to add post-patch.
Smoke verified locally: 9/9 checks pass.
Co-Authored-By: RuFlo <ruv@ruv.net>
Job-level continue-on-error keeps the workflow from failing but still
reports the check as fail on the PR status badge. Step-level
continue-on-error makes the JOB report success regardless of the
action's outcome — what's actually needed to make the check green
until Dependency Graph is enabled at the repo level.
Co-Authored-By: RuFlo <ruv@ruv.net>
GitHub's dependency-review-action errors with 'Dependency review is
not supported on this repository' when the repo's Dependency Graph
feature is off. That toggle lives at Settings → Security and analysis
and is a repo-admin action, not something a PR can do.
Mark the job continue-on-error: true so the rest of the supply-chain
hardening (CVE audit, lockfile integrity, allowlist, typosquat,
CODEOWNERS) stays usable while the repo owner enables the feature.
When the Dependency Graph is enabled, this job will start gating new
vulnerable deps from being added in PRs — no further code change
needed, just remove the continue-on-error line.
Co-Authored-By: RuFlo <ruv@ruv.net>
The action rejected the bare-name format with 'Error parsing
package-url: name is required'. Per actions/dependency-review-action
docs, deny-packages accepts pURL strings like
'pkg:npm/event-stream@3.3.6'.
Co-Authored-By: RuFlo <ruv@ruv.net>
The plugin directory plugins/ruflo-graph-intelligence/ exists with a
valid .claude-plugin/plugin.json, but the marketplace manifest does not
list it, so /plugin install ruflo-graph-intelligence@ruflo fails with
'Plugin not found in marketplace ruflo'.
Add the missing entry, alphabetically placed between ruflo-federation
and ruflo-iot-cognitum to match the ordering of recent additions.
Upstream agentic-flow@2.0.12 shipped today (PR ruvnet/agentic-flow#154,
commit 2c10eb9) moving @xenova/transformers from `dependencies` to
`optionalDependencies`. Five of six call sites in agentic-flow already
used dynamic import; the sixth (src/reasoningbank/utils/embeddings.ts)
was converted to dynamic with try/catch + graceful fallback to the
existing hash-based embedding path.
This commit:
1. ADR-124 — full architectural record of the upstream fix +
downstream impact + rollout plan.
2. Bump agentic-flow ^2.0.11 → ^2.0.12 in:
- package.json (root)
- v3/@claude-flow/browser/package.json
3. Regenerate lockfiles:
- package-lock.json (root npm)
- v3/@claude-flow/browser/package-lock.json
- v3/pnpm-lock.yaml (v3 workspace)
4. Update .github/supply-chain/accepted-findings.json:
- Add entry to `fixedDirectly[]` documenting the 2.0.12 ship
- Replace the previous "blocked by upstream" CVE entry with a
"moot finding" entry. The vulnerable code is no longer installed
when consumers use `npm install --omit=optional`; `npm audit`
still reports it because it reads the lockfile graph (which
includes optionals) — a known npm limitation. Tracking now
points at the merged upstream PR + ADR-124.
After this commit:
- Root npm audit: 0 vulnerabilities (was 0 already after PR #2050; still 0)
- Browser tests: 230/230 passing
- Graph-intel tests: 104/104 passing
- Supply-chain audit: 0 hard-fail findings (1 accepted, moot)
- Consumers of @claude-flow/browser who pass `--omit=optional` get a
fully CVE-clean install profile
Closes the upstream half of #2046. ADR-121 Phase 4 still tracks the
long-term Xenova retirement.
Co-Authored-By: RuFlo <ruv@ruv.net>
Two worker skill directories contain both SKILL.md (uppercase) and
skill.md (lowercase) with byte-identical contents:
.agents/skills/worker-benchmarks/{SKILL,skill}.md (4251 bytes each)
.agents/skills/worker-integration/{SKILL,skill}.md (3894 bytes each)
These collide on case-insensitive filesystems (macOS APFS default,
Windows NTFS default), producing 'invalid path' warnings on every
clone and forcing git to silently drop one of the two files from
the working tree.
The lowercase versions are outliers — the rest of the repo uses
SKILL.md consistently (282 files). Remove the lowercase duplicates
to align with that convention and eliminate the collision.
Companion to the CVE fix in 9a8c9c464. v3/@claude-flow/browser was
bumped to agentic-flow ^2.0.11 but the v3 workspace lockfile was not
regenerated. CI jobs using `pnpm install --frozen-lockfile` failed with
ERR_PNPM_OUTDATED_LOCKFILE.
Co-Authored-By: RuFlo <ruv@ruv.net>
Before:
Root npm audit: 13 HIGH/CRITICAL across 25 vulns
@claude-flow/browser fresh install: similar transitive chain
Audit script reported 0 unaccepted only because it correctly scopes
to direct deps — but transitive surface was hostile
Changes:
1. Bump agentdb to 3.0.0-alpha.14 (was alpha.10/13 across repo)
- 3.0.0-alpha.14 dropped @opentelemetry/sdk-node from its
dependencies block (still in optionalDependencies; overrides handle
that). Eliminates the @opentelemetry/sdk-node CVE chain via direct
dep replacement.
- Updated: v3/@claude-flow/memory, v3/@claude-flow/cli, root.
2. Bump agentic-flow 2.0.7 → 2.0.11 (root) and ^2.0.3 → ^2.0.11
(v3/@claude-flow/browser). Latest 2.x; closer to a Xenova-clean
release when upstream ships it.
3. Add npm overrides at the root + at v3/@claude-flow/browser package
(overrides do not cascade across separate npm projects, so browser
needs its own block for standalone publish):
@opentelemetry/sdk-node >= 0.218.0 (was <0.217.0 CVE)
@opentelemetry/auto-instrumentations >= 0.75.0
@opentelemetry/exporter-prometheus >= 0.217.0
axios >= 1.13.2
fast-uri >= 3.1.0
vite >= 6.4.6
ws >= 8.18.4
Plus the existing browser-package overrides for hono / undici / tar /
minimatch / picomatch / flatted / etc. — copied from root to keep
the standalone npm-published install clean.
After:
Root npm audit: 0 vulnerabilities (13 HIGH/CRITICAL → 0)
Supply-chain audit: PASS (0 unaccepted direct-dep findings)
Browser tests: 230/230 passing
Graph-intel tests: 104/104 passing
One CVE remains in v3/@claude-flow/browser's STANDALONE fresh install
(end-user `npm install`): @xenova/transformers via agentic-flow direct
dependency. Cannot fix without upstream agentic-flow shipping a Xenova-
free release. agentic-flow@3.0.0-alpha.2 still has it. Documented in
accepted-findings.json under cve[] with:
tracking: ADR-121 Phase 4
expiresAt: 2026-08-19 (audit re-fails if upstream still hasn't shipped)
rationale: browser package does not invoke embedding code paths
This is the right level of triage. The audit doesn't lie about it — it
just doesn't block our shipping while we wait for upstream.
Co-Authored-By: RuFlo <ruv@ruv.net>
After ADR-122 + ADR-123 expanded ruflo's published-package surface
(@claude-flow/browser, ruflo-graph-intelligence) the supply-chain attack
surface grew alongside it. This commit puts five layers of defence on
every PR + push that touches package.json, lockfiles, or the audit
itself.
New files:
.github/supply-chain/allowed-deps.json
Whitelist of direct deps per audited package (ruflo-graph-intelligence,
@claude-flow/browser). New top-level deps require an explicit edit here.
Also lists policies.rejectInRegistry (typosquat block-list — ruflo-graph-
intellligence, sublinear-time-solvor, agent-browse, etc.) and
publisherTrust.criticalUpstreamPackages (upstream identities snapshotted
in CI logs so maintainer takeovers are visible).
.github/supply-chain/accepted-findings.json
Triaged findings the audit currently tolerates. Each entry cites a
tracking issue or ADR and carries an expiresAt date so the audit
re-fails after triage window closes. CODEOWNER review required to
edit.
.github/supply-chain/README.md
Operator guide: how to run the audit locally, how to triage new
findings, how to add a new package to coverage.
.github/CODEOWNERS
Workflows / lockfiles / plugin manifests / supply-chain config now
require explicit maintainer review. Pairs with the automated audit.
scripts/audit-supply-chain.mjs
Five-layer audit:
[1/5] CVE — npm audit --audit-level=high, fail on HIGH/CRITICAL in
DIRECT deps unless accepted
[2/5] Lockfile integrity — every downloaded entry must carry
SHA-512 in `integrity` (skip pnpm-shadow + workspace-link
entries by construction)
[3/5] Top-level allowlist — package.json deps must match
allowed-deps.json
[4/5] Typosquat reject — names matching policies.rejectInRegistry
fail regardless of upstream status
[5/5] Publisher trust — npm view maintainers, log-only (informational)
scripts/__tests__/audit-supply-chain.test.mjs
Smoke test for the audit itself (full-run / --json / each --scope).
Workflow additions in .github/workflows/v3-ci.yml:
supply-chain-audit job — runs the audit + the smoke test on every PR
and push that touches package.json, lockfile, allowed-deps,
accepted-findings, or the audit script.
dependency-review job — actions/dependency-review-action@v4 (PR-only)
flags any new vulnerable dep added by the PR vs base, fails on
`high` severity, denies known-bad licenses (AGPL/GPL/SSPL) and
blocks specific compromised versions (event-stream, flatmap-stream,
ua-parser-js@0.7.29 / 0.8.0 / 1.0.0, colors@1.4.1, faker@6.6.6).
Path filter expanded to include **/package.json, **/package-lock.json,
**/pnpm-lock.yaml, .github/supply-chain/**, scripts/audit-supply-chain.mjs
Dependabot additions in .github/dependabot.yml:
Per-plugin npm stanzas for ruflo-graph-intelligence and
@claude-flow/browser. Major-version bumps are blocked from auto-PR
(they require allowlist re-approval); patch + minor auto-PR'd.
One real-world finding the audit caught on first run + how it was
triaged (recorded in accepted-findings.json):
- HIGH CVE on @claude-flow/browser → agentic-flow (via @xenova/
transformers, agentdb). Already tracked in ADR-121 Phase 4
(Xenova retirement migration). Marked accepted with expiresAt
2026-08-19 so the audit re-fails if the migration hasn't
landed by then.
Audit run on this branch: PASS (0 unaccepted CVE / 0 lockfile issue
/ 0 allowlist violation / 0 typosquat / 5 publisher-trust entries
logged). Audit smoke test: 5/5 passing.
Co-Authored-By: RuFlo <ruv@ruv.net>
The 'validate' CI job requires every plugin under plugins/ to declare a
plugin manifest at .claude-plugin/plugin.json. Adds it for
ruflo-graph-intelligence so PR #2045 passes marketplace validation.
Co-Authored-By: RuFlo <ruv@ruv.net>
Phase 8 (BEYOND-SOTA MOAT):
domain/federation-protocol.ts — 4 wire message types over ADR-104:
pr_artifact_request — peer asks for a PR over (graphId, queryNode)
with lastKnownGraphHash + lastKnownResultHash
for stale-detection
pr_artifact_response — peer ships a Phase 7 signed envelope back
pr_artifact_delta — sparse delta over a known base resultHash
pr_artifact_stale — graph changed; consumer must recompute
All Zod-validated, discriminated-union routable.
application/federation-server.ts — receives requests, rate-limits per
peer (default 60/min), computes via Phase 2-6 adapters + runPageRank,
seals via Phase 7 sealArtifact. Returns stale rejects when graphHash
mismatches or graphId unknown.
application/federation-client.ts — sends requests via FederationTransport;
verifies inbound envelopes against trusted-public-keys list; falls back
to local compute (origin: 'peer' / 'stale-fallback' /
'untrusted-fallback' / 'local-fallback') with reason.
inProcessTransport() helper stitches a client to a server for in-process
testing without spinning up real ADR-104 wiring.
104/104 tests passing (+6 for Phase 8):
- phase8-federation.test.ts: 6 (verifiable peer artifact, untrusted-key
fallback, stale graphHash, unknown graphId, rate limit per peer,
unreachable-peer local fallback)
All 8 phases of ADR-123 are now feature-complete. Plugin builds clean,
ships at 0.1.0-alpha.1 with 104 passing tests across the eleven wedges
(W1-W11) + Wedge 12 streaming + the beyond-SOTA Phase 7+8 federation
artifact pipeline.
Next: publish ruflo-graph-intelligence to npm, open + merge PR, create
announcement gist with intro/features/usages (practical to exotic).
Co-Authored-By: RuFlo <ruv@ruv.net>
Phase 6.5 — Wedge 12: StreamingBridge
application/streaming-bridge.ts — couples a registered SublinearAdapter
with solve_on_change so event-driven graphs pay only O(nnz(delta) · log N)
per event. Maintains prev_solution in memory; pushDelta applies the
delta or falls back to full re-solve when the delta ratio exceeds the
threshold (default 0.05) or refresh-cap (default 50) hits. Cold-start
produces a full-solve baseline. Reset clears cached state.
Phase 7 — Witness-signed PR artifacts (BEYOND-SOTA WEDGE)
domain/signed-artifact.ts — SignedPageRankPayload + Envelope schema.
Embeds complexity_class + coherence_score + resultHash echoes so
verification covers provenance + budget compliance + input stability.
Solver version pinned to sublinear-time-solver@1.7.0.
infrastructure/witness-signer.ts — Ed25519 sign/verify via node:crypto
(no new deps). canonicalJSON skips undefined keys for round-trip
determinism. Trust-list filtering. Three integrity checks before
signature verify: resultHash echo, coherenceScore echo,
complexityClass echo — all three must match the embedded PageRankResult
or the artifact is rejected as tampered.
98/98 tests passing (+18 since Phase 6):
- phase6_5-streaming.test.ts: 6 (cold-start, sparse delta, full-resolve
fallback, refresh-cap, getCurrentSolution, reset)
- phase7-signed-artifact.test.ts: 12 (canonicalJSON determinism +
undefined-key skip, round-trip, 4 tamper-detection scenarios, trust
list accept/reject, byte-deterministic signing, signature changes
with content)
No competing memory framework (LangGraph, AutoGen, Letta, MemGPT, Mem0,
HippoRAG) ships signed graph-reasoning artifacts. The combination of
ADR-103 witness chain + ADR-104 federation transport + sublinear's
deterministic forward-push composes into a primitive structurally
unavailable to systems without these three substrate primitives.
Co-Authored-By: RuFlo <ruv@ruv.net>