Patch release covering the statusline/memory-integrity fix batch
merged in #2746, #2747, #2748, #2749 (issues #2733, #2735, #2736,
#2737, #2742).
Also fixes an npm EOVERRIDE conflict this batch introduced:
v3/@claude-flow/cli/package.json had gained both a direct
optionalDependency on better-sqlite3 (^12.9.0, from #2748) and a
self-referential override pinned to an exact "12.9.0" (from #2736)
for the same package — npm publish rejects an override that doesn't
match its own direct dependency's spec string. Aligned the override
to the same "^12.9.0" range so the dedup guarantee holds without the
conflict.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(security): dedup better-sqlite3 to patched 12.9.0 across dependency tree
Fixes#2736 (defense-in-depth mitigation).
SQLite's documented WAL-Reset Bug (sqlite.org/wal.html §11) is a race
between overlapping checkpoint operations and a WAL-resetting commit
that can make a later checkpoint skip a committed transaction, silently
losing acknowledged writes and/or corrupting index/table structure.
Affects SQLite 3.7.0-3.51.2; fixed in 3.51.3, backported to 3.44.6 and
3.50.7.
agentdb's own published dependency floor (`better-sqlite3@^11.8.1`,
confirmed in this tree resolving to 11.10.0, which bundles vulnerable
SQLite 3.49.2) created a mixed-engine tree alongside this repo's own
direct dependency on better-sqlite3 12.9.0 (patched SQLite 3.53.0, via
v3/@claude-flow/memory). Multiple concurrent connections (daemon, MCP
servers, CLI invocations) issuing wal_checkpoint(PASSIVE) after every
memory-bridge store is exactly the race precondition this bug requires.
This forces a single deduplicated better-sqlite3 build tree-wide via
pnpm overrides, pinned to the exact version this repo's own
@claude-flow/memory package already depends on directly (12.9.0,
bundling patched SQLite 3.53.0) — no new version to vet, just true
deduplication of agentdb's nested resolution into the already-patched
copy.
Changes (following this repo's existing #2112-lesson override
convention — multiple package.json files, each consumed a different
way):
- v3/package.json: pnpm.overrides (the v3 pnpm workspace root — this
is where agentdb's better-sqlite3@11.10.0 actually lived pre-fix)
- v3/@claude-flow/cli/package.json: npm-style overrides (effective
when @claude-flow/cli is npm-installed standalone via npx)
- package.json (root "claude-flow" umbrella): bumped the existing
">=12.8.0" override to an exact "12.9.0" pin, AND added a
pnpm.overrides block — the bare "overrides" key alone is silently
ignored by pnpm (only read by npm), so the pre-existing override was
a no-op for local `pnpm install` at repo root despite being present
in package.json for a while
- ruflo/package.json: bumped ">=12.8.0" to exact "12.9.0" (npm-style,
effective for `npx ruflo@latest`)
- v3/pnpm-lock.yaml, pnpm-lock.yaml: regenerated via `pnpm install`
Verification:
- `pnpm why -r better-sqlite3` (v3/) and `pnpm why better-sqlite3`
(root): exactly one resolved version, 12.9.0, everywhere
- Confirmed via realpath resolution (not hoisted symlink) from each of
the 4 installed agentdb versions' own on-disk directories
(1.6.1, 2.0.0-alpha.3.4, 2.0.0-alpha.3.7, 3.0.0-alpha.17) that each
now binds the same deduplicated better-sqlite3@12.9.0 copy
- `db.prepare('select sqlite_version()').get()` from that binding
returns 3.53.0 (>= 3.51.3 patched floor)
- v3/@claude-flow/memory test suite: 438/442 passing; the 4 failures
are pre-existing Windows path-separator and perf-threshold issues
unrelated to SQLite (none of the failing test files touch
better-sqlite3/sqlite at all)
Not fixed here (upstream, out of reach from this repo):
- agentdb's own published package.json floor (`^11.8.1`) is
unchanged — this override is a same-repo mitigation, not a fix to
agentdb itself. agentdb needs the same bump upstream.
Not touched here (explicitly out of scope, separate/riskier change):
- The wal_checkpoint(PASSIVE)-after-every-store pattern in
memory-bridge.ts (#2558) is left as-is; the issue calls that
"defense-in-depth" / optional, and dedup alone removes the
mixed-engine race precondition regardless.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(deps): regenerate package-lock.json for better-sqlite3 dedup override
package.json pins the better-sqlite3 override to 12.9.0 (patched,
fixes the WAL-reset bug) but package-lock.json still resolved a stray
top-level better-sqlite3@12.10.0 and was missing the nested
better-sqlite3@12.9.0 entries under @claude-flow/memory, agentdb, and
agentic-flow — causing npm ci to fail in CI with "Missing:
better-sqlite3@12.9.0 from lock file".
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(deps): restore better-sqlite3 as direct root optionalDependency
The #2736 dedup fix pinned better-sqlite3 to 12.9.0 via a pure
"overrides" entry (no direct dependency), which removed the top-level
hoisted node_modules/better-sqlite3 that used to exist under the
looser ">=12.8.0" override. That silently broke the "graph schema
smoke (ADR-130 P1)" CI job: its "npm rebuild better-sqlite3" step
(and graph-edge-writer.ts's bare `await import('better-sqlite3')`,
which Node resolves by walking up node_modules from the importing
file) had nothing at the root to rebuild/resolve, so _openDb() failed
closed and insertGraphEdge() silently returned false — 8/22 assertions
failing.
Restoring the direct optionalDependency (matching what this file
already had historically, before the override-only refactor) gives
npm a concrete anchor to hoist a single deduplicated copy back to
root node_modules, preserving the override's version pin while
keeping the graph-edge-writer's resolution path intact. Regenerated
package-lock.json accordingly.
Verified locally: `npm rebuild better-sqlite3` now finds and rebuilds
the root copy, and a direct insertGraphEdge() call against a real
better-sqlite3 handle returns true.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(deps): resync v3/pnpm-lock.yaml specifier after merging main
Merging main (which carries #2748's direct better-sqlite3 dependency
on @claude-flow/cli) forward into this branch left the recorded
lockfile specifier at the pre-override "^12.9.0" while this branch's
own overrides.better-sqlite3 pin ("12.9.0", exact) is now the
effective spec pnpm resolves against — a one-line drift causing
`pnpm install --frozen-lockfile` to fail across the whole v3-ci.yml
matrix. Regenerated to match.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(memory): force WAL checkpoint before close in graph-edge-writer
The "graph schema smoke (ADR-130 P1)" CI job started failing
deterministically on Linux runners after the better-sqlite3 dedup
(this branch) pinned a single 12.9.0 build tree-wide: TEST 2/3
insert-then-reread assertions found embedding_ref/source_id undefined
immediately after _resetBridgeDb() closed the write connection.
_resetBridgeDb()'s close() relied on SQLite's implicit "last
connection close" PASSIVE auto-checkpoint to flush the WAL into the
main file before a same-process sql.js reader re-reads the raw file.
That's best-effort, not guaranteed synchronous, and evidently more
prone to leaving data in the WAL under Linux CI's I/O/lock timing than
on Windows (did not reproduce locally). Not a correctness regression
in 12.9.0 itself — a latent timing assumption the dedup made newly
observable by changing which exact build backs every connection.
Force a blocking `wal_checkpoint(TRUNCATE)` before close so the main
file always reflects committed writes before any other reader (same
process or otherwise) touches it, regardless of platform timing.
Co-Authored-By: RuFlo <ruv@ruv.net>
Fixes#2735 (scoped).
Every memory CRUD op (storeEntry/getEntry/deleteEntry in
memory-initializer.ts) falls back to a raw sql.js path when the native
better-sqlite3 bridge is unavailable: read the whole database image,
mutate an in-memory copy, export() it, and rename the result over the
live database path. That rename does not participate in SQLite's
WAL/locking protocol at all -- if a native WAL connection is attached
(daemon, an MCP server, another CLI invocation), the rename strands
every open native connection on a deleted inode and can leave the
surviving -wal (paired to the new image by filename only, per SQLite's
own documented file format) applied to unrelated data, corrupting the
database or silently losing an already-acknowledged write.
Fix (a scoped subset of the fuller design discussed in the issue, not
the complete proposal -- see below): before performing the whole-image
write, refuse if `-wal`/`-shm` sidecar files exist next to the
database. A native WAL connection keeps its sidecars on disk for its
entire lifetime (removed only on the last connection's clean close),
so their presence is strong evidence of a live native holder, and
their absence means the image is a clean, checkpointed, standalone
file safe for sql.js to read-modify-write. Refusal returns a typed
`success: false` + descriptive error (never a whole-image write, never
a silent partial success) -- the CLI layer (commands/memory.ts) was
already correctly wired to turn `result.success === false` into a
nonzero exit code, verified by inspection, no change needed there.
Also fixed the completely silent bridge -> sql.js demotion (memory-
bridge.ts): both the process-wide cached failure (getRegistry's own
catch) and the four bridge functions with a corresponding unsafe
fallback (bridgeStoreEntry/bridgeGetEntry/bridgeDeleteEntry/
bridgePurgeNamespace) now log once per distinct failure reason to
stderr (never stdout, which callers may parse as JSON) -- previously
a demotion left zero diagnostic trail, which is exactly what made a
real corruption incident in the issue's field report unattributable
after the fact.
Verified as already fixed, no change needed: the issue's "closely
coupled destroy-path" concern (ensureInitialized -> a malformed
database silently replaced by an empty one) does not reproduce against
current main. initializeMemoryDatabase already has an idempotent-
reinit guard (#1791.6: existing + !force -> no overwrite, just
repairVectorIndexes), and repairVectorIndexes/recoverMemoryDatabase
already implement a real backup-verify-swap recovery flow with a
native quick_check gate and a busy-writer backoff (BEGIN IMMEDIATE,
returns 'writer-active' rather than racing a live writer) -- already
close to the "cooperative-drain recovery" the issue proposed.
Explicitly NOT done (scope decision, not an oversight): the fuller
process-holder-scanning design also discussed in the issue (a
/proc/<pid>/fd scan on Linux, lsof elsewhere, to close the narrow
assess-then-write race a sidecar-only check can't) is a larger,
platform-specific surface deserving its own dedicated review --
tracked as a follow-up, not attempted here. ensureSchemaColumns'/
applyTemporalDecay's own independent whole-image write sites remain
unguarded (lower frequency/severity per the issue's own analysis).
The "native WAL mutation as the primary path for every mutator"
rewrite (replacing all 7 db.export() sites) is out of scope entirely
-- a multi-day architectural change, not something to rush.
Verified: 8/8 new regression tests pass (storeEntry/getEntry/
deleteEntry each: refuses with -wal present, refuses with -shm
present, proceeds normally with neither, plus a "refused store never
touches the file" assertion). Clean tsc --noEmit. Confirmed the
`memory-search-recall-2558`/`commands.test.ts` full-suite failures
seen locally are pre-existing (identical on unmodified main via git
stash comparison) and non-deterministic (different failures each
full-suite run) -- unrelated to this change; all affected suites pass
cleanly in isolation.
* fix(doctor): wire real memory-DB checks into the default doctor run
Fixes#2737
Bare `doctor` / `doctor --fix` ran `allChecks`, whose only memory probe
was `checkMemoryDatabase` — existsSync()+statSync() only, so it PASSES
for any file that exists and can be stat'd, corrupt or not. The real
integrity/content/embedding checks added for #2677
(checkMemoryIntegrity/checkMemoryContent/checkMemoryEmbeddingCoverage)
were only reachable via `--component memory`, never the default run —
so a genuinely corrupt .swarm/memory.db could report "All checks
passed! System is healthy." on a bare `doctor` call.
Three-part fix:
1. Add `checkMemoryStructuralIntegrity` to the default `allChecks` run —
a bounded, native (better-sqlite3, WAL-aware) `PRAGMA quick_check`,
explicitly labeled "structural-only" in its name/message. Cheaper
than the deep trio (skips UNIQUE/index cross-checks quick_check
deliberately omits) but bounded enough to run unconditionally.
`checkMemoryDatabase`'s reported row is relabeled "Memory Database
Presence" to be honest about its existence-only scope; behavior is
unchanged and it stays in `allChecks` too.
2. Strengthen `checkMemoryIntegrity` (deep, `--component memory` only,
full #2677 trio unchanged there): prefer native better-sqlite3
`PRAGMA integrity_check` (adds index<->table cross-checking + UNIQUE
verification quick_check skips, and is WAL-aware) when better-sqlite3
is installed, falling back to the existing sql.js probe — now
explicitly labeled "main-image-only" (WAL-blind) — when it's not.
3. A definitively malformed, unencrypted DB now maps to `fail`, not
`warn`, in both checks. Before failing, both sniff the file for the
product's RFE1 encryption-at-rest magic bytes (reusing
isEncryptedBlob() from encryption/vault.ts, the same detector
checkEncryptionAtRest uses) so a legitimately encrypted-at-rest DB is
never misclassified as corrupt.
better-sqlite3 added to @claude-flow/cli's optionalDependencies
(matching the existing optional-dep pattern in @claude-flow/memory and
@claude-flow/hooks) with an ambient module declaration in
optional-modules.d.ts; every code path that touches it degrades to the
sql.js fallback (or a warn) on MODULE_NOT_FOUND.
Verified:
- New __tests__/doctor-2737-memory-structural.test.ts (7 cases): healthy
DB passes including the new check; malformed DB fails the new check
and the overall run reports failed>0/exitCode 1 (not "all healthy");
a real RFE1-encrypted blob is not misclassified as corrupt;
`--component memory` still runs the full unchanged trio; both
encryption-carve-out cases for checkMemoryIntegrity directly.
- Full existing doctor-*.test.ts suite (19 tests total) still passes.
- Manual repro: `node bin/cli.js doctor` against a scratch dir with a
garbage .swarm/memory.db now prints "Memory Structural Integrity
(quick_check): ... file is not a database" as a hard FAIL and exits 1
(previously: silent PASS via checkMemoryDatabase, exit 0). Re-verified
with a valid DB (exit 0, quick_check: ok) and via
--component memory (full trio, native integrity_check path
confirmed).
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(deps): regenerate v3/pnpm-lock.yaml for better-sqlite3 dep
The doctor memory-integrity fix added a direct better-sqlite3
dependency to @claude-flow/cli/package.json but didn't regenerate
the workspace lockfile, causing pnpm install --frozen-lockfile to
fail in CI (v3-ci.yml's lockfile-drift guard and Test V3 Packages).
Co-Authored-By: RuFlo <ruv@ruv.net>
Fixes#2733, #2742.
#2733 — hooks.ts's getUserInfo() hardcoded
`const modelName = 'Opus 4.6 (1M context)'`, ignoring the actual active
model Claude Code passes on stdin entirely. Cosmetically masked in the
default render path (the generated .claude/helpers/statusline.cjs
already parses stdin correctly and overrides this), but real for
direct/manual `hooks statusline` CLI use or any stdin-parse failure in
the wrapper. Fixed by mirroring statusline.cjs's own getModelFromStdin()
approach inside hooks.ts, so the CLI subcommand is correct standalone.
#2742 — getPkgVersion() in the generated statusline.cjs only probed
CWD-relative paths (CWD/node_modules/..., CWD/v3/@claude-flow/cli/...).
A linked git worktree has no node_modules of its own (worktrees don't
get their own `npm install`), so every probe missed and the version
silently fell back to the baked-in default from whenever the helper was
last generated. Fixed with a pure-fs worktree-root resolver: a linked
worktree's `.git` is a plain FILE containing `gitdir: <main>/.git/
worktrees/<name>`; walk up from CWD, parse the pointer, strip the
trailing segment to recover the main repo root, and probe its
node_modules/v3 paths too. No `git rev-parse` spawn (statusline renders
are latency-sensitive). Caught and fixed a real bug in this same
resolver during testing: git writes the gitdir pointer with forward
slashes even on native Windows, so a path.sep-based (backslash) marker
search silently never matched — normalize to forward slashes before
searching.
`v3/@claude-flow/cli/.claude/helpers/statusline.cjs` is the source of
truth per the #2679 redesign (generateStatuslineScript() reads it and
substitutes two tokens); regenerated the propagated root-level copy via
scripts/regen-statusline-artifact.mjs, which also needed a small
cross-platform fix (dynamic import() of a raw Windows path isn't a
valid ESM specifier — wrap with pathToFileURL()).
Also corrected a stale/misleading comment in message-transport.ts
claiming a fresh install "shows the in-code fallback pool until the
first refresh lands" — there has never been an in-code fallback pool
since ADR-311 ("zero local promo content"); a fresh install's promo
row is genuinely empty until the first background refresh lands.
Found while investigating a "promo doesn't show on new installs"
report; the underlying fail-closed design and SessionStart-triggered
refresh mechanism were confirmed working as intended (this machine's
own ~/.ruflo state shows a healthy, recently-rotated promo history) —
only the comment was wrong, not the behavior.
Left alone (separate, unreferenced, ~500-line legacy implementation
predating the #2195 delegation rewrite, no source references in its
own package): v3/@claude-flow/mcp/.claude/helpers/statusline.cjs.
Verified: 21/21 new + existing statusline tests pass, 122/122 funnel
tests pass, 10/10 hooks tests pass, clean tsc --noEmit. Manually
confirmed #2733 (real stdin model name renders; malformed/empty stdin
falls back to "Claude Code", never the old hardcoded string) and #2742
(a real `git worktree add` scenario resolves the main repo's version
instead of falling back) end-to-end.
RUFLO_HOOK_CLI_OVERRIDE and RUFLO_HOOK_DEBUG_STDOUT (both added to
plugins/ruflo-core/scripts/ruflo-hook.cjs to let test-hooks.mjs point
at a local CLI build and observe its output) tripped the
env-var-precedence audit's "CLI flag must win" requirement. Same
category as the existing RUFLO_HOOK_SKIP_NPX entry: hook scripts have
no CLI-flag surface to attach to (invoked by hooks.json, never a
user-typed command), and both are test-only — production never sets
them.
The #2721 hooks.json rewrite legitimately moved the -f/-s CLI-flag
construction logic out of hooks.json and into scripts/ruflo-hook.cjs,
which drifted the #1862 witness marker (it cited the literal bash
string that no longer exists). Re-anchored the marker to the new
location: plugins/ruflo-core/scripts/ruflo-hook.cjs, marker
"['-f', String(file), '-s', 'true']" -- the actual flag-construction
line that replaced the old bash string.
Also did a full witness regen for all three manifests (linux/macos/
windows) against a properly built tree, refreshing the 14 other
entries that had gone stale (sha256 no longer matching current file
content, though their marker text was still verified present --
"drift" per verify.mjs's own terminology, not a real regression: only
"regressed" i.e. marker text actually missing counts as a failure).
Confirmed those 14 are pre-existing on main, unrelated to this PR
(zero diff against origin/main for every file they cite), and were
already recorded as unverified in the previously-committed manifest --
this regen doesn't mask or fix any of them, it just brings sha256
current. All three manifests now show pass=117/drift=0/regressed=0/
missing=0.
(Regenerated with an OS-aware variant of regen.mjs's own algorithm,
since the tool's osDir() stamps whatever OS it's actually run on --
regenerating linux/macos manifests from this Windows machine via the
CLI as-is would have mislabeled their "os" field.)
Also fixed plugins/ruflo-cost-tracker/scripts/smoke.sh's step 28b,
which asserted literal substrings (track.mjs, TRACK_QUIET=1, || true)
directly in hooks.json -- true before #2721, no longer true now that
those live one level down in ruflo-hook.cjs. Updated to verify the
indirection is actually wired (hooks.json references ruflo-hook.cjs,
which references track.mjs/TRACK_QUIET/a resilient always-exit-0 done()).
Both plugins' hooks.json wrapped every command in `/bin/bash -c '...'`,
which fails outright on native Windows (no such path) -- Codex/Claude
Code report "PreToolUse hook (failed) -- exit code 1" on every tool
call. The `_platform: posix` / "ruflo init overrides this on Windows"
claim in both files was never actually true: Claude Code merges
plugin-declared hooks additively with any init-generated
.claude/settings.json, it doesn't replace them, and there's no `ruflo
init` step at all in the reported Codex marketplace install flow.
Fix: every hook command is now a `node -e` bootstrap that resolves
plugins/*/scripts/ruflo-hook.cjs from process.env.CLAUDE_PLUGIN_ROOT
inside Node -- no shell env-var expansion (${VAR} vs %VAR%), so the
exact same command string runs unchanged on Windows/macOS/Linux.
ruflo-core's ruflo-hook.cjs (previously a full port of ruflo-hook.sh
that existed on disk but was never referenced by hooks.json) gained:
- JSON parsing of the hook event from stdin (replaces jq) for
post-command/post-edit, deriving the same CLI flags the bash
version computed
- the PreToolUse permission-allow stdout echo Cursor's stricter
contract requires (previously only the bash wrapper's trailing
printf did this)
- precompact-manual/precompact-auto guidance text (previously plain
bash echoes, no CLI call)
- a real Windows shell-quoting fix: shell:true with an args array
does NOT quote array elements, so "echo hi" silently truncated to
"echo" and a heredoc's `<<` errored as unexpected -- skip the
shell entirely for `node` invocations (never a .cmd shim, so
CreateProcess gets the argv array byte-for-byte)
cost-tracker's existing ruflo-hook.cjs (already correct, just
orphaned) needed no logic changes, only wiring.
Also:
- corrected the false "_platform_note" claims about ruflo init
overriding plugin hooks
- hardened scripts/audit-plugin-hooks-cross-platform.mjs: a
POSIX-exempt hooks.json now must actually reference its sibling
.cjs shim, not just have one sitting on disk unreferenced (which
is exactly the shape cost-tracker shipped in undetected)
- added windows-latest to the plugin-hooks-smoke CI matrix (it was
ubuntu/macos-only because the old bash-based hooks.json couldn't
run on Windows at all) and rewrote test-hooks.mjs to drive hooks.json's
literal command strings via `shell: true` -- exactly how Claude
Code/Codex invoke them -- instead of wrapping everything in an
explicit `bash -c` that could never have caught this bug
- flagged (not fixed) a separate, currently-published, actively
maintained plugin package (.claude-plugin/ + plugin/, the older
"claude-flow" plugin, not listed in the ruflo marketplace) with
the same underlying bug via jq/xargs pipes instead of bash --
explicitly marked _legacy_unaudited_shim so the hardened audit
doesn't silently regress on out-of-scope work
Verified locally on native Windows (this fix's actual target
platform): all 17 ruflo-core hook cases pass, all 3 cost-tracker
cases pass, the existing 12-case smoke-ruflo-hook-cjs.mjs passes
unchanged, both hook-command audits pass clean.
Fixes#2721
Brings all three packages back into version lockstep (claude-flow had
been stuck at 3.32.2 while @claude-flow/cli and ruflo advanced to
3.32.7), fixing the "Plugin package install-safety" CI violation.
Bundles the pnpm-lock.yaml drift fix (#2719/#2717) and the
memory_search namespace-default fix (#2646), both already merged to
main, into this release.
Fixes#2646 (3rd occurrence of the #1123/#1131 bug shape).
Root cause: the memory_search MCP tool handler coerced an omitted
`namespace` parameter to the literal string 'default':
const namespace = (input.namespace as string) || 'default';
But both underlying search implementations already resolve an
omitted/undefined namespace to the 'all' sentinel (fan out across every
namespace):
const effectiveNamespace = namespace || 'all'; // memory-initializer.ts
const effectiveNamespace = namespace || 'all'; // memory-bridge.ts
'default' is truthy, so passing it explicitly defeated that fallback and
silently scoped the search to a namespace that is usually empty — exactly
matching memory_stats showing entries across other namespaces while
memory_search with no namespace returned 0 results. The CLI's `memory
search` command already got this right (defaults to 'all', not
'default'), which is what tipped this off as a tool-handler-only bug.
Fix: leave `namespace` undefined when the caller omits it, so the search
layer's own `|| 'all'` fallback actually fires. Also corrected the
inputSchema description, which previously (and misleadingly) documented
the empty-default behavior as intended.
Added __tests__/memory-search-namespace-default-2646.test.ts, which
mocks the search layer to assert the tool forwards `namespace: undefined`
(not 'default') and reproduces the issue's exact repro shape end-to-end.
Verified it fails against the pre-fix handler and passes against the fix.
Co-Authored-By: RuFlo <ruv@ruv.net>
pnpm-lock.yaml was still pinned to @claude-flow/security@^3.0.0-alpha.10
while v3/@claude-flow/cli/package.json had moved to ^3.0.0-alpha.12 in
076ccf3fe, without a matching lockfile regen. Every --frozen-lockfile CI
job (Type Check V3, Test V3 Packages, Build V3, etc.) has been failing
on main since, per issue #2719 and #2717.
Fixes#2719Fixes#2717
Issue #2670: security defend silently broken on 3.28.0+ because:
1. @claude-flow/aidefence was dropped from the dependency tree but
still dynamically imported by the defend command — import fails
with ERR_MODULE_NOT_FOUND when CLI is published standalone.
2. The catch block calls output.error() which is a string formatter
(returns a red string), not a printer — return value discarded so
the error message is never displayed (silent failure).
Fix:
- Add @claude-flow/aidefence (~3.0.2) to @claude-flow/cli
optionalDependencies, restoring the capability (same pattern as
@claude-flow/security and agentbbs per ADR-164).
- Replace output.error() -> output.printError() in both catch blocks
(AIDefence-not-installed + file-read-failure) so failures render to
stderr with [ERROR] prefix. printError is the existing canonical
error-printing method (used 10+ times in analyze.ts).
Closes#2670
getSecurityStatus() hardcoded totalCves=3 and counted scan *files* as
'CVEs fixed', fabricating '⚠ 3 CVEs' for every project. Now reads the
NEWEST scan in .claude/security-scans/ and surfaces its real findings
count (summary.total ?? totalFindings ?? findings.length). cvesFixed
stays 0 until a real fix-tracking mechanism exists.
Fixed in all 5 copies:
- v3/@claude-flow/cli/src/funnel/local-signals.ts (TS source of truth)
- v3/@claude-flow/cli/.claude/helpers/statusline.js (cli helper)
- v3/@claude-flow/mcp/.claude/helpers/statusline.cjs (mcp helper)
- v3/@claude-flow/mcp/.claude/helpers/statusline.js (mcp helper)
- v3/@claude-flow/hooks/src/statusline/index.ts (hooks statusline)
Also: executor.ts init defaults totalCves 3->0 (2 sites);
statusline/index.ts audit fallback defaults 3->0.
Added regression test issue-2694-cve-counter.test.ts (pure unit, no CLI).
Updated security-scan-persistence.test.ts to assert CLEAN/0/0 for the
empty fixture (was asserting cvesFixed>=1, the fabricated behavior).
Windows-only mitigation for anthropics/claude-code#67888 — Claude Code's Bash tool spawns cmd.exe/bash.exe without cleaning up child conhost.exe handles, so a long session accumulates dozens (observed live: 26+ orphaned conhost.exe after a ~4h session; each holds a kernel object + ~1MB). Combined with memory pressure this measurably slows the machine.
The new flag runs a targeted PowerShell cleanup that only touches conhost.exe (safe — Windows respawns on demand). Deliberately does NOT kill cmd.exe/bash.exe/node.exe: those can be the invoking shell or an active MCP server, and killing them would 255 the caller or disconnect ruflo's own MCP tools.
Reports before/after conhost count + free RAM delta. Early-return short-circuits the full health-check flow. On non-Windows platforms, prints a friendly "not applicable" and exits 0.
Also fixes a latent parser-quirk bug: `--fix-handles` was read as `ctx.flags['fix-handles']` but the arg parser camelCases kebab-case flag names to `ctx.flags.fixHandles`. (Init.ts's `no-codex-detect` / `no-skills-sh` reads probably have the same latent bug — filed as follow-up.)
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.32.0 (MINOR — new flag on existing command, backward-compatible addition per CLAUDE.md semver policy).
Co-Authored-By: RuFlo <ruv@ruv.net>
Before 3.31.3, autoRefreshHelpersIfStale only touched <cwd>/.claude/helpers. But Claude Code's global settings.json falls back to ~/.claude/helpers/statusline.cjs when no project-local override exists (executor.ts:460-462), and that global file was frozen at whatever version was current when the user last ran `ruflo init` — nothing refreshed it. So when the 2026-07-13 funnel/promo Line-3 row shipped (PR #2622), users who init'd earlier couldn't see it even after upgrading @claude-flow/cli — their global statusline literally didn't have the render code.
Fix:
- Extract per-dir refresh into refreshOneHelpersDir()
- Add alsoRefreshGlobal: boolean opt-in to autoRefreshHelpersIfStale — defaults FALSE so tests don't touch $HOME
- Real CLI entry (src/index.ts) passes alsoRefreshGlobal:true, activating the global pass in production
- Same forward-only semver.gte downgrade guard applies to both passes
- Result type gains optional `global` sub-object; top-level fields still describe the project pass (API compat)
Test additions: two new cases in helper-refresh.test.ts — one exercises the global pass end-to-end under a redirected HOME (proves the fix works), one asserts alsoRefreshGlobal:false is the default and never scaffolds under $HOME (invariant that keeps every other test in this file safe). All 9 tests pass.
Bumps @claude-flow/cli, claude-flow, and ruflo to 3.31.3 (PATCH — behavior extension, no API surface change; existing single-object return shape unchanged for callers that don't opt in).
Co-Authored-By: RuFlo <ruv@ruv.net>
3.31.1's `maybeInstallSkillsSh` fired unconditionally on every `ruflo init`, including `--force` reinits and `init upgrade`. Each call clones the ~50MB ruvnet/ruflo repo (skills CLI clones internally) and sends a fresh install telemetry event to skills.sh — silently inflating our own GitHub unique-cloners metric (rough estimate: +20-80%/day) and our skills.sh leaderboard rank, plus wasting user bandwidth.
Add an idempotency check: if `.agents/skills/ruflo` already exists in cwd, log a dim skip note and return. First init on a project → real registration + real signal; every subsequent init → no-op.
PATCH — behavior change corrects the over-firing, no API surface change.
Co-Authored-By: RuFlo <ruv@ruv.net>
3.31.0's `maybeInstallSkillsSh` called `npx skills add ruvnet/ruflo` with no filter, which discovered 267 skills across 30+ plugins and installed them all into the target project's .agents/skills/ — invasive for a user who just wanted the platform's cross-agent entry point.
- New: SKILL.md at repo root — a single canonical `ruflo` skill describing the platform (what it is, when to invoke, three-command getting-started, MCP tool namespaces, plugin discovery, cross-agent install path)
- Changed: init now runs `npx skills add ruvnet/ruflo --skill ruflo --yes` — installs ONLY the platform skill (~1 file). Users who want all 267 plugin skills can run `npx skills add ruvnet/ruflo --all` themselves; init prints that as a discoverable next step.
- Documentation strings + fallback retry command updated to reflect the narrower install.
PATCH — behavior change corrects an overreach, no API surface change.
Co-Authored-By: RuFlo <ruv@ruv.net>