* feat(core): add bounded context delegation with source-bound benchmark proof
* feat(core): add governed Messages adapter and durable resumable live pilot
* fix(benchmarks): isolate pilot fixtures and record bounded live timeout proof
* fix(context-delegation): review fixes — pilot env allowlist, hash-before-import, real policy root; ADR-521
- subscription-pilot: the spawned claude gets an allowlisted environment
(PATH, HOME, locale, XDG, CLAUDE_CONFIG_DIR, plus names in
RUFLO_PILOT_CHILD_ENV_PASS) instead of the whole shell; a GH_TOKEN
canary test proves it. Policy is evaluated for process.cwd(), not a
hardcoded /home/ruv.
- provider-pilot: the --runtime entry and policy runtime are contained
and hashed before they are imported.
- ADR renumbered 520 -> 521 (520 is agentdb episode CRUD on main).
- Evidence regenerated for the new snapshot (9301fbfd…, Node 24): 300/300
quotes, coordinator bytes -97.56%, total boundary +3.83%; verify.mjs ok.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(context-delegation): honour --worker-available through the CLI parser; scope evidence hashes to owned files
- context-plan read only f['worker-available'], but the parser camelCases
flags, so the documented command always planned 'worker-unavailable'.
Accept both spellings; new test drives the real CommandParser (fails
without the fix).
- results.json no longer hashes hooks.ts, index.ts and global-ai-budget.ts.
Those files change in unrelated PRs, which would have failed
verify.mjs on the next one. Evidence regenerated (20491e6e…, 14 hashes),
163/163 tests, verify ok.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(release): 3.70.0
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(agentdb): episode get/list/update/delete over agentdb 3.3 (ADR-520)
agentdb_episode-get, -list, -update and -delete reach agentdb 3.3's
ReflexionMemory through one new bridge helper (withReflexionController),
so a verified session can be marked success with a critique in place,
keeping its id, and recall re-ranks it. Strict integer ids; pre-3.3
builds get a clear error (delete is gated so the old parseInt-ing
deleteEpisode is never used).
agentdb ^3.3.0 in root and CLI, ruflo override >=3.3.0, both lockfiles;
marketplace agentdb plugin -> plugin-v3.3.0.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(agentdb): ADR-112 use-when guidance on episode CRUD tool descriptions
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(release): 3.69.0
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(memory,neural): persist AgentDB SQL fallback, reuse cached sizes, average MoE P_i
- memory (#4410): AgentDBBackend's SQL fallback gated on db.run/db.get, which
agentdb's prepare/exec handle never has, so no table was created and every
write was a silent no-op. Use prepare().run/get with spread params (safe on
better-sqlite3 and agentdb's sql.js shim) and quote the "references" column.
- memory (#4481): CacheManager stores each entry's size on its LRU node and
refunds that number on overwrite/delete/eviction instead of re-serializing.
- neural (#4381): computeLoadBalanceLoss() uses the mean gate probability over
the same route() history as f_i, persisted and reset with the routing stats.
- Bump @claude-flow/memory 3.2.2, @claude-flow/neural 3.0.2.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(cli): pin @claude-flow/memory 3.2.2 and @claude-flow/neural 3.0.2 (both published)
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* fix(cli): session-end consolidation, snapshot IDs, Fisher decay env, read-path regression test
- #3908: bridgeSessionEnd probed only `nightlyLearner.consolidate`, which
neither the MemoryConsolidator wrapper nor AgentDB's NightlyLearner has.
Feature-detect consolidate -> run -> runAll, bounded (10s) and non-fatal.
- #4404: session_save keyed snapshot rows by a bare `namespace::key`, so
tuples containing `::` collided (one dropped on save, a distinct sibling
row skipped as a mirror). Percent-escape `%` and `:` per component;
ordinary IDs are unchanged and restore reads the explicit fields.
- #3475: CLAUDE_FLOW_FISHER_DECAY overrides the default Fisher EMA decay;
only a finite number in (0, 1] is honoured, constructor config still wins.
- #4570: the sql.js read paths no longer rewrite memory.db on main (fixed by
#3918's ensureSchemaColumns change); add a regression test asserting
inode/mtime/ctime/size are unchanged across searchEntries, listEntries,
memory_search, memory_list and memory_search_unified.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(cli): drop #4570 regression test (issue closed separately as fixed by #3918)
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* fix(security): realpath containment in hooks_codemod; strict-majority Raft quorum
hooks_codemod (#4346, CWE-59): the project-root check compared lexically
resolved paths, so a symlink inside the project pointing outside it let the
codemod read and rewrite files outside the root. Both the file/files[] and
glob branches now also compare real paths (nearest existing ancestor for
missing leaves) against realpath(projectRoot) using path.relative.
RaftConsensus (#4458): quorum was floor(n * 0.66), i.e. 1 for 2- and
3-voter clusters, so the leader's self-vote accepted a proposal even after
a peer rejected it. Quorum is now max(floor(n/2)+1, floor(n * threshold)).
@claude-flow/swarm 3.0.2 -> 3.0.3.
Fixes#4346Fixes#4458
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(swarm): 3.0.4 (3.0.3 was published without dist)
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
config_get/set/reset/export/import/list indexed store.scopes with the
caller-supplied scope name. validateIdentifier accepted reserved names
such as __proto__, and inherited names (toString, hasOwnProperty)
resolved to shared built-ins, so a scoped write could land on
Object.prototype for the whole MCP server process.
Scope names now go through validateScope (rejects __proto__,
constructor, prototype) and scopes are only read/created as own
properties via readScope/ensureScope. Scoped config_set also rejects a
reserved key.
Claude-Session: https://claude.ai/code/session_01MfPHVKWbict6fc5sWyA3zp
Co-authored-by: Claude <noreply@anthropic.com>
agent_spawn now resolves the target swarm before writing the agent and
refuses a spawn into an active swarm that already holds maxAgents live
(non-terminated) agents, with current/max in the error. No swarm, a
shut-down swarm, or a retry of an agent already in the swarm behave as
before.
Main CI: the ratchet runs vitest from the repo root with no config, so the
5 s default testTimeout applied. On a loaded runner the #4203 recall test
took 6.2 s and timed out; its abandoned search imported rabitq-index.js
after the next test's vi.resetModules() and built the index there, which
failed "concurrent ensureRabitqIndex()" on its initialized === false
precondition. The suite gets an explicit 60 s budget. The #2226 test
searched the repo-root .swarm store that every other test file writes
patterns to; it now uses a store of its own.
Co-authored-by: r <r@x>
21 skills under .claude/skills/ (both the repo-dev copy and the shipped
v3/@claude-flow/cli/.claude/skills copy that `init` actually installs into
user projects) had a display-friendly `name:` in their SKILL.md frontmatter
instead of their kebab-case directory name. Claude Code resolves a skill
invocation (e.g. `/pair-programming`) by directory name but surfaces the
`name:` field in autocomplete, so a mismatch makes the skill unselectable
("skill not found").
Adds a regression test (skill-name-matches-dir-1054.test.ts) scanning the
shipped skills directory and asserting every SKILL.md's name: matches its
directory; it fails on the pre-fix content and passes after.
Note: open PR #1587 addresses the same report but only touches the separate
.agents/skills/ mirror, not the .claude/skills copy that `init` ships, so it
would not have fixed the reported repro on its own.
Claude-Session: https://claude.ai/code/session_01ReiDH3nbkdgFmZjAXyWZpp
Co-authored-by: Claude <noreply@anthropic.com>
The statusline's "DDD Domains" / "DDD ●XX%" fields were purely derived
from `.swarm/memory.db` file-size-based pattern-count thresholds in
getV3Progress() — nothing to do with Domain-Driven-Design domain
completion. Running `memory init --force` could drop "DDD progress"
from 100% to 80% just by resetting the DB file size, with zero change
to any actual architecture work.
Relabel the full and compact statusline views honestly ("Learning
Tier" / "Learning:") and replace the fabricated "DDD ●XX%" percentage
with the real pattern count it was derived from ("Memory ●N"), per the
issue's own suggested remediation. The CVE-count half of this issue
was already fixed by #2694; the ADR-count half is already tracked
separately by #1588, so neither is touched here.
Adds a regression test (issue-1047-ddd-statusline-metrics.test.ts)
that fails on the old code and passes after the fix.
Claude-Session: https://claude.ai/code/session_01ReiDH3nbkdgFmZjAXyWZpp
Co-authored-by: Claude <noreply@anthropic.com>
coordination_load_balance distribute with the round-robin algorithm
always picked the first active node, so every task went to the same
node. Remember the node the last task went to and pick the active node
after it, wrapping around.
workflow_run stored its workflow with status 'running' and a startedAt,
and returned status 'running' with a fabricated `stages * 30s`
estimate, but dispatched nothing. workflow_execute then refused the
workflow ("Workflow already running") and workflow_delete refused it
("Cannot delete running workflow"), so it stayed stuck unless
cancelled.
It now saves the workflow as 'ready', as workflow_create does, with no
startedAt. It returns status 'ready', estimatedDuration 'unknown' and a
nextStep note: workflow_execute starts the workflow, and its task
steps need config.agentId or options.defaultAgentId. options still flow
into variables, so a defaultAgentId passed to workflow_run is used by
workflow_execute. dryRun is unchanged.
The `workflow run` CLI says "Workflow created" and prints how to start
it. workflow-cli-tool-shape's list case now expects the 'ready' status.
Fixes#4609
- Session end stores the summary as a ReflexionMemory episode (neutral reward,
unverified). The bridge called startEpisode/endEpisode, which ReflexionMemory
never had, so no session episode was ever written.
- New agentdb_episode-recall MCP tool: retrieveRelevant with agentdb 3.2's
keyword + vector fusion by default, opt-in cross-encoder rerank.
- agentdb_session-start takes recall/k/hybrid/rerank and returns episodes.
- A failing secondary write no longer discards a stored or recalled episode.
- agentdb ^3.2.0 in cli and claude-flow, >=3.2.0 in the ruflo override.
- scripts/smoke-episode-recall.mjs runs the round trip on real agentdb.
Co-authored-by: r <r@x>
* 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>
* fix(aidefence): restore the ADR-118 wider-detection pass to source (3.0.4)
@claude-flow/aidefence 3.0.3 (npm latest) was published from an uncommitted
tree carrying the ADR-118 / #2004 patterns, so main never had them, and
main's #3177 ReDoS bounds never reached npm. 3.0.4 is a true superset:
the verb-noun override window, behave-as role hijack and god/root/admin/sudo
mode jailbreak markers, on top of main's bounded PII/marker regexes.
Parity against the published 3.0.3 dist: 24-input corpus, 0 regressions.
Drops publishConfig.tag=alpha. Refs #4625.
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(aidefence): merge AIMDS pattern packs into ThreatDetectionService (3.1.0)
Vendors the AIMDS pack engine (normalize, decoders, pattern-loader, engine)
and its six pattern packs (53 patterns) from midstream AIMDS at abe78d6 into
src/domain/services/packs/. Packs are embedded as TS modules, so they load
from the published ESM dist with no fs path lookup; the files allowlist is
unchanged.
ThreatDetectionService.detect() runs the packs in a second pass over the raw
input and merges findings into the existing result shape (one threat per
type, as before). Built-in patterns, including the ADR-118 extras, stay and
their confidences are unchanged. Packs are on by default; disable or select
them with createThreatDetectionService({ packs }) or createAIDefence({ packs }).
The legacy pattern-array argument still works.
- ThreatType gains tool_invocation, data_exfiltration, markup_forgery;
Threat gains an optional ruleId (e.g. EX-001) for pack findings.
- Packs are validated, compiled and regex-warmed once per process, so
isSafe()/checkThreats() no longer pay a compile per call and the first
detect() is not charged ~17 ms of lazy regex compilation.
- Fixes a quadratic regex in the vendored normaliser (undoLeet): 100 KB of
hex digits took 1.8 s; now 6 ms. Decoders cap each blob before decoding.
Corpus (55 attacks / 30 legit): built-ins only 8/55, packs on 55/55; false
positives F13 and F27 in both modes (built-in encoding_attack), pinned.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(memory): build AgentDB controllers with an embedder and the shared vector backend
LearningSystem, NightlyLearner, ExplainableRecall and the graph transformer's
CausalMemoryGraph take (db, embedder, ...). The registry passed only the
database, so the first predict/discover/recall threw on this.embedder (the
#3327 Finding A class, fixed for ReasoningBank only). Real-agentdb test fails
on the old source (learningSystem.embedder undefined). memory suite 659/659.
Adds ADR-513 (stable versions, convergence) and ADR-516 (aidefence recovery).
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(cli): move to agentic-flow ^2.2.0 (main line); stable-only tag policy
- agentic-flow ^3.0.0-alpha.1 resolved to the March 3.0.0-alpha.2, which
pulled @xenova/transformers -> onnx-proto -> protobufjs 6 (critical).
2.2.0 is agentic-flow's main line (ADR-515). The update validator and the
init doc table follow.
- neural-tools: computeEmbedding returns a Float32Array, which JSON.stringify
writes as {"0":...}; convert to an array before the neural store.
- CLAUDE.md: no more alpha/v3alpha/next dist-tags (ADR-513); overrides do not
reach users; examples use ruflo@latest.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(cli): pin @claude-flow/aidefence 3.1.0 (AIMDS pattern packs)
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(cli): target agentic-flow ^3.0.0 (first stable 3.x, ADR-515)
agentic-flow's security defaults change in a breaking way (agents no longer
bypass permissions by default, proxies need a token), so the main line ships
as 3.0.0 rather than 2.2.0. That also gives the 3.x alpha line a stable head:
existing ^3.0.0-alpha.1 installs resolve to it and drop the March alpha's
protobufjs 6 (critical).
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(memory): capture AgentDB's backend failure reason from stderr too
agentdb 3.0.0 moves library diagnostics off stdout (they corrupted stdio MCP
JSON-RPC), so the #4622 lock-reason capture patches console.error as well.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-514 agentdb 3.0.0, ADR-515 agentic-flow 3.0.0, ADR-517 AIMDS pattern packs
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(memory): 3.2.1 (embedder wiring, stderr reason capture)
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(release): 3.67.0 — agentdb 3.0.0, agentic-flow 3.0.0, aidefence 3.1.0, memory 3.2.1
- CLI and the claude-flow umbrella declare agentic-flow ^3.0.0 (root lock and
v3 pnpm lock resolve 3.0.0 / agentdb 3.0.0).
- CHANGELOG 3.67.0.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test/docs: dated ADRs 513-517; scope the bracket/DAN timing test to built-ins
- ADRs 513-517 gain Date lines (the console ADR parser expects >97% dated)
and ADR-513/516 name the versions that shipped (agentic-flow 3.0.0,
aidefence 3.1.0).
- threat-detection 'bounds the bracket and DAN patterns' measures the
built-in regexes it was written for ({ packs: false }); the AIMDS packs
have their own 100 KB adversarial timing test. Full detector on that input:
86 ms locally, 301 ms on the CI runner (linear, budget was 200 ms).
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(deps): stop pinning ruvector 0.2.27 under agentdb 3.0.0; CLI agentdb ^3.0.0
The root (and ruflo wrapper) overrides pinned ruvector ^0.2.27 from the BEIR
work (3.10.29). npm applies overrides inside this repo's tree, so CI ran
agentdb 3.0.0 on ruvector 0.2.27, below agentdb's own ^0.2.40: a pairing no
user ever installs (published overrides are ignored), and the one where #2226
pattern recall failed on CI. Raised to ^0.2.41.
The CLI's agentdb range moves to ^3.0.0 (stable; no alpha ranges, ADR-513),
so the v3 pnpm lock resolves 3.0.0 and the v3 test job exercises what users
get instead of 3.0.0-alpha.20. 115 agentdb/memory-related CLI test files:
868/868 on 3.0.0.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
- ControllerRegistry keeps the first backend failure AgentDB logs (e.g. a
native vector store locked by another process) instead of only the last
fallback's format rejection, exposed as getAgentDBInitError(), with the
single-owner HTTP remedy. @claude-flow/memory 3.2.0.
- The CLI bridge records that reason, so the sql.js fallback's refusal names
it, and isBridgeAvailable() is false when AgentDB did not open.
- memory_list returns success:false with the error on a failed query instead
of an empty inventory.
- Release 3.66.1 with plugin-agent-federation 1.0.4 (#4619 trust thresholds).
Co-authored-by: r <r@x>
* 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>
* fix(update): skip the startup update check for CI=1, not only CI=true
The startup update check skipped CI only when CI was the literal string 'true'. A CI=1 run
(many CI systems, and the mods-cli-bin test) checked, found a newer published CLI and ran
npm install @claude-flow/cli@<latest> --save-exact in the working directory during ruflo init.
After 3.65.1 was published that install, with native builds, pushed init past the test's
120s child timeout on every branch still at 3.65.0. isCI() now accepts any CI,
CONTINUOUS_INTEGRATION or GITHUB_ACTIONS value except empty, 0 or false.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(update): CI detection reads CI and CONTINUOUS_INTEGRATION only
GitHub Actions sets CI=true, so GITHUB_ACTIONS added nothing and broke rate-limiter tests that
clear CI to exercise the non-CI path.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* fix(security): pin http_fetch connections to DNS-checked addresses (SSRF via DNS)
http_fetch refused loopback/RFC-1918/link-local hosts by looking only at the URL's hostname
text, then let fetch() resolve the name on its own. A name that resolves to (or rebinds to)
127.0.0.1, a private address or 169.254.169.254 passed the check and fetch() connected to it,
with CLAUDE_FLOW_HTTP_FETCH_ALLOW_PRIVATE unset.
Requests now go through node:http/https with a lookup hook (http-fetch-pinned.ts): it resolves
every address of the host, refuses the host when any is private unless the opt-in is set, and
returns only the checked addresses to the socket, so the connection cannot land on an address
that was not checked (no TOCTOU between check and connect). Every redirect hop goes through the
same transport. Fresh connection per request (agent: false). IP literals are still checked by
text in validateUrl. The address check also covers ::, ::a.b.c.d, NAT64 64:ff9b::, 6to4
2002::/16, fe80::/10 and fec0::/10 in full, ff00::/8, 224.0.0.0/4 and up, 198.18.0.0/15 and
*.localhost.
Tests: a name resolving to loopback (localhost., no network) is refused and the internal server
sees no request, also as a redirect hop; the opt-in still reaches it; pinnedLookup refuses mixed
public+metadata answers, private IPv6 answers and empty answers, and passes public answers
through unchanged; address table. Redirect tests now inject the request function.
Co-Authored-By: RuFlo <ruv@ruv.net>
* ci: register CLAUDE_FLOW_HTTP_FETCH_ALLOW_PRIVATE as an operator-only trust boundary
The env read moved into http-fetch-pinned.ts, outside the function the audit's param heuristic
had credited. It must stay env-only: a flag or tool argument would let the agent driving
http_fetch turn the SSRF guard off.
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(plugins): ADR-507 cut the per-turn plugin footprint
- scripts/measure-plugin-footprint.mjs: per-plugin skills/commands/agents,
listing characters and estimated tokens, from the tree or a git ref;
before/after reports in v3/docs/validation/.
- 27 operational skills get disable-model-invocation: true (cost-tracker
sub-reports reached by /ruflo-cost, metaharness bench/learn/evolve/mint/
oia-audit, GAIA submission + comparison, init-project, ruflo-status,
vector-setup, federation-init, agntcy-status). Each is listed in a
"User-invoked skills" table in its plugin README; the choosing rule is in
plugins/README.md.
- 20 skill descriptions over 300 characters cut to one sentence plus
"Use when".
- audit-skill-frontmatter: 300-char ceiling on skill and command
descriptions (measured unfolded) and a README check for every
user-invoked skill.
- skillTrim (§2.4) not built: the engine has no skill-listing hook.
Listing with every plugin enabled: 47,743 -> 39,402 chars
(about 11,936 -> 9,851 tokens per turn).
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-507 status names PR #4588
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(plugins): ADR-507 cost-analyst points users at /ruflo-cost for user-invoked reports
The engine's refusal for a disable-model-invocation skill says not to
replicate its workflow by other means, so the agent names the subcommand
instead of running the report script. After-report now cites the pushed
commit.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(scripts): ADR-507 audit runs through symlinked paths; test the gate's wiring
The import guard compared argv[1] with import.meta.url, which Node realpaths
for the entry module. Run through a symlinked path, main() was skipped and the
audit exited 0 having checked nothing. Both scripts now compare realpaths.
audit-skill-frontmatter takes --plugins-dir so tests can run the real CLI on
a fixture: a 304-char folded description, an unlisted user-invoked skill and
a 311-char literal command description must exit 1 with those findings, and
adding the README row must clear only the user-invoked one. The repo-wide test
now also asserts skillsScanned > 100. Disabling any of the three checks, or
restoring either old guard, fails a test.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(plugins): version bumps for ADR-507 footprint changes
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* feat(mods): compactSnapshot — pre-compaction transcript snapshot + one-shot reload block (ADR-505)
New ruflo-mods option compactSnapshot (default on). On a main-loop manual/auto/plugin
session.compact it writes the transcript about to be summarized to
.claude-flow/sessions/compactions/snapshot-<n>.jsonl (role, text <= 2000 chars, tool
names/ids only; each line screened; 400 messages / 2 MiB; ten rotating slots), beside
the compaction so it is never blocked, delayed or rewritten. The next non-slash prompt
after a compaction that stood gets one [RUFLO_AFTER_COMPACT] context block (<= 2000
chars) from lessons shown this session, the last 5 loop outcomes, open swarm/claim ids
and the snapshot path. ruflo doctor warns when snapshots exist and git would commit them.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(mods): isolate the ADR-505 doctor test from global git excludes; note precompute inference
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-505 status names PR #4591
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(mods): compactSnapshot screens raw message text before JSON encoding (ADR-505)
JSON escaping put a backslash before quotes and encoded newlines, so the
key-assignment rule missed "api_key": "..." / password="..." and the
line-start role-tag rule missed a \nsystem: line; those were written to the
snapshot in plaintext. messageLine now screens the raw cut text and the tool
names, plus the encoded line as before. Negative-control test added.
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(ruflo-mods): 0.10.0 for ADR-505
---------
Co-authored-by: r <r@x>
* feat(plugins): sensitive userConfig secrets, readSecret helper, plugin secrets audit (ADR-506)
- ruflo-cost-tracker, ruflo-metaharness: `openrouterApiKey`; ruflo-x-gateway:
`adminToken`. Each is type string, sensitive, optional, no default.
- readSecret(name, envFallbacks): CLAUDE_PLUGIN_OPTION_<NAME> first, then the
variables the plugin always read. Copied per plugin (x-gateway in src/, the
only folder its Docker image ships); a test keeps the copies identical.
- Consumers: openrouter.mjs key/generation, x-gateway checkAdmin (call time,
fail closed), redblue child env (OPENROUTER_API_KEY, never argv).
- scripts/audit-plugin-secrets.mjs: credential-named option without
sensitive: true, or a literal secret (the mods' COMMON_SECRETS, parsed from
screen.ts) in plugin.json/hooks.json, fails. Wired into plugin-package-audit.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-506 status points at PR #4587
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(plugins): deliver the ADR-506 secret option, harden the plugin secrets audit
Review fixes for #4587:
- Delivery: Claude Code gives a plugin option only to the plugin's own hooks
and MCP servers, never to the Bash tool that runs openrouter.mjs and the
redblue skill path. ruflo-cost-tracker and ruflo-metaharness now carry a
SessionStart hook (scripts/_secret-env.cjs) that writes the sensitive
openrouterApiKey option to CLAUDE_ENV_FILE as OPENROUTER_API_KEY, only when
that variable is unset. Live-verified with Claude Code 2.1.289 (probe plugin
and the real cost-tracker): a Bash tool command resolved the key.
- ruflo-x-gateway adminToken removed: the gateway is a deployed server that no
Claude Code process of the plugin runs, so the option could never arrive.
- Audit: a secret used as a JSON key is shown as <redacted-key> and never
printed; .mcp.json and .lsp.json are scanned; OpenRouter key shape added;
credential-named env/headers entries holding a 16+ char literal fail;
${user_config.*} in command/headersHelper/args fails.
- ADR-506 updated with the delivery trade-off and what the bridge does not
reach (the metaharness_redblue MCP tool in ruflo-core's server).
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(plugins): skip the bash-only ADR-506 bridge tests on Windows; hedge env-file mode wording
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(plugins): cost-tracker 0.29.0, metaharness 0.3.0 for ADR-506
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* feat(mods): load ruflo plugins in headless claude -p workers (ADR-510)
claude -p on a fresh config loads no marketplace plugins, so ruflo's own
headless workers ran without ruflo-mods' guard, routing and learning loop.
- resolvePluginPaths: --source local checkout, then the marketplace clone,
then the install cache; a folder without .claude-plugin/plugin.json is
reported missing, never returned; honours CLAUDE_CONFIG_DIR.
- The daemon's HeadlessWorkerExecutor and `hive-mind work` add
--plugin-dir <ruflo-mods> and CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 (unless
set), never duplicate a caller's own --plugin-dir, and record a missing
plugin (logged once) as missingPlugins on the result.
- `ruflo plugins paths [--json]` for Agent SDK callers; README section.
- `ruflo doctor --component headless-plugins` runs a real claude -p and
checks the init event, plugin_errors and the mod heartbeat (runner
injectable; skipped without a model credential).
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-510 status names PR #4586
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(mods): headless plugin paths never come from project settings; stage hive-mind spawn -p (ADR-510)
- resolvePluginPaths no longer reads extraKnownMarketplaces from the
project's .claude/settings.json or settings.local.json. A cloned repo
could point every daemon worker and `hive-mind work` at its own folder,
loaded via --plugin-dir with function hooks on and no trust prompt, in
place of the user's ruflo-mods. "Local" is now only a directory
marketplace in Claude Code's user-level known_marketplaces.json, and a
relative path is rejected.
- `hive-mind spawn --claude --non-interactive` builds a `claude -p` worker
too: it now goes through withHeadlessPlugins (staged before the prompt)
and reports missingPlugins on data.claude. Interactive launch unchanged.
- Tests: project-scope settings (absolute or ./x) resolve to clone/cache,
never the repo; relative path rejected; spawn-mocked hive-mind spawn
test. All four new assertions fail on the previous commit.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-510 trust-boundary note records the live resolver check
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* feat(learning-loop): gaming defences for verified outcomes (ADR-503)
The verified-outcome loop (ADR-502) trusts a verifier's exit status, but the
model chooses what that verifier checks. Four downgrade-only layers:
- mod: a verified-success record carries taints when the turn edited a test
file (edited-tests), a verifier config (edited-verifier-config), or decided
on a weakened/narrowed command (narrowed-verifier); a per-process session
token is written on every record. The outcome word never changes.
- CLI: a success with a taint not listed in .claude-flow/config.json
learningLoop.allowTaint is counted under `tainted` and never reaches SONA.
- CLI: opt-in re-verify (learningLoop.reverify, off by default) re-runs a
rotating allowlisted manifest check in a temp detached git worktree at HEAD
with a timeout; failure, timeout or error downgrades to unknown. Only an
explicit verified-ingest re-verifies; hot callers defer.
- CLI: anomaly gate holds would-be lessons that are perfect-and-tainted,
only-narrowed, or from one session, listed as `held: <id> (<reason>)`.
Adds scripts/eval-learning-loop.mjs (manual, plan-only unless --run).
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-503 status names PR #4590
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(learning-loop): shell edits of tests taint; test the real re-verify runner (ADR-503)
- A Bash command that writes, moves or deletes a test file or verifier
config (rm, mv, cp, tee, truncate, sed -i/perl -i, output redirection,
git rm/checkout/restore/...) now sets edited-tests /
edited-verifier-config like an Edit of that file. Before this change,
Edit src/a.ts + `sed -i 's/it(/it.skip(/' src/a.test.ts` + `npm test`
produced an untainted verified-success. Downgrade-only: reads and test
runs earn nothing.
- gitWorktreeRunner is now tested against a throwaway git repo: pass,
fail, missing script, timeout (hung script's process verified dead),
non-repo error. After each run only the main worktree remains and no
ruflo-reverify-* dir is left. A negative control (kill only the direct
child) makes the timeout test fail.
- ADR-503 implementation notes record both, plus the interpreter-write gap.
Co-Authored-By: RuFlo <ruv@ruv.net>
* test(learning-loop): give the hung-check re-verify test an 8s budget for cold CI runners
Co-Authored-By: RuFlo <ruv@ruv.net>
* chore(ruflo-mods): 0.9.0 for ADR-503
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* test(mods): real-binary test tier with a scripted mock model (ADR-504)
Runs the real `claude` binary headless against a local mock of the
Anthropic Messages API, with ruflo-mods loaded through --plugin-dir in a
throwaway project with its own HOME. No API key, no paid model.
- mock-model.mjs: scripted Messages server (streaming and not), logs
every request; untool'd or unknown requests get a minimal answer.
- run.ts: runner with a minimal child environment, PATH recorders for
dangerous commands, and readers for events, requests and files.
- loads.test.ts (contract 1): with every option on, the heartbeat is
written, /ruflo-mods is registered and answered with no model request.
Negative control: a #4485-shaped copy (second bare session.start) is
refused silently by the real loader and fails those assertions.
- contracts.test.ts (contracts 2-5): verified-success record from a
scripted fix turn; [RUFLO_LESSONS] reaches the request (and not below
the gate); ruflo denies the root delete with its own reason and denies
a listed command the engine allows (which runs without the plugin);
the route block reaches the request (and not without the plugin).
- Excluded from the CLI, v3 and root-ratchet default runs; run with
`npm run test:real-binary`. New CI job mods-real-binary pins Claude
Code 2.1.289 and fails, naming the step, if the binary will not start.
Co-Authored-By: RuFlo <ruv@ruv.net>
* docs(adr): ADR-504 status names PR #4589
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
* feat(mods): verified-outcome learning loop (learningLoop, #4581, ADR-502)
ruflo-mods 0.8.0 adds the learningLoop option (default off). Each main-loop
turn becomes a trajectory whose outcome is verified-success/verified-failure
only when a recognised test/build/typecheck/lint command ran after the
turn's last edit and the shell's exit status said so; otherwise unknown.
A masked status (|| true, pipes, ;, background, substitution) verifies
nothing, and the model's own words are never read.
The CLI ingests the records (ruflo hooks verified-ingest, the
hooks_intelligence_verified-ingest MCP tool, and automatically from
hooks_route and hooks_session-end): only verified records train SONA,
unknown ones are counted; each id once; PII-redacted. It writes
learned-lessons.json, and the mod adds at most three cited lessons at or
above the 0.6 gate to a matching prompt. doctor --component learning-loop
reports whether outcomes reach SONA.
Stages 5-7 of #4581 (pane, autonomous /loop-run, GEPA self-tuning) are
deferred; the on-by-default evaluation has not been run.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(mods): learning loop needs an edit to verify; redact e-mails before writing (#4581)
A turn that edited nothing is unknown (a verifier verifies a change).
The mod replaces e-mail addresses in the stored task; ADR-502 states the
privacy limit (broader PII redaction runs at CLI ingest).
Co-Authored-By: RuFlo <ruv@ruv.net>
* feat(mods): learningLoop on by default (#4581)
Maintainer decision: ship the learning loop on by default. Set the
learningLoop option to false to turn it off. ADR-502 records that the
issue's 30-task evaluation has not been run yet.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(cli): ADR-112 guidance on hooks_intelligence_verified-ingest (#4581)
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
github_repo_analyze returned `git remote get-url origin` verbatim. A remote
with embedded credentials (https://x-access-token:<token>@github.com/...,
the form CI checkouts and some credential helpers write) put the token into
MCP tool output, where it reaches the model and session transcripts.
Strip URL userinfo before returning it. Greedy up to the last `@` in the
authority, so a raw `@` in a password cannot leave a fragment behind.
scp-form remotes (git@host:o/r) carry no secret and are unchanged.
Found while reviewing #4571, which widened the same parser.
Co-authored-by: r <r@x>
hooks_worker-detect's autoDispatch created a worker record and marked it completed after a hardcoded 1500ms timer without running any analysis. Its sibling hooks_worker-dispatch already reports synthetic-completed and a no-executor note, but detect exposed the fake as an ordinary completed worker (#4549 automation scan, Finding A).\n\nMark records created by detect with synthetic:true and a no-executor note, use phase 'synthetic-completed', and return autoDispatchStatus/note in the handler response. worker-status and worker-list spread the record, so both surfaces now carry the disclosure.\n\nRegression uses fake timers: before 1500ms the record is running+synthetic; after, status completed, phase synthetic-completed, and the note is present. Baseline fails because autoDispatchStatus is undefined; candidate passes. Existing worker-dispatch status test 4/4 combined, tsc reports no errors in touched files.
The parser stores `--dry-run` (and `-d` on `migrate fix`) as `dryRun`,
but both actions read `flags['dry-run']`, which is always undefined. So
`migrate run --dry-run` ran the real migration, overwriting an existing
.claude-flow/config.json, and `migrate fix --agents --dry-run` wrote the
restored agent files. Read `dryRun`, keeping the kebab key as a fallback
as update, init and mods do.
The remote-URL pattern stopped the repo name at the first dot, so remotes
like vercel/next.js or socketio/socket.io did not match and the repository
was reported and stored as local/repo.
@claude-flow/memory 3.1.0 (#4550) made ControllerRegistry.set() real, so the
bridge now registers the intelligence module's LocalReasoningBank whenever
agentdb's ReasoningBank is unavailable. It has store()/findSimilar() but no
storePattern(), so bridgeStorePattern wrote to the SQL pattern namespace while
bridgeSearchPatterns read the bank: a stored pattern was never found when the
bank already held other patterns (the #2226 test failed on CI for #4566).
- bridgeStorePattern writes to the bank's store() with an embedding from the
same generateEmbedding() the search uses, and flushes it to disk.
- bridgeSearchPatterns falls through to the SQL namespace when the bank has
no match, so patterns written by the fallback path stay findable.
Co-authored-by: r <r@x>
* dream(memory): wire ControllerRegistry.set() so MutationGuard/AttestationLog activation stops being dead code
memory-bridge.ts's post-init controller-activation wiring (reasoningBank,
learningSystem, skills, semanticRouter, gnnService, rvfOptimizer,
mutationGuard, attestationLog, guardedVectorBackend) has always gated
registration on `typeof reg.set === 'function'`, falling back to an
unread `reg._controllers` property otherwise. ControllerRegistry never
implemented a public set() method, so every external activation silently
took the dead fallback: registry.get('mutationGuard')/get('attestationLog')
always returned null, permanently disabling write-mutation validation
(fail-open "no guard installed = allow") and audit logging (silent no-op)
on the real store/delete/purge paths. Same bug shape as the already-fixed
#3327 Finding A (reasoningBank.store never existed, so its own
typeof-guard was dead too).
Adds ControllerRegistry.set<T>(name, instance) mirroring the shape
initController() already produces internally. Zero changes needed at any
of the 9 memory-bridge.ts call sites.
5 new discriminating tests reproduce memory-bridge.ts's exact activation
pattern; stash-isolated baseline fails all 5 (TypeError: registry.set is
not a function), candidate passes all 5. Full @claude-flow/memory suite:
650/651 both ways (1 pre-existing environmental failure, byte-identical,
unrelated chmod/root-bypass test). tsc --noEmit: 0 errors.
Evaluated, pending independent adversarial critique.
* dream(memory): close prior instance on ControllerRegistry.set() (post-critique)
Independent adversarial critique of afe2cdd found set() silently dropped
a reference to any pre-existing resource-holding instance on overwrite,
reintroducing the exact leak class #2432 fixed for initController()'s own
replacement path (unclosed sql.js/WASM resources, ~36GB over 6 weeks in
production per that commit's own account). Not currently triggerable
through the shipped memory-bridge.ts wiring (every real call site guards
with `if (!reg.get(name))` first), but the set() API itself offered no
protection.
Fix: dispatch the existing closePriorIfAny(name) before overwriting the
map entry, same as initController() does. Intentionally not awaited, so
get(name) still reflects the new instance synchronously; the old
instance's close()/dispose() (best-effort, errors swallowed) runs in the
background — matches every other call site's synchronous-looking
registration contract.
1 new discriminating test added. Full @claude-flow/memory suite:
651/652 (1 pre-existing environmental failure, unchanged). tsc --noEmit:
0 errors.
Known, disclosed, not-fixed-tonight limitation (out of scope, needs a
human call on correct init ordering): `causalRecall` is the one
ControllerName absent from every INIT_LEVELS entry, so shutdown()'s
by-static-list lookup would never find/close a controller registered
under that name via set() — unexercised today (no call site uses it).
Flagged for a future night rather than guessed at here.
* dream(memory): add 2026-10-28 SOTA research gist (gist publishing unavailable, FALLBACK)
No gh CLI / gist-creation tool reachable this session — same disclosed
FALLBACK as every night since 2026-09-30. Full SOTA report committed to
docs/dream-cycle/ instead of a gist.github.com URL.
* dream(memory): #4549 update LEDGER for 2026-10-28
* dream(memory): bump @claude-flow/memory to 3.1.0 (CI: leaf-package-publish audit)
CI's "Plugin package install-safety" job (scripts/audit-leaf-package-publish.mjs,
guarding ruvnet/ruflo#3335 and #3390/#3327 Finding A) correctly failed: this PR's
source change to v3/@claude-flow/memory/src/controller-registry.ts is publishable
(adds a new public method) but @claude-flow/memory's own package.json version was
unchanged at 3.0.9 — @claude-flow/memory is not bundled into the release train, so
publishing cli/claude-flow/ruflo without also bumping+publishing this leaf would
ship the OLD copy and this fix would reach nobody.
Bumped @claude-flow/memory 3.0.9 -> 3.1.0 (MINOR: backward-compatible new public
method). Updated the two exact pins in v3/@claude-flow/cli/package.json
(dependencies + optionalDependencies) to match, and regenerated v3/pnpm-lock.yaml
via `pnpm install` (never hand-edited) so the lockfile's specifier stays in sync.
Verified locally: node scripts/audit-leaf-package-publish.mjs --base origin/main
now reports "ok: every non-bundled leaf is covered by the CLI range and carries a
bump if changed". Full @claude-flow/memory suite re-confirmed 651/652 (same
pre-existing environmental failure), tsc --noEmit 0 errors.
Note for a future release: per CLAUDE.md's publishing rules, @claude-flow/memory
must be published standalone alongside the next @claude-flow/cli release for this
fix to actually reach consumers — not done as part of this draft PR.
---------
Co-authored-by: Claude <noreply@anthropic.com>
#4543 fixed the six default skills, but 443 more agent_spawn calls with
`type` sat in the agent, command and Codex skill docs that init installs,
and projects initialised earlier keep their old copies.
- agent_spawn accepts `type` as an alias for `agentType` (agentType wins
when both are sent) and reports a missing agentType by name, instead of
the security schema's misleading "type: Required". Fixed in the CLI
handler, so no standalone cli-core publish is needed.
- Rename the top-level `type` key of every mcp__claude-flow__agent_spawn
call to `agentType` in .claude/{agents,commands}, the CLI and MCP package
copies, and .agents/skills (443 keys, 71 files). Other tools'
agent_spawn calls (flow_nexus, ruv-swarm) are untouched.
- coordination_sync: the schema now says `trigger` is refused (#4559)
and that `force` is unused.
Co-authored-by: r <r@x>
coordination_sync trigger waited on a simulated 50ms "sync" (a
setTimeout), incremented syncCount, set lastSync, zeroed pendingChanges
and returned { success: true, action: 'synchronized', nodesSync }. No
state moved between nodes, and it did this even with no nodes
registered.
It now returns success: false with the reason and leaves the stored
sync record untouched, as neural_compress quantize/prune do (#4195,
#4423). status and resolve only report the stored counters and are
unchanged.
Fixes#4557
The default-on, critical-priority local audit fallback wrote noHardcodedSecrets: true and riskLevel: 'low' without inspecting any source. A daemon with no headless scanner therefore produced a believable clean security report every 10 minutes, the opposite of the honest-empty-stub convention used by sibling fallbacks (#4549 automation scan).\n\nReport scanned:false, noHardcodedSecrets:null, riskLevel:'unknown', and an explicit note/recommendation that only file presence was checked and no secret scan or code analysis ran. Existing env-file/gitignore presence checks are unchanged; persisted JSON and return value stay identical.\n\nRegression calls the private local audit path and asserts the report no longer claims a scan/risk level, then verifies the persisted security-audit.json matches. Baseline fails with scanned undefined; candidate passes. Existing worker-daemon timer test still passes; tsc reports no errors in the touched file.
agent_pool advertised 'fill' in its action enum, but the handler had
no branch for it, so every fill call returned
{ error: 'Unknown action' }.
fill is now scale without the shrink step. It grows agentType's pool
to targetSize with idle agents and never terminates any; a target at
or below the current size is a no-op. It shares scale's targetSize
validation and agent creation. scale and drain are unchanged.
Fixes#4555