Commit Graph
1900 Commits
Author SHA1 Message Date
kevin fbddf1260b fix(cli): report all matching tasks in task_list total, not just the limited page (#4324) 2026-10-20 09:23:54 -04:00
kevin 0b936e78a8 fix(cli): make status tasks list tasks instead of always printing "No tasks" (#4321) 2026-10-20 09:23:32 -04:00
Gss d7f2286835 fix(memory): build the RaBitQ index on demand and use it on the vector path (#4318)
* fix(memory): build the RaBitQ index on demand and use it on the vector path (#4203)

shouldRebuildRabitq() had no callers and the index was only ever populated by the explicit embeddings_rabitq_build tool, so searchRabitq() always returned null and the sql.js pre-filter was dead.

ensureRabitqIndex() drives the existing thresholds from the search entry points (60s throttle, 10-vector floor, 20% drift, disabled after a missing-WASM failure, bound to the source dbPath and dimensions).

The bridge cosine path now scans RaBitQ candidates and reranks them with the same exact cosine, falling back to the unchanged exhaustive scan on any error.

* test(memory): cover RaBitQ auto-build, exact rerank and top-k recall (#4203)

Six tests against a real sqlite store: build on demand, bridge uses the index and reranks with exact cosine, no rebuild per search, below-floor negative control, exhaustive-vs-indexed parity when the corpus fits the candidate window, and recall plus exact-rerank on a 60-row corpus larger than the window (>=80% top-5 recall).
2026-10-20 06:00:14 -04:00
Mathew BeaneandRuFlo 4c5fdb1fac feat(harness): report the live process, not the install (#3521)
* feat(harness): report the live process, not the install

`ruflo harness` reports what is already running for a working tree: the
host session, a live daemon pid, ruflo MCP servers whose cwd is inside the
tree, processes holding the memory databases open, and teams that are
still active. `doctor` and `status` stay as they are.

It is observe-only:
- bin/cli.js runs `harness` before the CLI class loads, so no daemon
  autostart, update check, policy migration, helper refresh or
  proven-config adoption runs, and nothing is written to disk. The CLI
  class also exempts it (OBSERVE_ONLY_COMMANDS) for programmatic callers.
- With --hook it fails silently: exit 0, no output, no stack, even when
  dist/ is missing.

Probing (src/services/live-harness.ts):
- MCP: a launcher plus a ruflo identity token plus `mcp [start]`; the
  process cwd must equal the root or sit under it on a path boundary.
  Shells whose argv mentions the text, other tools' `mcp start`, and
  sibling directories no longer count. npx wrappers count once.
- Output shows a count, pids and a redacted command (program and
  subcommand only); arguments never appear.
- Memory: .swarm/memory.db and .swarm/agentdb-memory.db, with WAL/SHM.
- Teams: `.claude-flow/teams/<name>/team.json` and the legacy flat file.
  A team is live only if not shut down and it has activity within a TTL
  (30 min, RUFLO_HARNESS_TEAM_TTL_SECS) or a running member pid; others
  are reported as stale.
- Daemon: EPERM counts as alive; a live pid that is not our daemon (pid
  reuse, another workspace) reads as stale.
- One ps and at most two batched lsof calls under a 4 s overall deadline;
  /proc is used for cwd on Linux. Missing ps/lsof (Windows, minimal
  Linux) reports `probe-unavailable` and `?` counts instead of idle.
- The root is compared in both spellings (/tmp and /private/tmp).
- Host detection walks up past `sh -c` and other wrappers.

The Codex SessionStart hook is opt-in: `ruflo harness --print-codex-hook`
prints a .codex/hooks.json that runs this install by absolute path with
RUFLO_DAEMON_AUTOSTART=0 and --no-update. No hooks file is committed to
the repo.

Tests: __tests__/harness-live-probe.test.ts and
__tests__/harness-observe-only.test.ts.

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

* feat(harness): list `harness` in the capability brain's command manifest (#3521)

The capability brain (capability-brain.ts) advertises the top-level CLI
commands from a checked manifest that landed on main after this PR was
opened. `harness` is a top-level command here, so it goes on the list and
the count in guidance-brain.test.ts moves from 53 to 54.

---------

Co-authored-by: RuFlo <ruv@ruv.net>
2026-10-20 05:42:13 -04:00
Mathew BeaneandRuFlo 953d8d0018 feat: Grok Build host surface + host-agnostic team bus (ADR-402) (#3512)
* feat: Grok Build host surface + host-agnostic team bus (ADR-402)

Adds `ruflo init --grok` and nine team_* MCP tools. Together they let a
lead agent on Grok Build (or Codex, or Claude) run a named agent team
without Claude's SendMessage. The team state lives in the project under
.claude-flow/teams/.

Team bus (team_create, team_spawn, team_send, team_broadcast,
team_inbox, team_plan, team_status, team_on_stop, team_shutdown)
- One implementation: templates/grok/scripts/grok-team-bus.mjs (ops,
  CLI) plus grok-team-store.mjs (storage). The MCP tools import these
  files, the SubagentStop hook imports them, and init --grok copies
  them into a project as a CLI with no dependencies. The repo root has
  no second copy.
- Mail is scoped per team: teams/<team>/mailbox/<agent>/. team_inbox
  requires the team, and team_status counts only that team's mail.
- team.json updates take a cross-process lock (team.lock, an O_EXCL
  file holding an owner token) and are written through a temp file and
  a rename. A stale lock is broken by renaming it aside and checking
  the token, never by a blind delete, and release removes only the
  holder's own token. 30 concurrent spawns
  from separate processes register all 30.
- team_shutdown closes the team. After it, spawn, send, plan and
  on-stop refuse. team_spawn enforces maxAgents.
- A broadcast with no members is refused. priority is an integer from
  0 to 999, stored as a zero-padded filename prefix. Symlinked mailbox
  directories are refused. Concurrent drains claim each message by
  rename, so no message is delivered twice and no drain throws ENOENT.
- The spawn description is <role>:<agent>@<team>. The SubagentStop
  hook parses it to advance that team's plan. When the hook cannot
  record a team subagent, or the team is ambiguous, it writes the
  reason to stderr and exits 1.

init --grok
- Writes .grok/ (config, rules, four agent profiles, a skill, the
  SubagentStop hook), scripts/ and docs/grok/README.md in the project,
  and lists every path it wrote. --dry-run writes nothing.
- Pins the project MCP server to the running release (ruflo@<version>,
  which ships team_*) instead of @latest. From a source checkout it
  points at that checkout's bin/cli.js. Inserted values are escaped as
  TOML strings, so Windows paths are valid.
- Writes nothing outside the project unless --grok-statusline is
  passed. With the flag, it installs ~/.grok/ruflo/host-statusline.mjs
  and merges [ui.status_line] into ~/.grok/config.toml using
  @iarna/toml. The merge leaves an existing status row alone in any
  TOML form. It writes only when the re-parsed result keeps every
  other value, and otherwise prints the snippet to paste. The command
  is `node "<absolute path>"`, which needs no shell and runs no
  script from the repo.
- The status row expects only the agent-teams-grok skill.

Also classifies team_* in the capability brain (swarm-coordination)
and adds ADR-402.

Tests: __tests__/team-tools.test.ts, __tests__/grok-init.test.ts.

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

* fix(grok-host): address round-2 review of ADR-402 team bus (#3512)

N1 (blocking): root package.json "files" listed cli/dist but not
cli/templates, so npm pack (and npx claude-flow) shipped a build that
team_create / init --grok couldn't find grok-team-bus.mjs /
grok-team-store.mjs from. Added v3/@claude-flow/cli/templates/** and
verified with a real npm pack + tar extract (files present with the fix,
absent without it).

N2: breakStaleLock renamed a stale lock without re-checking it was still
the lock it first observed. A waiter that read a stale token could have
that exact lock broken by someone else and re-acquired fresh in between,
and the rename would steal that live lock out from under its holder,
opening a window for a fourth party to grab the vacated slot — two
holders at once. Now re-verifies token + mtime immediately before
renaming and backs off (no rename at all) if either changed. Added a
direct regression test (monkeypatched fs to force the exact interleaving)
plus a concurrent-CLI-process test with a pre-seeded stale lock.

N3: LOCK_WAIT_MS (10s) was shorter than LOCK_STALE_MS (30s), so any
acquire attempted in the ~20s gap between "waiter gives up" and "lock
considered stale" failed even with nothing actually stuck — and the
SubagentStop hook's own 5s command timeout couldn't survive either value.
Lowered stale/wait to 4s/4.5s (wait >= stale, both comfortably under the
hook's 5s budget with real critical sections being sub-millisecond JSON
r-m-w). Also replaced the synchronous Atomics.wait lock-wait loop with an
async setTimeout-based poll (sleepMsAsync), so an MCP server keeps serving
other requests while a caller waits for the lock; threaded async/await
through withTeamLock/createTeam/spawnMember/runCli/main and the
SubagentStop hook and team-tools.ts's dispatcher. sleepMs (sync) stays
only for writeJsonAtomic's bounded Windows rename retry.

Minor 1: --grok-statusline replaced a symlinked ~/.grok/config.toml with
a plain file, destroying the symlink. writeFileAtomic now resolves an
existing symlink and writes through it instead.

Minor 2: a TOML integer above 2^53 in the user's config parses to a
BigInt (@iarna/toml) and crashed JSON.stringify inside the status-line
merge, which ran as the LAST step of init — leaving project files already
written. Now validated up front, before any file is touched, naming the
offending key; init fails clean with nothing written instead of half-done.

Minor 3: host-statusline.mjs matched `trusted = true` / `[mcp_servers.x]`
via substring/regex, so a commented-out trusted=true read as trusted and
an `enabled = false` server still counted as loaded. Can't add a runtime
dependency on @iarna/toml here (this script ships as a zero-dependency
copy outside any node_modules tree — project scripts/ and
~/.grok/ruflo/host-statusline.mjs). Added a small comment-aware
table/key parser instead and used it for grok, and for codex's
mcp_servers check too (same bug class).

Minor 4: team_create --force reopened a team but left the old
incarnation's mailboxes on disk. Now clears mailbox/ when recreating.

Minor 5: priority accepted "1e2" and "0x10" (Number() coerces both).
Now requires a plain base-10 integer literal string.

Minor (stray changes): reverted an incidental .helpers-version bump and
a router.js mode change (644->755) picked up from a concurrent session's
helper auto-refresh — not part of this PR.

Verified: cli build + tsc --noEmit clean; grok-init.test.ts and
team-tools.test.ts (41 tests, including 8 new ones) and
guidance-brain.test.ts pass; full `npm test` for @claude-flow/cli is
green except 20 pre-existing failures across 16 files, all from
@claude-flow/memory / @claude-flow/mcp / @claude-flow/codex not being
built in this environment (none touch grok/team/statusline code).

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

* fix(grok-host): address round-3 review nits on the team lock and status line (#3512)

A lock whose holder pid is still alive is no longer broken after 4s, so a stalled writer does not lose an update. An existing [ui.status_line] no longer fails init when another value is a BigInt. Quoted trusted-folder keys may contain ].

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

* fix(grok-host): keep the TOML parser out of the MCP tool import path (#3512)

grokTemplatesRoot moves to init/grok-templates.ts, which has no
dependencies. The team_* tools import it from there, so loading the MCP
tool table no longer pulls in grok-generator and @iarna/toml. On current
main, analyze-json-output.test.ts runs the analyze command from a copied
source tree with only cli-core and security beside it, and failed 20 of
20 with "Cannot find package '@iarna/toml'" before this change.
grok-generator re-exports grokTemplatesRoot, so its callers are unchanged.

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

---------

Co-authored-by: RuFlo <ruv@ruv.net>
2026-10-20 05:42:06 -04:00
Mathew BeaneandRuFlo f67d3b201f feat(memory,ollama): tag filter for memory list, export v1.1, local Ollama default model (#3526) (#3526)
Rebased onto main 3.56.9.

- memory_list / `memory list --tags`: exact AND tag filter via json_each,
  ANDed with namespace and provenance on the sql.js and bridge paths;
  coexists with ADR-472 embeddings and #4056 includeExpired.
- memory_export v1.1 carries tags; memory_import restores them and reports
  withTags alongside main's vectors/failed accounting.
- Ollama: tier aliases and claude-* ids resolve to OLLAMA_DEFAULT_MODEL or
  the persisted `providers configure` model; only the real ollama.com
  endpoint falls back to gpt-oss:120b-cloud, a local endpoint without a
  default fails loudly instead of egressing to Ollama Cloud.

Provider precedence is dropped from this change: main's #3493 (explicit
provider fails closed) supersedes the earlier narrowing.

Co-authored-by: RuFlo <ruv@ruv.net>
2026-10-20 05:36:37 -04:00
rUvandr e0a972ce82 fix(cli): only the first "--" ends option parsing, not every occurrence (#4310) (#4314)
CommandParser.parse() flipped parsingFlags on every literal "--" token,
not just the first. A later "--" supplied as an operand (e.g. a search
query of exactly "--", or any positional that happens to be "--") was
silently swallowed instead of being treated as a positional.

parse(['--', '--', 'needle']).positional was ['needle']; now ['--', 'needle'],
matching Node's util.parseArgs and the issue's reproduction.

Co-authored-by: r <r@x>
2026-10-20 03:26:56 -04:00
rUvandClaude df2dd4bfd6 dream(security): #4312 hooks_codemod path-containment bypass (CWE-22) (evaluated, ACCEPT) (#4313)
* dream(security): hooks_codemod path-containment bypass (CWE-22)

resolveTargets()'s containment check (hooks-tools.ts) used an unanchored
abs.startsWith(cwd) string-prefix comparison. An absolute path.resolve()
result is returned unchanged for an already-absolute input, so a sibling
directory whose name merely starts with the project directory's name
(e.g. cwd=/home/user/ruflo, target=/home/user/ruflo-staging/notes.ts)
passed containment and let this live, CLAUDE.md-recommended Tier-1 MCP
tool read+write outside the project root.

Anchors both call sites (file/files[] and glob-match branches) at a
path-separator boundary, matching the already-correct pattern used in
@claude-flow/security's isWithinPrefix(), @claude-flow/hooks/workers,
and @claude-flow/plugins/security elsewhere in this codebase.

4 new tests (2 discriminating, real temp-dir fs I/O; 2 non-discriminating
controls). Stash-isolated: both escape tests fail on baseline (file
genuinely written outside root), 4/4 pass on candidate. Related suites
(mcp-tools-deep, validate-input-*, codemod-engine/routing/corpus):
229/229 unchanged. tsc --noEmit byte-identical (9 pre-existing
environmental errors, unbuilt sibling packages).

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

* dream(security): disclose symlink containment gap (follow-up)

Independent adversarial critique of 71a6c07d found a real, reachable,
distinct bypass of the same containment check: a symlink inside the
project root pointing outside it still escapes containment, since the
check compares the resolved-but-not-realpath'd path (CWE-59, broader
than the CWE-22 unanchored-prefix bug the prior commit fixed). Not
fixed here (separate hardening effort, would need fs.realpathSync-based
containment) — disclosed in-source per this repo's established
non-blocking-caveat convention.

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

* docs(dream-cycle): research gist for 2026-10-20

SOTA report for tonight's performance DEEP / security+hive-mind SCAN
cycle. Documents the implemented hooks_codemod path-containment fix,
deferred performance candidates (CacheManager.estimateSize redundant
stringify; AttentionCoordinator embedding-cache miss), the hive-mind
topology role/connection-wiring bug, and graded 2026 external research
+ competitor comparison.

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

* docs(dream-cycle): ledger row for 2026-10-20 (#4312/#4313)

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-20 03:17:25 -04:00
stanleyandRuFlo cf8b6928ef feat(mcp): make HTTP and session rate limits configurable (#3694)
* feat(mcp): make HTTP and session rate limits configurable

The per-session token bucket (50, refill 5/s), the server-wide bucket
(100/s, burst 200) and the HTTP per-IP limit (120 per 60s) were
hardcoded, and HttpTransportConfig.rateLimit was unreachable because
MCPServerConfig had no field for it.

Add rateLimit and sessionRateLimit to MCPServerConfig and pass them to
the transport and rate limiter. Expose them on `mcp start` as
--rate-limit-per-ip, --rate-limit-window-ms, --rate-limit-per-session,
--rate-limit-global-rps and --rate-limit-global-burst (env
RUFLO_MCP_RATE_LIMIT_*), with bounded integer validation. A session
burst is still capped by the server-wide burst, so raising the session
limit above it needs --rate-limit-global-burst too. Defaults are
unchanged.

The HTTP 429 body now carries the JSON-RPC id of the rejected request
instead of null.

The CLI leaves the limits unset unless a flag or env value is given, so
the @claude-flow/mcp defaults stay the single source.

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

* fix(mcp): drop the request id from the HTTP 429 body

main now parses the JSON body after the rate limiter and auth gate, so
req.body is never set when the limiter rejects and the id echo always
fell back to null. Restore the static 429 message rather than parse
bodies for clients that are being throttled.

Also stub resolveMcpHttpAuthToken in the mcp start test mock, which
`mcp start` now calls.

* fix(mcp): refuse raised rate limits on a non-loopback host without a token

* refactor(mcp): keep raisedRateLimits module-private

---------

Co-authored-by: RuFlo <ruv@ruv.net>
2026-10-19 23:05:20 -04:00
6afffb777c fix(embeddings): writable model cache dir + retryable degraded state (#3692) (#3831)
A system-prefix global install's default ONNX model cache lives under its
own package directory, which is root-owned — an ordinary runtime user hits
EACCES the first time any of three independent call sites load the local
transformers.js pipeline. The resulting failure also got memoized as
permanent mock-embedding state for a worker's entire process lifetime, so
fixing cache permissions mid-run never helped an already-running worker.

- Resolve a writable cache dir (TRANSFORMERS_CACHE/HF_HOME, else
  ~/.cache/ruflo/models) and set it before pipeline() init at all three
  call sites: transformers-loader.ts, memory-initializer.ts, task-embedder.ts.
- Distinguish a permanently-missing backend from a retryable environmental
  failure (EACCES, ENOSPC, transient network) in memory-initializer.ts and
  task-embedder.ts, so a retryable degraded state re-attempts real
  initialization after a bounded interval instead of requiring a restart.
- Keep ADR-390's truthful backend:'onnx'|'mock' reporting unchanged.

See ADR-454 for the full decision record.

Co-authored-by: Nicholas Ruest <nicholasruest@Nicholass-MacBook-Pro.local>
Co-authored-by: RuFlo <ruv@ruv.net>
2026-10-19 22:56:02 -04:00
rUvandClaude e86134e45b feat(memory): add read-only memory peek command (#3508) (#3620)
Reports which memory.db/agentdb-memory.db files this cwd resolves to,
their active row counts, last write, and why the route was chosen —
without calling ensureInitialized(), the MCP tool layer, or writing
anything. Addresses the gap left after #3463/#3448: memory_stats and
friends still initialize the default store when called with no path,
answer for one file per call, and never report both stores or the
sharedKeys intersection (so a naive consumer double-counts mirrored
rows).

- src/memory/memory-peek.ts: new, self-contained read-only probe.
  sql.js store is read as a one-shot in-memory byte buffer (never
  written back); the native agentdb-memory.db sibling is opened
  readonly/fileMustExist, same as sibling-store.ts. Neither file is
  ever opened unless existsSync() first confirms it exists.
- src/commands/memory.ts: wires `memory peek [--path] [--format json]`
  into the existing subcommand list/help text.
- __tests__/memory-peek-3508.test.ts: asserts a fresh project ends up
  with zero files after a peek, plus correctness coverage for row
  counts (excluding soft-deleted rows), last-write timestamps, the
  sharedKeys intersection (not sum), route-source labeling, and the
  encrypted-at-rest case.

Scoped to the CLI subcommand only; the MCP `memory_peek` tool and
doctor integration from the issue's "smallest API" are left for a
follow-up to keep this change minimal.


Claude-Session: https://claude.ai/code/session_019gH7pnqfexcs77Ca1UCqHr

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-19 21:49:41 -04:00
rUvandClaude 2f86f32402 fix(claims): make expiresAt settable, dedupe maxClaims, fix misleading tool descriptions (#3180) (#3927)
* fix(claims): make expiresAt settable, dedupe maxClaims, fix misleading tool descriptions (#3180)

claims-tools.ts had three independently-confirmed issues from #3180:

- IssueClaim.expiresAt was declared but no handler could ever set it.
  claims_claim now accepts an optional ttlMs and computes expiresAt from
  it; omitting ttlMs keeps today's behavior unchanged (expiresAt stays
  undefined). This is informational/additive only — no handler enforces
  expiry yet (claims_steal still requires claims_mark-stealable), since
  wiring real expiry-based enforcement changes who is allowed to act on
  an existing claim and needs a maintainer decision, not an unattended
  fix.
- maxClaims=5 was duplicated as a bare literal in claims_load and
  claims_rebalance; both now reference one DEFAULT_MAX_CLAIMS constant.
- Every tool description ended with a boilerplate sentence telling
  callers to "Pair claims_grant + claims_check" — neither tool exists
  anywhere in the codebase. Removed the dangling reference from all 12
  tool descriptions.

Not addressed here (left for a maintainer per the issue's own flag):
self-reported ownership checks on claims_status/claims_release/
claims_handoff, and claims_steal requiring mark-stealable rather than
checking expiry — both change who can act on another party's claim,
which is the trust boundary this project's own guidance calls out
("a lease or work claim coordinates ownership; it never grants
authority"). The release-deletes-the-record behavior is also left
alone: keeping a released record would require claims_claim to treat
a released issue as claimable again, which is more than a mechanical
change.

Opened by the nightly triage routine — human review required before merge.

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

* fix(claims): satisfy ADR-112 tool-description audit after removing false claims_grant/claims_check reference

The previous commit shortened all 12 claims_* tool descriptions to drop
the dangling claims_grant/claims_check reference, which tripped the
ADR-112 discoverability audit (scripts/audit-tool-descriptions.mjs,
exercised by plugins/ruflo-business-pods/scripts/smoke.sh step 5): every
MCPTool description must carry "Use when ..." disambiguation guidance
and be at least 80 characters. Restores that guidance with accurate,
tool-specific text (no reference to the nonexistent tools) instead of
the removed boilerplate.

Verified: `node scripts/audit-tool-descriptions.mjs` now reports 0
no-guidance / 0 too-short / 0 duplicates (was 12/12/0 after the prior
commit). claims-tools-expiry-maxclaims.test.ts and
claims-store-compatibility.test.ts still pass (18/18).

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-19 21:46:01 -04:00
kevin 0dfaafe887 fix(agent): make agent list --all and --type filter as documented (#4302) 2026-10-19 21:43:31 -04:00
kevin 44ac186762 fix(agent): persist the name given to agent spawn (#4300) (#4301) 2026-10-19 21:43:28 -04:00
rUv 96670e2991 Merge pull request #4193 from 555aaditya/fix/3548-attention-hyperbolic-mode
fix(hooks): reject unimplemented hooks_intelligence_attention modes
2026-10-19 18:00:52 -04:00
rUv 5a71aa62e8 Merge pull request #4220 from xiajiahang/fix/4198-refresh-session-companions
fix(init): refresh session companions during upgrade
2026-10-19 17:24:56 -04:00
rUv 98a063ce41 Merge pull request #4268 from rudycelekli/fix/workflow-cli-tool-shape
fix(workflow): list, status, stop and run read the shape and errors the workflow tools return
2026-10-19 17:22:35 -04:00
rUv 2b15ef2715 Merge pull request #4191 from 555aaditya/fix/3113-3114-reasoningbank-embedder
fix(memory): use the ReasoningBank embedder instead of the hash fallback
2026-10-19 17:21:52 -04:00
rUv 136a653f02 Merge pull request #4207 from rudycelekli/fix/memory-export-failure-20261014
fix(memory): memory export reports the tool error instead of crashing (#4204)
2026-10-19 17:07:07 -04:00
rUv f86bbeb746 Merge pull request #4297 from ruvnet/worktree-agent-a2c0bfad890aec988
fix(memory): fail closed on native backup failure instead of a raw-copy false-success (#4287)
2026-10-19 17:04:26 -04:00
rUv 0bec340c54 Merge pull request #4298 from ruvnet/fix/4291-graph-query-db-path
fix(memory): resolve graph reads through explicit CLAUDE_FLOW_DB_PATH binding (#4291)
2026-10-19 17:02:21 -04:00
rUv 5e2ffd58f9 Merge pull request #4192 from 555aaditya/fix/2271-smart-search-identity
fix(memory): stop SmartRetrieval collapsing search results to one
2026-10-19 16:53:42 -04:00
randRuFlo 14f659089f fix(memory): resolve graph reads through explicit CLAUDE_FLOW_DB_PATH binding (#4291)
getBridgeDb() and isBridgeDbEncryptedAtRest() in graph-edge-writer.ts
resolved the memory.db path as `customDbPath ?? path.join(getMemoryRoot(),
'memory.db')`, bypassing resolveDbPath() (memory-initializer.ts) — the
function that actually implements the documented path-priority rule
(explicit CLAUDE_FLOW_DB_PATH wins over the plain default). A caller that
explicitly selected a store via that env var silently got graph-query
results read from a different, unselected memory.db instead — a
source-bound read leaking data from a store it never chose.

Both functions now resolve the file through resolveDbPath(customDbPath),
so a custom argument, then CLAUDE_FLOW_DB_PATH, then the memory-root
default are tried in that order, and encryption sniffing (isRfe1EncryptedAtRest)
and the native open always agree on the same resolved file. A missing or
encrypted-at-rest explicit source still refuses (returns null) rather than
falling back to any other store — unchanged behavior, just now applied to
the correct path.

Adds __tests__/graph-query-explicit-db-path-4291.test.ts, reproducing the
issue's exact synthetic fixture (two sqlite stores under a fixture .swarm
dir, CLAUDE_FLOW_MEMORY_PATH + CLAUDE_FLOW_DB_PATH env bindings, a k-hop
agentdb_graph-query call) plus: unchanged default behavior with no env
binding, refusal when the explicit path is missing, and refusal when the
explicit source is encrypted at rest. Does not touch the independent
agentdb-memory.db controller default (#3155/#3156) or the ControllerRegistry
identity fix (#3143).

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-10-19 15:00:25 -04:00
randRuFlo 6959d0135e fix(memory): fail closed on native backup failure instead of a raw-copy false-success (#4287)
backupMemoryDb() fell back to a plain file copy after ANY native
online-backup exception, not just the encrypted-RFE1 case it exists for.
That meant an ordinary SQLITE_BUSY, disk error, or any other native-backup
failure on a perfectly normal (unencrypted) SQLite source was silently
reported as backedUp: true via a raw copy, with no check that the source
was actually encrypted and no check for an active WAL (a plain copy of a
live WAL-mode DB can be a torn/inconsistent snapshot).

Fix: positively verify the source is RFE1-encrypted (existingFileIsEncrypted,
4-byte magic sniff) before ever taking the raw-copy fallback; refuse it for
any other native-backup failure. Even for a confirmed-encrypted source,
refuse the fallback if a non-empty `-wal` sidecar is present. Add a
`method: 'native-online-backup' | 'raw-copy-fallback'` field to the backup
receipt so downstream migration tooling can require a real native snapshot
instead of trusting a blanket backedUp: true; thread it through
backupProjectMemoryDbs (only set when every successful store agrees) and
the nightly backup worker's metrics receipt.

Added a BackupOptions.Database test seam for fault-injection tests (a fake
native Database whose backup() throws) without needing a real SQLite file.

Tests (__tests__/memory-backup-fail-closed.test.ts), all written and
confirmed failing against the old code first:
- repro: SQLITE_BUSY on an ordinary source must not report backedUp via
  raw copy
- confirmed-encrypted RFE1 source, native backup unavailable/failing, no
  active WAL: raw-copy fallback succeeds
- confirmed-encrypted RFE1 source WITH an active WAL: refuses the fallback
- successful native online-backup is marked method: native-online-backup

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-10-19 14:59:30 -04:00
rUv 2b847fbf52 Merge branch 'main' into fix/memory-export-failure-20261014 2026-10-19 19:55:47 +01:00
rUv 7d3031d6e6 Merge branch 'main' into fix/worker-dispatch-status-20261014 2026-10-19 19:55:45 +01:00
rUv 361c86a7fd Merge branch 'main' into fix/workflow-cli-tool-shape 2026-10-19 19:55:43 +01:00
rUv 4d788e8857 Merge branch 'main' into fix/4198-refresh-session-companions 2026-10-19 19:55:36 +01:00
rUv 1064014273 Merge pull request #4209 from rudycelekli/fix/memory-migrate-honest-20261014
fix(memory): memory_migrate reports what it migrated; force clears the marker that is checked (#4194)
2026-10-19 19:51:35 +01:00
rUv 8c6aeb6650 Merge pull request #4267 from rudycelekli/fix/memory-import-tool-failure
fix(memory): memory import reports the tool error and partial failures instead of crashing
2026-10-19 19:51:24 +01:00
rUv 251e163edc Merge pull request #4273 from proffesor-for-testing/fix/policy-tmp-reap-3164
fix(policy): remove orphaned atomic-write temp files under the policy lock (#3164)
2026-10-19 19:51:10 +01:00
rUv 227a9176c4 Merge branch 'main' into fix/3113-3114-reasoningbank-embedder 2026-10-19 19:49:28 +01:00
rUv f3b398826b Merge branch 'main' into fix/2271-smart-search-identity 2026-10-19 19:49:25 +01:00
rUv ad97681b5b Merge branch 'main' into fix/3548-attention-hyperbolic-mode 2026-10-19 19:49:23 +01:00
kevin9327 ed98c2341e fix(intelligence): write learned patterns before a one-shot command exits (#4283)
recordTrajectory() saved stats.json synchronously but left the
ReasoningBank save to its 100 ms debounce timer. The one-shot bins call
process.exit(0) as soon as the command resolves, so the timer never
fired: patternsLearned went up while patterns.json was never written.
Flush the bank next to savePersistedStats() so the counter is never
persisted for a pattern that wasn't.
2026-10-19 09:14:27 +09:00
Dragan SpiridonovandRuflo & AQE 547ae87d47 fix(policy): keep temps of live writers and raise the orphan age floor to 10 min
Review found the state.lock invariant has a gap with mixed versions: released
versions before the dead-owner fix take over any lock older than 30 s, even a
live owner's, so a writer suspended mid-write (e.g. a sleeping laptop) could
have its temp removed by a newer holder. Keep a temp while its writer pid is
alive on this host, and until it is 10 minutes old.

Tests: live-writer temps and 5-minute-old temps are kept, verify removes
orphans on its own, and the directory case is named for what it checks.

Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_011Qe66m38aobVEJGHAbFVzv
2026-10-18 09:55:03 +02:00
Dragan SpiridonovandRuflo & AQE 42011db977 fix(policy): remove orphaned atomic-write temp files under the policy lock (#3164)
A writer killed between creating <file>.<pid>.<uuid>.tmp and renaming it
(SIGKILL from a caller's timeout, OOM) never reaches writeJsonAtomic's
cleanup, so a full-size copy of state.json or ledger-anchors.json stays in
the policy directory forever. On a mature ledger each copy is ~250 MB; one
host had 13 of them (1.9 GB).

Every writer of state.json, ledger-anchors.json, state.anchor.json and
ledger-anchor-head.json holds the project's state.lock, so a transaction
or verify that holds the lock removes temp files of exactly those names.
Only regular files that match <name>.<pid>.<uuid>.tmp and are at least 60 s
old are removed; symlinks, directories, fresh temps and other files' temps
are left alone, and a failure never fails the caller.

Co-Authored-By: Ruflo & AQE
Claude-Session: https://claude.ai/code/session_011Qe66m38aobVEJGHAbFVzv
2026-10-18 09:48:36 +02:00
Rudy CelekliandClaude Sonnet 5.5 28a9fefaa3 fix(workflow): list, status, stop and run read the shape and errors the workflow tools return
The workflow MCP tools return { error } instead of throwing and a different
result shape than the CLI read. Against the real tools: 'workflow list'
always printed no workflows (the CLI sends status 'all', which the tool
treated as a literal filter), 'workflow status' crashed on a missing metrics
block, and 'workflow stop' printed "stopped" for a missing or finished
workflow. Read the fields the tools return and report tool errors.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
2026-10-18 01:03:28 -04:00
Rudy CelekliandClaude Sonnet 5.5 94fd5734ba fix(memory): memory import reports the tool error and partial failures instead of crashing
memory_import returns { error } for a missing or invalid file and
{ success: false, error, imported } when some writes fail. The CLI read
result.imported unconditionally, so a bad file printed "Imported from
undefined" and then died on a TypeError, and a partial import was reported
as a success. Check the result before printing, mirroring memory export.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
2026-10-18 00:55:26 -04:00
Dragan Spiridonov f18ff4c427 fix(policy): authenticate retained ledgers and stream full audits with fenced writers (#4216)
* fix(policy): preserve authenticated ledger receipts across crash recovery

* Register operator policy ledger limits in environment precedence audit

* test(policy): assert bounded retention work instead of shared-runner latency
2026-10-17 23:10:58 +01:00
961ab6c879 fix(cli): honor the no-update startup opt-out (#4251)
Co-authored-by: shuaiyafei <16618929+shuaiyafei@users.noreply.github.com>
Co-authored-by: r <r@x>
Co-authored-by: RuFlo <ruv@ruv.net>
2026-10-17 17:54:13 +01:00
他们都不玩了andshuaiyafei 64d00f4ab2 fix(cli): honor no-color before rendering help and version (#4248)
Co-authored-by: shuaiyafei <16618929+shuaiyafei@users.noreply.github.com>
2026-10-17 16:35:41 +01:00
kevin e733bda318 fix(daemon): report the running daemon's TTL in daemon status (#4238) (#4241)
daemon status printed config.ttlMs of the default-config WorkerDaemon it
builds in the status process, so a background daemon started with
--ttl 0 showed 'TTL: 12h (self-shutdown)'. Read ttlMs from
daemon-state.json when the background daemon is running, as is already
done for aiWorkersEnabled and for daemon status --all.
2026-10-17 16:35:34 +01:00
bbansandbbans ca31fc52be feat(doctor): add versioned JSON health check output (#4228)
Co-authored-by: bbans <252185257+bryanbans@users.noreply.github.com>
2026-10-17 16:35:30 +01:00
xjh bd92ac5b4c fix(intelligence): forward trajectories using the ruvllm contract (#4222)
Map outcomes and steps to the fields consumed by ruvllm pattern extraction. Add coverage for success, failure, and partial trajectories.

Refs #4199 (part A).
2026-10-17 16:35:22 +01:00
xjh f04ce8df1c fix(init): stop granting blanket execution of project helpers (#4221)
Remove the broad project helper Bash permission from generated settings while preserving hook configuration and existing user permissions.

Fixes #4205
2026-10-17 16:35:17 +01:00
rUvandr 37dd507c7a fix: bump @metaharness/darwin pin from ~0.10.2 to ~0.12.0 (#3219) (#4252)
* fix: bump @metaharness/darwin pin from ~0.10.2 to ~0.12.0 (#3219)

npm published 0.11.0 and 0.12.0 after the last pin bump, leaving the
optionalDependencies range, MH_DARWIN_PIN, and the plugin helper's
DARWIN_PIN_VERSION all stale. scripts/check-metaharness-pins.mjs now
reports clean (was: STALE), and the metaharness-pin-drift CI gate,
which runs on every PR touching these files, was failing repo-wide
as a result.

Verified: check-metaharness-pins.mjs exits 0; plugin test-pin-alignment.mjs
(12/12) and test-no-tool-time-npx.mjs (26/26) pass against the new pin.

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

* fix: update v3/pnpm-lock.yaml for the @metaharness/darwin ~0.12.0 bump

Minimal surgical patch (specifier/version + the resolution block's
version/integrity), not a full pnpm regen — a full `pnpm install
--no-frozen-lockfile` here also drags in unrelated transitive bumps
(ruvector 0.2.27->0.2.41, vite 7.3.0->8.3.4, etc.) that don't belong
in a pin-drift fix. Verified with `pnpm install --frozen-lockfile`.

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

---------

Co-authored-by: r <r@x>
2026-10-17 16:35:08 +01:00
Rudy Mizrahi Celekli f429ccac53 fix: serialize learning stats read-merge-write transactions (#4240) 2026-10-17 14:59:04 +01:00
Wu Shuwen d25f333421 fix(neural): report unchanged persisted quantization storage (#4224) 2026-10-17 14:58:50 +01:00
Wu Shuwen 422e61cf03 fix(init): omit unimplemented generated hooks (#4200) (#4213)
* fix(init): omit unimplemented generated hooks (#4200)

* test(init): match quoted hook commands

* test(init): reject quoted no-op hook commands
2026-10-17 14:58:40 +01:00