- helpers.manifest.json re-signed for 3.49.0
- verification/{linux,macos,windows}/manifest.md.json regenerated on a clean,
fully built tree: 117/117 verified each, os field stamped per manifest
Co-Authored-By: RuFlo <ruv@ruv.net>
security 3.0.1 carries the #3568 policy-ledger truncation fix (bundled into
the train and published standalone). codex's security pin relaxes to ^3.0.0
so the workspace keeps linking the local security package; codex source is
unchanged.
Co-Authored-By: RuFlo <ruv@ruv.net>
Resolves the helper-refresh.ts import conflict with #3576 (Nick Ruest's
post-install integrity re-check) by keeping both imports, and runs
ensureCommonJsCompanions after the #3565 heal path rewrites helpers too,
so a healed install also gets its .cjs companions (#3555).
Co-Authored-By: Nick Ruest <nicholas-ruest@users.noreply.github.com>
Co-Authored-By: RuFlo <ruv@ruv.net>
hook-handler.cjs also safeRequire()s session.js and memory.js, which are
CommonJS and fail in "type":"module" projects exactly as router.js did:
session-restore/-end then fall back to placeholder output and no session
is recorded. (In this repo the root copy already had session.cjs and
memory.cjs, so the .js requires never loaded anything at all.)
- rename the packaged session.js / memory.js to .cjs; hook-handler (both
copies and the generated one), generateHelpers and the init generator
fallback now use the .cjs names
- neither helper is in the signed critical set, so a pre-rename install
whose hook-handler gets refreshed would lose them: the refresh and
`init --upgrade` now write any missing session.cjs / memory.cjs from the
compiled generators (helper-companions.ts). Stale .js copies are left in
place and ignored; existing .cjs files are never overwritten
- hook-handler exports loadedHelpers so loading can be verified
- helpers manifest re-signed (hook-handler.cjs content changed)
Co-Authored-By: RuFlo <ruv@ruv.net>
Follow-up to drakeo338's fix, closing the remaining gaps found in review:
- Keys: MCP memory_store rejected `../` in keys, but CLI `memory store`
and `memory_import` accepted it. The MCP rule (DANGEROUS_KEY_PATTERN)
is now exported through `memoryKeyError()` and used by all three;
import checks every key up front, so a bad file writes nothing. Keys
with a plain `/` (`probe/x`) stay legal.
- Purge: `purgeNamespace` used its own NAMESPACE_PATTERN, which rejected
`:`, so `team:alice` could be stored and exported but never purged. It
now uses `validateIdentifier`, like the other three operations.
- MCP memory_store: namespaces only faced the key blacklist, so
`proj/sub` was accepted there but rejected by export and purge. It now
uses `validateIdentifier` too.
Tests added to memory-store-import-namespace-3570.test.ts: each gap fails
on the prior head and passes here, plus a round-trip table asserting that
CLI store, MCP store and purge accept exactly the namespaces export
accepts.
Co-Authored-By: drakeo338 <drakeo338@users.noreply.github.com>
Co-Authored-By: RuFlo <ruv@ruv.net>
`memory search --build-hnsw` printed "Search speedup: 12,500x / 150x / 10x"
chosen purely by entry count, and `memory stats` printed "150x-12,500x
faster search". The repo's measured numbers are ~1.9x-4.7x above the
crossover; the multiplier was never reproduced in-tree. Removed the
speedup line and the stats banner, and dropped the claim from the
backend hint and the --build-hnsw option description. No multiplier is
asserted anywhere in memory.ts now.
Co-Authored-By: RuFlo <ruv@ruv.net>
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>
`.claude/helpers/router.js` is CommonJS but shipped with a `.js`
extension. In any project whose package.json declares "type":"module",
Node loads it as ESM, `require` is undefined, it throws on load, and
hook-handler.cjs silently falls back to "Router not available, using
default routing" — so ADR-389's word-boundary routing fix never ran in
exactly the projects most new Node code uses.
Rename the shipped helper to router.cjs everywhere it is produced or
consumed: the packaged copy, the repo-root copy's hook-handler require,
helpers-generator (router + generated hook-handler), init executor
(upgrade copy list + generator fallbacks), helper-refresh
CRITICAL_HELPERS + generator fallback, sign/verify-helpers critical
lists, and the helper-signing security smoke. The helpers manifest is
re-signed. A stale router.js left in an existing install is harmless:
nothing requires it any more.
Co-Authored-By: RuFlo <ruv@ruv.net>
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>
#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>
`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>
suggestAgentsForTask() ended with a hard-coded { confidence: 0.7 } reached
only when no keyword or learned pattern matched. Blank, punctuation-only and
non-English tasks therefore routed to `coder` at 70%, above a correctly
routed "deploy the release to production" (62%).
The no-match path now returns NO_MATCH_CONFIDENCE (0.3, below every real
signal: keyword hits >= 0.8, learned >= 0.7, eligible semantic > 0.4, and the
same value the helper router already uses) with matched: false,
reason: 'no-match-default' and a note saying why (no words, or the keyword
matchers are English-only). Tasks with no letters or digits skip semantic
scoring. hooks_route, hooks_explain and hooks_pre-task surface the marker;
the CLI labels the box "Default Suggestion (nothing matched)", reports
success probability as unknown, and refuses a whitespace-only --task like an
empty one.
Co-Authored-By: RuFlo <ruv@ruv.net>
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>
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>
0.1.5 is already claimed by open PR #3553 and built as the live
edge-next image (ruflo-ai-team:0.1.5-edge-263c2c2).
Co-Authored-By: RuFlo <ruv@ruv.net>
`memory search` and `memory retrieve` disclosed the sibling AgentDB store
(.swarm/agentdb-memory.db, written by the MCP path) only in their
empty-result branches, so a partial hit ("Found 1 results") read as
complete while the other store's rows went unread. The disclosure now
runs on every search path (semantic, hybrid, keyword-only, text and
JSON) and on a found retrieve, worded as "Partial result: N matches
came from the store read here". Warnings go to stderr, so --format json
and --value-only stdout stay parseable.
Also: `memory import` reported "Vectors: 0" while every value was
re-embedded. The memory_import tool now counts the vectors storeEntry
actually wrote.
Fixes#3566
Co-Authored-By: RuFlo <ruv@ruv.net>
MCP discovery (initialize, ping, tools/list, prompts/list, resources/list)
stays anonymous on purpose, but every response carried
`access-control-allow-origin: *`. Replace it with an explicit allowlist
(chatgpt.com, chat.openai.com, claude.ai by default; ALLOWED_ORIGINS
replaces it), echo only an allowlisted origin with Vary: Origin, and send
no ACAO header otherwise, including on 401 responses. Server-to-server
calls without an Origin header are unaffected.
Document exactly which methods are public and why in the README, and bump
the service to 0.1.5.
Co-Authored-By: RuFlo <ruv@ruv.net>
`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>
Ships the gnn.ts SQL-injection fix (#3531, merged in #3564) to npm. The
registry's 3.0.0 predates the fix and still interpolates node ids and
schema/table/column identifiers into executed SQL.
Co-Authored-By: RuFlo <ruv@ruv.net>
The CLI store path and memory_import wrote a namespace containing ../,
which memory export and purge reject, leaving entries they cannot read or
clean up. Validate with validateIdentifier before any write; import checks
every entry first so a bad file persists nothing.
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>
BaseGNNLayer.toSQL, GraphOperations' kHopNeighborsSQL/shortestPathSQL/
pageRankSQL/communityDetectionSQL, and GNNSQLGenerator's static SQL
builders interpolated schema/table/column identifiers and node id/
algorithm string values directly into executed SQL. TypeScript types
are erased at runtime, so any caller passing through untrusted input
reached executed SQL (CWE-89).
Adds sqlIdent/sqlLiteral/sqlNumber/sqlInt/sqlJson/sqlParamPrefix
helpers mirroring attention.ts's existing sqlNumber/sqlBool hardening
(PR #3530): identifiers are validated against ^[A-Za-z_][A-Za-z0-9_]*$
and quoted, string values are single-quote-escaped, numeric params are
validated finite/integer, and JSON config blobs are escaped before
embedding in a jsonb literal (a `'` inside a config value could
previously break out of the surrounding SQL string).
Adds __tests__/gnn-sql-injection.test.ts (24 tests, mirroring the
existing attention-sql-injection.test.ts pattern): byte-identical SQL
for legitimate input, and a TypeError for each malicious identifier/
value/numeric field. Verified baseline-fails/candidate-passes via
stash isolation (22/25 new tests fail against the unpatched file, all
pass against the fix). Full plugins suite: 473 passed/3 skipped both
before and after, tsc --noEmit clean.
Fixes#3531
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>
reasoningbank-adapter: generatePatternId() appended Date.now(), so a repeated
successful trajectory merged into its existing pattern only when both calls
fell in the same millisecond. Otherwise it created a duplicate pattern with
usageCount 1 (the adapter never learned from repeats), and the
"update existing pattern" test failed intermittently in CI. The id is now a
pure function of the goal (slug + FNV-1a of the full normalized goal). A new
test pins Date.now to two different values; it fails on the old code.
v3-ci Build V3 (macos-latest): when the better-sqlite3/hnswlib-node prebuild
download times out, node-gyp compiles from source and macos-latest's Python
3.12 has no distutils. Pin Python 3.11 on macOS so the fallback works.
Co-Authored-By: RuFlo <ruv@ruv.net>
#3534 added plugins/ruflo-x-gateway/test/claude-directory.test.mjs, a
node:test file. Root vitest finds no suite in it and the ratchet fails on
main and on every PR since. Same treatment as its three sibling files; the
plugin's own `npm test` passes 84/84.
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(plugin): add multi-tenant RuFlo AI Team service
* fix(plugin): isolate AI Team validation from root test discovery
* fix(plugin): document deployment option precedence
* fix(plugin): satisfy Claude directory manifest and tool scoping
* fix(plugin): isolate Claude directory review bundle
* fix(plugin): include Claude MCP endpoint declaration
* docs(plugin): complete Claude directory listing links
* docs(plugin): disclose personal data and retention
* feat(plugin): publish complete RuFlo Claude marketplace