Commit Graph
2119 Commits
Author SHA1 Message Date
rUv bf2c7b463f Merge pull request #3584 from ruvnet/fix/3573-3575-session
fix(session): import round-trips and save actually includes memory (#3573, #3575)
2026-09-30 19:06:56 -04:00
rUv 9672237333 Merge pull request #3580 from ruvnet/fix/3557-plugin-trust
fix(plugins): make --verify enforce trust and permissions on install (#3557)
2026-09-30 19:02:45 -04:00
rUv e1f7f2057b Merge pull request #3576 from nicholas-ruest/fix/signed-helper-verification-3565
fix(cli): re-verify signed critical helpers on every invocation, not just once (#3565)
2026-09-30 19:02:41 -04:00
rUv 8d7e3b26b9 Merge pull request #3579 from ruvnet/fix/3568-ledger-anchor
fix(policy): anchor the decision ledger head so truncation fails verification (#3568)
2026-09-30 18:56:38 -04:00
rUv 7840af50cf Merge pull request #3578 from ruvnet/fix/3572-swarm-progress
fix(swarm): status no longer invents 5% progress for a swarm with no tasks (#3572)
2026-09-30 18:51:59 -04:00
ruvandNick Ruest b72ca9f7d8 feat(doctor): report signed-helper integrity mismatches (#3565 follow-up)
Review finding on #3576: the issue asked that `ruflo doctor` report a
helper integrity mismatch, and doctor had no such check. Startup now heals
tampered helpers, but the paths it deliberately skips (.LOCKED,
RUFLO_HELPERS_LOCKED, an unverifiable package manifest, an unresolvable
package source) were invisible to doctor.

Adds `checkHelperIntegrity`, which reuses Nick's `verifyInstalledCriticalHelpers`
and the shared `CRITICAL_HELPERS` list (no second hard-coded copy), for both
<cwd>/.claude/helpers and ~/.claude/helpers:
- mismatch, not locked -> fail, naming the dir and files
- mismatch under .LOCKED / RUFLO_HELPERS_LOCKED -> warn (deliberate edit)
- manifest signature invalid -> fail closed
- package source not found -> warn instead of a false pass
Wired into the default run and `doctor --component helpers`.
`findPackageHelpersDir` is exported for the check. 8 new tests.

Co-Authored-By: Nick Ruest <nicholas-ruest@users.noreply.github.com>
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-30 18:02:38 -04:00
ruv 7d55ac6e77 fix(plugins): skip npm lifecycle scripts for untrusted plugin installs (#3557)
Withholding hooks was not enough: `npm install` ran the package's
preinstall/install/postinstall (and its dependencies') before the trust
decision, so an untrusted plugin's postinstall executed with the user's
privileges.

- installFromNpm passes --ignore-scripts unless --trust is given or the
  registry vouches for the plugin (official/verified); a warning names the
  skip and the --trust opt-in, and the manifest records scriptsRun.
- npm pack for checksum verification always runs with --ignore-scripts.
- upgrade keeps an install that recorded scriptsRun:false script-free.
- installFromLocal never runs npm or package scripts; it records
  scriptsRun:false.

Test drives real npm against a local tarball whose postinstall writes a
sentinel: no sentinel on a default install, sentinel with --trust. Both
cases fail on 755c70589.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-30 18:02:28 -04:00
ruv 18d6a7b70c fix(session): import round-trips and save actually includes memory (#3573, #3575)
#3575: `session import` passed a parsed `data` object to session_import,
which required `inputPath`, so it returned { error }; the CLI then printed
"Session imported" and crashed reading result.stats. The CLI now passes
the path, session_import also accepts an inline `data` record, and every
session subcommand checks the tool's { error } before printing success.
`session export` with no id now refuses (like delete) unless --latest is
given, and import/export help names the required positional argument.

#3573: session_save read only the pre-SQLite .claude-flow/memory/store.json,
which current installs never write, so --include-memory (default true)
saved nothing and reported "Memory Entries: 0". It now snapshots the live
memory DB plus rows found only in the sibling AgentDB store (deduped by
namespace+key), restore writes them back and reports the count actually
written, and the table says "not included" instead of an invented 0.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-30 18:02:04 -04:00
ruv 755c705895 fix(plugins): make --verify enforce trust and permissions on install (#3557)
`plugins install --verify` was parsed and never read, and a plugin's
declared trustLevel/permissions were neither recorded nor enforced, so an
"untrusted" local plugin declaring shell:exec/secrets:read registered its
hooks silently.

- Registry installs with a well-formed sha256 checksum are verified against
  the tarball actually installed (npm pack -> hash -> install that file) and
  fail closed on a mismatch. Placeholder checksums are reported as
  unverifiable and fall back to npm's own integrity check.
- Declared trustLevel and permissions are recorded in installed.json.
- Hooks and commands are withheld (and recorded under `withheld`) for a
  plugin that is untrusted/unverified or declares permissions beyond
  DEFAULT_PLUGIN_PERMISSIONS (memory:read), unless --trust is passed.
  Registry official/verified plugins are vouched for by the registry.
- --no-verify keeps the old behaviour and prints a warning.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-30 17:59:21 -04:00
ruv f090628452 fix(policy): anchor the decision ledger head so truncation fails verification (#3568)
The ADR-324 decision ledger is a hash chain, which rejects a modified or
deleted-middle receipt but not a deleted tail: a prefix of a valid chain is
itself a valid chain. Deleting the most recent receipts, or all of them, from
.claude-flow/policy/state.json still verified as valid: true.

- PolicyState gains ledgerHead/ledgerLength, updated in the same state write
  as every receipt append.
- verifyLedger fails with policy-ledger-truncated (or
  policy-ledger-anchor-mismatch) when the chain disagrees with its anchor, and
  answers an empty ledger distinctly (state: 'empty').
- appendReceipt refuses to extend a chain that no longer matches its anchor,
  so a new decision cannot re-anchor a truncated ledger and erase the evidence.
- Ledgers written before the anchor existed verify as valid and are anchored
  once (anchor: 'established-now'); truncation before that point is not
  detectable and is not claimed to be.
- verifyPolicyLedger is now a locked read instead of a write transaction, whose
  own post-operation check turned every failure into a generic
  policy-ledger-verification-failed. `policy verify` exits 1 when invalid.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-30 17:58:52 -04:00
ruv 2e8f419c22 fix(swarm): status no longer invents 5% progress for a swarm with no tasks (#3572)
getSwarmStatus() hard-coded progress to 5 whenever a swarm existed but had
no tasks, so `swarm status` rendered [##----] 5.0% forever, regardless of
how many agents were spawned. With no tasks there is nothing to be a
fraction of: progress is now null with progressReason "no tasks" (JSON)
and "Overall Progress: n/a (no tasks)" (text), matching the neighbouring
"Tokens Used: unknown" / "Success Rate: no data" fields. With tasks,
progress stays completed/total.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-30 17:58:06 -04:00
Nicholas RuestandRuFlo 3b885e5a7e fix(cli): re-verify signed critical helpers on every invocation, not just once (#3565)
`helper-refresh.ts` verified a critical helper's signature/hash once, at
copy time, then stamped the target dir with the installed CLI version.
Every later command short-circuited on "stamp already matches" with zero
further verification, so a critical helper (router.js, hook-handler.cjs,
etc.) modified on disk after that point — a sibling package's postinstall,
a losing writer from a concurrent-session race, direct tampering — stayed
silently modified through any number of subsequent commands, indefinitely.

Adds helper-integrity.ts: re-hashes each installed critical helper against
the signed manifest independent of the stamp. helper-refresh.ts now runs
this on every stamp-match call (both the lock-free fast path and the
under-lock authoritative path) and heals a mismatch via the existing
fail-closed verify-then-copy path. `.LOCKED`-marked installs are exempt —
a deliberate hand-edit is not tampering. index.ts surfaces a loud,
non-verbose-gated warning when tampering is detected and healed, for both
the project and global helper dirs.

Adds 4 new tests (heal-on-tamper, .LOCKED exemption, unverifiable-source
handling, genuine-no-op-when-intact) and updates one existing test whose
premise this fix intentionally changes (a same-version race between two
genuinely different signed sources has no real-world analog — production
always resolves one real trust root — so it's rewritten to assert no
redundant write happens once content is verified correct).

Verified: tsc --noEmit clean, full package build succeeds, compiled
dist/src/init/helper-refresh.js confirmed to no longer contain the bare
`if (stamped === version) return { refreshed: false }` #3565 flagged.
Full CLI test suite (4405 tests) passes except 4 pre-existing failures
unrelated to this change (confirmed against unmodified baseline / known
unbuilt-dependency issues in @claude-flow/mcp and @claude-flow/memory).

Fixes #3565

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-30 17:51:41 -04:00
Nicholas RuestandRuFlo 61d328278c fix(cli): remove vi.doMock race from doctor-memory-driver-3321 tests (#3552)
checkMemoryPersistenceDriver() now accepts an optional loadBetterSqlite3
dependency (default: the real dynamic import) instead of relying solely on
vi.doMock('better-sqlite3', ...) for fault injection. The mock-timing
approach raced beforeEach's real, unmocked driver init against the test's
mock registration — reliable in isolation but flaky under the full suite,
per #3552 ("expected 'pass' to be 'warn'").

Tests that fake the native driver now pass loadBetterSqlite3 straight into
checkMemoryPersistenceDriver(), removing the module-loader timing entirely.
vi.doMock is kept only where it still covers doctor's other checks during a
full runDoctor() pass (not the part that was flaking).

Verified 20/20 passing across 11 repeated runs, solo and alongside sibling
memory/doctor test files.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-30 13:46:05 -04:00
ruv 9ce71021d7 docs(readme): remove flo.ruv.io and goal.ruv.io
Drop the flo.ruv.io and goal.ruv.io badges, the two capability-table rows,
and the Web UI (Beta) and Goal Planner UI showcase sections from the README
and its mirrors (README.zh-CN.md, ruflo/README.md, the npm-published
v3/@claude-flow/cli/README.md). The apps' own READMEs (ruflo/src/ruvocal,
v3/goal_ui) are unchanged.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-29 14:39:50 -04:00
ruv af6d49a3bd release 3.48.0: re-sign helper manifest, re-anchor witness, baseline x-gateway registration test
- helpers.manifest.json re-signed for 3.48.0
- witness #1825 marker re-anchored to `"@claude-flow/memory": "3.` (the
  stable pin removed the `3.0.0-alpha.` string it quoted); all three OS
  manifests regenerated on a clean, fully built tree: 117/117 each
- plugins/ruflo-x-gateway/test/registration.test.mjs joins its siblings in the
  ratchet baseline: root vitest cannot resolve the plugin's own deps
  (nostr-tools). Its own `npm test` passes 74/74. This was the only CI failure
  on #3510.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-28 17:20:09 -04:00
ruv 2764e49173 release 3.48.0: stable internal leaves + guarded federation registration (3.47.0) on main
Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-28 17:17:36 -04:00
ruv e69bc340cf feat(federation): add guarded public registration and release 3.47.0 2026-09-28 17:16:02 -04:00
ruv 643f415db3 chore(release): point consumers at the stable internal leaves
All 18 internal @claude-flow/* leaves are now published at stable versions
(3.0.0; cli-core 3.7.0; plugin-agent-federation and plugin-iot-cognitum 1.0.0).
This moves every consumer onto them:

- cli: exact pins to the stable leaves (deps + optionalDeps)
- root package.json and codex: same
- audit-leaf-package-publish: drop the shared waiver, now resolved
- v3/.npmrc: prefer-workspace-packages=true. Without it pnpm replaced
  link:../cli with registry cli@3.47.1 (released from a branch not on main)
  and pulled its alpha cli-core/neural/memory deps into the lockfile.
- both lockfiles regenerated; only @claude-flow entries change
- CLAUDE.md: leaves follow the stable policy (embeddings excepted), the
  bundled four are dual-distributed, files allowlist / no publishConfig.tag
  rule, and the lockfile no longer proves a leaf was published

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-09-28 17:13:43 -04:00
rUv b636802d8c Merge pull request #3514 from rudycelekli/fix/analyze-import-redos-3511
fix(analyze): prevent import parser ReDoS on ordinary source text
2026-09-28 15:47:50 -04:00
rUv fa61df2ef2 fix(hive-mind): dispatch submitted tasks to workers and record results (#3524)
Three defects kept a hive task pending with its worker idle forever:

1. Nothing consumed the queue. `hive-mind task` only wrote a pending row;
   workers are records, not processes. New `hive-mind work` claims the
   oldest pending hive task, assigns it to an idle hive worker, runs it
   through `claude -p --output-format json`, and records the outcome via
   task_complete (or task_update status=failed).

2. task_assign/task_complete/task_cancel synced only
   `.claude-flow/agents/store.json`, but hive workers live in
   `.claude-flow/agents.json` (#1916). Assignment never marked a hive
   worker busy and completion never counted it. They now update
   whichever store holds the agent. task_update gains `result` and
   frees workers on `failed`.

3. `spawn --claude` fell back to passing `~/.claude.json` as
   --mcp-config. Where that file has no top-level `mcpServers` (a fresh
   desktop), Claude exits with "Invalid MCP configuration: mcpServers:
   Invalid input". The worker config is now always generated: servers
   are extracted from the source config, a `ruflo` server pinned to the
   running CLI is guaranteed, and CLAUDE_FLOW_CWD points it at the
   dispatcher's stores.

Also fixes the "Track with: hive-mind task-status" hint, which named a
subcommand that does not exist.
2026-09-28 11:38:57 -04:00
Rudy Celekli 80460a5e5e test(analyze): cover each supported import clause shape 2026-09-28 02:30:22 -04:00
Rudy Celekli 62265fa4ce test(analyze): isolate cached graph fixtures by unique directory 2026-09-28 02:19:46 -04:00
Rudy Celekli 1a9c5b678d test(analyze): resolve tsx across workspace install layouts 2026-09-28 02:19:00 -04:00
Rudy Celekli 650af44d22 fix(security): honor JSON and SARIF scan output formats 2026-09-28 02:15:56 -04:00
Rudy Celekli 153c7bcd04 fix(analyze): prevent exponential import regex backtracking 2026-09-28 02:10:56 -04:00
ruv 850bd7991e Revert "perf(hooks): restore the in-memory fast path for trajectory lookups"
This reverts commit 5a45b76c8. The fast-path broke trajectory-recovery-3199's
own regression test ("reloads a clean cache after another process adds a
step"): with vi.resetModules() simulating separate processes, a first
process's clean-but-now-stale in-memory copy would win over the freshly
persisted cross-process step, since the fast path never re-read disk when
the local cache was merely clean rather than empty. That's the exact
scenario #3467 was written to fix — the "cost" the fast path removed was
the correctness guarantee, not just overhead. Local runs of the
unmodified #3467 code average 20-46ms on graph-trajectory-hooks-smoke's
200ms budget; the one observed 1171ms CI failure is far more likely
explained by that round's runner queue (this same PR's other jobs sat
queued 40+ minutes on ordinary infra load) than a real regression.
2026-09-27 15:24:21 -04:00
ruv 5a45b76c80 perf(hooks): restore the in-memory fast path for trajectory lookups
#3467 made loadPendingTrajectory() always do two DB reads (completed +
pending) before returning, even when the trajectory is already tracked
cleanly in-process — turning every trajectory-step/post-task call into
a synchronous round-trip instead of a Map lookup. CI's
graph-trajectory-hooks-smoke (ADR-130 P3, <200ms budget) failed once on
a loaded runner at 1171ms; local runs stayed at 20-46ms, so this was
likely a transient load spike, but the always-hit-disk path was real
overhead regardless. Skip both reads when the id is already a clean
(non-dirty) in-memory hit — the case #3467 didn't change (same-process,
not-yet-restarted). The disk-recovery path #3467 added still runs
exactly when it's needed: on a cache miss (e.g. after an MCP restart).
2026-09-27 15:07:49 -04:00
ruv 1d79068c56 fix(ci): repair CI regressions surfaced by the integrated community fixes
- plugins/ruflo-adr smoke step 20: #3432 correctly split the memory-db
  cwd into a more precise DB_ROOT (nearest .git/.swarm ancestor of ROOT),
  but the smoke check still only recognized the literal `cwd: ROOT`
  string. Accept `cwd: DB_ROOT` too.
- plugins/ruflo-core smoke step 6: #3428 replaced the old "pinned to
  v3.6" CLI compatibility line with an accurate description of the new
  resolve-installed-before-npx-fallback contract. Updated the smoke
  check to verify that contract's env vars are documented instead of a
  version pin that no longer exists.
- session-tools.ts: CodeQL flagged Math.random()-derived session IDs as
  insecure randomness in a security context, newly reachable through
  #3486's activate path. Switched both session ID generators to
  randomUUID(), matching the convention already used in mcp-server.ts
  and autopilot-state.ts.
2026-09-27 13:30:29 -04:00
ruv b23bf44820 chore(security): re-sign helpers manifest after helper content changes from #3433 2026-09-27 13:20:50 -04:00
ruv 2d8bab762f Merge PR #3486: fix(session): restore imported state before reporting activation 2026-09-27 13:15:52 -04:00
ruv 4dc4045111 Merge PR #3485: fix(memory): enforce TTL when retrieving and searching live rows 2026-09-27 13:15:52 -04:00
ruv b9f60a948c Merge PR #3483: fix(tasks): preserve current agent ownership during task retirement 2026-09-27 13:15:51 -04:00
ruv e62e96cc43 Merge PR #3482: fix(session): honor memory exclusion when exporting snapshots 2026-09-27 13:15:51 -04:00
ruv 6161543407 Merge PR #3481: fix(memory): evict cached entries after namespace purge 2026-09-27 13:15:50 -04:00
ruv 1be3f4ca37 Merge PR #3480: fix(memory): preserve namespace and key identity in entry cache 2026-09-27 13:15:50 -04:00
ruv b757009733 Merge PR #3479: fix(session): honor component selectors before restoring stores 2026-09-27 13:15:50 -04:00
ruv c53284abed Merge PR #3478: fix(tasks): align CLI assignment and listing with persisted handlers 2026-09-27 13:15:49 -04:00
ruv 3b379389e5 Merge PR #3477: fix(cli): preserve formatter receivers in threat and cycle reports 2026-09-27 13:15:49 -04:00
ruv a83aa4307a Merge PR #3472: fix(mcp): isolate and bound governance audit logs 2026-09-27 13:15:49 -04:00
ruv b5105bda5e Merge PR #3471: fix(graph): query retained SQL relationships for k-hop 2026-09-27 13:15:48 -04:00
ruv f48d214961 Merge PR #3470: fix(mcp): flag handler errors in tool result envelopes 2026-09-27 13:15:48 -04:00
ruv 7f9b880c03 Merge PR #3469: fix(learning): preserve zero quality and reject invalid scores 2026-09-27 13:15:48 -04:00
ruv 6832f18d19 Merge PR #3468: fix(metaharness): stop help and invalid flags before execution 2026-09-27 13:15:47 -04:00
ruv 3e6a2d5377 Merge PR #3467: fix(learning): recover pending trajectories after MCP restart 2026-09-27 13:15:47 -04:00
ruv 5de84d6040 Merge PR #3466: fix(memory): validate encrypted backup images before recovery 2026-09-27 13:15:46 -04:00
ruv 9cf5509cdb Merge PR #3465: fix(memory): remove default CLI entries from the AgentDB mirror 2026-09-27 13:15:46 -04:00
ruv b7e6083201 Merge PR #3464: fix(adr): retain qualified relations without inventing narrative edges 2026-09-27 13:15:46 -04:00
ruv 2ea6a97c44 Merge PR #3463: fix(memory): honor the selected database in memory stats 2026-09-27 13:15:45 -04:00
ruv 580980a0fe Merge PR #3462: fix(learning): create skills from validated task patterns 2026-09-27 13:15:36 -04:00
ruv 58f4d1a26a Merge PR #3461: fix(memory): confirm cleanup before dispatching deletion 2026-09-27 13:15:01 -04:00