mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 06:06:02 +09:00
v3.32.9
1751
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
26c35b59b4 |
chore(release): bump @claude-flow/cli, claude-flow, ruflo to 3.32.9
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> |
||
|
|
745dfbe327 |
fix(security): dedup better-sqlite3 to patched 12.9.0 across dependency tree (#2736) (#2746)
* 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> |
||
|
|
03b2dbf326 |
fix(memory): refuse unsafe sql.js whole-image writes under a live native WAL writer (#2749)
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. |
||
|
|
c47462ebc2 |
fix(doctor): wire real memory-DB integrity checks into the default doctor run (#2748)
* 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> |
||
|
|
9810d8d9c1 |
fix(statusline): real model name from stdin + worktree version resolution
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. |
||
|
|
fb2f92bb2c |
chore(release): bump @claude-flow/cli, claude-flow, ruflo to 3.32.8
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. |
||
|
|
fb026a7bb2 |
fix(memory): memory_search omitted namespace no longer collapses to empty 'default'
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> |
||
|
|
076ccf3fed | fix(release): exclude security workspace artifacts (#2712) | ||
|
|
14c41d7784 | fix(auth): verify OAuth exports in security release (#2711) | ||
|
|
5c02b5cda8 |
fix(proxy): show actionable lifecycle guidance (#2710)
* fix(cli): make proxy status actionable * chore(release): publish ruflo 3.32.5 |
||
|
|
5122b0e7d4 | fix(release): build CLI artifacts before publishing | ||
|
|
099b8df13e | chore(release): publish ruflo 3.32.3 | ||
|
|
ca5c5cfc63 | feat(proxy): default install to signed v0.4.0 | ||
|
|
7541bf962a |
Merge pull request #2697 from ruvnet/feat/meta-proxy-integration
feat(proxy): Cognitum auth and signed Meta-Proxy lifecycle |
||
|
|
3807c5c135 | fix(security): ship zero-dependency defend fallback | ||
|
|
e332689b8c | fix(release): harden hooks, statusline, security, and plugin MCP integration | ||
|
|
9049e9578e |
fix(security): restore @claude-flow/aidefence optionalDep + fix swallowed output.error
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 |
||
|
|
9f6cf7d2a1 |
fix(security): statusline CVE counter reads real scan findings, not hardcoded 3 (#2694)
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). |
||
|
|
942de65de7 | fix(codex): lazy-load stable adapter during init | ||
|
|
72875da937 | chore(release): prepare stable Ruflo 3.32.1 | ||
|
|
87101e28bc | fix(proxy): complete Windows OAuth service flow | ||
|
|
f52ab6e906 | feat(proxy): integrate Cognitum auth and meta-proxy lifecycle | ||
|
|
a0c1ac4b4f |
feat(doctor): add --fix-handles to kill orphaned conhost.exe on Windows
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> |
||
|
|
8306ad8fe5 |
fix(helper-refresh): also refresh ~/.claude/helpers so global statusline picks up new features
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> |
||
|
|
f00d78ffe8 |
fix(init): skip skills.sh re-registration if .agents/skills/ruflo already exists
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> |
||
|
|
23abe26b9b |
fix(init): install only the canonical ruflo skill via skills.sh (not all 267)
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> |
||
|
|
35ceda351a |
feat(init): auto-register ruflo with skills.sh for cross-agent skill catalog
Adds a post-init step (maybeInstallSkillsSh) that runs `npx --yes skills add ruvnet/ruflo` at the end of every `ruflo init`, exposing ruflo's 134 skills to whatever agent the project uses (Claude Code, Cursor, Copilot, Gemini, Cline, ...). Best-effort — never fails the primary init; on any error prints a soft retry line. Uses windowsHide to avoid Windows console-flash on the spawn. - New: skills.sh.json at repo root with 34 groupings (one per plugin), 134 skills total, controlling how ruflo displays on skills.sh - New: --no-skills-sh flag (also honors RUFLO_NO_SKILLS_SH=1) to opt out - Skipped under --skip-claude and --format json, matching the existing maybeAutoDetectCodex sibling pattern Bumps @claude-flow/cli, claude-flow, and ruflo to 3.31.0 (MINOR — new flag + new default behavior, backward-compatible addition per CLAUDE.md semver policy). All 400 commands-deep tests pass. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
9dd999c93d |
fix(#2357): add sonnet-5 to the sampling-params rejection regex
Sonnet 5 joined the Claude 5 adaptive-thinking family and removed temperature/top_p/top_k like Fable 5, Opus 4.8, and Opus 4.7 — the Anthropic API returns 400 'Extra inputs are not permitted' when any is present. The `modelRejectsSamplingParams` regex in agent-execute-core.ts didn't include sonnet-5, so callAnthropicMessages() would forward its 0.7-default temperature and get rejected on any Sonnet 5 call (including the internal routing that 3.30.4 just bumped `sonnet` → `claude-sonnet-5`). Test coverage extended: sonnet-5 added to both the alias-check and the request-body drop test (32 tests pass, up from 30). Bumps @claude-flow/cli, claude-flow, and ruflo to 3.30.5 (PATCH — bug fix, no API change). Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
3e9122a310 |
feat(routing): default to latest Claude 5/4.x models in tier map + init template
- MODEL_MAP: `sonnet` alias bumped from claude-sonnet-4-6 → claude-sonnet-5 (matches the current Claude 5 family default). Prior pin remains reachable via new `sonnet-4.6` alias for back-compat. - DEFAULT_ANTHROPIC_MODEL and `inherit` now resolve to claude-sonnet-5. - ruflo init template (settings-generator.ts): top-level `model` set to claude-sonnet-5 (previously commented out with a stale sonnet-4-5 hint); `claudeFlow.modelPreferences.default` bumped from opus-4-8 → claude-sonnet-5. - Project `.claude/settings.json` synced with the new template output (model + modelPreferences); removed the stale skillListingBudgetFraction rationale comment (kept the 0.06 value — #1834 still has 358 SKILL.md duplicates, workaround is still load-bearing). - Test updates for #2232 / #1906 regression guards to assert the new sonnet-5 resolution and the new `sonnet-4.6` back-compat alias. Bumps @claude-flow/cli, claude-flow, and ruflo to 3.30.4 (PATCH — no API change, default-model refresh only). All 30 model-resolution/sampling-params tests + 400 commands-deep tests green. Follow-up: sampling-params regex in agent-execute-core.ts (#2357) may need `sonnet-5` added if Sonnet 5 rejects temperature/top_p/top_k like the rest of the Claude 5 family — not touched here because I don't have that behavior confirmed. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
38d6079021 |
fix(windows): hide console flash from detached hook-refresh spawn
The spawnDetachedHookRefresh() call in v3/@claude-flow/cli/.claude/helpers/hook-handler.cjs was missing windowsHide: true. On Windows, npx.cmd's cmd.exe wrapper flashed a visible console window every time SessionStart fired the background funnel/advisor refresh. Matches the fix already in place at line 158 in the same file (firstRunAutoEnable path). Bumps @claude-flow/cli, claude-flow, and ruflo to 3.30.3 (PATCH — Windows-only visible bug, no API change). Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
5fb503480d |
chore(release): bump claude-flow / @claude-flow/cli / ruflo to 3.30.2
PATCH bump (3.30.1 → 3.30.2) — ships #2677 doctor memory functional checks (@stuinfla checks 1-3: integrity, content, embedding-coverage) plus env-audit allowlist entries for four escape hatches that were flagging CI on every PR (RUFLO_AI_BUDGET_{DIR,DISABLE}, RUFLO_METAHARNESS_SKIP_LOCAL, RUFLO_HELPERS_LOCKED). Related: PR #2681, half of issue #2677 (checks 4-8 pending stuinfla's PR). Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
4a37e55173 |
fix(#2677): doctor memory — integrity + content + embedding-coverage checks (stuinfla checks 1-3) (#2681)
* fix(#2677): doctor memory — add integrity + content + embedding-coverage checks Closes half of #2677 (@stuinfla's proposed checks 1–3; check 4 recall probe deferred to a follow-up since it needs end-to-end write+search+delete). ## Problem Before: `ruflo doctor --component memory` was existsSync + statSync — literally CANNOT fail on any file that exists. Reported PASS on a 99.97%-empty and even a SQLite-malformed DB (both from stuinfla's 81-store fleet report). "A check that cannot fail protects nothing." ## Fix — 3 new checks stacked on the existing existence probe Ordered so the earliest chain-break is always the first red the user sees: 1. **Memory Integrity** — opens via sql.js, runs `PRAGMA integrity_check`. Two failure modes handled distinctly: - Open fails / query refused: WARN (encrypted DB or corrupt — doctor can't distinguish from outside) - Open succeeds but pragma != 'ok': FAIL (definite corruption) 2. **Memory Content** — counts rows in `memory_entries` where `content` is non-empty. FAIL if ratio < 95%. Message includes the actual ratio ("content 3/11133 (0.03%)") per stuinfla's "Print the measurement, not a checkmark" rule. 3. **Memory Embedding Coverage** — counts rows with a vector on populated-content rows. FAIL if ratio < 95%. Schema-shape discovery handles the two known variants (inline `embedding`/`vector` column, or a paired `embeddings`/`vector_indexes` table). ## Design rules honored (from #2677) - **A check that cannot fail protects nothing** — every check has a demonstrable red state, verified live against this repo's DB (which happens to be broken enough to WARN on all three). - **UNKNOWN is never PASS** — encrypted / unreadable / schema-mismatch cases return warn or fail, never a reassuring pass. Encrypted-DB case gets an operator-actionable "DB refused query: … (encrypted DB or corruption)" message that names what the user needs to know. - **Print the measurement** — ratios in-line ("content 3/11133 (0.03%)"), not just checkmarks. - **Exit non-zero on failing dimension** — inherits from the existing doctor exit-code aggregation. ## componentMap now supports arrays `--component memory` runs the whole memory-health suite instead of a single check. Type of map values widened to `(() => Promise<HealthCheck>) | Array<() => Promise<HealthCheck>>`; `checksToRun` uses `Array.isArray()` at expansion time. No behavior change for the other 24 components — all still single functions. ## Verified live on this repo Before: `✓ Memory Database: 0.00 MB — 1 passed. All checks passed! System is healthy.` After: `✓ Memory Database` + 3 × ⚠ (integrity refused / content unknowable / embedding unknowable) with the diagnostic message on each. ## Deferred to follow-up - Check 4 (recall probe): needs actual write+search+delete round-trip through the CLI's memory pipeline. Slower + higher-blast-radius than read-only SQL. Its own PR. - Checks 5–8 (distillation, reflexion, skills, continuity) + the underlying distill→reflexion write-path fix stuinfla identified. Bigger change; his own PR proposal per issue thread. Closes half of #2677. Full closure requires stuinfla's second PR. Co-Authored-By: RuFlo <ruv@ruv.net> * ci(env-audit): allowlist RUFLO_AI_BUDGET_{DIR,DISABLE} + RUFLO_METAHARNESS_SKIP_LOCAL These env vars ship in main from PR #2663 (repo-supervisor + AI-cost fuse) and the metaharness invoke shim, but were never added to KNOWN_ESCAPE_HATCHES — so the env-var-precedence audit fails on every PR that touches related files. Drive-by fix while adding the doctor memory checks in PR #2681. Each entry follows the existing allowlist convention: rationale comment naming the file + why it's intentionally env-only (background service / plugin script — no CLI-flag surface to attach to). (Local audit surfaces ~12 more missing entries but the CI flagged only these 3 for this PR — the rest are pre-existing debt on main and warrant their own cleanup pass.) Co-Authored-By: RuFlo <ruv@ruv.net> * ci(env-audit): also allowlist RUFLO_HELPERS_LOCKED (v3.30.0 .LOCKED escape hatch) The env-audit's fail-level 'x' now surfaces our own new escape hatch from PR #2676 (.LOCKED marker + env opt-out for the concurrent-session helper clobber fix). Adding to KNOWN_ESCAPE_HATCHES with rationale. Follows the same pattern as the other 'runs from a hook, no CLI surface' entries above — helper-refresh is invoked from a session-restore hook, not a user-typed command, so there's no argv position for a --helpers- locked flag to attach to. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
5fa2a3ce6b |
chore(release): bump claude-flow / @claude-flow/cli / ruflo to 3.30.1
PATCH bump (3.30.0 → 3.30.1) — fixes #2679 statusline generator drift: generator now reads .claude/helpers/statusline.cjs as its single source of truth instead of an inline 1000-line template. Every future edit to the helper propagates to `ruflo init` output automatically. No user-facing behavior change — fresh installs get the same helper content that was already shipping in the deployed .claude/helpers/statusline.cjs. CI: three static-regression guards updated for the read-and-substitute pattern. All three now grep the helper (where the content lives) with a paired assertion that the generator still reads it. Related: PR #2680, issue #2679, v3.30.0 ( |
||
|
|
30e41c23f3 |
fix(#2679): sync statusline-generator with committed helper (read+substitute pattern) (#2680)
* fix(#2679): sync statusline-generator with committed .claude/helpers/statusline.cjs Closes #2679. Replaces the 946-line inline template string in generateStatuslineScript() with a read-committed-helper-and-substitute pattern. Single source of truth = the shipped .claude/helpers/statusline.cjs. ## Root cause of the drift The generator's inline template shipped as the pre-#2195 non-delegation build. Meanwhile the deployed helper got continuous v3.29.0 improvements (whole-row-clickable OSC 8, (domain) suffix, ellipsis on truncation, bright-white bold command styling, 300s cache TTL, windowsHide on every subprocess spawn). No mechanism kept them in sync — every `ruflo init` regressed a user's install to the older shape. ## Fix generateStatuslineScript() now: 1. Walks up from `__dirname_sg` looking for `@claude-flow/cli`'s package.json. Reads `.claude/helpers/statusline.cjs` relative to that. Falls back to `createRequire.resolve` for the installed-CLI case where walk-up misses (shipped tarball extracted outside a workspace). 2. Substitutes two known values: - `maxAgents: 15,` → `maxAgents: <options.runtime.maxAgents>,` - `let ver = "…";` → `let ver = <bakedVersion>;` (with non-downgrade guard so test environments that resolve to an older node_modules install can't clobber a fresh committed helper) Function body: ~1050 lines → ~60 lines. Every future edit to the helper now propagates to init output automatically. ## Also synced (was silently drifted) `v3/@claude-flow/cli/.claude/helpers/statusline.cjs` was a stale pre-v3.29.0 copy. Copied the root `.claude/helpers/statusline.cjs` (the current v3.29.0 shape) over the top. Re-signed helpers manifest. ## Test updates Three test assertions updated to match the current v3.29.0 helper shape: 1. `statusline-cost-display.test.ts` drift guard — restored to strict byte-comparison after normalizing the version line (the ONE legitimately environment-dependent line — vitest resolves to a different pnpm-installed CLI than production). 2. `funnel.test.ts` "re-sanitizes promo text" — was asserting the old `.slice(0, 100)` truncation; now asserts the v3.29.0 MAX_LEN + ellipsis path. 3. `funnel.test.ts` "styles the label as a link" — was asserting the old `UL_ON + safeTerminalLink(label, promo.url) + UL_OFF` label-only OSC 8 wrap; now asserts the v3.29.0 whole-row wrap via `wrapWholeRowInHyperlink` + the bright-white bold command styling. ## Verified - Local: 135/135 pass across funnel.test.ts + statusline-cost-display.test.ts. - TypeScript build clean. - Direct node call: generator produces exact byte-for-byte match with committed helper (modulo the substituted maxAgents + version). ## Follow-ups tracked None blocking. The `wrapWholeRowInHyperlink` name assertion pins one implementation detail — worth revisiting if we ever refactor that path. Related: v3.30.0 release ( |
||
|
|
fea1d9e955 |
chore(release): bump claude-flow / @claude-flow/cli / ruflo to 3.30.0
MINOR bump (3.29.0 → 3.30.0) — additive per PR #2676: - ADR-317: developer revenue-share Phase 0 scaffold (ruflo funnel enroll/earnings/unenroll) - ADR-318: spinner-verbs surface (ruflo spinner enable/disable/list/reset) — default ON - ADR-319: startup announcements surface (ruflo announcements enable/disable/list/reset) — opt-in via env - First-run auto-enable mechanism (RUFLO_NO_AUTO_ENABLE + RUFLO_NO_AUTO_ENABLE_SPINNER + RUFLO_AUTO_ENABLE_ANNOUNCEMENTS) - .LOCKED helper-refresh escape hatch (fixes concurrent-session clobber) Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
74bc81f8ef |
feat(adr-317): Phase 0 scaffold for developer revenue-share on the Cognitum funnel (#2676)
* feat(funnel,adr-317): Phase 0 scaffold for developer revenue-share on the Cognitum funnel
Response to "can we do something similar to kickbacks.ai?" — yes, and about 60-70%
of the plumbing (attribution, consent, rotation, disclosure grace, insight-slot
targeting) already ships in ADR-301..316. The gap is the payment rail. This ADR
scopes the smallest defensible slice: share existing Cognitum sponsor revenue
50/50 with users who explicitly opt in. Auction / advertiser self-serve are
DELIBERATELY OUT of scope (that would be ADR-320+ if we ever go marketplace).
Phase 0 (this PR, client-only scaffold):
- ADR-317 written in v3/docs/adr/ with data flow, consent-domain rationale,
phased delivery plan, and explicit "out of scope" list.
- New consent domain `rev-share-payout` — standalone, never bundled with the
funnel-on/off decision itself or with any other ADR-302-family domain.
- New funnel/payout.ts state module — opaque enrollment token storage,
`isEarningEligible()` gate (consent + verified token both required),
`getAttributionToken()` for future attribution enrichment.
- Three new subcommands: `ruflo funnel enroll` / `earnings` / `unenroll`.
All three refuse cleanly when the funnel is disabled or the disclosure has
been declined (same guard pattern as `accept`/`open` shipped in v3.29.0).
- Backend endpoint (funnel.ruv.io/v1/enrollment + /v1/earnings) is NOT live
yet — Phase 1 blocks on legal + Stripe Connect setup, called out in the ADR.
The subcommands ship with clear "coming soon" messaging that records local
consent and previews the URL.
Phases 1-3 (out of this PR, tracked in ADR):
- Phase 1: backend enrollment + earnings endpoints in cognitum-one/meta-proxy.
- Phase 2: attribution + payout engine, per-token ledger, monthly Stripe transfers.
- Phase 3: publisher TOS, docs, blog, public launch.
No breaking changes. Semver MINOR (new subcommands, additive).
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(spinner,adr-318): manage ruflo verbs in Claude Code's spinnerVerbs rotation
Ships alongside ADR-317 (per product decision) — same PR, but architecturally
distinct: this ADR is about a NEW placement surface (Claude Code's spinner
"✽ Channeling…" area, exposed via the documented `spinnerVerbs` settings key
in ~/.claude/settings.json), while ADR-317 is about a NEW consent model for
the existing statusline promo surface.
Key guarantees (from ADR-318):
- Append-only, never replace. Refuses if user already has replace mode.
- Backup ~/.claude/settings.json before every write (dated .bak-* files).
- Ruflo verbs tagged with a zero-width joiner triple (invisible in every
terminal), so `disable` strips ONLY ruflo verbs and leaves user-authored
ones intact.
- Full mix from day one (per product decision): Cognitum-branded verbs and
neutral tips both rotate together. The `enable` confirmation prompt IS
the disclosure — the pool is printed in full including Cognitum-tagged
entries before consent is recorded. This trades some ADR-311 "disclosure
before promotional content" invariant for user-visible transparency at
the consent moment.
Validation (rejects any pool entry that isn't):
- Present participle (some word ends in -ing). Was `/ing$/i.test(stripped)`
which required the WHOLE string end in "ing" — that rejected every
multi-word verb in the pool. Now checks per-word.
- ≤ 30 chars after marker strip.
- No control chars, ANSI, URL patterns, bidi overrides.
Subcommands (`src/commands/spinner.ts`, registered in commands/index.ts):
- `ruflo spinner list [--json]` — pool + installed + user-authored
- `ruflo spinner enable [--yes]` — preview + write (requires --yes to write)
- `ruflo spinner disable` — strip ruflo verbs only, preserve user verbs
- `ruflo spinner reset --yes` — restore most recent settings.json backup
New consent domain `spinner-verbs` in types.ts + consent.ts (never bundled).
v0 verb pool (baked into this PR; v1 will be remote-served from
funnel.ruv.io/v1/messages?class=spinner-verb per ADR-318 §Data flow):
Neutral: Optimizing your prompt, Consulting the memory graph, Warming
the HNSW index, Learning from the trajectory, Auditing for CVEs,
Sharpening the plan
Cognitum: Consulting Cognitum, Checking Cognitum credits, Routing via
Cognitum, Fetching a Cognitum tip
Verified end-to-end on Windows:
- enable --yes → 10 verbs appended, backup taken
- list → all 10 shown under "Currently installed ruflo verbs"
- settings.json direct inspection → mode="append", verbs[0] has trailing
ZWJ marker (hex e2808d×3)
- disable → strips all 10, preserves user-authored (0 in this test)
- No breaking changes; original settings.json restored via the backup
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(spinner,adr-318): expand v0 verb pool from 10 to 37 verbs
Per product decision — richer append-mode rotation. With Claude Code's
~50 built-in verbs and our 37 mixed in, users see a ruflo verb roughly
42% of the time (was ~17% at 10 verbs); Cognitum-tagged verbs sit at
~7% of all spins (6 of 37 ruflo, mixed with defaults).
Categories (see commands/spinner.ts):
- Memory & retrieval (7): Consulting the memory graph, Warming the
HNSW index, Recalling similar patterns, Searching semantic memory,
Reranking with MMR, Traversing knowledge graph, Loading trajectory context
- Optimization (6): Optimizing your prompt, Sharpening the plan,
Compacting the context, Distilling the trajectory, Reducing token spend,
Compressing the working set
- Learning & intelligence (6): Learning from the trajectory, Training
the router, Judging past verdicts, Consolidating memories, Reasoning
through the graph, Predicting the next step
- Security & audit (4): Auditing for CVEs, Scanning dependencies,
Verifying signatures, Guarding against injection
- Agents & swarm (4): Spawning subagents, Coordinating the swarm,
Reaching consensus, Balancing the workload
- Workflow (4): Routing to the best model, Warming background workers,
Analyzing the diff, Sharpening the review
- Cognitum-tagged (6): Consulting Cognitum, Checking Cognitum credits,
Routing via Cognitum, Fetching a Cognitum tip, Warming Cognitum cache,
Weighing Cognitum options
All 37 validated: at least one word ends in -ing, ≤ 30 chars, no
control chars / ANSI / URL patterns / bidi overrides.
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(announcements,adr-319): manage ruflo entries in Claude Code's companyAnnouncements startup rotation
Response to "can we include tip text also?" — turns out the "Tip: Double-tap
esc..." line specifically isn't documented as customizable, but Claude Code
DOES expose companyAnnouncements: string[] in ~/.claude/settings.json,
cycled at random on startup. That's the closest documented surface for
"give ruflo a place to speak" and it ships with the same guarantees as
ADR-318's spinner-verbs.
Ships in the same PR as ADR-317/318, sibling surface:
- Higher-attention (rendered prominently at startup) but lower-frequency
(once per Claude Code launch vs. every processing pause) than spinner-verbs
- Same architectural pattern: append-only, backup-first, ZWJ-marker-tagged
for clean removal, opt-in via consent domain, "full mix from day one"
(Cognitum-branded entries in the enable-time preview IS the disclosure)
Additions:
- ADR-319 documents the surface + guarantees + explicit out-of-scope list
- New consent domain `company-announcements` (never bundled, independent
from spinner-verbs — a user might reasonably want one without the other)
- funnel/consent.ts + funnel/types.ts additions
- commands/announcements.ts — new top-level subcommand group with
enable/disable/list/reset (mirror of commands/spinner.ts pattern)
- commands/index.ts registration
v0 pool (baked, 12 entries):
- 9 neutral product tips (memory graph, background workers, semantic search,
security scanner, doctor, cost routing, etc.)
- 3 Cognitum-tagged (sponsor mention, credits, overflow routing)
Validation bug fixed during smoke test — the naive `/[ - ... ]/`
character class regex from commands/spinner.ts, when written with raw
UTF-8 bytes in source, JavaScript (without the `u` flag) parses byte
sequences as literal byte ranges. Since every announcement starts with an
emoji (multi-byte UTF-8), all 12 falsely failed validation. Rewrote as
per-code-point iteration using String iterator + codePointAt — correct
Unicode semantics regardless of source encoding. Spinner-verbs verbs
happen to be plain ASCII so its identical regex works today by accident;
worth a follow-up to fix defensively (see ADR-319 §Consequences).
Verified end-to-end on Windows:
- list → shows all 12 in pool, 0 installed
- enable --yes → 12 written to settings.json companyAnnouncements array,
backup taken, sample verb has trailing ZWJ marker
- disable → removes all 12, preserves user-authored (0 in this test)
- reset (not exercised in this smoke) → available via the fourth subcommand
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(hook,adr-318,adr-319): first-run auto-enable for spinner + announcements, opt-in via RUFLO_AUTO_ENABLE_SURFACES=1
Per product decision — auto-enable-on-session-start for the two surfaces
(spinner verbs, startup announcements). Default OFF because shipping this
default-on is a company-level product call, not a mechanism call; this
commit ships the mechanism.
## Mechanism (hook-handler.cjs session-restore case)
New `firstRunAutoEnableIfEligible()` runs at the top of the session-restore
handler. Multiple gates — any TRUE skips:
- `RUFLO_AUTO_ENABLE_SURFACES` not truthy (default posture — no auto-enable)
- `RUFLO_NO_AUTO_ENABLE` truthy (explicit opt-out escape hatch)
- CI / GITHUB_ACTIONS truthy
- stdout is not a TTY (piped / non-interactive)
- Marker file at ~/.ruflo/first-run-enabled.json already exists
On success:
- Detached spawn `ruflo spinner enable --yes` + `ruflo announcements enable --yes`
(fully non-blocking — session-restore latency unchanged)
- Sync-write marker so a same-tick session-restore doesn't re-fire
- One-line stderr notification: what happened + how to disable + restart hint
## Additional fix — spinner.ts validator
Applied the same per-code-point isControlOrBidiOverride() fix to
commands/spinner.ts that commands/announcements.ts got when adding
emojis broke its validator. Today's spinner pool is pure ASCII so
the old naive `/[…]/` char-class regex worked by accident; this
prevents the same broken-emoji-validation trap the next time anyone
adds an emoji verb. Deleted the now-dead stub function.
## Verified live on Windows
Simulated session-restore with RUFLO_AUTO_ENABLE_SURFACES=1:
- Marker absent → wrote 37 verbs to spinnerVerbs + 12 to companyAnnouncements
- Marker written to ~/.ruflo/first-run-enabled.json
- Notification printed to stderr
- Second call (marker present) → silent no-op, correct
- Without the env var → silent no-op, correct
- No blocking of session-restore's own output
## Not shipped in this commit
- Default-on posture (still requires env opt-in) — deliberate; that's a
company/product decision, not a mechanism decision
- `disable` subcommands writing the marker (would prevent re-enable if
user disables BEFORE first-run auto-fires) — edge case, worth a
follow-up but not blocking
- User's existing hook-handler.cjs won't have this code until they upgrade
ruflo past this release
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(hook,adr-318): spinner default ON for new installs, announcements stays opt-in
Per product decision (ruv, this session) — flip spinner-verbs auto-enable from
opt-in (RUFLO_AUTO_ENABLE_SURFACES=1) to default-on. Announcements remain
opt-in via RUFLO_AUTO_ENABLE_ANNOUNCEMENTS=1 because the intrusion profile
is meaningfully different (prominent startup line vs. per-spin flash mixed
with Claude Code defaults).
## Split rationale (ADR-318 amended §First-run auto-enable)
Spinner verbs — default ON:
- Low intrusion: per-spin flash, ~40% of spins with 37 verbs + Claude Code's
~50 built-ins in append mode
- Reversible in one command: `ruflo spinner disable`
- Backup taken automatically before write; append-mode preserves defaults
- Notification-at-first-render IS the disclosure (satisfies ADR-311 for
this surface)
Announcements — default OFF:
- Higher intrusion: prominent line at every Claude Code startup
- Opt-in via RUFLO_AUTO_ENABLE_ANNOUNCEMENTS=1 or explicit
`ruflo announcements enable`
## Env-var summary (both surfaces)
Master opt-out: RUFLO_NO_AUTO_ENABLE=1 (kills both)
Spinner-only opt-out: RUFLO_NO_AUTO_ENABLE_SPINNER=1
Announcements opt-in: RUFLO_AUTO_ENABLE_ANNOUNCEMENTS=1
Plus auto-skip in CI / GITHUB_ACTIONS / non-TTY.
## Notification (stderr) reflects actual state
- Default: "enabled spinner verbs. Disable anytime with `ruflo spinner disable`.
Announcements stay opt-in — set RUFLO_AUTO_ENABLE_ANNOUNCEMENTS=1..."
- With announcements: "enabled spinner verbs + startup announcements. Disable anytime with..."
- Master opt-out: no notification (function returns early)
## Verified live on Windows (3-way)
- Default (no env): spinner enabled 37, announcements 0, notification correct
- With announcements opt-in: both enabled (37 + 12), notification names both
- With RUFLO_NO_AUTO_ENABLE=1: no notification, function returns before any spawn
## Not shipped here (follow-ups)
- `spinner disable` / `announcements disable` should write the marker so
disabling BEFORE first-run auto-fires doesn't get clobbered on next
session-restore. Edge case but worth fixing before default-on ships to
the whole user base.
- Release notes for the next stable bump need to call out the default
behavior change (existing users get spinner verbs added to their
settings.json on their next Claude Code session).
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(helper-refresh): opt-out via .LOCKED marker + RUFLO_HELPERS_LOCKED env
Fixes the recurring concurrent-session clobber documented in CLAUDE.md
(commit
|
||
|
|
0052b1b06d |
security: rotate helpers-signing key (RUFLO_HELPERS_PUBKEY v2) (#2673)
The previous Ed25519 private key was accidentally exposed in a Claude Code session transcript today while attempting the v3.29.0 publish flow — the gcloud secret fetch was invoked in a way that printed the PEM to the tool log, which is captured in the session's persistent transcript. Mitigation (already done at rotation time): - New Ed25519 keypair generated locally. - New private uploaded as GCP Secret Manager version 2 of `ruflo-helpers-signing-key` in the `ruv-dev` project. - Old GCP secret version 1 DESTROYED (not just disabled) — cannot be re-enabled from state or previous access tokens. - New public key baked into RUFLO_HELPERS_PUBKEY here. Compatibility (atomic per-version — no transition dance needed): - Users on ruflo <= 3.28.0 keep the old baked pubkey and continue to verify their locally-shipped manifest (also signed with the old key) successfully. Their helpers stay valid. - Users upgrading to ruflo >= 3.29.0 receive both the new baked pubkey AND the manifest signed with the new key in the same package — helper-refresh verifies cleanly on first run of the new CLI. Follow-up urgency: upgrade to v3.29.0 as soon as possible so any tampered tarball signed with the leaked v1 key can't survive against a fresh verifier. Old CLIs remain "trust v1 pubkey" until they upgrade — an attacker with the leaked key could still forge a manifest that verifies against those old installs. This is the last-mile risk of any rotation. Also updates scripts/verify-helpers.mjs, which duplicates the pubkey inline (prepublishOnly gate). Keep the two copies in sync on future rotations — worth a follow-up to make helper-signing.ts the single source of truth. |
||
|
|
c89a98a4fd |
feat(funnel,statusline): accept + open subcommands, whole-row-clickable promo, Windows flash mitigations (v3.29.0) (#2671)
Ruflo-side companion to anthropics/claude-code#70200 tracking in #2669. Adds two new user-facing subcommands, one visual+click improvement to the statusline promo row, and layered Windows subprocess-flash mitigations. CLI additions (semver MINOR — additive, backward-compatible): - ruflo funnel accept — backdates disclosure firstShownAt past the 24h grace so promo rotation starts immediately on the next render, without waiting a full day. Refuses cleanly if funnel is disabled or disclosure was declined. - ruflo funnel open — reads ~/.ruflo/statusline-promo.json, validates the URL against a hardcoded allowlist (never trusts the user-writable memo), and opens it in the default browser via execFile (no shell interpretation) with windowsHide. Works independently of whether the terminal renders OSC 8 hyperlinks — critical for hosts like VS Code integrated terminal where left-click pastes and Ctrl+Click hits Quick Open instead of following the link. - recordDisclosureAccepted() helper in disclosure.ts, exported from funnel/index.ts. Statusline row 3 (getPromoRow): - Ellipsis on truncation instead of silent mid-word chop. - Command portion styled bright-white + bold so it visually reads as "shell command to type" (as the design comment always intended) instead of getting lost in the row's kind-color. - Visible dim "(domain)" suffix after the label, showing the final destination host even on terminals that strip the click-redirect wrapper. Both label AND domain wrapped in OSC 8 hyperlinks — two click targets per row. - Whole assembled row wrapped in ONE OSC 8 hyperlink so a click anywhere on the row opens the URL. Command styling deliberately NOT underlined so it still reads as "type this" not "click me"; clicking opens the URL, does not execute the command. Windows console-flash mitigations (upstream tracking anthropics/claude-code#70200, ruflo tracking issue #2669): - windowsHide: true on statusline.cjs execSync (CLI JSON delegation) + safeExec helper (sqlite/git subshells) + hook-handler.cjs detached spawn (background funnel/context refresh). Silences flashes from OUR subprocess grandchildren. Cannot silence Claude Code's own spawn of the hook wrapper — that needs the upstream fix. - statusline cache TTL bumped 60s → 300s so the outer wrapper spawn (which is Claude Code's, not ours) fires 5x less often. Rendering still responsive because the promo/insight rotation has its own tighter 20s clock. Tests: 121/122 funnel invariants pass; 1 unrelated pre-existing perf timer flake on Windows (attributionUrl <100ms for 1000 builds, got 191ms — no relation to these changes). Closes some UX symptoms tracked in #2669; the upstream Claude Code bug is the authoritative fix. |
||
|
|
dc015986dc |
feat(adr): reconcile deleted ADRs — hard-delete primitive + drop-and-rebuild reindex (#2668)
* feat(adr): reconcile deleted ADRs — hard-delete primitive + drop-and-rebuild reindex Closes #2666. `adr-index` can only add/upsert; deleting an ADR file (or a relation line from a surviving one) left an orphan row in `adr-patterns`/ `adr-edges` forever, and `adr-verify` certified the result as healthy since an orphan has no dangling ref and forms no cycle. Root cause traced into @claude-flow/cli itself, not just this plugin: `memory delete` only ever soft-deletes (status='deleted'), so the row keeps occupying its UNIQUE(namespace, key) slot and blocks a later non-upsert re-store (#2652). `memory cleanup` reaps by age/TTL/quality, not by "does the source still exist". Neither the AgentDB v3 bridge nor the sql.js fallback exposed any hard, namespace-scoped delete anywhere in the CLI/MCP surface. Separately, import.mjs/verify.mjs's spawnSync calls never passed `cwd`, so ADR_ROOT scanned the right files but could write to the wrong `.swarm/memory.db`. CLI (@claude-flow/cli): - memory-bridge.ts: bridgePurgeNamespace() — real DELETE FROM memory_entries WHERE namespace = ? against the live bridge SQLite handle, routed through the existing MutationGuard/AttestationLog hooks. - memory-initializer.ts: purgeNamespace() (bridge-then-sql.js-fallback, same shape as deleteEntry) + withMemoryDbLock() (new <dbPath>.lock O_EXCL advisory lock, same stale-takeover pattern as global-ai-budget.ts — protects against a second concurrent purge/delete on the same file; does not close #2621, which needs every writer to adopt the same lock). - commands/memory.ts: `memory purge --namespace <ns> --force [--dry-run]` — requires --namespace explicitly (no default), confirms unless --force. - package.json: sql.js was already imported directly by memory-initializer.ts's fallback path but never declared as a dependency — worked by accident under npm's loose hoisting, silently broken under this repo's strict pnpm workspace (confirmed: unmodified deleteEntry/ storeEntry fail identically). Declared explicitly. Plugin (ruflo-adr): - scripts/reindex.mjs (new) — purge both namespaces via `memory purge`, rescan every ADR currently on disk, store fresh, then re-list and assert the count equals files-on-disk (a storedRecords tally can't see a concurrent-writer clobber of the purge; a fresh recount can). Exits non-zero on failure. Full-namespace wipe rather than a selective orphan diff, since adr-edges keys always carry a fresh timestamp-rand suffix and are never deduplicated across imports — a selective pass would still leave duplicate edges accumulating for ADRs that do still exist. - scripts/lib/parse-adrs.mjs (new) — findAdrs/parseAdr and sub-parsers extracted from import.mjs so reindex.mjs doesn't duplicate ~150 lines of dual-format parsing; import.mjs shrank 322 -> 156 lines, same dry-run output verified before/after (530 ADRs, same status/relation counts). - import.mjs/verify.mjs: every npx subprocess call now passes `cwd: ROOT`. - New `/adr-reindex` skill; adr-index/adr-verify SKILL.md cross-link it. - ADR-0002 records the decision. plugin.json 0.3.0 -> 0.4.0. Verified end-to-end against a scratch repo + local CLI build: 2 ADRs indexed, one deleted from disk, re-run adr-index -> orphan survives (bug reproduced exactly as filed), run adr-reindex -> orphan gone, post-condition OK, exit 0. New tests: __tests__/memory-purge-namespace-2666.test.ts (8 cases) — namespace-scoped hard delete, cross-namespace isolation, the specific #2652 regression (non-upsert re-store of a purged key must succeed), invalid-namespace rejection, lock acquire/release/stale-takeover/ serialization. smoke.sh: 15 -> 21 checks. Co-Authored-By: RuFlo <ruv@ruv.net> * fix(ci): restore sql.js lockfile entry lost during local drift verification A `git stash` + reinstall done while investigating unrelated pre-existing pnpm-lock.yaml drift (verifying it wasn't caused by this branch) ran with @claude-flow/cli/package.json temporarily reverted, regenerating v3/pnpm-lock.yaml without the sql.js entry the prior commit added. `git stash pop` restored package.json but not the lockfile state written while the stash was active, so the previous commit's lockfile silently lost that entry — CI's `pnpm install --frozen-lockfile` correctly caught the drift (ERR_PNPM_OUTDATED_LOCKFILE). Re-ran `pnpm install` with package.json in its correct state; frozen-lockfile install now passes clean locally, matching CI's exact step. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
dc625e8a99 |
feat(init): auto-detect OpenAI Codex CLI and configure its MCP server + skills (#2667)
`ruflo init` only wired up Codex support (AGENTS.md, .agents/, MCP
registration) behind the explicit --codex/--dual flags. A developer with
both `claude` and `codex` on PATH got nothing for Codex from a plain
`ruflo init` unless they already knew the flag existed.
- commands/init.ts: new maybeAutoDetectCodex(), called after a normal
(non---codex/--dual) init succeeds. Silently no-ops if `codex` isn't on
PATH (reusing services/harness-hosts.ts's commandExists detection
convention rather than a fourth ad hoc `which codex` check) or if
@claude-flow/codex isn't installed (prints one hint line). Never fails
the primary init. New --no-codex-detect opt-out; skipped under
--skip-claude and --format json.
- Extracted the three-strategy @claude-flow/codex dynamic-import
resolution (direct import / project node_modules / global node_modules)
out of initCodexAction into a shared resolveCodexInitializer() so both
the explicit-flag and auto-detect paths stay in sync.
- codex/src/initializer.ts: registerMCPServer()'s "already registered"
check now parses `codex mcp list --json` (each entry has a `name`
field — confirmed against OpenAI's current docs) instead of substring
-matching the human-readable table, which false-positived on any
unrelated server whose name/command merely contained "ruflo" and broke
silently on table-format drift. Falls back to the old text check for
older Codex CLI versions without --json support.
- ADR-080 documents the decision, including live verification against
developers.openai.com/codex/{mcp,skills} that the rest of the package's
Codex integration (config.toml [mcp_servers], .agents/skills/ scanning,
AGENTS.md) was already current and did not need revision.
|
||
|
|
ca6f09bf2f |
chore(release): bump @claude-flow/cli to 3.28.0
New backward-compatible additions (repository supervisor + leases, structured token telemetry, daemon budget CLI, migration warning) from PR #2663 — minor version bump per semver policy. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
f220882025 |
feat(daemon): repository supervisor, structured telemetry, budget CLI, migration warning (#2661) (#2663)
* feat(daemon): repository supervisor, structured telemetry, budget CLI, migration warning (#2661)
Closes the four gaps flagged as still-open against #2661's full root-fix
spec after the containment + dedup phases already shipped (#2662).
1. Repository-level supervisor + worktree leases (workspace-lease.ts,
repo-supervisor.ts). Ten worktree daemons of one repository independently
deciding "is it time to run audit" every tick was the redundant-scheduler
half of the cardinality bug — the budget ledger and job dedup already
bound and dedupe actual spend, but every daemon still ran its own timer.
Exactly one daemon per repositoryId is now elected supervisor (lock-
protected takeover, same pattern as global-ai-budget.ts) and owns the
recurring AI-worker schedule; every other worktree stays a lease-only
participant (15-min TTL heartbeat) running its cheap local-only workers.
An explicit `daemon trigger --headless` still bypasses the gate — it's a
one-off user action, still budget/dedup-governed like any other launch.
2. Structured per-launch token telemetry. `claude --print` now runs with
`--output-format json`; parseClaudePrintJsonEnvelope() extracts input/
output tokens, cost, and API duration, receipted via the budget ledger's
new recordUsage(). Lenient parsing — any schema mismatch degrades to
"no usage captured" rather than breaking existing analysis-output
parsing, since the raw `result` text still flows through unchanged.
3. `ruflo daemon budget show|pause|resume`. Budget state was previously
visible only inline in `daemon status --all`; these give it an
independently scriptable surface. pause()/resume() reuse the exact same
enforcement path as the automatic quota-triggered circuit breaker.
4. One-time upgrade migration warning. A pre-existing multi-daemon fleet
where AI workers were already enabled (old config/env from before this
fix) is exactly the P0 shape #2661 describes — warned once ever (a
persisted marker, not per-command), and only for that specific risky
shape, not a harmless AI-off fleet (already covered by the existing
always-shown fleet-size notice).
`daemon status --all` gains a "Repository Supervisors" panel alongside the
existing budget panel.
54 new tests across workspace-lease, repo-supervisor, claude-print-envelope,
global-ai-budget (extended), and daemon-migration-warning-2661 suites.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(statusline): don't import helper-refresh.js just for getInstalledCliVersion
statusline-generator.ts imported getInstalledCliVersion from helper-refresh.js
(added in
|
||
|
|
9e596df5af |
feat(init): turn on persistent AgentDB memory by default
runtime.memoryBackend already defaulted to 'hybrid' in DEFAULT_INIT_OPTIONS, but that only ever configured the DECLARED backend — the actual .swarm/memory.db file was never created until something eventually called `memory store`, or the user ran `memory init --force` by hand (both the generated CLAUDE.md and the quickstart docs told users to do this as a separate step). A fresh project could sit for days looking "configured for AgentDB" while genuinely capturing nothing, with no signal that the config and the on-disk reality had diverged. executeInit() now eagerly calls initializeMemoryDatabase() when runtime.memoryBackend !== 'memory', matching what the config already promised. MINIMAL_INIT_OPTIONS (memoryBackend: 'memory') opts out, matching its non-persistent intent — pinned by a new test alongside the positive case. Updated the printed "Next steps" list to drop the now-stale "run memory init" instruction. chore(release): bump @claude-flow/cli to 3.27.4. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
b254e3215e |
fix(statusline): bake in the real CLI version, fixing the npx-only fallback
getPkgVersion()'s runtime candidate scan can't find any version when rendering via a pure npx invocation with no persistent local install: npx installs into an ephemeral, unpredictably-hashed ~/.npm/_npx/<hash>/ directory that none of the probed candidate paths (marketplace, project node_modules, global prefix) can locate. It silently fell back to a hardcoded "3.6" placeholder — confirmed live via an isolated fresh-machine simulation (fresh HOME + fresh npm cache, no prior npx history). generateStatuslineScript() now bakes in the CLI's own real version at generation time (via getInstalledCliVersion(), the same reliable createRequire/findPackageRoot resolution helper-refresh.ts already uses) as getPkgVersion()'s default, replacing the hardcoded placeholder. The runtime candidate scan still wins when it finds something newer (e.g. a later `npm update` in the same project) — this only fixes the fallback. chore(release): bump to 3.27.3 across cli/umbrella/wrapper. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
6643d44d32 |
fix(statusline): pick highest local package version, not first-found
getPkgVersion() checked the marketplace plugin path first and returned as soon as ANY candidate's package.json existed, without comparing it to the others. Claude Code's plugin marketplace syncs on its own git-pull cadence, independent of npm publishes, so right after a publish the marketplace checkout can sit one (or more) releases behind while a newer install (e.g. this repo's own v3/@claude-flow/cli, or a plain `npm install`) is sitting right there — confirmed live on this machine: header showed 3.27.0 from a stale marketplace copy while the actual code running was already 3.27.1. compareVersions() now ranks every existing candidate and keeps the highest, so the header always reflects the newest install actually present rather than whichever candidate happens to be checked first. Also fixes this repo's own root .claude/helpers/hook-handler.cjs, which had drifted from the (correct, already-published) package copy due to the recurring concurrent-session helper corruption documented in CLAUDE.md — caught by the parity-guard test before this got shipped, since it's committed content, not what npm publish signs from. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
dbcfe15f3c |
fix(hooks,statusline): validate a real compiled dist before trusting a local CLI candidate
Claude Code's own plugin marketplace mechanism installs by git clone/pull
with no build step, so ~/.claude/plugins/marketplaces/ruflo is a
source-only checkout by construction: bin/cli.js exists on disk but
importing dist/src/index.js from it throws ERR_MODULE_NOT_FOUND on every
real command (confirmed live on a real install — only --version survives
it, since it reads package.json directly).
Both resolveCliBinForHook() (hook-handler.cjs) and resolveCliBinCandidates()
(statusline-generator.ts) picked that doomed candidate first and had no
recovery:
- hook-handler.cjs's spawnDetachedFunnelRefresh()/spawnDetachedAdvisorRefresh()
just gave up silently (`if (!cliBin) return;`) — the funnel promo cache
and ADR-316 advisor tip could never populate for a marketplace install,
on any OS.
- statusline.cjs's getStatuslineData() DID already fall through to the
other candidates and finally npx, but wasted every render's time budget
failing against the broken candidate first — starving the 20s
promo-rotation clock and making the row look frozen/non-rotating even
once it did show something.
Fix: both resolvers now also check for dist/src/index.js next to bin/cli.js
before trusting a candidate. hook-handler.cjs additionally gains a shared
spawnDetachedHookRefresh() that falls back to `npx --prefer-offline
@claude-flow/cli` (detached/unref'd, so the slower cold-start costs nothing
perceptible) when no local candidate has a real dist — mirroring the
robustness the statusline path already had.
Existing installs pick this up automatically via autoRefreshHelpersIfStale
on the next `ruflo`/`@claude-flow/cli` command, no reinstall required.
Co-Authored-By: RuFlo <ruv@ruv.net>
|
||
|
|
5dc9913799 |
chore(release): bump @claude-flow/cli to 3.27.0
Publishes the #2661/#2662 daemon flywheel fix (opt-in AI workers, global launch budget, cross-worktree dedup, stop --all) plus the inline hook-handler fallback's funnel-refresh wiring. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
87212ddbf7 |
fix(hooks): spawn funnel refresh from the inline hook-handler fallback
generateHookHandler()'s fallback template (used when copying the real package helper fails) never spawned refresh-funnel from session-restore, so a fallback-only install could never populate the promo cache. Mirrors the fix already shipped in the hand-maintained hook-handler.cjs, via a detached/unref'd npx spawn suited to the fallback's context. Co-Authored-By: RuFlo <ruv@ruv.net> |
||
|
|
215840536e |
fix(daemon): opt-in AI workers, global launch budget, cross-worktree dedup, stop --all (#2661) (#2662)
* fix(daemon): make AI workers opt-in, add user-global launch budget + stop --all (#2661) Containment patch for the P0 worktree-daemon fanout: N worktree daemons each auto-enabled headless claude --print workers whenever the Claude CLI was on PATH, so autonomous quota use scaled linearly with worktree count (13 launches/hour/daemon) and could silently exhaust a user's Claude quota. - AI workers are now OPT-IN (invariant 1: default install → zero autonomous Claude launches). Consent via `daemon start --headless`, `daemon.aiWorkers.enabled: true` in .claude-flow/config.json, or RUFLO_DAEMON_AI_WORKERS=1. Without it the daemon never probes `claude --version` and every worker runs its $0 local path. - `--headless` is now a real authorization gate: threaded into DaemonConfig.aiWorkersEnabled and re-checked in runWorkerLogic (defence in depth); consent is never restored from stale daemon-state.json. `daemon trigger --headless` grants per-run consent. - New user-global AI budget (services/global-ai-budget.ts): every launch must atomically reserve a slot in a shared owner-only ledger under ~/.claude-flow before any process is created. Defaults: maxConcurrentGlobal 1, 2 launches/hour, 12/day. Quota/429 failures open a user-global circuit breaker (60 min) so ALL daemons stop retrying. Every launch/denial/pause emits a receipt (no prompts/source persisted). Escape hatch: RUFLO_AI_BUDGET_DISABLE=1; limits tunable via RUFLO_AI_MAX_PER_HOUR / _PER_DAY / _CONCURRENT. - `daemon stop --all`: stops every ruflo daemon across all workspaces/worktrees (positive argv identification only), SIGTERM-first so each daemon's shutdown path reaps its Claude process group, then removes only ruflo-owned PID files. `stop()` now cancels in-flight headless children; cancel/cancelAll signal the whole process group. - `daemon start` warns when multiple daemons are running across worktrees; `daemon status` shows the AI-consent state of the RUNNING daemon; `daemon status --all` shows global AI budget usage and the circuit-breaker state. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01AHD8okFGN5JhCgu1MJmeUS * feat(daemon): repository identity, cross-worktree job dedup, worktree-removal shutdown (#2661) Root-fix phase 2 for the worktree daemon fanout — separates worktree identity from repository identity and stops duplicate model work across worktrees (issue invariants 5 and 6, containment form). - New git-workspace-identity service: resolves worktreeRoot (rev-parse --show-toplevel), commonGitDir (rev-parse --git-common-dir), a stable repositoryId (sha256 of the canonical common git dir — shared by ALL worktrees of one repository), and HEAD. Non-git dirs degrade to a path-hash id. Stable parts cached per process; HEAD never cached. - New ai-job-dedup registry (~/.claude-flow/ai-jobs.json, owner-only, symlink-rejecting): before a model launch the executor computes jobKey = sha256(repositoryId, HEAD, workerType, configHash) and skips the launch when the same job succeeded within the freshness window (the worker's own interval, floor 10 min; RUFLO_AI_DEDUP_WINDOW_SECS to tune, RUFLO_AI_DEDUP_DISABLE=1 to turn off). HEAD moves -> new key -> job runs again. Dedup is best-effort UNDER the budget: the atomic budget reservation remains the hard launch bound. Skips happen before budget spend, return dedupSkipped results, and never overwrite persisted metrics or fall back to redundant local runs. - Lifecycle monitor now always runs: a daemon whose workspace/worktree directory was removed self-shuts within one 60s check interval, even with ttl/idle disabled (previously the monitor was skipped entirely when both were 0). Tick logic extracted into a testable predicate. - daemon status --all budget panel now attributes 24h launches per workspace, so the worktree spending the shared budget is identifiable. Verified end-to-end with two real git worktrees: a success recorded at HEAD in worktree A makes worktree B's executor skip pre-spawn with zero budget spend; a new commit in B bypasses dedup and proceeds to the budget gate. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01AHD8okFGN5JhCgu1MJmeUS * fix(security): register #2661's new daemon/dedup env vars in the precedence audit RUFLO_AI_DEDUP_DISABLE and RUFLO_AI_DEDUP_WINDOW_SECS are background daemon tuning knobs with no CLI command surface to attach a flag to. RUFLO_DAEMON_AI_WORKERS does have CLI-flag precedence (`daemon start --headless`), but it's wired via constructor-injected config in commands/daemon.ts rather than a same-file check the audit's local-context heuristic can see from worker-daemon.ts, where the env read actually lives. --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
eabf953042 | chore(release): bump to 3.26.1 across cli/umbrella/wrapper (Windows statusline hotfix) |