From 2ede870496b77059758a4808b260aee9756925cc Mon Sep 17 00:00:00 2001 From: rUv Date: Tue, 17 Nov 2026 10:21:06 -0500 Subject: [PATCH 01/10] fix(ruflo-console): POSIX append keeps every batch under uutils dd (#4978) (#5013) * fix(ruflo-console): POSIX append keeps every batch under uutils dd (#4978) The POSIX append script ran `dd bs=1M iflag=fullblock status=none >> "$1"`. uutils dd 0.10.0 (the default coreutils on Ubuntu 26.04, now the ubuntu-latest runner image) truncates its stdout to its own offset after writing: strace shows `lseek(1, 0, SEEK_CUR)` then `ftruncate(1, pos)`. With concurrent appenders that cuts off every batch another writer added in between, so the "eight writers" spec lost whole 60-line batches (1500/1680/1740 of 2400) and kept main's CI/CD Pipeline red. Add `conv=notrunc` (POSIX dd; GNU, BSD and uutils all accept it). In an ubuntu:26.04 container the spec fails 3/3 before (720, 721, 1080 lines) and passes 3/3 after; GNU dd is unaffected. Linux hosts still run the GNU argv, so the shipped Linux path was never affected; the script is the macOS/BSD path. The POSIX whole-set digest is re-pinned; the GNU digest is unchanged. ruflo-console 0.50.1 -> 0.50.2. Fixes #4978 Co-Authored-By: RuFlo * chore(ruflo-console): smoke pins 0.50.2 Co-Authored-By: RuFlo --------- Co-authored-by: r --- plugins/ruflo-console/.claude-plugin/plugin.json | 2 +- plugins/ruflo-console/CHANGELOG.md | 3 +++ plugins/ruflo-console/hooks/data/write-flavor.ts | 4 +++- plugins/ruflo-console/hooks/version.ts | 2 +- plugins/ruflo-console/scripts/smoke.sh | 4 ++-- plugins/ruflo-console/tests/write-flavor.spec.ts | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/ruflo-console/.claude-plugin/plugin.json b/plugins/ruflo-console/.claude-plugin/plugin.json index eb499b4b04..89df263cb8 100644 --- a/plugins/ruflo-console/.claude-plugin/plugin.json +++ b/plugins/ruflo-console/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-console", "description": "ruflo's cockpit inside Claude Code and the one /ruflo command for every ruflo mod (function hooks, early access). Views: overview with health alerts, swarm topology graph, claims flow with TTL rings, federation map, plugin health matrix, learning curve and pipeline, MetaHarness radar and audit trend, memory, cost gauge, agent timeline, approvals queue, event stream, a main menu, an x.ruv.io federation board, an AI terminal (codex, claude or both in remembered sessions, streamed), Skills (npx skills), a Hive-Mind view, a MetaHarness lab, agent drill-down; a command palette for confirm-gated actions through the ruflo CLI; a band above the prompt. Reads ruflo's files and the CLI's local JSON; anything not measured reads n/a. The one network call it makes by itself is a daily read of the published plugin.json at github.com/ruvnet/ruflo to offer an update (Settings \u2192 Updates: ask, auto, or off); it installs only through Claude Code's own claude plugin update, and never a new major version without asking.", - "version": "0.50.1", + "version": "0.50.2", "repository": "https://github.com/ruvnet/ruflo", "author": { "name": "ruvnet", diff --git a/plugins/ruflo-console/CHANGELOG.md b/plugins/ruflo-console/CHANGELOG.md index 4c7f00c398..c176707a96 100644 --- a/plugins/ruflo-console/CHANGELOG.md +++ b/plugins/ruflo-console/CHANGELOG.md @@ -2,6 +2,9 @@ Newest first. One `## — ` heading per version, then `feat:`, `fix:`, `breaking:` and `chore:` bullets (ADR-478). Built from git history; older versions: `git log -- plugins/ruflo-console`. +## 0.50.2 — 2026-11-17 +- fix: the POSIX append script (`dd … >> "$1"`) now passes `conv=notrunc`. uutils dd, the default coreutils on Ubuntu 26.04, truncates its stdout to its own offset after writing (`lseek` then `ftruncate`), so concurrent appenders lost whole batches; with the flag, eight writers keep all 2400 lines. Linux still runs the GNU argv; this script is the macOS/BSD path, and `conv=notrunc` is POSIX dd (#4978) + ## 0.50.1 — 2026-11-09 - chore: the command catalog (`catalog/command-catalog.json`) is regenerated from the CLI's `catalog.generated.json`. It picks up the three init commands renamed so they no longer collide with plugin commands (`/memory-neural`, `/stream-chain-run`, `/swarm-orchestrate`, #2640) and the mod registrations and plugins added since the last regeneration diff --git a/plugins/ruflo-console/hooks/data/write-flavor.ts b/plugins/ruflo-console/hooks/data/write-flavor.ts index cb86c267aa..8bab2a2062 100644 --- a/plugins/ruflo-console/hooks/data/write-flavor.ts +++ b/plugins/ruflo-console/hooks/data/write-flavor.ts @@ -95,9 +95,11 @@ const MKDIR = 'mkdir -p -- "$(dirname -- "$1")" || exit 1;' /** * The whole set of POSIX write scripts. umask 022 makes a created file 0644 (as `install -m 0644`); the touch uses 077 and chmod 600. * `set -C` (noclobber) makes the shell open with O_CREAT|O_EXCL, so an exclusive create fails on a file that is already there. + * The append needs `conv=notrunc`: uutils dd (the default coreutils on Ubuntu 26.04) truncates its stdout to its own offset after + * writing (`lseek(1, 0, SEEK_CUR)` then `ftruncate`), which cuts off every batch another writer appended in between (#4978). */ export const POSIX_SCRIPTS = Object.freeze({ - append: `umask 022; ${GUARD} exec dd bs=1M iflag=fullblock status=none >> "$1"`, + append: `umask 022; ${GUARD} exec dd bs=1M iflag=fullblock conv=notrunc status=none >> "$1"`, createExclusive: `umask 022; ${GUARD} set -C; exec cat > "$1"`, createExclusiveWithDirs: `umask 022; ${MKDIR} ${GUARD} set -C; exec cat > "$1"`, replace: `umask 022; ${GUARD} exec cat > "$1"`, diff --git a/plugins/ruflo-console/hooks/version.ts b/plugins/ruflo-console/hooks/version.ts index 45dcde8dd6..0f143e3f06 100644 --- a/plugins/ruflo-console/hooks/version.ts +++ b/plugins/ruflo-console/hooks/version.ts @@ -2,4 +2,4 @@ * The console's version, shown on the header so a person can tell which build is running. Kept equal to the plugin's manifest * (`.claude-plugin/plugin.json`); tests/version.spec.ts fails if the two drift. */ -export const CONSOLE_VERSION = '0.50.1' +export const CONSOLE_VERSION = '0.50.2' diff --git a/plugins/ruflo-console/scripts/smoke.sh b/plugins/ruflo-console/scripts/smoke.sh index 0e8cc278dd..400ff2ff13 100755 --- a/plugins/ruflo-console/scripts/smoke.sh +++ b/plugins/ruflo-console/scripts/smoke.sh @@ -11,9 +11,9 @@ step() { printf "→ %s ... " "$1"; } ok() { printf "PASS\n"; PASS=$((PASS+1)); } bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); } -step "1. plugin.json declares ruflo-console 0.50.1" +step "1. plugin.json declares ruflo-console 0.50.2" grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \ - && grep -q '"version": "0.50.1"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version" + && grep -q '"version": "0.50.2"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version" step "2. hooks.json names exactly one module and no classic hook commands" grep -q '"modules": \["./register.ts"\]' "$HOOKS/hooks.json" && ! grep -q '"command"' "$HOOKS/hooks.json" \ diff --git a/plugins/ruflo-console/tests/write-flavor.spec.ts b/plugins/ruflo-console/tests/write-flavor.spec.ts index 0bc6877774..e80afeb6a9 100644 --- a/plugins/ruflo-console/tests/write-flavor.spec.ts +++ b/plugins/ruflo-console/tests/write-flavor.spec.ts @@ -74,7 +74,8 @@ describe('the argv that shipped before is unchanged', () => { it('whole-set digests of the GNU and the BSD argv (taken before this change)', () => { expect(digest('gnu')).toBe('cfd9124d0ee8208f81f0c8dc87ccdc9505b17d632267f9b8a942a6ae987094ad') - expect(digest('posix')).toBe('4c60ee6b0510418188772bc443afc9b8744a46d18e6b07c82837f8960a4e1160') + // Re-pinned on purpose for #4978: the POSIX append gained `conv=notrunc` (uutils dd truncates its stdout after writing). GNU is unchanged. + expect(digest('posix')).toBe('fe9db855288c1dfa7fa87d443bb42062c75b9e82cc7c53a9ab55ea3aec8784d1') }) it('writeVia on gnu and posix is the same host.run call as before (argv, timeout, stdin)', async () => { From 0500750d2b34dedbc51af1635469d6f98e827865 Mon Sep 17 00:00:00 2001 From: rUv Date: Tue, 17 Nov 2026 11:19:17 -0500 Subject: [PATCH 02/10] fix(cli): init --dry-run no longer performs a real init (#4994) (#4995) Only --grok honoured --dry-run; every other mode ignored it and wrote the project scaffold, $HOME/.codex and the mods settings. It now writes nothing and says so. Co-authored-by: r --- .../cli/__tests__/init-dry-run-4994.test.ts | 27 +++++++++++++++++++ v3/@claude-flow/cli/src/commands/init.ts | 10 ++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 v3/@claude-flow/cli/__tests__/init-dry-run-4994.test.ts diff --git a/v3/@claude-flow/cli/__tests__/init-dry-run-4994.test.ts b/v3/@claude-flow/cli/__tests__/init-dry-run-4994.test.ts new file mode 100644 index 0000000000..fb66ea651d --- /dev/null +++ b/v3/@claude-flow/cli/__tests__/init-dry-run-4994.test.ts @@ -0,0 +1,27 @@ +/** + * #4994: `init --dry-run` used to be honoured only by --grok; every other mode + * ignored it and ran a real init (project scaffold, $HOME/.codex, mods enable). + * It must now write nothing and say so. + */ +import { describe, it, expect } from 'vitest'; +import { mkdtempSync, readdirSync, rmSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { initCommand } from '../src/commands/init.js'; + +describe('init --dry-run (#4994)', () => { + for (const flags of [{}, { codex: true }, { dual: true }]) { + it(`writes nothing with ${JSON.stringify(flags)}`, async () => { + const cwd = mkdtempSync(join(tmpdir(), 'ruflo-dry-')); + try { + const result = await initCommand.action!({ + args: [], cwd, interactive: false, flags: { ...flags, 'dry-run': true, dryRun: true }, + } as never); + expect(result?.success).toBe(true); + expect(readdirSync(cwd)).toEqual([]); + } finally { + rmSync(cwd, { recursive: true, force: true }); + } + }); + } +}); diff --git a/v3/@claude-flow/cli/src/commands/init.ts b/v3/@claude-flow/cli/src/commands/init.ts index 1a2ec57cdd..617426ed6b 100644 --- a/v3/@claude-flow/cli/src/commands/init.ts +++ b/v3/@claude-flow/cli/src/commands/init.ts @@ -1163,6 +1163,14 @@ const initAction = async (ctx: CommandContext): Promise => { }); } + // #4994 — only the Grok path implements a preview. For every other mode + // --dry-run used to be silently ignored and a real init ran (project scaffold, + // $HOME/.codex, mods enable). Refuse to write anything instead. + if (ctx.flags.dryRun === true || ctx.flags['dry-run'] === true) { + output.printWarning('--dry-run: nothing was written. A file preview is only available with --grok; remove --dry-run to run init.'); + return { success: true, data: { dryRun: true, written: [] } }; + } + if (codexMode && !dualMode) { return initCodexAction(ctx, { codexMode, dualMode: false, force, minimal, full }); } @@ -2054,7 +2062,7 @@ export const initCommand: Command = { }, { name: 'dry-run', - description: 'With --grok: list the files init would write, write nothing', + description: 'List the files init would write (--grok); for other modes write nothing and exit', type: 'boolean', default: false, }, From 15331cddd66e00987274a85f2d5af564b71a9d1c Mon Sep 17 00:00:00 2001 From: ordinary being Date: Wed, 18 Nov 2026 00:19:22 +0800 Subject: [PATCH 03/10] fix(release): keep the stale watermark mirror out of publish paths (#4993) v3/@claude-flow/watermark is a stale 0.2.0 copy of the package now built from ruvnet/ai-text-watermark (npm 0.4.x, crates.io 0.3.x). The npm package was already private, but still declared publishConfig, and the Rust crate remained publishable, so a recursive release could overwrite the canonical artifacts with stale code (#4959).\n\n- remove the contradictory publishConfig from the npm package;\n- set publish = false on the ruflo-watermark crate;\n- replace the README's stale 0.2.0 install/API guide with a pointer to the canonical source;\n- add a regression test and run it in the stable release gates so reopening either publish path fails before packing.\n\nRegistry attribution for the already-published 0.4.2 metadata remains owner-scoped to the @claude-flow publisher. Co-authored-by: rUv --- .github/workflows/stable-npm-release.yml | 3 +- .../watermark-canonical-source-4959.test.ts | 46 ++++++++ v3/@claude-flow/watermark/README.md | 105 +++--------------- v3/@claude-flow/watermark/package.json | 3 - v3/crates/ruflo-watermark/Cargo.toml | 4 + 5 files changed, 66 insertions(+), 95 deletions(-) create mode 100644 v3/@claude-flow/cli/__tests__/watermark-canonical-source-4959.test.ts diff --git a/.github/workflows/stable-npm-release.yml b/.github/workflows/stable-npm-release.yml index e1a99fe57b..eacdce10e6 100644 --- a/.github/workflows/stable-npm-release.yml +++ b/.github/workflows/stable-npm-release.yml @@ -113,7 +113,8 @@ jobs: pnpm --dir @claude-flow/cli exec vitest run \ __tests__/guidance-brain.test.ts \ __tests__/mcp-client-guardrail.test.ts \ - __tests__/x-federation-join.test.ts + __tests__/x-federation-join.test.ts \ + __tests__/watermark-canonical-source-4959.test.ts pnpm --dir @claude-flow/codex exec vitest run pnpm --dir @claude-flow/security exec vitest run pnpm --dir @claude-flow/plugin-agent-federation exec vitest run diff --git a/v3/@claude-flow/cli/__tests__/watermark-canonical-source-4959.test.ts b/v3/@claude-flow/cli/__tests__/watermark-canonical-source-4959.test.ts new file mode 100644 index 0000000000..923c299163 --- /dev/null +++ b/v3/@claude-flow/cli/__tests__/watermark-canonical-source-4959.test.ts @@ -0,0 +1,46 @@ +/** + * #4959: v3/@claude-flow/watermark is a stale 0.2.0 duplicate. The published + * npm package (0.4.x) and crate (0.3.x) are built from ruvnet/ai-text-watermark. + * + * A recursive publish from ruflo would otherwise ship the stale copy on top of + * the canonical release. Keep every publish path closed and keep the README + * pointing at the canonical source. + */ +import { describe, it, expect } from 'vitest' +import { readFileSync } from 'node:fs' +import { join, resolve } from 'node:path' + +const REPO = resolve(__dirname, '../../../..') +const PACKAGE_JSON = 'v3/@claude-flow/watermark/package.json' +const CARGO_TOML = 'v3/crates/ruflo-watermark/Cargo.toml' +const README = 'v3/@claude-flow/watermark/README.md' +const CANONICAL = + 'https://github.com/ruvnet/ai-text-watermark/tree/main/packages/watermark' + +const read = (relativePath: string) => readFileSync(join(REPO, relativePath), 'utf8') + +describe('@claude-flow/watermark non-canonical mirror (#4959)', () => { + it('keeps the npm package private and free of publishConfig', () => { + const pkg = JSON.parse(read(PACKAGE_JSON)) + expect(pkg.name).toBe('@claude-flow/watermark') + expect(pkg.private).toBe(true) + expect(pkg.publishConfig).toBeUndefined() + }) + + it('keeps the Rust crate out of cargo publish', () => { + const lines = read(CARGO_TOML).split(/\r?\n/) + const start = lines.findIndex((line) => line.trim() === '[package]') + expect(start).toBeGreaterThanOrEqual(0) + const nextTable = lines.findIndex( + (line, index) => index > start && /^\s*\[/.test(line), + ) + const packageTable = lines.slice(start + 1, nextTable === -1 ? undefined : nextTable) + expect(packageTable.some((line) => /^\s*publish\s*=\s*false\s*(?:#.*)?$/.test(line))).toBe(true) + }) + + it('points readers at the canonical source instead of documenting the stale API', () => { + const readme = read(README) + expect(readme).toContain(CANONICAL) + expect(readme).toMatch(/not\s+the\s+source|non-canonical|stale/i) + }) +}) diff --git a/v3/@claude-flow/watermark/README.md b/v3/@claude-flow/watermark/README.md index b816640873..156679d5b3 100644 --- a/v3/@claude-flow/watermark/README.md +++ b/v3/@claude-flow/watermark/README.md @@ -1,97 +1,20 @@ -# @claude-flow/watermark +# @claude-flow/watermark (non-canonical mirror) -SynthID-Text-style **LLM text watermarking** (generation + detection) as a -WebAssembly module — no native addon, runs in Node. A watermark rides the -tie-break randomness among *already-plausible* tokens: it never injects an -out-of-distribution word, costs no extra tokens, and is detectable only by a -holder of the secret key. Built for EU AI Act AI-content marking and for -measuring watermark robustness. +This directory is **not** the source of the published +[`@claude-flow/watermark`](https://www.npmjs.com/package/@claude-flow/watermark) +package or the `ruflo-watermark` crate. It is a stale 0.2.0 snapshot kept only +as a workspace reference. -Backed by the Rust crate [`ruflo-watermark`](https://github.com/ruvnet/ruflo/tree/main/v3/crates/ruflo-watermark). - -> This package intentionally ships **no watermark-removal / laundering tool**. -> The legitimate way to produce un-marked output of your own model is not to -> apply the mark (or to regenerate) — see the crate's `unmarked.rs`. - -## Install +The canonical source, current API, issue tracker and releases live in +[`ruvnet/ai-text-watermark`](https://github.com/ruvnet/ai-text-watermark/tree/main/packages/watermark). +The Rust crate is +[`ai-text-watermark/crates/ruflo-watermark`](https://github.com/ruvnet/ai-text-watermark/tree/main/crates/ruflo-watermark). ```bash -npm install @claude-flow/watermark +npm install @claude-flow/watermark # resolves the canonical 0.4.x package ``` -## Use - -The module is model-agnostic: at each step you pass the model's candidate token -ids and their probabilities (typically a top-k slice); the watermarker picks -which candidate to emit. - -```js -const { Watermarker, detect } = require('@claude-flow/watermark'); - -const key = '8F3A91C7'; // secret key material (carries no user info) - -// Generate a watermarked sequence. -const wm = new Watermarker({ key, scheme: 'gumbel' }); -const tokens = Uint32Array.from({ length: 128 }, (_, i) => i); -const probs = new Float32Array(128).fill(1 / 128); -const out = new Uint32Array(600); -for (let i = 0; i < out.length; i++) out[i] = tokens[wm.step(tokens, probs)]; -wm.free(); - -// Detect it. -const r = detect(out, { key, scheme: 'gumbel' }); -console.log(r.zScore, r.log10P, r.isWatermarked(1e-6)); // strong, true -``` - -## Schemes - -| `scheme` | Property | -|---|---| -| `gumbel` (default) | Aaronson/Kuditipudi exponential-min — **per-instance distortion-free** (marginal token distribution unchanged). | -| `tournament` | SynthID-Text tournament (Nature 2024) — strong, mildly distortionary; strength grows with `layers`. | -| `tournament_nd` | Tournament with continuous g + masking — **key-averaged non-distortionary** (measured < 0.3% drift). | - -## API - -- `new Watermarker({ key, scheme?, contextWidth?, layers? })` → `.step(tokens, probs)`, `.free()` -- `detect(tokens, { key, scheme?, contextWidth?, layers? })` → `Detection` -- `detectSelfSync(tokens, { key, contextWidth? })` — indel-robust (stronger on edited / repetitive text) -- `detectExact(tokens, { key, contextWidth? })` — exact Gamma-tail p-values for short texts - -`Detection` = `{ zScore, pValue, log10P, scoredPositions, isWatermarked(alpha = 1e-6) }`. -`key` may be a string (UTF-8) or `Uint8Array`. Detection is key-specific: a wrong -key sees nothing. Confidence grows with the number of low-stakes token choices, -so short or low-entropy (factual/code) text carries little to no mark. - -## Browser / Deno / bundler - -The `@claude-flow/watermark/web` entry is an ESM build. Instantiate the WASM once -with `await init()`, then use the same API. In a browser, `init()` with no -argument fetches the sibling `.wasm`; pass a `URL` / `Response` / bytes to -override. - -```js -import { init, Watermarker, detect } from '@claude-flow/watermark/web'; - -await init(); // browser: auto-fetches the wasm - -const wm = new Watermarker({ key: '8F3A91C7', scheme: 'gumbel' }); -const tokens = Uint32Array.from({ length: 128 }, (_, i) => i); -const probs = new Float32Array(128).fill(1 / 128); -const out = new Uint32Array(600); -for (let i = 0; i < out.length; i++) out[i] = tokens[wm.step(tokens, probs)]; -wm.free(); - -console.log(detect(out, { key: '8F3A91C7', scheme: 'gumbel' }).isWatermarked(1e-6)); -``` - -The `.` entry is the Node (CommonJS) build shown earlier; the `/web` entry is for -browser / Deno / bundlers. - -## Scope - -Bindings are generated from the Rust crate with `npm run build:wasm` -(`wasm-pack`, both `nodejs` and `web` targets). The crate exposes more than this -WASM surface — the Bayesian/Higher-Criticism detectors, the robustness-evaluation -harness, the Darwin/flywheel detector tuner, and the authorized un-marked- -generation governance path are Rust-only for now. +Do not publish from this directory. Both +`v3/@claude-flow/watermark/package.json` (`"private": true`) and +`v3/crates/ruflo-watermark/Cargo.toml` (`publish = false`) are pinned shut; +see [#4959](https://github.com/ruvnet/ruflo/issues/4959). diff --git a/v3/@claude-flow/watermark/package.json b/v3/@claude-flow/watermark/package.json index 9c21707865..32a426960c 100644 --- a/v3/@claude-flow/watermark/package.json +++ b/v3/@claude-flow/watermark/package.json @@ -56,9 +56,6 @@ "engines": { "node": ">=18" }, - "publishConfig": { - "access": "public" - }, "scripts": { "build:wasm": "bash scripts/build-wasm.sh", "test": "node test/smoke.cjs && node test/smoke-web.mjs", diff --git a/v3/crates/ruflo-watermark/Cargo.toml b/v3/crates/ruflo-watermark/Cargo.toml index d7e6850771..c4dc2c2436 100644 --- a/v3/crates/ruflo-watermark/Cargo.toml +++ b/v3/crates/ruflo-watermark/Cargo.toml @@ -9,6 +9,10 @@ [package] name = "ruflo-watermark" version = "0.1.0" +# This crate is a stale, non-canonical snapshot. The published crate (0.3.x) +# and npm package (0.4.x) are built from ruvnet/ai-text-watermark; see #4959. +# Keep every publish path closed so a release here cannot overwrite them. +publish = false edition = "2021" rust-version = "1.74" license = "MIT" From 56bc85267f05d876a049e0ebae35a4d91029ada0 Mon Sep 17 00:00:00 2001 From: rUv Date: Tue, 17 Nov 2026 11:19:27 -0500 Subject: [PATCH 04/10] fix(security): path traversal in session_import and workflow_validate (#4878) Over MCP, session_import (inputPath) and workflow_validate (file) read any file the caller named and returned the JSON parser's error text, which quotes the start of the file. Both now resolve MCP paths with containedReadPath (regular file inside the project, no symlinks), the same rule memory_import already applies. The local CLI marks its calls with localCliContext so operators can still name any file. Parse failures now return a fixed message, and workflow_validate reads through readImportFile so the 16 MiB import limit applies. Claude-Session: https://claude.ai/code/session_01MfPHVGRya9wHHpa9JZRJvY Co-authored-by: Claude --- .../__tests__/import-read-containment.test.ts | 91 +++++++++++++++++++ v3/@claude-flow/cli/src/commands/session.ts | 3 +- v3/@claude-flow/cli/src/commands/workflow.ts | 3 +- .../cli/src/mcp-tools/session-tools.ts | 22 +++-- .../cli/src/mcp-tools/workflow-tools.ts | 20 ++-- 5 files changed, 125 insertions(+), 14 deletions(-) create mode 100644 v3/@claude-flow/cli/__tests__/import-read-containment.test.ts diff --git a/v3/@claude-flow/cli/__tests__/import-read-containment.test.ts b/v3/@claude-flow/cli/__tests__/import-read-containment.test.ts new file mode 100644 index 0000000000..6f31d1fcd1 --- /dev/null +++ b/v3/@claude-flow/cli/__tests__/import-read-containment.test.ts @@ -0,0 +1,91 @@ +/** + * session_import and workflow_validate read a caller-named file. Over MCP the + * path must stay inside the project (as memory_import already does), and a + * parse failure must not echo the file's contents back to the caller. + */ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; + +const state = vi.hoisted(() => ({ cwd: '' })); +vi.mock('../src/mcp-tools/types.js', () => ({ getProjectCwd: () => state.cwd })); +vi.mock('../src/mcp-tools/agent-execute-core.js', () => ({ executeAgentTask: vi.fn() })); + +import { sessionTools } from '../src/mcp-tools/session-tools.js'; +import { workflowTools } from '../src/mcp-tools/workflow-tools.js'; +import { localCliContext } from '../src/mcp-tools/path-containment.js'; + +const CANARY = 'CANARY-7f3a-outside-project'; +const tool = (name: string) => [...sessionTools, ...workflowTools].find(t => t.name === name)!; +const run = (name: string, input: Record, context?: unknown) => + (tool(name).handler as (i: unknown, c?: unknown) => Promise)(input, context); +const importSession = (inputPath: string, context?: unknown) => run('session_import', { inputPath }, context); +const validateWorkflow = (file: string, context?: unknown) => run('workflow_validate', { file }, context); + +let base: string; +let outside: string; +beforeEach(() => { + base = mkdtempSync(join(tmpdir(), 'ruflo-read-containment-')); + state.cwd = join(base, 'project'); + mkdirSync(state.cwd); + outside = join(base, 'outside'); + mkdirSync(outside); + writeFileSync(join(outside, 'secret.txt'), `${CANARY}\nsecond line`); + writeFileSync(join(outside, 'session.json'), JSON.stringify({ name: 'external' })); + writeFileSync(join(outside, 'workflow.json'), JSON.stringify({ steps: [{ name: CANARY, agent: CANARY }] })); +}); +afterEach(() => rmSync(base, { recursive: true, force: true })); + +describe('MCP callers cannot read files outside the project', () => { + it.each([ + ['absolute path', () => join(outside, 'secret.txt')], + ['relative traversal', () => '../outside/secret.txt'], + ])('session_import refuses an %s without echoing contents', async (_label, path) => { + const result = await importSession(path()); + expect(result.error).toMatch(/inside the project directory/); + expect(JSON.stringify(result)).not.toContain('CANARY'); + }); + + it.each(['secret.txt', 'workflow.json'])('workflow_validate refuses outside file %s without echoing contents', async name => { + const result = await validateWorkflow(join(outside, name)); + expect(result.valid).toBe(false); + expect(result.errors[0].message).toMatch(/inside the project directory/); + expect(JSON.stringify(result)).not.toContain('CANARY'); + }); + + it('refuses a symlink inside the project that points outside', async () => { + symlinkSync(join(outside, 'secret.txt'), join(state.cwd, 'link.json')); + expect(JSON.stringify(await importSession('link.json'))).not.toContain('CANARY'); + expect(JSON.stringify(await validateWorkflow('link.json'))).not.toContain('CANARY'); + expect((await importSession('link.json')).error).toMatch(/not a symlink/); + }); + + it('does not quote file contents in parse errors for files inside the project', async () => { + writeFileSync(join(state.cwd, 'bad.json'), `${CANARY} is not json`); + const imported = await importSession(join(state.cwd, 'bad.json')); + expect(imported.error).toMatch(/invalid session json/i); + expect(JSON.stringify(imported)).not.toContain('CANARY'); + const validated = await validateWorkflow(join(state.cwd, 'bad.json')); + expect(validated.errors[0].message).toMatch(/not valid JSON/); + expect(JSON.stringify(validated)).not.toContain('CANARY'); + }); + + it('still reads valid files inside the project', async () => { + writeFileSync(join(state.cwd, 'session.json'), JSON.stringify({ name: 'inside' })); + expect(await importSession('session.json')).toMatchObject({ name: 'inside' }); + writeFileSync(join(state.cwd, 'workflow.json'), JSON.stringify({ steps: [{ name: 's', agent: 'coder' }] })); + expect(await validateWorkflow('workflow.json')).toMatchObject({ valid: true, stats: { stages: 1, agents: 1 } }); + }); +}); + +describe('the local CLI may still name files outside the project', () => { + it('session import and workflow validate accept an operator-chosen path', async () => { + expect(await importSession(join(outside, 'session.json'), localCliContext())).toMatchObject({ name: 'external' }); + expect(await validateWorkflow(join(outside, 'workflow.json'), localCliContext())).toMatchObject({ valid: true }); + }); + + it('reports a missing file plainly', async () => { + expect((await importSession(join(outside, 'nope.json'), localCliContext())).error).toMatch(/File not found/); + }); +}); diff --git a/v3/@claude-flow/cli/src/commands/session.ts b/v3/@claude-flow/cli/src/commands/session.ts index 58369e1127..8694e0710c 100644 --- a/v3/@claude-flow/cli/src/commands/session.ts +++ b/v3/@claude-flow/cli/src/commands/session.ts @@ -7,6 +7,7 @@ import type { Command, CommandContext, CommandResult } from '../types.js'; import { output } from '../output.js'; import { confirm, input, select } from '../prompt.js'; import { callMCPTool, MCPClientError } from '../mcp-client.js'; +import { localCliContext } from '../mcp-tools/path-containment.js'; import * as fs from 'fs'; import * as path from 'path'; import { stringify as stringifyYaml } from 'yaml'; @@ -809,7 +810,7 @@ const importCommand: Command = { inputPath: absolutePath, name: sessionName, activate - }); + }, localCliContext()); const failure = toolError(result); if (failure) { diff --git a/v3/@claude-flow/cli/src/commands/workflow.ts b/v3/@claude-flow/cli/src/commands/workflow.ts index 4f532b626e..052ee843be 100644 --- a/v3/@claude-flow/cli/src/commands/workflow.ts +++ b/v3/@claude-flow/cli/src/commands/workflow.ts @@ -7,6 +7,7 @@ import type { Command, CommandContext, CommandResult } from '../types.js'; import { output } from '../output.js'; import { select, confirm, input } from '../prompt.js'; import { callMCPTool, MCPClientError } from '../mcp-client.js'; +import { localCliContext } from '../mcp-tools/path-containment.js'; // Workflow templates const WORKFLOW_TEMPLATES = [ @@ -250,7 +251,7 @@ const validateCommand: Command = { }>('workflow_validate', { file, strict, - }); + }, localCliContext()); if (ctx.flags.format === 'json') { output.printJson(result); diff --git a/v3/@claude-flow/cli/src/mcp-tools/session-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/session-tools.ts index a687452620..591f578aff 100644 --- a/v3/@claude-flow/cli/src/mcp-tools/session-tools.ts +++ b/v3/@claude-flow/cli/src/mcp-tools/session-tools.ts @@ -9,7 +9,7 @@ import { randomUUID } from 'node:crypto'; import { gunzipSync } from 'node:zlib'; import { join } from 'node:path'; import { type MCPTool, getProjectCwd } from './types.js'; -import { containedWritePath } from './path-containment.js'; +import { containedReadPath, containedWritePath, isLocalCliCall } from './path-containment.js'; import { MAX_IMPORT_BYTES, readImportFile } from './import-limits.js'; import { mkdirRestricted, @@ -803,21 +803,31 @@ export const sessionTools: MCPTool[] = [ activate: { type: 'boolean', description: 'Restore the imported session into the active stores' }, }, }, - handler: async (input) => { + handler: async (input, context) => { let parsed: unknown; if (input.data !== undefined && input.data !== null) { parsed = input.data; } else { - const inputPath = String(input.inputPath ?? ''); - if (!inputPath) return { error: 'Provide inputPath (a session JSON file) or data (a session record)' }; - if (!existsSync(inputPath)) return { error: `File not found: ${inputPath}` }; + const requestedPath = String(input.inputPath ?? ''); + if (!requestedPath) return { error: 'Provide inputPath (a session JSON file) or data (a session record)' }; + // MCP callers may only read regular files inside the project, matching + // memory_import; the local CLI may name any file the operator chooses. + const local = isLocalCliCall(context); + const inputPath = local ? (existsSync(requestedPath) ? requestedPath : null) : containedReadPath(requestedPath); + if (!inputPath) { + return { error: local ? `File not found: ${requestedPath}` + : 'inputPath must be an existing regular file inside the project directory (not a symlink)' }; + } try { const bytes = readImportFile(inputPath); const content = bytes[0] === 0x1f && bytes[1] === 0x8b ? gunzipSync(bytes, { maxOutputLength: MAX_IMPORT_BYTES }) : bytes; parsed = JSON.parse(content.toString('utf-8')); } - catch (e) { return { error: `Invalid session JSON: ${(e as Error).message}` }; } + catch (e) { + // Never echo parser text: a SyntaxError message quotes the file's contents. + return { error: e instanceof SyntaxError ? 'Invalid session JSON (parse failed)' : `Invalid session JSON: ${(e as Error).message}` }; + } } const validationError = validateImportedSession(parsed); if (validationError) return { error: validationError }; diff --git a/v3/@claude-flow/cli/src/mcp-tools/workflow-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/workflow-tools.ts index 42996c16cb..df42d97d4e 100644 --- a/v3/@claude-flow/cli/src/mcp-tools/workflow-tools.ts +++ b/v3/@claude-flow/cli/src/mcp-tools/workflow-tools.ts @@ -4,12 +4,14 @@ * Tool definitions for workflow automation and orchestration. */ -import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs'; +import { existsSync, writeFileSync, mkdirSync } from 'node:fs'; import { join } from 'node:path'; import { type MCPTool, getProjectCwd } from './types.js'; import { validateIdentifier, validatePath, validateText } from './validate-input.js'; import { executeAgentTask } from './agent-execute-core.js'; import { readPreservedJsonStore } from './record-store.js'; +import { containedReadPath, isLocalCliCall } from './path-containment.js'; +import { readImportFile } from './import-limits.js'; // Storage paths const STORAGE_DIR = '.claude-flow'; @@ -1034,17 +1036,22 @@ export const workflowTools: MCPTool[] = [ }, required: ['file'], }, - handler: async (input) => { + handler: async (input, context) => { const file = String(input.file ?? ''); const errors: Array<{ line: number; message: string; severity: string }> = []; const warnings: Array<{ line: number; message: string }> = []; let stages = 0; let agents = 0; try { - if (!file || !existsSync(file)) { - errors.push({ line: 0, message: `File not found: ${file || '(empty)'}`, severity: 'error' }); + // MCP callers may only read regular files inside the project, matching + // memory_import; the local CLI may name any file the operator chooses. + const local = isLocalCliCall(context); + const resolved = !file ? null : local ? (existsSync(file) ? file : null) : containedReadPath(file); + if (!resolved) { + errors.push({ line: 0, message: !file || local ? `File not found: ${file || '(empty)'}` + : 'file must be an existing regular file inside the project directory (not a symlink)', severity: 'error' }); } else { - const raw = readFileSync(file, 'utf-8'); + const raw = readImportFile(resolved).toString('utf-8'); let doc: unknown = null; if (/\.ya?ml$/i.test(file)) { warnings.push({ line: 0, message: 'YAML workflow files are not schema-validated yet — only JSON is fully checked (#1916 follow-up)' }); @@ -1082,7 +1089,8 @@ export const workflowTools: MCPTool[] = [ } } } catch (e) { - errors.push({ line: 0, message: `Parse error: ${(e as Error).message}`, severity: 'error' }); + // Never echo parser text: a SyntaxError message quotes the file's contents. + errors.push({ line: 0, message: e instanceof SyntaxError ? 'Parse error: file is not valid JSON' : `Parse error: ${(e as Error).message}`, severity: 'error' }); } const valid = errors.length === 0 && (!input.strict || warnings.length === 0); return { From 44a48fa064e646b90019804680e2090cb17e5976 Mon Sep 17 00:00:00 2001 From: rUv Date: Tue, 17 Nov 2026 11:19:32 -0500 Subject: [PATCH 05/10] docs: add opt-in RVF MCP search recipe and package discovery metadata (#4896) --- README.md | 4 ++ docs/assets/readme/rvf-mcp-search.svg | 27 ++++++++++++ docs/recipes/rvf-mcp-search.md | 52 +++++++++++++++++++++++ docs/recipes/rvf-mcp-search.mjs | 61 +++++++++++++++++++++++++++ package.json | 11 +++-- ruflo/README.md | 5 +++ ruflo/package.json | 12 ++++-- v3/@claude-flow/cli/README.md | 5 +++ v3/@claude-flow/cli/package.json | 11 +++-- 9 files changed, 176 insertions(+), 12 deletions(-) create mode 100644 docs/assets/readme/rvf-mcp-search.svg create mode 100644 docs/recipes/rvf-mcp-search.md create mode 100644 docs/recipes/rvf-mcp-search.mjs diff --git a/README.md b/README.md index 776737a89e..8e6a68528f 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,10 @@ Use a ruflo swarm to review this repo: find the riskiest module, write tests for [First useful task, step by step](docs/ruflo-explained.md) · [User guide](docs/USERGUIDE.md) · [Compare install paths](#quick-start) +Search a local RVF index from a Ruflo project using the stdio RVF MCP server and a read-only handle + +[Optional recipe: local vector search with RVF and MCP](https://github.com/ruvnet/ruflo/blob/main/docs/recipes/rvf-mcp-search.md) · [Ruvnet ecosystem](https://ruv.io) +
Other ways to install (Claude Code plugins only, MCP-only clients, terminal UI) diff --git a/docs/assets/readme/rvf-mcp-search.svg b/docs/assets/readme/rvf-mcp-search.svg new file mode 100644 index 0000000000..3d6a801270 --- /dev/null +++ b/docs/assets/readme/rvf-mcp-search.svg @@ -0,0 +1,27 @@ + + Ruflo recipe: search a local portable RVF index + A Ruflo project sends a vector query through a local stdio MCP server. The server searches a trusted RVF copy using a read-only handle. + + + Search a local RVF index + + + + + + + Ruflo project + RVF MCP server + Trusted RVF copy + + + Supply a query vector + Local stdio transport + Read-only search handle + + + diff --git a/docs/recipes/rvf-mcp-search.md b/docs/recipes/rvf-mcp-search.md new file mode 100644 index 0000000000..65310c2d9f --- /dev/null +++ b/docs/recipes/rvf-mcp-search.md @@ -0,0 +1,52 @@ +# Search a portable RVF index from a Ruflo project + +Use the [RuVector RVF MCP server](https://www.npmjs.com/package/@ruvector/rvf-mcp-server) beside Ruflo to look up nearest vectors in a local `.rvf` file. The recipe keeps the index on your machine and leaves the default Ruflo install unchanged. + +## Quickstart: check the local search path + +Use Node.js 20 or later and a native RVF build for your platform. The smoke test below was run on Linux x64. The [RVF platform table](https://github.com/ruvnet/ruvector/tree/main/npm/packages/rvf#platform-support) lists other targets; this stdio server uses the Node backend, not browser WASM. + +From this repository's root, run: + +```sh +demo_dir="$(mktemp -d)" +cp docs/recipes/rvf-mcp-search.mjs "$demo_dir/" +cd "$demo_dir" +npm init -y +npm install --ignore-scripts --no-audit --no-fund --save-exact @ruvector/rvf-mcp-server@0.2.2 @ruvector/rvf@0.4.8 @modelcontextprotocol/sdk@1.32.2 +node rvf-mcp-search.mjs +``` + +Expected final line: + +```text +Nearest vector: 1; read-only write rejected; traversal rejected; RVF unchanged. +``` + +The script creates a temporary three-vector fixture, connects over stdio, opens the index read-only, checks the nearest match, verifies that an attempted write and path traversal are rejected, and checks that the original bytes did not change. It removes the fixture on exit. No model, API key, remote endpoint, or telemetry is needed. + +## Use it next to Ruflo + +1. In the directory where you explicitly installed the packages above, make a dedicated `rvf-search-data` directory. Put only a **copy of a trusted index** in it. If the index came from the RVF MCP server and uses metadata filters, copy its matching `.mcp-meta.jsonl` sidecar too. +2. In your MCP client for the Ruflo project, add a separate `rvf-search` server alongside the existing Ruflo server. For Claude Code, merge the entry below into the project's `.mcp.json`, replacing both absolute paths. Review the project MCP configuration before enabling it. + + ```json + { + "mcpServers": { + "rvf-search": { + "command": "node", + "args": [ + "/absolute/recipe/node_modules/@ruvector/rvf-mcp-server/dist/cli.js", + "--transport", "stdio", + "--data-dir", "/absolute/recipe/rvf-search-data" + ] + } + } + } + ``` + +3. Ask the client to use `rvf_open_store` with a relative `path` and **`readOnly: true`**. Then call `rvf_query` with the returned `storeId`, a vector of the same dimensions and embedding space as the index, and `k`. Call `rvf_close_store` when finished. The server searches supplied vectors; it does not automatically embed a text query in this recipe. + +Keep transport on stdio. Read-only applies to the opened handle; the server still advertises write tools and can open other handles. Keep the data directory isolated, keep automatic tool approval off, and permit only open/query/close calls for this workflow. If the client cannot constrain calls, use the deterministic script with a disposable fixture instead of exposing a sensitive index to an agent. + +Continue with the [RVF SDK quickstart](https://github.com/ruvnet/ruvector/tree/main/npm/packages/rvf#quick-start) to create your own index, or explore the [Ruvnet ecosystem](https://ruv.io). diff --git a/docs/recipes/rvf-mcp-search.mjs b/docs/recipes/rvf-mcp-search.mjs new file mode 100644 index 0000000000..888be82293 --- /dev/null +++ b/docs/recipes/rvf-mcp-search.mjs @@ -0,0 +1,61 @@ +import assert from 'node:assert/strict'; +import { createHash } from 'node:crypto'; +import { mkdtemp, readFile, rm } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { Client } from '@modelcontextprotocol/sdk/client/index.js'; +import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; +import { RvfDatabase } from '@ruvector/rvf'; + +const dir = await mkdtemp(join(tmpdir(), 'ruflo-rvf-search-')); +const file = join(dir, 'demo.rvf'); +const sha256 = async () => createHash('sha256').update(await readFile(file)).digest('hex'); +const client = new Client({ name: 'ruflo-rvf-search-recipe', version: '1.0.0' }); +const server = fileURLToPath(new URL('./node_modules/@ruvector/rvf-mcp-server/dist/cli.js', import.meta.url)); +const transport = new StdioClientTransport({ + command: process.execPath, args: [server, '--transport', 'stdio', '--data-dir', dir], + stderr: 'ignore', +}); +const call = (name, args) => client.callTool({ name, arguments: args }, undefined, { timeout: 5000 }); +function data(result) { + assert.notEqual(result.isError, true, JSON.stringify(result.content)); + return result.structuredContent ?? JSON.parse(result.content[0].text); +} + +try { + const db = await RvfDatabase.create(file, { dimensions: 3, metric: 'l2' }, 'node'); + try { + await db.ingestBatch([ + { id: '1', vector: new Float32Array([1, 0, 0]) }, + { id: '2', vector: new Float32Array([0, 1, 0]) }, + { id: '3', vector: new Float32Array([0, 0, 1]) }, + ]); + } finally { + await db.close(); + } + + const before = await sha256(); + await client.connect(transport, { timeout: 5000 }); + const opened = data(await call('rvf_open_store', { path: 'demo.rvf', readOnly: true })); + assert.equal(opened.readOnly, true); + const { storeId } = opened; + const search = data(await call('rvf_query', { storeId, vector: [1, 0, 0], k: 1 })); + assert.equal(search.results.length, 1); + assert.equal(String(search.results[0].id), '1'); + + const write = await call('rvf_ingest', { storeId, entries: [{ id: '4', vector: [1, 0, 0] }] }); + assert.match(write.content[0]?.text ?? '', /^Error: store is read-only$/); + const escaped = await call('rvf_open_store', { path: '../outside.rvf', readOnly: true }); + assert.match(escaped.content[0]?.text ?? '', /^Error: store path must not contain/); + + data(await call('rvf_close_store', { storeId })); + assert.equal(await sha256(), before, 'read-only queries must not change the RVF'); + console.log('Nearest vector: 1; read-only write rejected; traversal rejected; RVF unchanged.'); +} finally { + try { + await client.close(); + } finally { + await rm(dir, { recursive: true, force: true }); + } +} diff --git a/package.json b/package.json index 62d2bcd9d9..39e5a64fd7 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,9 @@ "bin": { "claude-flow": "bin/cli.js" }, - "homepage": "https://github.com/ruvnet/claude-flow#readme", + "homepage": "https://ruv.io", "bugs": { - "url": "https://github.com/ruvnet/claude-flow/issues", + "url": "https://github.com/ruvnet/ruflo/issues", "email": "support@ruv.io" }, "funding": { @@ -175,7 +175,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/ruvnet/claude-flow.git" + "url": "git+https://github.com/ruvnet/ruflo.git" }, "keywords": [ "ruvflow", @@ -210,7 +210,10 @@ "hive-mind", "distributed-systems", "consensus", - "self-learning" + "self-learning", + "local-vector-search", + "rvf", + "mcp-server" ], "author": "RuvNet (https://ruv.io)", "license": "MIT", diff --git a/ruflo/README.md b/ruflo/README.md index 4f69ff5e29..e8698ab2f4 100644 --- a/ruflo/README.md +++ b/ruflo/README.md @@ -52,6 +52,11 @@ User --> Ruflo (CLI/MCP) --> Router --> Swarm --> Agents --> Memory --> LLM Prov ## Quick Start + +Search a portable RVF index locally through stdio MCP + +[Optional recipe: local vector search with RVF and MCP](https://github.com/ruvnet/ruflo/blob/main/docs/recipes/rvf-mcp-search.md) · [Ruvnet ecosystem](https://ruv.io) + There are **two different install paths** with very different surface areas. Pick based on what you need (#1744): | | **Claude Code Plugin** | **CLI install (`npx ruflo init`)** | diff --git a/ruflo/package.json b/ruflo/package.json index fc8f0075d7..b4e1ebd3df 100644 --- a/ruflo/package.json +++ b/ruflo/package.json @@ -8,9 +8,9 @@ "bin": { "ruflo": "bin/ruflo.js" }, - "homepage": "https://github.com/ruvnet/claude-flow#readme", + "homepage": "https://ruv.io", "bugs": { - "url": "https://github.com/ruvnet/claude-flow/issues", + "url": "https://github.com/ruvnet/ruflo/issues", "email": "support@ruv.io" }, "funding": { @@ -83,7 +83,8 @@ }, "repository": { "type": "git", - "url": "https://github.com/ruvnet/claude-flow.git" + "url": "git+https://github.com/ruvnet/ruflo.git", + "directory": "ruflo" }, "keywords": [ "ruflo", @@ -102,7 +103,10 @@ "cli", "developer-tools", "enterprise", - "self-learning" + "self-learning", + "local-vector-search", + "rvf", + "mcp-server" ], "author": { "name": "RuvNet", diff --git a/v3/@claude-flow/cli/README.md b/v3/@claude-flow/cli/README.md index b54869c76c..274dab5a3e 100644 --- a/v3/@claude-flow/cli/README.md +++ b/v3/@claude-flow/cli/README.md @@ -52,6 +52,11 @@ User --> Ruflo (CLI/MCP) --> Router --> Swarm --> Agents --> Memory --> LLM Prov ## Quick Start + +Search a portable RVF index locally through stdio MCP + +[Optional recipe: local vector search with RVF and MCP](https://github.com/ruvnet/ruflo/blob/main/docs/recipes/rvf-mcp-search.md) · [Ruvnet ecosystem](https://ruv.io) + There are **two different install paths** with very different surface areas. Pick based on what you need (#1744): | | **Claude Code Plugin** | **CLI install (`npx ruflo init`)** | diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.json index 690b3664b7..d42c92ca18 100644 --- a/v3/@claude-flow/cli/package.json +++ b/v3/@claude-flow/cli/package.json @@ -11,13 +11,13 @@ "claude-flow": "bin/cli.js", "claude-flow-mcp": "bin/mcp-server.js" }, - "homepage": "https://github.com/ruvnet/claude-flow#readme", + "homepage": "https://ruv.io", "bugs": { - "url": "https://github.com/ruvnet/claude-flow/issues" + "url": "https://github.com/ruvnet/ruflo/issues" }, "repository": { "type": "git", - "url": "git+https://github.com/ruvnet/claude-flow.git", + "url": "git+https://github.com/ruvnet/ruflo.git", "directory": "v3/@claude-flow/cli" }, "keywords": [ @@ -38,7 +38,10 @@ "vector-database", "embeddings", "self-learning", - "enterprise" + "enterprise", + "local-vector-search", + "rvf", + "mcp-server" ], "author": "RuvNet (https://ruv.io)", "license": "MIT", From f697d0dc26ec1694e51e237ba549592e7f0b0703 Mon Sep 17 00:00:00 2001 From: rUv Date: Tue, 17 Nov 2026 11:19:36 -0500 Subject: [PATCH 06/10] chore(npm): set Ruflo package homepages to ruv.io (#4897) cli-core and neural homepages are left for those leaves' next version bump: the leaf-publish audit treats any package.json change in a non-bundled CLI leaf as unpublished work. --- v3/@claude-flow/browser/package.json | 1 + v3/@claude-flow/guidance/package.json | 1 + v3/@claude-flow/hooks/package.json | 1 + v3/plugins/code-intelligence/package.json | 1 + v3/plugins/cognitive-kernel/package.json | 1 + v3/plugins/legal-contracts/package.json | 1 + v3/plugins/neural-coordination/package.json | 1 + v3/plugins/perf-optimizer/package.json | 1 + v3/plugins/teammate-plugin/package.json | 2 +- v3/plugins/test-intelligence/package.json | 1 + 10 files changed, 10 insertions(+), 1 deletion(-) diff --git a/v3/@claude-flow/browser/package.json b/v3/@claude-flow/browser/package.json index f51bb87261..dec3b50a9e 100644 --- a/v3/@claude-flow/browser/package.json +++ b/v3/@claude-flow/browser/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://ruv.io", "name": "@claude-flow/browser", "version": "3.0.1", "description": "Browser automation for AI agents - integrates agent-browser with claude-flow swarms", diff --git a/v3/@claude-flow/guidance/package.json b/v3/@claude-flow/guidance/package.json index 5dc6c2fd5d..6eca7218ed 100644 --- a/v3/@claude-flow/guidance/package.json +++ b/v3/@claude-flow/guidance/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://ruv.io", "name": "@claude-flow/guidance", "version": "3.0.1", "description": "Guidance Control Plane - Compiles, retrieves, enforces, and evolves guidance rules for Claude Code sessions", diff --git a/v3/@claude-flow/hooks/package.json b/v3/@claude-flow/hooks/package.json index 6a54ed116d..4d2a0f0eff 100644 --- a/v3/@claude-flow/hooks/package.json +++ b/v3/@claude-flow/hooks/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://ruv.io", "name": "@claude-flow/hooks", "version": "3.0.3", "description": "V3 Hooks System - Event-driven lifecycle hooks with ReasoningBank learning integration", diff --git a/v3/plugins/code-intelligence/package.json b/v3/plugins/code-intelligence/package.json index ed2256e2e2..f006013ebc 100644 --- a/v3/plugins/code-intelligence/package.json +++ b/v3/plugins/code-intelligence/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://ruv.io", "name": "@claude-flow/plugin-code-intelligence", "version": "3.0.0-alpha.4", "description": "Advanced code intelligence plugin for Claude Flow V3 - semantic search, architecture analysis, refactoring impact, module splitting, and pattern learning", diff --git a/v3/plugins/cognitive-kernel/package.json b/v3/plugins/cognitive-kernel/package.json index a583aa7589..8cf2da698b 100644 --- a/v3/plugins/cognitive-kernel/package.json +++ b/v3/plugins/cognitive-kernel/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://ruv.io", "name": "@claude-flow/plugin-cognitive-kernel", "version": "3.0.0-alpha.3", "description": "Cognitive kernel plugin for LLM augmentation with working memory, attention control, meta-cognition, and scaffolding", diff --git a/v3/plugins/legal-contracts/package.json b/v3/plugins/legal-contracts/package.json index 56142453f9..dee4077024 100644 --- a/v3/plugins/legal-contracts/package.json +++ b/v3/plugins/legal-contracts/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://ruv.io", "name": "@claude-flow/plugin-legal-contracts", "version": "3.0.0-alpha.3", "description": "Legal contract analysis plugin for Claude Flow V3 - clause extraction, risk assessment, contract comparison, obligation tracking, and playbook matching", diff --git a/v3/plugins/neural-coordination/package.json b/v3/plugins/neural-coordination/package.json index 9aebece103..32091c2d3b 100644 --- a/v3/plugins/neural-coordination/package.json +++ b/v3/plugins/neural-coordination/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://ruv.io", "name": "@claude-flow/plugin-neural-coordination", "version": "3.0.0-alpha.3", "description": "Neural coordination plugin for multi-agent swarm intelligence using SONA, GNN, and attention mechanisms", diff --git a/v3/plugins/perf-optimizer/package.json b/v3/plugins/perf-optimizer/package.json index 782aa30c83..4e82776138 100644 --- a/v3/plugins/perf-optimizer/package.json +++ b/v3/plugins/perf-optimizer/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://ruv.io", "name": "@claude-flow/plugin-perf-optimizer", "version": "3.0.0-alpha.3", "description": "AI-powered performance optimization plugin for bottleneck detection, memory analysis, and configuration tuning", diff --git a/v3/plugins/teammate-plugin/package.json b/v3/plugins/teammate-plugin/package.json index b6d411b777..dbe2e15b7f 100644 --- a/v3/plugins/teammate-plugin/package.json +++ b/v3/plugins/teammate-plugin/package.json @@ -60,7 +60,7 @@ "bugs": { "url": "https://github.com/ruvnet/claude-flow/issues" }, - "homepage": "https://github.com/ruvnet/claude-flow#readme", + "homepage": "https://ruv.io", "engines": { "node": ">=18.0.0" }, diff --git a/v3/plugins/test-intelligence/package.json b/v3/plugins/test-intelligence/package.json index 057b6650f0..eaf03d33b0 100644 --- a/v3/plugins/test-intelligence/package.json +++ b/v3/plugins/test-intelligence/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://ruv.io", "name": "@claude-flow/plugin-test-intelligence", "version": "3.0.0-alpha.3", "description": "AI-powered test intelligence plugin for predictive test selection, flaky detection, and coverage optimization", From 8ad024ce6c3030c12bf40a5960d7e403ab675b7d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:19:40 -0500 Subject: [PATCH 07/10] chore(deps): bump agent-browser from 0.41.2 to 0.43.0 in /v3/@claude-flow/browser (#5005) * chore(deps): bump agent-browser in /v3/@claude-flow/browser Bumps [agent-browser](https://github.com/vercel-labs/agent-browser) from 0.41.2 to 0.43.0. - [Release notes](https://github.com/vercel-labs/agent-browser/releases) - [Changelog](https://github.com/vercel-labs/agent-browser/blob/main/CHANGELOG.md) - [Commits](https://github.com/vercel-labs/agent-browser/compare/v0.41.2...v0.43.0) --- updated-dependencies: - dependency-name: agent-browser dependency-version: 0.43.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * chore(deps): update v3/pnpm-lock.yaml for agent-browser 0.43.0 Dependabot updated only @claude-flow/browser's package-lock.json, so every pnpm --frozen-lockfile job failed with ERR_PNPM_OUTDATED_LOCKFILE. This edits just the agent-browser importer entry, its package entry, and the seven @agent-browser/cli-* optional platform packages 0.43 now ships as; a full regeneration also bumped ruvector and dropped unrelated entries. Co-Authored-By: RuFlo --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: r Co-authored-by: RuFlo --- v3/@claude-flow/browser/package-lock.json | 124 ++++++++++++++++++++-- v3/@claude-flow/browser/package.json | 2 +- v3/pnpm-lock.yaml | 74 ++++++++++++- 3 files changed, 188 insertions(+), 12 deletions(-) diff --git a/v3/@claude-flow/browser/package-lock.json b/v3/@claude-flow/browser/package-lock.json index 5cbe0cdc2d..cc11c3ae70 100644 --- a/v3/@claude-flow/browser/package-lock.json +++ b/v3/@claude-flow/browser/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "license": "MIT", "dependencies": { - "agent-browser": "^0.41.0", + "agent-browser": "^0.43.0", "agentic-flow": "^2.0.14", "zod": "^4.6.7" }, @@ -26,6 +26,110 @@ "@claude-flow/cli": ">=3.5.0" } }, + "node_modules/@agent-browser/cli-darwin-arm64": { + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@agent-browser/cli-darwin-arm64/-/cli-darwin-arm64-0.43.0.tgz", + "integrity": "sha512-HV6GP59IjNnowlrXR/5rVM8msPWwQDEONt/tWC8STzUfKZQHKZI/Iv9sf2h2ZhwK8xwoqLhxpf+KxcFgJ0sExQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@agent-browser/cli-darwin-x64": { + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@agent-browser/cli-darwin-x64/-/cli-darwin-x64-0.43.0.tgz", + "integrity": "sha512-3NKnKFOWLYDYTz4bJxo4jt+GwjM4VtcW5FDrQY35eUrytig65FEDdXmXKuRbZGq9jEEWxh6rmpS4R6xS53XCaw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@agent-browser/cli-linux-arm64-gnu": { + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-0.43.0.tgz", + "integrity": "sha512-8DC234LGlXCn8A2YXGk6woy1uTjyexvtHd/TOQHLrV2sfUMZD647HTHEJyF+2z1J1oR34LaB5jqHJ9d0REC+Cw==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@agent-browser/cli-linux-arm64-musl": { + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-arm64-musl/-/cli-linux-arm64-musl-0.43.0.tgz", + "integrity": "sha512-/dYeGX2E1lWZ25q1IZSVs6PaPmr0GmhHU8z/LtCh0anHN4ND50i5fOPbysRBaE8iQCBY74h+1R2kePfEqD7X4Q==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@agent-browser/cli-linux-x64-gnu": { + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-x64-gnu/-/cli-linux-x64-gnu-0.43.0.tgz", + "integrity": "sha512-WY8vy2Saa3oRt6XEmz4Sae1W5qS9TjYcbX6IE+dxb8s2APfL9XyQjMHC6jBZrhwqDBIvUeTMCT/P2cq3XLPSBw==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@agent-browser/cli-linux-x64-musl": { + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-x64-musl/-/cli-linux-x64-musl-0.43.0.tgz", + "integrity": "sha512-WpCI0cIaVIVj4trdduDmW90h51BAP5Nhx6lALOqHjUhOOae/TkLL4bK8gJfjPb/nOp2FRjsF1l77f6rVwkpsug==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@agent-browser/cli-win32-x64-msvc": { + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/@agent-browser/cli-win32-x64-msvc/-/cli-win32-x64-msvc-0.43.0.tgz", + "integrity": "sha512-xhk8wnHk3aiBFSR0pd1Ye3ay2jKjgRardgBJLiB9nXJv0ZkbeP/wh3X7jMiKUfUGE1qqJrKdaM5szQ6iz8/8+w==", + "cpu": [ + "x64", + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@ai-sdk/google": { "version": "3.0.82", "resolved": "https://registry.npmjs.org/@ai-sdk/google/-/google-3.0.82.tgz", @@ -5337,17 +5441,25 @@ } }, "node_modules/agent-browser": { - "version": "0.41.2", - "resolved": "https://registry.npmjs.org/agent-browser/-/agent-browser-0.41.2.tgz", - "integrity": "sha512-/agCKB5rw1EEK8SKWo4zid7a5kOwlclqALC0P3c69buJvKdhrl/dJkKdfLqGGaiNIbWzRdqqT0PxZVkwVEf2fg==", + "version": "0.43.0", + "resolved": "https://registry.npmjs.org/agent-browser/-/agent-browser-0.43.0.tgz", + "integrity": "sha512-TExwnZAW39fUBDJhUPrw8KKGmcjzBo7FxNqoP2/usHG1ODsjGI2jAWq3+Q6I5JYyBMjePFEsj8KGB68mALtglA==", "hasInstallScript": true, "license": "Apache-2.0", "bin": { "agent-browser": "bin/agent-browser.js" }, "engines": { - "node": ">=24.0.0", - "pnpm": ">=11.0.0" + "node": ">=22.0.0" + }, + "optionalDependencies": { + "@agent-browser/cli-darwin-arm64": "0.43.0", + "@agent-browser/cli-darwin-x64": "0.43.0", + "@agent-browser/cli-linux-arm64-gnu": "0.43.0", + "@agent-browser/cli-linux-arm64-musl": "0.43.0", + "@agent-browser/cli-linux-x64-gnu": "0.43.0", + "@agent-browser/cli-linux-x64-musl": "0.43.0", + "@agent-browser/cli-win32-x64-msvc": "0.43.0" } }, "node_modules/agentic-flow": { diff --git a/v3/@claude-flow/browser/package.json b/v3/@claude-flow/browser/package.json index dec3b50a9e..c17ca30d4a 100644 --- a/v3/@claude-flow/browser/package.json +++ b/v3/@claude-flow/browser/package.json @@ -27,7 +27,7 @@ "postinstall": "node -e \"const{execSync}=require('child_process');const v=require('./package.json').dependencies['agent-browser'];try{execSync('agent-browser --version',{stdio:'ignore'});}catch{console.log('\\n📦 Installing agent-browser globally...');try{execSync('npm install -g agent-browser@'+v,{stdio:'inherit'});console.log('✅ agent-browser installed successfully!');}catch(e){console.log('⚠️ Could not install agent-browser globally. Run manually:\\n npm install -g agent-browser@'+v);}}\"" }, "dependencies": { - "agent-browser": "^0.41.0", + "agent-browser": "^0.43.0", "agentic-flow": "^2.0.14", "zod": "^4.6.7" }, diff --git a/v3/pnpm-lock.yaml b/v3/pnpm-lock.yaml index 06b6c94ad2..dcdf2dcacf 100644 --- a/v3/pnpm-lock.yaml +++ b/v3/pnpm-lock.yaml @@ -71,8 +71,8 @@ importers: specifier: '>=3.5.0' version: link:../cli agent-browser: - specifier: ^0.41.0 - version: 0.41.2 + specifier: ^0.43.0 + version: 0.43.0 agentic-flow: specifier: ^2.0.14 version: 2.0.14(@types/node@20.19.27) @@ -731,6 +731,62 @@ packages: /@actions/io@2.0.0: resolution: {integrity: sha512-Jv33IN09XLO+0HS79aaODsvIRyduiF7NY/F6LYeK5oeUmrsz7aFdRphQjFoESF4jS7lMauDOttKALcpapVDIAg==} + /@agent-browser/cli-darwin-arm64@0.43.0: + resolution: {integrity: sha512-HV6GP59IjNnowlrXR/5rVM8msPWwQDEONt/tWC8STzUfKZQHKZI/Iv9sf2h2ZhwK8xwoqLhxpf+KxcFgJ0sExQ==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@agent-browser/cli-darwin-x64@0.43.0: + resolution: {integrity: sha512-3NKnKFOWLYDYTz4bJxo4jt+GwjM4VtcW5FDrQY35eUrytig65FEDdXmXKuRbZGq9jEEWxh6rmpS4R6xS53XCaw==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@agent-browser/cli-linux-arm64-gnu@0.43.0: + resolution: {integrity: sha512-8DC234LGlXCn8A2YXGk6woy1uTjyexvtHd/TOQHLrV2sfUMZD647HTHEJyF+2z1J1oR34LaB5jqHJ9d0REC+Cw==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@agent-browser/cli-linux-arm64-musl@0.43.0: + resolution: {integrity: sha512-/dYeGX2E1lWZ25q1IZSVs6PaPmr0GmhHU8z/LtCh0anHN4ND50i5fOPbysRBaE8iQCBY74h+1R2kePfEqD7X4Q==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@agent-browser/cli-linux-x64-gnu@0.43.0: + resolution: {integrity: sha512-WY8vy2Saa3oRt6XEmz4Sae1W5qS9TjYcbX6IE+dxb8s2APfL9XyQjMHC6jBZrhwqDBIvUeTMCT/P2cq3XLPSBw==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@agent-browser/cli-linux-x64-musl@0.43.0: + resolution: {integrity: sha512-WpCI0cIaVIVj4trdduDmW90h51BAP5Nhx6lALOqHjUhOOae/TkLL4bK8gJfjPb/nOp2FRjsF1l77f6rVwkpsug==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@agent-browser/cli-win32-x64-msvc@0.43.0: + resolution: {integrity: sha512-xhk8wnHk3aiBFSR0pd1Ye3ay2jKjgRardgBJLiB9nXJv0ZkbeP/wh3X7jMiKUfUGE1qqJrKdaM5szQ6iz8/8+w==} + cpu: [x64, arm64] + os: [win32] + requiresBuild: true + dev: false + optional: true + /@agntcy/slim-bindings-darwin-arm64@2.1.1: resolution: {integrity: sha512-YbUsO1bWdgxHIQP/I7L+1NG27+mnpW/WueT/1n68NC8n5KedQPAV3TuUU5NAQlUN4uxpbGaZQ6Yi8Yk0qVn88g==} engines: {node: '>=18.0.0'} @@ -4812,11 +4868,19 @@ packages: dev: false optional: true - /agent-browser@0.41.2: - resolution: {integrity: sha512-/agCKB5rw1EEK8SKWo4zid7a5kOwlclqALC0P3c69buJvKdhrl/dJkKdfLqGGaiNIbWzRdqqT0PxZVkwVEf2fg==} - engines: {node: '>=24.0.0', pnpm: '>=11.0.0'} + /agent-browser@0.43.0: + resolution: {integrity: sha512-TExwnZAW39fUBDJhUPrw8KKGmcjzBo7FxNqoP2/usHG1ODsjGI2jAWq3+Q6I5JYyBMjePFEsj8KGB68mALtglA==} + engines: {node: '>=22.0.0'} hasBin: true requiresBuild: true + optionalDependencies: + '@agent-browser/cli-darwin-arm64': 0.43.0 + '@agent-browser/cli-darwin-x64': 0.43.0 + '@agent-browser/cli-linux-arm64-gnu': 0.43.0 + '@agent-browser/cli-linux-arm64-musl': 0.43.0 + '@agent-browser/cli-linux-x64-gnu': 0.43.0 + '@agent-browser/cli-linux-x64-musl': 0.43.0 + '@agent-browser/cli-win32-x64-msvc': 0.43.0 dev: false /agentdb@3.10.0(@types/node@20.19.27)(zod@3.25.76): From 6e1bcc45179ce9b5fb799987f58d2c341aad75f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 11:19:45 -0500 Subject: [PATCH 08/10] chore(deps): bump @ruvnet/sublinear-core from 1.0.0 to 1.0.1 in /plugins/ruflo-graph-intelligence (#5006) * chore(deps): bump @ruvnet/sublinear-core Bumps [@ruvnet/sublinear-core](https://github.com/ruvnet/sublinear-time-solver/tree/HEAD/packages/sublinear-core) from 1.0.0 to 1.0.1. - [Release notes](https://github.com/ruvnet/sublinear-time-solver/releases) - [Changelog](https://github.com/ruvnet/sublinear-time-solver/blob/main/CHANGELOG.md) - [Commits](https://github.com/ruvnet/sublinear-time-solver/commits/HEAD/packages/sublinear-core) --- updated-dependencies: - dependency-name: "@ruvnet/sublinear-core" dependency-version: 1.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * chore(ruflo-graph-intelligence): 0.3.2; lockfile without peer entries Regenerated with --legacy-peer-deps from main's lockfile, as main's was made: dependabot's version added ~11.7k lines of peer entries pulled in by the @claude-flow/cli peer. Bump the plugin version for the version-bump gate. Co-Authored-By: RuFlo --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: r Co-authored-by: RuFlo --- .../ruflo-graph-intelligence/.claude-plugin/plugin.json | 2 +- plugins/ruflo-graph-intelligence/CHANGELOG.md | 3 +++ plugins/ruflo-graph-intelligence/package-lock.json | 8 ++++---- plugins/ruflo-graph-intelligence/package.json | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/ruflo-graph-intelligence/.claude-plugin/plugin.json b/plugins/ruflo-graph-intelligence/.claude-plugin/plugin.json index 7d7fd4f136..5880f5230c 100644 --- a/plugins/ruflo-graph-intelligence/.claude-plugin/plugin.json +++ b/plugins/ruflo-graph-intelligence/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ruflo-graph-intelligence", "description": "RuFlo Graph Intelligence Engine — real-time relationship intelligence with complexity-aware execution. Single-entry personalized PageRank, streaming delta updates, witness-signed reasoning artifacts, federation-distributable PR vectors. Declares the zero-dependency @ruvnet/sublinear-core as its solver; ships a sublinear-core skill for PPR, local push and sparse solves.", - "version": "0.3.1", + "version": "0.3.2", "author": { "name": "ruvnet", "url": "https://github.com/ruvnet" diff --git a/plugins/ruflo-graph-intelligence/CHANGELOG.md b/plugins/ruflo-graph-intelligence/CHANGELOG.md index 81f1f67b7b..335590fb72 100644 --- a/plugins/ruflo-graph-intelligence/CHANGELOG.md +++ b/plugins/ruflo-graph-intelligence/CHANGELOG.md @@ -2,6 +2,9 @@ Newest first. One `## — ` heading per version, then `feat:`, `fix:`, `breaking:` and `chore:` bullets (ADR-478). Built from git history; this is the whole history. +## 0.3.2 — 2026-11-17 +- chore: `@ruvnet/sublinear-core` 1.0.0 → 1.0.1 (#5006) + ## 0.3.1 — 2026-11-10 - chore: first stable version. The npm manifest gains a canonical repository, homepage and bug-tracker link, and a shorter description. No code changes diff --git a/plugins/ruflo-graph-intelligence/package-lock.json b/plugins/ruflo-graph-intelligence/package-lock.json index f65975db62..c5420b5a8e 100644 --- a/plugins/ruflo-graph-intelligence/package-lock.json +++ b/plugins/ruflo-graph-intelligence/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0-alpha.1", "license": "MIT", "dependencies": { - "@ruvnet/sublinear-core": "^1.0.0", + "@ruvnet/sublinear-core": "^1.0.1", "zod": "^4.6.7" }, "devDependencies": { @@ -304,9 +304,9 @@ "license": "MIT" }, "node_modules/@ruvnet/sublinear-core": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@ruvnet/sublinear-core/-/sublinear-core-1.0.0.tgz", - "integrity": "sha512-AfcOehcQe7GXc7wRMUAMqp7DgKXTjAUl7Gj9tmRpmMuvOHo/tap/2RP0OjpjZXsr5jMNySEFHn0yFpxGq47B6w==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@ruvnet/sublinear-core/-/sublinear-core-1.0.1.tgz", + "integrity": "sha512-3QkspuVBijsNA+F2ZY+Z8Goq5uNfd26MW0QHpRx1LdOAMvyq7SZja1Jw6SdAohwve/9OcaXiou2x9vw2R+dY6Q==", "license": "MIT OR Apache-2.0", "engines": { "node": ">=16" diff --git a/plugins/ruflo-graph-intelligence/package.json b/plugins/ruflo-graph-intelligence/package.json index 9bd55c190b..f92e5d8cf3 100644 --- a/plugins/ruflo-graph-intelligence/package.json +++ b/plugins/ruflo-graph-intelligence/package.json @@ -28,7 +28,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@ruvnet/sublinear-core": "^1.0.0", + "@ruvnet/sublinear-core": "^1.0.1", "zod": "^4.6.7" }, "overrides": { From e0ad134ce598a7e77cdba48349403e0e5cb69c59 Mon Sep 17 00:00:00 2001 From: Wasabi Date: Wed, 18 Nov 2026 00:19:50 +0800 Subject: [PATCH 09/10] fix(memory): persist HNSW metadata atomically and report failures (#5001) Co-authored-by: wasabihu <973168+wasabihu@users.noreply.github.com> Co-authored-by: rUv --- .../hnsw-metadata-atomic-4739.test.ts | 119 ++++++++++++++++++ .../cli/src/memory/memory-initializer.ts | 10 +- 2 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 v3/@claude-flow/cli/__tests__/hnsw-metadata-atomic-4739.test.ts diff --git a/v3/@claude-flow/cli/__tests__/hnsw-metadata-atomic-4739.test.ts b/v3/@claude-flow/cli/__tests__/hnsw-metadata-atomic-4739.test.ts new file mode 100644 index 0000000000..c6378bd29f --- /dev/null +++ b/v3/@claude-flow/cli/__tests__/hnsw-metadata-atomic-4739.test.ts @@ -0,0 +1,119 @@ +/** #4739: metadata writes must publish a complete image and report failures. */ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import * as fs from 'node:fs'; +import { tmpdir } from 'node:os'; +import { basename, join } from 'node:path'; + +const state = vi.hoisted(() => ({ + failure: undefined as unknown, + swaps: [] as Array<{ previous: string; next: string }>, +})); + +// Only the vector engine is stubbed; persistence uses the real atomic helper +// and filesystem, with a failure injected at the final publication boundary. +// vitest.config.ts externalizes @ruvector/*; Vite exposes its dynamic imports +// under /@id/, so mock that external module ID rather than a native addon. +vi.mock('/@id/@ruvector/core', () => ({ + default: { + VectorDb: class { + async len() { return 0; } + async insert() {} + }, + }, +})); + +vi.mock('node:fs', async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + renameSync: vi.fn((from: string, to: string) => { + if (basename(to) === 'hnsw.metadata.json') { + state.swaps.push({ + previous: actual.readFileSync(to, 'utf8'), + next: actual.readFileSync(from, 'utf8'), + }); + if (state.failure !== undefined) throw state.failure; + } + actual.renameSync(from, to); + }), + }; +}); + +import * as memory from '../src/memory/memory-initializer.js'; + +describe('HNSW metadata persistence (#4739)', () => { + let root: string; + let metadataPath: string; + const entry = { id: 'vector-1', key: 'policy', namespace: 'patterns', content: 'memory 世界 🌱' }; + const previous = '[]\n' + ' '.repeat(64); + + beforeEach(() => { + root = fs.mkdtempSync(join(tmpdir(), 'ruflo-hnsw-4739-')); + metadataPath = join(root, 'hnsw.metadata.json'); + fs.writeFileSync(metadataPath, previous); + vi.stubEnv('CLAUDE_FLOW_MEMORY_PATH', root); + vi.stubEnv('CLAUDE_FLOW_DISABLE_BRIDGE', '1'); + vi.spyOn(console, 'warn').mockImplementation(() => {}); + memory.clearHNSWIndex(); + memory._resetMemoryRootCache(); + state.failure = undefined; + state.swaps = []; + }); + + afterEach(() => { + memory.clearHNSWIndex(); + memory._resetMemoryRootCache(); + vi.restoreAllMocks(); + vi.unstubAllEnvs(); + fs.rmSync(root, { recursive: true, force: true }); + }); + + it('atomically replaces the old image with complete UTF-8 metadata that reloads', async () => { + expect(await memory.addToHNSWIndex(entry.id, [1, 0, 0], entry)).toBe(true); + + const serialized = JSON.stringify([[entry.id, entry]]); + expect(fs.readFileSync(metadataPath, 'utf8')).toBe(serialized); + // Before rename, readers still see the old complete image while the new + // complete image is in a separate sibling file. + expect(state.swaps).toEqual([{ previous, next: serialized }]); + expect(fs.readdirSync(root)).toEqual(['hnsw.metadata.json']); + if (process.platform !== 'win32') { + expect(fs.statSync(metadataPath).mode & 0o777).toBe(0o600); + } + expect(console.warn).not.toHaveBeenCalled(); + + memory.clearHNSWIndex(); + const reloaded = await memory.getHNSWIndex({ dimensions: 3 }); + expect(reloaded?.entries.get(entry.id)).toEqual(entry); + }); + + it.each([ + new Error('ENOSPC: no space left on device'), + 'EACCES: permission denied', + ])('reports a failed atomic swap and preserves the previous image (%s)', async (failure) => { + state.failure = failure; + + // Metadata is best-effort: the vector insertion still succeeds in memory. + expect(await memory.addToHNSWIndex(entry.id, [1, 0, 0], entry)).toBe(true); + expect(console.warn).toHaveBeenCalledWith( + '[memory] Failed to save hnsw.metadata.json:', + failure instanceof Error ? failure.message : String(failure), + ); + expect(state.swaps).toHaveLength(1); + expect(fs.readFileSync(metadataPath, 'utf8')).toBe(previous); + expect(fs.readdirSync(root)).toEqual(['hnsw.metadata.json']); + expect((await memory.getHNSWIndex())?.entries.get(entry.id)).toEqual(entry); + }); + + it('reports a missing parent directory without throwing or recreating it', async () => { + expect(await memory.getHNSWIndex({ dimensions: 3 })).not.toBeNull(); + fs.rmSync(root, { recursive: true }); + + expect(await memory.addToHNSWIndex(entry.id, [1, 0, 0], entry)).toBe(true); + expect(console.warn).toHaveBeenCalledWith( + '[memory] Failed to save hnsw.metadata.json:', + expect.stringContaining('ENOENT'), + ); + expect(fs.existsSync(root)).toBe(false); + }); +}); diff --git a/v3/@claude-flow/cli/src/memory/memory-initializer.ts b/v3/@claude-flow/cli/src/memory/memory-initializer.ts index 78ab478988..bb27b8ed69 100644 --- a/v3/@claude-flow/cli/src/memory/memory-initializer.ts +++ b/v3/@claude-flow/cli/src/memory/memory-initializer.ts @@ -795,9 +795,13 @@ function saveHNSWMetadata(): void { const swarmDir = getMemoryRoot(); const metadataPath = path.join(swarmDir, 'hnsw.metadata.json'); const metadata = Array.from(hnswIndex.entries.entries()); - fs.writeFileSync(metadataPath, JSON.stringify(metadata)); - } catch { - // Silently fail - metadata save is best-effort + writeFileAtomic(metadataPath, Buffer.from(JSON.stringify(metadata), 'utf-8')); + } catch (error) { + // Metadata is best-effort, but persistence failures must be visible. + console.warn( + '[memory] Failed to save hnsw.metadata.json:', + error instanceof Error ? error.message : String(error), + ); } } From 6f877c60698d3905534f81efa258fc4c6d839c93 Mon Sep 17 00:00:00 2001 From: Mohammed Alkindi Date: Tue, 17 Nov 2026 08:48:53 -0800 Subject: [PATCH 10/10] test(cli): pin statusline --json stdout purity on a cold daemon (#5008) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `hooks statusline --json` is parsed by ruflo's own V3 statusline helper, which treats its stdout as the single source of truth. A diagnostic line on that stream makes `JSON.parse` throw and silently demotes the helper to the local file probes #2195 removed. Current source already routes diagnostics to stderr, and output.test.ts asserts that at the unit level by spying on the streams. This adds the end-to-end half: a real subprocess, where anything writing to stdout counts, not just the formatter. Two conditions have to be forced or the test is inert. Autostart gates on `isRufloProject()`, so a bare mkdtemp directory reports `not a ruflo project` and never emits the daemon notice — each case plants a `.claude-flow/config.json` marker. And autostart is single-instance per cwd, so a reused directory returns clean JSON regardless of routing — each case gets its own directory. The notice races daemon readiness rather than firing only on call one, so the cold case asserts across three invocations. stdout is parsed whole, with no `indexOf('{')` slice, because the contract is that stdout *is* the document. Verified both directions against @claude-flow/cli-core: with printInfo/printWarning on writeErrorln both cases pass; with them inverted to writeln, as published 3.7.0-alpha.5 has them, case one fails on call one with `[INFO] Started Ruflo background daemon` on stdout and case two with `Unexpected token 'W', "[WARN] Fail"...`. Refs #2909 Co-authored-by: rUv --- .../issue-2909-statusline-json-stdout.test.ts | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 v3/@claude-flow/cli/__tests__/issue-2909-statusline-json-stdout.test.ts diff --git a/v3/@claude-flow/cli/__tests__/issue-2909-statusline-json-stdout.test.ts b/v3/@claude-flow/cli/__tests__/issue-2909-statusline-json-stdout.test.ts new file mode 100644 index 0000000000..0f37f56ef7 --- /dev/null +++ b/v3/@claude-flow/cli/__tests__/issue-2909-statusline-json-stdout.test.ts @@ -0,0 +1,161 @@ +/** + * Regression coverage for issue #2909: `hooks statusline --json` interleaved + * diagnostics with its payload on **stdout**, so callers doing + * `JSON.parse(stdout)` failed with `Unexpected token 'W', "[WARN] Fail"...`. + * ruflo's own V3 statusline helper parses this command's stdout and calls it + * the single source of truth, so a polluted line silently demoted it to the + * local file probes that #2195 existed to remove. + * + * Current source routes every diagnostic to stderr (`OutputFormatter.printInfo` + * / `printWarning` → `writeErrorln`), so this is a regression guard, not a + * reproduction. `output.test.ts` already asserts that routing at the unit level + * by spying on the streams; the gap this closes is end-to-end, on a real + * process, where anything else writing to stdout also counts. + * + * Two conditions have to be forced, and both are easy to get wrong: + * + * 1. **A daemon must actually start.** `daemon-autostart.ts` gates on + * `isRufloProject()`, so a bare `mkdtemp` directory yields + * `{ started: false, reason: 'not a ruflo project' }` and never emits the + * `[INFO] Started Ruflo background daemon` line at all. Each case plants a + * `.claude-flow/config.json` marker so autostart is genuinely exercised. + * 2. **The directory must be cold.** Autostart is single-instance per cwd, so + * a reused directory returns clean JSON regardless of routing. Each case + * gets its own directory. + * + * The notice is also a race against daemon readiness rather than a + * deterministic "first call only" event, so the cold case asserts across three + * sequential invocations; correct routing passes all three every time. + * + * The CLI is spawned as a real subprocess because the routing under test is a + * property of the process's streams, not of any exported function. + */ +import { describe, it, expect, afterAll } from 'vitest'; +import { execFileSync } from 'node:child_process'; +import * as fs from 'node:fs'; +import * as os from 'node:os'; +import * as path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const CLI = path.resolve(HERE, '..', 'bin', 'cli.js'); +// `bin/cli.js` is tracked, so its presence proves nothing; the build artifact it +// imports is the gitignored one. Standard flow is `npm run build && npm test`. +const CLI_BUILT = fs.existsSync(path.resolve(HERE, '..', 'dist', 'src', 'index.js')); + +/** Any OutputFormatter level prefix. None of them belongs on stdout. */ +const DIAGNOSTIC_MARKER = /\[(?:WARN|INFO|ERROR|DEBUG|TRACE)\]/; + +const tempDirs: string[] = []; + +/** + * A directory that (a) no daemon has claimed yet and (b) autostart recognises + * as a ruflo project, so the run is genuinely cold rather than skipped. + * + * `realpathSync` matters: on macOS `os.tmpdir()` reports `/var/folders/...`, a + * symlink to `/private/var/folders/...`, and the daemon keys its lock on the + * resolved cwd. Resolving up front keeps "fresh directory" and "cold daemon" + * the same statement on every platform. + */ +function freshRufloCwd(): string { + const dir = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'ruflo-2909-')); + tempDirs.push(dir); + fs.mkdirSync(path.join(dir, '.claude-flow'), { recursive: true }); + fs.writeFileSync(path.join(dir, '.claude-flow', 'config.json'), '{}', 'utf8'); + return dir; +} + +function statuslineStdout(cwd: string): string { + return execFileSync('node', [CLI, 'hooks', 'statusline', '--json'], { + cwd, + input: JSON.stringify({ model: { display_name: 'Sonnet 4.6 (1M context)' } }), + encoding: 'utf8', + // stderr is piped, not inherited: diagnostics legitimately belong there, so + // capturing them keeps a passing run quiet while still failing this test on + // anything that reaches stdout. + stdio: ['pipe', 'pipe', 'pipe'], + env: { + ...process.env, + // Keep the run off the developer's real install: helper auto-refresh + // writes to ~/.claude/helpers and funnel state to ~/.ruflo. + HOME: cwd, + USERPROFILE: cwd, + RUFLO_STATE_DIR: path.join(cwd, '.ruflo-state'), + // `checkForUpdatesOnStartup` is fire-and-forget, network-bound, and writes + // to stdout via `writeln` with no level prefix — a genuine flake source + // that the regex would miss and the raw parse would catch at random. + CLAUDE_FLOW_AUTO_UPDATE: 'false', + CI: 'true', + }, + timeout: 60_000, + }); +} + +function assertStdoutIsOnlyJson(raw: string, label: string): void { + // Parsed whole, deliberately without an `indexOf('{')` slice: the contract is + // that stdout *is* the JSON document, not that a JSON document can be + // recovered from somewhere inside it. Slicing — as a sibling statusline test + // does — passes on the build that prompted this issue. + expect(() => JSON.parse(raw), `${label}: stdout was not JSON: ${raw.slice(0, 160)}`).not.toThrow(); + expect(raw, `${label}: stdout carried a diagnostic`).not.toMatch(DIAGNOSTIC_MARKER); +} + +// Explicit hook timeout: every case leaves a real detached daemon behind, and +// stopping them exceeds vitest's 10s hook default. +afterAll(() => { + for (const dir of tempDirs) { + // Stop before removing: the daemon holds its cwd, so on Windows `rmSync` + // first can fail outright. Defaults are a 12h hard TTL / 30m idle, so + // leaving them would hold one process per case for that window. + try { + execFileSync('node', [CLI, 'daemon', 'stop'], { + cwd: dir, + stdio: 'ignore', + timeout: 20_000, + }); + } catch { + /* already gone, or never started */ + } + try { + // Retries because a stopping daemon can still hold the directory for a + // moment on Windows (EPERM/EBUSY). Swallowed entirely: a leftover temp + // directory is inconsequential, and cleanup must never turn a suite whose + // assertions passed into a red one. + fs.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 }); + } catch { + /* the OS temp sweeper can have it */ + } + } +}, 120_000); + +describe.skipIf(!CLI_BUILT)('hooks statusline --json keeps stdout parseable — issue #2909', () => { + it( + 'emits only JSON on stdout while the daemon autostarts', + () => { + const dir = freshRufloCwd(); + for (let call = 1; call <= 3; call++) { + assertStdoutIsOnlyJson(statuslineStdout(dir), `call ${call}`); + } + }, + 120_000 + ); + + it( + 'emits only JSON on stdout when the config in cwd is malformed', + () => { + const dir = freshRufloCwd(); + // Triggers the `Failed to load config from ...` warning pushed in + // shared/src/core/config/loader.ts — the diagnostic the reporter actually + // saw on stdout. A malformed config does not disable autostart: the + // parse error is caught and autostart fails open. + fs.writeFileSync( + path.join(dir, 'claude-flow.config.json'), + '{ "features": [ this is not valid json', + 'utf8' + ); + + assertStdoutIsOnlyJson(statuslineStdout(dir), 'malformed config'); + }, + 120_000 + ); +});