Commit Graph
1311 Commits
Author SHA1 Message Date
randRuFlo 7c0ad84e5e fix(cost-tracker): warm an npx CLI once before parallel subchecks; a failed CLI read is an error (#4711)
cost-health started four subchecks at once, each running
npx -y @claude-flow/cli@latest. With a cold npm cache the four first
installs raced in one ~/.npm/_npx directory and left a broken install. Its
memory reads then exited 1, and budget/_sessions read that as no data, so
the budget check reported "no budget set" and Case 2 of the integration
test failed about half the time.

- health.mjs resolves the CLI once, serially, when it comes from npx
  (HEALTH_SKIP_WARMUP=1 skips it).
- A non-zero memory list is reported as an error with the CLI's stderr
  (exit 2) by budget, burn, anomaly and projection.
- New test-cli-failure-4711.mjs, in smoke step 48 and the CI workflow; the
  integration test runs with RUFLO_DAEMON_AUTOSTART=0.
- ruflo-cost-tracker 0.31.2.

Closes #4711

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-11-05 17:52:20 -05:00
randRuFlo 704330e488 fix(cli): reuse an identical corrupt-store backup; bump workflows 0.7.2 and plugin-creator 0.4.5
Polling a corrupt store made a new .corrupt-<ts> copy on every read (#4779
review). A backup with identical bytes is now reused.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-11-05 09:53:38 -05:00
r 4ea572a9d3 Merge PR #4797 2026-11-05 09:52:45 -05:00
r 1bac85340b Merge PR #4796 2026-11-05 09:52:45 -05:00
chaitanya-y20 13af5f1208 chore(plugins): give every plugin manifest a repository field
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
2026-11-05 09:25:38 +05:30
Doomguy d50f5b6fa1 docs: document GAIA critic and decomposition diagnostics 2026-11-05 06:50:04 +03:00
Doomguy 7b2e1b3ce0 docs: add the ruRE plugin guide 2026-11-05 06:18:42 +03:00
rUv 8b132881ae Merge pull request #4791 from ruvnet/fix/untrusted-project-context
fix(hooks): ignore repo-committed learning data; label surfaced notes as project data
2026-11-04 21:10:17 -06:00
randRuFlo f91135144b fix(hooks): ignore repo-committed learning data; label surfaced notes as project data
.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>
2026-11-04 21:53:45 -05:00
randRuFlo 825ce061d5 fix(x-gateway): key per-IP limits on the trusted forwarding address
Rate limits and the Seraphina/GitHub allowances keyed on the leftmost
X-Forwarded-For entry. They now use the same trusted-chain derivation as
registration (shared client-ip module). Gateway 0.9.2, plugin 0.10.3.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-11-04 21:41:09 -05:00
Michael ValderramaandMichael Valderrama 5c44615e78 fix(cost-tracker): count each Claude Code response once in track and session (#4688)
* fix(cost-tracker): count each Claude Code response once in track and session

Claude Code writes one assistant line per content block and repeats the response's usage on each, so summing lines counts a response once per block. Key responses by message.id + requestId, as _ledger.mjs already does, and price each once.

* chore(cost-tracker): bump to 0.31.1; use a counter in the test fixture

The double-count fix changes shipped scripts, so the plugin version rises for installed copies to pick it up. The fixture's uuid no longer uses Math.random, which CodeQL flagged.

---------

Co-authored-by: Michael Valderrama <17348490+ibucketbranch@users.noreply.github.com>
2026-11-04 17:49:00 -06:00
rUv d2e33508f4 Merge pull request #4704 from ruvnet/integrate/sweep-2026-11-04b
integrate: 4 contributor fixes + #4693 + #4691 (2026-11-04 sweep)
2026-11-04 17:32:41 -06:00
rUvandr 00432b4eb1 fix(plugins): agentdb_context-synthesize guidance in agentdb, observability and rag-memory (#4691 follow-up) (#4705)
agentdb 0.4.11, observability 0.3.6, rag-memory 0.3.8: the tool summarizes
validated task episodes; ordinary memories and trace spans get no-eligible-
episodes, which the old 'combine memories' guidance made look like missing data.

Co-authored-by: r <r@x>
2026-11-04 17:31:57 -06:00
randRuFlo e95c77d469 fix: refuse a trajectoryIds selection in hooks_intelligence_learn (#4693); route research synthesis away from the episode controller (#4691)
- hooks_intelligence_learn advertised trajectoryIds but never read it, so a
  scoped request ran global learning. The learning path cannot select, so an
  explicit selection is now refused before anything is imported or mutated.
- agentdb_context-synthesize summarizes validated task episodes; its description,
  the research-synthesize skill (ruflo-goals 0.4.6) and the researcher agent
  (ruflo-core 0.2.14) no longer send research documents to it.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-11-04 17:46:14 -05:00
rUvandr 27dd1f1ac8 feat(ruflo-mods): agentModels — a model per agent type for spawns that chose none (0.16.1) (#4703)
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>
2026-11-04 16:07:51 -06:00
rUvandr 45bf52cd86 feat(mods): adopt Claude Code 2.1.290-2.1.318 mod API changes (mods 0.16.0, console 0.49.11, swarm 0.3.8) (#4702)
- 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>
2026-11-04 15:49:08 -06:00
rUvandr 937a9a44c2 fix(ruflo-console): the band fits a narrow pane (0.49.10) (#4701)
Rows are measured in terminal columns (emoji are two), a part that does not
fit is left out whole with a dim +N count instead of being cut mid-word, the
longest parts are shortened first so a wide band keeps the rest in full, and
the open button sizes to its label ('open' below 64 columns; the mark alone
below 40).

Co-authored-by: r <r@x>
2026-11-04 15:15:40 -06:00
rUvandr 1c0d63c79a feat(ruflo-agent): leaf agents skip CLAUDE.md and run at low effort (0.4.2) (#4700)
nested-leaf and nested-queen-leaf get effort: low and omitClaudeMd: true.
Measured on Claude Code 2.1.318 in this repo: ~64k fewer input tokens per
leaf spawn; a one-leaf run cost $0.081 instead of $0.153. README gains the
2.1.292 one-command 'claude plugin install --marketplace' form.

Co-authored-by: r <r@x>
2026-11-04 14:33:12 -06:00
Mario JauvinandRuFlo dbeaa39611 fix(ruflo-console): mission over with cancelled tasks, and no cancelled-mission context in Claude's prompt (0.49.9) (#4689)
* fix(ruflo-console): treat a mission with only done and cancelled tasks as over (0.49.9)

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ruflo-console): leave the mission context out of Claude's prompt for a cancelled mission (0.49.9)

The active mission stays active until another is created, so after a cancel every new goal's guidance reached Claude with 'The mission is cancelled. Do not start new work.' before the create step could make the new mission. contextSection already returned null for a finished mission; it now does the same for a cancelled one.

---------

Co-authored-by: RuFlo <ruv@ruv.net>
2026-11-04 09:31:07 -06:00
rUv 5f3dacc54b feat(mods): automatic context delegation (ruflo-mods 0.15.0, ADR-522) + release 3.71.0 (#4652)
* 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
2026-11-01 15:14:10 -05:00
Mario JauvinandRuFlo 36a1575eaf fix(ruflo-core): say why a stale local CLI build failed and fall back to npx (0.2.13) (#4607)
mcp-launch picked v3/@claude-flow/cli inside a ruflo checkout because bin/cli.js and dist/src/index.js existed, then died on a bare ERR_MODULE_NOT_FOUND when dist/ predated src/. Claude Code hides stderr behind 'Skipping connection', so the cause was invisible.

Catch the missing-module import failure, print the rebuild command and the run-outside-the-repo option, and fall back to npx @latest. RUFLO_MCP_CLI_OVERRIDE, RUFLO_MCP_SKIP_NPX=1 and other error types still exit 1.

Co-authored-by: RuFlo <ruv@ruv.net>
2026-11-01 10:26:15 -05:00
rUvandr 66df9b95e1 feat(marketplace): agentdb and agentic-flow external plugins (ADR-518) (#4629)
* feat(marketplace): list agentdb and agentic-flow as external plugins (ADR-518)

Adds both upstream Claude Code plugins to the ruflo marketplace as
git-subdir entries pinned to their plugin-v3.1.0 merge commits
(agentdb 401fcb68, agentic-flow 2c86073b). Each runs its own MCP server
pinned to the 3.1.0 package plus a mod guard command.

A real-binary e2e checks out the pinned commit and asserts the mod
answers its own command with zero model requests, with a negative
control the loader refuses. README rows and ADR-518 added.

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(marketplace): keep \u escapes so the diff only adds the two entries

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(console): give agentdb and agentic-flow a home section (plugin coverage)

Co-Authored-By: RuFlo <ruv@ruv.net>

* test: run the external-plugin e2e only in the real-binary tier

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(console): 0.49.8 — plugin map covers agentdb and agentic-flow

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: r <r@x>
2026-10-31 20:45:43 -04:00
rUvandr bd77bced5f fix(security): bearer parsing, verification-code bias, protocol stripping; release 3.66.2 (#4624)
* fix(security): linear bearer parsing, unbiased verification codes, nested-protocol stripping

- @claude-flow/mcp: HTTP and WebSocket transports parse Authorization: Bearer
  with a prefix compare instead of /^Bearer\s+(.+)$/i, which backtracked
  quadratically on long whitespace runs (CodeQL js/polynomial-redos).
- ruflo-chatgpt-federation: same parser fix in authContext.
- @claude-flow/security: generateVerificationCode draws digits with
  randomInt(10); byte % 10 favoured 0-5 (js/biased-cryptographic-random).
- @claude-flow/security: sanitizeString strips javascript:/vbscript:/data:
  until stable, so javajavascript:script: no longer reassembles javascript:
  (js/incomplete-url-scheme-check).
- cli terminal_create: session ids from crypto randomBytes, not Math.random.

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(release): 3.66.2 — mcp 3.1.5, security 3.0.6

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(ruflo-chatgpt-federation): 0.2.5 for the bearer parser fix

Co-Authored-By: RuFlo <ruv@ruv.net>

* test(ruflo-chatgpt-federation): smoke expects 0.2.5

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: r <r@x>
2026-10-31 14:11:42 -04:00
rUvandr 189aceca1d feat(learning): the verified-outcome learning loop on classic hooks, for every ruflo project (ADR-512) (#4604)
* 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>
2026-10-30 16:59:46 -04:00
rUvandr 243bc57f0b feat(learning): lessons say where the fix goes; reworded tasks learn together (ADR-511) (#4603)
* 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>
2026-10-30 12:12:42 -04:00
rUvandr e9248a170e feat(security): plugin signing, scan before install, refuse risky project auto-approve keys (ADR-509) (#4593)
* 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>
2026-10-29 22:32:06 -04:00
rUvandr 5d2be9374a feat(cost): budget file, LiteLLM gateway export, per-agent/tool attribution (ADR-508) (#4592)
* 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>
2026-10-29 20:33:25 -04:00
rUvandr 828a8d78d9 feat(plugins): cut per-turn footprint — user-invoked operational skills, description ceiling, footprint report (ADR-507) (#4588)
* 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>
2026-10-29 19:50:34 -04:00
rUvandr 49fe0b362b feat(mods): compactSnapshot — pre-compaction snapshot + post-compaction reload (ADR-505) (#4591)
* 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>
2026-10-29 19:41:08 -04:00
rUvandr 658f0e33bf feat(plugins): sensitive userConfig secrets + readSecret + secrets audit (ADR-506) (#4587)
* 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>
2026-10-29 19:21:05 -04:00
rUvandr 76845f22d3 feat(cli): load ruflo plugins in headless claude -p workers (ADR-510) (#4586)
* 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>
2026-10-29 19:07:05 -04:00
rUvandr 38112e0042 feat(mods): learning-loop gaming defences — taints, re-verify, anomaly gate (ADR-503) (#4590)
* 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>
2026-10-29 18:57:12 -04:00
rUvandr 375e846c66 feat(mods): verified-outcome learning loop, on by default (learningLoop, #4581, ADR-502) (#4583)
* 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>
2026-10-29 16:38:56 -04:00
Dragan SpiridonovandClaude Opus 5.5 8c0ad74e50 chore(marketplace): pin agentic-qe-fleet to v3.15.17 (#4574)
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>
2026-10-29 09:12:33 -04:00
Dragan SpiridonovandClaude Opus 5.5 49f9a313ea chore(marketplace): pin agentic-qe-fleet to v3.15.16 (#4560)
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>
2026-10-28 05:39:48 -04:00
rUvandr 7d679ab425 fix(console): let Claude ack Project Anatole alerts via console_run (0.49.7) (#4545)
* 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>
2026-10-27 17:22:26 -04:00
Mario JauvinandRuFlo 065089344d fix(ruflo-console): offer to create a mission for a new goal once the active mission is over (0.49.6) (#4537)
* 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>
2026-10-27 14:22:25 -04:00
Dragan SpiridonovandClaude Opus 5.5 551428e39a chore(marketplace): pin agentic-qe-fleet to v3.15.15 (#4533)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 05:49:18 -04:00
rUvandr dafd38a4fe feat(ai-team): semantic memory via Cognitum embeddings, ordered listing, funnel logging, anon rate limit (0.4.0) (#4527)
* feat(ai-team): semantic memory via Cognitum embeddings, ordered listing, funnel logging, anon rate limit (0.4.0)

- memory_search ranks by meaning through /v1/embeddings (cognitum-embed, 384-dim) when a key is set;
  vectors persisted only for unchanged text, never returned; outage or no key falls back to the
  labelled lexical index
- listMemories reads newest first (composite index teamId+createdAt), falling back to the unordered
  read when the index is absent
- one structured ai_team_activation log line per workflow stage, hashed tenant, no content
- per-client limit on unauthenticated requests (last X-Forwarded-For entry; OAuth and /health exempt)

Co-Authored-By: claude-flow <ruv@ruv.net>

* fix(ai-team): keep plain mcp.tool registration sites; wrap registration for funnel logging

The repo-wide guard-tool-names check scans for .tool('name'; a local tool() helper hid them.

Co-Authored-By: claude-flow <ruv@ruv.net>

---------

Co-authored-by: r <r@x>
2026-10-26 17:37:25 -04:00
Mario JauvinandClaude Sonnet 5.5 60e951415b fix(ruflo-console): keep a project copy of the mission ledger (0.49.5) (#4524)
* fix(ruflo-console): keep a project copy of the mission ledger (0.49.5)

The ledger lives in the plugin's host store, a separate file per plugin
source. A console loaded inline in one session and from the marketplace
install in the next saw an empty store, so the project's mission
disappeared from Mission Control after a restart. Each save now also
writes .claude-flow/console/mission-ledger.json (git-ignored), and a load
that finds no ledger for the project in the store restores this project's
missions from it. A store that already has a ledger is left alone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(ruflo-console): offer, never adopt, missions from the project copy

The copy is a file a cloned repository can ship. Missions read from it
are now only offered (same path as pre-per-project missions, one yes
adopts each); nothing is adopted, stored or made active unasked, `active`
in the copy is ignored, and an empty ledger no longer overwrites it.

Addresses review on #4524.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(ruflo-console): word the project-folder offer as what it is

Missions offered from .claude-flow/console/mission-ledger.json were shown
under "from before per-project storage, with no project recorded", which
is wrong for them. They now get their own heading that says where they
were found and that a cloned repo can ship the file; the old heading is
kept for missions that name no project.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 16:08:34 -04:00
Mario JauvinandClaude Sonnet 5.5 64b4fb9768 fix(ruflo-console): submit the mission plan from a file (Windows "command line is too long") (#4506)
* fix(ruflo-console): submit the mission plan from a file so create works on Windows

mission_plan passed the ~7 KB plan as one `mcp exec -p` argument. With about 750 quotes, Windows argv quoting pushed the line past cmd.exe's 8191 characters: "The command line is too long." The plan is now written to .claude-flow/missions/console-plan-<id>.json and submitted with `ruflo mission plan --plan-file`, on every platform. Bumps to 0.49.4.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(ruflo-console): smoke contract expects 0.49.4

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 09:13:16 -04:00
rUvandr ed2dd638bd fix(ruflo-console): entryFor no longer returns another project's install record (#4496) (#4497)
* fix(ruflo-console): entryFor no longer returns another project's install record (#4496)

No applying record and no user record now yields null; among applying
project/local records the longest projectPath wins.

Co-Authored-By: RuFlo <ruv@ruv.net>

* chore(ruflo-console): bump to 0.49.3 for the entryFor fix (#4496)

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: r <r@x>
2026-10-25 22:51:04 -04:00
daak 264b346479 fix(ruflo-console): close Windows autopilot guard gaps and binary-planting paths (#4491) (#4494)
* fix(ruflo-console): close Windows autopilot guard gaps and binary-planting paths (#4491)

- ap-guard: extract Windows paths with spaces in folder names, extended namespaces (\\?\), UNC forward slashes (//srv/share), and capture drive-relative/device paths into relative paths.
- ap-envelope: match envelope-edit deny pattern under both / and \ separators.
- ap-envelope: normalize before root test and reject extended device namespace prefixes (\\?\, \\.\).
- ap-envelope: refuse .bat/.cmd targets in verifyProblem, and strip Windows executable suffixes repeatedly.
- paths: reject NTFS alternate data streams (colon after drive) and segments resolving to parent traversals in hasParentSegment.
- wf-control & wf-convo-live: resolve powershell.exe and where.exe via System32 to prevent local directory binary-planting.
- Add focused regression tests in ap-windows-guard, ap-envelope-windows-paths, wf-control-windows, and wf-convo-finder.

Fixes #4491

* chore(ruflo-console): bump version to 0.49.2 (#4491)
2026-10-25 16:28:32 -04:00
Mario JauvinandRuFlo 3a650ce747 fix(ruflo-console): Windows fixes from running every view on a real Windows machine (console 0.49.1, cost-tracker 0.28.3) (#4490)
* fix(ruflo-console): Plugin Catalog reads a Windows marketplace clone (0.47.1)

Claude Code records the ruflo marketplace clone's installLocation as a drive
path (C:\Users\...\marketplaces\ruflo). readCatalog refused any location not
starting with "/", so the catalog showed "the clone's marketplace.json is not
readable" with the file in place.

- readCatalog uses isAbsolutePath / hasParentSegment from paths.ts.
- The catalog's plugin folders, manifests, skill/agent/command reads and the
  snapshot's marketplace.json read (freshness row) build paths with joinPath
  instead of a hardcoded "/".
- tests/windows-drive-path-sites.spec.ts: a Windows clone lists its plugins,
  reads a skill file, and still refuses a relative or climbing location. The
  new tests fail without the fix.
- Version 0.47.0 -> 0.47.1 in plugin.json, hooks/version.ts, scripts/smoke.sh
  and CHANGELOG.md.

The other ruflo-console specs fail the same 12 tests with and without this
change on this machine (mission-cost, menu-entry, tui-ai-page, write-argv).

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ruflo-console): forget-history actions and TUI colour work on Windows

- Events "forget history" and Workflows "forget saved views" ran `rm -f`, which
  Windows does not have (write-flavor.ts: no delete on host-fs). On host-fs they
  now empty the file(s) through the host file API (new emptyFiles in
  write-via.ts; forgetSpec carries a `write` op like event-export does). The
  saved-views file is rewritten as a valid empty document, and the forget is
  verified by what the file holds. Linux/macOS keep the rm argv.
- depthOf returned "none" whenever TERM was unset. Windows Terminal, PowerShell
  and cmd leave TERM unset (COLORTERM=truecolor, OS=Windows_NT), so the
  standalone TUI drew without colour. On Windows only an explicit TERM=dumb or
  NO_COLOR turns colour off.

Tests: both forget actions in host-fs flavor (files emptied, no rm run, refusal
reported, missing file left alone), forgetSpec verification, depthOf on Windows.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ruflo-console): ADR status edits on CRLF records, and codex detection, on Windows

- withStatus / withSupersedes compared whole lines ("---") and checked
  startsWith("---\n"), so a MADR record checked out with CRLF (git autocrlf is on
  by default on Windows) failed with "the front matter is not closed", and other
  formats got mixed line endings. Records with CRLF are now edited as LF text and
  written back with CRLF.
- The Conversation board looked for codex with `which`, which Windows lacks, so
  codex was never offered there. A Windows home (drive path or share) uses
  `where`.

Tests: CRLF records for all three ADR formats (same edit as LF, CRLF kept, MADR
front matter found, supersede link), and the finder per platform. The ADR tests
fail without the fix.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ruflo-console): keep the Windows fixes under the size rule, skip POSIX-only specs on Windows (0.47.2)

- Move the forget-history spec out of events-ui.ts into events-forget.ts: the
  Windows branch had taken events-ui.ts to 521 lines (smoke step 11 caps files at
  500). Move the codex-finder test out of wf-control-views.spec.ts (514 lines)
  into wf-convo-finder.spec.ts.
- wf-replay-views: the Forget button asks one tick later now that it awaits the
  write flavor; the spec waits for it.
- write-argv.spec.ts: the real-disk POSIX script specs check Unix mode bits and
  FIFOs, which NTFS has not; Windows writes through the host file API. Skipped
  there. tui-ai-page.spec.ts: the --plain spec needs a runnable fake codex (a
  shebang script), which Windows cannot run; it asserts the codex line exists.
- Version 0.47.1 -> 0.47.2 in plugin.json, hooks/version.ts, scripts/smoke.sh and
  CHANGELOG.md (the entry lists every Windows fix of this branch).

Verified: the specs of the changed areas pass; the remaining failures in a full
run are menu-entry (a circular import, not Windows-specific, fails on the
baseline), the *.test.ts kit files (need claude-code/testing), and two
timing-sensitive specs that pass alone.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ruflo-cost-tracker): the ledger scripts run on Windows (0.28.3)

ledger.mjs, advise.mjs and local-cost.mjs ran only when
import.meta.url === `file://${process.argv[1]}`. On Windows that is
file:///C:/... against C:\..., never equal, so every call exited 0 with no
output and the plugin's own test-ledger.mjs failed 7 tests. They compare against
pathToFileURL(process.argv[1]).href now.

Two more breaks sat behind it for the ruflo console's mission spend:
- ledger.mjs --project required a leading "/", so a Windows project exited 2.
- inProject matched with "/" and exact case; transcripts record C:\Users\x\proj.
  A drive-lettered path now compares with either separator and any letter case;
  POSIX matching is unchanged (exact, directory boundary).

Tests: test-ledger.mjs gains Windows rows and cases (drive path in both
separator styles and letter cases, relative or climbing drive paths still exit 2,
POSIX rule stays exact). Version 0.28.2 -> 0.28.3 in plugin.json, smoke.sh and
CHANGELOG.md. smoke.sh still fails 5 steps on a Windows Git Bash for a reason
that predates this (it hands /c/... paths to a Windows node), unchanged here.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ruflo-console): the autopilot's text checks know Windows paths, commands and shells

Groundwork for the Windows-aware path checks that ap-windows-gate.spec.ts names as
the follow-up (an autopilot start is still refused on Windows). Each rule only
parks or refuses more; none allows anything that was refused before.

- classifyTask read only POSIX paths from a task's text, so a task naming
  C:\Windows\..., \\srv\share\..., ..\..\x, ~\x, %USERPROFILE%\x or
  $env:USERPROFILE\x was not checked against the envelope folders. It is now.
- delete-outside-worktree knew the POSIX recursive-delete forms but not the
  Windows ones: rmdir /s, del on a drive, the drive-format command,
  Remove-Item -Recurse, or a recursive rm on a drive or a variable.
- verifyProblem took the program name by splitting on "/" only, so
  C:\Windows\System32\cmd.exe, bash.exe or powershell passed the banned-program
  check. It uses either separator, drops .exe/.cmd/.bat/.ps1, and a second set
  bans the Windows shells, script hosts and destructive or system tools.

Tests (ap-windows-guard.spec.ts): path extraction and the envelope check, the deny
forms and ordinary text that must not match, verify programs allowed and refused.
Four of them fail without the change; the POSIX behaviour is asserted unchanged.
CHANGELOG: added to the unreleased 0.47.2 entry.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ruflo-console): the Overview heading shortens a Windows project path

"ruflo state in <last two folders>" split the cwd on "/" only, so a Windows cwd
(C:\Users\x\proj) printed whole. tailOf in paths.ts splits on either separator;
the overview uses it. Test in paths.spec.ts. CHANGELOG: added to the unreleased
0.47.2 entry.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(ruflo-console): transcript search, model keys and peer sends on Windows; smoke under Git Bash

The last Windows gaps of the sweep, each tested.

- Stopping or messaging a workflow run reads the run's task id from the session
  transcript; over 2 MB that was `grep -o`, which Windows lacks. Windows now runs
  PowerShell's Select-String (windowsSearchArgv in data/wf-control.ts). The path
  and the pattern ride inside the script as base64, so a path with a space, a
  quote, $, & or ; is only data and the script holds no double quote. Tested
  against a real PowerShell on a 5 MB-class file through such a path.
- taskIdOf returned the FIRST launch when a search printed two launches of one
  run (a resume), because the pattern's `[^}]` ran across both matches (nothing
  prints a closing brace between them). It takes the last task id in the match.
  This also affected `grep -o` on Linux and macOS.
- A model key for an HTTP endpoint was read with `printenv`, which Windows lacks.
  Host gains an optional `env` (register.ts: $.env.get, already used for other
  names) and SendDeps an optional `readEnv`, set only for a Windows home; elsewhere
  `printenv` is unchanged.
- A send to a federation peer runs `bash <helper>`. On a Windows PATH `bash` is
  the WSL launcher (System32\bash.exe), which cannot open a C:\ script path, so
  the send failed obscurely. On a Windows home it now refuses, running nothing,
  and says why.
- ruflo-cost-tracker scripts/smoke.sh builds ROOT with `pwd -W` under Git Bash:
  a Windows node could not open /c/... paths, which failed 5 steps (now 66/0).

Checked and left alone: the npx launcher. The installed Claude Code (a native
binary with the host code inside it) runs $.process.run through a bundled execa
on cross-spawn, which finds `npx` as npx.cmd through PATHEXT and runs it via
cmd.exe /d /s /c with its own argument escaping, so ['npx', ...] works on
Windows. The same lookup is why `bash` there is the first bash.exe on the PATH
(the WSL launcher on this machine), which the peer refusal above relies on.

CHANGELOG: both plugins' unreleased entries (0.47.2, 0.28.3) list these.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01C9t8G7o2vTPAxSFNb8rP4n

* fix(ruflo-console): what running every view on a real Windows machine turned up

The previous commits came from pattern scans. This one comes from running the
console's own readers against a real Windows machine (every view through the
standalone terminal; the plugin catalog, ADR loader and workflow reader called
directly), plus a complete triage of the path-handling patterns in hooks/.

Found by the real run:
- The standalone terminal left state.configDir null when CLAUDE_CONFIG_DIR was
  unset (the usual case), so the installed plugins, the marketplaces and the
  workflow runs were all "unreadable". It now falls back to <home>/.claude, as
  register.ts does in the engine. Not Windows-specific.
- research.ts kept its own POSIX-only safeInstallPath, so ruflo-goals was never
  found on Windows. It uses the Windows-aware one in cost-ledger.ts (same
  character set on POSIX); on this machine goalsOf now answers ready with the
  real C:\ root.

Found by triaging every `split('/')`, `lastIndexOf('/')` and `startsWith('/')`:
- isRunPath, isRunFile and isUnder checked for ".." only between slashes, so a
  segment written with a backslash passed on Windows; a config folder ending in
  a backslash did not match. They use hasParentSegment / trimTrailing, as does
  under().
- The menu and the boot screen named the project by splitting cwd on "/", which
  printed a whole C:\ path. baseOf in paths.ts.

Test-suite and cycle fixes so the smoke's own command passes here:
- views/pane built BODIES = { menu: menuView, ... } at load time, but
  views/menu reaches pane through mission-control > mission-claude > model-tools,
  so loading menu first left menuView undefined under the test runner (native
  ESM hoists the function; the app loads pane first). It is read at call time.
- tui-actions waited a fixed 1.2 s for a 1 s retry plus a redraw, and failed
  under CPU contention in a full run (also on the baseline). It waits for the
  outcome it asserts, up to 10 s.

Verified: the smoke's exact command (every spec, 30 s timeout) is 239 files
passed, 0 failed, 3486 tests; the console smoke is 20 passed, 0 failed; all 34
views render with exit 0 and no stderr; an ADR project with a space in its path
and CRLF records loads and plans a status change keeping its CRLF.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01C9t8G7o2vTPAxSFNb8rP4n

* fix(ruflo-console): the install record of a plugin that applies to this project, compared the Windows way

installed_plugins.json holds one record per install of a plugin, and a project-scope
record names the project it was made for. The snapshot took entries[0], so a plugin
installed for several projects showed another project's version and install folder.
On a real Windows machine ruflo-console@ruflo has five records (four project, one
user) and the first is a different project's 0.44.7; everything derived from it,
the version shown and the installPath used to find a plugin's scripts, could point
at the wrong copy.

- parseInstalled(text, cwd) picks the project or local record whose projectPath is
  the session folder or holds it, else the user record, else the first.
- insideOrSame in paths.ts is that comparison, Windows-aware (case, either
  separator, a folder inside the project); hooks/updates.ts decides which installs
  to update with it too. It compared with === and startsWith(path + "/"), so on
  Windows a session in a subfolder of the project, or with a different drive-letter
  case, did not count the project's own install and left it stale.

tui-actions: "a read runs at once" waited a fixed 500 ms for a stand-in CLI process
to start; it waits for the run it asserts, and its neighbour, which failed only
because that run landed late in the shared log, no longer does.

Tests (windows-path-guards.spec.ts): the record chosen for the project under both
separators, other letter case, a subfolder, a sibling sharing the prefix, no match,
no user record, no cwd; the updater's rule; insideOrSame. Verified: the smoke's
exact command (every spec, 30 s timeout) is 239 files passed, 0 failed, 3491 tests.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01C9t8G7o2vTPAxSFNb8rP4n

* test(ruflo-console): the focus-lost spec waits for the output to go quiet before it asserts silence

"stops drawing while the terminal reports focus lost" marked the output length 60 ms
after the focus-lost report and then expected no growth. A frame already in flight
when focus was lost lands after that mark on a busy machine, which reads as the page
still drawing; the smoke's first vitest pass failed on it and only the retry passed.
It now waits until the output stops changing before it marks, still asserts 500 ms of
silence after that, and waits for the redraw on focus regained instead of a fixed
300 ms. Passes 4 of 4 isolated runs.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01C9t8G7o2vTPAxSFNb8rP4n

* test(ruflo-console): the hostile-regex spec bounds the scan's CPU time, not the wall clock

"a slow pattern over ten thousand 200-character events stops at its budget" asserted
that the scan finished in under 2500 ms of wall-clock time. The scan is CPU-bound, and
the wall clock also counts every other worker of a parallel run, so the spec passed
alone (all 12 specs of the file in 316 ms) and failed in full runs, including both
tries of the smoke's step 14 on the previous HEAD. It now bounds the scan's CPU time
(process.cpuUsage) at the same 2500 ms and keeps a 30 s wall-clock bound as a guard
against a hang. The product code is untouched.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01C9t8G7o2vTPAxSFNb8rP4n

* test(ruflo-console): the host-boundary spec does not scan the mutation specs' temporary files

tui-boundary.spec.ts reads every .ts under hooks/ when it loads. adr-mutation and
mission-advisor-mutation make temporary .mut-N-*.ts copies of hooks modules inside
hooks/ and delete them, in other workers of the same run. Two ways that disturbs this
spec: a copy that is still there is checked as if it were a hooks module (shown with a
throwaway .mut- file that imports a Node module: the spec failed before this change,
passes after), and a copy listed and then deleted can throw at load, which fails the
whole file (the smoke's step 14 showed one such file-level failure that did not repeat;
six runs of the three specs together did not reproduce it, so that part is the likely
cause, not a demonstrated one).

The walk skips .mut- names and tolerates a file that vanishes. A real violation in
hooks/ is still caught (checked with a throwaway file).

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01C9t8G7o2vTPAxSFNb8rP4n

* fix(ruflo-console): the mod loads again: $.env.get takes a literal name

An earlier commit on this branch (f54772424) gave the host an `env` read that was
`async name => $.env.get(name)`. The engine lists the variables a module reads, so
`claude plugin validate` refuses a computed name:

  $.env.get takes a literal name as its first argument ...

and when it refuses register.ts the mod does not load at all: no /ruflo command, no
pane. Vitest never runs the engine's validator, so no test caught it; it showed up
when the branch was installed into a real Claude Code.

- register.ts reads only the one key it can name literally,
  $.env.get('OPENROUTER_API_KEY'); any other name answers undefined.
- wf-send says, for a custom endpoint key on Windows, that it cannot be read here and
  that only $OPENROUTER_API_KEY can, instead of claiming the variable is unset. The
  OpenRouter key keeps the "is not set" wording.
- tui-boundary.spec.ts: no $.env.get/set in hooks/ may take a non-literal name (fails on
  the old line, passes on the fix).
- smoke.sh step 21 runs `claude plugin validate` on the plugin when the CLI is present
  (passes now; reports "Validation failed" against the old line).
- CHANGELOG corrected: it described the broken behaviour.

Verified with the real validator: before, "Found 1 error"; after, "Validation passed",
and the hook list shows command.run{command=ruflo}. The 9 "gating hook without .catch"
notes it prints are identical on upstream/main.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01C9t8G7o2vTPAxSFNb8rP4n

* test(ruflo-console): specs remove their temp folder with a retry, so a still-exiting child does not fail the file on Windows

After the merge, tui-actions.spec.ts was reported as a failed FILE with all 8 of its
tests passing:

  EBUSY: resource busy or locked, rmdir '...\tui-actions-XXXX\project'

On Windows a folder cannot be deleted while a process started in it is still running,
and these specs start the stand-in CLI and terminal sessions with the project folder as
their working directory. force: true does not cover EBUSY, and neither does maxRetries
on rmSync: measured on Node 22 with a child holding the folder for 1.2 s, rmSync fails
in 3 ms with or without maxRetries, while fs.promises.rm with maxRetries (and a manual
loop) removes it after about a second.

- tests/fixtures/rm-tree.ts: removeTree(), the async rm with up to ~5 s of retries.
- The ten specs that start processes or sessions in their temp folder (tui-actions,
  tui-ai-host, tui-ai-page, tui-host, tui-nav, tui-pagebar, tui-parity, tui-pictures,
  tui-session, wf-control-windows) use it in afterAll.
- tests/rm-tree.spec.ts: removes a tree and an already-gone one; on Windows, a real child
  holding the folder makes rmSync fail with EBUSY and removeTree wait it out.

All eleven files pass.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01C9t8G7o2vTPAxSFNb8rP4n

---------

Co-authored-by: RuFlo <ruv@ruv.net>
2026-10-25 13:00:56 -04:00
rUvandr d7fcaf3b25 fix(ruflo-mods): load again: the ruRE offer no longer registers a second bare session.start, tool.call and turn.complete (0.7.1, #4485) (#4487)
Co-authored-by: r <r@x>
2026-10-25 07:52:18 -04:00
Dragan SpiridonovandClaude Opus 5.5 c365d37280 chore(marketplace): pin agentic-qe-fleet to v3.15.13 (#4484)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-25 07:22:05 -04:00
rUvandr f02989a78c fix(managed): refuse . and .. resource ids; guard reads common argument wrappers (ruflo-agent 0.4.1) (#4478)
Follow-up to the 3.63.0 security review (low severity #6 and #9); documents #7 and #8 as known limits.

Co-authored-by: r <r@x>
2026-10-24 23:49:51 -04:00
rUvandr db141ba70e feat: managed workflows, unified console runs and verified advisory learning (#4471)
* feat(agent): add bounded managed dynamic workflows and verified lifecycle observation

* feat(plugins): integrate managed workflows with mod policy and capability discovery

* feat(managed): unify console runs and verified advisory learning

* fix(managed): hydrate native recall receipts validated on ruOS

* docs(managed): record authenticated console host blocker

* docs(managed): qualify installed console and compatible native host

* feat(managed): integrate verified cycles and isolate native memory

* fix(managed): enforce offline native models and qualify feedback E2E

* fix(managed): independent security and correctness review findings

- gate managed_agent_interrupt through the managed_agent_control policy; terminate obeys the allowlist and deletes only its own environment when RUFLO_MANAGED_CONTROL=1
- track only events from the acknowledged message so a later poll cannot report the previous turn as finished
- require the canonical base64 verifier signature so one receipt cannot fill the ledger
- register RUFLO_MANAGED_AGENTS_BASE_URL as a trust-boundary env var (env-precedence audit) and key the credential scope marker with a per-process HMAC (CodeQL)
- best-effort local snapshot writes; report messageId when a prompt fails after it was sent
- console: rescheduling is running, budget/action-blocked sessions are active, not finished
- document the remaining known limits in ADR 0004

Co-Authored-By: RuFlo <ruv@ruv.net>

* docs: user guide section for managed cloud agents; correct ruflo-agent README counts

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(managed): scope marker is a generation number, never a hash of the API key (CodeQL)

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: r <r@x>
2026-10-24 22:42:09 -04:00
rUvandr 8ec06c0ee8 feat(ai-team): guard team_create/team_update, skill handoffs, ruflo agent linkage, /team-remember and /team-board (0.3.5) (#4475)
The guard already covered task_update results (it screens the whole call), but
team_create/team_update carry shared free text too and were unscreened. Skills now
end with the skill to use next, the three agents say how ruflo agents do the work
the service only records, and two commands cover memory and the board.

Co-authored-by: r <r@x>
2026-10-24 22:35:09 -04:00
rUvandr 979cce0ab5 fix(x-gateway): argument-less tools/call, bare-host POST, reject diagnostics (0.9.1) (#4468)
* fix(x-gateway): argument-less tools/call, bare-host POST, and reject diagnostics (0.9.1)

Co-Authored-By: RuFlo <ruv@ruv.net>

* ci: baseline the x-gateway registration-compat spec with its node:test siblings

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: r <r@x>
2026-10-24 18:28:39 -04:00