* feat(plugins): ADR-509 plugin trust — signing, scan before install, refuse project auto-approve keys
- scripts/sign-plugins.mjs signs every marketplace plugin (signature.json:
sorted path+sha256 list, version, Ed25519 over canonical JSON) with the
existing helpers key (same key resolution as sign-helpers.mjs; never
printed). Nothing is signed with the real key here; release step in ADR.
- `ruflo plugins verify [name]` and `ruflo mods doctor` check the clone and
install cache: verified / modified / unsigned / bad-signature, and write
~/.claude-flow/mods/plugin-verify.json per config dir.
- ruflo-mods plugin.register gate: under modTrust refuse-risky, a
<name>@ruflo module whose clone is modified or bad-signature is refused
(allow-list does not exempt it). Live-validated on Claude Code 2.1.289.
- Static scan of .mcp.json, hooks/hooks.json and hook modules before
`claude plugin install` (mods install / init mods path) and before a
local `plugins install`; a high finding blocks that plugin unless
--accept-risk <plugin>, which is recorded in .claude-flow/mods/install.json.
- settings-risk-scanner covers enableAllProjectMcpServers,
enabledMcpjsonServers, bypassPermissions, blanket Bash/* allows and
non-ruflo hooks; `ruflo init` / `init hooks` / `init upgrade --settings`
stop before writing anything (--keep-risky-settings / --drop-risky-settings);
`ruflo doctor` warns on them in settings.json and settings.local.json.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-509 status names PR #4593
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(init): ADR-509 classify ruflo hooks by exact command; gate project-shipped helpers
isRufloHelperCommand no longer reuses pinToUserHelpers as a classifier: it
matches the closed set of commands ruflo generates or has generated (each
helper, subcommand, scope, platform, plus the legacy forms) by string
equality. node -e with extra code, -r/--require, --import, NODE_OPTIONS=
and a helper path in a comment are now findings. A project
.claude/helpers/<critical helper> that is neither ruflo's shipped copy nor
in a ruflo-signed manifest stops init too; --drop-risky-settings replaces it.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(mods): ADR-509 a scan-blocked plugin is never left enabled
applyMods scans an existing marketplace clone before enabling anything and
does not enable what it blocks; a plugin the post-refresh scan blocks has
its enabledPlugins key removed and is dropped from the install record. The
--no-plugin-install, test/CI and no-claude paths are covered by the
pre-enable scan, and say when there is no clone to scan yet.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(plugins): ADR-509 scan the modules hooks.json loads and their imports
The pre-install scan now resolves hooks.json `modules` against hooks.json
and follows every relative import/export-from/import()/require they reach,
with none of the walk's name, directory or size skips. A loaded file that is
missing, unreadable, over the size limit, outside the plugin, or loads a
computed module name is a high finding instead of being skipped.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(mods): ADR-509 signature gate works on Windows and checks the loaded copy
The status file key is normalized the same way on both sides (forward
slashes, no trailing slash, Windows drive paths lower-cased), and the mod
finds the home the CLI used (USERPROFILE on Windows, else HOME).
plugins/.gitattributes turns off line-ending conversion so a Windows clone
hashes as signed. Every writer now records the install-cache copies too:
per plugin the worst of all copies, and each copy by its directory; the mod
looks up the plugin.register root first, so a tampered install cache next
to a clean clone is refused.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(mods): ADR-509 match status path keys normalized; fix-pass notes
The mod compares the status file's per-copy path keys normalized, so a key
another writer spelled differently still matches the plugin.register root.
ADR-509 gains the review fix-pass implementation notes and live validation.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(mods): ADR-509 report each blocked plugin once per run
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(cli): no env values in sign-plugins errors; RSA-2048 in the rejection test (CodeQL, ADR-509)
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(ruflo-mods): 0.12.0 for ADR-509
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(mods): make mods-cli-bin failures readable (no more opaque STACK_TRACE_ERROR)
execFileSync's error holds Buffers and a process handle that vitest cannot
serialize, so a CI failure only said STACK_TRACE_ERROR. Rethrow a plain
Error with exit status, signal and the child's stdout/stderr tail.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* feat(cost): ADR-508 budget file, LiteLLM budget export, per-agent/tool attribution
- .claude-flow/cost/budget.json (v1): `ruflo cost budget set --daily/--weekly/--monthly`
writes it; the ruflo-mods ladder uses its smallest window when costBudgetUsd is 0.
Hostile files (negative usd, unknown periods, oversized arrays) are no budget.
Validator in both the mod and the CLI with a parity test.
- `ruflo cost budget export --gateway litellm` prints budget_limits (and, with
--model, model_max_budget + budget_fallbacks) as YAML or the /key/generate body;
--apply posts it to https or loopback only, key from --key-env, redirects refused.
--gateway meta-llm fails with a pointer to ADR-508 (no documented budget API).
- ruflo-mods costLedger option (default on, ruflo projects only): session.measure
deltas charged to subagent type and preceding tool, one line per session in
.claude-flow/cost/attribution.jsonl, read by `ruflo cost report`; a gateway
budget refusal is toasted once and counted.
- Live-validated on Claude Code 2.1.289 (fake LiteLLM on loopback + one haiku run).
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-508 status names PR #4592
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(ruflo-mods): ADR-508 costLedger transcript read, open budget-file and default-on notes
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(cost): ADR-508 review — --apply host escape via // path, per-call attribution split
- keyGenerateUrl: a base path starting with // (or /\) resolved as a
protocol-relative URL and sent the LiteLLM master key to another host
(http://localhost//evil.example/ -> http://evil.example/key/generate).
Refuse such paths, set the path on a copy of the parsed URL, and require
the result to keep the given scheme and host.
- Attribution: session.measure fires once per main-thread turn, and a
foreground subagent runs inside the main Agent call, so last-tool
charging put subagent spend on main/Agent. Split each measured delta
evenly across the tool calls completed since the last measurement.
- Tests in host event order and for the path escape; both fail on the
previous code. ADR, README, cost report header state the estimate rule.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-508 live run of the per-call attribution split
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(plugins): ruflo-mods 0.11.0, cost-tracker 0.31.0 for ADR-508
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* 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>
* feat(mods): compactSnapshot — pre-compaction transcript snapshot + one-shot reload block (ADR-505)
New ruflo-mods option compactSnapshot (default on). On a main-loop manual/auto/plugin
session.compact it writes the transcript about to be summarized to
.claude-flow/sessions/compactions/snapshot-<n>.jsonl (role, text <= 2000 chars, tool
names/ids only; each line screened; 400 messages / 2 MiB; ten rotating slots), beside
the compaction so it is never blocked, delayed or rewritten. The next non-slash prompt
after a compaction that stood gets one [RUFLO_AFTER_COMPACT] context block (<= 2000
chars) from lessons shown this session, the last 5 loop outcomes, open swarm/claim ids
and the snapshot path. ruflo doctor warns when snapshots exist and git would commit them.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(mods): isolate the ADR-505 doctor test from global git excludes; note precompute inference
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-505 status names PR #4591
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(mods): compactSnapshot screens raw message text before JSON encoding (ADR-505)
JSON escaping put a backslash before quotes and encoded newlines, so the
key-assignment rule missed "api_key": "..." / password="..." and the
line-start role-tag rule missed a \nsystem: line; those were written to the
snapshot in plaintext. messageLine now screens the raw cut text and the tool
names, plus the encoded line as before. Negative-control test added.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(ruflo-mods): 0.10.0 for ADR-505
---------
Co-authored-by: r <r@x>
* feat(plugins): sensitive userConfig secrets, readSecret helper, plugin secrets audit (ADR-506)
- ruflo-cost-tracker, ruflo-metaharness: `openrouterApiKey`; ruflo-x-gateway:
`adminToken`. Each is type string, sensitive, optional, no default.
- readSecret(name, envFallbacks): CLAUDE_PLUGIN_OPTION_<NAME> first, then the
variables the plugin always read. Copied per plugin (x-gateway in src/, the
only folder its Docker image ships); a test keeps the copies identical.
- Consumers: openrouter.mjs key/generation, x-gateway checkAdmin (call time,
fail closed), redblue child env (OPENROUTER_API_KEY, never argv).
- scripts/audit-plugin-secrets.mjs: credential-named option without
sensitive: true, or a literal secret (the mods' COMMON_SECRETS, parsed from
screen.ts) in plugin.json/hooks.json, fails. Wired into plugin-package-audit.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-506 status points at PR #4587
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(plugins): deliver the ADR-506 secret option, harden the plugin secrets audit
Review fixes for #4587:
- Delivery: Claude Code gives a plugin option only to the plugin's own hooks
and MCP servers, never to the Bash tool that runs openrouter.mjs and the
redblue skill path. ruflo-cost-tracker and ruflo-metaharness now carry a
SessionStart hook (scripts/_secret-env.cjs) that writes the sensitive
openrouterApiKey option to CLAUDE_ENV_FILE as OPENROUTER_API_KEY, only when
that variable is unset. Live-verified with Claude Code 2.1.289 (probe plugin
and the real cost-tracker): a Bash tool command resolved the key.
- ruflo-x-gateway adminToken removed: the gateway is a deployed server that no
Claude Code process of the plugin runs, so the option could never arrive.
- Audit: a secret used as a JSON key is shown as <redacted-key> and never
printed; .mcp.json and .lsp.json are scanned; OpenRouter key shape added;
credential-named env/headers entries holding a 16+ char literal fail;
${user_config.*} in command/headersHelper/args fails.
- ADR-506 updated with the delivery trade-off and what the bridge does not
reach (the metaharness_redblue MCP tool in ruflo-core's server).
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(plugins): skip the bash-only ADR-506 bridge tests on Windows; hedge env-file mode wording
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(plugins): cost-tracker 0.29.0, metaharness 0.3.0 for ADR-506
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* feat(mods): load ruflo plugins in headless claude -p workers (ADR-510)
claude -p on a fresh config loads no marketplace plugins, so ruflo's own
headless workers ran without ruflo-mods' guard, routing and learning loop.
- resolvePluginPaths: --source local checkout, then the marketplace clone,
then the install cache; a folder without .claude-plugin/plugin.json is
reported missing, never returned; honours CLAUDE_CONFIG_DIR.
- The daemon's HeadlessWorkerExecutor and `hive-mind work` add
--plugin-dir <ruflo-mods> and CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 (unless
set), never duplicate a caller's own --plugin-dir, and record a missing
plugin (logged once) as missingPlugins on the result.
- `ruflo plugins paths [--json]` for Agent SDK callers; README section.
- `ruflo doctor --component headless-plugins` runs a real claude -p and
checks the init event, plugin_errors and the mod heartbeat (runner
injectable; skipped without a model credential).
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-510 status names PR #4586
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(mods): headless plugin paths never come from project settings; stage hive-mind spawn -p (ADR-510)
- resolvePluginPaths no longer reads extraKnownMarketplaces from the
project's .claude/settings.json or settings.local.json. A cloned repo
could point every daemon worker and `hive-mind work` at its own folder,
loaded via --plugin-dir with function hooks on and no trust prompt, in
place of the user's ruflo-mods. "Local" is now only a directory
marketplace in Claude Code's user-level known_marketplaces.json, and a
relative path is rejected.
- `hive-mind spawn --claude --non-interactive` builds a `claude -p` worker
too: it now goes through withHeadlessPlugins (staged before the prompt)
and reports missingPlugins on data.claude. Interactive launch unchanged.
- Tests: project-scope settings (absolute or ./x) resolve to clone/cache,
never the repo; relative path rejected; spawn-mocked hive-mind spawn
test. All four new assertions fail on the previous commit.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-510 trust-boundary note records the live resolver check
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* feat(learning-loop): gaming defences for verified outcomes (ADR-503)
The verified-outcome loop (ADR-502) trusts a verifier's exit status, but the
model chooses what that verifier checks. Four downgrade-only layers:
- mod: a verified-success record carries taints when the turn edited a test
file (edited-tests), a verifier config (edited-verifier-config), or decided
on a weakened/narrowed command (narrowed-verifier); a per-process session
token is written on every record. The outcome word never changes.
- CLI: a success with a taint not listed in .claude-flow/config.json
learningLoop.allowTaint is counted under `tainted` and never reaches SONA.
- CLI: opt-in re-verify (learningLoop.reverify, off by default) re-runs a
rotating allowlisted manifest check in a temp detached git worktree at HEAD
with a timeout; failure, timeout or error downgrades to unknown. Only an
explicit verified-ingest re-verifies; hot callers defer.
- CLI: anomaly gate holds would-be lessons that are perfect-and-tainted,
only-narrowed, or from one session, listed as `held: <id> (<reason>)`.
Adds scripts/eval-learning-loop.mjs (manual, plan-only unless --run).
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-503 status names PR #4590
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(learning-loop): shell edits of tests taint; test the real re-verify runner (ADR-503)
- A Bash command that writes, moves or deletes a test file or verifier
config (rm, mv, cp, tee, truncate, sed -i/perl -i, output redirection,
git rm/checkout/restore/...) now sets edited-tests /
edited-verifier-config like an Edit of that file. Before this change,
Edit src/a.ts + `sed -i 's/it(/it.skip(/' src/a.test.ts` + `npm test`
produced an untainted verified-success. Downgrade-only: reads and test
runs earn nothing.
- gitWorktreeRunner is now tested against a throwaway git repo: pass,
fail, missing script, timeout (hung script's process verified dead),
non-repo error. After each run only the main worktree remains and no
ruflo-reverify-* dir is left. A negative control (kill only the direct
child) makes the timeout test fail.
- ADR-503 implementation notes record both, plus the interpreter-write gap.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(learning-loop): give the hung-check re-verify test an 8s budget for cold CI runners
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(ruflo-mods): 0.9.0 for ADR-503
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* test(mods): real-binary test tier with a scripted mock model (ADR-504)
Runs the real `claude` binary headless against a local mock of the
Anthropic Messages API, with ruflo-mods loaded through --plugin-dir in a
throwaway project with its own HOME. No API key, no paid model.
- mock-model.mjs: scripted Messages server (streaming and not), logs
every request; untool'd or unknown requests get a minimal answer.
- run.ts: runner with a minimal child environment, PATH recorders for
dangerous commands, and readers for events, requests and files.
- loads.test.ts (contract 1): with every option on, the heartbeat is
written, /ruflo-mods is registered and answered with no model request.
Negative control: a #4485-shaped copy (second bare session.start) is
refused silently by the real loader and fails those assertions.
- contracts.test.ts (contracts 2-5): verified-success record from a
scripted fix turn; [RUFLO_LESSONS] reaches the request (and not below
the gate); ruflo denies the root delete with its own reason and denies
a listed command the engine allows (which runs without the plugin);
the route block reaches the request (and not without the plugin).
- Excluded from the CLI, v3 and root-ratchet default runs; run with
`npm run test:real-binary`. New CI job mods-real-binary pins Claude
Code 2.1.289 and fails, naming the step, if the binary will not start.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-504 status names PR #4589
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* feat(mods): verified-outcome learning loop (learningLoop, #4581, ADR-502)
ruflo-mods 0.8.0 adds the learningLoop option (default off). Each main-loop
turn becomes a trajectory whose outcome is verified-success/verified-failure
only when a recognised test/build/typecheck/lint command ran after the
turn's last edit and the shell's exit status said so; otherwise unknown.
A masked status (|| true, pipes, ;, background, substitution) verifies
nothing, and the model's own words are never read.
The CLI ingests the records (ruflo hooks verified-ingest, the
hooks_intelligence_verified-ingest MCP tool, and automatically from
hooks_route and hooks_session-end): only verified records train SONA,
unknown ones are counted; each id once; PII-redacted. It writes
learned-lessons.json, and the mod adds at most three cited lessons at or
above the 0.6 gate to a matching prompt. doctor --component learning-loop
reports whether outcomes reach SONA.
Stages 5-7 of #4581 (pane, autonomous /loop-run, GEPA self-tuning) are
deferred; the on-by-default evaluation has not been run.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(mods): learning loop needs an edit to verify; redact e-mails before writing (#4581)
A turn that edited nothing is unknown (a verifier verifies a change).
The mod replaces e-mail addresses in the stored task; ADR-502 states the
privacy limit (broader PII redaction runs at CLI ingest).
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(mods): learningLoop on by default (#4581)
Maintainer decision: ship the learning loop on by default. Set the
learningLoop option to false to turn it off. ADR-502 records that the
issue's 30-task evaluation has not been run yet.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(cli): ADR-112 guidance on hooks_intelligence_verified-ingest (#4581)
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
github_repo_analyze returned `git remote get-url origin` verbatim. A remote
with embedded credentials (https://x-access-token:<token>@github.com/...,
the form CI checkouts and some credential helpers write) put the token into
MCP tool output, where it reaches the model and session transcripts.
Strip URL userinfo before returning it. Greedy up to the last `@` in the
authority, so a raw `@` in a password cannot leave a fragment behind.
scp-form remotes (git@host:o/r) carry no secret and are unchanged.
Found while reviewing #4571, which widened the same parser.
Co-authored-by: r <r@x>
Move the external agentic-qe-fleet entry from v3.15.16 (4edfa469) to
v3.15.17 (b177b2315521376b83f2eed40e4994fd7581d067), so its MCP server
runs agentic-qe@3.15.17. The plugin folder changed only its version and
MCP pin. Updates the README links, the external-plugins test fixture and
the ADR-484 evidence section with the re-run install results.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
hooks_worker-detect's autoDispatch created a worker record and marked it completed after a hardcoded 1500ms timer without running any analysis. Its sibling hooks_worker-dispatch already reports synthetic-completed and a no-executor note, but detect exposed the fake as an ordinary completed worker (#4549 automation scan, Finding A).\n\nMark records created by detect with synthetic:true and a no-executor note, use phase 'synthetic-completed', and return autoDispatchStatus/note in the handler response. worker-status and worker-list spread the record, so both surfaces now carry the disclosure.\n\nRegression uses fake timers: before 1500ms the record is running+synthetic; after, status completed, phase synthetic-completed, and the note is present. Baseline fails because autoDispatchStatus is undefined; candidate passes. Existing worker-dispatch status test 4/4 combined, tsc reports no errors in touched files.
The parser stores `--dry-run` (and `-d` on `migrate fix`) as `dryRun`,
but both actions read `flags['dry-run']`, which is always undefined. So
`migrate run --dry-run` ran the real migration, overwriting an existing
.claude-flow/config.json, and `migrate fix --agents --dry-run` wrote the
restored agent files. Read `dryRun`, keeping the kebab key as a fallback
as update, init and mods do.
The remote-URL pattern stopped the repo name at the first dot, so remotes
like vercel/next.js or socketio/socket.io did not match and the repository
was reported and stored as local/repo.
@claude-flow/memory 3.1.0 (#4550) made ControllerRegistry.set() real, so the
bridge now registers the intelligence module's LocalReasoningBank whenever
agentdb's ReasoningBank is unavailable. It has store()/findSimilar() but no
storePattern(), so bridgeStorePattern wrote to the SQL pattern namespace while
bridgeSearchPatterns read the bank: a stored pattern was never found when the
bank already held other patterns (the #2226 test failed on CI for #4566).
- bridgeStorePattern writes to the bank's store() with an embedding from the
same generateEmbedding() the search uses, and flushes it to disk.
- bridgeSearchPatterns falls through to the SQL namespace when the bank has
no match, so patterns written by the fallback path stay findable.
Co-authored-by: r <r@x>
* dream(memory): wire ControllerRegistry.set() so MutationGuard/AttestationLog activation stops being dead code
memory-bridge.ts's post-init controller-activation wiring (reasoningBank,
learningSystem, skills, semanticRouter, gnnService, rvfOptimizer,
mutationGuard, attestationLog, guardedVectorBackend) has always gated
registration on `typeof reg.set === 'function'`, falling back to an
unread `reg._controllers` property otherwise. ControllerRegistry never
implemented a public set() method, so every external activation silently
took the dead fallback: registry.get('mutationGuard')/get('attestationLog')
always returned null, permanently disabling write-mutation validation
(fail-open "no guard installed = allow") and audit logging (silent no-op)
on the real store/delete/purge paths. Same bug shape as the already-fixed
#3327 Finding A (reasoningBank.store never existed, so its own
typeof-guard was dead too).
Adds ControllerRegistry.set<T>(name, instance) mirroring the shape
initController() already produces internally. Zero changes needed at any
of the 9 memory-bridge.ts call sites.
5 new discriminating tests reproduce memory-bridge.ts's exact activation
pattern; stash-isolated baseline fails all 5 (TypeError: registry.set is
not a function), candidate passes all 5. Full @claude-flow/memory suite:
650/651 both ways (1 pre-existing environmental failure, byte-identical,
unrelated chmod/root-bypass test). tsc --noEmit: 0 errors.
Evaluated, pending independent adversarial critique.
* dream(memory): close prior instance on ControllerRegistry.set() (post-critique)
Independent adversarial critique of afe2cdd found set() silently dropped
a reference to any pre-existing resource-holding instance on overwrite,
reintroducing the exact leak class #2432 fixed for initController()'s own
replacement path (unclosed sql.js/WASM resources, ~36GB over 6 weeks in
production per that commit's own account). Not currently triggerable
through the shipped memory-bridge.ts wiring (every real call site guards
with `if (!reg.get(name))` first), but the set() API itself offered no
protection.
Fix: dispatch the existing closePriorIfAny(name) before overwriting the
map entry, same as initController() does. Intentionally not awaited, so
get(name) still reflects the new instance synchronously; the old
instance's close()/dispose() (best-effort, errors swallowed) runs in the
background — matches every other call site's synchronous-looking
registration contract.
1 new discriminating test added. Full @claude-flow/memory suite:
651/652 (1 pre-existing environmental failure, unchanged). tsc --noEmit:
0 errors.
Known, disclosed, not-fixed-tonight limitation (out of scope, needs a
human call on correct init ordering): `causalRecall` is the one
ControllerName absent from every INIT_LEVELS entry, so shutdown()'s
by-static-list lookup would never find/close a controller registered
under that name via set() — unexercised today (no call site uses it).
Flagged for a future night rather than guessed at here.
* dream(memory): add 2026-10-28 SOTA research gist (gist publishing unavailable, FALLBACK)
No gh CLI / gist-creation tool reachable this session — same disclosed
FALLBACK as every night since 2026-09-30. Full SOTA report committed to
docs/dream-cycle/ instead of a gist.github.com URL.
* dream(memory): #4549 update LEDGER for 2026-10-28
* dream(memory): bump @claude-flow/memory to 3.1.0 (CI: leaf-package-publish audit)
CI's "Plugin package install-safety" job (scripts/audit-leaf-package-publish.mjs,
guarding ruvnet/ruflo#3335 and #3390/#3327 Finding A) correctly failed: this PR's
source change to v3/@claude-flow/memory/src/controller-registry.ts is publishable
(adds a new public method) but @claude-flow/memory's own package.json version was
unchanged at 3.0.9 — @claude-flow/memory is not bundled into the release train, so
publishing cli/claude-flow/ruflo without also bumping+publishing this leaf would
ship the OLD copy and this fix would reach nobody.
Bumped @claude-flow/memory 3.0.9 -> 3.1.0 (MINOR: backward-compatible new public
method). Updated the two exact pins in v3/@claude-flow/cli/package.json
(dependencies + optionalDependencies) to match, and regenerated v3/pnpm-lock.yaml
via `pnpm install` (never hand-edited) so the lockfile's specifier stays in sync.
Verified locally: node scripts/audit-leaf-package-publish.mjs --base origin/main
now reports "ok: every non-bundled leaf is covered by the CLI range and carries a
bump if changed". Full @claude-flow/memory suite re-confirmed 651/652 (same
pre-existing environmental failure), tsc --noEmit 0 errors.
Note for a future release: per CLAUDE.md's publishing rules, @claude-flow/memory
must be published standalone alongside the next @claude-flow/cli release for this
fix to actually reach consumers — not done as part of this draft PR.
---------
Co-authored-by: Claude <noreply@anthropic.com>
#4543 fixed the six default skills, but 443 more agent_spawn calls with
`type` sat in the agent, command and Codex skill docs that init installs,
and projects initialised earlier keep their old copies.
- agent_spawn accepts `type` as an alias for `agentType` (agentType wins
when both are sent) and reports a missing agentType by name, instead of
the security schema's misleading "type: Required". Fixed in the CLI
handler, so no standalone cli-core publish is needed.
- Rename the top-level `type` key of every mcp__claude-flow__agent_spawn
call to `agentType` in .claude/{agents,commands}, the CLI and MCP package
copies, and .agents/skills (443 keys, 71 files). Other tools'
agent_spawn calls (flow_nexus, ruv-swarm) are untouched.
- coordination_sync: the schema now says `trigger` is refused (#4559)
and that `force` is unused.
Co-authored-by: r <r@x>
coordination_sync trigger waited on a simulated 50ms "sync" (a
setTimeout), incremented syncCount, set lastSync, zeroed pendingChanges
and returned { success: true, action: 'synchronized', nodesSync }. No
state moved between nodes, and it did this even with no nodes
registered.
It now returns success: false with the reason and leaves the stored
sync record untouched, as neural_compress quantize/prune do (#4195,
#4423). status and resolve only report the stored counters and are
unchanged.
Fixes#4557
The default-on, critical-priority local audit fallback wrote noHardcodedSecrets: true and riskLevel: 'low' without inspecting any source. A daemon with no headless scanner therefore produced a believable clean security report every 10 minutes, the opposite of the honest-empty-stub convention used by sibling fallbacks (#4549 automation scan).\n\nReport scanned:false, noHardcodedSecrets:null, riskLevel:'unknown', and an explicit note/recommendation that only file presence was checked and no secret scan or code analysis ran. Existing env-file/gitignore presence checks are unchanged; persisted JSON and return value stay identical.\n\nRegression calls the private local audit path and asserts the report no longer claims a scan/risk level, then verifies the persisted security-audit.json matches. Baseline fails with scanned undefined; candidate passes. Existing worker-daemon timer test still passes; tsc reports no errors in the touched file.
agent_pool advertised 'fill' in its action enum, but the handler had
no branch for it, so every fill call returned
{ error: 'Unknown action' }.
fill is now scale without the shrink step. It grows agentType's pool
to targetSize with idle agents and never terminates any; a target at
or below the current size is a no-op. It shares scale's targetSize
validation and agent creation. scale and drain are unchanged.
Fixes#4555
hooks_build-agents had three problems:
- It resolved outputDir against the process cwd instead of the project
(getProjectCwd). A default call therefore wrote ./agents wherever the
server happened to run, overwriting any agents/*.yaml there; run from
v3/@claude-flow/cli, that meant the package's own tracked configs.
- It never validated outputDir, so a `..` traversal path was accepted
and written to.
- It reported patternsApplied = agents * 3, although no pretrain data
is read; the configs are built-in templates.
outputDir now goes through validatePath, as hooks_codemod's filePath
does, and relative paths resolve against getProjectCwd().
patternsApplied is 0, with a note that the configs are templates. The
`hooks build-agents` CLI command reports the tool's validation error
instead of crashing on result.agents.
Fixes#4558
Move the external agentic-qe-fleet entry from v3.15.15 (1d0cc766) to
v3.15.16 (4edfa469d8f957b45bc0ea25424eb831b134f129), so its MCP server
runs agentic-qe@3.15.16. The plugin folder changed only its version and
MCP pin. Updates the README links, the external-plugins test fixture and
the ADR-484 evidence section with the re-run install results.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
performance_metrics returned constant latency (current 45ms, p95 150ms)
and throughput (1250 ops/s) blocks. For the default metric 'all', it
labelled the whole response _real: true even with no samples recorded.
Latency and throughput now come from the samples performance_report
already records (latency.avg and throughput.operations, ADR-093 F8),
aggregated with the same calcStats as CPU and memory. With no samples,
each is reported as { available: false, samples: 0, _real: false } with
a note on how to record one, and a single-metric query returns
value: null. The top-level _real for 'all' is true only when every
figure was measured, and the single-metric _real comes from the metric
itself. CPU and memory are unchanged.
Fixes#4554
* fix(console): let Claude ack Project Anatole alerts via console_run
console_run anatole-ack-<id> failed with "command.run: called from a
tool.call hook, it would wait on the turn this hook is holding": the
console sent /protector and awaited its answer inside Claude's tool
call, and the host refuses a slash command while that call holds the
turn. A clock tick and immediate:true do not avoid it (probed against
Claude Code 2.1.289); a command started after the hook returns runs.
The Anatole specs now send /protector without waiting, retry for about
a minute while the host reports the turn as held, and say Queued until
the mod answers. Acks still pass the console confirm and Claude-control
level. ruflo-console 0.49.7.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(console): link #4545 in the 0.49.7 changelog
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* fix(cli): declare @claude-flow/aidefence as an optional dependency
security-tools.ts, auto-install.ts and others import @claude-flow/aidefence at runtime but the package was in no dependency field. Flat node_modules layouts (npm) resolve it by accident; pnpm's isolated layout (pnpm dlx) hides it, so aidefence_* tools fail with 'AIDefence package not available'. Optional keeps the existing graceful-degradation path.
* fix(cli): add @claude-flow/aidefence to pnpm-lock.yaml
Matches the optionalDependencies entry added to @claude-flow/cli so the
frozen-lockfile install in CI passes. Hand-edited per review rather than
regenerated, to avoid rewriting unrelated importers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Q8MPAof1TAgCWWkJKdDJy
* fix(cli): pin @claude-flow/aidefence exactly and lift it from the #2561 guard
Pin 3.0.2 (the workspace and a published version) like @claude-flow/memory,
and keep the pnpm lock specifier in step. Remove aidefence from the guard's
FORBIDDEN list per its escape clause: the published package has no
dependencies (agentdb is an optional peer) and cold-installs in about 2-3 s
and 150 KB, versus 139 s for the CLI itself.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ci): drop an apostrophe from a comment in the #2561 guard script
The guard body is a single-quoted node -e string in the workflow, so an
apostrophe in a JS comment ends the shell quote and the step fails with a
syntax error.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: RuFlo <ruv@ruv.net>
* dream(intelligence): wire real Fisher-information estimation into SONAManager's EWC++ path
SONAManager's EWC++ catastrophic-forgetting mechanism was completely inert:
ewcState.fisher/.means were initialized empty and never written anywhere in
the core @claude-flow/neural package; consolidateEWC() (the only method
touching fisher post-init) only decayed an always-empty map and had zero
callers. Every computeEWCPenalty/computeEWCLoss call across all 5 learning
modes therefore always evaluated to exactly 0, in production (SONAManager
backs NeuralLearningSystem, loaded by @claude-flow/memory's learning-bridge).
Scoped fix (default 'balanced' mode only): BalancedMode now exposes
getConsolidationSnapshot(), deriving Fisher as squared-gradient and means as
the raw gradient from its existing gradientAccumulator (mirroring a working
reference pattern already in this monorepo's
plugins/cognitive-kernel/src/bridges/sona-bridge.ts). SONAManager's
triggerLearning() folds this into ewcState via the existing (unchanged)
consolidateEWC() decay step, then additive accumulation - online-EWC style.
Also removes 6 stale, never-gitignored .js files under
v3/@claude-flow/neural/src/modes/ that shadowed the current .ts sources for
any explicit .js-extension import (Vite/Vitest resolve a literal file on
disk over transforming a sibling .ts) and were themselves circularly broken
- this was blocking any vitest test of SONAManager/mode classes from ever
exercising real logic, confirmed via git-stash to reproduce identically on
the pre-candidate baseline and to be a necessary precondition for tonight's
evaluation, not part of the EWC logic change itself.
Disclosed scope limit: this makes the EWC *state* real and measurable; the
computed penalty is not yet wired into the gradient update itself (same gap
already disclosed as a stub in the reference plugin's own consolidate()).
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01ReiDH3LBmCGHLADvSaqWs2
* dream(intelligence): fix forward per independent adversarial critique
Round-2 fixes from an independent adversarial-critic pass on commit
2c5bcb177:
- getConsolidationSnapshot() now reports the CHANGE in gradientAccumulator
since the last consolidation (a delta), not the raw lifetime-cumulative
accumulator. Squaring the ever-growing cumulative value directly (the
original candidate) made Fisher/means diverge without bound over a
long-running session - confirmed empirically by the critic (25 cycles:
0.00012 -> 0.68) and reproduced independently here (150 cycles). The
delta-based version is a strict improvement (Fisher now reflects "what
changed", the theoretically appropriate EWC quantity) but does NOT fully
solve divergence by itself: traced the remaining growth to a separate,
deeper, pre-existing behavior one layer up - triggerLearning() reprocesses
every completed trajectory still held by the manager on every call (no
"already learned from" tracking; only pruneTrajectories()'s 50%-capacity
threshold ever removes one), so BalancedMode.learn()'s gradient movement
per cycle grows with the historical backlog, not just what's new. Fixing
that is a distinct, larger-blast-radius change (trajectory lifecycle, not
EWC) - disclosed in the test file's docstring and carried forward as a
priority candidate for a future night, explicitly ahead of ever wiring
computeEWCPenalty() into a real gradient update.
- Rescoped the "Fisher == means^2" test to state plainly it's a
single-cycle construction-time identity (true by the snapshot's own
arithmetic when there's no prior snapshot to diff against), not an
ongoing system invariant - confirmed by the critic to break after cycle 2.
- Finished the stale-build-artifact cleanup in src/modes/ that the prior
commit started: removed the remaining tracked .d.ts/.d.ts.map/.js.map
siblings (12 files) plus a stray tmp.json, same never-gitignored,
out-of-sync-with-source bug class as the .js files removed in the prior
commit. src/modes/ now contains only .ts sources.
- Fixed a path citation (plugins/... -> v3/plugins/...) in comments/tests.
143/143 tests pass, 0 tsc errors, build clean - re-verified after each
change in this commit.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01ReiDH3LBmCGHLADvSaqWs2
* dream(intelligence): add research gist for 2026-10-27
Full SOTA report: 5-role parallel research fan-out, 6-row graded 2026
external-research table, 5-row competitor comparison (genuine "None" across
LangGraph/AutoGen/CrewAI/OpenAI agent tooling, explained), the frozen
hypothesis with explicit scope disclosure, the evaluation receipt including
the independent adversarial critique's findings and this session's fix
forward, and 4 deferred/scored candidates plus 2 scan findings
(capabilities, memory) carried to a future night. Witness stamp computed
from the final file content.
No gh gist create / gist-equivalent MCP tool reachable this session (same
disclosed FALLBACK as every night since 2026-09-30) - committed here
instead, per established convention.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01ReiDH3LBmCGHLADvSaqWs2
* docs(dream-cycle): append 2026-10-27 ledger row
Issue #4531 / PR #4532 / witness 7b524483... — ACCEPT-scoped, post-critique.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01ReiDH3LBmCGHLADvSaqWs2
* fix(neural): bump @claude-flow/neural to 3.1.0 for the EWC fix
CI's audit-leaf-package-publish.mjs (ruvnet/ruflo#3335/#3390 guard) failed:
@claude-flow/neural is a non-bundled leaf that resolves from the npm
registry at release time, not from this PR's source. Its publishable
source changed (the EWC Fisher-wiring fix) but package.json's version was
still 3.0.0 - a release right now would ship the OLD, still-broken copy
and this fix would reach nobody.
Bumped neural 3.0.0 -> 3.1.0 (adds a new optional ModeImplementation
member, getConsolidationSnapshot, in addition to the bug fix - a
backward-compatible addition, MINOR per CLAUDE.md's versioning policy) and
the CLI's exact pin to match. Verified locally: audit script passes
(version bumped, CLI range satisfied), full neural suite 143/143, build
clean.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01ReiDH3LBmCGHLADvSaqWs2
* fix(deps): regenerate v3/pnpm-lock.yaml for the neural version bump
The 3.0.0 -> 3.1.0 bump to @claude-flow/cli's @claude-flow/neural dependency
spec (previous commit) was made by hand, without regenerating the lockfile
- CI's --frozen-lockfile installs correctly rejected it with
ERR_PNPM_OUTDATED_LOCKFILE across every job that runs one (Memory import
smoke, Windows hook execution smoke, statusline generator delegation smoke,
Smoke (no better-sqlite3), and others).
Regenerated via `pnpm install --no-frozen-lockfile` (the repo's own
tooling, not a hand edit) inside v3/. The only intended change is the
@claude-flow/neural specifier; the diff also picked up an incidental
@opentelemetry/api 1.9.0 -> 1.9.1 transitive bump across vitest's
resolution entries, which is pnpm's own resolver picking a newer
compatible published patch, not something this PR intentionally touches.
Verified locally: `pnpm install --frozen-lockfile` now succeeds, full
@claude-flow/neural suite still 143/143.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01ReiDH3LBmCGHLADvSaqWs2
* fix(cli): revert neural pin to the published 3.0.0, not an unpublished 3.1.0
My previous fix bumped @claude-flow/cli's @claude-flow/neural dependency
spec to 3.1.0 to satisfy the "Plugin package install-safety" leaf-publish
audit - but 3.1.0 has never been published to npm (confirmed: `npm view
@claude-flow/neural versions` lists only up to 3.0.0). That pin broke a
REAL, more severe check: "CLI npx-install smoke" packs the actual CLI
tarball and runs a real `npm install` against it, which failed with
`ETARGET: No matching version found for @claude-flow/neural@3.1.0` - i.e.
a real `npx @claude-flow/cli` user would hit this exact error today.
Publishing @claude-flow/neural@3.1.0 to npm is a human-gated release
action (signing keys, GCP secrets, WebAuthn - see CLAUDE.md's "Publishing
to npm"), not something this session does autonomously from an unreviewed
nightly research PR. Reverted the CLI's pin to 3.0.0 (the real published
version) and regenerated the lockfile to match.
This leaves one disclosed, expected finding in "Plugin package
install-safety": @claude-flow/neural's own package.json is now ahead of
the CLI's pin (3.1.0 source vs 3.0.0 pinned) - exactly the state CLAUDE.md
describes as needing a human to "publish @claude-flow/neural@3.1.0 and
raise the range" as part of an actual release, not a code fix. Noted on
the PR rather than resolved by further pushes.
@claude-flow/neural's own suite remains 143/143, build clean - unaffected,
since its tests exercise the local TS source directly.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01ReiDH3LBmCGHLADvSaqWs2
* fix(neural): drop the 3.1.0 bump and restore main's lockfile
The bump broke the umbrella's @claude-flow/neural range check and forced a
lockfile regen that flipped @claude-flow/memory to a registry copy. The EWC
change ships as the next neural release, bumped at release time.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(neural): anchor EWC means on the parameters at consolidation
computeEWCPenalty() measures current - means against the cumulative
gradient accumulator, so means must be that accumulator at consolidation
(theta*). Storing the per-cycle delta made the penalty start at roughly the
previous parameter value instead of zero. New test fails on the delta and
passes on the fix; neural suite 144/144, tsc clean.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(neural): bump to 3.0.1 for the EWC++ consolidation fix (#4531)
The CLI and root pins move with it so the release carries the fix.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore: lock @claude-flow/neural 3.0.1 from the registry
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: r <r@x>
* fix(ruflo-console): offer to create a mission for a new goal once the active mission is over
The active mission stayed active for ever, so after it finished (every task
done in the ruflo task store) or was cancelled, a goal planned after it showed
"Create the mission and its tasks" as done with the old id and no create
button. missionOfGoal() now says the goal has no mission yet when the active
one is over, so the create step is the next step with its mc-create button.
A mission still going keeps the re-plan in place; a finished mission's own
goal is not offered a second time; a cancelled mission's goal can be created
again. The create itself is unchanged and still asks first.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(ruflo-console): 0.49.6
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: RuFlo <ruv@ruv.net>
http_fetch validated only the initial URL, then called fetch with its default redirect:'follow'. A public URL could redirect to loopback/RFC1918/cloud-metadata or switch to file:// without ever passing validateUrl(), bypassing the SSRF allowlist. This is the redirect escalation called out as the natural follow-up to #4503/#4504.\n\nFollow redirects manually with redirect:'manual': cap at 10 hops, run validateUrl() on every Location, cancel redirect bodies, drop Authorization/Cookie/Proxy-Authorization on cross-origin hops, and apply fetch's 303/301/302 method rules. The reported URL is the final validated URL. Redirect validation failures return the same error codes as initial-URL failures (PRIVATE_ADDRESS/FORBIDDEN_PROTOCOL), with REDIRECT_LIMIT for the hop cap.\n\nSix regression tests mock fetch: loopback, IPv4-mapped metadata, file:// redirect, public relative redirect + final URL, cross-origin auth stripping, and the redirect limit. Baseline fails all six; candidate passes. Existing 37 http-fetch tests still pass, 43/43 total. tsc reports no errors in the changed file.
Auto-generated by .github/workflows/clone-tracker.yml.
Source: GitHub Traffic API (14-day rolling window).
Co-Authored-By: ruflo-bot <ruflo-bot@users.noreply.github.com>
recoverAgent() reset the shared AgentState to idle after a heartbeat failure but never released the agent's AgentPool reservation. Pool ownership is tracked separately, so the slot stayed busy forever and queued domain tasks could not drain; the recovered agent looked idle to getAvailableAgents() while the pool had no capacity (#4458 swarm scan).\n\nAwait releaseDomainAgent() after the reset, matching the completion/failure/cancel terminal paths; releaseAgentToDomain() then drains the next queued task into the recovered slot.\n\nRegression fills a one-agent domain, queues a second task, calls recoverAgent(), and asserts the queued task becomes assigned to the recovered agent with currentTask set (baseline leaves it queued). Existing domain release/teardown tests 10/10, full swarm suite 356/356, tsc clean.