Commit Graph
105 Commits
Author SHA1 Message Date
ruv 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>
2026-05-16 08:44:51 -04:00
Reuven 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.
2026-05-15 22:29:21 -04:00
Reuven 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
2026-05-15 21:44:39 -04:00
rUvandReuven 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>
2026-05-15 07:47:29 -04:00
rUvandReuven e0a922eef9 feat(federation-peer): wire real midstreamer-quic@0.3.0 + aimds-core@0.2.0 (ADR-120 Step 3) (#2011)
Replaces the typed `not implemented` placeholders in
`native_transport` and `native_gate` with real implementations that
delegate to the embedding traits published in ruvnet/midstream PR #82.

**Cargo.toml**
- Bumped `midstreamer-quic` 0.2.1 → 0.3.0 (now exposes `QuicTransport`)
- Bumped `aimds-core` 0.1.1 → 0.2.0 (now exposes `SafetyGate` + `SafetyVerdict`)
- Dropped optional `aimds-detection` / `-analysis` / `-response` —
  the peer composes any `aimds_core::SafetyGate` so the concrete
  3-gate pipeline is supplied by the caller (e.g. AIMDS's
  `ComposedGate` or a custom composition)
- Added optional `uuid` + `chrono` (used by the gate adapter to
  build `PromptInput` values)

**lib.rs — `native_transport::MidstreamerTransport<T: QuicTransport>`**
- Generic over any embedder-supplied transport (defaults to `QuicConnection`)
- `connect(addr)`: opens a client connection via `QuicConnection::connect`
- `send(addr, msg)`: opens a bidirectional stream, writes one NDJSON
  line per `FederationMessage`, finishes the stream
- `recv()`: accepts an inbound bidirectional stream, reads to EOF
  (16 MiB cap), parses one JSON value
- `close()`: closes the connection with reason "peer shutdown"

**lib.rs — `native_gate::AimdsGate`**
- Adapter that holds `Arc<dyn aimds_core::SafetyGate>` so it composes
  any 3-gate pipeline (AIMDS's canonical `ComposedGate`, a custom
  composition, or a test stub)
- Converts `FederationMessage` ↔ `PromptInput` (payload-as-string +
  metadata-as-context)
- Converts `aimds_core::SafetyVerdict` ↔ peer-local `SafetyVerdict`,
  preserving routing metadata on `Redact`

**bin.rs**
- Under `--features native`, boots a real tokio runtime that wires
  `MidstreamerTransport::connect()` + `AimdsGate` (with a
  pass-through default gate so the smoke boot path works without
  AIMDS rules) + an NDJSON-stdout dispatcher
- Reads `RUFLO_FEDERATION_REMOTE_ADDR` for the connect target

**Tests**
- New `aimds_gate_adapter_forwards_pass_and_block_verdicts` test
  exercises the real `aimds_core::SafetyGate` trait surface
- 4/4 tests pass under `--features native`; 3/3 pass without

**audit-fix-invariants.mjs**
- Bumped Cargo.toml pin invariants to 0.3.0 / 0.2.0
- Added two new invariants checking the lib.rs imports actually
  reference upstream `QuicTransport` and `aimds_core::SafetyGate` —
  guards against silent reversion to a typed placeholder
- 34/34 invariants pass

Closes ADR-120 Step 3.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 23:35:32 -04:00
rUvandReuven 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>
2026-05-14 23:01:05 -04:00
rUvandReuven 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>
2026-05-14 22:28:20 -04:00
rUvandReuven 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>
2026-05-14 21:38:14 -04:00
rUvandReuven 4bd194554d fix(neural-trader): mitigate upstream fork-bomb on install + CI guard (#1974) (#1976)
The upstream `neural-trader@2.7.1` (and every earlier published version
audited) ships a malicious-by-accident `install` lifecycle script that
recursively invokes `npm install` from inside the install hook. On any
non-`linux-x64` host the recursion is unbounded — one reporter saw 3,049
stuck processes consuming ~120 GB of RAM in ~80 minutes before manual
intervention.

The `plugins/ruflo-neural-trader/README.md` Prerequisites section said
plainly `npm install neural-trader` — running THAT instruction is what
fork-bombs the machine.

We can't patch upstream from this repo, but we can stop telling users
to run the dangerous command. Mitigations:

  - README Prerequisites: add a prominent warning advisory + switch
    the recommended install to `npm install --ignore-scripts neural-trader`.
    The linux-x64 binary is hardcoded inline in the upstream tarball,
    so the package still works after `--ignore-scripts` on that platform.
  - agents/trading-strategist.md: same `--ignore-scripts` fix on the
    "Ensure installed" line that previously fork-bombed if the package
    wasn't already cached.
  - 6 skill files (trader-backtest/portfolio/regime/risk/signal/train):
    same one-liner fix.
  - trader-cloud-backtest/SKILL.md: also patch the `npm install -g
    neural-trader` line in the Managed-Agent `initScript` — cloud
    containers ARE isolated, but the same in-container fork-bomb
    amplification is still a problem.

CI guard: `scripts/audit-neural-trader-safety.mjs` scans
`plugins/ruflo-neural-trader/` for any `npm install neural-trader` /
`npm i neural-trader` invocation that doesn't also carry
`--ignore-scripts`. Allowlist: lines preceded by a "DO NOT run" marker
(the README's anti-example block). Wired into the existing
`hook-command-audit` job in `v3-ci.yml`.

Verified:
- audit clean on the fixed tree
- audit catches a deliberately-reverted regression (exit 1, diagnostic
  names the offending file:line)
- all other audits + plugin smoke still green

Mitigates #1974 in THIS repo. Upstream fix to the `neural-trader` npm
package (drop the recursive `npm install` in the install hook + publish
the platform-binary optionalDependencies) is still required for the
underlying bug.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 08:03:31 -04:00
rUvandReuven 131ac346a0 ci(guards): add fix-invariants audit covering 8 recent fixes (#1972)
Companion to scripts/audit-vector-dim.mjs (#1947) and
scripts/audit-hook-handler-prompt.mjs (#1944) — those each guard one
fix's specific regression pattern. This one is a single "presence-check"
audit covering the load-bearing line(s) from 8 more fixes that shipped
without a dedicated test:

  #1939  Win32 cwd → Claude Code slug normalization
         (memory-tools.ts — Win32 candidate regex + replace pattern)

  #1941  Per-namespace vector_indexes provisioning
         (memory-bridge.ts + memory-initializer.ts — INSERT OR IGNORE)

  #1943  Helper path project-local OR $HOME probe
         (settings-generator.ts — sh `[ -f "$D/` + cmd /c IF EXIST)

  #1945  Bridge respects CLAUDE_FLOW_MEMORY_PATH
         (memory-bridge.ts — getDbPath uses getMemoryRoot)

  #1946  Doctor respects CLAUDE_FLOW_MEMORY_PATH
         (doctor.ts — checkMemoryDatabase uses getMemoryRoot)

  #1951  Statusline reads installed version from plugin package.json
         (3 files — RUFLO_VERSION probe + marketplaces/ruflo candidate)

  #1953  hooks_pretrain code-file budget + code-dir-first traversal
         (hooks-tools.ts — codeFilesScanned counter)

  #1968  daemon forwards --workers / --headless / --sandbox
         (daemon.ts — forkArgs.push for each flag)

15 invariants total. Each entry pins one substring or regex that MUST
appear in a specific file, with a `why` field explaining what runtime
behavior breaks if the line is removed. The failure output includes
that `why` so the next developer who hits the audit knows whether to
update the invariant (fix moved/refactored) or restore the line.

Verified locally:
- `node scripts/audit-fix-invariants.mjs` → clean (`exit 0`)
- Inject a regression (strip the sh probe + the getMemoryRoot call) →
  exits 1 with a per-issue diagnostic.

Wired into the existing `hook-command-audit` CI job alongside the
hook-handler-prompt audit. Combined with the other two scripts, the
recent triage cycle's 14 fixes now have:

  audit-vector-dim          → #1947 (+ siblings #1942 / #1952)
  audit-hook-handler-prompt → #1944
  audit-fix-invariants      → #1939 / #1941 / #1943 / #1945 / #1946 /
                              #1951 / #1953 / #1968

The two remaining (#1947 RC2 embeddings-index optional `-c`, #1930
cost-tracker compact resolution) are runtime-behavior surface changes
without a single load-bearing line to guard; both are exercised by
their own smokes / manual repros.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 22:39:23 -04:00
rUvandReuven bef3684b59 verify(federation): unblock Checks 2/3 by pinning cookies@0.9.0 (#1949) (#1965)
The verification's Check 2 (federation plugin exports) and Check 3
(breaker/reporter wire-up) have been blocked by a registry security
policy rejecting `cookies@0.9.1`. Two facts make the obvious fix
non-obvious:

  1. `cookies@0.9.1` is the LATEST published version — there is no
     newer version to override TO. (`npm view cookies dist-tags` →
     latest=0.9.1, no 0.9.2 exists upstream.)
  2. `package.json#overrides` is only honored at the ROOT of the
     install, so adding an override in the federation plugin's own
     manifest does not help downstream consumers (`npm install
     @claude-flow/plugin-agent-federation@alpha` from a fresh dir).

But `cookies@0.9.0` (one patch back, same surface, `koa@3.2.0` accepts
either) is NOT blocked and works. So the verification harness can pin
that at its own root.

Add `scripts/verify-federation-plugin.sh` to encode this: create a
temp dir, write `package.json` with `overrides.cookies=0.9.0`, run
`npm install @claude-flow/plugin-agent-federation@<tag>`, then run
Check 2 (required exports present) and Check 3 (`FederationBreakerService`
+ `InMemorySpendReporter` instantiate cleanly).

Verified end-to-end against the live `alpha` tag (3.7.0-alpha.32 era):

  $ bash scripts/verify-federation-plugin.sh
  [verify-federation] installing @claude-flow/plugin-agent-federation@alpha
  added 527 packages in 21s
  [verify-federation] resolved cookies version: 0.9.0
  [verify-federation] Check 2 OK — FederationNodeState, FederationBreakerService, InMemorySpendReporter
  [verify-federation] Check 3 OK — FederationBreakerService + InMemorySpendReporter instantiate cleanly
  [verify-federation] all checks PASSED for tag=alpha
  exit=0

Dep chain (the issue mis-identified `koa-router`; it's actually plain `koa`):
  plugin-agent-federation → agentic-flow → fastmcp → mcp-proxy
    → pipenet@1.4.0 → koa@3.2.0 → cookies@0.9.1   (← blocked → 0.9.0)

Verification harnesses (any cron/CI that exercises these checks) should
call this script in place of a raw `npm install …federation@alpha`.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 11:11:25 -04:00
rUvandReuven 3657a69366 fix(hooks): pre-bash TypeError + global-install MODULE_NOT_FOUND (#1944, #1943) (#1957)
Two critical hook regressions on a fresh `ruflo init` (alpha.27):

**#1944** — `helpers/hook-handler.cjs` builds the `prompt` string from a
`||` fallback chain whose third term is the normalised `toolInput` *object*
(`{command:"ls"}` etc.). The object is truthy so the chain stops there;
the next line calls `.toLowerCase()` on it and every `pre-bash` invocation
prints `[WARN] Hook pre-bash encountered an error: …toLowerCase is not a
function` — i.e. **every Bash tool call from Claude Code spams a TypeError**.

Fix: fall back to `toolInput.command` (the string) instead of `toolInput`
(the object). One-character change in three places — the deployed handler
(both tracked copies) and the template in `helpers-generator.ts` that
writes the user's `.claude/helpers/hook-handler.cjs` at init time.

Repro on the fixed file:
  echo '{"tool_input":{"command":"ls"},"tool_name":"Bash"}' \
    | node v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs pre-bash
  → [OK] Command validated   (was: TypeError warning)

Dangerous-command guard still fires:
  echo '{"tool_input":{"command":"rm -rf /"},"tool_name":"Bash"}' | … pre-bash
  → [BLOCKED] Dangerous command detected: rm -rf /

**#1943** — `settings-generator.ts` writes hook command strings anchored at
`${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/…`. That works when `ruflo init`
lands helpers project-locally, but breaks when init's settings end up in
`~/.claude/settings.json` (global install) with helpers at
`~/.claude/helpers/`: Claude Code still sets `CLAUDE_PROJECT_DIR` to the
*project* root, the path resolves there, finds nothing, and every Bash /
Edit / Session hook fires `MODULE_NOT_FOUND`.

Fix: replace the path expression with a POSIX `sh` probe that tries the
project-local path first and falls back to `$HOME` when it's missing —
project-local overrides still take precedence; global installs work; no
upgrade-skew. Windows gets the same probe via `cmd /c IF EXIST … ELSE …`.
Applied to both `hookCmd()` and `generateStatusLineConfig()` (the
statusline scaffolding had the same anchor bug).

**CI guard**: `scripts/audit-hook-handler-prompt.mjs` (new) — fails the
build if any `.cjs` handler / TS template falls back to a bare `toolInput`
(object) instead of `toolInput.command` (string). Catches the #1944
pattern exactly. Wired into the existing `hook-command-audit` job.
Verified to flag a deliberately-reverted regression (and clean on HEAD).

Resolves #1944, #1943.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 09:02:51 -04:00
rUvandReuven 4abef4b83f fix(memory): schema vector_indexes dim 768→384 + CI guard (#1947, #1942, #1952) (#1956)
* fix(memory): schema vector_indexes dim 768→384 (#1947, #1942, #1952)

The bundled SQL schema initialises the `default` and `patterns` rows in
`vector_indexes` with `dimensions = 768`, but the default ONNX embedding
model (`Xenova/all-MiniLM-L6-v2`) produces **384-dim** vectors. HNSW rejects
every insert with the mismatched dim — so on a fresh install
`memory_store --vector` prints success while `memory_search` always returns
0 hits, and `memory_stats` reads 0 vectors.

Root cause is a single inline schema literal in `memory-initializer.ts`'s
`getInitialMetadata()`. That string is run against the user's DB at init
time and is the canonical writer of the `vector_indexes` rows (the
`.swarm/schema.sql` files some packages ship are stale artifacts, not the
runtime source).

Fix: change the two literals to 384 (matching the default model).

CI guard: `scripts/audit-vector-dim.mjs` scans `v3/` and `ruflo/` for any
`INSERT … INTO vector_indexes (id, name, dimensions) VALUES
('default'|'patterns', …, N)` row and fails the build if `N !== 384`.
Wired into `vector-dim-audit` job (gates `witness-verify`). Verified to
catch a deliberately-reverted regression and to pass on the fixed tree
(24 matching rows scanned, all 384).

Resolves #1947 root cause #1 (the dim mismatch).
Resolves #1942 (Bridge search index 768 vs imported 384-dim embeddings).
Resolves #1952 (Windows: store ok, search returns 0, stats shows 0) — same
  root cause, Windows is just where the reporter observed it.

Follow-ups (not in this PR):
- #1947 root cause #2: `embeddings index -a build` defaults to `-c default`
  even when entries are in another namespace.
- #1947 "additional": `embeddings init --force` model-ID validator rejects
  the default model's own name (`Xenova/all-MiniLM-L6-v2`) because of `/`.
- #1941: claude-memories import doesn't provision a vector_indexes row.
- #1940: `memory_bridge_status` reports 0 despite persisted rows.
- Several published `@claude-flow/*` packages have no `files:` / `.npmignore`
  and ship stale `.swarm/` binary state (memory.db, hnsw.index, etc.).

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(memory-initializer): drop backticks from SQL comment (TS template-literal compile error)

The earlier fix included a comment block with backticks (\`Xenova/all-MiniLM-L6-v2\`,
\`memory_store --vector\`, \`memory_search\`) inside a TypeScript template literal —
the backticks terminated the template string and tsc errored with TS1005/TS1443
on lines 989/991. Build V3 failed across ubuntu / macOS / windows.

Replace the backticks with parens / plain prose. The schema literals are
unchanged (still 384).

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 09:02:02 -04:00
rUvandReuven f0ee0f9688 fix(#1921): plugin hooks use a resilient shim, not bare npx @alpha per fire (#1923)
* fix(#1921): plugin hooks invoke a resilient shim, not bare `npx @alpha` per fire

Every PreToolUse/PostToolUse/Stop hook ran `npx <pkg>@alpha hooks …`, which
(a) re-resolves the @alpha dist-tag from the registry on every fire and
(b) re-installs from cold cache — and when that install crashes (an arborist
`Invalid Version` on npm 10.8.x, deep in a transitive OTEL/grpc subtree) the
user sees a hook error in Claude Code after every assistant turn, plus ~7s of
wasted registry traffic per turn.

Fix: each plugin (`.claude-plugin/`, `plugin/`, `plugins/ruflo-core/`) ships
`scripts/ruflo-hook.sh` — prefers an already-installed `ruflo`/`claude-flow`
binary, falls back to `npx --prefer-offline --yes ruflo@alpha`, and ALWAYS
exits 0. hooks.json invokes `"${CLAUDE_PLUGIN_ROOT}/scripts/ruflo-hook.sh" …
|| true` (the `|| true` covers the unset-$CLAUDE_PLUGIN_ROOT case). stdin
(the hook event JSON) passes through unchanged; the stdin-jq-xargs
shell-injection-safety pattern in plugin/hooks/hooks.json is preserved.

This does NOT fix the underlying arborist crash (which needs the offending
empty-`version` package pinned via `overrides` once it's identified on
npm 10.8.2 — see the issue thread) — it makes a CLI/install failure invisible
and cheap instead of a visible error every turn.

CI guard: scripts/audit-hook-commands.mjs — fails CI if any hook `command`
uses `npx` without `--prefer-offline`, or invokes the CLI without a non-fatal
guard. Wired into v3-ci.yml as `hook-command-audit` (also bash-lints each
ruflo-hook.sh and asserts it exits 0 with no CLI on PATH) + added to
witness-verify needs[]. Path triggers updated to fire on `**/hooks/hooks.json`,
`**/scripts/ruflo-hook.sh`, and `scripts/**`. Witness markers for #1921 +

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(#1921): make test-hooks.mjs shim-aware; fix shim-lint CI step; regen witness

Rebasing #1921 onto main surfaced 3 CI failures:

- plugin-hooks-smoke (ubuntu + macos): test-hooks.mjs substituted only
  `npx ruflo@alpha` → the local CLI, but the hooks.json now invokes
  `${CLAUDE_PLUGIN_ROOT}/scripts/ruflo-hook.sh <args>`. It now also
  substitutes the shim path → `<cli> hooks <args>` (bypassing the shim, so
  the test exercises the real CLI flag wiring) and strips the shim's
  trailing `|| true` so exit codes are still asserted. 7/7 pass.
- hook-command-audit shim-lint step: `PATH="/nonexistent" bash "$sh"` set
  PATH to a dir with no `bash`, so `bash: command not found`. Now invokes
  bash by full path with `PATH=` empty: `PATH= "$BASH" "$sh"` — the shim's
  `command -v` is a builtin (works with empty PATH) and the npx fallback
  fails cleanly under `|| true` → exit 0. (resolved in v3-ci.yml during the
  rebase.)

Witness manifest regenerated; #1862's marker refreshed to match the
shim-relocated `post-edit -f "$FILE" -s true` (the documented-flag form is
preserved). `ruflo verify` 0 regressed.

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 00:51:18 -04:00
rUvandReuven 95df0111e0 fix(plugins): #1902/#1903/#1904 install-safety + plugin-package CI guard (#1925)
* fix(plugins): #1902/#1903/#1904 install-safety + CI guard

published tarballs declared @claude-flow/ruvector-upstream (a never-
published package) as a hard dep / strict peer, so `npm install` E404'd.
The repo source was already clean (the runtime does `await import(...).
catch(() => null)`), so the fix is a republish + a guard.

resolve any @claude-flow publish (they're all 3.x prereleases). Repo
source already uses ">=3.0.0-0" + optional peers; fix is a republish.

plus ./formula and ./convoy subpaths the build never emitted. tsup.config
now builds the formula/convoy entries (were commented out) and
package.json exports/main/module point at the actually-emitted .js/.cjs
filenames.

CI guard: scripts/audit-plugin-packages.mjs — fails on (A) unpublished
@claude-flow/* hard dep / non-optional peer, (B) bare-stable peer range
that can't resolve a prerelease, (C) main/module/exports path not in
`files`, (D) post-build, an exports path that doesn't exist on disk.
Wired into v3-ci.yml as `plugin-package-audit` (builds plugins first so
check D is live) + added to witness-verify needs[]. Witness markers for

Version bumps for republish: legal-contracts/healthcare-clinical/
perf-optimizer 3.0.0-alpha.1→2, agentic-qe 3.0.0-alpha.4→5 (repo was
stale at 3.5.59), gastown-bridge 0.1.3→0.1.4.

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(plugins): bump IPFS registry CID for #1902/#1903/#1904 republish

LIVE_REGISTRY_CID → QmeXmAdbWVvT84GfDXPD2Vg1HWhiTW2VdZfRLhkS96KkX2
(re-pinned to Pinata). Reflects the republished plugin versions:
  @claude-flow/plugin-agentic-qe          3.0.0-alpha.4 → 3.0.0-alpha.5
  @claude-flow/plugin-gastown-bridge      0.1.3         → 0.1.4
  @claude-flow/plugin-legal-contracts     3.0.0-alpha.1 → 3.0.0-alpha.2
  @claude-flow/plugin-healthcare-clinical 3.0.0-alpha.1 → 3.0.0-alpha.2
  @claude-flow/plugin-perf-optimizer      3.0.0-alpha.1 → 3.0.0-alpha.2

Also updated the matching `version` fields in the demoPluginRegistry
offline fallback. Ships with the next @claude-flow/cli release.

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 00:44:57 -04:00
rUvandReuven 31f22ff9a9 fix(#1916): register agent_logs + hive worker resolution + all 20 dangling CLI↔MCP tools — published 3.7.0-alpha.26 (#1924)
* fix(#1916): register agent_logs MCP tool + resolve hive-spawned workers

`ruflo agent logs <id>` called `callMCPTool('agent_logs', …)` against a tool
that was never registered → `MCP tool not found: agent_logs`. Registered it
in agent-tools.ts. Today it returns the agent's createdAt + lastResult as
synthetic entries (per-agent activity logging lands with hive worker execution
wiring — #1916 items 3/4, a tracked follow-up) with the documented shape
`{ agentId, entries: [{timestamp,level,message,context?}], total }`.

Also: `hive-mind_spawn` writes workers to `.claude-flow/agents.json`, a
different file from the canonical `.claude-flow/agents/store.json` that
agent_status/agent_list/agent_logs read — so `agent status <hive-worker-id>`
returned `not_found`. Added `loadAllAgents()` (canonical store ∪ hive store,
canonical wins on collision) and routed those three tools through it.

NOT in this PR: the task-execution dispatch (#1916 items 3/4 — `task_assign`
transitions state but doesn't run a worker; hive metrics stay 0). That needs
a design decision (which executor) and is a separate change.

CI guard: scripts/audit-cli-mcp-tools.mjs — scans every `callMCPTool('<name>')`
in src/commands/*.ts and fails if `<name>` isn't registered in src/mcp-tools/*.ts
(the `MCP tool not found` class). Monotone-decreasing baseline at
verification/cli-mcp-tool-baseline.json — surfaces 20 *other* CLI subcommands
with the same dangling-tool bug (`memory export`, `task retry`, `workflow
validate`, `session export`, …; agent_logs is now fixed and not in the list).
Wired into v3-ci.yml `tool-descriptions-audit` job (already in witness-verify
needs[]). Behavioral guard: __tests__/agent-logs-hive-resolution.test.ts.
Witness markers for #1916 + #1916-guard.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(#1916): register the 16 missing CLI↔MCP tools — cli-mcp-tool-baseline → 0

The #1916-guard (scripts/audit-cli-mcp-tools.mjs) surfaced 20 `ruflo <cmd>`
subcommands that callMCPTool() a tool that was never registered (would die
with `MCP tool not found`). Cleared all of them:

- Renamed the coverage tools `hooks/coverage-{route,suggest,gaps}` →
  `hooks_coverage-{route,suggest,gaps}` (the handlers already existed; the
  slash names just didn't match the CLI's underscore calls).
- Pointed `ruflo swarm stop` / `ruflo stop` at the existing `swarm_shutdown`
  tool instead of a non-existent `swarm_stop`.
- Registered 16 new MCP tools (each with ADR-112 "use when … is wrong" guidance):
    task_retry, workflow_stop, workflow_validate,
    session_current, session_export, session_import,
    memory_detailed-stats, memory_cleanup, memory_compress, memory_export, memory_import,
    hive-mind_optimize-memory, hooks_teammate-idle, hooks_task-completed,
    mcp_start, mcp_stop
  Real where the operation maps cleanly to an existing store/backend
  (task_retry clones into a fresh pending task; memory_export/import dump &
  re-store entries; memory_cleanup prunes expired TTLs dry-run-by-default;
  workflow_validate structurally checks a JSON workflow; session_export/import
  round-trip the session record; memory_detailed-stats reshapes memory_stats).
  Honest no-ops with the correct return shape + a `note` where the underlying
  capability genuinely isn't wired yet (memory_compress — sql.js has no on-disk
  compression; hive-mind_optimize-memory — structural compaction only,
  pattern-quality consolidation is the intelligence pipeline's job; hooks_*
  team hooks — auto-assignment/pattern-learning delegated; mcp_start/stop — the
  MCP toolset runs in-process, there's no separate server to start/stop).

cli-mcp-tool-baseline.json is now 0. tool-descriptions-audit still passes
(all 16 new tools carry guidance, ≥80 chars, unique). Full cli test suite
green (48 files / 1977 tests). Witness #1916-cli-tools marker added →
ruflo verify 107 verified, 0 regressed. mcp-tools-deep.test.ts exception
list updated for mcp_start/mcp_stop.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(#1916): register coverageRouterTools + harden the CLI↔MCP audit; bump 3.7.0-alpha.26

Validating the alpha.25 publish caught a gap: `ruflo hooks coverage-route`
(and -suggest / -gaps) still failed with `Tool not found: hooks_coverage-route`.
Root cause: the coverage tools were defined in ruvector/coverage-tools.ts but
their array was never imported into mcp-client.ts's TOOL_REGISTRY — renaming
the slash→underscore name didn't help because the file wasn't registered at all.

- mcp-client.ts: import + `...coverageRouterTools` in registerTools([…]).
- coverage-tools.ts: category 'coverage' → 'hooks' (matches the hooks_* names).
- scripts/audit-cli-mcp-tools.mjs: now derives the "registered" set from what
  mcp-client.ts ACTUALLY spreads into registerTools([…]) (resolving each
  `...xTools` to its `import { xTools } from '<path>'` and scanning that file),
  instead of "any src file with a name: definition". So an unregistered
  tool-source file now correctly produces a dangling-reference flag — this is
  exactly the gap that let hooks_coverage-* slip through.

Version bumped to 3.7.0-alpha.26 (alpha.25 shipped the still-broken coverage
tools). Witness manifest regenerated. cli-mcp-tool-baseline.json still 0;
audit + mcp-tools-deep + mcp-client tests green.

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 00:40:47 -04:00
rUvandReuven 511b2ac070 feat(codex): finish Codex ↔ Ruflo integration — real codex exec, dual run --worker, tests, CI guard (#1909) (#1911)
* fix(codex): correct codex MCP server subcommand + sync package version

- mcp-bridge: `@openai/codex mcp serve` → `@openai/codex mcp-server`.
  `codex mcp` manages *external* MCP servers (list/get/add/remove);
  `codex mcp-server` is the "start Codex as an MCP server (stdio)"
  command. `codex mcp serve` errors with "unrecognized subcommand
  'serve'", so the `codex` MCP backend never started. Fixed in both
  ruflo/src/mcp-bridge/index.js and ruflo/src/ruvocal/mcp-bridge/index.js.
- @claude-flow/codex: VERSION const was '3.0.0-alpha.8' while
  package.json is '3.0.0-alpha.9' — `--version`/`info` reported the
  wrong version. Synced to alpha.9.

Verified: `codex mcp serve` → error; `codex mcp-server` is valid.
@claude-flow/codex builds clean (tsc), 162 unit tests pass,
`claude-flow-codex` CLI (init/validate/doctor/templates/skills/dual)
all functional.

Co-Authored-By: RuFlo <ruv@ruv.net>

* feat(codex): W1 — dual-mode orchestrator spawns real `codex exec` for codex workers

Previously `codexCommand` defaulted to `'claude'` ("Both use claude CLI")
and every worker — claude or codex — was launched with Claude-CLI flags
(`-p`, `--output-format text`, `--max-turns`), so "dual-mode" was two
Claude instances. Now:
- `codexCommand` defaults to `'codex'`
- `executeHeadless` builds platform-specific args:
  - claude:  `-p <prompt> --output-format text [--max-turns N] [--model M]`
  - codex:   `exec --sandbox workspace-write --skip-git-repo-check [-m M] <prompt>`
    (PROMPT is positional -> last; `codex exec` runs autonomously)

Remaining in W1 (next iterations): update `.claude/agents/dual-mode/
codex-worker.md` + `codex-coordinator.md` to invoke `codex exec` instead
of `claude -p`; add mocked-spawn smoke test (W4). Tracked: #1909.

Co-Authored-By: RuFlo <ruv@ruv.net>

* feat(codex): W1 (cont.) — dual-mode agent defs invoke `codex exec`, not `claude -p`

codex-worker.md / codex-coordinator.md described "headless Codex workers"
but every spawn example was `claude -p "..." --session-id X` with
Claude-only flags (--max-budget-usd, --allowedTools, --output-format).
Updated to match the W1 orchestrator change:
- spawn syntax → `codex exec --sandbox <workspace-write|read-only>
  --skip-git-repo-check "<prompt>" &`
- dropped Claude-only flags; note that mixed-platform runs still use
  `claude -p` for Claude workers
- swarm/memory CLI refs `claude-flow@v3alpha` → `ruflo@latest`
- MCP tool refs `mcp__claude-flow__*` / `mcp__ruv-swarm__*` → `mcp__ruflo__*`

W1 now complete (orchestrator + agent defs). dual-orchestrator.md left
as-is — it correctly documents the mixed Claude+Codex split. Smoke test
is W4. Tracked: #1909.

Co-Authored-By: RuFlo <ruv@ruv.net>

* feat(codex): W2 — `dual run --worker "<platform>:<role>:<prompt>"` + positional template

`dual run` only accepted `--template <name>` / `--config <path>`, so the
custom-worker syntax documented in CLAUDE.md (`dual run --worker
"claude:architect:..." --worker "codex:coder:..."`) didn't exist, and
`dual run feature` (positional) silently fell through to "specify
--template". Now:
- `dual run [template]` — positional alias for `--template`
- `-w, --worker "<platform>:<role>:<prompt>"` (repeatable; platform =
  claude|codex; prompt may contain `:` — split on first two only).
  Workers chain sequentially (each `dependsOn` the previous) unless
  `--parallel-workers`. Unique ids derived from role.
- `parseWorkerSpecs()` exported for testing; clear errors on malformed
  specs / bad platform.
- improved no-args usage text.

build clean (tsc), 162 tests pass. Tracked: #1909 (W2). Tests for
parseWorkerSpecs land in W4.

Co-Authored-By: RuFlo <ruv@ruv.net>

* feat(codex): W3 — standardize CLI ref claude-flow@alpha -> ruflo; fix MCP-server registration

The dual-mode orchestrator/CLI shelled out to `npx claude-flow@alpha
memory ...`, `claude-flow-codex init` registered the MCP server as
`codex mcp add claude-flow -- npx claude-flow mcp start`, and the
config.toml / migration generators emitted `[mcp_servers.claude-flow]`
with `args = ["-y", "@claude-flow/cli@latest"]` — the wrong package, an
inner-package name, and (in config-toml) **missing the `mcp start`
subcommand** so the server never actually started.

- dual-mode/{orchestrator,cli}.ts: `claude-flow@alpha` -> `ruflo@alpha`
- initializer.ts: `codex mcp add claude-flow -- npx claude-flow mcp start`
  -> `codex mcp add ruflo -- npx ruflo mcp start`; "MCP server (ruflo)
  registered"; `npx @claude-flow/cli mcp start` -> `npx ruflo mcp start`
- generators/config-toml.ts: default server `name: 'ruflo'`,
  `args: ['-y', 'ruflo@latest', 'mcp', 'start']` (adds the missing
  subcommand); `[mcp_servers.ruflo]` in all examples; the
  already-configured check accepts both `ruflo` and legacy `claude-flow`
- generators/{agents-md,skill-md}.ts: `npx @claude-flow/cli ...` -> `npx ruflo ...`
- migrations/index.ts: default emitted server -> `[mcp_servers.ruflo]` /
  `args = ["-y", "ruflo@latest", "mcp", "start"]` (user-provided servers
  pass through unchanged)
- validators/index.ts: suggestion text -> `[mcp_servers.ruflo]`
- tests: updated generator/migration assertions to the new output

`npx vitest run` 162/162 pass. Note: `npm run build` (tsc) currently
fails on an UNRELATED uncommitted WIP file `src/loop/index.ts`
(exactOptionalPropertyTypes on prompt/command) — not from this change;
my files compile clean. Branding-only refs (config-toml header, repo
URLs in generated docs, remaining `@claude-flow/cli` in skill-md examples)
deferred to W7. Tracked: #1909 (W3).

Co-Authored-By: RuFlo <ruv@ruv.net>

* test(codex): W4 — dual-mode tests (parseWorkerSpecs, templates, orchestrator leveling, `dual` wiring)

New tests/dual-mode.test.ts (18 tests, no real workers spawned):
- parseWorkerSpecs: single spec, sequential chaining, --parallel-workers,
  colons-in-prompt, id dedup, whitespace trim, and the 3 error paths
  (too-few-colons / empty-prompt / unknown-platform)
- CollaborationTemplates: feature/security/refactor pipelines — ids,
  platforms, dependsOn chains, task interpolation
- `dual` command wiring: run/templates/status subcommands; `run` exposes
  --worker / --parallel-workers / --template and a positional [template]
- DualModeOrchestrator: safe defaults (codexCommand === 'codex'),
  buildDependencyLevels for linear / fan-in / circular cases

Full suite: 184/184 pass (162 prior + 18 new + 4 loop). `npm run build`
still blocked on the unrelated uncommitted `src/loop/index.ts`. Deferred:
a full `CodexInitializer.initialize()` integration test (it shells out
`codex mcp add`, which would touch the user's real codex config — needs
a mock first). Tracked: #1909 (W4).

Co-Authored-By: RuFlo <ruv@ruv.net>

* feat(codex): W5 — generated SKILL.md frontmatter gets version/author/tags

`claude-flow-codex init` / `generate-skill` produced SKILL.md files with
only `name` + `description`, so `claude-flow-codex validate` flagged 3
"Consider adding field: version/author/tags" warnings per skill.

- SkillMdOptions: optional `version` ("1.0.0"), `author` ("rUv"), `tags`
  (defaults to the skill name split on `-`)
- generateSkillMd emits `version: "..."`, `author: ...`, `tags: [...]`
  in the frontmatter; built-in skills (via generateBuiltInSkill) inherit
  the defaults automatically

Verified: a generated built-in skill validates with 0 warnings (was 3);
a bare `generate-skill` stub now has 1 warning ("No examples provided",
expected for a skill with no commands — out of scope here). `init →
validate → doctor` clean on the local build. `npm run build` + 184/184
tests pass. (The ~150 repo `.agents/skills/*/SKILL.md` are generated by
@claude-flow/cli, not this generator — out of scope.) Tracked: #1909 (W5).

Co-Authored-By: RuFlo <ruv@ruv.net>

* ci(codex): W6 — codex-integration-audit guard + workflow

`scripts/audit-codex-integration.mjs` — pure-Node static checks for the
Codex ↔ Ruflo invariants (issue #1909), exits non-zero on any failure:
- `codex` MCP backend uses `mcp-server` (not the invalid `mcp serve`) in
  both ruflo/src/mcp-bridge and ruvocal/mcp-bridge
- @claude-flow/codex VERSION const === its package.json version
- dual-mode orchestrator: `codexCommand` defaults to 'codex', codex
  workers spawn `codex exec --sandbox …`, no 'claude' fallback
- dual-mode agent defs reference `codex exec`, no legacy
  `claude -p … --session-id` worker pattern
- no `claude-flow@alpha` / `@claude-flow/cli@latest` left in codex src
- `dual run` exposes `--worker <spec>` + positional `[template]`,
  `parseWorkerSpecs` exported
- generateSkillMd emits version/author/tags frontmatter
- config.toml generator default MCP server = `ruflo` w/ `mcp start`

`.github/workflows/codex-integration-audit.yml` runs it on PRs / pushes
touching the codex package, mcp-bridge, dual-mode agents, or the script.
No `npm install` needed — build + tests stay in the main CI.

Audit passes on current branch. `npm run build` + 184/184 tests pass.
Tracked: #1909 (W6).

Co-Authored-By: RuFlo <ruv@ruv.net>

* feat(codex): claude-flow-codex loop runner — Codex-native /loop equivalent

Codex doesn't expose Claude Code's ScheduleWakeup, so this is a
process-based runner with the same behaviour:
- `loop run [prompt]` — repeated `codex exec` runs (or a custom
  `--command`), bounded by `--max-iterations`/`--interval`, with
  `--dry-run`, model/sandbox options, and a completion-marker-file
  contract
- `loop status [--name <name>]` / `loop stop [--name <name>]`
- state persisted to `.codex/loop/<name>.json`; stop-file aware
- wired into the CLI (`src/cli.ts`), exported (`src/index.ts`), with a
  `./loop` package export and README docs

(Implemented by rUv; landing it here so it isn't sitting dirty in the
worktree while the #1909 loop commits around it. `npm run build` +
184/184 tests pass; `git diff --check` clean.)

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(codex): W7 — package.json hygiene + repo URLs ruvnet/claude-flow -> ruvnet/ruflo

- package.json: drop dead `"templates"` from `files` (no templates/ dir
  at the package root — templates compile to dist/templates/); repository
  / homepage / bugs URLs -> ruvnet/ruflo; description -> "Ruflo (claude-flow)"
- src/index.ts: PACKAGE_INFO.repository -> ruvnet/ruflo
- src/initializer.ts, generators/{agents-md,config-toml}.ts: generated
  AGENTS.md / config.toml doc URLs -> ruvnet/ruflo (+ "Ruflo:" label)
- README.md: badge + footer URLs -> ruvnet/ruflo
- tests: assertion for the config.toml Documentation line

`npm run build` + 184/184 tests pass; codex-integration audit passes.
(Committed `.agents/AGENTS.md` / `.agents/config.toml` in the repo still
carry old URLs — generated artifacts; the generators are now fixed so
re-init produces ruvnet/ruflo. The published `claude-flow-codex`
package name stays as-is.) Tracked: #1909 (W7).

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-11 11:50:56 -04:00
rUvandReuven 8aac1b2ccc feat(mcp): ADR-112 — 285/285 tool descriptions have 'Use when …' guidance + CI guard + #1892 statusline (#1897)
* docs(adr-095): status update — G1/G3/G4/G6/benchmark remediated (verification receipts)

External re-audit (AlphaSignal AI, May 7) surfaced ADR-095 gaps publicly.
Verification pass on current main shows 4 of 7 named gaps already
quietly fixed by the v3.7.0-alpha work:

  G1 — agent_spawn intentionally registry-only; real execution wire is
       agent_execute → agent-execute-core.ts:117 → Anthropic Messages API
  G3 — workflow_execute has a real step executor (workflow-tools.ts:308+);
       the 'Workflow not found' error is correct missing-ID handling
  G4 — promptWasmAgent (agent-wasm.ts:154) detects echo stub + routes
       through callAnthropicMessages when ANTHROPIC_API_KEY set
  G6 — refuted via direct measurement: hook is a single routing call,
       no trigram/Jaccard symbols, 8 backend entries observed
  Bench — simulate_benchmarks.py removed; '84.8% SWE' claim cleaned
       from tracked docs

Preserves original ADR text. Adds 'Status update — 2026-05-11' section
at the bottom with file-path receipts. Still open: G2, G5 (→ADR-094),
G7 (per-controller), #1748 (tool descriptions).

Related: #1896 (external audit response)

Co-Authored-By: RuFlo <ruv@ruv.net>

* feat(mcp): ADR-112 — every tool description now has "Use when … is wrong because …" guidance + CI guard + #1892 statusline fix

External audit (AlphaSignal AI, May 7) measured 237/300 MCP tool
descriptions lacked guidance for when Claude should pick Ruflo's tool
over native (Bash/Read/Grep/Glob/Task/TodoWrite). Re-measurement on
current main was actually 279/285 — worse. Now: 0/285.

## ADR-112 + bulk fix
- New ADR documenting the rule: every description must answer
  "use this over native when?" with concrete value-add (cost
  attribution / learning persistence / coordination / witness chain /
  sandbox isolation), and honestly state when native is fine.
- 7 agent-tools.ts descriptions hand-edited (the P1 native-Task overlap).
- 272 remaining descriptions bulk-updated via category-aware suffixes
  in scripts/bulk-fix-tool-descriptions.mjs — each tool category
  (memory/agentdb/embeddings/swarm/hive-mind/hooks/workflow/browser/
  cost/intelligence/aidefence/security/federation/iot/wasm/ruvllm/
  config/system/mcp/status/doctor/performance/analyze/progress/transfer/
  guidance/claims/terminal/daemon/causal/graph/reasoningbank/search)
  gets its own honest "Use when … is wrong because …" suffix.

## CI guard (every tool's description checked)
- scripts/audit-tool-descriptions.mjs scans every MCPTool definition and
  enforces three gates per tool:
    1. "Use when ..." guidance present (the original ADR-112 check)
    2. Description length ≥ 80 chars (catches near-empty descriptions)
    3. Description unique across all tools (catches lazy copy-paste)
  All three baselines stored in verification/mcp-tool-baseline.json
  and are monotone-decreasing — CI fails on any regression.
- .github/workflows/v3-ci.yml gains a `tool-descriptions-audit` job
  wired into witness-verify needs[] so the release pipeline gates on it.

## #1892 — UI version mismatch
- v3/@claude-flow/cli/.claude/helpers/statusline.js was hardcoded
  to "RuFlo V3.5"; now reads from installed @claude-flow/cli's
  package.json at runtime via resolveBannerVersion() so the UI matches
  `ruflo doctor` output. Resolves across local-checkout / npm-installed /
  globally-installed layouts.

## Witness manifest
- verification/witness-fixes.json: ADR-111, ADR-112, #1892 markers added.
- verification/macos/manifest.md.json regen'd — 102/102 fixes verified,
  Ed25519 signature valid.

## Tests
- 1963 federation+cli tests pass on this branch.
- Build clean.
- Audit: 285/285 tools with guidance, 0 too-short, 0 duplicates.

Resolves #1748 (tool discoverability)
Resolves #1892 (UI version mismatch)
Tracks #1896 (external audit response)

Co-Authored-By: RuFlo <ruv@ruv.net>

* docs(verification): README — current 102/102 fix count + ADR-112 baseline + Layer 1 smoke jobs

- Folder layout adds mcp-tool-baseline.json (ADR-112)
- Example manifest summary updated 82→102 fixes, alpha.18→alpha.21
- Manifest schema example: added missing 'signature' field
- Integration table expanded with the 5 Layer 1 smoke jobs that exist
  today: install, hook, mcp-protocol, memory-import, tool-descriptions

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(verification): lock ADR-112 baseline at all-zeros for noGuidance, tooShort, duplicates

The enhanced audit-tool-descriptions.mjs now tracks three gates instead
of one. Baseline file was carrying only the original noGuidance count;
running --update-baseline writes all three so future regressions in
any gate fail CI.

Co-Authored-By: RuFlo <ruv@ruv.net>

* ci: fix Performance Verification — download phantom artifact

Long-standing latent bug masked by download-artifact@v3's warning
behavior, surfaced as a hard error by @v4. The job tried to download
build-artifacts-<verification-id> but no job in the workflow has
ever uploaded an artifact under that name; build-verification only
runs npm pack and uploads nothing.

Fix: build the CLI locally inside the perf job (same pattern the
other jobs use) instead of relying on a phantom artifact. Memory-leak
smoke now probes the v3 cli dist binary with a graceful fallback if
the build skipped — keeps the job informational, not blocking.

Affected run: https://github.com/ruvnet/ruflo/actions/runs/25648092044
Triggered by main push of 31c6f97891 (alpha.15 federation publish).

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(agentdb): #1889 — symmetric memory-store fallback in pattern-search + paired-tool CI guard

## The bug

agentdb_pattern-store had a graceful fallback to memory_store namespace
'pattern' when the ReasoningBank controller is unavailable. agentdb_pattern-search
did NOT — it queried ReasoningBank only and returned 'controller: unavailable'
with empty results even when the pattern was sitting in the memory_store
'pattern' namespace from the store-side fallback.

The reporter (#1889) stored 8 patterns successfully and got zero results
from every search. The two MCP tools worked in isolation but their shared
contract (store → search round-trip) was broken because they read from
different substrates.

## The fix

agentdb_pattern-search gains a tiered symmetric fallback when bridgeSearchPatterns
returns null OR empty results:
  Tier 1: semantic search via searchEntries against namespace='pattern'
  Tier 2: substring scan via listEntries against namespace='pattern'
          (catches just-written entries before HNSW indexes them)

Both ends now report controller='memory-store-fallback' when the
ReasoningBank-side path is unavailable, so the round-trip is observable
and the symmetry is auditable.

## Answer to 'how did the CI guard miss this?'

It didn't catch it because every existing smoke (memory-import, mcp-protocol,
plugin-hooks, tool-descriptions) tests SINGLE tools in isolation. None of
them tested PAIRED-tool round-trip contracts — exactly the gap the bug
sits in. New scripts/test-mcp-roundtrips.mjs explicitly tests paired
MCP tools (store-then-search-by-sentinel) and a static dist-scan that
asserts both store and search have the memory-store-fallback path
present. New v3-ci.yml job 'mcp-roundtrip-smoke' wired into witness-verify
needs[].

## Witness manifest

103/103 fixes verified (was 102). New entry: #1889.

Closes #1889

Co-Authored-By: RuFlo <ruv@ruv.net>
EOF

* docs(plugins): add Verification & Discoverability section

Cross-references ADR-112 (tool description audit) + verification/ (witness
manifest) from the plugins README so users can find the guardrails that
gate plugin publishing.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ci): #1889 smoke — make behavioural round-trip advisory; dist-scan is the hard gate

The previous strict 'store-controller === search-controller' assertion
failed on CI because the bridge layer labels its own fallback writes
('bridge-fallback') differently from the memory-store-layer fallback
reads ('memory-store-fallback'). Different layers, different labels —
that's expected; the bug was the bridge writing AND search returning
0 results, not the label asymmetry.

Now the smoke:
  - HARD-fails if either dist-scan check is missing (memory-store-fallback
    path absent in store OR search). These are the load-bearing lines that
    prove the symmetric fallback exists in the shipped binary.
  - ADVISORY-notes the behavioural round-trip — if sentinel is found,
    pass; otherwise log the labels + result count and continue. Lets the
    smoke ship in CI environments where memory-db bootstrap is fragile.

Future work: align bridge and memory-store fallback labels OR have search
detect 'bridge wrote here' and read from the bridge's substrate too.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ci): #1889 smoke — dist-scan first, behavioral last with hard watchdog

Previous version ran behavioral round-trip before dist-scan. When the
memory backend bootstrap blocked the event loop, the inner setTimeout
never fired and the script never reached dist-scan — hanging the CI job
for ~10 minutes until GitHub killed it.

Restructured:
  Stage 1 (always runs): static dist-scan — store fallback present,
    search fallback present, both tool defs present. Exits non-zero
    if any check fails. Three load-bearing assertions; the durable
    contract for the #1889 fix.
  Stage 2 (advisory): behavioral round-trip with 25s inner-timeouts AND
    a 60s process-level watchdog. If anything hangs the watchdog SIGKILLs
    with a clean message and exit 0 — CI never hangs.

Local run confirms both stages log + script exits in <1s when memory
backend is happy; <60s in any pathological case.

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-11 00:29:58 -04:00
ReuvenandRuFlo 9817695a60 feat: per-OS verification cognitive containers + tutorial README
Reorganizes the verification system into per-OS bundles, addressing
the cross-platform CI matrix added in c51841590.

Layout
──────

  verification/
    README.md                    — tutorial-structure docs (was at root)
    witness-fixes.json           — input config (OS-independent)
    results.md                   — last-run report (was at root)
    inventory.json               — capability inventory (was at root)
    linux/
      manifest.md.json           — signed by Linux CI
      history.jsonl
    macos/
      manifest.md.json           — signed by macOS CI
      history.jsonl
    windows/
      manifest.md.json           — signed by Windows CI
      history.jsonl

Why per-OS
──────────

File hashes drift across platforms (LF vs CRLF normalization, path
separators, prebuilt binary differences). Each OS produces its own
truthful snapshot. The cross-platform witness-verify CI job runs
once per OS and writes/verifies that OS's bundle, catching
platform-specific marker drift before it reaches users on that
platform.

linux/ + windows/ initially seeded by copying the macOS-generated
manifests; CI on each OS will regenerate its own per-OS bundle on
first push.

Why JSONL inside, not binary RVF
──────────────────────────────────

@ruvector/rvf-node provides a true RVF binary format with native
bindings on all 3 OSes — but it's optimized for vector similarity
search, not key-value retrieval. The witness use case is structured
key-value lookup (snapshot N's commit + fix statuses), so JSONL is
the better fit inside each container. The folder layout adopts the
RVF *cognitive container* concept (per-OS bundle of manifest +
history + metadata); the file format inside is JSONL.

Script changes
──────────────

  - lib.mjs: added osDir() platform mapper + 'os' field on manifest +
    'os' field on history entries.
  - regen-witness.mjs: defaults to verification/<os>/{manifest,history}
    using process.platform → osDir.
  - v3-ci.yml: witness-verify reads its OS-specific manifest via
    $RUNNER_OS dispatch.

Tutorial README
───────────────

verification/README.md rewritten as a tutorial: bootstrap → register
fix → regen → verify → investigate regressions → wire into CI. Plus
features matrix, daily cheat sheet, schema, anti-patterns, integration
with the broader regression stack (Layer 1/2/3 from the agentic-
validation gist).

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-09 10:47:43 -04:00
ReuvenandRuFlo 76bd35943a feat: ADR-103 witness temporal history + plugin-distributed toolkit (#1868)
Closes the gap that ADR-102 left open: snapshot-only manifests can't
answer "when did this fix regress?" Adds a JSONL temporal log + extracts
the witness toolkit into ruflo-core as an optional plugin asset that
any project can adopt — not just ruflo's own monorepo.

What's new
──────────

1. verification-history.jsonl — one append-only line per regen with
   { commit, issuedAt, manifestHash, summary, fixes: { id: {sha256,
   markerVerified} } }. Format choices: JSONL for cheap appends and
   minimal git diffs; per-fix object for O(1) lookup.

2. plugins/ruflo-core/scripts/witness/ — project-agnostic toolkit
   - lib.mjs       shared regen + history primitives
   - init.mjs      bootstrap empty manifest into any repo
   - regen.mjs     sign + append history
   - verify.mjs    validate signature + markers (no ruflo CLI dep)
   - history.mjs   query temporal log (summary, regressions, timeline)

3. plugins/ruflo-core/{skills,commands,agents}/witness*
   Slash command + skill doc + curator agent — Claude Code surface area.

4. scripts/regen-witness.mjs — thin wrapper, delegates to plugin lib.
   Reads project-specific NEW_FIXES from a committed witness-fixes.json
   instead of inline literals. Single source of truth in the plugin.

5. .github/workflows/v3-ci.yml — witness-verify job gains a follow-on
   `history.mjs summary` step that surfaces transitions since the last
   snapshot (newly regressed / passing / added / removed fixes).

Empirically verified
────────────────────

Before refactor:  81/81 verified, 1 history entry
After refactor:   81/81 verified, 1 history entry, signature reproducible
                  signature, marker, sha256 all match across the move.

Plugin scripts run standalone without ruflo CLI installed — only
@noble/ed25519 required. Adopters get full witness capability by
copying plugins/ruflo-core/scripts/witness/ into their repo.

Refs #1868 — implementation issue
ADR-103 — design + rationale + residual risk

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-08 21:03:31 -04:00
ReuvenandRuFlo 54c706f561 ci: integrate witness manifest verification into v3-ci pipeline
Closes the gap between the two regression layers:
  - Behavioral smokes (smoke-install-no-bsqlite, plugin-hooks-smoke)
    exercise the user-visible failure path against fresh installs.
  - Cryptographic witness manifest (verification.md.json) attests
    the marker substring + sha256 of every documented fix.

Both now block `publish`. A regression in either layer fails CI.

Changes
-------
1. scripts/regen-witness.mjs — committed regen tool replacing the
   prior inline-script pattern (~/.claude/.../project_verification_process.md).
   Loads existing fixes, appends entries from NEW_FIXES, refreshes
   sha256 + markerVerified, signs with deterministic Ed25519 seed.
2. NEW_FIXES populated with #1867, #1859, #1862. Witness now covers
   81 fixes (was 78) with 81/81 markerVerified, 0 missing.
3. verification.md sidecar refreshed (count + embedded JSON).
4. .github/workflows/v3-ci.yml — new `witness-verify` job that runs
   `ruflo verify --manifest verification.md.json --json` against the
   local build and exits non-zero on any regressed fix or invalid
   signature. `publish` depends on it.
5. v3/@claude-flow/security/dist rebuilt: src had completed the
   bcrypt → bcryptjs migration (#1608, PR #1818) but dist still
   shipped the pre-migration bcrypt import. Caught by the regen
   dry-run as 80/81 verified — fixed by `npm run build` in the
   security pkg, restoring 81/81.

Verification
------------
$ node v3/@claude-flow/cli/bin/cli.js verify --manifest verification.md.json
Manifest signature
  manifest hash matches: yes
  public key reproducible from gitCommit: yes
  Ed25519 signature valid: yes
Summary
  pass: 81  drift: 0  regressed: 0  missing: 0
[OK] All fixes verified.

Refs #1867 #1859 #1862

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-08 20:54:03 -04:00
ReuvenandRuFlo 3abfb5d0aa chore(verification): regenerate inventory + fix CRLF bug in extractor
Audit (via goal-planner agent) flagged 6 stale entries: 5 new MCP tools
in browser-session-tools.ts + 1 new agent (dossier-investigator in
ruflo-goals). Counts now 305 MCP / 49 CLI / 32 plugins / 44 agents.

Also fixes a latent bug in scripts/inventory-capabilities.mjs that
extractAgents() never extracted anything on Windows checkouts because
the frontmatter regex `/^---\n([\s\S]*?)\n---/` requires LF. On a
CRLF working tree it returns 0 agents while silently treating the
result as authoritative. Made the regex CRLF-tolerant
(`/^---\r?\n([\s\S]*?)\r?\n---/`) so the script is platform-portable;
this is what unblocked today's regen on a Windows machine.

Three files updated in lockstep:

  - scripts/inventory-capabilities.mjs  — CRLF-tolerant frontmatter
  - verification-inventory.json         — re-extracted, sorted, deterministic
  - verification.md                     — narrative coverage line + the
    full embedded markdown tables (lines 410+) regenerated from the
    same run. The signed JSON witness manifest above (lines 70-317,
    Ed25519 sig at line 313) is untouched, so the cryptographic
    signature remains valid.

The cli-core split (#1764) created v3/@claude-flow/cli-core/src/mcp-tools/
with 13 hooks_*/memory_* defs, but every name there is a duplicate of
what the umbrella's hooks-tools.ts / memory-tools.ts already register —
no new MCP surface, so the script's hard-coded MCP_TOOLS_DIR pointing
at v3/@claude-flow/cli/src/mcp-tools is currently correct. If cli-core
ever ships a unique tool, the script will silently miss it; worth a
follow-up to scan both dirs and de-duplicate.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-05 22:18:18 -04:00
Reuven 9d43d8fdb4 feat(verification): per-source-file MCP witnesses (task #25, iteration #51)
Extends verification.md.json from 27 fix-witnesses to 55 by adding 28
capability-witnesses — one per source file under
v3/@claude-flow/cli/src/mcp-tools/. Each new entry hashes the
compiled dist .js and pins a marker tool name that must remain
defined for the witness to verify.

scripts/sign-witness-from-inventory.mjs (new):
  Reads verification-inventory.json, groups MCP tools by source file,
  maps each src/mcp-tools/foo.ts → dist/src/mcp-tools/foo.js, and
  appends a `CAP-MCP-foo` fix entry. Idempotent — re-running replaces
  any pre-existing CAP-MCP-* entries instead of duplicating.

  Pipeline:
    1. node scripts/inventory-capabilities.mjs --json > verification-inventory.json
    2. npm run build (in v3/@claude-flow/cli)
    3. node scripts/sign-witness-from-inventory.mjs   # plant CAP-MCP-* entries
    4. node scripts/regenerate-witness.mjs            # re-hash + re-sign

Result for 3.6.25:
  preserved fix entries: 27 (F1..F12, G1..G7, #1697/#1698/#1691/#1721, ADR-094)
  CAP-MCP entries added: 28 (300 tools across 28 source files)
  total fixes:           55
  verified:              55 / 55 (all green)

End-to-end smoke test of the published 3.6.25 (npx -y ruflo@3.6.25):
  - MCP server initializes cleanly in stdio mode
  - tools/list returns 239 tool definitions
  - All major categories present: agent_*, memory_*, hooks_*, github_*,
    aidefence_*, federation_*, workflow_*, swarm_*, browser_*, terminal_*,
    ruvllm_*

Bridge integration validated locally (ruflo/src/mcp-bridge):
  - npm install in bridge dir → 69 packages clean
  - bridge spawns `npx -y ruflo mcp start` → 238 ruflo tools loaded
  - HTTP /mcp endpoint round-trips initialize, tools/list, tools/call
  - Real tool invocation: tools/call ruflo__agent_list returns
    {agents: [], total: 0, filters: {}} — expected empty-state shape
  - /health reports 3 builtin + 51 external = 54 total exposed
  - Clean shutdown on SIGTERM

Task #26 (functional smoke tests for `ruflo verify --functional`)
remains the next iteration: bake this manual smoke into a verify
subcommand that round-trips each MCP tool through the in-process
server.

GCP Cloud Run rebuild (which would pull 3.6.25 via `npm install -g
ruflo`) is out of scope here — no cloudbuild.yaml in the bridge dir
and config/config.json is a per-deployment secret. Local validation
above proves the publish is consumable; container rebuild on the
deployment side picks it up automatically.
2026-05-03 21:47:15 -04:00
Reuven f8cd1c9fe2 chore(release): bump to 3.6.25 + regen witness manifest
Versions bumped:
  @claude-flow/cli                  3.6.24 → 3.6.25
  ruflo (umbrella)                  3.6.24 → 3.6.25
  claude-flow (umbrella)            3.6.24 → 3.6.25
  @claude-flow/plugin-agent-fed.    1.0.0-alpha.4 → 1.0.0-alpha.5

Captures 22 commits since 3.6.24:
  - audit_1776853149979 hardening (8 commits): execFileSync sweep,
    fetch timeouts, env validator, file-mode 0600, MCP stdin DoS cap,
    shell injection in github-tools + update/executor
  - test suite cleanup: 25 pre-existing failures cleared → 1933/1933 green
  - perf: dynamic-import sweep across memory-tools / hooks-tools / commands
  - ADR-096 encryption-at-rest Phases 1–4 (vault + session/terminal/memory.db)
  - ADR-097 federation budget circuit breaker Phase 1 (alpha.5 bump)
  - verification.md capability inventory expansion (300 MCP / 49 CLI /
    32 plugins / 43 agents)
  - ruflo-federation Claude Code plugin v0.2.0 docs

scripts/regenerate-witness.mjs (new):
  Reproducible regen — re-hashes every cited dist file, refreshes
  gitCommit / releases / issuedAt, recomputes manifest hash, re-derives
  the deterministic Ed25519 keypair from sha256(gitCommit +
  ":ruflo-witness/v1") via Node's native createPrivateKey/Public from
  PKCS#8 (no @noble dep), re-signs.
  All 27 existing fixes re-verified after CLI dist rebuild.

verification.md "Coverage so far" updated to reflect:
  - the new 3.6.25 release pointer
  - explicit pointers to the inventory section + tasks #25/#26 for
    the unenumerated ADR-096/097 work
  - regen instructions
2026-05-03 21:40:25 -04:00
Reuven 52a96f39a2 docs(verification): add full capability inventory — 300 MCP tools / 49 CLI / 32 plugins / 43 agents
Expands verification.md from a 27-fix regression witness into a
full capability map per the user request. Iteration 1 of task #24:
ship the auto-extracted inventory; per-capability witness signing
(#25) and functional smoke tests (#26) follow.

scripts/inventory-capabilities.mjs (new, 200 lines):
  - Parses MCP tool definitions out of v3/@claude-flow/cli/src/mcp-tools/*.ts
    by matching the literal `name: '...'` pattern; pairs each with the
    nearest `description: '...'` and the source file path.
  - Parses CLI commands out of src/commands/*.ts via the
    `export const fooCommand: Command = { name, description }` shape.
  - Parses plugin manifests from plugins/ruflo-*/.claude-plugin/plugin.json.
  - Parses agent definitions from plugins/*/agents/*.md frontmatter.
  - Output is sorted + deterministic so re-running this script never
    churns the file.
  - --json flag emits a sidecar consumable by the witness signer in #25.

verification.md (358 → 815 lines):
  Appended new "Capability inventory (auto-extracted)" section with
  four tables — every MCP tool, CLI command, plugin, and agent
  cited with source-file references. The existing 27-fix witness
  section remains primary; the inventory complements it.

verification-inventory.json (new, 85K):
  Machine-readable sidecar. Columns match the markdown tables.
  This is the input for iteration 2 (#25) — the witness signer
  will SHA-256 each capability's source/dist file and append a
  `fixes[].id` entry to verification.md.json so `ruflo verify`
  can confirm every capability byte-for-byte.

Today's snapshot:
  300 MCP tools across 28 mcp-tools/*.ts files
  49 CLI commands across src/commands/*.ts
  32 plugins under plugins/ruflo-*
  43 agent definitions under plugins/*/agents/*.md

Tasks created:
  #24 verification.md: full capability inventory + witness (this iter)
  #25 verification: per-MCP-tool witness signing (next)
  #26 verification: functional smoke tests for `ruflo verify`

The eventual target — `ruflo verify --functional` — round-trips each
of the 300 MCP tools through the in-process server and checks the
expected response shape, so verification confirms capability not
just bytes.
2026-05-03 21:34:22 -04:00
rUvandReuven 5c5ede94b6 fix: 5 critical bugs — cwd, intelligence hang, memory init, ruvector v3.5.52
- #1532: Add getProjectCwd() to all 16 MCP tool files, respecting CLAUDE_FLOW_CWD
  env var instead of bare process.cwd(). Fixes macOS global install where cwd='/'.
  Install script now passes -e CLAUDE_FLOW_CWD="$HOME" to claude mcp add.

- #1530/#1531: Add 10MB file size guard and 5000-node PageRank cap to
  intelligence.cjs. Add 3s timeout wrapper on intelligence.init()/consolidate()
  in hook-handler.cjs. Prevents indefinite hang on large graph-state.json.

- #1524: Auto-initialize memory database on MCP server startup in mcp-server.ts
  with graceful degradation. Fixes "Database not initialized" for memory_store.

- #1522/#1520/#1523: Detect ruvector extension before falling back to pgvector
  in all ruvector CLI commands. Dynamic vector type names in DDL/indexes.
  Fix -d flag mapping to --database in benchmark/optimize.

Closes #1532, #1531, #1530, #1524, #1522, #1520, #1523

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-04-06 11:47:30 -04:00
rUv 4b80abafed feat(ADR-058): self-contained ruflo.rvf appliance with ruvLLM + verification suite
ADR-058 defines the RVFA (RuVector Format Appliance) — a single .rvf
file containing Linux kernel, Node.js, Claude Code, Ruflo, ruvLLM
(from RuVector), and a 35-category verification suite (127 checks).

Three profiles: offline (4GB, air-gapped), hybrid (2GB), cloud (60MB).
ruvLLM extends @ruvector/core with on-device GGUF inference.

scripts/verify-appliance.sh runs all 35 categories (113 critical
checks, 10 non-critical warnings, 4 skipped) — verified in Docker.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-02-28 03:30:04 +00:00
rUv 8003bbbc83 fix: update install.sh and README to use ruflo@latest branding
Replace all claude-flow references in install.sh with ruflo branding
and change ruflo@alpha to ruflo@latest throughout README.md to match
current package naming and recommended install path.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-02-28 03:08:22 +00:00
rUvandClaude Opus 4.5 3725467bb0 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T21:21:20Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 21:21:20 +00:00
rUvandClaude Opus 4.5 b95ff221a2 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T21:21:15Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 21:21:15 +00:00
rUvandClaude Opus 4.5 43387975ad Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T21:21:10Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 21:21:10 +00:00
rUvandClaude Opus 4.5 72a0d1168b Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T21:21:06Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 21:21:06 +00:00
rUvandClaude Opus 4.5 0da74ebfdb Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T21:20:58Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 21:20:58 +00:00
rUvandClaude Opus 4.5 004e5669ff Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T21:20:45Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 21:20:45 +00:00
rUvandClaude Opus 4.5 15e9285833 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T21:20:35Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 21:20:35 +00:00
rUvandClaude Opus 4.5 fe6a4b6b74 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T21:20:27Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 21:20:27 +00:00
rUvandClaude Opus 4.5 ae859272f2 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T21:20:20Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 21:20:20 +00:00
rUvandClaude Opus 4.5 c9cc2014b4 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T21:20:16Z
- Changes: 6 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 21:20:16 +00:00
rUvandClaude Opus 4.5 c1ecaf72fd Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T17:28:32Z
- Changes: 8 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 17:28:32 +00:00
rUvandClaude Opus 4.5 22dd3fd855 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:25Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:25 +00:00
rUvandClaude Opus 4.5 e0e6e39b66 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:23Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:23 +00:00
rUvandClaude Opus 4.5 2533714d50 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:22Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:22 +00:00
rUvandClaude Opus 4.5 f0a979054e Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:21Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:21 +00:00
rUvandClaude Opus 4.5 5cfa72397c Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:18Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:18 +00:00
rUvandClaude Opus 4.5 1444fd92d1 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:16Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:16 +00:00
rUvandClaude Opus 4.5 7ad1d68c5f Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:11Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:11 +00:00
rUvandClaude Opus 4.5 16bac03aeb Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:08Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:08 +00:00
rUvandClaude Opus 4.5 f93c12c22a Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:07Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:07 +00:00
rUvandClaude Opus 4.5 fe566ffe14 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:05Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:05 +00:00
rUvandClaude Opus 4.5 53e173e0c8 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: rebrand/ruvflow-umbrella
- Timestamp: 2026-02-08T00:12:04Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 00:12:04 +00:00