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
.claude-flow/data stores committed to a cloned repository are no longer read
as this machine's learned patterns or synced into the user's Claude Code
memory, and are never rewritten. Surfaced entries are flattened to one line
(control, bidi and zero-width characters removed) and the block ends with a
line saying they are project notes, not instructions. Same change in the
generated fallback helper and the ruflo-mods routeContext block (0.16.2).
Helper manifest re-signed.
Co-Authored-By: RuFlo <ruv@ruv.net>
agent.spawn routing for Claude Code 2.1.300+: 'Explore=haiku,general-purpose=sonnet'
sets the model of a spawn whose call chose none, covering built-in and other
plugins' types (definitions a person cannot edit) and workflow agents. A chosen
model, forks and teammates are kept; malformed pairs are dropped; a failing hook
passes the spawn through. Off by default; /ruflo-mods reports it.
Co-authored-by: r <r@x>
- ruflo-mods guard (tool.check): read-only fast path on e.isReadOnly (2.1.304)
that skips the policy-projection stat while a full check found none in the
last 2 s (web tools excluded so the research ask still fires); a chain deny
returns without file reads; decider "person" on every ask ruflo raises;
agentId names the subagent on ruflo's reason; the chain's ceiling survives a
tightening; .catch documented for 2.1.301 semantics, still fails closed.
- ruflo-console: console_state and console_run registered with
isDeferred: false (2.1.293); console_open/console_set stay deferred.
- console + swarm: Text bold -> weight (2.1.299 deprecation), codemodded;
bold: true -> weight: "semibold" (what the host already maps bold to).
Engines before 2.1.299 refuse a tree with an unknown Text prop, so the kit
maps weight back to bold there (text-weight.ts, via $.session.version()).
- tests for 2.1.318's kit: $.tool.call now raises tool.check first
(guidance test); stub answers are validated (swarm prompt.fill stub);
stale expectations fixed (probe session.compact, learning-loop handshake).
- console kit tests: timeoutMs 30_000 (the 5 s default timed out 19-58
end-to-end tests under load, on 2.1.289 and 2.1.318 alike), and the mock
clock advanced past runner.ts's VERIFY_RETRY_MS in actions/settings tests.
Co-authored-by: r <r@x>
* feat(mods): automatic context delegation (ruflo-mods 0.15.0, ADR-522) + release 3.71.0
New contextDelegation option (off | observe | enforce, default off). A
main-loop whole-file Read of a 14-120 KB file for an analysis prompt is
answered by a no-tools haiku $.model.complete on the session's own
credentials. Every quote is checked against the file and the model sees
only the cited passages (the file's own lines) plus how to read the rest.
The real Read always runs first, so a later Edit works (spike: answering
the Read without next(e) breaks Edit); any failure shows the whole file.
Live A/B (real binary, haiku main, 6 repo files 17-83 KB): 6/6 correct
both ways, 6/6 delegated, total cost -22.5% incl. worker, main input
-21.5%, wall +6.5%. First run delegated 0/6: haiku drops indentation in
quotes; the verifier now trims per-line whitespace and relocates up to 3
lines, showing the file's own lines.
Tests: 8 plugin tests, 3 real-binary e2e (extract + Edit, forged quote,
off), CLI parity test vs DEFAULT_CONTEXT_LIMITS and core verdicts. Smoke
step 4 now allows exactly one gated $.model.complete.
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01MfPHVHXWyvDvDtYMTsA6MP
* ci: keep the claude-code test-kit plugin test out of the vitest ratchet
Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01MfPHVHXWyvDvDtYMTsA6MP
* feat(learning): run the verified-outcome learning loop on classic hooks for every ruflo project (ADR-512)
Until now only the opt-in ruflo-mods plugin recorded verified turns and showed lessons. Classic hooks
(every `ruflo init` project) now do the same. They replay the session transcript (`transcript_path`)
through the mod's own record and lesson code, bundled into .claude/helpers/learning-loop.cjs:
- route: records the turns that finished, then prints the lessons that fit the new prompt
- session-end: records the rest (PreCompact leaves the open turn open). This runs before the
session-id dedup, which otherwise dropped SessionEnd after a PreCompact. It also starts a
detached `ruflo hooks verified-ingest --quiet`
- one implementation: plugins/ruflo-mods/scripts/build-learning-loop-helper.mjs bundles
hooks/loop/transcript.ts; the bundle is committed, checked in mod-guidance CI, and is a signed
critical helper that helper-refresh installs (manifest re-signed)
- never twice: with its loop on, the mod adds `learning-loop` to RUFLO_MODS_OWNS
- opt-out: .claude-flow/config.json learningLoop.enabled=false, or RUFLO_LEARNING_LOOP=0
Tests: mods-learning-loop-classic (replay matches the mod's records, offsets, the hook-handler run
as a process, end to end classic record -> real ingest -> lesson in route output) and real-binary
contract 6 (pinned claude, mock model, no plugin). ruflo-mods 0.14.0.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-512 cites PR #4604
Co-Authored-By: RuFlo <ruv@ruv.net>
* ci: sign and exclude the classic-loop helper and real-binary test where the other helpers are (ADR-512)
smoke-helper-signing-security copies the critical helpers into its fixture; it now copies
learning-loop.cjs too. The ratchet's default run skips real-binary files, which need the
claude binary (mods-real-binary runs them).
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(mods): give the built-CLI tests the time their children get
vitest's 5s default timed out mods-cli-bin on a loaded CI runner and reported only
STACK_TRACE_ERROR (the timeout error carries the stack of the it() call). Each test runs the
built CLI several times with a 120s child timeout.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* feat(learning): lessons say where the fix goes; reworded tasks learn together (ADR-511)
The §7 evaluation (#4581) showed three limits on what the verified-outcome
loop can learn:
- a lesson named an agent, nothing the model can act on;
- tasks naming different files merged into one lesson;
- the same task worded differently never learned (15 reworded verified
successes left 15 patterns at one success each, zero lessons).
Changes:
- mods: a verified turn records its screened edited source files; a lesson
names the three its passing fixes edited most and leads with them; pick()
weighs rare keywords (IDF) and drops matches far below the best.
ruflo-mods 0.13.0.
- cli: files are counted per pattern (successes only) into learned-lessons.json;
SONA takes them as pattern anchors (never keywords), so reworded tasks that
fixed the same file reinforce one pattern; tasks naming disjoint paths never
merge. Lesson building moves to verified-lessons.ts.
- eval: the harness gains --ablate, --test-index, --concurrency, --lessons,
--save-lessons, --eval-sample, --calibrate and --max-turns;
scripts/eval-learning-loop-corpus.mjs writes a validated 15+30-task corpus.
Proved offline (tests): 15 reworded prompts form 5 lessons, up from 0; the
first run's prompts form 5 lessons, up from 1; the right lesson ranks first
for 30 of 30 eval prompts, with 1.07 lessons shown per prompt.
Paid pilots (haiku, about $6.80) are directional and did not reach the gate:
- 8-turn cap: off 2/10, on 4/10, lessons without files 1/10;
- uncapped: 6/6 vs 6/6, cost within 1%.
ADR-511 §5 has the details.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-511 cites PR #4603
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* 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(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(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>
* 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>
Off by default. Observes Read/Write/Edit/MultiEdit file_path, and at the end of a
main-loop turn appends one fixed-wording line naming up to three validated
project-relative binary/library/asar/CUDA files (12 per session, each once).
Offer only: never runs ruRE, never denies or edits a call. Inert without a ruRE
MCP tool. Harness gains World.tools and $.tool.list.
Co-authored-by: r <r@x>
* fix(ruflo-mods): trust gate also treats the agent.spawn, prompt.submit, tool.call, command.run, session.append and agent.register calls and the tool.describe and session.append hooks as risky (#3787, #3801)
Adversarial review of the previous commit: risk was checked per scanned
`calls` and `events` separately, and only the events side had agent.spawn
and prompt.submit, so a mod CALLING $.agent.spawn / $.prompt.submit /
$.tool.call still loaded under refuse-risky ("no risky calls or hooks").
session.append and agent.register, and the tool.describe and
session.append hooks (rewriting what the model reads).
Docs follow the code: README hardening note lists the first-party mods that
now need modTrustAllow under refuse-risky (agentdb, ruos, intelligence,
graph-intelligence, goals, iot-cognitum beside swarm and console), the
modTrust row and plugin.json description name the categories, and the
create-mod skill's list matches.
* fix(ruflo-mods): trust gate judges a glob or negation by what it selects; covers prompt sections/context, peer receive, model requests (#3801)
Re-review: the scan reports hook patterns as written, and riskOf matched
names exactly, so `on('tool.*')` or `on('!tool.describe')` loaded under
refuse-risky with "no risky calls or hooks" and could answer tool
permission verdicts (shown: tool.check returned allow). A glob now maps to
every risky event it selects, a negation to `*`, and any classic.* pattern
to the classic risk. Lookups use Object.hasOwn.
Same-category hooks added: prompt.section, prompt.context,
prompt.attachment, skill.prompt, session.receive, turn.step, and hooks on
process.run / http.fetch / mcp.call (they can answer other mods' calls).
Docs: every first-party mod with function hooks (43 of 43) is risky under
the gate's sets, so the README now says to allow-list each ruflo mod you
use under refuse-risky and points to `claude plugin validate`.
* fix(ruflo-mods): a hook on a risky call is a risky hook (fs.write, env.set, process.spawn, ...) (#3801)
Third review: every $ call is also an event a hook above the caller can
rewrite or answer for every other mod. Under refuse-risky a mod hooking only
fs.write loaded clean and redirected ruflo-mods' own heartbeat write to
.claude/settings.json; one hooking env.set rewrote RUFLO_MODS_OWNS; one on
process.spawn rewrote an allow-listed mod's argv; fs.* loaded too.
Hook risk is now derived: every RISKY_CALLS entry is also a risky event
("can rewrite or answer another mod's <call>"), on top of RISKY_EVENTS
(+ tool.register). Globs match against the union. Tests: fs.write, env.set
and fs.* refused (each fails on the previous head); the harmless-glob
control is clock.*, since command.run is a risky call. README and the
create-mod skill say so.
* fix(ruflo-mods): trust gate treats hooks that forge what other mods read, or replace the conversation, as risky (#3801)
Fourth review: a mod hooking only fs.stat (answer ENOENT for the policy
projection) or fs.read (return an empty observe projection) loaded under
refuse-risky and turned ruflo's own enforced deny into allow; one hooking
session.compact replaced the whole conversation. Added fs.read, fs.stat,
fs.exists, fs.list, settings.read, env.get, session.compact, prompt.edit
and attribution.text to the risky hooks; three tests (each fails on the
previous head). README states the gate is a list over the 2.1.289 engine
API, so an event added later is not judged until listed.
* fix(ruflo-mods): session.root, session.cwd, fs.ancestors and command.register hooks are risky; docs name ruflo-ruos (#3801)
Fifth review: a mod hooking only session.root moved ruflo-mods' project
root, so the enforced policy projection was read from elsewhere and a deny
became allow (the round-4 exploit through another input). Added those
inputs and command.register (consistent with tool.register), with a
root-forger test (fails on the previous head). Derived messages read
"another mod's fs.write, which writes files ..." instead of nesting
parentheses.
Docs: ruflo-ruos hooks only prompt.submit, so it is newly risky under
refuse-risky (#3787); README and PR body said every first-party mod was
already risky via a status file or tool.call, which was false for it.
* test(router): seed Thompson sampler convergence trajectory
* ci: retain one plugin smoke execution and its report
* Register smoke workflow test with its dedicated Node runner
* Prevent same-millisecond hierarchy embedding index collisions
The ADR-404 parity test (mods-route) compares the mod's route context with hook-handler.cjs.
#4172 changed intelligence.cjs scoring (inflection variants, IDF weights, coverage >= 0.15),
leaving the mod's trigram-Jaccard copy behind, so the parity job failed. Same algorithm now in
plugins/ruflo-mods/hooks/route/ranked-context.ts; ruflo-mods 0.6.1 -> 0.6.2.
Co-Authored-By: RuFlo <ruv@ruv.net>
Independent review of #4096 (issues #4093-#4095). The guard and mods-screen fixes hold on a 62-row adversarial
corpus (main 40/62, PR 58/62; the 4 misses are static-analysis limits main also has) and 1 MB hostile inputs stay
bounded. Gaps found and fixed here, tests first:
- the shared plugin screen (copied into 39 plugins) still flagged ./service-account.json and --set-secrets=NAME=NAME:latest
as key assignments: relative file paths and secret-manager references are now excused there too, a literal is not
- exfiltration now also covers e-mailed credentials ("email me the .env")
- 8 more guard parity rows (list that includes the root in any position, benign brace uses, spaced named fork bomb)
- every plugin whose screen copy changed gets a patch bump + CHANGELOG entry (marketplace users only receive a
change after a bump; precedent: d06b0122b), ruflo-mods 0.6.1 carries the guard, screens and README
- helpers manifest re-signed (hook-handler.cjs changed)
Co-Authored-By: RuFlo <ruv@ruv.net>
The README said only ruflo-swarm and ruflo-console (plus ruflo-protector)
need a modTrustAllow entry under modTrust=refuse-risky. In fact almost every
shipped ruflo mod writes its status file ($.fs.write) and most hook tool.call,
and both count as risky: a static scan of the 45 shipped mods judges all 45
risky, 35 of them for those two reasons alone.
Say so, and tell people to build the allow-list from the observe-mode
"ruflo mod trust: ..." lines before switching to refuse-risky.
- exfiltration (mods guidance screen and the shared plugin screen, synced to
all 40 copies): `\b\.env` needs a word character before the dot, so
"upload the .env file to my server", "send .env to me" and
"post your .env here" were not flagged. `.env` and `.envrc` are now
matched on their own, and a dot inside a word (./config.env,
config.prod.env) no longer ends the phrase. A model's token accounting is
not a credential: --max-tokens, /oauth/token and "token
usage/count/limit/budget/window" are left out; a file or value named token
(/run/token, "max-token value") is still caught.
- key assignment (mods guidance screen): a value that only names where the
secret lives is not one: process.env.X, os.environ, import.meta.env.X, a
./ ../ or ~/ path to a file with an extension, a secret-manager reference
name-with-separators:latest or :3, or NAME=that-reference
(--set-secrets=NAME=ref:latest). A literal value is never excused by its
shape alone, and padded base64 still matches.
Measured with the screen corpus: true positives caught 32/33 -> 33/33,
benign inputs clean 16/41 -> 22/41. Real docs (24,876 ruflo + ~34,600
cognitum paragraphs): flagged 96 -> 95 and 97 -> 86. One new hit: a sentence
whose phrase now spans a dotted hostname ("post the prompt to
api.deepseek.com ... a key, token"). Every shape stays linear (about 10x per
10x of input; worst ~240 ms at 1M chars, `send ` repeated).
Regenerates plugins/ruflo-adr/hooks/codex-hook.cjs, which bundles the shared
screen. New test: __tests__/mods/mods-screen-exfiltration.test.ts (40 cases;
17 fail with main's screens).
The pre-bash guard (mods dangerous-command.ts, both shipped hook-handler.cjs
copies and the helpers-generator fallback) missed:
- brace expansion: `rm -rf {/*,}`, `{/,}*` and `{,/}*` expand to `/*`, which
GNU rm deletes; `rm -rf /{tmp,}` and `{rm,-rf,/}` were documented limits.
Unquoted {a,b} lists (nested or glued to text) now become separate words,
as bash expands them. Quoted or escaped braces, anything inside ${...} and
{1..3} sequences are left alone. A quoted string with braces is rescanned
like one with spaces, so `bash -c '{rm,-rf,/}'` is caught.
Expansion is iterative with a linear group finder: no recursion to
overflow, no quadratic rescans. Past 4096 words or 1M characters of work,
an rm in progress fails closed and the list itself is judged by its tokens,
so an oversized list cannot hide the rm it spells.
- nesting past four `bash -c` levels: only the literal phrase was matched, so
`rm -fr /`, `rm -rf '/'`, `r"m" -rf /` and `rm --recursive --force /`
passed at depth 5, and a nested `rm -rf /tmp/x` was refused. The string is
now judged by its tokens (quote characters dropped first): an rm and a
possible root operand anywhere in it. Backtick bodies past the bound too.
- fork bombs: only the exact `:(){:|:&};:` spelling was matched. The
definition itself is now caught in any spacing and under any name,
including `function f { f|f& }`, wherever the call comes later.
- the short-option checks (/^-[a-z]*r[a-z]*$/) were quadratic on a long
failing option; they are now linear.
All four copies are derived from one source and stay byte-identical (the two
.cjs files) or annotation-identical (the mod). 42 new table rows; with main's
guard 27 of them fail. A 209-row differential corpus agrees across every copy,
blocks every miss above and changes no other verdict.
helpers.manifest.json is NOT re-signed here (no signing key): until the
maintainer runs `node scripts/sign-helpers.mjs`, as in 1803bd9d7,
__tests__/helper-signing.test.ts ("its hashes match the actual shipped helper
files") fails and helper refresh refuses the new hook-handler.cjs.
- ruflo-mods 0.6.0: selfCheck option (default on): one toast per session when an enabled ruflo plugin is missing from the marketplace clone with no cached install, fixed text with the repair; read-only, fail-open
- smoke: /ruflo-mods stays an alias of /ruflo mods; the self-check cannot write or echo repository text
- ADR-477 addendum: what Claude Code 2.1.289 draws for icons, SGR, OSC 8, OSC 0, bidi, CR (icons only; no colour; one slot)
- ADR-404 addendum: doctor/install hardening and the self-check
Co-Authored-By: RuFlo <ruv@ruv.net>
- Text answers (console_state, ask-Claude) no longer carry other projects'
cwd or git branch from session transcripts; group labels use the
placeholder titles already use. A branch name could carry
instruction-shaped text into Claude's context.
- "failed" follows ADR-486 §2.3: raised only after the quiet period; a
permission refusal (Claude Code's exact refusal results) and a Codex
interrupt are not failures; a seen failure is keyed on the error record's
own time, so metadata appends do not re-raise it.
- Timestamps are clamped (<= file mtime, <= now + 5 min); stores with future
stamps or baselines are repaired once on load.
- The 12 MB read budget is one per pass, shared and taken in turns by all
adapters, reserved before each read and charged the bytes read; never-read
files are read first-come first-served, then least recently read, so no
session starves.
- attention.json is rewritten at least every 5 min while the workspace runs,
failed writes back off (30 s to 5 min), and /ruflo-mods marks an old
summary stale.
- "Who is here" lists the main session and active or busy agents first, not
the whole agent store.
Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_01CGoza3gyxBjpaiMPhGHcHs
Console 0.42.0: Overview "Grounding" line (on / not installed / installed, disabled / unknown), a default-on nudge setting that adds one fixed line pointing at search_ruvnet to the mission context when the brain is on and the mission names the ruvnet stack (through modelLine, nothing interpolated), and a default-off, dismissible once-per-session install hint. Mods 0.5.0: option `grounding` (default off) adds a read-only /ruflo-mods row.
Detect-only: never calls, installs, gates, blocks or copies anything of the third-party plugin; ruflo behaves identically without it (smoke steps console 20, mods 15).
Co-Authored-By: RuFlo <ruv@ruv.net>
Needs-you queue (approvals, questions, failures, finished-unread) across Claude Code, Codex and Ruflo
sessions, a browser grouped by repository and worktree, and a preview of the selected session. Local,
read-only discovery (no model call, no process); ambiguous identity goes to an unassigned bucket;
finished work clears only after its preview was drawn; transcript text never reaches a model, the
state, the disk or a text answer. ruflo-mods gains an optional counts-only attention row.
Co-Authored-By: RuFlo <ruv@ruv.net>
One dependency-free policy (canonical in ruflo-mods, byte-identical copies in console,
swarm and protector, checked by scripts/sync-toast-policy.mjs and each smoke.sh): level
prefixes, one washed line of at most 120 characters, 60 s de-duplication, four toasts a
minute per source with errors held and counted, the person's all/important/off setting and
per-source mute (console Settings, mirrored to a file the others read), and a digest of
every toast kept for the console's Events page. All call sites migrated; new toasts for a
mission that finishes or fails and a swarm subagent that fails or a loop that is stuck.
Versions: console 0.37.0, swarm 0.3.4, protector 0.1.1, mods 0.3.16.
Co-Authored-By: RuFlo <ruv@ruv.net>
$'\x2f' and $'\x72m' name the root and rm without any expansion, and a
\' inside $'...' does not close the string. The scanner now decodes ANSI-C
escapes (octal, \x, \u/\U, \c, the single-letter set, NUL ends the string)
in all four copies, and the parity table gains wrapper, flag-spelling,
benign look-alike and documented-limit rows.
Co-Authored-By: RuFlo <ruv@ruv.net>
The scan reports hook patterns as written, so tool.*, prompt.*, agent.* or
!tool.describe hooked every risky event without matching a RISKY_EVENTS key.
Co-Authored-By: RuFlo <ruv@ruv.net>
refuse-risky admitted a user-tier mod that ran host commands through
$.process.spawn (process.run was listed) or through any MCP tool via
$.mcp.call, and one that steered every prompt (prompt.submit) or every
subagent (agent.spawn). Observe told the person "no risky calls or hooks".
The risk sets now cover every call in the engine's $ API that reaches
outside the session, and the two hooks from #3787. Observe-mode logging is
keyed on provenance plus the risk set, so a hot reload that gains a risky
call or hook is named again ("and every reload"), and the same risk is not
repeated.
(cherry picked from commit 566bfdc8a20409f763d312e1ae34bcd0fc6c0515)
Adversarial review follow-up: the list test only covered the conditions it
named, and the doc comment claimed smoke.sh guarded drift (it checks names,
not conditions). The matrix test calls register() with a recording on() for
256 option combinations and compares.
(cherry picked from commit d857b4d136)
registeredEvents() listed them as always registered, so with default options
the probe counted session.measure as "fired" with no ruflo hook running and
listed agent.spawn as "never fired" although the mod never hooked it (and
plugin.register under modTrust: off).
(cherry picked from commit 3a146c08dc)
Projects initialised before hook-handler.cjs (e.g. settings-generator at
d7212d25b wrote `npx claude-flow@v3alpha hooks route --task "$PROMPT"`) run
the CLI's own hooks command, which never reads RUFLO_MODS_OWNS. The mod saw
no classic route/post-edit there, owned both, and every prompt was routed
twice (the CLI still prints its block with the handshake set, verified on
3.52.0). A settings hook running claude-flow / @claude-flow/cli / ruflo
`hooks route|post-edit` now makes the mod stand down for that event.
On Windows the generated hook falls back to
%USERPROFILE%\.claude\helpers\hook-handler.cjs; helperHonours now checks it
beside the project root and $HOME.
(cherry picked from commit 4dec48e9f5)
Fourth review (differential vs main over 154k inputs): two secret shapes
main caught were missed after the earlier tightening - a Google key glued to
"-suffix" (the trailing lookahead rejected it; \b now also ends it) and a
JWT after a '-' (the new lookbehind; the rule now starts at the first eyJ
after a '-' or the run start, still once per run and linear). A later window
that starts mid-line gets a lead character so ^ cannot treat a benign
"system:" there as a role tag. Inbound and outbound now build the windows
once and pass them to scanWindows(). Two tests (each fails on the previous
head); corpus unchanged.
(cherry picked from commit 5e9cec209c)
Third review: stripping every default-ignorable character and NFKC folding
joined what followed to the word before it, so a leading \b or lookbehind
failed: "x" + soft hyphen + "Ignore all previous instructions", a circled
digit before AKIA..., and a zero-width space before an SSN all passed, where
main caught them (129 of 1,093 sampled inputs).
windows() now screens three readings: the folded one, main's literal one
(only its original invisible set removed) and a spaced one (invisible
characters become spaces), each whitespace-collapsed and windowed, so cost
stays linear. The role-tag rule is back to main's \s* (linear after the
collapse; it caught "system\n:"), and the key rule accepts doubled or mixed
separators again (my--token=). One test pins seven of these cases; it fails
on the previous head.
(cherry picked from commit 000f677c36)
Second review: once the whole text is screened, two older rules that were
only ever run on a 20k prefix became the cost: `fake role tags` (^\s* with
m) is quadratic on runs of newlines (1 MB of "\n": 16.8 s) and `jwt` (\beyJ)
restarts at every '-' ("-eyJ" x 1 MB: 8.2 s). Unbounded \s in shell pipe,
key assignment and bearer also let padding carry a match across a window.
- bare() collapses each whitespace run to one space or newline before
windowing (linear; screening only tests text, never returns it).
- jwt starts once per token run; the anchored role-tag half uses [ \t].
- key assignment accepts a CLI flag prefix again (--password=, --token=),
which main caught.
Three tests pin these (1 MB of blank lines and "-eyJ" under 1.5 s, a pipe
padded with 1.1k-25k spaces at window boundaries, CLI flags); each fails on
the previous head.
(cherry picked from commit 2ffd534404)
Adversarial review of the previous commit:
- the suffix group after the keyword backtracked against it: 1 MB of
'token_' took 6.4 s through scan() (10 MB: 71 s), and with the 20k cap gone
a peer controlled the input. The keyword must now end the name, optionally
followed by _key / _access_key; 1 MB of 'token_' screens in milliseconds.
- the same group flagged config names that only start with a keyword
(TOKEN_URL=, MAX_TOKENS=, session_token_ttl=, CREDENTIALS_FILE=); those
pass again, and an all-digit value is no longer a credential.
- a later window began mid-word, so its lookbehind, \b and ^ saw a false
start of text ('q' * 18976 + 'secret=...' was refused, unpadded it passes).
Later windows now start after whitespace within 256 characters; the 1,024
overlap still covers every rule.
Three tests pin these; each fails on the previous head.
(cherry picked from commit 60a5f05340)
The shared screen behind deliveryScreen, compactCarry and guidance safeText:
- scanned only the first 20,000 characters, so padding pushed an injection
or a secret past it. It now scans the whole text in overlapping 20k
windows (1k overlap, far longer than any rule spans): still linear.
- stripped a fixed list of invisible characters. It now strips every
default-ignorable code point (soft hyphen, CGJ, Mongolian VS, variation
selectors, bidi isolates, tags) plus C0/C1 and line/paragraph separators,
then NFKC-folds fullwidth forms.
- missed GITHUB_TOKEN= / aws_secret_access_key = / "client_secret": (the
keyword inside an _ or - separated name), PGP armored private keys, Google
keys ending in '-', and Slack xapp- tokens.
delivery/screen.ts reuses the shared windows instead of its own copy of the
invisible set and the 20k slice. The 50/50 acceptance corpus is unchanged
(50/50 caught, 1/50 benign flagged, as before).
(cherry picked from commit b1cc41c887)
Re-review follow-ups: the engine contract says the process also goes on
under another session after a resume (no session.start), so the rollup
resets on reason resume as on clear (new test). The cost reset stays on
clear only until /resume cost behaviour is measured live. The cost reset
now redraws the status line, which otherwise showed the old rung until the
next prompt.
(cherry picked from commit 927799ae24)
Adversarial review: the engine contract (2.1.289 types) says session.start
fires once per process or fresh load, "never /clear"; /clear is seen as
session.end with reason clear and no session.start follows. The previous
commit reset on session.start, so it never ran on a real /clear, and its
tests faked one with an `as never` cast.
- rollup: after writing the ending session's record, a clear resets the
counters and the written flag, so the next session gets its own record.
- cost: a session.end matcher on reason clear restarts the ladder and the
hard stop. Registered after the rollup, which records the rung first. Any
other end reason keeps the hard stop (new test).
- tests replay the real sequence: session.end(clear), work, session.end.
Live (2.1.289, --plugin-dir, tmux): prompt, /clear, prompt, /exit now writes
two ledger records; main writes one.
(cherry picked from commit 3630744aea)
/clear ends a session and starts the next in the same process without
re-running register, so the process-scoped state carried over:
- sessionRollup set `written` once and never reset it, so every session after
the first /clear went unrecorded (measured live on 2.1.289), and its
counters accumulated. The rollup now resets on session.start and records
routed/tightened as this session's share.
- the cost ladder kept the previous session's announced rung and HARD_STOP
level, though the engine counts the new session's cost from zero
($0.07 -> $0.06 across /clear, measured live). The ladder and the hard stop
now start over at session.start; within a session a rung is still told once.
The engine refuses a second matcher-less session.start, so the cost hook uses
the same match-everything surface matcher as the rollup hook.
(cherry picked from commit 0f9f1b99f2)
Adversarial review follow-ups in the same class:
- flushObservations read and parsed in one try and applied isMissing to the
parse error, so a corrupt queue quoting ENOENT was overwritten, against its
own "corrupt bytes are never replaced". Read and parse are separate now.
- isMissing matched ENOENT anywhere in the message, including the quoted
path (a project under .../ENOENT-x/). It now takes the path and ignores
it; cachedFile and the queue pass theirs.
(cherry picked from commit 5044d007f3)