Commit Graph
7782 Commits
Author SHA1 Message Date
rUvandReuven 4051aeecad docs(neural-trader): record 2.7.2 fix, keep --ignore-scripts as defense (#1974) (#1979)
`neural-trader@2.7.2` published 2026-05-14 — install hook no longer spawns
a recursive `npm install`. Cite the upstream PR (ruvnet/neural-trader#109)
in the README's Prerequisites section, recommend pinning to >=2.7.2, and
keep the `--ignore-scripts` flag on every documented install as defense
in depth (cheap belt-and-braces against any future install-script
regression — and what `scripts/audit-neural-trader-safety.mjs` still
enforces).

The "danger zone" advisory still appears for anyone pinned to <=2.7.1,
since lockfiles can hold older versions long after the fix lands.

Verified end-to-end:
  $ rm -rf /tmp/nt-verify && mkdir /tmp/nt-verify && cd /tmp/nt-verify
  $ perl -e 'alarm 30; exec("npm","install","neural-trader@latest")'
  added 698 packages in 18s   ← was 80 min / 120 GB RAM
  exit=0
  $ ps aux | grep -c "[n]eural-trader"
  1   ← was 3,049

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 09:17:06 -04:00
ReuvenandRuFlo 4a19793e52 chore(release): 3.7.0-alpha.35 — ships #1974 mitigation
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.35.

Fixes:
- #1974 — neural-trader@2.7.1 has a malicious-by-accident `install`
  lifecycle script that recursively invokes `npm install` from inside
  the install hook → unbounded process recursion → ~120 GB RAM + 3,049
  stuck processes on macOS Apple Silicon. The plugin's docs told users
  to run the dangerous command verbatim. Now every documented install
  uses `npm install --ignore-scripts neural-trader` (the linux-x64
  binary is hardcoded inline in the upstream tarball, so the package
  still works on that platform after `--ignore-scripts`). 9 files
  patched + new `scripts/audit-neural-trader-safety.mjs` CI guard in
  the `hook-command-audit` job. Merged via #1976.

Also closed #1975 (recruiter outreach, not a bug) and asked #1973 for
specific repro details (vague "Windows install + bash + wiki" report
without a failing command or error).

Published to npm with all dist-tags updated:
- @claude-flow/cli  3.7.0-alpha.35  (alpha, latest, v3alpha)
- claude-flow       3.7.0-alpha.35  (alpha, latest, v3alpha)
- ruflo             3.7.0-alpha.35  (alpha, latest)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-14 08:05:04 -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 c8258cc07c fix(cost-tracker/compact): resolve from anywhere + free HEALTH_PORT (#1930) (#1971)
`compact.mjs` only worked when the caller ran from a cwd where
`@claude-flow/integration` resolved — which on a pnpm-workspace
marketplace install means `cwd=v3/@claude-flow/integration/` specifically
(pnpm doesn't hoist into `v3/node_modules/`). The skill's documented
`cd v3 && node ...` path failed with `Cannot find module
@claude-flow/integration/token-optimizer`.

The script also imported agentic-flow indirectly, which binds
`process.env.HEALTH_PORT || 8080` at module-load time and EADDRINUSE'd
on any host with something else already on 8080.

Fix:

1. Resolution chain (#1930 step 5) — try in order:
   - createRequire(cwd) — works for npm-style hoisted installs
   - createRequire(script-dir) — works when run from inside the plugin
   - absolute path walk from `import.meta.url` up to 6 levels looking
     for `v3/@claude-flow/integration/dist/token-optimizer.js` — works
     on the marketplace layout regardless of cwd

2. HEALTH_PORT (#1930 step 4) — set to `0` by default (OS picks a free
   port) before the dynamic import runs. Users can still override.

3. dist/-missing (#1930 step 1) — when the resolver finds a path that
   doesn't exist on disk, surface a clear error pointing at the build
   command (`cd v3/@claude-flow/integration && pnpm run build`) instead
   of the generic MODULE_NOT_FOUND.

Steps 2 (agentic-flow not in workspace deps) and 3 (sharp prebuild
missing) are install-environment issues outside the script's reach.
The graceful-fallback path already reports `agenticFlowAvailable: false`
when the bridge can't load, which covers those cases truthfully.

Resolves #1930 (script-level — the deeper packaging fix to ship a built
`@claude-flow/integration/dist` in marketplace bundles is separate).

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 22:28:02 -04:00
ReuvenandRuFlo c29ed99637 chore(release): 3.7.0-alpha.34 — ships #1968 fix + #1946/#1943/#1940 closeouts
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.34.

Code fix:
- #1968 — daemon start --workers map silently dropped the flag when the
  launcher forked the foreground child, so the daemon came up with the
  full default worker set regardless of the user's selection. Threaded
  --workers / --headless / --sandbox through the same validation +
  forwarding path the resource thresholds already use. Merged via #1970.

Issue-tracker closeouts (no new code — these were fixed in earlier alphas
but the issues weren't auto-closed by the PRs that resolved them):
- #1946 — doctor "Not initialized" — fixed in alpha.29 (#1959)
- #1943 — global-install hook MODULE_NOT_FOUND — fixed in alpha.28 (#1957)
- #1940 — bridge_status totalEntries:0 — fixed in alpha.31 (#1963)

Published to npm with all dist-tags updated:
- @claude-flow/cli  3.7.0-alpha.34  (alpha, latest, v3alpha)
- claude-flow       3.7.0-alpha.34  (alpha, latest, v3alpha)
- ruflo             3.7.0-alpha.34  (alpha, latest)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-13 21:57:26 -04:00
rUvandReuven 8a4803020f fix(daemon): forward --workers / --headless / --sandbox to forked child (#1968) (#1970)
`daemon start --workers map` (and `--headless` / `--sandbox`) were
accepted by the launcher but silently dropped when it forked the
foreground child — so the daemon came up with the full default worker
set (`map,audit,optimize,consolidate,testgaps`) regardless of what the
user asked for.

Root cause: `startBackgroundDaemon()` only accepted resource thresholds
(`--max-cpu-load` / `--min-free-memory`) and forwarded just those plus
`--workspace` to the forked child. `--workers` / `--headless` /
`--sandbox` were read by `ctx.flags.*` but never passed through.

Fix: thread the three additional flags through the launcher and add
them to the forked child's argv, gated by the same kind of strict
input validation the existing thresholds use:

  - `--workers <list>`  — `/^[a-z][a-z0-9_-]*(,[a-z][a-z0-9_-]*)*$/`
  - `--headless`        — boolean
  - `--sandbox <mode>`  — one of `strict|permissive|disabled`

Anything that fails validation is dropped silently — same posture as
the existing thresholds. Forced through the same `forkArgs.push()`
path so the child sees them in argv (which both the daemon's own arg
parser AND `killStaleDaemons` rely on for workspace identification).

Behaviour now (matching the user's repro from #1968):

  $ ruflo daemon start --workers map --max-cpu-load 1000 --min-free-memory 0
  $ ruflo daemon status
  Workers Enabled: 1
  map         enabled

Build verified clean (tsc).

Resolves #1968.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 21:56:25 -04:00
ReuvenandRuFlo 9057d59749 docs(summit): make banner link to registration + add text link below
Wraps the Budapest summit banner in a link to the discounted Craft
Conference registration page (ti.to/AgenticsFoundation20) and adds a
visible "🎟️ Register here — discount applied" text link directly under
it for screen readers / link-extractors that skip image links.

Issue #1967's body updated to match.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-13 13:43:05 -04:00
ReuvenandRuFlo 276874adb0 docs: add ruFlo Summit Budapest banner asset
Image referenced by:
- v3/docs/assets/ruflo_summit_budapest.md (the doc / issue body source)
- README.md (linked banner above # Ruflo, points at #1967)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-13 13:40:29 -04:00
ReuvenandRuFlo 8c6584efdd docs: link ruFlo Summit Budapest issue (#1967) from root README
Adds a linked banner above `# Ruflo` pointing at the newly-created
Summit announcement (#1967). The summit asset doc
(v3/docs/assets/ruflo_summit_budapest.md) is also reformatted into
table-led sections with light section emoji for skim-ability — same
content the issue body uses (image URL rewritten to the GitHub raw
path so it renders on the issue).

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-13 13:40:15 -04:00
ReuvenandRuFlo 40e94434ff chore(release): 3.7.0-alpha.33 — 14 critical fixes since alpha.27
Cumulative batch release closing out the issue-triage cycle that started
at alpha.27. Bumps @claude-flow/cli, claude-flow, and ruflo to alpha.33;
each prior bump (.28→.32) shipped its fix-set immediately but had no
GitHub Release writeup. This commit + tag closes the loop.

Fixes shipped since alpha.27 (resolved-issue list):

Memory layer:
- #1947  vector_indexes schema dim 768→384 (default model is 384-dim)
- #1942  Bridge search index 768 vs imported 384-dim — same root cause
- #1952  Windows: memory store ok, search returns 0 — same root cause
- #1945  CLI memory store didn't persist on non-default memory paths
         (bridge ignored CLAUDE_FLOW_MEMORY_PATH / config)
- #1946  doctor reported DB "Not initialized" on a valid DB at
         data/memory/memory.db (same cwd-path-hardcode root cause)
- #1941  memory_search returned 0 for non-default namespaces — every
         store path now provisions per-namespace vector_indexes rows
- #1940  memory_bridge_status reported totalEntries:0 — used
         entries.length (page size) instead of .total (row count)
- #1939  Win32 cwd didn't resolve to Claude Code's on-disk slug —
         drive-colon / backslash / whitespace now normalised to `-`
- #1947 RC2  embeddings index -a build required `-c` — now optional

Hooks layer:
- #1944  pre-bash TypeError on every Bash call — toolInput (object)
         was used as the prompt string fallback; switched to .command
- #1943  global-install hooks fired MODULE_NOT_FOUND — settings paths
         now probe project-local first, fall back to $HOME

UI / statusline:
- #1953  hooks_pretrain extracted 0 patterns on md-heavy repos — used
         a code-file budget + code-dir-first traversal
- #1951  statusline hardcoded V3.5 — now probes plugin install path
         first, falls back to npm install / source checkout

Verification:
- #1949  federation plugin install 403 on cookies@0.9.1 — added
         scripts/verify-federation-plugin.sh that pins cookies@0.9.0
         at the verification harness root. Workaround until upstream
         pipenet/koa chain ships a non-blocked release.

CI regression guards (so these don't come back):
- scripts/audit-vector-dim.mjs        — #1947 dim guard
- scripts/audit-hook-handler-prompt.mjs — #1944 toolInput guard

Published to npm with all dist-tags updated:
- @claude-flow/cli  3.7.0-alpha.33  (alpha, latest, v3alpha)
- claude-flow       3.7.0-alpha.33  (alpha, latest, v3alpha)
- ruflo             3.7.0-alpha.33  (alpha, latest)

Co-Authored-By: RuFlo <ruv@ruv.net>
v3.7.0-alpha.33
2026-05-13 13:33:44 -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
ReuvenandRuFlo 0cdad108b9 chore(release): 3.7.0-alpha.32 — ships #1947 RC2 fix
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.32.

Fixes:
- #1947 RC #2 — `embeddings index -a build` REQUIRED `-c` and the docs
  suggested `-c default`/`-c documents`/etc., so users who stored entries
  under a non-default namespace ended up with `Vector Count: 0`. The HNSW
  index has always been a single global structure across all namespaces;
  `-c` is informational only. Make it optional, treat omitted `-c` as
  "(all namespaces)", and print a helpful hint when the resulting count
  is 0. Merged via #1964.

Also posted an investigation comment on #1949 — the federation plugin
install 403 is genuinely upstream-only (cookies@0.9.1 arrives transitively
via `agentic-flow`, which is third-party; npm `overrides` in a non-root
package.json aren't honored when consumers install the plugin as a dep).
Documented why and what the actual fix path looks like, so the issue
isn't lost.

Published to npm with all dist-tags updated:
- @claude-flow/cli  3.7.0-alpha.32  (alpha, latest, v3alpha)
- claude-flow       3.7.0-alpha.32  (alpha, latest, v3alpha)
- ruflo             3.7.0-alpha.32  (alpha, latest)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-13 10:44:32 -04:00
rUvandReuven a5a6389852 fix(embeddings-index): make -c optional for build/rebuild (#1947 RC2) (#1964)
The HNSW index is a single global structure that indexes every
namespace's embeddings — `-c` was always informational. But the earlier
code REQUIRED `-c` for `build`/`rebuild` and the examples showed
`-c documents`/`-c patterns`/`-c default`, so users who stored entries
under a non-default namespace (e.g. `project`, `claude-memories`) hit
"Collection is required" on plain `-a build`, then re-ran with `-c default`
and got `Vector Count: 0` because that namespace was empty.

Drop the required check. When `-c` is omitted, label the result `(all
namespaces)`, run the same global rebuild, and print a helpful follow-up
if the resulting vector count is 0. Update help text + examples so the
intent is clear ("Omit to build for all namespaces"). No runtime
behavior change for callers passing `-c` — still indexes globally, just
labels the box with whatever they passed.

Build verified clean (tsc).

Resolves #1947 RC #2.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 10:42:30 -04:00
ReuvenandRuFlo 6f7d04d224 chore(release): 3.7.0-alpha.31 — ships #1941 + #1940 bridge fixes
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.31.

Fixes:
- #1941 — memory_search returned 0 for non-default namespaces (e.g.
  claude-memories) because vector_indexes only held rows for `default`
  and `patterns`. Every store path now INSERT-OR-IGNOREs a per-namespace
  vector_indexes row before the entry write. Merged via #1963.
- #1940 — memory_bridge_status reported totalEntries: 0 on DBs with
  hundreds of rows because it used listEntries({}).entries.length
  (capped at the 20-row page size). Now uses .total + reports a
  per-namespace breakdown. Merged via #1963.

Published to npm with all dist-tags updated:
- @claude-flow/cli  3.7.0-alpha.31  (alpha, latest, v3alpha)
- claude-flow       3.7.0-alpha.31  (alpha, latest, v3alpha)
- ruflo             3.7.0-alpha.31  (alpha, latest)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-13 10:19:29 -04:00
rUvandReuven 2c904df868 fix(memory): provision vector_indexes per namespace + truthful bridge_status (#1941, #1940) (#1963)
Two related memory-bridge bugs:

**#1941** — \`memory_search({namespace:"claude-memories"})\` always returned
0 results even when \`memory_import_claude\` had inserted hundreds of rows
into that namespace. The schema's \`vector_indexes\` table held only
\`default\` and \`patterns\` rows; AgentDB's HNSW/router keys namespace
lookups by this table, so any namespace without a row was effectively
unindexed for search.

Fix: every store path (both the AgentDB-bridge \`bridgeStoreEntry\` and the
raw-sql.js fallback \`storeEntry\`) now does \`INSERT OR IGNORE INTO
vector_indexes (id, name, dimensions) VALUES (?, ?, ?)\` for the entry's
namespace before the row insert. Idempotent; legacy DBs without the
table fall through cleanly. Dimensions defaults to the embedding's
actual dim (384 for the default model), preserving #1947's contract.

**#1940** — \`memory_bridge_status\` reported \`totalEntries: 0\` and
\`status: not-synced\` on DBs with hundreds of rows. Root cause: it used
\`listEntries({}).entries.length\`, but \`listEntries\` returns at most 20
entries with the full row count in a separate \`.total\` field — so the
status reporter was capped at the page size, not the table count.

Fix: use \`listEntries({}).total\` for the count. Plus surface a
per-namespace breakdown (\`agentdb.namespaces\`) for the common namespaces
(\`default\`, \`patterns\`, \`claude-memories\`, \`auto-memory\`, \`tasks\`,
\`feedback\`, \`pretrain\`) so callers can see where the rows actually live.
\`bridge.status\` now flips to \`connected\` on ANY persisted row, not only
\`claude-memories\` (the bridge is in use from many import paths).

Build verified clean (tsc).

Resolves #1941, #1940.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 10:18:29 -04:00
ReuvenandRuFlo 3b14b7aa97 chore(release): 3.7.0-alpha.30 — ships #1953 + #1939 fixes
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.30.

Fixes:
- #1953 — hooks_pretrain extracted 0 patterns on markdown-heavy repos
  because the 50-file budget for import-pattern extraction counted EVERY
  file (.md/.yaml/.db/.log), not just code files. Fix uses a separate
  `codeFilesScanned` counter, sorts readdir so code-likely dirs recurse
  first, widens the per-file scan window 30→80 lines, and recognises
  more code extensions (.tsx/.jsx/.mjs/.cjs). Merged via #1961.
- #1939 — memory_import_claude({allProjects:false}) returned 0 on Win32
  installs because resolveProjectMemoryDir's slug candidates only handled
  forward slashes. Added a Win32 candidate that normalises drive-colon,
  backslash, and whitespace to `-` (`C:\Users\…\Claude Stuff` →
  `C--Users-…-Claude-Stuff`). Merged via #1962.

Published to npm with all dist-tags updated:
- @claude-flow/cli  3.7.0-alpha.30  (alpha, latest, v3alpha)
- claude-flow       3.7.0-alpha.30  (alpha, latest, v3alpha)
- ruflo             3.7.0-alpha.30  (alpha, latest)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-13 09:38:06 -04:00
rUvandReuven 4e6822fa8d fix(memory-import): resolve Win32 cwd to Claude Code's slug (#1939) (#1962)
`memory_import_claude({ allProjects: false })` couldn't find the current
project's memory directory on a pure Win32+Win32 install, because the
slug candidates in `resolveProjectMemoryDir()` only replaced forward
slashes — never the drive-colon, backslash, or whitespace that a Win32
cwd contains.

Example:
- cwd: `C:\Users\tobia\OneDrive\Desktop\Claude Stuff`
- Claude Code's on-disk slug: `C--Users-tobia-OneDrive-Desktop-Claude-Stuff`
- Before this fix: no candidate matched, importer reported `imported: 0,
  "No Claude memory files found"`.

Add a Win32-specific candidate gated on `/^[A-Za-z]:[\\/]/` that does the
full normalization (`:` / `\` / `/` / whitespace → `-`). The other four
candidates (legacy POSIX, WSL `/mnt/<drive>/`, leading-dash strip, space
rule) are unchanged, so no regression for the other setup classes.

Verified the new candidate emits
`C--Users-tobia-OneDrive-Desktop-Claude-Stuff` for the reporter's path.

Build verified clean (tsc).

Resolves #1939.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 09:36:53 -04:00
rUvandReuven 1d414b194d fix(hooks-pretrain): code-file budget + code-dir-first traversal (#1953) (#1961)
`hooks_pretrain` reported `patternsExtracted: 0` on any monorepo whose
depth-first traversal hit 50 non-code files (.md / .yaml / .db / .log /
…) before reaching a single .ts/.js/.py/etc. The 50-file budget that
gates the import-pattern scan was checked against `filesAnalyzed`, which
counts EVERY directory entry — so in markdown-heavy repos (docs/, specs/,
_bmad-output/, …) the budget burned out on Markdown long before the
walker recursed into apps/, packages/, or src/.

Two-part fix:

1. Use a separate `codeFilesScanned` counter for the budget, incremented
   only inside the `if (codeExts.includes(ext))` block. The 50-file cap
   now means "50 code files", which is what the comment always claimed.

2. Sort `readdirSync` entries so the walker recurses into code-likely
   dirs first (`src/`, `apps/`, `packages/`, `lib/`, `crates/`, `workers/`,
   `server/`, `backend/`, `frontend/`, `app/`, `cli/`, `core/`) and
   deprioritises docs/specs/build/coverage/test dirs. Files are mixed in
   between. Stable sort so test behaviour is deterministic.

Plus two collateral improvements:

- Widen the per-file scan window from 30 → 80 lines. Modern TS files
  often have license headers + JSDoc + type-only imports before the
  first `import` — the 30-line cap was missing real imports.

- Recognise more code extensions: `.tsx`, `.jsx`, `.mjs`, `.cjs`. The
  `SUPPORTED_EXTRACTION_EXTS` list used by the "found N code files but 0
  patterns" note got the same expansion so the diagnostic stays accurate.

Build verified clean (tsc).

Resolves #1953.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 09:28:50 -04:00
ReuvenandRuFlo 3c4638bb91 chore(release): 3.7.0-alpha.29 — ships #1945 + #1946 + #1951 critical fixes
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.29.

Critical fixes in this release:

- #1945 — CLI `memory store` reported success but didn't persist when the
  user had a non-default memory path (e.g. `data/memory/memory.db` via
  `CLAUDE_FLOW_MEMORY_PATH`). Root cause: `memory-bridge.ts::getDbPath()`
  hard-coded `<cwd>/.swarm/memory.db` and ignored the env var / config,
  while `memory init` honored both — so the bridge wrote to one file and
  the user's next CLI invocation read from another. Merged via #1959.

- #1946 — `ruflo doctor` reported "Memory Database: Not initialized" on
  perfectly-init'd DBs because `doctor.ts::checkMemoryDatabase()` only
  probed three legacy paths and ignored `CLAUDE_FLOW_MEMORY_PATH` /
  config entirely (also missed `data/memory/memory.db`, a common layout).
  Merged via #1959.

- #1951 — statusline showed hard-coded "RuFlo V3.5" regardless of the
  installed version. Three files had the bug: two tracked `statusline.cjs`
  copies, plus the TypeScript template that writes the project-local
  statusline at init time. All now probe a fuller candidate list, preferring
  `~/.claude/plugins/marketplaces/ruflo/package.json` (the plugin install,
  which was never checked before). Merged via #1960.

Published to npm with all dist-tags updated:
- @claude-flow/cli  3.7.0-alpha.29  (alpha, latest, v3alpha)
- claude-flow       3.7.0-alpha.29  (alpha, latest, v3alpha)
- ruflo             3.7.0-alpha.29  (alpha, latest)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-13 09:25:12 -04:00
rUvandReuven 7ca28a7593 fix(statusline): read installed version from plugin package.json (#1951) (#1960)
The statusline showed a hard-coded "RuFlo V3.5" regardless of the
installed version, even on alpha.27 where `ruflo doctor` correctly
reported the real version.

Two files had the bug:

1. `v3/@claude-flow/cli/.claude/helpers/statusline.cjs` — fully hard-coded
   `▊ RuFlo V3.5 ` in both header constructions, with no version-reading
   logic at all. Added a startup version-probe (4 candidate package.jsons,
   preferring the plugin install at `~/.claude/plugins/marketplaces/ruflo/`)
   and wired `${RUFLO_VERSION}` into both headers.

2. `.claude/helpers/statusline.cjs` — already had version-reading, but its
   candidate list only checked project-local `node_modules` paths, never
   the plugin install location. Plugin users always fell back to `'3.5'`.
   Added the plugin path as the first candidate.

3. `v3/@claude-flow/cli/src/init/statusline-generator.ts` — the template
   that writes `<project>/.claude/helpers/statusline.cjs` at init time had
   the same too-narrow candidate list. Same fix, applied to the template.

Probe order for all three:
  1. ~/.claude/plugins/marketplaces/ruflo/package.json   (plugin install)
  2. <cwd>/node_modules/@claude-flow/cli/package.json    (npm install)
  3. <cwd>/node_modules/ruflo/package.json               (umbrella)
  4. <cwd>/v3/@claude-flow/cli/package.json              (source checkout)

Falls through to a hard-coded default if all four are missing or malformed.

Build verified clean (tsc) on @claude-flow/cli.

Resolves #1951.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 09:24:07 -04:00
rUvandReuven 434a8f95bb fix(memory): bridge + doctor honor CLAUDE_FLOW_MEMORY_PATH / config (#1945, #1946) (#1959)
Two CLI memory bugs caused by hard-coded `.swarm/memory.db` paths that
ignored the configured memory location:

**#1945** — `memory-bridge.ts::getDbPath()` always defaulted to
`<cwd>/.swarm/memory.db` regardless of `CLAUDE_FLOW_MEMORY_PATH` or
`claude-flow.config.json#memory.persistPath`. So a user with a non-default
memory layout (e.g. `data/memory/memory.db`) had `memory init` write the
schema to the configured file, while `bridgeStoreEntry()` silently wrote
INSERTs to `.swarm/memory.db` — a different file, sometimes a different
directory. CLI `memory store` reported success against the wrong DB, and
a fresh process reading the configured path saw zero rows ("store works
but next process finds nothing").

Fix: route `getDbPath()` through `getMemoryRoot()` (from
memory-initializer), the same function `memory init` uses. The two now
agree on the same file. `:memory:` and explicit `customPath` still work
unchanged; path-traversal protection unchanged.

**#1946** — `doctor.ts::checkMemoryDatabase()` only checked the legacy
paths `.claude-flow/memory.db` / `.swarm/memory.db` / `data/memory.db` and
ignored `CLAUDE_FLOW_MEMORY_PATH` / config entirely. So `ruflo doctor`
reported `⚠ Memory Database: Not initialized` on a perfectly-initialized
DB at `data/memory/memory.db`.

Fix: check `getMemoryRoot() + '/memory.db'` first (the authoritative
path); fall back to the legacy candidates for non-standard layouts; add
`data/memory/memory.db` to the fallback list (a common config that was
missing entirely).

Build verified clean (tsc) on `@claude-flow/cli`.

Resolves #1945, #1946.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-13 09:19:32 -04:00
ReuvenandRuFlo 4d6e47d8ad chore(release): 3.7.0-alpha.28 — ships #1947 + #1944 + #1943 critical fixes
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.7.0-alpha.28.

Critical fixes in this release:

- #1947 / #1942 / #1952 — vector_indexes schema dim 768→384 (the default
  `Xenova/all-MiniLM-L6-v2` model produces 384-dim vectors; the old 768
  literal silently broke every `memory_store --vector` insert, so
  `memory_search` always returned 0 on a fresh install). Merged via #1956.

- #1944 — `helpers/hook-handler.cjs` fell back to the `toolInput` *object*
  instead of `toolInput.command` (string), tripping `.toLowerCase()` on
  every Bash tool call from Claude Code. Merged via #1957.

- #1943 — `settings-generator.ts` anchored hook command paths at
  `${CLAUDE_PROJECT_DIR}` only, breaking global-install layouts where
  helpers live at `$HOME/.claude/helpers/` (every Bash/Edit/Session hook
  fired MODULE_NOT_FOUND). Fix: POSIX `sh` probe tries project-local first,
  falls back to `$HOME`. Windows: `cmd /c IF EXIST … ELSE …`. Merged via #1957.

CI guards added with each fix:
- scripts/audit-vector-dim.mjs — catches any `vector_indexes` row whose
  dim isn't 384 (wired into the existing `witness-verify` gate).
- scripts/audit-hook-handler-prompt.mjs — catches the `|| toolInput`
  (object) regression (wired into `hook-command-audit`).

Published to npm with all dist-tags updated:
- @claude-flow/cli  3.7.0-alpha.28  (alpha, latest, v3alpha)
- claude-flow       3.7.0-alpha.28  (alpha, latest, v3alpha)
- ruflo             3.7.0-alpha.28  (alpha, latest)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-13 09:05:22 -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 545426f605 docs(adr-117): neural-trader heavy jobs on the Managed Agent cloud runtime (#1935)
ADR-117 (Accepted): dispatch heavy neural-trader jobs — multi-year
walk-forward backtests, big Monte-Carlo, parameter sweeps, LSTM/
Transformer/N-BEATS training — to an Anthropic Managed Agent cloud
container via the managed_agent_* tools (ADR-115, shipped in
3.7.0-alpha.27). No new MCP tools, no new deps — pure orchestration.

- skills/trader-cloud-backtest/SKILL.md — the recipe (provision-once,
  pre-flight-cheap, run, ingest-locally, terminate-eagerly); allowed-tools
  scoped to managed_agent_* + memory_* + agentdb_pattern-store + Bash/Read
  (no wildcard grant).
- commands/trader.md — /trader cloud <backtest|train|sweep> subcommand.
- scripts/smoke.sh — step 2 now asserts the 7th skill exists, references
  managed_agent_create, and names the local trader-backtest fallback;
  step 10 ADR-status check corrected to Accepted.
- README.md — overview + skills table + Architecture-Decisions +
  Related-Plugins cross-refs to ADR-117 / ADR-115 / ruflo-agent.
- ADR-115 Links — cross-refs ADR-117 as the first consumer.

Cost-optimization rules baked into the recipe (the "optimize" requirement):
install-once in initScript, reuse the environment, pre-flight cheap
(1-path/3-month smoke before a 1000-path/multi-year run), batch sweeps into
one prompt, terminate eagerly + GC orphans (#1931), cheap agent model
(Haiku/Sonnet — the compute is the Rust engine, not the LM; ADR-026),
estimate before kicking off.

Validation: ruflo-neural-trader smoke 11/0, ruflo-agent smoke 12/0,
audit-cli-mcp-tools / audit-tool-descriptions / audit-plugin-packages /
audit-hook-commands all green. No new MCP tools → cli build unaffected.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 12:31:42 -04:00
rUvandReuven cffa557449 chore(release): 3.7.0-alpha.27 — ships managed_agent_* (ADR-115) + ruflo-wasm→ruflo-agent (#1934)
Bumps @claude-flow/cli, claude-flow, ruflo to 3.7.0-alpha.27. Published to npm
(alpha/latest/v3alpha updated for all three) so `npx ruflo@latest mcp start`
exposes the 6 managed_agent_* tools — without this they were on main but not
in any published package, so the /ruflo-agent:managed-agent skill couldn't
find them. Validated: `npx ruflo@3.7.0-alpha.27 mcp tools` lists all 6
managed_agent_* (Enabled); `managed_agent_list` with no key returns the
graceful "use wasm_agent_create" error. Witness manifest regenerated (all
3 per-OS manifests synced, pass=113/0).

What ships since alpha.26: #1928 (ruflo-cost-tracker Windows path), #1929
(ruflo-wasm→ruflo-agent rename + managed_agent_* cloud runtime + ADR-115),
#1932 (README plugin links), #1933 (ruflo-agent README).

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 10:44:30 -04:00
rUvandReuven 3975ab512c docs(ruflo-agent): bring README up to date for the managed (cloud) runtime (#1933)
The README still described only the WASM runtime (it was the old ruflo-wasm
README with a name-swap). Rewrote it around the two runtimes — WASM (rvagent,
sandboxed-local, the safe default) + Managed (Anthropic Claude Managed Agents,
cloud) — plus the planned SDK runtime (ADR-116). Now documents:
- the runtime decision table (when to use which) + the trust/sandbox model
- all 16 MCP tools (10 wasm_* + 6 managed_agent_*) with the managed↔wasm
  counterpart mapping
- the ANTHROPIC_API_KEY prereq + the graceful "use wasm_agent_create" fallback
- the managed-agent skill + /managed-agent command
- the beta caveats (managed-agents-2026-04-01; multiagent/define-outcomes are
  research preview; mcpServers needs a reachable URL; cost = tokens + container time)
- ADR-115 cross-ref; smoke is "12 passed, 0 failed" (was 11); the CI workflow
  + the no-network managed-agent test as the contract
- ruflo-cost-tracker as a related plugin (record managed sessions)

smoke.sh 12/0.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 10:35:28 -04:00
rUvandReuven db5321671d docs(readme): link each plugin in the "🔌 All 32 plugins" section to its README (#1932)
Every plugin title in the collapsed plugins table is now a link to
plugins/<name>/README.md. Verified all 32 targets exist. Also refreshed the
ruflo-agent row (renamed from ruflo-wasm, now spans both runtimes): "Run
agents — local WASM sandbox (rvagent) + Anthropic Claude Managed Agents (cloud)".

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 10:30:13 -04:00
rUvandReuven ef73a1616f feat(ruflo-agent): rename ruflo-wasm → ruflo-agent + Claude Managed Agents (cloud) runtime — ADR-115 (proposed→accepted, implemented) (#1929)
* docs(adr): ADR-115 — Claude Managed Agents as a cloud backend for rvagent (explored + validated)

Records the proposal to add `runtime: "managed"` to ruflo's rvagent
interface (ruflo-wasm / @ruvector/rvagent-wasm / wasm_agent_* MCP tools),
backed by Anthropic's Claude Managed Agents API (beta), as a second backend
alongside the local WASM sandbox — mirroring the ConsensusTransport
LocalTransport|FederationTransport pattern (ADR-095 G2 / ADR-104). The
agent/environment/session/events model maps ~1:1 to wasm_agent_create/
prompt/files/terminate + the gallery.

Validated live against api.anthropic.com/v1 with the org's Anthropic key
(GCP claude-flow/anthropic-api-key): created an agent + environment + session,
sent a bash task, observed the full event log (status_running → user.message
→ tool_use(bash) → tool_result → agent.message("Done.") → status_idle,
stop_reason end_turn), cleaned up. ~7s for a trivial Haiku task.

High-value combos noted: ruflo's own MCP server as a Managed Agent tool
source (cloud-hosted ruflo, zero local infra); Managed Agent session as a
third task_assign executor (closes #1916 items 3/4); long-running/async work;
skills + define-outcomes parity. Constraints: opt-in/off-by-default, needs
ANTHROPIC_API_KEY + beta access, plugin-level @anthropic-ai/sdk dep,
cost-tracking + orphaned-session GC, beta churn, branding.

Status: proposed. Registered in AgentDB (adr-ADR-115) + adr-patterns.

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

* refactor(plugins): rename ruflo-wasm → ruflo-agent (agent-runtimes home; ADR-115 prep)

`ruflo-wasm` only covered local WASM-sandboxed agents (rvagent —
@ruvector/rvagent-wasm, the wasm_agent_*/wasm_gallery_* MCP tools). It's
becoming the home for *all* ruflo agent runtimes: the existing local-WASM
backend plus Anthropic's Claude Managed Agents as a cloud backend (ADR-115),
behind one interface — same local-vs-cloud pattern as ConsensusTransport.

- git mv plugins/ruflo-wasm → plugins/ruflo-agent
- plugin.json: name ruflo-wasm → ruflo-agent; description/keywords now span
  both runtimes (rvagent/wasm + managed-agents/anthropic/cloud)
- .claude-plugin/marketplace.json entry renamed
- README / plugins/README / docs/index / cli README / ruflo README /
  discover-plugins SKILL / verification/inventory.json / ADR-115 — refs updated
- wasm_agent_* / wasm_gallery_* MCP tool names are unchanged (they stay; the
  plugin is just renamed). managed_agent_* tools land next per ADR-115.

(Left `ruflo-wasm-mcp` in ruvocal/workerClient.ts alone — unrelated worker MCP name.)

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

* feat(cli): managed_agent_* MCP tools — Claude Managed Agents cloud runtime (ADR-115)

Six new MCP tools wrapping Anthropic's Claude Managed Agents REST API (beta,
`anthropic-beta: managed-agents-2026-04-01`) via plain fetch — no new SDK dep:

  managed_agent_create    agents.create + environments.create + sessions.create   ↔ wasm_agent_create (CLOUD counterpart)
  managed_agent_prompt    events.send(user.message) + poll events until idle       ↔ wasm_agent_prompt
  managed_agent_status    GET /v1/sessions/{id}
  managed_agent_events    GET /v1/sessions/{id}/events  (full transcript)           ↔ wasm_agent_files
  managed_agent_list      GET /v1/sessions
  managed_agent_terminate DELETE /v1/sessions/{id} (+ optionally the env)           ↔ wasm_agent_terminate

Needs ANTHROPIC_API_KEY (or CLAUDE_API_KEY); every tool degrades gracefully
with a structured "use wasm_agent_* for a local no-key runtime" error when the
key is absent — the CLI/MCP server stays up. ADR-112-compliant descriptions
(each says when wasm_agent_* / native is the right call instead). Registered
in mcp-client.ts. Lives conceptually in the `ruflo-agent` plugin (the
`ruflo-wasm`→`ruflo-agent` rename in the prior commit).

Validated live against api.anthropic.com with the org's Anthropic key (GCP
claude-flow/anthropic-api-key) via `ruflo mcp exec -t managed_agent_*`:
create (haiku) → prompt ("echo … > /tmp/r.txt && cat") → got finished:true,
status:idle, stopReason:end_turn, assistantText:"Done.", toolUses:[bash],
13 events → terminate (sessionDeleted+environmentDeleted). No-key path returns
the graceful error. audit-cli-mcp-tools 311 registered/0 dangling;
audit-tool-descriptions 0 no-guidance; cli build clean.

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

* feat(ruflo-agent): wire the managed-agent (cloud) runtime into the plugin + CI smoke

- skills/managed-agent/SKILL.md — drives the cloud runtime: managed_agent_create
  / prompt / status / events / list / terminate, with the WASM-vs-managed
  decision table, the ANTHROPIC_API_KEY prereq + graceful fallback, the
  mcpServers-reachability caveat, and the cost/cleanup discipline (a cloud
  session bills until terminated). Explicit allowed-tools (no wildcard).
- commands/managed-agent.md — quick "list cloud sessions / status / transcript
  / clean up" command (the cloud sibling of /wasm).
- plugin.json — kept rvagent-wasm + ruvllm-wasm keywords (still built on those);
  added managed-agents/anthropic/cloud.
- smoke.sh: step 1 now also asserts name=ruflo-agent + the managed-agents
  keywords; step 10 expects ADR-0001 status `Accepted` (was stale `Proposed`,
  pre-existing red); new step 12 — managed-agent skill+command exist + all 6
  managed_agent_* tools referenced + the skill keeps an explicit allowed-tools
  list + offers the wasm_agent_create fallback. 12 passed / 0 failed.
- .github/workflows/ruflo-agent-smoke.yml — new CI job running smoke.sh on any
  plugins/ruflo-agent/** change (the plugin had no CI gate before).

Validated: `claude --plugin-dir plugins/ruflo-agent` loads the plugin and lists
its skills (managed-agent, wasm-agent, wasm-gallery); plugin.json + all skill
frontmatters parse; smoke.sh 12/0.

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

* docs(adr): ADR-115 → Accepted + Implementation section (managed_agent_* landed)

Status Proposed → Accepted. Added an Implementation (2026-05-12) section:
the ruflo-wasm→ruflo-agent rename, the 6 managed_agent_* MCP tools (plain
fetch, no new SDK dep, graceful no-key degradation, ADR-112 descriptions),
the managed-agent skill+command, the smoke.sh/ruflo-agent-smoke.yml CI guard,
the live e2e validation (create→prompt→terminate against api.anthropic.com
with the GCP anthropic-api-key) and `claude --plugin-dir` validation, and the
called-out follow-ups (runtime:"managed" unification, deployed HTTP ruflo MCP
server for the cloud-hosted-ruflo combo, task_assign/federation dispatch to a
Managed Agent session, cost-tracking + orphaned-session GC, multiagent/outcomes).
Tracking issue: #1931.

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

* test(cli): no-network guard for managed_agent_* tools (ADR-115)

__tests__/managed-agent-tools.test.ts (10 cases): the 6 managed_agent_*
tools are registered; each has an object inputSchema + a ≥80-char,
ADR-112-ish, unique description that names the wasm_agent_*/native fallback;
and — crucially — every handler degrades gracefully with no ANTHROPIC_API_KEY/
CLAUDE_API_KEY: no throw, structured error mentioning the key + the
wasm_agent_create fallback, no network call (so the CLI/MCP server stays up
offline). Plus managed_agent_prompt's missing-sessionId/message validation.

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

* docs(adr): ADR-115 — add the third runtime (Claude Agent SDK) to the picture

ADR-115 adds the *cloud* runtime (Managed Agents); add a section noting the
natural *third* runtime — the Claude Agent SDK (@anthropic-ai/claude-agent-sdk,
"Claude Code as a library": query()/ClaudeSDKClient, hooks, subagents, MCP,
permission modes, sessions, loads .claude/ config + plugins; runs in-process,
full host trust). ruflo-agent → three runtimes behind one model:

  WASM (rvagent)   local sandbox, no host fs/net   untrusted/portable/offline
  SDK  (future)    your process, your filesystem    a real Claude agent loop on the local repo — the in-process `claude -p`
  Managed          Anthropic cloud container        long-running/async, no local infra

The SDK runtime's killer combo: `mcpServers: { ruflo: { command: "npx", args: ["ruflo","mcp","start"] } }` — a *local* stdio MCP server, so the agent gets ruflo's 314 tools with zero deployment (vs Managed Agents needing a reachable URL). Anthropic positions SDK→Managed as prototype→production. Costs: heavy dep (bundles a Claude Code binary), full host trust (no sandbox — least isolated), needs an API key. Implementing it = a follow-up, likely ADR-116 (tracked in #1931).

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

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 10:24:03 -04:00
rUvandReuven 965ec669d9 fix(#1927): ruflo-cost-tracker encodeProjectPath handles Windows backslash + drive colon (#1928)
* fix(#1927): ruflo-cost-tracker encodeProjectPath handles Windows `\` + drive `:`

`track.mjs` couldn't find Claude Code session jsonls on Windows because
`encodeProjectPath()` only replaced `/` — a no-op on `D:\project\Foo`, so it
looked under a corrupt `~/.claude/projects/D:\project\Foo` instead of the real
`~/.claude/projects/D--project-Foo`. Now replaces `/`, `\`, and `:` with `-`
(matching Claude Code's encoding); POSIX paths are unchanged.

CI guard: smoke.sh step 29b runs `track.mjs` with `TRACK_CWD='D:\project\Subcloudy'`
and asserts the (expected-to-fail) "looked under" line shows `D--project-Subcloudy`
and not the corrupt un-encoded form. Negative-tested. Also fixed smoke.sh step 8
(ADR-0001 is `Accepted`, not `Proposed` — the check was stale; cost-tracker-smoke
was already red on main because of it). Witness marker #1927.

Not fixed here (secondary issue in the report): on long Windows sessions
`spawnSync('npx', ['claude-flow', 'memory', 'store', '--value', JSON.stringify(summary)])`
can exceed the CreateProcess argv limit when `summary` is large — a follow-up
(write to a temp file / stream via stdin).

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

* ci: green up witness-verify (sync linux/windows manifests) + cost-tracker-smoke (.ci-bench npm-init)

Two pre-existing CI reds, surfaced while making sure all builds pass:

- witness-verify on ubuntu/windows failed after #1923: it verifies the
  per-OS manifest (verification/{linux,windows}/manifest.md.json), but
  regen-witness.mjs only ever rewrites the *current* OS's manifest (macos
  on the maintainer's machine), so the linux/windows snapshots still had the
  pre-#1923 `#1862` marker — which #1923 changed when it moved the hook
  invocation behind ruflo-hook.sh. Synced linux + windows manifests to the
  current macos one (byte-identical at the same commit — the Ed25519 seed is
  derived from gitCommit only, not OS, and the dist .js are LF everywhere).
  All 3 verify clean (pass=113, 0 regressed).
- cost-tracker-smoke `Install agent-booster for the bench` step did
  `npm init -y` inside `.ci-bench/`, and npm 11 rejects a package name
  starting with `.`. Write the manifest explicitly instead.

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

* ci(v3): run v3-ci.yml on pull_request when verification/** changes (witness-verify on PRs)

Without this, a PR that bumps witness-fixes.json / regenerates a per-OS
manifest doesn't trigger witness-verify, so a stale per-OS manifest only
fails after merge to main (the push trigger does have verification/**).

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

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 08:41:58 -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 7c1938b00b docs(adr): ADR-114 — adopt DSPy.ts as a Ruflo plugin (#1920)
Records the decision to wrap ruvnet/dspy.ts (TS port of Stanford DSPy)
as an optional @claude-flow/plugin-dspy: ~7 MCP tools for declarative
prompt-program optimization (signatures → modules → optimizers →
compile()), a /dspy skill, an opt-in AgentPromptCompile hook. Shares
ruflo's AgentDB instance; bridges configureLM to @claude-flow/providers.

Key boundary recorded: DSPy = compile-time, task-scoped prompt+demo
optimization (output is a reusable artifact); ruflo intelligence =
run-time, cross-task ambient pattern learning. The plugin must not
re-implement the intelligence pipeline, must not be a hard dep of any
core package, and must pass scripts/audit-plugin-packages.mjs.

Status: proposed. Related: ADR-026, ADR-098, ADR-112, ADR-G008, ADR-G009.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 00:37:41 -04:00
rUvandReuven ad169de89b fix(#1914): daemon start only reaps daemons in the current workspace (#1917)
`killStaleDaemons` SIGTERM'd every process whose command line contained
`daemon start --foreground`, so starting the daemon in workspace B killed
workspace A's daemon — a violation of ADR-014's per-workspace daemon scope.

The forked daemon's argv is now stamped with `--workspace <root>` (kept
last), and `killStaleDaemons{Posix,Windows}` filter on it via
`daemonCommandLineBelongsToWorkspace` — an exact trailing match, never a
bare path-prefix match, so `/a/proj` can't reap `/a/proj-other`'s daemon.
Pre-#1914 daemons (no stamp) are left for `daemon stop` to handle via the
PID file. `resolveWorkspaceFlag` rejects shell metacharacters / null bytes
since the value lands in a forked child's argv.

CI guard: __tests__/daemon-workspace-scope.test.ts (12 cases — cross-
workspace isolation, prefix-sibling, legacy-no-stamp, Windows tasklist
row, space-containing paths) + witness marker for #1914.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 00:37:38 -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
ReuvenandRuFlo 3c447854d0 chore(release): 3.7.0-alpha.24 — ships #1906 agent_execute model-alias fix
All 3 packages on alpha+latest+v3alpha = 3.7.0-alpha.24:
  @claude-flow/cli@3.7.0-alpha.24
  claude-flow@3.7.0-alpha.24
  ruflo@3.7.0-alpha.24

Ships #1906 (merged #1908) — agent_execute model aliases now map to
current Claude 4.x ids (claude-haiku-4-5-20251001 / claude-sonnet-4-6 /
claude-opus-4-7) instead of the deprecated claude-3-*-latest that the
Anthropic API 404s. Two CI guards added (unit test + witness marker).

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-11 11:03:55 -04:00
rUvandReuven 16e59c2613 fix(#1906): agent_execute model aliases → current Claude 4.x ids (not deprecated claude-3.x) (#1908)
`MODEL_MAP` in agent-execute-core.ts mapped haiku/sonnet/opus/inherit to
`claude-3-5-haiku-latest` / `claude-3-5-sonnet-latest` / `claude-3-opus-latest`
— ids the Anthropic API now 404s. Every `agent_execute` call (and the WASM
agent's LLM fallback, which routes through `resolveAnthropicModel`) failed
with HTTP 404 even with a valid key.

Fixed mappings (Claude 4.x family):
  haiku   → claude-haiku-4-5-20251001
  sonnet  → claude-sonnet-4-6
  opus    → claude-opus-4-7
  inherit → claude-sonnet-4-6  (= new DEFAULT_ANTHROPIC_MODEL)

Also replaced the 4 other hardcoded `claude-3-5-sonnet-latest` defaults
(`callAnthropicMessages` fallback, `resolveAnthropicModel` no-input case,
`executeAgentTask` fallback, the doc-comment example) with
`DEFAULT_ANTHROPIC_MODEL`.

## CI coverage (the user's ask: "make sure the ci guard doesn't miss these")

Two layers:
1. Unit test `__tests__/agent-execute-models.test.ts` — picked up by the
   cli package's vitest run in CI. Asserts each alias resolves to the
   right Claude-4.x id, the prefix-strip works, the pass-through works,
   and — critically — `no alias resolves to a claude-3.x id` (the #1906
   regression-class assertion). 8/8 pass.
2. Witness marker `#1906` in the manifest — `claude-sonnet-4-6` must be
   present in `agent-execute-core.js` dist; `witness-verify` fails on
   regression. 104/104 fixes verified.

Closes #1906 · related to #1863 (agent_execute was the path #1863's
comment pointed users at — now it actually works)

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-11 11:02:35 -04:00
ReuvenandRuFlo a03f6f6ed9 docs(skill): verification-quality — document the actual CI guards + fix branding
The verification-quality SKILL.md was a generic truth-scoring/rollback doc
that predated every concrete CI guard added recently. Updated both copies
(.claude/skills/ + .agents/skills/):

- New "CI Guards — what's actually shipped (current state)" section right
  up front: the real three-layer regression stack (install/behavioral
  smoke + cryptographic witness + temporal history), the 6 CI jobs in
  v3-ci.yml by name (smoke-install-no-bsqlite, plugin-hooks-smoke,
  mcp-protocol-smoke, memory-import-smoke, mcp-roundtrip-smoke,
  tool-descriptions-audit), the ADR refs (ADR-102/103/112), the
  audit/smoke scripts with copy-paste local-run commands, and a
  "how to add a new guard" recipe.
- A "shipped vs. aspirational" note so readers know the truth-scoring /
  auto-rollback / WebSocket-dashboard sections later in the doc are
  partly design, not all live.
- `claude-flow@alpha` → `ruflo@alpha` throughout (same branding fix family
  as #1899 / #1858 / #1861).
- Added `@noble/ed25519` to prerequisites (the witness verifier's one
  runtime dep).
- `.agents/skills/` copy keeps its richer frontmatter (version/category/
  tags); only the body was updated to match.

No code change — documentation only. The skill is distributed via the
marketplace (git clone of this repo), so this push is the publish.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-11 10:15:12 -04:00
ReuvenandRuFlo e2bc6d9ce5 chore(release): @claude-flow/swarm 3.0.0-alpha.7 — ADR-095 G2 consensus transport
Published with alpha + latest + v3alpha all pointing to 3.0.0-alpha.7.
Ships the merged #1905 work:
  - ConsensusTransport interface + LocalTransport + FederationTransport
  - raft/byzantine/gossip wired to accept an injected transport
  - real Ed25519 message signing/verify (Node core crypto, no new deps)
  - BFT f derived from cluster size (floor((n-1)/3), capped by config)
  - Raft receiver rules (term comparison, vote-once, log-up-to-date)
  - failure-injection tests (f<n/3 BFT, f<n/2 Raft)
  - 218/218 swarm suite

Backward compatible — new exports + optional config fields only; the
legacy no-transport single-process path is unchanged.

Tracks #1872

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-11 09:53:58 -04:00
rUvandReuven 22ca3b018b feat(swarm): ADR-095 G2 — pluggable ConsensusTransport + Ed25519 message signing (step 1) (#1905)
* feat(swarm): ADR-095 G2 step 1 — pluggable ConsensusTransport + Ed25519 message signing

First concrete piece of ADR-095 G2 (hive-mind multi-process). The
consensus protocols (raft/byzantine/gossip in @claude-flow/swarm) used a
local EventEmitter for *everything* — both observability events
("leader.elected", "consensus.achieved") AND inter-node messages
(append-entries, vote requests, pre-prepare/prepare/commit). The latter
never crossed a process boundary: a node "sent" a message by emitting it
locally and synthesizing the peer's reply inline. That's the single-
process limitation #G2 names.

## What lands

`v3/@claude-flow/swarm/src/consensus/transport.ts`:
- `ConsensusTransport` interface — `send` (request-response), `broadcast`,
  `onMessage`, `peers`, `close`. Separates the inter-node-message
  dimension from the observability-event dimension (events stay on each
  protocol's own EventEmitter).
- `LocalTransport` + `LocalTransportRegistry` — in-process registry,
  the default. Matches current single-process behavior so nothing breaks.
  Supports optional Ed25519 signing + per-sender monotonic-seq replay
  defense when keypairs are configured.
- Real Ed25519 helpers via Node's built-in `crypto` (no new deps):
  `generateNodeKeyPair`, `signMessage`, `verifyMessage`,
  `canonicalizeForSigning` (deep-sorted-key JSON — deterministic across
  hosts), `messageDigest`.
- Exported from `consensus/index.ts`.

## CI guard (the user's ask: "include ci guards for new capabilities")

`plugins/ruflo-core/scripts/test-consensus-transport.mjs`, wired as a step
in the `mcp-roundtrip-smoke` job:
- Static: required exports present in swarm dist; **no `return true`
  signature-stub regression** (the original #G2 bug — `verifySignature()`
  returned true unconditionally).
- Behavioral: `LocalTransport` round-trip (send → peer handler → reply);
  Ed25519 verify is real (true for right key; false for wrong key /
  tampered payload / missing sig). 30s watchdog so CI never hangs.

## Tests

14 new tests in `__tests__/consensus-transport.test.ts` (sign/verify
round-trip, tampered-payload rejection, wrong-key rejection, fail-closed
on missing sig, canonicalization stability, LocalTransport send/broadcast/
peers/timeout/closed-peer, signed-transport round-trip, unsigned-rejected,
seq monotonicity). 186/186 swarm suite passes. Build clean.

## Remaining for G2 (subsequent commits)

- FederationTransport adapter (ADR-104 WS wire)
- Wire raft/byzantine/gossip to accept an injected ConsensusTransport
- Replace byzantine-coordinator verifySignature()→true with real verifyMessage
- Per-strategy correctness: BFT f<n/3 vote counting; Raft term/log replication
- Failure-injection tests

ADR-095 G2 status section updated.

Tracks #1872

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

* feat(swarm): ADR-095 G2 step 2 — wire ByzantineConsensus to ConsensusTransport + sha256 digests

Second piece of ADR-095 G2. ByzantineConsensus now accepts an optional
`transport: ConsensusTransport` in its config:

- When set, PBFT messages (pre-prepare / prepare / commit) actually go
  over the transport (signed if the transport has a keypair) instead of
  being `emit`ted into the void. Inbound transport messages are routed
  back into `handlePrePrepare` / `handlePrepare` / `handleCommit`.
- When unset, behavior is unchanged: messages emit as `message.broadcast`
  / `message.sent` events for an external relay layer (the legacy
  single-process path). The `emit`s also stay when a transport IS wired,
  so observers don't break.
- Transport broadcast failures are non-fatal at the protocol layer — the
  proposal simply times out, which is the correct failure mode (lose
  liveness, never commit incorrectly).

Also: `computeDigest` was a 32-bit string-hash "for demonstration" —
replaced with sha256. PBFT relies on the digest uniquely identifying the
request being agreed on; a 32-bit hash has trivial collisions. Removed
the toy hash entirely (no test depended on it).

Tests: 3 new in `__tests__/byzantine-transport.test.ts` — emit-only when
no transport (legacy unchanged); broadcasts go over transport AND emit
when wired (and digests are 64-hex sha256); inbound transport messages
route into the PBFT handlers (a pre-prepare in → a prepare out over the
transport). 189/189 swarm suite passes. consensus-transport CI guard
green. Build clean.

Remaining for G2: same wiring for raft.ts + gossip.ts; FederationTransport
adapter; per-strategy correctness (BFT f<n/3 vote counting — the current
`2f+1` thresholds are right but a single node fabricates the quorum
locally; Raft term/log replication); failure-injection tests.

Tracks #1872 · branch feat/adr-095-g2-hive-mind-ws-transport

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

* feat(swarm): ADR-095 G2 step 3 — wire RaftConsensus to ConsensusTransport with real receiver rules

Third piece of ADR-095 G2. RaftConsensus now accepts an optional
`transport: ConsensusTransport`:

- Sender side: `requestVote(peerId)` / `appendEntries(peerId, entries)`
  go over the transport as real request-response RPCs (RequestVote /
  AppendEntries) instead of mutating the local fake-peer map. On a
  higher-term reply, the node steps down (§5.1).
- Receiver side (`handleInboundRaftMessage`): proper Raft rules —
    • RequestVote: grant iff `term >= currentTerm` AND (haven't voted this
      term OR voted for this candidate) AND candidate's log is at least as
      up-to-date (lastLogTerm/lastLogIndex comparison). Adopts a higher
      term, resets the election timer on grant.
    • AppendEntries: reject if `term < currentTerm`; else become follower,
      reset the election timer, append entries by index, advance
      `commitIndex` to `min(leaderCommit, lastLogIndex)`.
- Legacy no-transport path unchanged (single-process in-memory peer map).

This is the "Raft term/log replication correctness" piece from the ADR.
(Full prevLogIndex/prevLogTerm conflict resolution is the next refinement;
the current append-by-index is correct for the heartbeat + sequential-
append cases the consensus engine actually exercises.)

Tests: 5 new in `__tests__/raft-transport.test.ts` — vote granted for an
up-to-date candidate; second different candidate denied (vote-once-per-
term); stale-term candidate denied; behind-log candidate denied; valid
AppendEntries accepted + commitIndex updated; stale-term AppendEntries
rejected with the follower's term reported. 194/194 swarm suite passes.
Build clean. consensus-transport CI guard green.

Remaining for G2: same wiring for gossip.ts; FederationTransport adapter
(ADR-104 WS wire); BFT f<n/3 vote-counting correctness; failure-injection
tests; cross-host validation; build/publish.

Tracks #1872 · branch feat/adr-095-g2-hive-mind-ws-transport

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

* feat(swarm): ADR-095 G2 step 4 — FederationTransport (ConsensusTransport over the ADR-104 WS wire)

Fourth piece of ADR-095 G2 — the multi-host transport option.

`v3/@claude-flow/swarm/src/consensus/federation-transport.ts`:
- `FederationTransport implements ConsensusTransport` — backed by the
  federation plugin's ADR-104 WS wire (agentic-flow/transport/loader).
- Structural dependency, not a package dep: takes an
  `AgenticFlowTransportLike` instance by injection (the `loadQuicTransport`
  result satisfies it) plus consensus-level metadata (this node's id, how
  to address peers, who the peers are). @claude-flow/swarm stays zero-dep;
  the wiring layer (hive-mind + federation) supplies the transport.
- Layers request-response on top of fire-and-forget WS delivery via
  per-message correlation ids + a pending-replies map + per-call timeout.
  Uses ADR-104 stream-mux (`streamId='ruflo-consensus'`) so consensus
  traffic doesn't interleave with application traffic.
- Optional Ed25519 signing — outbound signed, inbound verified against the
  sender's published pubkey (resolvePeerPublicKey), per-sender monotonic-
  seq replay defense. Fail-closed: unverifiable inbound is dropped.
- Exported from `consensus/index.ts` (+ `AgenticFlowTransportLike` /
  `FederationTransportOptions` types).

Tests: 7 new in `__tests__/federation-transport.test.ts` using a mock
in-memory mesh — send→handler→reply correlation; broadcast to all peers;
no-address rejection; send timeout; peers() excludes self; signed
round-trip (seq increments, signature present); unsigned inbound dropped
at a signing-enabled node (sender's send times out, handler never runs).
201/201 swarm suite passes. Build clean. consensus-transport CI guard
extended to assert FederationTransport is exported — green.

Remaining for G2: wire gossip.ts to the transport; BFT f<n/3 vote-
counting correctness (real vote aggregation across distinct senders, not
a locally-fabricated quorum); failure-injection tests; cross-host
validation (mac↔ruvultra over tailscale, root); build/publish; then merge.

Tracks #1872 · branch feat/adr-095-g2-hive-mind-ws-transport

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

* feat(swarm): ADR-095 G2 step 5 — wire GossipConsensus to transport + BFT f-from-cluster-size

Fifth piece of ADR-095 G2 — completes the protocol-wiring trio and adds
the BFT fault-tolerance correctness fix.

## GossipConsensus transport wiring
- `GossipConfig.transport?` — when set, `sendToNeighbor` actually sends
  the gossip message over the transport (signed if signing is on) instead
  of mutating the local fake-neighbor map. Inbound gossip routes into the
  merge logic via `handleInboundGossipMessage`, deduped by message id.
- Legacy no-transport path preserved.

## BFT fault tolerance correctness
- `f` (`maxFaultyNodes`) was hardcoded to 1 in the config default, so a
  7- or 10-node cluster ran with the same `2f+1=3` quorum as a 4-node one
  — wrong. Now `byzantineF()` derives `f = floor((n-1)/3)` from the actual
  cluster size (n = self + known peers), clamped to ≥1. `config.maxFaultyNodes`,
  when set, acts as an *upper cap* (never exceed what the operator declared
  the cluster can tolerate). The three `2f+1` quorum checks (vote /
  handlePrepare / handleCommit) now use the cluster-derived `f`.
- Dropped the `?? 1` config default so an operator who doesn't pass
  `maxFaultyNodes` gets the cluster-derived behavior, not a silent cap of 1.

## Tests
- 3 new gossip-transport tests (messages go over transport with hops/path
  incremented; inbound deduped by id; non-gossip ignored).
- 5 new byzantine-f tests (f scales 4→1, 7→2, 10→3; explicit cap honored;
  no-cap follows cluster size; 3-node clamps to 1).
- 210/210 swarm suite passes. Build clean. consensus-transport CI guard green.

ADR-095 G2 status section updated — all three protocols now wired,
FederationTransport landed, Ed25519 sig verify real, BFT correctness done,
Raft receiver rules done. Remaining: failure-injection tests, cross-host
validation, merge.

Tracks #1872 · branch feat/adr-095-g2-hive-mind-ws-transport

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

* test(swarm): ADR-095 G2 step 6 — failure-injection tests (f<n/3 BFT, f<n/2 Raft)

Sixth piece of ADR-095 G2 — the failure-injection coverage the ADR calls for.

## BFT — prepare/commit quorum under f-bounded faults
`injectQuorum()` builds one ByzantineConsensus with a configured cluster
size (so byzantineF() derives f = floor((n-1)/3)), feeds it a pre-prepare
(creates the proposal), then N distinct external prepares + M distinct
external commits, and reports whether `consensus.achieved` fired. Because
the node contributes 1 prepare + 1 commit of its own, 2f external messages
of each kind hit the 2f+1 quorum.
  - 4-node (f=1): 2 ext prepares + 2 ext commits → reached; 1 ext commit → NOT
  - 7-node (f=2): 4 + 4 → reached (quorum 5); 3 ext commits → NOT
  - 10-node + maxFaultyNodes:1 cap → f stays 1, 2 ext commits suffice

## Raft — election under vote majority/minority
`tallyVotes()` drives a RequestVote round from a candidate to all voters
over LocalTransport; silenced voters never reply (their handler is a no-op)
so the candidate's `send` to them times out → no vote. Tallies grants
including the self-vote.
  - 5-node, all reply → 5 votes (≥ majority 3) → wins
  - 5-node, 2 silent → 3 votes (= majority) → wins
  - 5-node, 3 silent → 2 votes (< majority) → loses

(The full multi-node PBFT cascade over the synchronous LocalTransport is
order-sensitive and flaky as an integration test — the direct
message-injection form above tests the threshold property robustly. A
real-WS cross-host cascade test belongs in the federation cross-host
validation step, not the unit suite.)

218/218 swarm suite passes. Build clean.

This completes the per-strategy correctness + failure-injection items.
Remaining for G2: cross-host validation (mac↔ruvultra over tailscale,
root); merge PR #1905.

Tracks #1872 · branch feat/adr-095-g2-hive-mind-ws-transport

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

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-11 09:52:46 -04:00
ReuvenandRuFlo 5b36fe531e chore(release): 3.7.0-alpha.23 — ships #1863 task-status crash fix + #1899 hooks rename
All 3 packages on alpha+latest+v3alpha atomically:
  @claude-flow/cli@3.7.0-alpha.23
  claude-flow@3.7.0-alpha.23
  ruflo@3.7.0-alpha.23

Includes:
  - #1863 — guard undefined arrays in `task status` (no more TypeError)
  - #1863 — new cli-no-crash CI smoke (task create→status + list formatters)
  - #1899 — ruflo-core hooks call `npx ruflo@alpha` not `npx claude-flow@alpha`
    (in-tree; marketplace republish of ruflo-core@0.2.2 still pending)

Co-Authored-By: RuFlo <ruv@ruv.net>
v3.7.0-alpha.23
2026-05-11 09:13:45 -04:00
ReuvenandRuFlo 8403907d86 fix(#1863): guard undefined arrays in task status + cli-no-crash CI smoke
## The crash

`task status <id>` threw `TypeError: Cannot read properties of undefined
(reading 'join')` in the Assignment section. Lines in task.ts did
`result.dependencies.join(', ')`, `result.dependents.join(', ')`,
`result.tags.join(', ')` — `callMCPTool<{ dependencies: string[]; ... }>()`
types those as non-optional arrays, but the MCP server legitimately omits
them for tasks created via task_create or loaded from an older store
schema. The TS compiler can't see the risk; only running the command does.

Fix: `?.join(', ') || 'None'` at all five sites (the inline `task status`
formatter at ~206 + the detailed one at ~441). `assignedTo` was already
guarded; the others weren't.

## CI guard (the user's ask: "ensure this type of error is caught")

New plugins/ruflo-core/scripts/test-cli-no-crash.mjs — drives
`task create` → `task status <id>` plus `task list` / `agent list` /
`memory list` / `swarm status`, asserting none crash with an unhandled
exception (TypeError/ReferenceError/"Cannot read propert"/etc). Graceful
"not found" errors are fine; only unhandled crash stacks fail the gate.
Per-command 30s timeout + 90s process-level watchdog so CI never hangs.

Tried a static grep-based guard first (`obj.prop.arrayMethod()` without
`?.`) — too noisy: 285 hits, mostly legit. Behavioral smoke is the right
shape: it catches the actual crash class, not the syntactic pattern.

Wired as a step in the existing mcp-roundtrip-smoke job (already builds
the cli + has the watchdog discipline).

Local: smoke green — confirms `task status` on a fresh task no longer crashes.

Closes #1863

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-11 09:09:52 -04:00
ReuvenandRuFlo 0114951502 fix(#1899): ruflo-core hooks call npx ruflo@alpha not npx claude-flow@alpha
The ruflo-core plugin's hooks.json referenced the legacy package name
`claude-flow@alpha` in all 5 hook commands (PreToolUse/Bash, PreToolUse/file,
PostToolUse/Bash, PostToolUse/file, Stop/session-end). On every session end
+ every tool call, `npx` re-resolves the old `claude-flow` package, producing
visible `ETIMEDOUT` errors on any brief network blip (VPN reconnect, etc.)
even though it's non-blocking.

Per the ruflo rebranding, all 5 now use `npx ruflo@alpha`. Updated
test-hooks.mjs's substitution regex to match. Bumped ruflo-core
plugin version 0.2.1 → 0.2.2.

7/7 hooks smoke still passes after the rename.

NOTE: the marketplace plugin distributes via IPFS, not npm — users won't
get this until ruflo-core@0.2.2 is republished to the marketplace
(separate step, same pattern as #1862).

Closes #1899

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-11 09:04:03 -04:00
ReuvenandRuFlo 7415f83ad7 chore(release): 3.7.0-alpha.22 — ADR-112 tool discoverability + #1889 paired-tool round-trip + #1892 statusline
Published with all 3 packages on alpha+latest+v3alpha atomically:
  @claude-flow/cli@3.7.0-alpha.22
  claude-flow@3.7.0-alpha.22
  ruflo@3.7.0-alpha.22

Ships #1897 — see release notes for the user-facing overview.

Co-Authored-By: RuFlo <ruv@ruv.net>
v3.7.0-alpha.22
2026-05-11 00:31:48 -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 31c6f97891 chore(federation): 1.0.0-alpha.15 — ships ADR-111 Phases 4-6 + Phase 7 staging
Published with both dist-tags atomically:
  @claude-flow/plugin-agent-federation@1.0.0-alpha.15
    alpha:  1.0.0-alpha.15
    latest: 1.0.0-alpha.15

Includes (delta from alpha.14):
  - Phase 4 WgFirewallService — nftables + pf projection
  - Phase 5 WgWitnessService — Ed25519-signed append-only chain
  - Phase 6 federation_wg_status / _attest / _keyrotate MCP tools
  - Security: readSafePeerWgFields validator closes peer-content
    injection vector in buildInterfaceConfig + summarize
  - Phase 7 staging helper (scripts/phase7-stage.mjs)
  - Federation user guide (docs/federation/)

Cross-OS validated: 550/550 tests pass on darwin/arm64 (mac mini)
and linux/x64 (ruvultra). claude -p verified working on both hosts.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-10 23:04:16 -04:00
rUvandReuven 70e2339469 feat(federation): ADR-111 Phases 4-6 — firewall projection + witness chain + MCP tools (#1895)
* feat(federation): ADR-111 Phases 4-6 — firewall projection + witness chain + MCP tools

Phases 4-6 of ADR-111. Phase 7 (cross-OS WG mesh bringup) is operator-mediated
and lives outside the package — staged but not auto-executed per CLAUDE.md
destructive-actions guidance.

## Phase 4 — Trust-graded firewall projection
`domain/services/wg-firewall-service.ts` (new)
- Two backends: linux-nftables (atomic `nft -f`, table `inet ruflo_fed`,
  default DROP, interface-scoped) and darwin-pf (anchor-scoped pfctl).
- Projects WG_NETWORK_GATES → concrete rule lines per peer.
- UNTRUSTED excluded (no mesh IP), peers without wgMeshIP skipped.
- Defense-in-depth: regex-validated rule args (no shell metachars in
  pubkey/IP/iface).
- Returns rule file content + the load command the operator runs —
  service never shells out.
- 16 unit tests.

## Phase 5 — Witness attestation chain
`domain/services/wg-witness-service.ts` (new)
- Append-only chain of Ed25519-signed entries. Each entry hash-links to
  the previous (`prevHash` = sha256 of previous canonical encoding).
- Canonical encoding: sorted keys, no whitespace, omitted-on-undefined.
- `verifyWitnessChain` walks the chain and reports `failedAt` + reason
  (`broken-chain-link` | `invalid-signature-or-hash`).
- `attestWgCommand` adapter maps WgCommand.verb → event type.
- 11 unit tests (canonicalization stability, deterministic hash,
  chain link integrity, signature-tamper detection).

## Phase 6 — Operator MCP tools
`mcp-tools.ts` (extended)
- `federation_wg_status` — per-peer mesh state (trust, meshIP, AllowedIPs,
  suspended/evicted flags) via `WgMeshService.summarize()`.
- `federation_wg_attest` — operator-signed witness chain entry. v1 stub
  returns wire-up instructions until plugin.ts integrates WgWitnessService.
- `federation_wg_keyrotate` — emits a new X25519 keypair (public key only
  via MCP; private key write is operator-mediated) + the upgrade checklist.
  Requires `confirm: true` (destructive — drops existing tunnels until peers
  fetch updated manifest).
- `createMcpTools` gets optional `getWgMesh` getter (additive, no break).
- `FederationCoordinator.listPeers()` added as public discovery accessor.

## Tests
- 543/543 pre-existing + new tests pass (513 + 27 phase 4/5 + 3 plugin
  test count assertions for the new MCP tools).

## Not in this PR (Phase 7 — operator-mediated)
- Real WG mesh bringup on mac↔ruvultra over tailscale: stage configs,
  operator-approved `wg-quick up`, peer-add via federation manifests,
  SUSPEND → confirm L3 isolation → reactivate restores, witness-verify
  the change log. Tracked alongside #1879.

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

* fix(federation): security — validate peer wg fields before splice (ADR-111)

Manual security audit of ADR-111 Phases 1-6 found a real vulnerability in
Phase 2's WgMeshService that the existing tests did not catch.

## The bug

`WgMeshService.buildInterfaceConfig()` and `summarize()` spliced
`peer.metadata.wgPublicKey` / `wgMeshIP` / `wgEndpoint` into the wg-quick
config string *without validation*. The ADR's threat model explicitly
includes "compromised federation peer with valid WG key" — that peer
signs their own manifest, so the Ed25519 signature only proves origin,
not content safety.

Concrete attack: a compromised peer publishes

  wgEndpoint = "host:51820\n[Peer]\nPublicKey = attacker\nEndpoint = ..."

and the operator's wg-quick config ends up with an extra [Peer] block.
Cross-peer lateral movement, bypassing the per-peer trust gates.

Phase 4 (WgFirewallService) already validated meshIP via
`assertSafeRuleArg`. Phase 2 didn't — fixed here.

## The fix

New `readSafePeerWgFields(peer)` returns the validated triple or null.
Three regexes:
  - wgPublicKey: ^[A-Za-z0-9+/]{43}=$            (base64 X25519, 32 raw bytes)
  - wgMeshIP:    ^d.d.d.d/32$ + octet range check
  - wgEndpoint:  ^(hostname|ipv4|[ipv6]):port$  + port range check

Mismatched fields → peer is skipped entirely (no [Peer] block, no
AllowedIPs, summarize() returns empty strings). Silent skip beats partial
write because partial writes can leak attacker content into operator
review while looking syntactically valid.

## Tests

7 new adversarial cases under `WgMeshService — readSafePeerWgFields
(compromised-peer defense)`:
  - newline injection in wgEndpoint
  - wrong-length / non-base64 wgPublicKey
  - out-of-range octet in wgMeshIP
  - missing /32 CIDR
  - port out of range
  - IPv6 bracket positive case
  - summarize() also sanitizes (regression: it used the same unsafe path)

Full suite: 550/550 pass.

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

* feat(federation): ADR-111 Phase 7 staging helper

Generates WG keypair + wg-quick config + per-OS firewall rules on the
current host, naming a single peer. Outputs go to /tmp/adr-111-stage.
Nothing loaded into the kernel — wg-quick up / nft -f / pfctl -f are
operator-mediated.

Usage:
  node scripts/phase7-stage.mjs <localId> <peerId> <peerPk> <peerIP> <peerEndpoint>

Workflow:
  1. Run on host A with placeholder peer values → emit host-A pubkey
  2. Run on host B with placeholder peer values → emit host-B pubkey
  3. Re-run on both with the OTHER host's pubkey → final config files
  4. Operator reviews + activates per the printed checklist

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

* fix(federation): ADR-111 phase7-stage idempotent — reuse key file

Without persistence, every run generates a fresh keypair, which breaks
the cross-feed workflow (run on host A → capture pubkey → run on host B
with A's pubkey → A regenerates a different key on its next run).

Now reads /tmp/adr-111-stage/wg-key-<nodeId>.json if present, falls back
to fresh generation if not. Operator can delete the file to force
rotation.

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

* docs(federation): user guide + Phase 7 bringup procedure + README link

Adds:
  - docs/federation/README.md — full user guide (when to use, MCP tools,
    trust levels, breaker, ADR-111 mesh layer, claude -p headless usage)
  - docs/federation/phase7-mesh-bringup.md — step-by-step cross-OS WG
    mesh activation procedure with operator review checklist
  - README.md — link to docs/federation/ from the existing Federation
    section

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

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-10 23:03:19 -04:00
ReuvenandRuFlo f2f1fec3e1 chore(federation): 1.0.0-alpha.14 — ships ADR-111 Phases 1-3
Published with both dist-tags updated atomically per the CLAUDE.md
publishing protocol (closing the gap that produced #1881):

  @claude-flow/plugin-agent-federation@1.0.0-alpha.14
    alpha:  1.0.0-alpha.14
    latest: 1.0.0-alpha.14

Includes:
  - Manifest.wg? section (Phase 1) — Ed25519 sig covers it
  - WgMeshService with no-shell pure projection (Phase 2)
  - Coordinator/breaker WG propagation hooks (Phase 3)
  - 33 new unit tests; 513/513 pre-existing pass

Cross-OS validated: 513/513 tests pass on both darwin/arm64
(mac mini) and linux/x64 (ruvultra) over tailscale. deriveMeshIP
produces byte-identical outputs across hosts for the same nodeId.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-10 22:33:41 -04:00