Commit Graph
1490 Commits
Author SHA1 Message Date
ruvandRuFlo 1ce81a3e35 chore(release): publish 3.7.0-alpha.76 — ADR-128 init bundle reduce + refactor
ADR-128 (PR #2096, PR #2097) ships:
- 29+ canonical skills now bundled inside @claude-flow/cli npm package
  (closes the source-of-truth gap surfaced by ADR-127)
- 9 forked agents removed from init template (let plugins own them)
- agents.all default flipped true → false; --all-agents opt-in flag
  (default agent count drops 98 → 17)
- 9 truly-orphan flow-nexus/ command files deleted; 78 ambiguous
  ones promoted to first-class COMMANDS_MAP keys
- New smoke-init-bundle-invariants.mjs + CI wiring

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
2026-05-21 15:53:10 -04:00
ruv 9a66b2996b feat(ci): #2095 ADR-128 Phase 5 — init-bundle-invariants smoke (no orphans, no plugin-init overlap)
Adds scripts/smoke-init-bundle-invariants.mjs with three assertions:
  1. Every subdir under .claude/{commands,agents}/ has a COMMANDS_MAP or
     AGENTS_MAP entry (zero orphaned dirs).
  2. Every skill in SKILLS_MAP has SKILL.md or README.md in the package
     (catches Phase 1 regression).
  3. No init-template agent shares a basename with a plugin agent (ADR-128
     Phase 2 dedup invariant).

Also copies the 5 remaining SKILLS_MAP-referenced skills that were not in
the 29 Phase-1 core/agentdb/github/v3 set (browser, flow-nexus-neural,
flow-nexus-platform, flow-nexus-swarm, dual-mode) so assertion 2 passes.

Wires the smoke into v3-ci.yml as init-bundle-invariants-smoke job with
path filters on .claude/**, src/init/**, plugins/*/agents|skills|commands/**,
and the smoke itself.

Smoke matrix: init-bundle-invariants=PASS, deprecated-actions=PASS,
github-safe-injection=PASS, github-actions-pins=PASS,
attribution-opt-in=PASS, ruvllm-wasm-auto-init=PASS,
plugin-registry-signature=PASS — no regressions.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-21 15:41:47 -04:00
ruv 0740b2fa1d feat(init): #2095 ADR-128 Phase 4 — delete 9 orphan command files (unreachable from COMMANDS_MAP)
Deletes commands/flow-nexus/ (9 files) — the only directory the ADR
explicitly marks for deletion. Promotes all remaining orphaned substrate
dirs to first-class COMMANDS_MAP keys: agents, coordination, hiveMind,
memory, swarm, workflows (default true) and pair, training, streamChain,
truth, verify (opt-in, default false). Adds matching CommandsConfig
interface fields and DEFAULT_INIT_OPTIONS entries.

Deviation from task's estimated "87 orphan deletions": the ADR Phase 3
resolution for the other 78 orphaned files is promotion (add COMMANDS_MAP
key), not deletion. Deleting substrate commands like swarm/, memory/,
hive-mind/ would be a regression. Only flow-nexus/ (domain-specific,
plugin-owned) is deleted. Ambiguous-as-substrate files preserved.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-21 15:37:56 -04:00
ruv 34e7b1e9f6 feat(init): #2095 ADR-128 Phase 3 — opt-in domain-specific agent categories (98 → ~17 by default)
Changes DEFAULT_INIT_OPTIONS.agents: github, hiveMind, v3, optimization
now default false; core, consensus, swarm, sparc, testing remain true.
agents.all flipped from true to false. Adds --all-agents CLI flag to
restore the full set when users explicitly opt in.

Default install now ships ~17 substrate agents instead of 98. Full set
(89 after Phase 2) available via: ruflo init --all-agents

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-21 15:35:42 -04:00
ruv 865c901af2 feat(init): #2095 ADR-128 Phase 2 — remove 9 forked agents (let plugins own them)
Deletes the 9 init-template agent files that have diverged from their
canonical plugin counterparts. Plugins now own: coder.md (ruflo-core),
researcher.md (ruflo-core), reviewer.md (ruflo-core), tester.md
(ruflo-testgen), memory-specialist.md (ruflo-rag-memory),
security-auditor.md (ruflo-security-audit), sparc-orchestrator.md
(ruflo-sparc), goal-planner.md (ruflo-goals), adr-architect.md
(ruflo-adr). AGENTS_MAP not modified: map values are directory names;
the copy function picks up whatever files remain in those dirs.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-21 15:33:30 -04:00
ruv c63905e6ae feat(init): #2095 ADR-128 Phase 1 — ship 29 skills inside @claude-flow/cli package
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-21 15:32:28 -04:00
ruvandRuFlo b4e1776675 fix(github): #2089 — complete Phase 3 (5 init-template agents missed) + strengthen smoke + alpha.75
Post-publish validation of alpha.74 found 5 init-template agents still
shipping `actions/checkout@v3`:

  v3/@claude-flow/cli/.claude/agents/github/release-manager.md
  v3/@claude-flow/cli/.claude/agents/github/swarm-pr.md
  v3/@claude-flow/cli/.claude/agents/github/release-swarm.md
  v3/@claude-flow/cli/.claude/agents/github/repo-architect.md
  v3/@claude-flow/cli/.claude/agents/github/workflow-automation.md

The Phase 3 sed in PR #2094 only scanned `.claude/agents/github/`
(dogfood) and `v3/@claude-flow/cli/.claude/commands/github/` (init
commands). It missed the *init-template agents* subtree at
`v3/@claude-flow/cli/.claude/agents/github/` and the *dogfood commands*
at `.claude/commands/github/`.

`smoke-deprecated-actions.mjs` had the same scan-tree gap, which is
why CI didn't catch this. Smoke now scans all 5 trees:

  .claude/agents/github/
  .claude/skills/
  .claude/commands/github/                                  (added)
  v3/@claude-flow/cli/.claude/agents/github/                (added)
  v3/@claude-flow/cli/.claude/commands/github/

Verified: `npm pack @claude-flow/cli@3.7.0-alpha.74 && grep ... @v3`
showed the 5 missed files in the published tarball.

Versions bumped to 3.7.0-alpha.75 across cli + claude-flow umbrella + ruflo wrapper.

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
2026-05-21 14:37:43 -04:00
ruv 1eece3afc0 feat(init): #2089 ADR-127 Phase 4 — attribution opt-in across 19 github command files + last-updated stamps
Remove 13 hardcoded "Generated with Claude Code" attribution strings from
6 github command/agent/skill files (dogfood + init-template copies):
  .claude/agents/github/{release-manager,sync-coordinator,issue-tracker}.md
  .claude/skills/github-project-management/SKILL.md
  v3/@claude-flow/cli/.claude/commands/github/{release-manager,sync-coordinator,issue-tracker}.md

Add <!-- last-updated: 2026-05-21 — ADR-127 --> stamps to the top-level
code-block boundary of each edited file so readers can trace the change
back to this ADR without opening git log.

Export ATTRIBUTION_FOOTER from helpers-generator.ts (ADR-127 §opt-in):
when options.attribution === true, materialise a .claude/helpers/attribution
file during init so PR templates can append it conditionally, without
hard-wiring the emoji into every user's commit history (#1670).

Add scripts/smoke-attribution-opt-in.mjs + github-attribution-opt-in-smoke
CI job: static scan that fails if the 🤖 emoji pattern reappears in the
three github-scoped template trees — prevents copy-paste regression.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-21 14:19:35 -04:00
ruv 388665d67c feat(ci): #2089 ADR-127 Phase 3 — bump actions/checkout + setup-node to v4 + deprecated-actions smoke
Replace all actions/checkout@v3 and actions/setup-node@v3 refs with @v4
across .claude/agents/github/, .claude/skills/github-*/,
and v3/@claude-flow/cli/.claude/commands/github/ (19 files total).

Add scripts/smoke-deprecated-actions.mjs: static scan that fails if any
of the deprecated refs (checkout@v3, setup-node@v3,
create-release@*, upload-release-asset@*, softprops/action-gh-release@v1)
reappear in scope — preventing copy-paste regression from blog posts or
AI-generated YAML snippets.

Wire github-deprecated-actions-smoke job and path filter into v3-ci.yml
so every future PR touching the github surface re-runs this gate.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-21 14:11:32 -04:00
ruv 7d2fc001ec feat(security): #2089 ADR-127 Phase 2 — github-safe maxBuffer + agent frontmatter tools: + swarm-pr/issue injection fix
github-safe.js (both copies — dogfood + init-template)
  Adds GITHUB_SAFE_VERSION='1.0.0' constant for smoke assertions.
  Adds explicit 256KB body cap (MAX_BODY_BYTES): rejects oversized bodies
  with exit 1 before any temp-file write, matching the GitHub API body
  field limit documented in ADR-127.  Adds strict error handling: all
  execSync calls wrapped in try/catch, cleanup in finally.  Adds
  GITHUB_SAFE_DRY_RUN=1 env-var for smoke tests to skip gh exec.

github-setup.sh (both copies)
  Prepends set -euo pipefail.  Replaces bare `gh auth status &>/dev/null`
  with a check that parses "Logged in" and "repo" scope from the output.
  Adds security rationale comment explaining why each flag is needed.

Agent frontmatter WebFetch removal (dogfood copies only — init-template
commands don't have frontmatter; the relevant change there is the injection
fix below):
  release-manager.md  — removes WebFetch (keeps Write for CHANGELOG)
  release-swarm.md    — removes WebFetch (keeps Write for CHANGELOG)
  repo-architect.md   — removes WebFetch

All 13 agents already have explicit tools: lines; only the 3 above had
WebFetch.  No agent in scope now has WebFetch in its tools: list.

swarm-pr.md + swarm-issue.md (BOTH dogfood .claude/agents/github/ AND
init-template v3/@claude-flow/cli/.claude/commands/github/):
  Replaces unquoted ${{ github.event.comment.body }} interpolated into
  --comment "..." with mktemp + printf + grep + --comment-file pattern.
  Replaces unquoted ${{ github.event.label.name }} == "swarm-ready" with
  mktemp + printf + grep -qx pattern.  Closes prompt-injection path where
  a PR comment with shell metacharacters could execute attacker-controlled
  shell in a pull_request-triggered workflow.

smoke-github-safe-injection.mjs updated:
  Upgrades the >256KB test case from "note" (Phase 1 red) to "ok" (Phase 2
  green) now that the 256KB cap is enforced.

Acceptance checks:
  node scripts/smoke-github-safe-injection.mjs  → all 5 cases pass
  node scripts/smoke-github-actions-pins.mjs    → ok (no regressions)
  grep -r 'github.event.comment.body.*--comment' .claude/agents/ v3/@claude-flow/cli/.claude/
  → exit 1 (no matches)

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-21 14:06:59 -04:00
ruvandRuFlo bc1f587c0f fix(mcp): #2086 — auto-init ruvllm WASM in loadRuvllmWasm + CI regression guard
Reported by @seo-yas. The `loadRuvllmWasm()` helper in
`v3/@claude-flow/cli/src/mcp-tools/ruvllm-tools.ts` did a bare
`import('../ruvector/ruvllm-wasm.js')` and never called
`initRuvllmWasm()`. Result: `_wasmReady` stayed false even after
`ruvllm_sona_create` / `ruvllm_microlora_create` / `ruvllm_hnsw_create`,
which left every downstream `sona_*` / `microlora_*` / `hnsw_*` call
either erroring inside the WASM module or returning empty.

`ruvllm_status` reported `wasm.available=true, wasm.initialized=false`
forever because nothing triggered `initSync({ module: wasmBytes })`.

Fix: fold `await mod.initRuvllmWasm()` into `loadRuvllmWasm()`. The
init function is idempotent (early-returns on `_wasmReady`), so the
cost after the first call is one boolean check. `ruvllm_status`
deliberately uses a separate `loadRuvllmWasmModule()` helper so the
diagnostic path stays callable when init has not been attempted (a
diagnostic that triggers the very thing it diagnoses is worse than
useless).

CI guard: `scripts/smoke-ruvllm-wasm-auto-init.mjs` statically asserts
all 12 invariants the fix relies on. Wired into v3-ci.yml as
`ruvllm-wasm-auto-init-smoke` with path filters on the two source files
and the smoke itself, so future refactors that drop the `await
mod.initRuvllmWasm()`, reroute `ruvllm_status` through the auto-init
loader, or add a new `ruvllm_*` tool that bypasses `loadRuvllmWasm()`
without an instance lookup will fail the check before merge.

Versions bumped to 3.7.0-alpha.73 (cli, claude-flow umbrella, ruflo).

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
2026-05-21 12:36:22 -04:00
ruvandRuFlo 10db8e4595 docs(readme): add RuFlo Agentic Appliance banner linking to cognitum.one/appliance
Place above the ruFlo Summit badge in the three customer-facing READMEs
(repo root, ruflo wrapper package, @claude-flow/cli package). Same
hosting pattern as the summit asset.

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
2026-05-21 00:57:59 -04:00
ruvandruflo-bot 7bdcd58dba fix(init): #2078 — use no-reply bot email for opt-in Co-Authored-By
The opt-in attribution feature (#1670) used `ruv@ruv.net`, a personal
email that GitHub maps to the maintainer's contributor graph. When
users opt in (or have legacy `.claude/settings.json` from before #1670),
the trailer silently adds ruvnet as a contributor to their repos.

Switch to `ruflo-bot <ruflo-bot@users.noreply.github.com>` — GitHub's
no-reply convention excludes the address from contributor graphs and
maps it to a tool identity rather than a person.

The default (no `--attribution` flag) still writes no trailer at all
per #1670. This is purely about what's written when the user opts in.

Also updates the same trailer format in three sibling locations that
hardcoded the personal email:
- v3/@claude-flow/cli/.claude/settings.json (this repo's local settings,
  eating our own dog food)
- v3/@claude-flow/codex/src/generators/agents-md.ts (codex AGENTS.md
  template generator)
- v3/@claude-flow/codex/AGENTS.md (the generated AGENTS.md, regenerated
  to match the template change)

Out of scope: the harness portion of #2078 (Claude Code runtime trailer)
is a separate concern handled by the Claude Code itself, not by ruflo.

Refs #2078

Co-Authored-By: ruflo-bot <ruflo-bot@users.noreply.github.com>
2026-05-20 16:21:57 -04:00
ruv fa790f0963 chore(release): publish 3.7.0-alpha.72 — #2073 memory export/retrieve fix
Bumps @claude-flow/cli, claude-flow, ruflo to 3.7.0-alpha.72 carrying
the fix for #2073 (memory export returned null values; new --value-only
pipe-friendly retrieve flag).

Published:
- @claude-flow/cli@3.7.0-alpha.72 (tags: alpha, latest, v3alpha)
- claude-flow@3.7.0-alpha.72 (tags: alpha, latest, v3alpha)
- ruflo@3.7.0-alpha.72 (tags: alpha, latest, v3alpha)

Verified against the published artifact: `npx @claude-flow/cli@3.7.0-alpha.72
memory export -o out.json -f json -n test` now writes the real entry
value as a parseable JSON string (was null in alpha.71).

Refs #2073

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-20 09:38:18 -04:00
ruv 0c31cbad48 fix(memory): #2073 — export returns real value + --value-only pipe-friendly retrieve
Two related fixes for the cost-tracker reporting pipeline:

1. `memory export -f json` now writes the real entry value instead of
   null. Root cause: the export tool used `(e as { value?: unknown }).value`
   but `listEntries` only returned metadata — the SELECT pulled `content`
   from SQL but the result-mapping dropped it. Fix: `listEntries` /
   `bridgeListEntries` now accept `includeContent: true` to opt into
   returning the full content string, and `memory_export` passes that
   flag + writes `e.content` to the exported `value` field.

2. `memory retrieve --value-only` emits ONLY the raw value to stdout —
   no box, no banner, no decoration — designed for piping into JSON.parse
   without any cleanup. Closes the third suggested fix from #2073.

3. `memory retrieve --format json` was already wired in the handler but
   wasn't discoverable through `--help`. Removed dead per-command option
   override (the global --format from parser.ts:78 already handles it
   with choices: ['text','json','table']) and documented it in a comment.

Backward compat: when callers don't pass `includeContent`, listEntries
omits the field entirely (no behavior change for the 14 existing
call sites that just want metadata). When `includeContent: true`, the
returned id is no longer truncated to 20 chars — exporters need the
full id for round-trip via memory_import.

Verification (against the fixed dist):

  $ node bin/cli.js memory store -n test -k x \
      --value '{"sessionId":"abc","byTier":{"opus":1.23}}'
  $ node bin/cli.js memory retrieve -n test -k x --value-only \
      | node -e "console.log(JSON.parse(require('fs').readFileSync(0,'utf8')))"
  { sessionId: 'abc', byTier: { opus: 1.23 } }                       # ✅

  $ node bin/cli.js memory export -o out.json -f json -n test
  $ jq -r '.entries[0].value | fromjson' out.json
  { "sessionId": "abc", "byTier": { "opus": 1.23 } }                 # ✅

Refs #2073. Restores the ruflo-cost-tracker reporting pipeline
(cost summary / report / conversation / budget / export / federation /
optimize — all of which depend on a working memory read path).

Closes #2073

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-20 09:34:49 -04:00
ruv 27e91c7fb5 chore(release): publish 3.7.0-alpha.71 + @claude-flow/memory@3.0.0-alpha.18
Bumps @claude-flow/cli, claude-flow, ruflo to 3.7.0-alpha.71 and
@claude-flow/memory to 3.0.0-alpha.18. This release ships ADR-125
end-to-end — `@claude-flow/memory` consolidation across both PR A
(#2062, phases 1+2+6+7) and PR B (#2063, phases 3+4+5).

Published artifacts:
- @claude-flow/cli@3.7.0-alpha.71 (tags: alpha, latest, v3alpha)
- claude-flow@3.7.0-alpha.71 (tags: alpha, latest, v3alpha)
- ruflo@3.7.0-alpha.71 (tags: alpha, latest, v3alpha)
- @claude-flow/memory@3.0.0-alpha.18 (tags: alpha, latest, v3alpha)

ADR-125 delivered:
- Canonical MemoryService entry point (UnifiedMemoryService deprecated)
- Real HybridBackend default wired (ADR-009 fulfilled)
- Persistent HNSW with snapshot/restore on close + every Nth write
- MemoryConsolidator (sweepExpired + dedup + compactHnsw + autoRun)
- Graceful retrieval degradation + FTS5 keyword fallback
- Runnable benchmarks with measured baseline
- RuVector boundary cleanup + no-stray-DB CI smoke

Test count: 367 → 378 (PR A) → 403 (PR B) across 15 test files.
All 8 ADR-125 acceptance criteria locked in.

Closes #2061

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-19 18:47:16 -04:00
ruv 4de8846c75 chore(release): publish 3.7.0-alpha.70 — CWE-347 security fix
Bumps @claude-flow/cli, claude-flow, ruflo to 3.7.0-alpha.70 and
publishes to npm. This release ships the CWE-347 plugin-registry
signature verification fix landed in #2060 (Closes #1922).

Published artifacts:
- @claude-flow/cli@3.7.0-alpha.70 (tags: alpha, latest, v3alpha)
- claude-flow@3.7.0-alpha.70 (tags: alpha, latest, v3alpha)
- ruflo@3.7.0-alpha.70 (tags: alpha, latest)

Also includes #2056 — agentic-flow ^2.0.12 → ^2.0.13 (Windows
onnxruntime lazy-load fix from upstream PR ruvnet/agentic-flow#155).

Verification:
- 13-check CWE-347 regression smoke green
- Root npm audit: 0 vulnerabilities
- Supply-chain audit (5 layers): no hard-fail findings
- All 65 CI checks green on PR #2060 pre-merge

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-19 16:54:09 -04:00
ruvandAeon 82edec30f9 fix(security): #1922 — verify plugin-registry Ed25519 signature properly (CWE-347)
The plugin-registry signature verifier in
`v3/@claude-flow/cli/src/plugins/store/discovery.ts` was a stub that
returned `true` whenever the served `registryPublicKey` field started
with `"ed25519"`. The call site only `console.warn`ed on failure and
continued to use the unverified registry. With `requireVerification:
true` (the default), a network adversary on the path to an IPFS
gateway could swap the served registry and have a user install
attacker-controlled plugin tarballs with filesystem+network+hooks
permissions.

Patch (originally proposed in #1922 by @aaronjmars; CWE-347):
- Import `verifyEd25519Signature` from `transfer/ipfs/client.ts` (the
  real Ed25519 verifier already lived there, just wasn't wired in).
- Replace the stub with an async verifier that mirrors `signRegistry()`
  in `scripts/publish-registry.ts:127-151`: strip `registrySignature` +
  `registryPublicKey` from the registry copy, `JSON.stringify`, verify
  signature against `expectedPublicKey`.
- Pin verifier to the caller-supplied `expectedPublicKey` (the trusted
  pinned key from `DEFAULT_PLUGIN_STORE_CONFIG`), NOT the self-asserted
  `registry.registryPublicKey` (which an attacker can swap too).
- Update call site to `await` the now-async verifier AND fail closed
  (return demo registry on failure rather than warn+continue).

CI guards (this commit):
1. `scripts/smoke-plugin-registry-signature.mjs` — 13-check regression
   smoke covering: (a) static contract on discovery.ts (correct import,
   canonicalization, pinned-key call, no stub revival), (b) Ed25519
   crypto round-trip matching signRegistry()'s scheme (valid passes,
   tampered fails, empty fields fail, swapped served key cannot defeat
   the trusted pin), (c) call-site byte check (await + fail-closed).
2. `plugin-registry-signature-smoke` job in `v3-ci.yml` runs the smoke
   on push + PR (including from forks now that pull_request branches
   include `develop`).
3. Path filters added for `discovery.ts`, `transfer/ipfs/client.ts`,
   `publish-registry.ts`, and the smoke itself so any future drift in
   the signing scheme triggers re-verification.

Acceptance:
- `node scripts/smoke-plugin-registry-signature.mjs` → 13/13 pass
- Build of `@claude-flow/cli` clean (no new typecheck errors)
- Root npm audit: 0 vulnerabilities
- Supply-chain audit (5 layers): no hard-fail findings

Sibling `verifyRegistrySignature` stub at
`transfer/store/registry.ts:278` is dead code today; tracked as a
follow-up (delete-if-dead or rewrite when wired up).

Co-Authored-By: Aeon (aaronjmars) <aeon@aaronjmars.com>
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-19 16:39:54 -04:00
ruv 9a8c9c464f fix(supply-chain): #2046 — eliminate all root-level HIGH/CRITICAL CVEs
Before:
  Root npm audit: 13 HIGH/CRITICAL across 25 vulns
  @claude-flow/browser fresh install: similar transitive chain
  Audit script reported 0 unaccepted only because it correctly scopes
  to direct deps — but transitive surface was hostile

Changes:

1. Bump agentdb to 3.0.0-alpha.14 (was alpha.10/13 across repo)
   - 3.0.0-alpha.14 dropped @opentelemetry/sdk-node from its
     dependencies block (still in optionalDependencies; overrides handle
     that). Eliminates the @opentelemetry/sdk-node CVE chain via direct
     dep replacement.
   - Updated: v3/@claude-flow/memory, v3/@claude-flow/cli, root.

2. Bump agentic-flow 2.0.7 → 2.0.11 (root) and ^2.0.3 → ^2.0.11
   (v3/@claude-flow/browser). Latest 2.x; closer to a Xenova-clean
   release when upstream ships it.

3. Add npm overrides at the root + at v3/@claude-flow/browser package
   (overrides do not cascade across separate npm projects, so browser
   needs its own block for standalone publish):
     @opentelemetry/sdk-node              >= 0.218.0  (was <0.217.0 CVE)
     @opentelemetry/auto-instrumentations >= 0.75.0
     @opentelemetry/exporter-prometheus   >= 0.217.0
     axios                                >= 1.13.2
     fast-uri                             >= 3.1.0
     vite                                 >= 6.4.6
     ws                                   >= 8.18.4

   Plus the existing browser-package overrides for hono / undici / tar /
   minimatch / picomatch / flatted / etc. — copied from root to keep
   the standalone npm-published install clean.

After:
  Root npm audit: 0 vulnerabilities (13 HIGH/CRITICAL → 0)
  Supply-chain audit: PASS (0 unaccepted direct-dep findings)
  Browser tests:  230/230 passing
  Graph-intel tests: 104/104 passing

One CVE remains in v3/@claude-flow/browser's STANDALONE fresh install
(end-user `npm install`): @xenova/transformers via agentic-flow direct
dependency. Cannot fix without upstream agentic-flow shipping a Xenova-
free release. agentic-flow@3.0.0-alpha.2 still has it. Documented in
accepted-findings.json under cve[] with:
  tracking: ADR-121 Phase 4
  expiresAt: 2026-08-19 (audit re-fails if upstream still hasn't shipped)
  rationale: browser package does not invoke embedding code paths

This is the right level of triage. The audit doesn't lie about it — it
just doesn't block our shipping while we wait for upstream.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-19 08:34:23 -04:00
ruv 5b71c7ac13 release(alpha.43+44): pin neural→sona@0.1.5, republish modules w/ standalone READMEs, add npm download badges everywhere (#2022)
This commit closes the chain started in ca0a6fa5c (standalone use recipes
landed in repo but never reached npm because no version bumps shipped).

## Changes

### Module version bumps (alpha.43)
- @claude-flow/memory     → 3.0.0-alpha.17  (republish standalone use README)
- @claude-flow/embeddings → 3.0.0-alpha.18  (republish standalone use README)
- @claude-flow/security   → 3.0.0-alpha.8   (republish standalone use README)
- @claude-flow/neural     → 3.0.0-alpha.9   (pin @ruvector/sona to 0.1.5,
                                             republish standalone use README)
- @claude-flow/cli        → 3.7.0-alpha.43  (repin to new modules above)
- claude-flow             → 3.7.0-alpha.43  (umbrella)
- ruflo                   → 3.7.0-alpha.43  (umbrella)

### Umbrella bump (alpha.44) — npm download badges
- @claude-flow/cli        → 3.7.0-alpha.44
- claude-flow             → 3.7.0-alpha.44
- ruflo                   → 3.7.0-alpha.44

### Neural sona pin (root fix for #2022)
@claude-flow/neural alpha.8 had `"@ruvector/sona": "latest"`, and
@ruvector/sona@0.1.6 (current latest on npm) shipped as an empty publish
— README + package.json only, no index.js or native bins. So every
fresh `npm install @claude-flow/neural@alpha.8` broke at import time
with `Cannot find package '.../node_modules/@ruvector/sona/index.js'`.

Alpha.9 pins to the exact known-good 0.1.5 (which has index.js + 7
platform-specific .node bins). Will revert to a range once
@ruvector/sona@0.1.7+ ships with content (tracked in #2022).

### npm download badges across every published package README
Added `shields.io/npm/dm/<pkg>` (monthly downloads) badges to:
  - claims, cli-core, plugins (had no npm badges at all)
  - plugin-agent-federation, plugin-iot-cognitum (no npm badges)
  - browser, codex, mcp (had version badge, missing downloads)
  - umbrella root README (now badges both `ruflo` + `claude-flow`)
The ruflo/README.md and v3/@claude-flow/cli/README.md auto-copy from
root via prepublishOnly, so they inherit the new badges on publish.

Packages that already carried downloads badges (aidefence, deployment,
embeddings, guidance, hooks, integration, memory, neural, performance,
providers, security, shared, swarm, testing) are unchanged.

## Live functional check on the published artifacts

  - Fresh `npm install @claude-flow/neural@3.0.0-alpha.9`:
    sona resolves to 0.1.5; `import('@claude-flow/neural')` returns
    A2CAlgorithm, BalancedMode, BaseModeImplementation, BatchMode,
    CuriosityModule, ... (was broken before alpha.9).
  - Standalone use sections from ca0a6fa5c now visible on npmjs.com for
    memory@alpha.17, embeddings@alpha.18, security@alpha.8, neural@alpha.9.
  - npm dm/ badges resolve and render the current weekly download count.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-16 16:46:34 -04:00
ruv 9056720219 fix(browser): #2015 round 2 — strip bogus --kind flag, ship alpha.42
Round 1 (alpha.41) added the required --dimension flag to
`ruvector rvf create` but left the equally bogus `--kind browser-session`
in place. ruvector@0.2.25's `rvf create` accepts only:

  -d, --dimension <n>    (required)
  -m, --metric <metric>  (optional, default cosine)

Commander's required-option check fires before its unknown-option
check, so the original bug report (#2015) only surfaced the dimension
error. The fresh live regression check after publishing alpha.41
exposed the second-layer bug: `error: unknown option '--kind'`.

This round:
- Strip `--kind browser-session` from all 5 call sites (TS source,
  compiled dist via rebuild, replay-spike.sh, browser-agent.md,
  browser-record/SKILL.md). Also fixed the ADR prose example.
- Tighten the smoke (scripts/smoke-browser-rvf-create-flags.mjs):
  - Switch from rg-based content scan to an explicit PATHS_IN_SCOPE
    list (the original `--kind browser-session` anchor is gone, so
    we can no longer identify call sites by content).
  - Police BOTH invariants per line:
      * --dimension / -d is present
      * --kind is ABSENT (since ruvector@0.2.25 rejects it)
  - Skip quoted-string false positives ('rvf create failed' log lines).

Versions:
  @claude-flow/cli    3.7.0-alpha.42
  claude-flow         3.7.0-alpha.42
  ruflo               3.7.0-alpha.42
  @claude-flow/memory 3.0.0-alpha.16  (unchanged, #2019 fix already live)

Post-publish live functional check (everything green):
- ruvector rvf create --dimension 384 (no --kind): exit 0, .rvf file
  written. Reproduces what the MCP tool now invokes.
- Published CLI dist:113 carries '--dimension','384', no --kind.
- #2019 vectorBackend / graphAdapter functional test from
  alpha.41 still passes against published memory@3.0.0-alpha.16.
- verify.mjs precondition contract still holds.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-16 09:02:08 -04:00
ruv e4bd9bbcbe fix(verify+memory+browser): #1880, #2019, #2015 — three precondition/contract fixes + CI guards
Three small but recurring bugs ship together because they share the
same anti-pattern: a try/catch (or a missing flag) silently turned a
clear precondition failure into a vague "verification failed" /
"controller disabled" / "rvf create failed" outcome that downstream
consumers couldn't act on.

#1880 — witness verify exits 1 on source-only checkouts
  - The 12h scheduled verification has been filing a duplicate
    "HIGH — verification broken" issue every cron run since 2026-05-10
    because the runner does a source-only checkout (no @noble/ed25519
    install, no `npm run build`) and verify.mjs lumped that into the
    same exit-1 bucket as a real signature regression.
  - verify.mjs now reserves exit 2 strictly for precondition misses:
      * @noble/ed25519 not installed                → exit 2
      * every manifest entry missing AND manifest   → exit 2
        references /dist/ paths (= "dist not built")
    Real failures (signature invalid, specific marker regressed)
    keep exit 1. The scheduled runner can now distinguish
    "needs install/build" from "we broke something".
  - New CI guard: scripts/smoke-witness-verify-precondition.mjs
    drives all three shapes (missing dep, all-files-missing,
    built tree) and asserts the exit code contract.
  - Wired into v3-ci.yml as witness-verify-precondition-smoke and
    into witness-verify's `needs:` so a contract break blocks publish.

#2019 — vectorBackend controller permanently disabled
  - @claude-flow/memory's controller-registry.ts calls
    agentdb.getController('vectorBackend'). agentdb@3.0.0-alpha.14's
    getController switch only handles memory/reflexion/skills/causal
    and throws `Unknown controller: vectorBackend` for everything else
    — silently swallowed, leaving the controller `enabled: false`
    even though `agentdb.vectorBackend` is a real field on the
    instance (assigned in AgentDB.initialize()).
  - Registry now probes `agentdb[name]` directly first, falls back to
    getController only when the field is absent. Applied to all three
    accessor paths (initializeController, get, isEnabled).
  - RuntimeConfig gains an optional `agentdb` injection field so
    tests and consumers with a pre-built AgentDB can govern it via
    the registry.
  - Two new tests in controller-registry.test.ts cover both branches
    (direct property wins; falls back to getController when absent).
  - Full controller-registry suite stays green (67 tests).

#2015 — ruflo-browser session_record fails every call
  - ruvector@0.2.25 makes `-d, --dimension <n>` required on
    `rvf create`. The browser_session_record MCP tool wrapper invoked
    `rvf create … --kind browser-session` WITHOUT the flag, so every
    call returned `{ success: false, error: "rvf create failed" }`.
  - All five call sites updated to pass `--dimension 384` (matches
    MiniLM-L6 / AgentDB index default):
      v3/@claude-flow/cli/src/mcp-tools/browser-session-tools.ts
      plugins/ruflo-browser/scripts/replay-spike.sh
      plugins/ruflo-browser/agents/browser-agent.md
      plugins/ruflo-browser/skills/browser-record/SKILL.md
      plugins/ruflo-browser/docs/adrs/0001-browser-skills-architecture.md
  - New CI guard: scripts/smoke-browser-rvf-create-flags.mjs
    statically scans every `rvf create … --kind browser-session`
    invocation across the repo (TS, dist, shell, markdown) and
    fails if any is missing --dimension / -d.
  - Wired into v3-ci.yml as browser-rvf-create-flags-smoke and into
    witness-verify's `needs:` so a regression blocks publish.

Cases covered by guards: source-only checkout (no deps), source-only
checkout with build, built tree, missing dimension flag on TS/dist/
shell/markdown call sites. The smokes are independent jobs so the CI
summary names the specific contract that broke.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-16 08:44:51 -04:00
Reuven d5dbfa4b92 fix(hooks): #2017 — defensive pre-bash + new CI gate against silent-swallow shape
The pre-bash PreToolUse hook in .claude/helpers/hook-handler.cjs is a
security gate that refuses dangerous commands. In 3.6.30 it read the
wrong stdin field (`toolInput` object instead of `toolInput.command`
string), `.toLowerCase()` threw TypeError, the global safety-timer
try/catch swallowed it, and the handler printed misleading
"[OK] Command validated" while exiting 0 — letting `rm -rf /` through.

The bind-the-string fix already landed in alpha.39 via #1944. This
commit adds:

1. Belt-and-suspenders defensive coding — wrap with String(... || '')
   so any future regression that re-binds command to null/undefined/an
   object can no longer throw and silently exit 0.

2. New dedicated CI job `pre-bash-hook-smoke` (#2017) that drives real
   Claude-Code-shaped PreToolUse JSON into BOTH handler copies and
   fails on any of:
     - dangerous command + exit 0 (the security bypass)
     - "[OK] Command validated" on a dangerous input (misleading log)
     - "[WARN] Hook X encountered an error" anywhere (silent-swallow)
   Wired into witness-verify's needs:, so the gate now blocks publish.

3. Path filters extended: '**/.claude/helpers/hook-handler.cjs' triggers
   the smoke whenever either handler copy changes.

Cases covered: dangerous rm -rf /, fork-bomb, format c:, null command
field (defensive), empty payload, snake_case tool_input.command shape
(the exact #2017 reproduction), innocuous ls -la.

Ships as 3.7.0-alpha.40 to all three packages.
2026-05-15 22:29:21 -04:00
Reuven 1430b4c76e fix(embeddings): #2018 — drop @huggingface/transformers from optionalDependencies (npx Invalid Version)
Same failure shape as #1147: `npx @claude-flow/cli@latest` crashes with
`npm error Invalid Version: ` on npm 11.x / Node 24+.

Root cause: @claude-flow/embeddings declared @huggingface/transformers in
both `optionalDependencies` AND `peerDependencies` (with
peerDependenciesMeta.optional = true). When npm 11.x arborist runs
PlaceDep.pruneDedupable → Node.canDedupe → semver.eq, the overlap plus a
"-dev." prerelease transitive (onnxruntime-web@1.26.0-dev.…) trips the
empty-version crash inside @npmcli/arborist.

Fix:
- @claude-flow/embeddings: keep only the optional peerDependency, drop
  the duplicate optionalDependencies entry. Bumped to 3.0.0-alpha.17.
- @claude-flow/cli: pin embeddings to ^3.0.0-alpha.17 so existing
  lockfiles re-resolve to the fixed version. Bumped to 3.7.0-alpha.39.

Regression guards (so this can't recur):
- scripts/audit-package-dep-overlap.mjs — static check that no package
  declares the same name in BOTH optionalDependencies and
  peerDependencies. Wired into v3-ci.yml as part of the
  plugin-package-audit job.
- scripts/smoke-cli-npx-install.mjs — behavioural smoke: pack the CLI
  tarball, install it into a scratch project with optionals enabled,
  fail if `npm install` prints "Invalid Version:" or exits non-zero.
  New v3-ci.yml job `cli-npx-install-smoke` runs on Node 22 + 24
  (Node 24 ships npm 11.x, where the bug surfaces) and gates witness-verify.

Verified end-to-end:
  $ npx -y @claude-flow/cli@3.7.0-alpha.39 doctor
  ✓ MCP Servers, AIDefence, Disk Space, TypeScript … 10 passed
2026-05-15 21:44:39 -04:00
rUvandReuven 29ea78f21e chore(release): 3.7.0-alpha.38 — ADR-120 Step 3 (Rust peer crate) + Step 2 path update (#2010)
Cuts alpha.38 covering #2009 (Rust peer crate + midstreamer@0.3.1 path
update). Tests: cargo (3/3), vitest (555/555), audit (31/31).

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 23:01:35 -04:00
rUvandReuven 6e0ced7935 chore(release): 3.7.0-alpha.37 — ADR-119 + ADR-120 + Step 2 loader (#2008)
Cuts the alpha.37 release covering the three midstream-related PRs
merged today:

  #2005 — ADR-119 — midstreamer adoption assessment (decision: wait)
  #2006 — ADR-120 — cross-port plan (Steps 1-3)
  #2007 — ADR-120 Step 2 — midstream-aware federation transport loader

Source changes are TS-only + audit guards; no native build surface
change. The midstream-aware loader is opt-in via MIDSTREAMER_QUIC_NATIVE
and falls through transparently to the agentic-flow loader otherwise,
so behavior on the published package is unchanged today.

  • audit-fix-invariants.mjs: 27 invariants across 16 files (was 25/14)
  • Federation plugin tests: 555/555 passing
  • Type-check: clean

Bumps all 3 packages (@claude-flow/cli, claude-flow umbrella,
ruflo umbrella) to 3.7.0-alpha.37.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 22:29:40 -04:00
rUvandReuven 91657b9fce chore(release): 3.7.0-alpha.36 — 10 fixes + audit guard update (#2001)
Cuts the alpha.36 release covering today's 10 PRs (#1992-#2000):

  #1989 statusline RFE1 cascade        (#1992)
  #1987 memory stats HNSW persistent    (#1993)
  #1973 Windows install README          (#1994)
  #1948 platform-aware statusLine cmd   (#1995)
  #1937 memory_import_claude excl.      (#1996)
  #1921 @opentelemetry/core override    (#1997)
  #1910 MCP stdio stdout protection     (#1998)
  #1880 verify.mjs actionable error     (#1999)
  #1872 SwarmCoordinator (2 of 5)       (#2000)
  #1990 runtime-smoke gate count

Plus 9 new invariants added to `scripts/audit-fix-invariants.mjs`
covering the source-side fixes (statusline magic-bytes, page-count
clamp, memory-stats persistent count, platform-aware statusLine,
exclusion-patterns flag, otel pin, MCP stdio mode + uncaught
handler, scaleAgents target semantics, executeTask try/catch).

Result: `node scripts/audit-fix-invariants.mjs`
  → 25 invariants across 14 file(s), all present.

Bumps all 3 packages (@claude-flow/cli, claude-flow umbrella,
ruflo umbrella) to 3.7.0-alpha.36.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 21:38:14 -04:00
rUvandReuven 0873f81463 fix(mcp): protect stdout from stray console.log in stdio MCP mode (#1910) (#1998)
A broad MCP tool smoke test bricked the transport mid-batch: after
hooks_pre_task ran, every subsequent hooks_* / mcp_* call returned
`Transport closed`, including mcp_status. Root cause is stdout
protocol corruption — Codex closes the MCP transport the moment it
sees a non-JSON line on fd 1, and one or more of the modules that
hooks_route lazy-loads (@ruvector/router, @claude-flow/neural,
transformers.js/ONNX, semantic-router init) emits a diagnostic via
console.log into the JSON-RPC stream.

Defense in three layers, all in `startStdioServer()`:

1. **Hijack console.log/info/debug → stderr.** As the first thing
   the server does, replace those three methods with stderr writers
   prefixed `[stdout→stderr]`. Any subsequent module that calls
   `console.log(...)` (lazy-loaded or otherwise) goes to stderr
   instead of corrupting the protocol. `console.error` is
   unchanged.

2. **`writeFrame()` helper for JSON-RPC.** All three
   server-originated frames (`server.initialized`, the
   `Request too large` error, and tool responses) go through a
   dedicated helper that calls `process.stdout.write(...)`
   directly. The hijack above can't redirect protocol frames
   because they bypass `console.log` entirely.

3. **uncaughtException + unhandledRejection handlers.** Previously
   only SIGINT/SIGTERM were caught — an unhandled rejection in a
   lazy-loaded module's init (very common during the hooks
   semantic-router race the issue describes) crashed the server
   silently. Now those go to stderr with the full stack and the
   process stays up.

Plus: sets `process.env.MCP_STDIO_MODE = '1'` so downstream code
that wants to behave differently in stdio mode can probe a single
flag.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 21:04:17 -04:00
rUvandReuven ced2abc200 feat(memory): excludeFilePatterns/excludeFiles for memory_import_claude (#1937) (#1996)
`memory_import_claude` only had `allProjects: true/false` granularity.
Voice-fidelity-aware operators (named-persona content, PII-aware
hygiene) couldn't bulk-import without contaminating the unified
`claude-memories` namespace with the subset of files they had to
exclude. The current workaround was to halt imports entirely.

Two new params:

  excludeFilePatterns: string[]
    Glob patterns matched against the absolute file path. Files
    matching ANY pattern are skipped. Supports:
      `**`  any chars including path separators
      `*`   any chars except path separators
      `?`   exactly one char except a path separator
    Example: ["**/voice-*.md", "**/persona-*.md"]

  excludeFiles: string[]
    Absolute file paths to skip verbatim. Faster than a pattern when
    the operator already has a list captured.

Both apply to either branch (`allProjects: true` or single-project).
The response gains an `excludedByPattern` counter so callers can
verify the exclusion ran.

A minimal `globToRegex` helper is added (anchored, escapes regex
metas, handles `**` / `*` / `?`). Verified four representative
cases pass; the unrelated regex escapes the issue's voice-fidelity
patterns need.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 20:36:37 -04:00
rUvandReuven 1f8971d16b fix(init): platform-aware statusLine command (#1948) (#1995)
The statusLine command was hardcoded as
`sh -c 'D="${CLAUDE_PROJECT_DIR:-.}"; … exec node "$D/<script>"'`
on every platform. On native Windows (cmd / PowerShell, no
Git-Bash) `sh` either isn't on PATH or its quoting gets mangled.
Symptom in #1948: spurious files like `0)` or
`toastr.error('ESD...` appearing in the repo root because misparsed
shell tokens leak back into the file system as filenames.

Fix: detect `process.platform === 'win32'` at init time and emit a
shell-free command instead — a `node -e "…"` one-liner that
resolves the script path internally using `process.env`. No shell
quoting hazards because the resolution happens inside Node, not in
the shell.

  Windows: node -e "const fs=require('fs'),p=require('path');
    const d=process.env.CLAUDE_PROJECT_DIR||'.';
    const f=p.join(d,'.claude/helpers/statusline.cjs');
    const h=p.join(process.env.USERPROFILE||process.env.HOME||'.', '.claude/helpers/statusline.cjs');
    require(fs.existsSync(f)?f:h);"

  POSIX:   unchanged (sh -c with project-dir / HOME fallback)

Verified both branches emit valid JSON when generated through the
real settings-generator path on each platform.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 20:14:14 -04:00
rUvandReuven 6b9250ea8c fix(memory): memory stats HNSW count reads persistent DB (#1987) (#1993)
`memory stats` always reported `HNSW Index: active (0 entries)` even
when `memory store` had just stored a vector and `memory search`
successfully retrieved it. Root cause: the rendered count was
`hnsw.entryCount`, which is the live in-process JS state
(`hnswIndex?.entries.size`). A fresh `memory stats` invocation has
never initialized HNSW in this Node process, so the in-process
counter is always 0 — even when the persistent .swarm/memory.db has
many entries with embeddings.

Fix: prefer the persistent count from the `memory_stats` MCP tool,
which already computes `entriesWithEmbeddings` by listing the DB's
real rows. Fall back to the live counter when persistent count
isn't available. When both are non-zero, take the max (covers the
edge case where the live process has indexed more entries than the
persisted store has flushed).

Behavior matrix:

  hnsw.available  persisted  live    →  rendered
  false           any        any     →  "not active"   (unchanged)
  true            0          0       →  "available but not initialized"
  true            N>0        any     →  "active (max(N,live) entries)"
  true            0          M>0     →  "active (M entries)"    (unchanged)

Adds `entriesWithEmbeddings?: number` to the stats result type so
TypeScript is happy. The MCP tool already returns this field; this
just teaches the consumer to read it.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 19:44:08 -04:00
rUvandReuven 4680a2c044 fix(statusline): guard SQLite header read on encrypted memory.db (#1989) (#1992)
Resolves #1989. When encryption at rest is enabled, `.swarm/memory.db`
becomes an RFE1-magicked ciphertext blob rather than a SQLite
database. The statusline-generator's "page count at offset 28"
fallback read ciphertext bytes as a uint32 and rendered
3,367,093,602 patterns, which then cascaded into fake DDD 5/5 /
100% / intelligence 100% downstream.

Three defense layers, all in `statusline-generator.ts` (the template
that `ruflo init` writes to `.claude/helpers/statusline.cjs`):

  1. **Magic-bytes check** -- compare the first 16 bytes against the
     literal "SQLite format 3\\0" before interpreting any subsequent
     bytes. Encrypted, empty, or non-SQLite files are skipped.

  2. **Page-count sanity clamp** -- reject pageCount > 1,000,000
     (~4GB DB). Catches future regressions or genuinely corrupt
     headers even on plaintext SQLite.

  3. **Defensive consumer clamps** in `getV3Progress` and
     `getSystemMetrics` -- `Number.isFinite` + range check on
     `learning.patterns` before deriving domainsCompleted /
     intelligencePct. If any future regression in the reader returns
     a wild value, the downstream displays stay honest.

Verified with a fake RFE1-headered `memory.db` matching the
forensic bytes from the issue:

  Before: DDD Domains 5/5 / 100% / patterns=3367093.6k / 🧠 100%
  After:  DDD Domains 0/5 /   0% / patterns=0          / 🧠   0%

The `\\0` in the SQLite-magic string is intentional: the
statusline-generator emits via a JS template literal, so the
source-level `\\\\0` resolves to `\\0` in the generated .cjs which
JS then parses as the null byte.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-14 19:40:10 -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
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 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>
2026-05-13 13:33:44 -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 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