A scope is a namespace prefix in the same store:
agent-memory:<scope>:<agentId>:<namespace>. memory_store, memory_retrieve
and memory_search take an optional scope (project|local|user) plus the
agentId the memory package keys each scope by; the CLI gets matching
--scope/--agent flags. Without a scope nothing is prefixed, so existing
data and unscoped calls behave exactly as before. New read-only tool
memory_list_scopes reports each scope's agents, namespaces and counts.
Co-Authored-By: RuFlo <ruv@ruv.net>
`read <ns> <key>` refused a key held by several entries with AMBIGUOUS_KEY
and no ids, so there was no way to see the duplicates or repair them.
- The AMBIGUOUS_KEY refusal now lists every matching id with its
createdAt and updatedAt, and names the commands below.
- `read --all <ns> <key>` returns {multiplicity, entries[]}; `read-id <id>`
returns one entry by id. Both are read-only: no package load, no
directory, no lock, no write.
- `dedupe <ns> <key> [--keep <id>] [--apply]` is a dry run by default and
reports which entry would be kept (newest updatedAt, then createdAt;
ties broken by ascending id) and which removed. With --apply it plans
again from a fresh read under the store lock, removes only the other
entries of that namespace+key through the atomic write, and verifies
the result by readback. --keep must name an entry of that key, or the
command is refused and the store is left as it was.
Co-Authored-By: RuFlo <ruv@ruv.net>
SessionStart runs auto-memory-hook.mjs directly, and the hook only found
@claude-flow/memory through the sidecar that init / upgrade / doctor write.
A fresh worktree has no sidecar (.claude-flow/ is gitignored), so imports
were DISABLED there.
The hook now tries, in order: its own sidecar; the main checkout's sidecar
when it runs in a git worktree; the in-repo dist; require.resolve from the
helper's install root and from the helper's own directory; and the CLI's
own dependencies (@claude-flow/cli, directly or under ruflo / claude-flow),
which is where recordMemoryPackagePath() resolves from. Candidates come
from MODULE_ROOT or the helper's directory only, never CLAUDE_PROJECT_DIR.
A candidate is used only if it exports AutoMemoryBridge. import and sync
record the found path in the sidecar, so the next run is fast; status
reports where it resolved but writes nothing. When nothing resolves, the
existing DISABLED warning now lists every place searched and why each
failed. No network, no install.
Co-Authored-By: RuFlo <ruv@ruv.net>
Step 0 of `start all` is now project init, using the exact path
`start quick` uses: isInitialized() (.claude-flow/config.yaml) and, only
when that is false, `init --minimal`. That init call is extracted into
runMinimalProjectInit() and shared by both subcommands, so `quick` keeps
its behaviour and `all` never re-inits an initialized project. A failed
or throwing project init stops the run with exitCode 1 and
failedStep: 'project init'.
runStartAll and its injectable StartAllDeps move to
src/commands/start-all.ts; start.ts is back to 487 lines.
Co-Authored-By: RuFlo <ruv@ruv.net>
CI runs vitest from the repo root, where @claude-flow/mcp is not
resolvable as a package, so the import failed and the file counted as a
new failure in the test ratchet.
Co-Authored-By: RuFlo <ruv@ruv.net>
CI runs vitest from the repo root, where @claude-flow/mcp is not
resolvable as a package, so the import failed and the file counted as a
new failure in the test ratchet.
Co-Authored-By: RuFlo <ruv@ruv.net>
`embeddings init` writes { model, dimension } to .claude-flow/embeddings.json,
but memory init, the AgentDB bridge and the router task embedder all
hardcoded Xenova/all-MiniLM-L6-v2 / 384.
Add src/memory/embedding-config.ts: resolveEmbeddingConfig(root) reads that
file (same schema commands/embeddings.ts writes; bare model names get the
Xenova/ namespace), falls back to MiniLM/384, and warns once on malformed
JSON. resolveEffectiveEmbeddingConfig() additionally checks memory.db and
agentdb-memory.db: if either already holds real vectors of another
dimension, that recorded dimension is kept with one warning; nothing is
mixed or rebuilt. Resolutions are cached per root.
Used by loadLocalEmbeddingChain, fresh vector_indexes seeds, the bridge's
registry init / embedding labels / dimension stub check, and task-embedder.
Co-Authored-By: RuFlo <ruv@ruv.net>
`ruflo start all` initializes the memory database only when it is not
initialized yet (checkMemoryInitialization, then initializeMemoryDatabase
with force: false), starts the worker daemon only when it is not already
running (isDaemonAlive, then the existing `daemon start` action), and then
runs the main start action. It stops at the first failing step and
returns exitCode 1 naming that step. Existing subcommands are unchanged.
The steps are injectable (runStartAll(ctx, deps)) and the tests mock all
of them: fresh project, already-initialized project with a running
daemon, and a failure at each step.
Co-Authored-By: RuFlo <ruv@ruv.net>
agentdb_pattern-search only treated a ReasoningBank result as success when
it had hits. A healthy empty result fell through to the legacy
pattern-namespace fallback and came back degraded:true with
reason "reasoningBank-empty:reasoningBank", so callers that honour
`degraded` stopped although every read completed.
- bridgeSearchPatterns now reports read failures in-band (`error`):
a throwing controller, a non-array controller result, and a failing
reasoning_patterns substring scan. These used to become [] or null.
- The handler returns {results: [], noMatch: true, degraded: false,
controller: 'reasoningBank', searched: [...]} only when ReasoningBank ran
without error AND the legacy semantic, list and hydrate reads all
succeeded with nothing found. scanLimited is set when the namespace
holds more than the 200 entries the substring scan reads.
- A ReasoningBank error stays degraded with reason reasoningBank-error:<msg>.
Legacy list/hydrate failures are now surfaced as listError.
- Legacy hits after an empty ReasoningBank keep the existing labelling;
ReasoningBank hits are returned unchanged.
Co-Authored-By: RuFlo <ruv@ruv.net>
The default/full/enterprise AGENTS.md templates told agents to call
`task_orchestrate` and `benchmark_run`, neither of which is a registered
MCP tool. Replace them with registered tools whose schemas match the
examples: `task_create` (assign/track work), `coordination_orchestrate`
(task coordination), `performance_benchmark` (benchmarks).
Add a CLI test that renders every AGENTS.md and CLAUDE.md template,
extracts every backticked snake_case tool-like name (bare or call form,
hyphens allowed), and checks each against listMCPTools().
Co-Authored-By: RuFlo <ruv@ruv.net>
agent_spawn's input schema limited `model` to five aliases, so a client
that validates against the schema could not pass an exact model id such
as claude-opus-5-5 or openrouter/anthropic/claude-sonnet-5.5, although
the handler already passes non-alias strings through as modelId (#2962).
The enum is now a bounded string (1-256 chars) with an anchored pattern:
letters, digits and . _ : / @ + -, starting with a letter or digit. The
handler applies the same check to `model` and to `config.model` (the
`agent spawn -m` path, which the schema never sees), so whitespace and
shell metacharacters are refused before the agent is stored. Aliases
route as before; exact ids are reported back as modelId.
Co-Authored-By: RuFlo <ruv@ruv.net>
aidefence_learn treated any wasAccurate=false with no threat detected as a
false negative and recorded it as a missed prompt_injection, so marking a PII
detection as inaccurate taught the registry a fake injection. When the scan
found PII and the feedback is PII-related (no threatType, or one naming PII),
nothing is recorded now and the response says why. wasAccurate is documented
as covering threat detection only.
Adds retractKnownMiss(input, threatType, cwd), which removes exactly the
matching hash+type entry through the module's atomic write and leaves the
store untouched when nothing matches, exposed as retract=true on
aidefence_learn.
Co-Authored-By: RuFlo <ruv@ruv.net>
Schema and description metadata only; validation logic and limits are unchanged.
- aidefence_scan.input (#4886): maxLength 10000, description states the
bound is 10000 UTF-16 code units (validateText default) and that JSON
Schema maxLength counts code points.
- agentdb_hierarchical-store.value (#4892): minLength 1, maxLength 10000,
same UTF-16 note. The only input that reaches the "max 100KB" error is
the empty string (validateText refuses >10000 first), so that message
now states the effective 10000-character limit.
- hooks_post-task taskId/agent/parentAgentId (#4887): a pattern
equivalent to cli-core IDENTIFIER_RE, maxLength 128, `not: {enum}` for
the CLI's reserved names, and descriptions saying these are registered
native IDs, not host paths like /root/x. agent's pattern also accepts
'' because the handler treats an empty agent as omitted and the HTTP
transport enforces pattern/minLength at runtime.
Adds __tests__/tool-schema-limits.test.ts, which checks each schema with
ajv and with @claude-flow/mcp's runtime validateSchema against the real
validators and handlers.
Co-Authored-By: RuFlo <ruv@ruv.net>
memory_search_unified:
- searchTime is now elapsed time ("12.34ms"), not a Date.now() timestamp.
- Per-namespace failures (thrown errors and success:false results such as
"Database not found") are returned as namespaceErrors with
namespacesSearched / namespacesFailed counts. success stays true for
partial coverage and is false only when every namespace failed.
- Namespaces are searched concurrently, at most 4 at a time, through a small
in-handler pool. Each search is a read of the same store with no shared
mutable state. Results are slotted by namespace position and flattened in
namespace order before the existing stable sort, so ranking and ordering
match the sequential loop.
Co-Authored-By: RuFlo <ruv@ruv.net>
LocalReasoningBank.flushToDisk() caught write errors such as ENOSPC, logged
them and left the bank dirty, but returned void, so recordTrajectory() still
returned true for patterns that only existed in memory.
- flushToDisk() now returns a boolean: true when persisted or nothing to
write, false when the write failed (state stays dirty). It still never
throws, so the debounce timer path is unchanged. The lock/merge/temp-file
+ rename algorithm is untouched.
- The last flush error and attempt time are recorded and exposed read-only
through getFlushState() and getPersistenceStatus() (dirty, lastFlushError,
lastFlushAt). A successful flush clears the error.
- recordTrajectory() and flushPatterns() return the flush result.
Co-Authored-By: RuFlo <ruv@ruv.net>
writeFileAtomic called writeSync once and ignored the returned byte count,
then fsynced and renamed the temp file over the target. A short write
(allowed by POSIX) published a truncated file and returned success.
Loop on writeSync's return value, advancing the buffer offset and file
position until every byte is written; throw if a call makes no progress.
The fsync, close, rename, chmod, directory fsync and cleanup-on-error
sequence is unchanged.
Fixes#4888
Co-Authored-By: RuFlo <ruv@ruv.net>
@claude-flow/cli@3.74.0 shipped 3.63.4 .claude/helpers. The committed
package stamp (.helpers-version) reads 3.57.1, so hook-spawned daemons
running an older checkout's CLI (3.63.4) saw the worktree's helpers as
stale and rewrote them between prepare and npm publish. verify-helpers
passed because it signs and checks whatever is on disk.
prepare-publish now diffs .claude/helpers against HEAD before signing
and again after verifying, and throws if any helper content changed
(the regenerated manifest and stamp are excluded). Tested: a dirtied
helper is refused, and a live daemon overwrite during a clean run was
caught.
Co-Authored-By: RuFlo <ruv@ruv.net>
CI's root npm install hoists @metaharness/darwin to the repo root, so the
package-local node_modules path did not exist and beforeAll failed.
Co-Authored-By: RuFlo <ruv@ruv.net>
- darwin moves to dependencies (ADR-526 amends ADR-150 rule 2 for darwin
only); the smoke gate, doctor check and clean-install test accept it.
- src/metaharness/darwin-lib.ts: cached import; metaharness_bench verify and
every metaharness_gepa op run in-process with the scripts' exact payloads
and exit codes, falling back to the scripts when darwin does not import.
- ruflo-metaharness 0.5.0: bench.mjs verify imports darwin directly (bare
import, no tool-time install) and falls back to the installed darwin CLI.
- Parity test vs the plugin scripts; benchmark script + measured runs.
- Version 3.74.0.
Co-Authored-By: RuFlo <ruv@ruv.net>
validateAgentSpawn() runs @claude-flow/security's SpawnAgentSchema and
skips the enum miss for custom agent types by matching
`invalid_enum_value`. That is zod 3's code; zod 4 reports
`invalid_value`, so with security on zod 4 every custom agent type was
rejected. agent_spawn and the hive-mind suites failed in CI (5 files).
It now accepts both codes.
cli-core resolves from the registry (non-bundled leaf), so this bumps it
to 3.7.6, which is already published, and moves the cli and claude-flow
pins and the root lockfile to it.
Co-Authored-By: claude-flow <ruv@ruv.net>
zod < 4.6.6 can exhaust memory while validating oversized constrained
collections (high severity). @claude-flow/security declared zod ^3.22.0,
so every consumer of it (memory, hooks, codex, federation and the cli
bundle) carried a vulnerable zod. A fresh `npm i @claude-flow/memory@3.2.4`
reports 3 high findings via @claude-flow/security -> zod 3.25.76.
API changes handled:
- z.setErrorMap(fn(issue, ctx)) -> z.config({ customError }), with
invalid_string/validation becoming invalid_format/format. Messages given
to a check still take precedence; undefined falls back to zod's default.
- z.string().ip({version}) -> z.ipv4() / z.union([z.ipv4(), z.ipv6()]),
keeping the messages.
- z.record(value) -> z.record(z.string(), value).
- SafeParseReturnType/ZodSchema -> ZodSafeParseResult/ZodType.
The workspace lockfile also drops zod 4.3.5 (vulnerable). Version 3.0.7,
and the cli and claude-flow pins move to 3.0.7. Publishing
@claude-flow/security only; the cli and claude-flow ride the release lane.
Tests: the existing 631 pass. input-validator-zod4.test.ts pins the
installed zod at >= 4.6.6, the IP schemas, message precedence, the global
map and the record schemas.
Co-Authored-By: claude-flow <ruv@ruv.net>
agentdb ^3.0.0-alpha.20 -> ^3.7.2 (filtered search and in-memory
isolation the backends rely on). Workspace lockfile now resolves agentdb
3.7.2 everywhere. memory@3.2.5 is published before merge, which
audit-leaf-versions-published requires.
Co-Authored-By: claude-flow <ruv@ruv.net>
The SQLiteBackend migration is in @claude-flow/memory, which the CLI
resolves from the registry, so the leaf-package publish audit (#3335)
requires a bump and a matching CLI pin. memory@3.2.4 is published right
after this merges. The federation pin moves to the 1.0.7 already on npm
(GHSA-vcv2 peer range, #4890).
Co-Authored-By: claude-flow <ruv@ruv.net>
Re-applies dskarasev's #1426 on current main.
SQLiteBackend: a memory.db created by the CLI's memory-initializer DDL has no
access_level, version or "references" column. CREATE TABLE IF NOT EXISTS left
that table alone, so every store() failed with "table memory_entries has no
column named access_level". initialize() now adds the missing columns (and
access_count / last_accessed_at for older DDLs) with createDefaultEntry()
defaults.
memory_store: accepts an optional `metadata` object and persists it on both
write paths (AgentDB bridge and sql.js fallback), which both hard-coded '{}'.
Arrays, null and scalars are rejected at the MCP boundary.
Tests: sqlite-backend-legacy-schema.test.ts (fails on main with the
no-such-column error) and memory-store-metadata-1426.test.ts (sql.js path,
bridge path, input check; 6 of 7 fail on main).
Co-Authored-By: dskarasev <dskarasev@users.noreply.github.com>
Co-Authored-By: claude-flow <ruv@ruv.net>
#4890 bumped the bundled federation leaf to 1.0.7 (published) but left the
CLI and root pins at 1.0.6. Move both pins (and the lock specifiers) so the
bundled copy and its declared version agree.
Co-Authored-By: RuFlo <ruv@ruv.net>
#4871 replaced the Next-steps list, which dropped the metaharness tip that
the ruflo-metaharness smoke (17k) asserts; the path-filtered metaharness
CI only ran on the release PR. One dim line under the snapshot.
Co-Authored-By: RuFlo <ruv@ruv.net>
On npm 10 / Node 20, agentic-flow -> fastmcp -> mcp-proxy pulls the
optional pipenet (engines node >=22). npm skips it, then deletes every
package reachable only through optional edges from that failure: all of
agentic-flow, ruvector, @ruvector/attention and @huggingface/transformers.
3.72.2 is affected the same way. Making agentic-flow a regular dependency
(rUv: agentic-flow stays) stops the cascade at pipenet; verified on a
fresh node:20 install of the packed 3.73.0 tarball: all present, 1.5 GB,
same tree as Node 22.
Co-Authored-By: RuFlo <ruv@ruv.net>
#4870 added the telemetry opt-in after capability enrollment, which left
the #4871 snapshot and paste-ready prompt above two questions. Move it
below them so it is the last thing init prints.
Co-authored-by: r <r@x>
* feat(funnel): count plugin-only users via the ruflo-core MCP launch
Plugin-only users never run init, so no SessionStart hook refreshes the
funnel cache and they are invisible in the usage numbers. The ruflo-core
launcher now sets RUFLO_LAUNCH_SURFACE=plugin; mcp start (stdio) makes the
existing 6h-cached /v1/messages fetch off the start path, gated on
resolveFunnelEnabled(), and the User-Agent gains ' surface/plugin' from a
closed allowlist. Nothing is written to stdout. LIA updated.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ruflo-core): keep RUFLO_MCP_SPAWN inside the env-precedence audit window
The four-line insertion pushed the existing RUFLO_MCP_SPAWN read past the
audit's 20-line function-signature heuristic. Collapse it to one line and
move the explanation to the header comment.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: r <r@x>
Replaces the five-command 'Next steps' list with a local, time-capped snapshot
(tracked files, top languages, most-changed code file over 90 days, test
command) and one ready-to-paste Claude Code prompt about that file. git runs
with argument arrays and a 2s timeout; any failure prints the generic prompt.
Skipped for --format json and --start-all/--start-daemon.
Co-authored-by: r <r@x>
Measures activation, not just installs (adoption plan item 3). All events
are recorded only with explicit telemetry consent (ADR-302/309), are
daily-bucketed, and carry no paths, prompts or code.
- init_completed: every successful `ruflo init` (main and wizard).
- first_agent_run: first agent spawn or swarm init on this machine, from
the CLI commands and the agent_spawn / swarm_init MCP tools. Once ever.
- session_active: at most once per UTC day, from the SessionStart
refresh-funnel, so 7-day retention can be computed server-side.
- Once-ever and once-per-day markers live in funnel-activation.json, because
a successful flush removes sent events from the queue.
- `ruflo init` asks once, in an interactive terminal only, never in CI or
when the funnel is disabled: "Share anonymous usage telemetry?" (default
No). Skippable with --no-telemetry-prompt. Separate from enrollment, which
must never toggle telemetry (ADR-302).
Server side: cognitum-one/ruflo-funnel-api#1 adds these names to the
allowlist; until it deploys, the server drops them individually.
Co-authored-by: r <r@x>
- @claude-flow/plugin-agent-federation 1.0.6: optional peer midstreamer
>=0.3.1 -> ^0.3.2. 0.3.1 ships no wasm or entry point, so it can't be
imported; 0.3.2 is the first importable release.
- @claude-flow/aidefence 3.1.1: optional peer agentdb >=2.0.0-alpha.1 ->
^3.6.0, matching the ecosystem's agentdb 3.6 convergence.
- @claude-flow/cli: pins @claude-flow/aidefence 3.1.1 and
@claude-flow/plugin-agent-federation 1.0.6, and agentdb ^3.6.0. Root
claude-flow pins federation 1.0.6. These ride the next cli release.
- @claude-flow/watermark: private. ruvnet/ai-text-watermark publishes
@claude-flow/watermark from 0.3.0 on (npm latest 0.4.1); this 0.2.0 copy
is stale and must never be published over it.
Both released tarballs are byte-identical to 3.1.0 / 1.0.5 apart from
package.json. v3/pnpm-lock.yaml regenerated with pnpm 8.15.0, root
package-lock.json with npm --package-lock-only.
Co-Authored-By: claude-flow <ruv@ruv.net>