* feat(funnel): count plugin-only users via the ruflo-core MCP launch
Plugin-only users never run init, so no SessionStart hook refreshes the
funnel cache and they are invisible in the usage numbers. The ruflo-core
launcher now sets RUFLO_LAUNCH_SURFACE=plugin; mcp start (stdio) makes the
existing 6h-cached /v1/messages fetch off the start path, gated on
resolveFunnelEnabled(), and the User-Agent gains ' surface/plugin' from a
closed allowlist. Nothing is written to stdout. LIA updated.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ruflo-core): keep RUFLO_MCP_SPAWN inside the env-precedence audit window
The four-line insertion pushed the existing RUFLO_MCP_SPAWN read past the
audit's 20-line function-signature heuristic. Collapse it to one line and
move the explanation to the header comment.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
44 of the 48 `plugins/*/.claude-plugin/plugin.json` manifests had no
`repository`, while the four that do already point at the repo URL their
`homepage` names. The field is what the directory listing and
`npm view` read, and its absence is invisible until something reads it.
Add it to the 44 that lack it, then make `scripts/audit-plugin-manifest.mjs`
enforce it so the next plugin cannot ship without one:
- check 6 in the script header, the violation in `auditManifest`, and the
clean-run summary line. A manifest may carry the repository as a string or
as an object's `url`; anything else is reported as missing, and a value that
is not an http(s) URL is reported separately.
- the required-field lists in `create-plugin` and `validate-plugin` skills, so
a scaffolded plugin passes the gate it is told to satisfy.
Verified with the repo's own gates:
- `node scripts/audit-plugin-manifest.mjs` scans 48 manifests, clean.
- removing the field from one manifest reports `repository field: missing or
empty` and exits 1; setting it to `ruvnet/ruflo` reports `repository is a URL`
and exits 1; restoring it exits 0.
- `node scripts/check-plugin-manifests.mjs` is unchanged by this diff (its two
nested-manifest findings belong to `ruflo-ai-team/directory` and
`ruflo-x-gateway/directory`, which this change does not touch).
- `node scripts/audit-plugin-secrets.mjs` clean, 48 manifests.
No plugin version is bumped: the installed artifact's behaviour does not change
and no user-visible surface reads the field from an installed copy, so there is
nothing for a version bump to deliver. The `Plugin version bump` workflow will
flag the 44 manifests it sees as shipped files, and this PR needs the
`skip-plugin-version-check` label rather than 44 unrelated version bumps that
would collide with each plugin's own release cadence.
Closes#4774
- hooks_intelligence_learn advertised trajectoryIds but never read it, so a
scoped request ran global learning. The learning path cannot select, so an
explicit selection is now refused before anything is imported or mutated.
- agentdb_context-synthesize summarizes validated task episodes; its description,
the research-synthesize skill (ruflo-goals 0.4.6) and the researcher agent
(ruflo-core 0.2.14) no longer send research documents to it.
Co-Authored-By: RuFlo <ruv@ruv.net>
mcp-launch picked v3/@claude-flow/cli inside a ruflo checkout because bin/cli.js and dist/src/index.js existed, then died on a bare ERR_MODULE_NOT_FOUND when dist/ predated src/. Claude Code hides stderr behind 'Skipping connection', so the cause was invisible.
Catch the missing-module import failure, print the rebuild command and the run-outside-the-repo option, and fall back to npx @latest. RUFLO_MCP_CLI_OVERRIDE, RUFLO_MCP_SKIP_NPX=1 and other error types still exit 1.
Co-authored-by: RuFlo <ruv@ruv.net>
* feat(plugins): ADR-507 cut the per-turn plugin footprint
- scripts/measure-plugin-footprint.mjs: per-plugin skills/commands/agents,
listing characters and estimated tokens, from the tree or a git ref;
before/after reports in v3/docs/validation/.
- 27 operational skills get disable-model-invocation: true (cost-tracker
sub-reports reached by /ruflo-cost, metaharness bench/learn/evolve/mint/
oia-audit, GAIA submission + comparison, init-project, ruflo-status,
vector-setup, federation-init, agntcy-status). Each is listed in a
"User-invoked skills" table in its plugin README; the choosing rule is in
plugins/README.md.
- 20 skill descriptions over 300 characters cut to one sentence plus
"Use when".
- audit-skill-frontmatter: 300-char ceiling on skill and command
descriptions (measured unfolded) and a README check for every
user-invoked skill.
- skillTrim (§2.4) not built: the engine has no skill-listing hook.
Listing with every plugin enabled: 47,743 -> 39,402 chars
(about 11,936 -> 9,851 tokens per turn).
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-507 status names PR #4588
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(plugins): ADR-507 cost-analyst points users at /ruflo-cost for user-invoked reports
The engine's refusal for a disable-model-invocation skill says not to
replicate its workflow by other means, so the agent names the subcommand
instead of running the report script. After-report now cites the pushed
commit.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(scripts): ADR-507 audit runs through symlinked paths; test the gate's wiring
The import guard compared argv[1] with import.meta.url, which Node realpaths
for the entry module. Run through a symlinked path, main() was skipped and the
audit exited 0 having checked nothing. Both scripts now compare realpaths.
audit-skill-frontmatter takes --plugins-dir so tests can run the real CLI on
a fixture: a 304-char folded description, an unlisted user-invoked skill and
a 311-char literal command description must exit 1 with those findings, and
adding the README row must clear only the user-invoked one. The repo-wide test
now also asserts skillsScanned > 100. Disabling any of the three checks, or
restoring either old guard, fails a test.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(plugins): version bumps for ADR-507 footprint changes
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* fix(witness): support pinned signing keys and label legacy signatures
The default witness seed is derived from the public git commit, so anyone can re-sign a modified manifest; verify.mjs still called the result cryptographically valid. Add RUFLO_WITNESS_SEED for external-key signing and RUFLO_WITNESS_PUBLIC_KEY for pinned verification (fail closed on external-key manifests without a pin), tag legacy manifests as self-attested, and stop describing the default as authorship proof.
* fix(witness): make --public-key win over the env pin
The env-var precedence audit requires a CLI flag for RUFLO_WITNESS_PUBLIC_KEY. Add --public-key, document that it takes precedence, and cover both precedence directions in the auth test.
* fix(ci): exclude witness-auth test from vitest ratchet (uses node:test)
plugins/ruflo-core/scripts/witness/__tests__/witness-auth.test.mjs imports
from node:test, not vitest, matching the same miscategorization pattern as
pod-tick.test.mjs and probe-mod-guards.test.mjs. vitest's glob picks it up
but can't parse node:test's API, so the ratchet reports "No test suite
found" even though `node --test` passes all 3 cases cleanly.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
Co-authored-by: RuFlo <ruv@ruv.net>
- #4127: PostToolUseFailure registered for Bash and Write|Edit|MultiEdit and forwarded with -s false and the real exit code (builds on #4170 by @rudycelekli; payload shape verified against Claude Code 2.1.289)
- #4176: the hook shim starts the CLI from CLAUDE_PROJECT_DIR; the CLI only adopts a proven config in a directory that carries ruflo init's markers, not a bare .claude/ that Claude Code created
- #4128: the shim starts the CLI detached and returns at once (about 25 ms instead of 0.2-4 s per hook), bounded to 4 concurrent telemetry CLIs per project, Stop never dropped, RUFLO_HOOK_SYNC=1 for the old path
- ruflo-core 0.2.9
Co-Authored-By: RuFlo <ruv@ruv.net>
#4057: with encryption at rest on, `memory purge`'s sql.js fallback rewrote a
plaintext native SQLite store as an RFE1 blob and still printed [OK]; the
native bridge and every SQLite reader then rejected the file. Every whole-file
read-modify-write (purge, delete, get access-count, store, schema migration,
decay) now writes the image back in the format it read (plaintext -> plaintext,
RFE1 -> RFE1) via writeDbImagePreservingFormat. applyTemporalDecay also read
the raw bytes, so it failed on encrypted stores, and wrote plaintext: both
fixed.
#4056: `hooks post-command` stored every Bash command in full with no off
switch. Add CLAUDE_FLOW_HOOKS_RECORD_COMMANDS=0 / CLAUDE_FLOW_HOOKS_ENABLED=false /
hooks.recordCommands=false (nothing is stored when off), redact common secret
shapes and cap stored text at 2000 chars (bounded patterns, linear on hostile
input). `memory cleanup --expired-only` never saw expired rows because
listEntries hides them (TTL is a read-time rule): listEntries gains
includeExpired + expiresAt, and memory_cleanup uses it. ruflo-core 0.2.8: the
Bash shim stands down when recording is off.
Co-Authored-By: RuFlo <ruv@ruv.net>
Verified every CLI flag and MCP call example in ruflo-core, cost-tracker, daa,
ddd, deepseek-harness, docs, federation and goals against the published CLI
(3.56.5) and the tool schemas in source:
- hooks post-task has no --train-neural (8 agents/skills); neural train takes
--pattern, not --pattern-type; hooks worker dispatch takes --context, not
--scope (docs scoping was silently ignored).
- agentdb_* examples used non-existent parameters (semantic-route query ->
input; causal-edge from/to/type -> sourceId/targetId/relation; hierarchical
store/recall path/data/depth -> key/value/tier and query/topK; pattern-search
limit -> topK; context-synthesize sources -> maxEntries); ddd skills used a
CLI-style --parent/--child form that failed on required key/value. The
researcher agent now follows edges with graph-query/graph-pathfinder.
- hooks_worker-status has no worker filter; cost docs now filter the result.
- dossier-collect/investigator fetch web content: add untrusted-content rules
and AIDefence screening. deepseek skills state the data egress.
- Stale smoke/tool/command counts and four dead relative links fixed.
Patch-bumps each changed plugin with a CHANGELOG entry.
Co-Authored-By: RuFlo <ruv@ruv.net>
A home-level helper or a user-level plugin hook serves every opened project.
hook-handler.cjs and statusline.cjs executed a CLI found under the project
(<cwd>/node_modules/{@claude-flow/cli,ruflo}, <cwd>/v3/...), and every npx
fallback ran with the project as cwd, where npx prefers the project's own
install. The plugin shims also resolved `ruflo` through relative PATH
entries, which resolve against the cwd.
- hook-handler.cjs / statusline.cjs (package and repo copies): candidates
are built from the helper's install root; for a project-local helper that
is the project, so its behaviour is unchanged.
- npx fallbacks pass `--prefix <helper root>` (generated hook-handler and
ruflo-hook.cjs too) or, in the plugin shims, `--prefix <plugin data dir or
home>`. The spawned CLI still runs with the project as its cwd.
- ruflo-hook.cjs (all four copies): relative/empty PATH entries are skipped.
Test: helper-cli-resolution-trust.test.ts (11 cases, 10 fail on main);
hook-handler-artifact-parity follows the npx args into cliSpawnArgs().
The signed helpers changed, so the helpers manifest needs re-signing.
mcp-launch.cjs spawned `node <bin>/cli.js mcp start` as a child even when a
built local/global CLI resolved, so every Claude Code session kept a second,
idle node.exe alive just to forward stdio and signals.
When a local CLI resolves, import it in-process with process.argv rewritten
to the exact argv the child used to get. The npx fallback still spawns.
RUFLO_MCP_SPAWN=1 restores the child-process behaviour.
Measured (Windows 11, Node 24.21, @claude-flow/cli 3.56.3, median of 3,
post-GC, after initialize + tools/list):
processes 2 -> 1, working set 149.3 -> 87.6 MB, private 74.0 -> 52.2 MB,
spawn->initialize 1320 -> 729 ms; tools/list sha256 unchanged (8a723dc0...).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ruflo-core MCP launcher spawned `@claude-flow/cli mcp start` with its
own process.cwd() and never consulted the session's project directory, so
MCP tools could read/write .claude-flow state (hive-mind, swarm, memory)
in a different folder than CLI commands, producing split-brain state.
- mcp-launch.cjs: resolve the project dir (CLAUDE_PROJECT_DIR, then
CLAUDE_FLOW_CWD, then launcher cwd; home/root/missing dirs skipped),
spawn the server with that cwd and CLAUDE_FLOW_CWD set, probe local
CLI installs from it, and warn on stderr when there is no project.
- cli-core getProjectCwd(): treat filesystem roots (incl. C:\) and the
home dir (os.homedir(), $HOME, $USERPROFILE; case/trailing-sep
insensitive on win32) as "no project". The old `=== process.env.HOME`
guard was a no-op on Windows where HOME is usually unset.
Tests: node:test end-to-end launcher cases + vitest spec for the guard.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hook-handler.cjs (both copies) returns before any work for route or
post-edit when the ruflo mod, running in the same Claude Code process, has
named them in RUFLO_MODS_OWNS. Guards (pre-bash) and session hooks never
hand over, whatever the variable says. ruflo-core's ruflo-hook.cjs stands
down for post-edit likewise, so an edit is recorded exactly once.
hook-handler.cjs content changed: the helpers manifest must be re-signed at
release (helper-signing.test.ts fails on the hash until then).
Co-Authored-By: RuFlo <ruv@ruv.net>
- 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.
override.split(' ') broke process.execPath into 'C:\Program' plus stray
tokens on a standard Windows Node install (C:\Program Files\nodejs\node.exe),
since the override string wasn't quote-aware. Found while verifying #3332's
Windows argv fix on a real Windows machine: 3 of 32 plugin-hooks-smoke cases
failed only on a stock Windows dev box, not on windows-latest CI (whose
hostedtoolcache Node path has no space).
RUFLO_HOOK_CLI_OVERRIDE is a test-only escape hatch, never set in
production, so this has no user-facing impact — it only unblocks the
test harness on the common case of a Program-Files Node install.
Adds splitCliOverride(), a minimal double-quote-aware tokenizer, and
quotes the two override strings test-hooks.mjs builds from
process.execPath.
#3322 escaped argv on the Windows shell:true path in
plugins/ruflo-core/scripts/ruflo-hook.cjs. The same shim exists in three
other places, which still pass hook-derived values (a Bash tool's
`command`, a file path) to cmd.exe unescaped, and are broader than the
copy that was fixed — a bare `process.platform === 'win32'` with no
exemption for `node`:
- .claude-plugin/scripts/ruflo-hook.cjs (published in the npm package)
- plugin/scripts/ruflo-hook.cjs (byte-identical sibling)
- generateRufloHookCjs() in helpers-generator.ts, which `ruflo init`
writes to .claude/helpers/ruflo-hook.cjs
All four now follow one pattern — resolve, then escape:
- resolveCommandPath() walks PATH/PATHEXT with fs only. The previous
probe was `execSync('where ' + cmd)`, which spawned a shell on every
hook invocation.
- resolveNpmShim() maps an npm .cmd shim to the .js entrypoint it would
have run, read from the package's own `bin` field rather than a
guessed filename, and required to resolve inside the package
directory. Both npm layouts are handled (global prefix and
node_modules/.bin), as is npx, whose command and package names differ.
- invokeHook() spawns `node <entry>` with shell:false, so CreateProcess
receives the argv array verbatim — no second cmd.exe tokenizer, and no
%VAR% expansion, which quoting does not suppress and carets do not
reliably escape.
- escapeCmdArg() is unchanged from #3322 and remains as the fallback for
the case where no entrypoint can be identified. Returning early there
would silently drop the hook instead of surfacing the problem.
escapeCmdArg, resolveCommandPath, resolveNpmShim and resolveInvocation are
byte-identical across all four copies, and the suite asserts that for each
of them — the divergence between copies is what let this persist after
#3322.
Verification. #3322 could only assert the string transform, with no
Windows host available. Two changes address that:
- resolveCommandPath/resolveInvocation take `platform` and `env` as
arguments, so the Windows branch runs on any OS. The tests build a real
npm layout in a temp dir, drive it with { platform: 'win32' }, and
assert the payload reaches the recorded argv byte-for-byte while the
sibling .cmd/.ps1 are resolved past, never executed.
- the coverage is added to plugins/ruflo-core/scripts/test-hooks.mjs,
whose "Plugin hooks smoke" job already runs on windows-latest. The
existing cases there go through RUFLO_HOOK_CLI_OVERRIDE and so never
reach the global-shim branch; these call invokeHook() directly, so the
fallback is executed against a real cmd.exe.
Tests: 11 vitest cases and 6 new harness cases, each mutation-checked —
every one fails when the code it covers is reverted. test-hooks.mjs goes
19/24 to 25/30 against the recorder fixture; those 5 failures are
pre-existing on main (the fixture does not echo argv) and pass in CI
against the real built CLI.
Windows result: the windows-latest leg ran green, 32/32, including the
escaped fallback executed against a real cmd.exe. The %VAR% probe was
included because carets are not a reliable escape for % and quoting does
not suppress percent expansion, so expansion on the shim's second parse
looked plausible; the runner measured otherwise and the value arrives
literal, with no redirection performed. The probe stays as a regression
guard and keeps reporting the observed value rather than asserting one.
Out of scope: nine sites in plugins/ruflo-metaharness/scripts spawn with
`shell: process.platform === 'win32'` and a dynamic argv element —
_darwin.mjs:86/129 spread the caller's own ...argv, oia-audit.mjs:105 passes
JSON.stringify(payload), and audit-list/audit-trend/similarity pass
`--key <key>`. Same shape, different plugin, separate change.
Two neighbours that look like the same problem and are not: the ten `shell:`
flags across ruflo-cost-tracker are inert, because spawnNpxSync() discards
the option and forces shell:false; and mcp-launch.cjs already prefers a
resolved local bin with shell:false and only falls back to npx.cmd with
constant args.
loadEd25519() threw an error telling callers to set WITNESS_ED25519_ROOT
when @noble/ed25519 couldn't be found, but the function never read
process.env — the env var had no effect. Prepend it to the probe list
so the advertised escape hatch actually works.
Fixes#3200
Co-authored-by: rUv <ruv@ruv.net>
* fix(federation): verified event identity must win over publisher-controlled content
fetchRecent/fetchManyOn/fetchChannel spread the parsed message content
after the signature-verified id/pubkey/created_at, so a publisher could
put those keys in their own content and overwrite their verified
identity downstream (reduceClaims trusts .pubkey for claim
release/handoff authorization). Reorder so verified fields always win.
Also in x-federation-channels.ts: reqEvents() never called verifyEvent()
at all, so channel-read/grant-accept events were trusted unsigned; add
the check. Same content-override reorder in x_federation_channel_read.
fix(hooks): escape argv for the Windows shell:true npm-shim path
ruflo-hook.cjs's invokeHook() passes hook-derived values (command text,
file paths) through cmd.exe via shell:true to resolve npm's .cmd/.ps1
shims. Node does no escaping in that mode, so a value containing a
cmd.exe metacharacter could be reinterpreted as a separate command or
redirection instead of reaching the CLI as data. Add escapeCmdArg()
(qntm.org/cmd algorithm, same one cross-spawn uses) and apply it to
every argv element on that path.
No native Windows/cmd.exe available to execute this end-to-end in this
environment — verified at the string-transform level only (8 unit
tests). Real Windows execution remains a required follow-up gate.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01RYP825phHMjPRmmjkcAWpq
* fix(ci): register new hook test env var and test file with CI guards
Follow-up to the previous commit's escape-cmd-arg.test.cjs:
- Register RUFLO_HOOK_UNIT_TEST in audit-env-var-precedence.mjs's
KNOWN_ESCAPE_HATCHES, matching the existing RUFLO_HOOK_CLI_OVERRIDE/
RUFLO_HOOK_DEBUG_STDOUT entries for the same file.
- Register plugins/ruflo-core/scripts/escape-cmd-arg.test.cjs in
ci-test-baseline.txt, matching the sibling mcp-launch.test.cjs entry —
both are node:test-based .cjs files that vitest's own JSON reporter
marks "failed" (it doesn't recognize the node:test API) even though
every test inside genuinely passes under `node --test`.
Verified locally: node scripts/audit-env-var-precedence.mjs now passes
(exit 0). A scoped `vitest run` + `ci-test-ratchet.mjs --report` against
just these two files confirms escape-cmd-arg.test.cjs is no longer an
unexpected failure (the one remaining flagged file is a stale local
worktree artifact under .claude/worktrees/, not part of a clean CI
checkout).
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01RYP825phHMjPRmmjkcAWpq
ADR-382 Part A:
- plugins/ruflo-core/.mcp.json launched the MCP server via a bare
`npx -y @claude-flow/cli@latest`, which always re-resolves to the
newest registry version regardless of any local `npm install
@claude-flow/cli` a user separately pinned. Add scripts/mcp-launch.cjs,
a small launcher mirroring hook-handler.cjs's resolveCliBinForHook()
(candidate list + dist/src/index.js existence guard against a
source-only marketplace checkout), and point .mcp.json at it via the
documented ${CLAUDE_PLUGIN_ROOT} substitution. Falls back to the
original npx @latest invocation only when no local install resolves.
- .claude-plugin/marketplace.json listed 35 plugins while plugins/ has
38 directories; register the 3 missing ones (ruflo-agntcy,
ruflo-bbs-federation, ruflo-business-pods), descriptions sourced from
each plugin's own .claude-plugin/plugin.json.
Ref: ADR-382, #2971
Codex's plugin hook-manifest loader accepts only `description` and
`hooks` at the top level and hard-rejects the rest of the manifest on
anything else. plugins/ruflo-core/hooks/hooks.json and
plugins/ruflo-cost-tracker/hooks/hooks.json carried `_note` /
`_platform_note` documentation fields, so a fresh Codex install of
ruflo-core@ruflo (still true as of the currently-published 3.32.38 /
ruflo-core 0.2.5) fails to load the plugin at all with:
failed to parse plugin hooks config .../hooks.json:
unknown field `_note`, expected `description` or `hooks`
Fold the doc content into `description` (content preserved, no hook
commands changed) for both marketplace-listed manifests, and add a
strict top-level-key check to
scripts/audit-plugin-hooks-cross-platform.mjs so this class of
regression fails CI going forward. `.claude-plugin/hooks/hooks.json`
is POSIX-only and not marketplace-distributed (not what Codex fetches
for ruflo-core@ruflo); its doc fields are folded too but its
audit-script flags (`_platform`, `_legacy_unaudited_shim`) are kept.
Second, deeper bug once the manifest loads at all: `modify-bash`/
`modify-file` PreToolUse hooks always echo Cursor's
`{"permission":"allow"}` verdict. Codex's own strict output schema
(additionalProperties: false) rejects that shape outright and reports
"hook returned invalid pre-tool-use JSON output" on every single tool
call — verified directly against the real parser
(codex-rs/hooks/src/engine/output_parser.rs,
codex-rs/hooks/src/events/pre_tool_use.rs) and its generated JSON
schema. Empty stdout is the one input Codex's parser treats as
no-opinion/implicit-allow with no error. `isCodexPluginHost()` (added
for #2816, ruflo-core 0.2.5) already detects Codex via its
PLUGIN_ROOT/PLUGIN_DATA env vars and correctly suppresses the verdict
in that case — harden it with a `turn_id`-based fallback (a documented
Codex-only field always present in Codex's PreToolUse input JSON, per
codex-rs/hooks/schema/generated/pre-tool-use.command.input.schema.json)
so detection doesn't depend solely on those env vars being set.
Bump ruflo-core 0.2.5 -> 0.2.6 and ruflo-cost-tracker 0.26.2 -> 0.26.3
so Codex's per-version plugin cache invalidates and re-fetches the
fixed manifest instead of serving a stale cached copy indefinitely.
Fixes#2855, #2856.
Both plugins' hooks.json wrapped every command in `/bin/bash -c '...'`,
which fails outright on native Windows (no such path) -- Codex/Claude
Code report "PreToolUse hook (failed) -- exit code 1" on every tool
call. The `_platform: posix` / "ruflo init overrides this on Windows"
claim in both files was never actually true: Claude Code merges
plugin-declared hooks additively with any init-generated
.claude/settings.json, it doesn't replace them, and there's no `ruflo
init` step at all in the reported Codex marketplace install flow.
Fix: every hook command is now a `node -e` bootstrap that resolves
plugins/*/scripts/ruflo-hook.cjs from process.env.CLAUDE_PLUGIN_ROOT
inside Node -- no shell env-var expansion (${VAR} vs %VAR%), so the
exact same command string runs unchanged on Windows/macOS/Linux.
ruflo-core's ruflo-hook.cjs (previously a full port of ruflo-hook.sh
that existed on disk but was never referenced by hooks.json) gained:
- JSON parsing of the hook event from stdin (replaces jq) for
post-command/post-edit, deriving the same CLI flags the bash
version computed
- the PreToolUse permission-allow stdout echo Cursor's stricter
contract requires (previously only the bash wrapper's trailing
printf did this)
- precompact-manual/precompact-auto guidance text (previously plain
bash echoes, no CLI call)
- a real Windows shell-quoting fix: shell:true with an args array
does NOT quote array elements, so "echo hi" silently truncated to
"echo" and a heredoc's `<<` errored as unexpected -- skip the
shell entirely for `node` invocations (never a .cmd shim, so
CreateProcess gets the argv array byte-for-byte)
cost-tracker's existing ruflo-hook.cjs (already correct, just
orphaned) needed no logic changes, only wiring.
Also:
- corrected the false "_platform_note" claims about ruflo init
overriding plugin hooks
- hardened scripts/audit-plugin-hooks-cross-platform.mjs: a
POSIX-exempt hooks.json now must actually reference its sibling
.cjs shim, not just have one sitting on disk unreferenced (which
is exactly the shape cost-tracker shipped in undetected)
- added windows-latest to the plugin-hooks-smoke CI matrix (it was
ubuntu/macos-only because the old bash-based hooks.json couldn't
run on Windows at all) and rewrote test-hooks.mjs to drive hooks.json's
literal command strings via `shell: true` -- exactly how Claude
Code/Codex invoke them -- instead of wrapping everything in an
explicit `bash -c` that could never have caught this bug
- flagged (not fixed) a separate, currently-published, actively
maintained plugin package (.claude-plugin/ + plugin/, the older
"claude-flow" plugin, not listed in the ruflo marketplace) with
the same underlying bug via jq/xargs pipes instead of bash --
explicitly marked _legacy_unaudited_shim so the hardened audit
doesn't silently regress on out-of-scope work
Verified locally on native Windows (this fix's actual target
platform): all 17 ruflo-core hook cases pass, all 3 cost-tracker
cases pass, the existing 12-case smoke-ruflo-hook-cjs.mjs passes
unchanged, both hook-command audits pass clean.
Fixes#2721
* fix(federation): sync shim types + guard optional close() to unblock Build V3
Fixes 7 TS errors on main that block Build V3 across all 3 platforms:
- src/transport/midstream-aware-loader.ts:39-52 — local AgentMessage/
AgentTransport shim was over-minimized by #2578. Restored required
{id, type, payload, metadata?} on AgentMessage and made send/onMessage
2-arg (address, message) to match how plugin.ts actually calls them.
- src/transport/midstream-aware-loader.ts:84 — cast dynamic import()
through `unknown` since upstream's exported AgentTransport carries a
richer InboundMessageHandler surface we intentionally hide behind the
minimal shim.
- src/plugin.ts:481 — this.transport.close is optional (`?`) on the
shim; guard with optional chaining `close?.()`.
Local tsc build clean after fix.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(federation): dispatcher import + re-sign witness manifests (3.25.3 drift)
Two more preexisting main-red root causes, in the same fix:
(1) inbound-dispatcher.ts:22 still imported `AgentMessage` from
`agentic-flow/transport/loader` — the exact phantom subpath #2578
eliminated in midstream-aware-loader.ts. Repointed to the local
shim. This is the residual site #2578 missed; the graph schema smoke
(ADR-130 P1) failure was a cascade of this same TS type collision.
(2) Re-signed verification/{linux,macos,windows}/manifest.md.json via
plugins/ruflo-core/scripts/witness/regen.mjs. The 3.25.3 release
(PR #2602) edited the ADR-104-transport `desc` string in all 3 per-OS
manifests but did not re-run regen.mjs, so the stored
integrity.manifestHash no longer matched sha256(JSON.stringify(
manifest)) and Witness verify exited 1 across all 3 platforms.
Manifests now verify cleanly (117 pass, 0 drift, 0 regressed).
Note: witness/regen.mjs takes --manifest + --history and re-signs
deterministically from manifest.gitCommit; already wired but the
3.25.3 release process skipped it.
Local verify: pass=117 drift=0 regressed=0 missing=0 on all 3 OSes.
Local tsc build: clean.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(hooks): PreToolUse hook emits valid JSON verdict (#2613)
Cursor imports third-party Claude Code hooks under its stricter
`preToolUse` contract, which requires stdout to be a valid JSON
permission verdict (`{"permission":"allow"|"deny"|"ask"}`) and
fail-closes on any other text. The prior PreToolUse commands ran the
ruflo hook shim which prints telemetry to stdout — Cursor then blocked
every Bash/Write/Edit tool call across every workspace.
Fix:
1. ruflo-hook.sh (all three copies) — redirect stdout to /dev/null in
addition to stderr. Claude Code doesn't consume this stdout either,
so silencing it is a pure cleanup with no functional cost.
2. hooks.json PreToolUse commands — after invoking the shim, always
`printf` a well-formed `{"permission":"allow"}` verdict. Valid for
both Claude Code's JSON-hook contract and Cursor's stricter
preToolUse contract, so telemetry keeps working while nothing is
blocked. Also guard `${CLAUDE_PLUGIN_ROOT:-}` so an unset env var
collapses to the safe empty branch instead of a bash parse error.
Simulated Cursor invocation (CLAUDE_PLUGIN_ROOT unset) now emits:
{"permission":"allow"}
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): indirect optional-dep imports in cli — @ruvector/*, @metaharness/router (#2608)
Same install-safety anti-pattern as #2586's prime-radiant fix, now
surfaced in @claude-flow/cli once plugin-agent-federation's TS2307
stopped masking it (630034ca4 on this branch). Build V3 fails with
"Cannot find module '@ruvector/learning-wasm'" and
"Cannot find module '@metaharness/router'" whenever the optional deps
aren't installed — which is the case in the install-safety /
Build V3 configurations.
Every call site is already runtime-guarded (try/catch, availability
probes). But a literal `await import('@ruvector/learning-wasm')` or a
`typeof import('@metaharness/router')` type expression forces tsc to
statically resolve the specifier at build time, so TS2307 fires when
the package is absent.
Fix: route the specifier through a string-typed variable
(`const pkg: string = '...'; await import(pkg)`) — same idiom as the
optional better-sqlite3 loader and #2586. Runtime behaviour unchanged:
the package still loads when present, still falls back cleanly when
absent.
Also replaced services/ruvector-training.ts's static `import type
{ WasmMicroLoRA, ... } from '@ruvector/learning-wasm'` with local
`type X = any` aliases (mirrors the existing FlashAttention et al.
pattern a few lines below).
Verified: with @ruvector/learning-wasm, @ruvector/attention, and
@metaharness/router hidden locally (matching the CI condition), the
cli package now compiles clean (tsc, 0 TS2307). plugin-agent-federation
remains clean as well.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(smoke): add metaharness optionalDep to ruflo wrapper (ADR-150 constraint #2)
The all-plugins-smoke, metaharness-ci `score`, and no-metaharness-smoke
CI jobs all fail on the same single step (ruflo-metaharness smoke #16):
→ 16. ruflo wrapper has metaharness in optionalDependencies
(architectural constraint #2) ... FAIL:
ruflo wrapper missing metaharness optionalDep
ADR-150 §"Architectural constraint" rule #2 requires `metaharness` and
`@metaharness/*` packages to live in `optionalDependencies` (never
`dependencies`) so ruflo remains operational when they're removed. The
CLI already satisfies this; the wrapper package.json had an empty
`optionalDependencies` block.
Pin to `~0.3.1` — the current npm-published `metaharness@latest`, and
the same range family used by CLAUDE.md's `@metaharness/router@~0.3.2`
pin. Wrapper install remains graceful-fail when the optional dep is
absent (that's the whole point of ADR-150's removable rule #1).
Unblocks PR #2604 merge. Only 3 CI failures on the branch — all
the same rule — so this single change flips them green.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(smoke): reconcile ADR-150 rule #2 with #2561 npx-startup budget
Two CI gates were mutually incompatible on this PR:
- ruflo-metaharness smoke #16 (older): asserted \`metaharness\` MUST be
in \`ruflo/package.json\` optionalDependencies.
- guard #2561 (newer): enforces \`RUFLO_MAX=0\` optionalDependencies
AND FORBIDs \`metaharness\` specifically, because installing it as a
ruflo postinstall dep timed out the \`npx -y ruflo@alpha --version\`
fast-path (measured incident).
Adding \`metaharness\` to ruflo optDeps satisfies #16 but breaks #2561;
removing it satisfies #2561 but leaves #16 red (pre-existing main state).
Fix: correct the smoke #16 rule. ADR-150 §"Architectural constraint"
rule #2 says "when \`@metaharness/*\` or \`metaharness\` appears in a
package's dep graph, it MUST be in \`optionalDependencies\`, never
\`dependencies\`". It does NOT require ruflo to depend on metaharness.
The old check was over-restrictive — it demanded PRESENCE, not just
correct SHAPE-when-present. The new check enforces the actual invariant:
no \`metaharness\` / \`@metaharness/*\` in ruflo's hard \`dependencies\`.
Absence is fine (ruflo delegates to @claude-flow/cli, which keeps
metaharness as a runtime dynamic import via ADR-150 rule #1).
#2561 is stronger evidence (proven cold-npx timeout) than the old #16
assertion, so the correction goes to #16.
Verified locally:
smoke #16 PASS (new logic)
guard #2561 PASS
Also reverts the ruflo/package.json optionalDeps change that briefly
tried to satisfy the old #16 rule — the wrapper stays clean.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(init): heal duplicate MCP registrations without breaking plugin refs (#2612)
Users who followed pre-rename setup docs ended up with two independent
MCP server registrations pointing at the same binary — one keyed
`claude-flow`, one keyed `ruflo` — doubling Claude Code's tool-schema
load (~350 duplicated tools) with zero added capability. Bug #2612.
The naive fix (rename the canonical key from `claude-flow` → `ruflo`)
silently re-opens #2206 (closed), because ~166 plugin files across
plugins/**/{agents,commands,skills}/*.md reference tools with the
`mcp__claude-flow__*` prefix. Claude Code derives the tool prefix from
the MCP server key; flipping the key to `ruflo` renames every plugin
tool to `mcp__ruflo__*` and every one of those 166 refs errors with
"Unknown tool".
Correct reconciliation:
- Canonical MCP key STAYS `claude-flow` (preserves #2206 for the 166
plugin refs). The binary invoked is `ruflo@latest` — only the
registration name is legacy.
- Duplicate is HEALED via `ruflo doctor`, not by renaming: detect
coexisting `ruflo`-keyed + `claude-flow`-keyed registrations for
the same binary, warn, and instruct the operator to remove the
`ruflo`-keyed one.
Changes:
- src/init/mcp-generator.ts — server key restored to `claude-flow`;
manual `claude mcp add …` commands restored to name `claude-flow`.
Comment now explains the #2206/#2612 duality.
- src/init/executor.ts — writeMCPConfig skip-comment updated to
reflect that `claude-flow` is canonical and `ruflo`-keyed is the
legacy duplicate form; existing detection accepts both keys (was
already correct).
- src/init/claudemd-generator.ts — generated CLAUDE.md `Setup`
section restored to `claude mcp add claude-flow -- …`.
- src/commands/doctor.ts — inherit the concurrent session's
duplicate-detection logic (rufloLocations / duplicateLocations /
legacyLocations / currentLocations), but flip which key is
treated as canonical: `claude-flow`/`claude-flow_alpha` are
current, `ruflo`/`ruflo_alpha` are legacy. Fix-message now
references removing the `ruflo`-keyed entry and cites #2206.
- src/commands/swarm.ts — help output uses `claude mcp add
claude-flow` again.
- __tests__/issue-2612-mcp-rename.test.ts — regression guard for the
duplicate-detection warning; header comment documents the
canonical/legacy roles matching the flipped semantics.
- CLAUDE.md / v3/@claude-flow/cli/CLAUDE.md / v3/@claude-flow/mcp/CLAUDE.md /
v3/implementation/init/API.md — kept the binary-update from
`@claude-flow/cli@latest` → `ruflo@latest` (correct, this IS the
post-rename wrapper), but restored the MCP server KEY to
`claude-flow` in every example line.
Verified:
- tsc clean (CLI package)
- all 70 test files / 726 tests pass locally, including:
- __tests__/init-wizard-bugs.test.ts (#2206 canonical key + #2207 dual-key detection)
- __tests__/stale-mcp-key-2369.test.ts (10 tests, unchanged)
- __tests__/issue-2612-mcp-rename.test.ts (new — asserts doctor
surfaces "Duplicate Ruflo MCP registrations found" with legacy
`ruflo` + current `claude-flow`)
- Manual doctor run against a synthetic .mcp.json/.claude.json pair
surfaces the exact warning + remediation string.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): neural status ReasoningBank row shows Empty despite persisted patterns (#2575)
Derive the Status cell from the same count Details displays so the label
matches the number (7798 patterns → Active) instead of the stale in-memory
handle.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): default memory store --upsert=true to fix store→delete→store UNIQUE violation (#2594)
memory_entries has UNIQUE(namespace, key) that does not exclude soft-deleted rows,
so a store→delete→store cycle reliably hits UNIQUE constraint failed when --upsert
defaults to false. storeEntry() already honors upsert via INSERT OR REPLACE; flipping
the CLI default closes the footgun without touching schema or plumbing.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): remove reverse-substring collision in GAIA isAnswerCorrect (#2566)
The reverse check normExpected.includes(normModel) scored fragmentary model
answers as correct whenever they normalized to any substring of the expected
answer (e.g. "a" vs "Paris, France" → true), inflating GAIA scores via
normalization collision. ADR-169 R1 forbids this vector. Forward-substring
and numeric-tolerance paths remain.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): skip onnxruntime-node postinstall to unblock v3 memory smoke (#2590)
onnxruntime-node's postinstall fetches a GPU nupkg from nuget.org which
ETIMEDOUTs from GitHub runners, taking pnpm install down. Skip it via
neverBuiltDependencies (CPU prebuilds ship in the npm tarball, so runtime
is unaffected) and pass --ignore-scripts in the memory smoke workflow as a
belt-and-braces safety net.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): drop verifyMemoryInit writeback that races better-sqlite3 handle on Windows (#2596)
sql.js verification holds an in-memory DB copy; writing it back via
atomic rename fights the open better-sqlite3 WAL handle owned by
ControllerRegistry / repairVectorIndexes, producing EPERM on Windows.
Verification is read-only — close and discard the copy instead.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): auto-heal doctor Learning Bridge sidecar on plain run (#2599)
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): prune CLI optionalDependencies to fix cold npx timeout (#2561)
Cold `npx -y @claude-flow/cli@alpha --version` (and the ruflo wrapper)
timed out because npm had to resolve and place ~30 optional deps before
Node ever ran the in-process --version fast-path in bin/cli.js. Trim
optionalDependencies to the 5 actually used by the default CLI path
(agentdb, ruvector, agentic-flow, @claude-flow/memory, @claude-flow/security);
everything else is already gated behind try/require or the plugins-store
lazy-install path. Mirror the pruning in the ruflo wrapper. Add a
pre-warm npm install step in verification-pipeline.yml as defense-in-depth.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): align ruflo-hook.cjs npx fallback with .sh dist-tag (#2600)
The three shipped .cjs Windows shims hardcoded ruflo@latest while the bash
shim used ruflo@alpha, breaking the "mirrors ruflo-hook.sh" contract from
#2132. Point all three .cjs shims at ruflo@alpha and extend the smoke
test with a static parity assertion so future drift fails CI.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): replace phantom agentic-flow/transport/loader marker in ADR-104 witness (#2578)
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): re-sign + verify helpers manifest in prepublishOnly (#2593)
Manifest drift (intelligence.cjs was bumped in 3.24/3.25 but the manifest
still carried the 3.23.0 hash) triggered writeCriticalHelpers' fail-closed
tamper warning on every CLI run in stamped projects. Root cause: sign-helpers.mjs
existed but was never wired into publish. This wires sign+verify into
prepublishOnly so drift fails the release, not every user.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(2590): guard against regression of #2590
Adds a CI guard step to the memory-smoke job that fails fast if either
part of the #2590 fix regresses:
1) v3/package.json drops "onnxruntime-node" from pnpm.neverBuiltDependencies
2) the memory-smoke pnpm install loses --ignore-scripts
Either regression would let onnxruntime-node's postinstall fetch a GPU
nupkg from nuget.org and ETIMEDOUT on GitHub runners, taking pnpm install
down as it did on main.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(2594): guard against regression of #2594
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(2561): guard against regression of #2561
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(2593): guard against regression of #2593
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(2596): guard against regression of #2596
Adds a vitest regression test asserting verifyMemoryInit() does not
modify the on-disk DB file — snapshots bytes+mtime before, calls verify,
asserts unchanged after. Fails if the sql.js writeback is re-added
(bytes change from re-serialization, mtime bumps), passes on the fix.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(2566): guard against regression of #2566
Locks in the removal of the reverse-substring branch in
isAnswerCorrect() (v3/@claude-flow/cli/src/benchmarks/gaia-agent.ts).
The reverse rule `normExpected.includes(normModel)` scored fragmentary
model answers (e.g. "a") as correct against any longer expected answer
that contained them ("Paris, France"), inflating GAIA scores via
normalization-collision — the vector ADR-167/169 R1 forbid.
Verified: FAILS if the reverse-substring branch is reintroduced,
PASSES on the current fix.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(2578): guard against regression of #2578
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(2599): guard against regression of #2599
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(release): 3.25.3 — 10 fixes + CI guards
Bumps @claude-flow/cli, claude-flow (umbrella), ruflo (wrapper) to 3.25.3.
Regens v3 pnpm-lock.yaml after optionalDependencies pruning (#2561) and
neverBuiltDependencies additions (#2590).
Fixes included:
- #2561 npx cold-install timeout — pruned CLI optionalDependencies
- #2566 GAIA isAnswerCorrect reverse-substring collision
- #2575 neural status ReasoningBank Empty vs 7798 patterns display
- #2578 ADR-104 phantom agentic-flow/transport/loader witness marker
- #2590 CI Node24/ubuntu memory smoke — onnxruntime-node postinstall block
- #2593 helpers.manifest.json auto-refresh — verify + sign in prepublishOnly
- #2594 memory store UNIQUE violation — flip --upsert default to true
- #2596 memory init Windows EPERM — drop sql.js writeback race
- #2599 doctor Learning Bridge — self-heal via recordMemoryPackagePath
- #2600 Windows shim dist-tag parity — align @alpha across all shims
CI guards added per fix.
Co-Authored-By: RuFlo <ruv@ruv.net>
The ruflo-core smoke contract step 2 ("registers a 'ruflo' MCP server")
fails on CI because plugins/ruflo-core/.mcp.json is gitignored by the
two repo-level `.mcp.json` rules (lines 67 + 128). The file exists
locally for everyone who has run smoke, but CI does a fresh clone and
never sees it.
Plugin-shipped .mcp.json templates are part of the plugin's contract
(they declare which MCP server the plugin registers). They MUST be
tracked. User-specific .mcp.json at the repo root or other paths
remains ignored for security (no secret leakage).
Fix is two-part:
1. .gitignore — add `!plugins/*/.mcp.json` negation after both
`.mcp.json` rules so the plugin templates escape the ignore.
2. Force-add plugins/ruflo-core/.mcp.json (the only file currently
matching the new exemption). Contents are the standard registration:
{
"mcpServers": {
"ruflo": {
"command": "npx",
"args": ["-y", "@claude-flow/cli@latest"],
"env": { "CLAUDE_FLOW_MCP_TRANSPORT": "stdio" }
}
}
}
Smoke locally: 10/10 PASS (unchanged — file always existed locally).
Smoke under CI conditions (fresh clone): was 9/10, now 10/10 once
this commit lands.
Co-Authored-By: RuFlo <ruv@ruv.net>
Three HIGH-severity verification-cluster fixes shipping together.
#2311 — `@claude-flow/security` build fails with TS2307: `Cannot find module
'@noble/ed25519'`. The package imports it in integrity-verifier.ts:260 but
never declared it as a dep — the root override didn't propagate (lesson
from #2112). Declare it directly. Unblocks the `ToolOutputGuardrail smoke
(ADR-131)` job and the broader `V3 CI/CD Pipeline failing on main` cluster
documented in #2275.
#2274 — `plugins/ruflo-core/scripts/witness/verify.mjs:175` unconditionally
assigned `ed.etc.sha512Sync`. On `@noble/ed25519` v2 some patch versions
freeze `etc`, throwing `TypeError: Cannot add property sha512Sync, object
is not extensible` and aborting witness verification on every run (6+
documented occurrences). Guard with `if (!ed.etc.sha512Sync)` and a
try/catch fallback — sha512Sync is already wired internally on v2, so the
shim is only needed on v1. Verified against macOS, Linux, and Windows
manifests on this checkout: all three return `Ed25519 signature valid: yes`
with regressed=0 missing=0.
#2312 — `scripts/smoke-trajectory-graph-edges.mjs` TEST 2 OOMs at ~4 GB on
GitHub-runner default heap, killing the `graph trajectory hooks smoke
(ADR-130 P3)` job (SIGABRT exit 134). The allocation lives deep inside
`intelligence.recordTrajectory` → `@ruvector/ruvllm SonaCoordinator` on
first call; the runtime cause is tracked separately. Bump
`NODE_OPTIONS=--max-old-space-size=6144` on the CI step so the job
completes while the leak is investigated.
Co-Authored-By: RuFlo <ruv@ruv.net>
full-system-test surfaced 23/32 plugin smoke contracts failing on a
single drifted assertion: the smoke gate greps ADR-0001 for
`status: Proposed`, but those ADRs were long since promoted to
`Accepted` without updating the gate. Flip the assertion (label, grep,
message) Proposed -> Accepted only where the ADR is genuinely Accepted.
ruflo-core additionally had a stale version assertion (0.2.0 -> 0.2.2).
Left untouched: ruflo-adr, ruflo-browser, ruflo-intelligence — their
ADR-0001 is genuinely Proposed, so their smokes correctly assert it.
No plugin source or ADR changed — only the drifted test assertions.
All 32 plugin smoke contracts now pass; full-system-test is 4/4 green.
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(security): #2149 ADR-131 P1 — ToolOutputGuardrail + OWASP 2026 mapping
Closes the OWASP ASI01 (Agent Goal Hijacking) gap identified in the
2026-05-26 dream cycle. Adds a pure, synchronous, pattern-based screener
for content crossing the agent's content boundary (MCP tool results,
memory reads, external API responses) before it enters reasoning.
Design (full rationale in ADR-131):
- Eight built-in pattern categories: instruction-override, embedded-system
(ChatML / Llama [INST] / <system>), exfiltration, role-hijack, jailbreak,
hidden-unicode (bidi + zero-width), tool-spoofing, truncation
- Default policy: critical→reject, high→redact, medium→flag, low→allow
- Pure-function shape — safe to invoke in every tool result / memory read
- 32KB content scans in 0.1ms locally (target: <1ms p99)
Scope:
- P1 (this PR): class + tests + exports + ADR + OWASP matrix + CI smoke
- P2-P5 (follow-on): MCP dispatch, memory read, swarm Raft payload,
per-tool policy + telemetry — tracked in ADR-131
Validation:
- 24/24 vitest tests pass (9ms)
- 11/11 smoke checks against built dist/index.js
- Tested against the four canonical ASI01 attack shapes
- CI guard `tool-output-guardrail-smoke` wired into v3-ci.yml
OWASP Top 10 for Agentic Applications 2026 control matrix added:
v3/docs/security/owasp-agents-2026-mapping.md — flags ASI01/06/09/10 as
highest-priority remaining gaps.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(plugins/ruflo-core/hooks): #2155 — wrap 3 unwrapped .sh hooks in /bin/bash -c
Three hooks (PreToolUse:Bash, PreToolUse:Write|Edit|MultiEdit, Stop)
invoked scripts/ruflo-hook.sh directly without an outer shell wrapper.
On Windows, Claude Code's hook executor spawned the .sh path, Node read
the shebang, attempted to exec /bin/bash (absent on Windows), and exited
with code 126 — surfacing as PostToolUse:Bash/PreToolUse:Bash/Stop hook
errors in every user session.
Wrapped each invocation in /bin/bash -c '... || true' to match the
existing pattern of the four other hooks in the same file. The || true
fallback now executes inside the bash subshell rather than relying on
the .sh body being readable. Validated as still working on POSIX.
Co-Authored-By: RuFlo <ruv@ruv.net>