mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
8773fcffdf783e83afad1cf2689e5a6713384a21
2150
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8773fcffdf |
feat(memory): #2061 ADR-125 Phase 5 — graceful retrieval degradation + FTS5 keyword fallback
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>
|
||
|
|
850450f385 |
feat(memory): #2061 ADR-125 Phase 4 — MemoryConsolidator (sweep + dedup + compactHnsw)
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>
|
||
|
|
81a2b23eb9 |
feat(memory): #2061 ADR-125 Phase 3 — persistent HNSW snapshot + restore
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> |
||
|
|
7dd4b52529 |
chore(memory): #2061 ADR-125 Phase 7 — RuVector boundary cleanup + no-stray-db CI smoke
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> |
||
|
|
ed95d67822 |
feat(memory): #2061 ADR-125 Phase 6 — runnable benchmarks + baseline results
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> |
||
|
|
11eaef851e |
feat(memory): #2061 ADR-125 Phase 2 — wire createHybridService to actually use HybridBackend
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>
|
||
|
|
4e9a33ce2a |
feat(memory): #2061 ADR-125 Phase 1 — MemoryService canonical entry point + deprecate UnifiedMemoryService
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>
|
||
|
|
4de8846c75 |
chore(release): publish 3.7.0-alpha.70 — CWE-347 security fix
Bumps @claude-flow/cli, claude-flow, ruflo to 3.7.0-alpha.70 and publishes to npm. This release ships the CWE-347 plugin-registry signature verification fix landed in #2060 (Closes #1922). Published artifacts: - @claude-flow/cli@3.7.0-alpha.70 (tags: alpha, latest, v3alpha) - claude-flow@3.7.0-alpha.70 (tags: alpha, latest, v3alpha) - ruflo@3.7.0-alpha.70 (tags: alpha, latest) Also includes #2056 — agentic-flow ^2.0.12 → ^2.0.13 (Windows onnxruntime lazy-load fix from upstream PR ruvnet/agentic-flow#155). Verification: - 13-check CWE-347 regression smoke green - Root npm audit: 0 vulnerabilities - Supply-chain audit (5 layers): no hard-fail findings - All 65 CI checks green on PR #2060 pre-merge Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
82edec30f9 |
fix(security): #1922 — verify plugin-registry Ed25519 signature properly (CWE-347)
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> |
||
|
|
3dbf6074aa |
fix(deps): #2048 — bump agentic-flow ^2.0.12 → ^2.0.13 (Windows onnxruntime lazy-load)
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>
|
||
|
|
f60417352e |
fix(deps): #2046 ADR-124 — bump agentic-flow to 2.0.12 (xenova optional)
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>
|
||
|
|
9a8c9c464f |
fix(supply-chain): #2046 — eliminate all root-level HIGH/CRITICAL CVEs
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>
|
||
|
|
72d31a00a8 |
docs(browser): #2041 ADR-122 security audit + substrate benchmarks + announcement draft
- scripts/benchmark-substrate.mjs — measures Phase 1/2/3/5/7 throughput; results: Ed25519 sign 37µs, verify 88µs, annotate 2µs, vault verify 83µs, classify 0.16µs, production UCT 0.32µs, compile 23µs. All under 100µs. - docs/SECURITY_AUDIT.md — full audit: 0 new vulnerabilities, all transitive findings (Xenova, OTel, sqlite3) tracked under ADR-118/121. Code-level review per phase: timing-safe verify, no shell injection, anchored regexes, fail-safe JSON parsing, defense-in-depth on attestations. Approves 3.0.0-alpha.4 for npm publish. - docs/ANNOUNCEMENT.md — substrate framing + 8-phase table + benchmarks + quick-start. To be uploaded as a public gist at publish time. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
350bcf0606 |
feat(browser): #2041 ADR-122 Phase 7 — Workflow Compiler + production-aware UCT
Phase 7 (substrate-layer compiler):
- domain/workflow.ts — CompiledWorkflow schema with WorkflowStep (primary
SelectorSpec + ordered fallback chain), WorkflowRequirements (sessionCapsule,
origins[], taskClass), WorkflowGuards (irreversibleAction,
requiresUserConfirmation), WorkflowReplay (maxRetries, timeoutMs).
ProductionUctSignals/Weights for the production-aware UCT formula.
- application/workflow-compiler.ts — WorkflowCompiler.compile() walks a signed
trajectory envelope's steps, extracts the primary locator from each step
input, derives an ordered selector fallback chain from observed snapshot
metadata (role+name → text → ref), classifies highest-risk action via
Phase 6 RiskClassifier, gates requirements + guards. toYaml() emits
deterministic, parseable YAML for VCS check-in.
- application/production-uct.ts — productionUct(input, weights) implements
the full substrate scoring formula:
score = Q + C·√(ln(N)/n) + λ_R·replayability
− λ_risk·risk − μ_cost·cost − α_auth·auth_fragility
Unvisited branches still return +Infinity for parity with Phase 4 UCB1.
blendQ() linearly mixes scorer value + replay-success-rate.
- 12 new tests: compile login flow + fallback chain, financial-action
guard escalation, origin extraction, deterministic YAML output, UCT
invariants (infinity for unvisited, prefers safe over risky, penalises
cost, rewards replayability, custom weights honoured), blendQ linearity.
Renames in src/index.ts re-export: WorkflowStep → CompiledWorkflowStep
(avoids collision with workflow-templates.ts's pre-existing WorkflowStep).
230/230 tests passing (+12 for Phase 7). Build + typecheck clean.
Beyond SOTA: no other web agent compiles MCTS traces into signed, replayable
YAML workflows with selector fallback graphs. The compiler is the "output of
the substrate" — what makes browser experience truly reusable.
Co-Authored-By: RuFlo <ruv@ruv.net>
|
||
|
|
45f951143e |
feat(browser): #2041 ADR-122 Phase 6 + substrate reframing — Session Capsule + adapters + risk classes
ADR-122 reframed as **RuFlo Browser Substrate**: ruflo becomes the memory, policy, replay, distributed-planning layer underneath browser agents. Stagehand, Browser Use, Playwright, Browserbase, Surfer-H become execution targets — not competitors. Added Architecture section: layered system, 6 runtime services, risk-class taxonomy, Session Capsule schema, production-aware UCT, SOTA rubric. Phase 6 implementation (substrate primitives): - domain/session-capsule.ts — full SessionCapsulePayload with origins[], reusePolicy (allowedOrigins, allowedTaskClasses, maxReplays, requireFreshMfa, allowCrossDevice/Installation), consentProof (signed statement), browserProfile, witnessChainHead, expiry, replays counter. RiskClass enum (read-only / authenticated-read / draft-write / external-submission / financial / account-mutation / destructive) + AUTONOMOUS_CLASSES set. - application/session-capsule-service.ts — create() with PII-scan gate, verify() with schema+signature+trust-list+expiry+maxReplays checks, mount() that increments replays + rolls witness chain head, revoke(), per-class RiskClassifier with verb+target regex taxonomy. - domain/browser-adapter.ts — BrowserExecutionAdapter interface (single surface above the tool wars: open/snapshot/click/fill/type/screenshot/wait/ getUrl/getTitle/getText/close/observe). - infrastructure/agent-browser-execution-adapter.ts — first concrete adapter wraps existing AgentBrowserAdapter; future Phase 6.5+ adds Stagehand, Browserbase, local Chrome. - 20 new tests: clean+PII create, tamper rejection, expired capsule, trust list, mount replays + chain head, maxReplays cap, origin/taskClass policy enforcement, revoke, RiskClassifier for all 7 classes (Class 1-3 autonomous, Class 4-7 human approval), inline-state PII detection regression fix (string-spread bug that prevented SSN regex matching). 218/218 tests passing (+20 for Phase 6). Build + typecheck clean. Beyond SOTA: no public browser-agent system ships a signed-state capsule with origin scope, consent proof, replay counter, witness chain, AND risk-class gating. Stagehand v3 portability + Browserbase persistence + Surfer-H vision are all *execution-layer* — ruflo is the substrate that sits above them. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
a0d3d01c33 |
feat(browser): #2041 ADR-122 Phase 5 — cost-aware routing + GOAP preflight
- domain/action-routing.ts — ActionTier, RoutingDecision, TrajectoryCostReport - application/action-router.ts — verb-based 3-tier classifier (Tier 1 booster $0, Tier 2 haiku $0.0002, Tier 3 sonnet/opus $0.005+); causal-risk-aware escalation; per-trajectory cost rollup with tier-1 share - application/goap-preflight.ts — pre-session dry-run: missing-cookie / high-causal-risk / unsafe-URL findings + estimated total cost - 11 new tests: classification (DOM verbs Tier 1, find Tier 2, eval Tier 3), risk escalation, cost rollup with tier-1 share ≥30% on representative workload, GOAP preconditions (cookie present/missing), high-causal-risk warning, URL safety, routing-plan + total-cost emission 198/198 tests passing (+11). Build + typecheck clean. All 6 phases done. Beyond SOTA: combines existing ruflo primitives (Agent Booster, hooks_route, ruflo-goals GOAP, AIDefence) into a per-action cost optimizer that no single-process LLM browser agent ships. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
dfb7747b32 |
feat(browser): #2041 ADR-122 Phase 3 + Phase 4 — attested cookie vault + federated MCTS
Phase 3 — AIDefence-attested cookie vault: - domain/cookie-vault.ts — CookieValue, ScanAttestation, VaultEntryEnvelope - application/cookie-vault-service.ts — store() with AIDefence-gate, sealed envelope sign, verifyAttestation(), refusal audit log, optional persistence - 14 new tests: clean store + verify, PII refusal (cookie + audit + no persist), tamper detection (value swap, hash+value swap, schema-invalid), clean=false attestation refusal (defense in depth), trust-list filter, audit record Phase 4 — Federated MCTS branch exploration: - domain/mcts-branch.ts — McTsBranch, MctsRunResult, PeerAdapter, ValueScorer - application/mcts-explorer.ts — UCB1 selection, backprop, expansion via policy, least-spend peer load balance, per-peer budget caps, signature blacklist, pending-branch finalization (rejected-budget vs terminated) - 8 new tests: UCB1 invariants, basic exploration, tree expansion, signature rejection + peer blacklist, budget enforcement, multi-peer distribution, winner-by-average-score Beyond SOTA — both phases: - No web agent ships per-cookie attestation; cross-installation cookie sharing is a known open problem. The witness signature is the trust boundary. - No web agent distributes MCTS exploration across multiple installations. PeerAdapter abstracts local vs federation execution; the explorer itself is the wedge (signature verification + cost gating + winner selection). 187/187 tests passing (+22). Build + typecheck clean. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
8d10e1aa8c |
feat(browser): #2041 ADR-122 Phase 1 MCP + Phase 2 causal recovery
Phase 1 MCP tool surface (5 new tools):
- browser/sign-trajectory — seal a BrowserTrajectory into Ed25519 envelope
- browser/verify-trajectory — verify with optional trust-list filtering
- browser/plan-replay — dry-run replay with mutations (no browser exec)
- browser/build-replay-delta — detect action/outcome drift between runs
- browser/generate-witness-key — bootstrap a fresh Ed25519 keypair
Phase 2 (beyond-SOTA wedge: causal-graph self-healing selectors):
- domain/causal-recovery.ts — SelectorBreakEvent + CausalRiskAnnotation types
- infrastructure/causal-recovery-store.ts — in-memory + JSON-on-disk store
+ classifyBreak() taxonomy: not-found/not-visible/not-enabled/detached/
ref-stale/timeout/navigation-during-action/unknown
+ parseUrl() for origin/path isolation in the graph
- application/causal-recovery-service.ts — reportBreak / annotateSnapshot
/ decorateTree / explain (prior breaks + alternative locator suggestions)
- 18 new tests: classification, URL parsing, risk scoring (0→N breaks),
snapshot annotation, cross-origin isolation, explain with role+name
fuzzy-match, listBreaks
165/165 tests passing (was 147; +18 for Phase 2). Build + typecheck clean.
Beyond SOTA: no other web agent (Surfer-H, Browser Use, Stagehand, Operator,
Skyvern) surfaces WHY a selector broke — they retry silently. AgentDB-backed
swap is a single-file change (IBreakStore interface).
Co-Authored-By: RuFlo <ruv@ruv.net>
|
||
|
|
5fedd1d022 |
feat(browser): #2041 ADR-122 Phase 0 + Phase 1 — agent-browser 0.27 + signed trajectories
Phase 0 (convergence): - Bump agent-browser dep ^0.6.0 → ^0.27.0 (21-minor drift closed) - Package version → 3.0.0-alpha.4 - Adapter already had full 0.27 surface (find/mouse/set/network/tabs/etc.) Phase 1 (beyond-SOTA wedge: signed trajectory containers): - domain/signed-trajectory.ts — envelope schema + replay types - infrastructure/witness-signer.ts — Ed25519 sign/verify via node:crypto - application/signed-trajectory-service.ts — seal/verify/replay-plan/replay-delta - BrowserService.endTrajectory now optionally seals via signTrajectories:true - 19 new tests: round-trip, tamper detection, trust list, replay planning, delta detection, determinism. 147/147 tests passing. Acceptance (Phase 1): - record → sign → distribute → verify round-trips - forging a step/goal/screenshot-hash breaks verify (signature invalid) - trust-list filtering accepts/rejects by signer public key - replay planning applies replaceStepInput + skipSteps mutations - buildReplayDelta detects action drift + outcome drift Beyond SOTA: no other web agent (Surfer-H, Browser Use, Stagehand, Operator, Skyvern) ships cryptographic provenance for AI browsing sessions. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
5b71c7ac13 |
release(alpha.43+44): pin neural→sona@0.1.5, republish modules w/ standalone READMEs, add npm download badges everywhere (#2022)
This commit closes the chain started in |
||
|
|
ca0a6fa5cb |
docs(modules): publish standalone-use recipes for memory, embeddings, security + flag @ruvector/sona empty-publish blocking neural
Adds a 'Standalone use (without the Ruflo CLI)' section to each
module's README right after Installation, with copy-pasteable
recipes verified against the published artifacts (fresh `npm install`
clean room, no patched dist, exit 0 for every example).
Recipes:
@claude-flow/memory (@3.0.0-alpha.16)
1. HNSWIndex — add 3 vectors, search top-2, no other deps
2. ControllerRegistry + injected AgentDB — proves the v3
governance layer works on a caller-owned AgentDB instance
(the agentdb injection field added in #2019)
@claude-flow/embeddings
1. MockEmbeddingService + cosineSimilarity — embed + compare
without network calls
2. Provider swap snippet showing OpenAI / Transformers / etc.
keep the same API surface
@claude-flow/security (@3.0.0-alpha.7)
1. InputValidator.validate(EmailSchema) +
new PasswordHasher({ rounds: 12 }) +
createCredentialGenerator().generateApiKey() — three of the
OWASP top 10 in ~15 lines
2. createDevelopmentExecutor — git through the allowlist gate;
createProjectPathValidator — refuses `../` traversal with
errors[] surfaced
Bugs uncovered by running the recipes against live npm:
- `embed()` returns { embedding, tokens, ... }, not a raw Float32Array
(recipe destructures `.embedding`).
- createPasswordHasher(rounds: number) accepts a NUMBER, not a
config object (passing `{ rounds: 12 }` made config.rounds nest
into `{ rounds: 12 }` and bcryptjs threw 'Illegal arguments:
string, object'). Switched recipe to `new PasswordHasher(...)`.
- generateCredentials() does NOT generate API keys — that lives
on `CredentialGenerator.generateApiKey(prefix)`. Recipe now
uses createCredentialGenerator().generateApiKey().
- PathValidator result is { isValid, errors[], ... }, not
{ valid, error }. Recipe matches the real shape.
Not included — @claude-flow/neural standalone recipe:
@claude-flow/neural@3.0.0-alpha.8 currently fails on fresh
install because @ruvector/sona@0.1.6 is an empty publish (only
README + package.json — no index.js, no native bins).
@ruvector/sona@0.1.5 had full content (index.js + 7 platform
bins), so this is a regression in the latest sona release that
blocks the entire neural package from loading.
Rather than ship a broken recipe, the neural README gains a
'Known issue' callout pointing at @ruvector/sona@0.1.6. Fix
path: republish @ruvector/sona with content or pin
@claude-flow/neural to @ruvector/sona@^0.1.5 in its next bump.
Co-Authored-By: RuFlo <ruv@ruv.net>
|
||
|
|
9056720219 |
fix(browser): #2015 round 2 — strip bogus --kind flag, ship alpha.42
Round 1 (alpha.41) added the required --dimension flag to `ruvector rvf create` but left the equally bogus `--kind browser-session` in place. ruvector@0.2.25's `rvf create` accepts only: -d, --dimension <n> (required) -m, --metric <metric> (optional, default cosine) Commander's required-option check fires before its unknown-option check, so the original bug report (#2015) only surfaced the dimension error. The fresh live regression check after publishing alpha.41 exposed the second-layer bug: `error: unknown option '--kind'`. This round: - Strip `--kind browser-session` from all 5 call sites (TS source, compiled dist via rebuild, replay-spike.sh, browser-agent.md, browser-record/SKILL.md). Also fixed the ADR prose example. - Tighten the smoke (scripts/smoke-browser-rvf-create-flags.mjs): - Switch from rg-based content scan to an explicit PATHS_IN_SCOPE list (the original `--kind browser-session` anchor is gone, so we can no longer identify call sites by content). - Police BOTH invariants per line: * --dimension / -d is present * --kind is ABSENT (since ruvector@0.2.25 rejects it) - Skip quoted-string false positives ('rvf create failed' log lines). Versions: @claude-flow/cli 3.7.0-alpha.42 claude-flow 3.7.0-alpha.42 ruflo 3.7.0-alpha.42 @claude-flow/memory 3.0.0-alpha.16 (unchanged, #2019 fix already live) Post-publish live functional check (everything green): - ruvector rvf create --dimension 384 (no --kind): exit 0, .rvf file written. Reproduces what the MCP tool now invokes. - Published CLI dist:113 carries '--dimension','384', no --kind. - #2019 vectorBackend / graphAdapter functional test from alpha.41 still passes against published memory@3.0.0-alpha.16. - verify.mjs precondition contract still holds. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
e4bd9bbcbe |
fix(verify+memory+browser): #1880, #2019, #2015 — three precondition/contract fixes + CI guards
Three small but recurring bugs ship together because they share the same anti-pattern: a try/catch (or a missing flag) silently turned a clear precondition failure into a vague "verification failed" / "controller disabled" / "rvf create failed" outcome that downstream consumers couldn't act on. #1880 — witness verify exits 1 on source-only checkouts - The 12h scheduled verification has been filing a duplicate "HIGH — verification broken" issue every cron run since 2026-05-10 because the runner does a source-only checkout (no @noble/ed25519 install, no `npm run build`) and verify.mjs lumped that into the same exit-1 bucket as a real signature regression. - verify.mjs now reserves exit 2 strictly for precondition misses: * @noble/ed25519 not installed → exit 2 * every manifest entry missing AND manifest → exit 2 references /dist/ paths (= "dist not built") Real failures (signature invalid, specific marker regressed) keep exit 1. The scheduled runner can now distinguish "needs install/build" from "we broke something". - New CI guard: scripts/smoke-witness-verify-precondition.mjs drives all three shapes (missing dep, all-files-missing, built tree) and asserts the exit code contract. - Wired into v3-ci.yml as witness-verify-precondition-smoke and into witness-verify's `needs:` so a contract break blocks publish. #2019 — vectorBackend controller permanently disabled - @claude-flow/memory's controller-registry.ts calls agentdb.getController('vectorBackend'). agentdb@3.0.0-alpha.14's getController switch only handles memory/reflexion/skills/causal and throws `Unknown controller: vectorBackend` for everything else — silently swallowed, leaving the controller `enabled: false` even though `agentdb.vectorBackend` is a real field on the instance (assigned in AgentDB.initialize()). - Registry now probes `agentdb[name]` directly first, falls back to getController only when the field is absent. Applied to all three accessor paths (initializeController, get, isEnabled). - RuntimeConfig gains an optional `agentdb` injection field so tests and consumers with a pre-built AgentDB can govern it via the registry. - Two new tests in controller-registry.test.ts cover both branches (direct property wins; falls back to getController when absent). - Full controller-registry suite stays green (67 tests). #2015 — ruflo-browser session_record fails every call - ruvector@0.2.25 makes `-d, --dimension <n>` required on `rvf create`. The browser_session_record MCP tool wrapper invoked `rvf create … --kind browser-session` WITHOUT the flag, so every call returned `{ success: false, error: "rvf create failed" }`. - All five call sites updated to pass `--dimension 384` (matches MiniLM-L6 / AgentDB index default): v3/@claude-flow/cli/src/mcp-tools/browser-session-tools.ts plugins/ruflo-browser/scripts/replay-spike.sh plugins/ruflo-browser/agents/browser-agent.md plugins/ruflo-browser/skills/browser-record/SKILL.md plugins/ruflo-browser/docs/adrs/0001-browser-skills-architecture.md - New CI guard: scripts/smoke-browser-rvf-create-flags.mjs statically scans every `rvf create … --kind browser-session` invocation across the repo (TS, dist, shell, markdown) and fails if any is missing --dimension / -d. - Wired into v3-ci.yml as browser-rvf-create-flags-smoke and into witness-verify's `needs:` so a regression blocks publish. Cases covered by guards: source-only checkout (no deps), source-only checkout with build, built tree, missing dimension flag on TS/dist/ shell/markdown call sites. The smokes are independent jobs so the CI summary names the specific contract that broke. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
d5dbfa4b92 |
fix(hooks): #2017 — defensive pre-bash + new CI gate against silent-swallow shape
The pre-bash PreToolUse hook in .claude/helpers/hook-handler.cjs is a security gate that refuses dangerous commands. In 3.6.30 it read the wrong stdin field (`toolInput` object instead of `toolInput.command` string), `.toLowerCase()` threw TypeError, the global safety-timer try/catch swallowed it, and the handler printed misleading "[OK] Command validated" while exiting 0 — letting `rm -rf /` through. The bind-the-string fix already landed in alpha.39 via #1944. This commit adds: 1. Belt-and-suspenders defensive coding — wrap with String(... || '') so any future regression that re-binds command to null/undefined/an object can no longer throw and silently exit 0. 2. New dedicated CI job `pre-bash-hook-smoke` (#2017) that drives real Claude-Code-shaped PreToolUse JSON into BOTH handler copies and fails on any of: - dangerous command + exit 0 (the security bypass) - "[OK] Command validated" on a dangerous input (misleading log) - "[WARN] Hook X encountered an error" anywhere (silent-swallow) Wired into witness-verify's needs:, so the gate now blocks publish. 3. Path filters extended: '**/.claude/helpers/hook-handler.cjs' triggers the smoke whenever either handler copy changes. Cases covered: dangerous rm -rf /, fork-bomb, format c:, null command field (defensive), empty payload, snake_case tool_input.command shape (the exact #2017 reproduction), innocuous ls -la. Ships as 3.7.0-alpha.40 to all three packages. |
||
|
|
1430b4c76e |
fix(embeddings): #2018 — drop @huggingface/transformers from optionalDependencies (npx Invalid Version)
Same failure shape as #1147: `npx @claude-flow/cli@latest` crashes with `npm error Invalid Version: ` on npm 11.x / Node 24+. Root cause: @claude-flow/embeddings declared @huggingface/transformers in both `optionalDependencies` AND `peerDependencies` (with peerDependenciesMeta.optional = true). When npm 11.x arborist runs PlaceDep.pruneDedupable → Node.canDedupe → semver.eq, the overlap plus a "-dev." prerelease transitive (onnxruntime-web@1.26.0-dev.…) trips the empty-version crash inside @npmcli/arborist. Fix: - @claude-flow/embeddings: keep only the optional peerDependency, drop the duplicate optionalDependencies entry. Bumped to 3.0.0-alpha.17. - @claude-flow/cli: pin embeddings to ^3.0.0-alpha.17 so existing lockfiles re-resolve to the fixed version. Bumped to 3.7.0-alpha.39. Regression guards (so this can't recur): - scripts/audit-package-dep-overlap.mjs — static check that no package declares the same name in BOTH optionalDependencies and peerDependencies. Wired into v3-ci.yml as part of the plugin-package-audit job. - scripts/smoke-cli-npx-install.mjs — behavioural smoke: pack the CLI tarball, install it into a scratch project with optionals enabled, fail if `npm install` prints "Invalid Version:" or exits non-zero. New v3-ci.yml job `cli-npx-install-smoke` runs on Node 22 + 24 (Node 24 ships npm 11.x, where the bug surfaces) and gates witness-verify. Verified end-to-end: $ npx -y @claude-flow/cli@3.7.0-alpha.39 doctor ✓ MCP Servers, AIDefence, Disk Space, TypeScript … 10 passed |
||
|
|
455f0b17be |
fix(plugin-agent-federation): #1949 — agentic-flow → optional peer dep (drops cookies@0.9.1 blocker) (#2013)
Hardened npm registries reject `@claude-flow/plugin-agent-federation@alpha` with `403 Forbidden` on `cookies@0.9.1` because of a deep transitive chain (agentic-flow → fastmcp → mcp-proxy → pipenet → koa → cookies). The plugin only uses agentic-flow for one function (`loadQuicTransport` as fallback), so it doesn't need to be a hard runtime dep. **package.json** - Moved `agentic-flow` from `dependencies` → `peerDependencies` with `peerDependenciesMeta.agentic-flow.optional = true` - Added `midstreamer` as a second optional peer (so an operator can pick either or both backends — per ADR-120's Step 2 loader) - Kept `agentic-flow` in `devDependencies` so vitest + tsc still resolve it in this workspace - Bumped version 1.0.0-alpha.15 → 1.0.0-alpha.16 **midstream-aware-loader.ts** - Replaced the static value import of `loadQuicTransport` with a lazy `loadAgenticFlowQuicTransport()` that uses direct dynamic `import()` (vitest-mockable) and falls back to `null` when the package isn't installed - Type imports remain static — they're erased at compile time, so TypeScript users still get full IntelliSense without forcing the install - `loadFederationTransport()` now throws a clear, actionable error when neither midstreamer nor agentic-flow is present, instead of silently crashing on a missing module **Impact** - Install size: 529 packages → 2 packages (verified via `npm pack` + fresh install in an empty workspace) - No more `cookies@0.9.1`, no more `koa-router@14.0.0` deprecation warning, no more 403 in hardened registries - 555/555 vitest tests pass (up from 549 — 6 loader tests now exercise the new lazy-import path) **audit-fix-invariants.mjs** - Added 4 new invariants checking the peer-dep wiring stays in place (package.json `peerDependencies` + `peerDependenciesMeta`, and the loader's type-only import + lazy loader symbol) - 38/38 invariants pass Closes #1949. Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
29ea78f21e |
chore(release): 3.7.0-alpha.38 — ADR-120 Step 3 (Rust peer crate) + Step 2 path update (#2010)
Cuts alpha.38 covering #2009 (Rust peer crate + midstreamer@0.3.1 path update). Tests: cargo (3/3), vitest (555/555), audit (31/31). Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
b50d4dd7a2 |
feat(federation): ADR-120 Step 3 — Rust peer crate + Step 2 path update (#2009)
Lands the remaining ADR-120 work in ruflo now that upstream ruvnet/midstream#81 shipped midstreamer@0.3.1 with real QUIC. ## Step 3 — `v3/crates/ruflo-federation-peer/` New Rust crate that composes the QUIC transport (midstreamer-quic or any TransportProvider impl) with the AIMDS 3-gate safety pipeline (any SafetyGate impl) into a single Peer<T, G, D> dispatch loop. Replaces today's Node-bridge → Node-MCP → Rust-crate path with one process per federation peer. Surface: * `TransportProvider`, `SafetyGate`, `Dispatcher` traits — async, Send + Sync, so the Peer can run in any tokio executor. * `Peer::run()` — inbound dispatch loop. `Pass` → dispatch; `Block` → quarantine (never reaches dispatch); `Redact` → dispatch the cleaned variant. * `Peer::send()` — outbound through the gate first; Block error bubbles back to the caller. * `--features native` — pulls in midstreamer-quic@0.2.1 + aimds-{core,detection,analysis,response}@0.1.1 from crates.io. Without it, the binary builds and the trait surface compiles so CI / `cargo check` work in any tree. Verified: * `cargo build` and `cargo test` — 3/3 unit tests pass (dispatch loop with PassThroughGate, BlockEverythingGate, and outbound-send-blocks-when-gate-blocks). * `cargo check --features native` — resolves the upstream deps cleanly. ## Step 2 update — `midstream-aware-loader.ts` Probes `midstreamer/quic` (the new sub-path added in midstreamer@0.3.1) first, falls back to the root `midstreamer` import for older versions. Accepts both ESM and CommonJS shapes (via `.default`) since the upstream sub-path is CJS. ## CI guards * New workflow `.github/workflows/federation-peer-rust.yml`: two jobs — `stable-noop` (cargo build + cargo test without features) and `stable-native` (cargo check --features native). Triggers on changes to the crate or this workflow. * `scripts/audit-fix-invariants.mjs` gains 4 invariants pinning the crate name + the midstreamer-quic version + the two pluggable trait names. 31 invariants now present across 18 files (was 27/16). ## Verification matrix * `node scripts/audit-fix-invariants.mjs` → 31/31 ✓ * `npx vitest run` in plugin-agent-federation → 22 files, 555/555 ✓ * `cargo test` in v3/crates/ruflo-federation-peer → 3/3 ✓ Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
6e0ced7935 |
chore(release): 3.7.0-alpha.37 — ADR-119 + ADR-120 + Step 2 loader (#2008)
Cuts the alpha.37 release covering the three midstream-related PRs merged today: #2005 — ADR-119 — midstreamer adoption assessment (decision: wait) #2006 — ADR-120 — cross-port plan (Steps 1-3) #2007 — ADR-120 Step 2 — midstream-aware federation transport loader Source changes are TS-only + audit guards; no native build surface change. The midstream-aware loader is opt-in via MIDSTREAMER_QUIC_NATIVE and falls through transparently to the agentic-flow loader otherwise, so behavior on the published package is unchanged today. • audit-fix-invariants.mjs: 27 invariants across 16 files (was 25/14) • Federation plugin tests: 555/555 passing • Type-check: clean Bumps all 3 packages (@claude-flow/cli, claude-flow umbrella, ruflo umbrella) to 3.7.0-alpha.37. Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
8f5934dea5 |
feat(federation): ADR-120 Step 2 — midstream-aware transport loader (#2007)
Lands the ruflo-side of ADR-120 (cross-port agentic-flow QUIC into
midstream + Rust inflight agentics) Step 2: extend the federation
plugin's transport loading to prefer midstream's real QUIC build
when MIDSTREAMER_QUIC_NATIVE=1, with a transparent fallthrough to
the existing agentic-flow loader (which itself handles ADR-108
native QUIC and ADR-104 WebSocket fallback).
Surface:
• New `src/transport/midstream-aware-loader.ts` —
`loadFederationTransport(config)` probes midstreamer first,
refuses the WASM stub via `isStub()` if reported (ADR-119),
returns a `LoadedFederationTransport` envelope with `source`
+ optional `fallbackReason` for log/metric visibility.
• `src/plugin.ts` now imports from the wrapper instead of
`agentic-flow/transport/loader` directly. Logs the resolved
source on successful load.
• 5 unit tests covering both branches (env unset / "0" / "1"
without package), config passthrough, envelope shape.
Behavior unchanged today: midstream's WASM build is a counter-
tracking stub per ADR-119, so `MIDSTREAMER_QUIC_NATIVE=1` falls
through to agentic-flow's loader on every install. The wrapper
activates the moment `midstreamer@0.3.0` ships real QUIC (ADR-120
Step 1, upstream work in ruvnet/midstream).
Test results in the worktree:
• Full plugin suite: 22 files, 555/555 tests passing
• audit-fix-invariants.mjs: 27 invariants across 16 files,
all present (was 25/14)
Two new invariants added to the audit guard so a refactor can't
silently revert to the bare `loadQuicTransport` import and bypass
the midstream preference.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
|
||
|
|
91657b9fce |
chore(release): 3.7.0-alpha.36 — 10 fixes + audit guard update (#2001)
Cuts the alpha.36 release covering today's 10 PRs (#1992-#2000): #1989 statusline RFE1 cascade (#1992) #1987 memory stats HNSW persistent (#1993) #1973 Windows install README (#1994) #1948 platform-aware statusLine cmd (#1995) #1937 memory_import_claude excl. (#1996) #1921 @opentelemetry/core override (#1997) #1910 MCP stdio stdout protection (#1998) #1880 verify.mjs actionable error (#1999) #1872 SwarmCoordinator (2 of 5) (#2000) #1990 runtime-smoke gate count Plus 9 new invariants added to `scripts/audit-fix-invariants.mjs` covering the source-side fixes (statusline magic-bytes, page-count clamp, memory-stats persistent count, platform-aware statusLine, exclusion-patterns flag, otel pin, MCP stdio mode + uncaught handler, scaleAgents target semantics, executeTask try/catch). Result: `node scripts/audit-fix-invariants.mjs` → 25 invariants across 14 file(s), all present. Bumps all 3 packages (@claude-flow/cli, claude-flow umbrella, ruflo umbrella) to 3.7.0-alpha.36. Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
0873f81463 |
fix(mcp): protect stdout from stray console.log in stdio MCP mode (#1910) (#1998)
A broad MCP tool smoke test bricked the transport mid-batch: after hooks_pre_task ran, every subsequent hooks_* / mcp_* call returned `Transport closed`, including mcp_status. Root cause is stdout protocol corruption — Codex closes the MCP transport the moment it sees a non-JSON line on fd 1, and one or more of the modules that hooks_route lazy-loads (@ruvector/router, @claude-flow/neural, transformers.js/ONNX, semantic-router init) emits a diagnostic via console.log into the JSON-RPC stream. Defense in three layers, all in `startStdioServer()`: 1. **Hijack console.log/info/debug → stderr.** As the first thing the server does, replace those three methods with stderr writers prefixed `[stdout→stderr]`. Any subsequent module that calls `console.log(...)` (lazy-loaded or otherwise) goes to stderr instead of corrupting the protocol. `console.error` is unchanged. 2. **`writeFrame()` helper for JSON-RPC.** All three server-originated frames (`server.initialized`, the `Request too large` error, and tool responses) go through a dedicated helper that calls `process.stdout.write(...)` directly. The hijack above can't redirect protocol frames because they bypass `console.log` entirely. 3. **uncaughtException + unhandledRejection handlers.** Previously only SIGINT/SIGTERM were caught — an unhandled rejection in a lazy-loaded module's init (very common during the hooks semantic-router race the issue describes) crashed the server silently. Now those go to stderr with the full stack and the process stays up. Plus: sets `process.env.MCP_STDIO_MODE = '1'` so downstream code that wants to behave differently in stdio mode can probe a single flag. Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
ced2abc200 |
feat(memory): excludeFilePatterns/excludeFiles for memory_import_claude (#1937) (#1996)
`memory_import_claude` only had `allProjects: true/false` granularity.
Voice-fidelity-aware operators (named-persona content, PII-aware
hygiene) couldn't bulk-import without contaminating the unified
`claude-memories` namespace with the subset of files they had to
exclude. The current workaround was to halt imports entirely.
Two new params:
excludeFilePatterns: string[]
Glob patterns matched against the absolute file path. Files
matching ANY pattern are skipped. Supports:
`**` any chars including path separators
`*` any chars except path separators
`?` exactly one char except a path separator
Example: ["**/voice-*.md", "**/persona-*.md"]
excludeFiles: string[]
Absolute file paths to skip verbatim. Faster than a pattern when
the operator already has a list captured.
Both apply to either branch (`allProjects: true` or single-project).
The response gains an `excludedByPattern` counter so callers can
verify the exclusion ran.
A minimal `globToRegex` helper is added (anchored, escapes regex
metas, handles `**` / `*` / `?`). Verified four representative
cases pass; the unrelated regex escapes the issue's voice-fidelity
patterns need.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
|
||
|
|
1f8971d16b |
fix(init): platform-aware statusLine command (#1948) (#1995)
The statusLine command was hardcoded as
`sh -c 'D="${CLAUDE_PROJECT_DIR:-.}"; … exec node "$D/<script>"'`
on every platform. On native Windows (cmd / PowerShell, no
Git-Bash) `sh` either isn't on PATH or its quoting gets mangled.
Symptom in #1948: spurious files like `0)` or
`toastr.error('ESD...` appearing in the repo root because misparsed
shell tokens leak back into the file system as filenames.
Fix: detect `process.platform === 'win32'` at init time and emit a
shell-free command instead — a `node -e "…"` one-liner that
resolves the script path internally using `process.env`. No shell
quoting hazards because the resolution happens inside Node, not in
the shell.
Windows: node -e "const fs=require('fs'),p=require('path');
const d=process.env.CLAUDE_PROJECT_DIR||'.';
const f=p.join(d,'.claude/helpers/statusline.cjs');
const h=p.join(process.env.USERPROFILE||process.env.HOME||'.', '.claude/helpers/statusline.cjs');
require(fs.existsSync(f)?f:h);"
POSIX: unchanged (sh -c with project-dir / HOME fallback)
Verified both branches emit valid JSON when generated through the
real settings-generator path on each platform.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
|
||
|
|
6b9250ea8c |
fix(memory): memory stats HNSW count reads persistent DB (#1987) (#1993)
`memory stats` always reported `HNSW Index: active (0 entries)` even when `memory store` had just stored a vector and `memory search` successfully retrieved it. Root cause: the rendered count was `hnsw.entryCount`, which is the live in-process JS state (`hnswIndex?.entries.size`). A fresh `memory stats` invocation has never initialized HNSW in this Node process, so the in-process counter is always 0 — even when the persistent .swarm/memory.db has many entries with embeddings. Fix: prefer the persistent count from the `memory_stats` MCP tool, which already computes `entriesWithEmbeddings` by listing the DB's real rows. Fall back to the live counter when persistent count isn't available. When both are non-zero, take the max (covers the edge case where the live process has indexed more entries than the persisted store has flushed). Behavior matrix: hnsw.available persisted live → rendered false any any → "not active" (unchanged) true 0 0 → "available but not initialized" true N>0 any → "active (max(N,live) entries)" true 0 M>0 → "active (M entries)" (unchanged) Adds `entriesWithEmbeddings?: number` to the stats result type so TypeScript is happy. The MCP tool already returns this field; this just teaches the consumer to read it. Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
4680a2c044 |
fix(statusline): guard SQLite header read on encrypted memory.db (#1989) (#1992)
Resolves #1989. When encryption at rest is enabled, `.swarm/memory.db` becomes an RFE1-magicked ciphertext blob rather than a SQLite database. The statusline-generator's "page count at offset 28" fallback read ciphertext bytes as a uint32 and rendered 3,367,093,602 patterns, which then cascaded into fake DDD 5/5 / 100% / intelligence 100% downstream. Three defense layers, all in `statusline-generator.ts` (the template that `ruflo init` writes to `.claude/helpers/statusline.cjs`): 1. **Magic-bytes check** -- compare the first 16 bytes against the literal "SQLite format 3\\0" before interpreting any subsequent bytes. Encrypted, empty, or non-SQLite files are skipped. 2. **Page-count sanity clamp** -- reject pageCount > 1,000,000 (~4GB DB). Catches future regressions or genuinely corrupt headers even on plaintext SQLite. 3. **Defensive consumer clamps** in `getV3Progress` and `getSystemMetrics` -- `Number.isFinite` + range check on `learning.patterns` before deriving domainsCompleted / intelligencePct. If any future regression in the reader returns a wild value, the downstream displays stay honest. Verified with a fake RFE1-headered `memory.db` matching the forensic bytes from the issue: Before: DDD Domains 5/5 / 100% / patterns=3367093.6k / 🧠 100% After: DDD Domains 0/5 / 0% / patterns=0 / 🧠 0% The `\\0` in the SQLite-magic string is intentional: the statusline-generator emits via a JS template literal, so the source-level `\\\\0` resolves to `\\0` in the generated .cjs which JS then parses as the null byte. Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
4a19793e52 |
chore(release): 3.7.0-alpha.35 — ships #1974 mitigation
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.35. Fixes: - #1974 — neural-trader@2.7.1 has a malicious-by-accident `install` lifecycle script that recursively invokes `npm install` from inside the install hook → unbounded process recursion → ~120 GB RAM + 3,049 stuck processes on macOS Apple Silicon. The plugin's docs told users to run the dangerous command verbatim. Now every documented install uses `npm install --ignore-scripts neural-trader` (the linux-x64 binary is hardcoded inline in the upstream tarball, so the package still works on that platform after `--ignore-scripts`). 9 files patched + new `scripts/audit-neural-trader-safety.mjs` CI guard in the `hook-command-audit` job. Merged via #1976. Also closed #1975 (recruiter outreach, not a bug) and asked #1973 for specific repro details (vague "Windows install + bash + wiki" report without a failing command or error). Published to npm with all dist-tags updated: - @claude-flow/cli 3.7.0-alpha.35 (alpha, latest, v3alpha) - claude-flow 3.7.0-alpha.35 (alpha, latest, v3alpha) - ruflo 3.7.0-alpha.35 (alpha, latest) Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
c29ed99637 |
chore(release): 3.7.0-alpha.34 — ships #1968 fix + #1946/#1943/#1940 closeouts
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.34. Code fix: - #1968 — daemon start --workers map silently dropped the flag when the launcher forked the foreground child, so the daemon came up with the full default worker set regardless of the user's selection. Threaded --workers / --headless / --sandbox through the same validation + forwarding path the resource thresholds already use. Merged via #1970. Issue-tracker closeouts (no new code — these were fixed in earlier alphas but the issues weren't auto-closed by the PRs that resolved them): - #1946 — doctor "Not initialized" — fixed in alpha.29 (#1959) - #1943 — global-install hook MODULE_NOT_FOUND — fixed in alpha.28 (#1957) - #1940 — bridge_status totalEntries:0 — fixed in alpha.31 (#1963) Published to npm with all dist-tags updated: - @claude-flow/cli 3.7.0-alpha.34 (alpha, latest, v3alpha) - claude-flow 3.7.0-alpha.34 (alpha, latest, v3alpha) - ruflo 3.7.0-alpha.34 (alpha, latest) Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
8a4803020f |
fix(daemon): forward --workers / --headless / --sandbox to forked child (#1968) (#1970)
`daemon start --workers map` (and `--headless` / `--sandbox`) were accepted by the launcher but silently dropped when it forked the foreground child — so the daemon came up with the full default worker set (`map,audit,optimize,consolidate,testgaps`) regardless of what the user asked for. Root cause: `startBackgroundDaemon()` only accepted resource thresholds (`--max-cpu-load` / `--min-free-memory`) and forwarded just those plus `--workspace` to the forked child. `--workers` / `--headless` / `--sandbox` were read by `ctx.flags.*` but never passed through. Fix: thread the three additional flags through the launcher and add them to the forked child's argv, gated by the same kind of strict input validation the existing thresholds use: - `--workers <list>` — `/^[a-z][a-z0-9_-]*(,[a-z][a-z0-9_-]*)*$/` - `--headless` — boolean - `--sandbox <mode>` — one of `strict|permissive|disabled` Anything that fails validation is dropped silently — same posture as the existing thresholds. Forced through the same `forkArgs.push()` path so the child sees them in argv (which both the daemon's own arg parser AND `killStaleDaemons` rely on for workspace identification). Behaviour now (matching the user's repro from #1968): $ ruflo daemon start --workers map --max-cpu-load 1000 --min-free-memory 0 $ ruflo daemon status Workers Enabled: 1 map enabled Build verified clean (tsc). Resolves #1968. Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
40e94434ff |
chore(release): 3.7.0-alpha.33 — 14 critical fixes since alpha.27
Cumulative batch release closing out the issue-triage cycle that started at alpha.27. Bumps @claude-flow/cli, claude-flow, and ruflo to alpha.33; each prior bump (.28→.32) shipped its fix-set immediately but had no GitHub Release writeup. This commit + tag closes the loop. Fixes shipped since alpha.27 (resolved-issue list): Memory layer: - #1947 vector_indexes schema dim 768→384 (default model is 384-dim) - #1942 Bridge search index 768 vs imported 384-dim — same root cause - #1952 Windows: memory store ok, search returns 0 — same root cause - #1945 CLI memory store didn't persist on non-default memory paths (bridge ignored CLAUDE_FLOW_MEMORY_PATH / config) - #1946 doctor reported DB "Not initialized" on a valid DB at data/memory/memory.db (same cwd-path-hardcode root cause) - #1941 memory_search returned 0 for non-default namespaces — every store path now provisions per-namespace vector_indexes rows - #1940 memory_bridge_status reported totalEntries:0 — used entries.length (page size) instead of .total (row count) - #1939 Win32 cwd didn't resolve to Claude Code's on-disk slug — drive-colon / backslash / whitespace now normalised to `-` - #1947 RC2 embeddings index -a build required `-c` — now optional Hooks layer: - #1944 pre-bash TypeError on every Bash call — toolInput (object) was used as the prompt string fallback; switched to .command - #1943 global-install hooks fired MODULE_NOT_FOUND — settings paths now probe project-local first, fall back to $HOME UI / statusline: - #1953 hooks_pretrain extracted 0 patterns on md-heavy repos — used a code-file budget + code-dir-first traversal - #1951 statusline hardcoded V3.5 — now probes plugin install path first, falls back to npm install / source checkout Verification: - #1949 federation plugin install 403 on cookies@0.9.1 — added scripts/verify-federation-plugin.sh that pins cookies@0.9.0 at the verification harness root. Workaround until upstream pipenet/koa chain ships a non-blocked release. CI regression guards (so these don't come back): - scripts/audit-vector-dim.mjs — #1947 dim guard - scripts/audit-hook-handler-prompt.mjs — #1944 toolInput guard Published to npm with all dist-tags updated: - @claude-flow/cli 3.7.0-alpha.33 (alpha, latest, v3alpha) - claude-flow 3.7.0-alpha.33 (alpha, latest, v3alpha) - ruflo 3.7.0-alpha.33 (alpha, latest) Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
0cdad108b9 |
chore(release): 3.7.0-alpha.32 — ships #1947 RC2 fix
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.32. Fixes: - #1947 RC #2 — `embeddings index -a build` REQUIRED `-c` and the docs suggested `-c default`/`-c documents`/etc., so users who stored entries under a non-default namespace ended up with `Vector Count: 0`. The HNSW index has always been a single global structure across all namespaces; `-c` is informational only. Make it optional, treat omitted `-c` as "(all namespaces)", and print a helpful hint when the resulting count is 0. Merged via #1964. Also posted an investigation comment on #1949 — the federation plugin install 403 is genuinely upstream-only (cookies@0.9.1 arrives transitively via `agentic-flow`, which is third-party; npm `overrides` in a non-root package.json aren't honored when consumers install the plugin as a dep). Documented why and what the actual fix path looks like, so the issue isn't lost. Published to npm with all dist-tags updated: - @claude-flow/cli 3.7.0-alpha.32 (alpha, latest, v3alpha) - claude-flow 3.7.0-alpha.32 (alpha, latest, v3alpha) - ruflo 3.7.0-alpha.32 (alpha, latest) Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
a5a6389852 |
fix(embeddings-index): make -c optional for build/rebuild (#1947 RC2) (#1964)
The HNSW index is a single global structure that indexes every
namespace's embeddings — `-c` was always informational. But the earlier
code REQUIRED `-c` for `build`/`rebuild` and the examples showed
`-c documents`/`-c patterns`/`-c default`, so users who stored entries
under a non-default namespace (e.g. `project`, `claude-memories`) hit
"Collection is required" on plain `-a build`, then re-ran with `-c default`
and got `Vector Count: 0` because that namespace was empty.
Drop the required check. When `-c` is omitted, label the result `(all
namespaces)`, run the same global rebuild, and print a helpful follow-up
if the resulting vector count is 0. Update help text + examples so the
intent is clear ("Omit to build for all namespaces"). No runtime
behavior change for callers passing `-c` — still indexes globally, just
labels the box with whatever they passed.
Build verified clean (tsc).
Resolves #1947 RC #2.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
|
||
|
|
6f7d04d224 |
chore(release): 3.7.0-alpha.31 — ships #1941 + #1940 bridge fixes
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.31. Fixes: - #1941 — memory_search returned 0 for non-default namespaces (e.g. claude-memories) because vector_indexes only held rows for `default` and `patterns`. Every store path now INSERT-OR-IGNOREs a per-namespace vector_indexes row before the entry write. Merged via #1963. - #1940 — memory_bridge_status reported totalEntries: 0 on DBs with hundreds of rows because it used listEntries({}).entries.length (capped at the 20-row page size). Now uses .total + reports a per-namespace breakdown. Merged via #1963. Published to npm with all dist-tags updated: - @claude-flow/cli 3.7.0-alpha.31 (alpha, latest, v3alpha) - claude-flow 3.7.0-alpha.31 (alpha, latest, v3alpha) - ruflo 3.7.0-alpha.31 (alpha, latest) Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
2c904df868 |
fix(memory): provision vector_indexes per namespace + truthful bridge_status (#1941, #1940) (#1963)
Two related memory-bridge bugs:
**#1941** — \`memory_search({namespace:"claude-memories"})\` always returned
0 results even when \`memory_import_claude\` had inserted hundreds of rows
into that namespace. The schema's \`vector_indexes\` table held only
\`default\` and \`patterns\` rows; AgentDB's HNSW/router keys namespace
lookups by this table, so any namespace without a row was effectively
unindexed for search.
Fix: every store path (both the AgentDB-bridge \`bridgeStoreEntry\` and the
raw-sql.js fallback \`storeEntry\`) now does \`INSERT OR IGNORE INTO
vector_indexes (id, name, dimensions) VALUES (?, ?, ?)\` for the entry's
namespace before the row insert. Idempotent; legacy DBs without the
table fall through cleanly. Dimensions defaults to the embedding's
actual dim (384 for the default model), preserving #1947's contract.
**#1940** — \`memory_bridge_status\` reported \`totalEntries: 0\` and
\`status: not-synced\` on DBs with hundreds of rows. Root cause: it used
\`listEntries({}).entries.length\`, but \`listEntries\` returns at most 20
entries with the full row count in a separate \`.total\` field — so the
status reporter was capped at the page size, not the table count.
Fix: use \`listEntries({}).total\` for the count. Plus surface a
per-namespace breakdown (\`agentdb.namespaces\`) for the common namespaces
(\`default\`, \`patterns\`, \`claude-memories\`, \`auto-memory\`, \`tasks\`,
\`feedback\`, \`pretrain\`) so callers can see where the rows actually live.
\`bridge.status\` now flips to \`connected\` on ANY persisted row, not only
\`claude-memories\` (the bridge is in use from many import paths).
Build verified clean (tsc).
Resolves #1941, #1940.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
|
||
|
|
3b14b7aa97 |
chore(release): 3.7.0-alpha.30 — ships #1953 + #1939 fixes
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.30. Fixes: - #1953 — hooks_pretrain extracted 0 patterns on markdown-heavy repos because the 50-file budget for import-pattern extraction counted EVERY file (.md/.yaml/.db/.log), not just code files. Fix uses a separate `codeFilesScanned` counter, sorts readdir so code-likely dirs recurse first, widens the per-file scan window 30→80 lines, and recognises more code extensions (.tsx/.jsx/.mjs/.cjs). Merged via #1961. - #1939 — memory_import_claude({allProjects:false}) returned 0 on Win32 installs because resolveProjectMemoryDir's slug candidates only handled forward slashes. Added a Win32 candidate that normalises drive-colon, backslash, and whitespace to `-` (`C:\Users\…\Claude Stuff` → `C--Users-…-Claude-Stuff`). Merged via #1962. Published to npm with all dist-tags updated: - @claude-flow/cli 3.7.0-alpha.30 (alpha, latest, v3alpha) - claude-flow 3.7.0-alpha.30 (alpha, latest, v3alpha) - ruflo 3.7.0-alpha.30 (alpha, latest) Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
4e6822fa8d |
fix(memory-import): resolve Win32 cwd to Claude Code's slug (#1939) (#1962)
`memory_import_claude({ allProjects: false })` couldn't find the current
project's memory directory on a pure Win32+Win32 install, because the
slug candidates in `resolveProjectMemoryDir()` only replaced forward
slashes — never the drive-colon, backslash, or whitespace that a Win32
cwd contains.
Example:
- cwd: `C:\Users\tobia\OneDrive\Desktop\Claude Stuff`
- Claude Code's on-disk slug: `C--Users-tobia-OneDrive-Desktop-Claude-Stuff`
- Before this fix: no candidate matched, importer reported `imported: 0,
"No Claude memory files found"`.
Add a Win32-specific candidate gated on `/^[A-Za-z]:[\\/]/` that does the
full normalization (`:` / `\` / `/` / whitespace → `-`). The other four
candidates (legacy POSIX, WSL `/mnt/<drive>/`, leading-dash strip, space
rule) are unchanged, so no regression for the other setup classes.
Verified the new candidate emits
`C--Users-tobia-OneDrive-Desktop-Claude-Stuff` for the reporter's path.
Build verified clean (tsc).
Resolves #1939.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
|
||
|
|
1d414b194d |
fix(hooks-pretrain): code-file budget + code-dir-first traversal (#1953) (#1961)
`hooks_pretrain` reported `patternsExtracted: 0` on any monorepo whose depth-first traversal hit 50 non-code files (.md / .yaml / .db / .log / …) before reaching a single .ts/.js/.py/etc. The 50-file budget that gates the import-pattern scan was checked against `filesAnalyzed`, which counts EVERY directory entry — so in markdown-heavy repos (docs/, specs/, _bmad-output/, …) the budget burned out on Markdown long before the walker recursed into apps/, packages/, or src/. Two-part fix: 1. Use a separate `codeFilesScanned` counter for the budget, incremented only inside the `if (codeExts.includes(ext))` block. The 50-file cap now means "50 code files", which is what the comment always claimed. 2. Sort `readdirSync` entries so the walker recurses into code-likely dirs first (`src/`, `apps/`, `packages/`, `lib/`, `crates/`, `workers/`, `server/`, `backend/`, `frontend/`, `app/`, `cli/`, `core/`) and deprioritises docs/specs/build/coverage/test dirs. Files are mixed in between. Stable sort so test behaviour is deterministic. Plus two collateral improvements: - Widen the per-file scan window from 30 → 80 lines. Modern TS files often have license headers + JSDoc + type-only imports before the first `import` — the 30-line cap was missing real imports. - Recognise more code extensions: `.tsx`, `.jsx`, `.mjs`, `.cjs`. The `SUPPORTED_EXTRACTION_EXTS` list used by the "found N code files but 0 patterns" note got the same expansion so the diagnostic stays accurate. Build verified clean (tsc). Resolves #1953. Co-authored-by: Reuven <cohen@ruv-mac-mini.local> |
||
|
|
3c4638bb91 |
chore(release): 3.7.0-alpha.29 — ships #1945 + #1946 + #1951 critical fixes
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.29. Critical fixes in this release: - #1945 — CLI `memory store` reported success but didn't persist when the user had a non-default memory path (e.g. `data/memory/memory.db` via `CLAUDE_FLOW_MEMORY_PATH`). Root cause: `memory-bridge.ts::getDbPath()` hard-coded `<cwd>/.swarm/memory.db` and ignored the env var / config, while `memory init` honored both — so the bridge wrote to one file and the user's next CLI invocation read from another. Merged via #1959. - #1946 — `ruflo doctor` reported "Memory Database: Not initialized" on perfectly-init'd DBs because `doctor.ts::checkMemoryDatabase()` only probed three legacy paths and ignored `CLAUDE_FLOW_MEMORY_PATH` / config entirely (also missed `data/memory/memory.db`, a common layout). Merged via #1959. - #1951 — statusline showed hard-coded "RuFlo V3.5" regardless of the installed version. Three files had the bug: two tracked `statusline.cjs` copies, plus the TypeScript template that writes the project-local statusline at init time. All now probe a fuller candidate list, preferring `~/.claude/plugins/marketplaces/ruflo/package.json` (the plugin install, which was never checked before). Merged via #1960. Published to npm with all dist-tags updated: - @claude-flow/cli 3.7.0-alpha.29 (alpha, latest, v3alpha) - claude-flow 3.7.0-alpha.29 (alpha, latest, v3alpha) - ruflo 3.7.0-alpha.29 (alpha, latest) Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
7ca28a7593 |
fix(statusline): read installed version from plugin package.json (#1951) (#1960)
The statusline showed a hard-coded "RuFlo V3.5" regardless of the
installed version, even on alpha.27 where `ruflo doctor` correctly
reported the real version.
Two files had the bug:
1. `v3/@claude-flow/cli/.claude/helpers/statusline.cjs` — fully hard-coded
`▊ RuFlo V3.5 ` in both header constructions, with no version-reading
logic at all. Added a startup version-probe (4 candidate package.jsons,
preferring the plugin install at `~/.claude/plugins/marketplaces/ruflo/`)
and wired `${RUFLO_VERSION}` into both headers.
2. `.claude/helpers/statusline.cjs` — already had version-reading, but its
candidate list only checked project-local `node_modules` paths, never
the plugin install location. Plugin users always fell back to `'3.5'`.
Added the plugin path as the first candidate.
3. `v3/@claude-flow/cli/src/init/statusline-generator.ts` — the template
that writes `<project>/.claude/helpers/statusline.cjs` at init time had
the same too-narrow candidate list. Same fix, applied to the template.
Probe order for all three:
1. ~/.claude/plugins/marketplaces/ruflo/package.json (plugin install)
2. <cwd>/node_modules/@claude-flow/cli/package.json (npm install)
3. <cwd>/node_modules/ruflo/package.json (umbrella)
4. <cwd>/v3/@claude-flow/cli/package.json (source checkout)
Falls through to a hard-coded default if all four are missing or malformed.
Build verified clean (tsc) on @claude-flow/cli.
Resolves #1951.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
|
||
|
|
434a8f95bb |
fix(memory): bridge + doctor honor CLAUDE_FLOW_MEMORY_PATH / config (#1945, #1946) (#1959)
Two CLI memory bugs caused by hard-coded `.swarm/memory.db` paths that
ignored the configured memory location:
**#1945** — `memory-bridge.ts::getDbPath()` always defaulted to
`<cwd>/.swarm/memory.db` regardless of `CLAUDE_FLOW_MEMORY_PATH` or
`claude-flow.config.json#memory.persistPath`. So a user with a non-default
memory layout (e.g. `data/memory/memory.db`) had `memory init` write the
schema to the configured file, while `bridgeStoreEntry()` silently wrote
INSERTs to `.swarm/memory.db` — a different file, sometimes a different
directory. CLI `memory store` reported success against the wrong DB, and
a fresh process reading the configured path saw zero rows ("store works
but next process finds nothing").
Fix: route `getDbPath()` through `getMemoryRoot()` (from
memory-initializer), the same function `memory init` uses. The two now
agree on the same file. `:memory:` and explicit `customPath` still work
unchanged; path-traversal protection unchanged.
**#1946** — `doctor.ts::checkMemoryDatabase()` only checked the legacy
paths `.claude-flow/memory.db` / `.swarm/memory.db` / `data/memory.db` and
ignored `CLAUDE_FLOW_MEMORY_PATH` / config entirely. So `ruflo doctor`
reported `⚠ Memory Database: Not initialized` on a perfectly-initialized
DB at `data/memory/memory.db`.
Fix: check `getMemoryRoot() + '/memory.db'` first (the authoritative
path); fall back to the legacy candidates for non-standard layouts; add
`data/memory/memory.db` to the fallback list (a common config that was
missing entirely).
Build verified clean (tsc) on `@claude-flow/cli`.
Resolves #1945, #1946.
Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
|