Commit Graph
1010 Commits
Author SHA1 Message Date
rUvandReuven cc114c8db4 fix(mcp): sharpen high-overlap tool descriptions for better selection (#1748 Issue 4) (v3.6.30) (#1756)
#1748 Issue 4 — across 4 experiments, the model invoked 0 of 237 Ruflo
MCP tools, even on a 230-call-site cross-file refactor. The diagnosis:
descriptions don't lead with 'Use when native X doesn't help because Y',
so the model's tool-selection heuristic always wins for native tools.

This PR sharpens descriptions for 7 of the highest-overlap tools — the
ones where the model HAS a native equivalent and the differentiation
needs to be crystal clear.

Memory family (5 tools — competes with Read/Write/Grep/Glob):
  - memory_store: 'Use when native Write is wrong because the data is
    not a file ... AND you need to recall it later by semantic query,
    not by path'
  - memory_retrieve: 'Use when native Read is wrong because the value
    is not a file (lives in .swarm/memory.db)'
  - memory_search: 'Use when native Grep is wrong because Grep matches
    characters and you need conceptually-related entries'
  - memory_delete: 'No native equivalent — Write to a file does not
    affect the .swarm/memory.db SQLite store'
  - memory_list: 'Use when native Glob is wrong because the entries
    are not files'

Hooks family (1 high-leverage tool):
  - hooks_route: '3-tier routing recommendation BEFORE spawning ...
    Native tools have no equivalent — Claude Code does not introspect
    its own model-selection cost'

Agent family (1 — competes with native Task):
  - agent_spawn: 'Use when native Task is wrong because you need
    cost tracking / cross-session learning / swarm coordination'

This is a representative subset, not the full 237. Pattern is now
established; subsequent PRs can extend per-family. The smoke test for
this approach: re-run the #1748 G3 cross-file rename — does the model
now invoke memory_search to find existing references, or still fall
through to Grep?

Published as 3.6.30 to npm:
  @claude-flow/cli@3.6.30 → tags: latest, alpha, v3alpha
  claude-flow@3.6.30      → tags: latest, alpha, v3alpha
  ruflo@3.6.30            → tags: latest, alpha, v3alpha

Status of #1748: Issue 1 ✅, Issue 2 ✅, Issue 3 ⏳, Issue 4 (this) — first
batch of descriptions sharpened; pattern established; further families
land incrementally.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-05 10:20:05 -04:00
rUvandReuven 7aa7fc93e5 fix(hive-mind): pass --mcp-config to spawned worker (#1748 Issue 2) (v3.6.29) (#1755)
The Liberation of Bajor team's eval (#1748) found that
\`ruflo hive-mind spawn --claude\` launches the spawned \`claude -p\`
worker WITHOUT \`--mcp-config\`, so the worker's MCP tool registry
is empty for \`mcp__ruflo__*\`. The coordination prompt then
references tools the worker doesn't know about and the worker
exits silently. Result: the framework reports swarm success but
zero phases complete.

Fix in v3/@claude-flow/cli/src/commands/hive-mind.ts:

- Add \`--mcp-config <path>\` flag to \`spawn\` subcommand
- Resolution order in spawnClaudeCodeInstance:
  1. explicit --mcp-config path passed by caller
  2. ./.mcp.json in cwd (project-local)
  3. ~/.claude.json (user-global)
  4. ~/.claude/mcp.json (alt user-global)
- If resolved: pass --mcp-config <path> to childSpawn('claude', ...)
- If not: warn explicitly so the failure mode is visible (not silent
  as before). The warning text references #1748 Issue 2 and tells the
  user how to fix (pass --mcp-config or run \`ruflo init\`).

This is the second-most load-bearing of #1748's four findings. Issue
1 (per-plugin hooks layout) shipped in PR #1754 / commit on main.

Build verified: \`tsc\` clean, fix present in dist/.

Published as 3.6.29 to npm:
  @claude-flow/cli@3.6.29 → tags: latest, alpha, v3alpha
  claude-flow@3.6.29      → tags: latest, alpha, v3alpha
  ruflo@3.6.29            → tags: latest, alpha, v3alpha

Issues 3 and 4 from #1748 will land in follow-up PRs:
  Issue 3 — package size / 30s MCP timeout race (footprint reduction
            + README pre-warm doc)
  Issue 4 — tool description sharpening + lite default surface

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-05 09:55:25 -04:00
rUvandReuven 229d273a1f fix(init): #1744 honest defaults + runtime fallbacks (v3.6.28) (#1753)
* fix(init): #1744 honest defaults — --no-global, --minimal hooks gate, README install paths (v3.6.28)

Three fixes from @ruvnet's install-study (issue #1744) plus three
already-on-disk runtime honesty fixes:

#1744 changes (this commit):

1. **--no-global flag** for `init` (and codex/dual variants) — opt out
   of the user-global ~/.claude/CLAUDE.md "Ruflo Integration" pointer
   block append. Default behavior unchanged (block still appended once,
   idempotent — but now opt-out is documented). #1744 #2.

2. **--minimal hooks gate** in settings-generator. Before this commit,
   `--minimal` wrote .claude/settings.json with 4 hook decls pointing at
   .claude/helpers/hook-handler.cjs but didn't install the helpers
   directory — so every hook fired and silently failed. Now the hooks
   block only emits when components.helpers is true. Minimal stays
   minimal AND functional. #1744 #3.

3. **README Quick Start labeling** — added a head-to-head table
   distinguishing Plugin install (lite, slash commands only, no MCP)
   from CLI install (full Ruflo loop, MCP registered, hooks installed).
   The previous README marketed both equally as "Recommended" which
   surprised users who chose plugin install and found the MCP tools
   missing. #1744 #1.

Already-on-disk runtime honesty fixes (bundled in this release):

4. v3/@claude-flow/cli/src/commands/performance.ts — drop unverified
   "Flash Attention 2.49x speedup" optimize/bottleneck recommendations.
   Re-tagged as "in progress, currently JS reference impl".

5. v3/@claude-flow/cli/src/mcp-tools/neural-tools.ts — drop the silent
   Tier 4 mock-fallback in embedding resolution. If Tier 1 (agentic-flow)
   and Tier 3 (ONNX) both failed to import, leave realEmbeddings null
   and let the explicit hash-fallback path run with a clear
   _embeddingNote in stats. Silently substituting mock embeddings hid a
   missing production dependency from callers.

6. v3/@claude-flow/embeddings/src/embedding-service.ts — throw on
   unknown provider / no-real-provider-available paths instead of
   silently substituting MockEmbeddingService. Mock embeddings are
   tests-only; production code that lands on the mock path
   accidentally is a bug, and silent fallback hid it.

All TypeScript clean (tsc --noEmit). Build verified — all 3 fixes
present in dist/.

Closes #1744 (3 of 5 papercuts; remaining 2 are doc-only, addressed
in PR #1751).

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

* chore(release): bump to 3.6.28 — published to npm

  @claude-flow/cli@3.6.28 → tags: latest, alpha, v3alpha
  claude-flow@3.6.28      → tags: latest, alpha, v3alpha
  ruflo@3.6.28            → tags: latest, alpha, v3alpha

Includes: #1744 (--no-global, --minimal hooks gate, README install
labeling) + runtime honesty fixes (drop unverified Flash Attention
claim, drop silent mock embedding fallback, throw on missing real
embedding provider).

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

* chore(release): regen verification witness for 3.6.28

  totalFixes: 27 → 55 (adds CAP-MCP capability inventory: 300 tools
                       across 28 source files)
  releases:   3.6.24 → 3.6.28 (current published)
  manifestHash + signature regenerated from current git commit

Includes the #1744 + runtime-honesty fixes shipped in 3.6.28.

Run `node scripts/regenerate-witness.mjs` after each release.

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

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-05 09:46:35 -04:00
ReuvenandRuFlo b5b6fb3fbe feat(ruflo-browser): v0.2.0 session-as-skill architecture + ADR-0001
Refactors ruflo-browser around recordable, replayable RVF cognitive
containers. Implements ADR-0001 (Proposed). Pre-Accept gate is a 10-site
replay-fidelity spike (≥80% pass) — harness shipped, run pending.

Plugin (plugins/ruflo-browser/):
- bump 0.1.0 → 0.2.0; new keywords (rvf, replay, trajectory, agentdb, aidefence)
- ADR-0001: session-as-skill architecture, 4 AgentDB namespaces, 3 AIDefence
  gates, 7 verb dispatcher, 5 new MCP lifecycle tools, 7+1 skill catalog,
  load-bearing replay-fidelity assumption flagged in Verification §4
- agent: rewritten with session contract, RVF allocation, ruvector
  trajectory-begin/step/end hooks, 4 namespaced AgentDB writes, 3
  mandatory AIDefence gates
- /ruflo-browser command: verb dispatcher (ls/show/replay/export/fork/purge/doctor)
- 7 new skills: browser-record (primitive), browser-replay, browser-extract,
  browser-login, browser-form-fill, browser-screenshot-diff, browser-auth-flow
- browser-test kept; rewritten to compose record+replay
- browser-scrape becomes a deprecation shim (removed in v0.3.0)
- scripts/smoke.sh: 13 structural checks; scripts/replay-spike.sh + SITES.txt:
  10-site interactive harness writing STATUS.md per run

CLI (v3/@claude-flow/cli/):
- src/mcp-tools/browser-session-tools.ts: 5 new lifecycle tools
  (browser_session_record / _end / _replay / browser_template_apply /
  browser_cookie_use). Each shells out to pinned ruvector@0.2.25 + the
  existing agent-browser CLI + bridged claude-flow memory; missing deps
  degrade with structured success:false rather than crash.
- src/mcp-client.ts: registers browserSessionTools alongside existing
  browserTools.
- TypeScript clean (npx tsc --noEmit reports zero errors against the
  new files).

Borrows from Browserbase skills/skill repo (verified 2026-05-04):
trace-as-firehose with per-page bisection (browser-trace/SKILL.md);
outer/inner self-improving loop (autobrowse/SKILL.md); sessions+contexts
as separately addressable artifacts (browser/REFERENCE.md + cookie-sync).
Adapted to use Ruflo's substrates (RVF, ruvector, AgentDB, AIDefence,
federation) rather than Browserbase's hosted backend.

Verification:
- bash plugins/ruflo-browser/scripts/smoke.sh → 13 passed, 0 failed.
- replay spike runnable via scripts/replay-spike.sh (network-dependent;
  not part of the smoke contract). ADR remains Proposed until ≥80% pass
  recorded under spike-results/<timestamp>/STATUS.md.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-04 16:47:37 -04:00
Reuven 9c1a71f009 feat(providers): add Ollama (Tier-2) — closes #1725 + workflow_execute fix
End users on Anthropic Max (which doesn't expose ANTHROPIC_API_KEY) +
Ollama Cloud were locked out of workflow_execute because both
agent-execute paths hardcoded Anthropic. The 4-provider tier-shim in
agentic-flow upstream is a separate fix; this commit closes the gap on
the claude-flow side so Ollama is a first-class Tier-2 option.

src/commands/providers.ts:
  - Added 'Ollama' to PROVIDER_CATALOG (LLM, OLLAMA_API_KEY env,
    'gpt-oss:120b-cloud, llama3:70b-cloud, qwen2.5-coder:32b-cloud').
  - Added 'ollama' to envMapping in resolveApiKey.
  - Added ollama endpoint to testProviderConnectivity (tags endpoint).
    `claude-flow providers configure -p ollama -k <key>` now accepts
    the value; `providers test -p ollama` round-trips the API key.

src/mcp-tools/agent-execute-core.ts:
  callAnthropicMessages now picks provider per:
    1. RUFLO_PROVIDER=ollama (explicit)         OR
    2. ANTHROPIC_API_KEY unset AND OLLAMA_API_KEY set (auto-fallback)
  When Ollama is selected, callOllamaCompat() runs:
    - POST <OLLAMA_BASE_URL or https://ollama.com>/v1/chat/completions
    - Bearer auth if apiKey is non-empty AND not the literal 'local'
      sentinel (sentinel skips header for self-hosted bind-no-auth)
    - OpenAI-compat request shape (messages array w/ system role)
    - Normalizes response back to AnthropicCallResult so callers see
      the same { success, model, output, usage, durationMs } regardless
      of provider.
  resolveOllamaModel maps logical names (haiku/sonnet/opus) to the
  cloud default 'gpt-oss:120b-cloud'; passes through 'ollama:<model>'
  prefix or bare provider-native names like 'llama3.2:1b'.

Validated end-to-end against ruvultra over tailscale:
  - Installed ollama 0.23.0 on ruvultra (Ubuntu 24.04)
  - Daemon bound to 0.0.0.0:11434
  - Pulled llama3.2:1b
  - From local Mac: callAnthropicMessages({ prompt, model:
    'ollama:llama3.2:1b', timeoutMs: 30000 }) with OLLAMA_BASE_URL=
    http://ruvultra:11434 / OLLAMA_API_KEY=local / RUFLO_PROVIDER=ollama
  - success: true, 611ms, 49 tokens, response normalized to
    AnthropicCallResult shape

Same code path supports Ollama Cloud (default endpoint) when users
set OLLAMA_API_KEY=<real-key>. workflow_execute, which dispatches
through executeAgentTask → callAnthropicMessages, picks up the new
routing automatically — no MCP wire-format change required.

Bump 3.6.26 → 3.6.27 across CLI + claude-flow + ruflo umbrellas.
2026-05-03 22:54:00 -04:00
Reuven ccf58ea4dd feat(doctor): ADR-096 Phase 5 — encryption-at-rest status section
Adds checkEncryptionAtRest() to ruflo doctor. Reports four facets
without ever logging the key bytes:

  1. Gate status — is CLAUDE_FLOW_ENCRYPT_AT_REST truthy?
  2. Key resolution — does CLAUDE_FLOW_ENCRYPTION_KEY decode to a
     valid 32-byte key (env-var path; keychain/passphrase deferred
     to Phase 5+).
  3. Key fingerprint — first 16 hex chars of sha256(key) so users
     can sanity-check across machines without leaking the key.
  4. Per-store breakdown — for each high-tier store
     (sessions/, terminals, memory.db) report whether on-disk bytes
     carry the RFE1 magic ("enc"), are plaintext ("plain"), missing
     ("∅"), or unreadable ("err").

Outputs:
  Off:  warn  — "Off — session/terminal/memory stores are plaintext
                (mode 0600 only)"
        fix:   "export CLAUDE_FLOW_ENCRYPT_AT_REST=1 && export
                CLAUDE_FLOW_ENCRYPTION_KEY=<64-char-hex>"
  On + missing key:    fail (fail-closed) with key-generation hint
  On + malformed key:  fail with key-format hint
  On + valid key:      pass — "On — key fp:abcd1234… (sessions/=enc
                              terminals=enc memory.db=enc)"

Wired into both allChecks (always-on) and componentMap as
'encryption' so users can drill in via `ruflo doctor -c encryption`.

Tests (__tests__/doctor-encryption.test.ts, 5 cases):
  - command runs cleanly with gate off
  - command runs cleanly with gate on + valid key
  - command runs cleanly with gate on + missing key (fail-closed)
  - command runs cleanly with gate on + malformed key
  - command reads a real encrypted blob without crashing

Verified: tsc --noEmit clean; doctor-encryption suite 5/5 green.

Closes ADR-096 acceptance-criteria item "ruflo doctor reports
encryption status" — last open box on the high-tier scope.
2026-05-03 21:51:59 -04:00
Reuven 841365f645 feat(encryption): ADR-096 Phase 4 — wire vault into memory DB writes/reads
Closes the high-tier encrypt-at-rest target trio (Phase 2 sessions,
Phase 3 terminals, Phase 4 memory DB). All three are now opt-in
encrypted under CLAUDE_FLOW_ENCRYPT_AT_REST without breaking any
existing test or callsite.

Memory DB is the largest of the three: a sql.js SQLite blob with
384-dim ONNX embeddings, often multi-MB. Different shape from the
JSON.stringify writers — pure Buffer in both directions.

Wired in src/memory/memory-initializer.ts:

  Reads — 9 sites converted from `fs.readFileSync(dbPath)` to
  `readFileMaybeEncrypted(dbPath, null)` (Buffer overload). Magic-
  byte sniff handles legacy plaintext + post-migration encrypted in
  the same call.

  Writes — 7 sites converted from `writeFileRestricted(dbPath, buf)`
  to `writeFileRestricted(dbPath, buf, { encrypt: true })`. Vault
  env-gate decides whether bytes are actually encrypted; off-by-default
  preserves the bit-for-bit legacy path.

Tests (__tests__/memory-db-encryption.test.ts, 9 cases):

  encryption disabled
    - SQLite buffer written unchanged (first 16 bytes are the literal
      "SQLite format 3\0" header)
    - readFileMaybeEncrypted(path, null) returns Buffer; round-trip OK

  encryption enabled
    - on-disk blob starts with RFE1 magic, NOT the SQLite header —
      pins that encryption actually replaced the bytes (regression
      sentinel)
    - round-trip with the same key
    - 1MB-scale round-trip (real-world memory.db size)
    - planted "TOPSECRET-EMBEDDING-VECTOR" signature does NOT appear
      in the encrypted bytes (defense-in-depth assertion)

  migration
    - plaintext SQLite written before the gate flipped is returned
      as-is via the magic-byte sniff (gate-on, file-off scenario)

  tamper
    - flipped ciphertext byte → GCM auth fails → throws on read
    - flipped magic byte → no longer detected as encrypted, returned
      as-is (correct: tamper on plaintext SQLite is sql.js's domain,
      not fs-secure's)

Verified:
  tsc --noEmit clean (0 errors)
  Encryption-track suite (vault + fs-secure + session + terminal +
    memory-db): 76/76 passing
  Full vitest suite: 1933/1933 passing, 46 skipped, 0 failures
    (was 1924; +9 from this commit)

ADR-096 high-tier scope is now complete. Phase 5 would extend to
medium-tier stores (agents/, tasks/, github/, etc.) but those have
much lower information value per the ADR's tiering and ship as a
separate decision.
2026-05-03 21:26:27 -04:00
Reuven 49c8019ed9 feat(encryption): ADR-096 Phase 3 — wire vault into terminal-tools
End-to-end opt-in encryption for the .claude-flow/terminals/store.json
store. Terminal command history routinely carries pasted credentials
(API keys, DB passwords), so this is the highest-stakes of the three
high-tier targets.

Mechanics — same shape as Phase 2 (session-tools) so reviewers can
diff the patterns:

  src/mcp-tools/terminal-tools.ts
    - loadTerminalStore: readFileSync → readFileMaybeEncrypted; the
      magic-byte sniff handles legacy plaintext + post-migration
      encrypted in one read path
    - saveTerminalStore: passes { encrypt: true } unconditionally;
      vault env-gate decides whether bytes are actually encrypted
    - Dropped the now-unused readFileSync import

Tests (__tests__/terminal-encryption.test.ts, 7 cases):

  encryption disabled (legacy plaintext)
    - writes plaintext JSON (first byte '{', not 'R')
    - round-trips create → list

  encryption enabled (RFE1 wire format)
    - on-disk blob starts with the RFE1 magic
    - plaintext name is NOT present anywhere in the on-disk bytes —
      stricter than the equivalent session test because terminal stores
      carry pasted credentials and an encryption regression here is a
      direct CVE
    - round-trips create → list

  migration
    - legacy plaintext store written before the gate flipped is still
      readable AFTER the gate flips on (sniff path)

  mixed: same store, plaintext-then-encrypted
    - first save plaintext (gate off), second save encrypted (gate on);
      saveTerminalStore rewrites the whole file → on-disk becomes
      encrypted bytes containing BOTH sessions. List enumerates both.

Verified:
  tsc --noEmit clean (0 errors)
  Encryption-track suite (vault + fs-secure + session + terminal):
    67/67 passing
  Full vitest suite: 1924/1924 passing, 46 skipped, 0 failures
    (was 1917; +7 from this commit)

Phase 4 wires the seven memory-initializer DB writes — the sql.js
SQLite blob containing memory entries + 384-dim embeddings. Different
shape (whole-Buffer encryption vs JSON.stringify) so it lands as its
own iteration.
2026-05-03 21:20:00 -04:00
Reuven 98aa2560e5 feat(encryption): ADR-096 Phase 2 — wire vault into session-tools
End-to-end opt-in encryption for the .claude-flow/sessions/*.json store.
The session writer is the smallest of the three high-tier targets, so it
ships first to bound the blast radius. Terminal stores and the
sql.js memory DB land in follow-up iterations.

Mechanics:

  src/fs-secure.ts
    - writeFileRestricted gains an options object: { encoding, encrypt }
      Legacy positional encoding signature still works, so all 5 existing
      call sites keep compiling unchanged.
    - When encrypt:true AND CLAUDE_FLOW_ENCRYPT_AT_REST is set, payload
      is run through encryptBuffer() before writeFileSync. Otherwise the
      flag is silently ignored — legacy plaintext path runs unchanged.
    - New readFileMaybeEncrypted(path, encoding?) — magic-byte sniff,
      decrypt-if-RFE1, otherwise pass-through. Two-overload signature
      mirrors fs.readFileSync (string default, Buffer with encoding=null).

  src/mcp-tools/session-tools.ts
    - saveSession passes { encrypt: true } unconditionally. The vault
      gate decides whether the bytes actually get encrypted.
    - loadSession + listSessions switch to readFileMaybeEncrypted, so
      a mixed plaintext+encrypted dir enumerates cleanly during the
      migration window.

Tests (__tests__/session-encryption.test.ts, 7 cases):

  encryption disabled
    - writes plaintext JSON (first byte '{', not 'R')
    - round-trips save → restore
  encryption enabled
    - on-disk blob starts with RFE1 magic
    - plaintext name is NOT present anywhere in the on-disk bytes
      (defense-in-depth: confirms encryption actually ran)
    - round-trips save → restore using the same key
  migration
    - a legacy plaintext file written before the gate flipped is
      still readable AFTER the gate flips on (sniff path)
  mixed dir
    - listSessions enumerates plain-1 + encrypted-1 in one call

Verified:
  tsc --noEmit clean (0 errors)
  Vault + fs-secure + session-encryption: 60/60
  Full vitest suite: 1917/1917 passing, 46 skipped, 0 failures
  (was 1910; +7 from the new test file)

Phase 3 wires terminal-tools.saveTerminalStore. Phase 4 wires the
seven memory-initializer DB writes.
2026-05-03 21:05:26 -04:00
Reuven cb9a9f346c feat(encryption): ADR-096 Phase 1 — vault primitives + tests
Implements the cipher primitives portion of the encryption-at-rest
design (ADR-096). No call sites wired yet — that's a separate iteration
to keep blast radius small. With this commit alone, the env vars are
inert and the 1865-test baseline stays green.

src/encryption/vault.ts (new):

  isEncryptionEnabled() — env-var gate (CLAUDE_FLOW_ENCRYPT_AT_REST).
    Truthy: "1" / "true" / "yes" / "on" (case+whitespace tolerant).
    Anything else, including unset, leaves the legacy plaintext path.

  getKey() — resolves a 32-byte key from CLAUDE_FLOW_ENCRYPTION_KEY,
    fail-closed when enabled-but-missing. Phase 1 supports env var only;
    keychain (keytar) and passphrase-with-scrypt land in a follow-up.

  decodeKey(raw) — accepts 64-char hex, 44-char padded base64, or
    43-char unpadded base64. Anything else throws. Trims whitespace.

  encryptBuffer(plain, key) — AES-256-GCM with a fresh random 12-byte
    IV per call. Returns wire-format blob:

      magic(4) || iv(12) || ciphertext(N) || tag(16)

    where magic = "RFE1" (Ruflo File Encrypted v1). Validates inputs
    (Buffer + 32-byte key) so a misuse fails loudly.

  decryptBuffer(blob, key) — verifies magic with timingSafeEqual,
    parses iv/ct/tag, runs GCM decrypt. Lets GCM auth failure
    propagate so tampered ciphertext / wrong key / corrupted IV all
    surface as a thrown error rather than silent garbage.

  isEncryptedBlob(blob) — magic-byte sniff. True iff blob ≥ 32 bytes
    AND starts with "RFE1". Used by readers during the incremental
    migration so legacy plaintext .claude-flow/sessions/*.json files
    pass through unchanged.

__tests__/encryption-vault.test.ts (new) — 45 cases pinning the
contract:
  isEncryptionEnabled: env-var gate w/ truthy/falsy table
  decodeKey: hex / padded b64 / unpadded b64 / wrong-length / garbage /
             whitespace
  getKey: missing-env error message; valid hex returns 32 bytes
  round-trip: empty / small text / JSON / 1MB random / fresh-IV
  wire format: starts with RFE1 / >= 32 bytes
  isEncryptedBlob: detects fresh / rejects JSON / rejects SQLite header
                   / rejects too-short / rejects non-Buffer
  tamper detection: flipped ct byte / flipped tag / flipped IV /
                    flipped magic / too-short / wrong key
  input validation: non-Buffer plaintext / wrong-size key (encrypt &
                    decrypt)

Verified:
  tsc --noEmit clean
  vault tests: 45/45 passing
  full vitest suite: 1910/1910 passing, 46 skipped, 0 failures
  (was 1865; +45 from this commit)

Phase 2 wires this into session/terminal/memory writers behind the env
gate. Phase 3 adds keychain + passphrase resolution.
2026-05-03 21:00:43 -04:00
Reuven da2cd80d8e perf: hoist dynamic stdlib imports to static across commands/
Continuing the dynamic-import-of-cached-module sweep started in 33cb210.
Same antipattern, same fix, four more files cleaned up:

  src/commands/guidance.ts (5 sites)
    All 5 handlers re-imported existsSync on every invocation.
    Hoisted to static `import { existsSync } from 'node:fs'` at the top.

  src/commands/performance.ts (3 sites)
    metrics action re-imported os/fs/path together. Hoisted as namespace
    imports so the existing `os.loadavg()` / `fs.statSync` / `path.resolve`
    call sites stay readable.

  src/commands/process.ts (2 sites)
    daemon-stats action re-imported node:os; logs scanner re-imported
    node:fs.readdirSync. Hoisted both to named imports
    (cpus/loadavg/totalmem/freemem from os, readdirSync alongside the
    existing fs imports).

  src/commands/appliance.ts (3 sites)
    requireFile, header, and rvfa extract action all re-imported
    fs/path. Hoisted as named imports — pathJoin/pathResolve aliased
    to avoid colliding with local `path` parameters.

Net: 13 dynamic-stdlib-import sites removed across 4 command files. Each
clears ~2µs (per the bench in 33cb210) and an async boundary that was
forcing the helper signatures to be unnecessarily async-colored.

Verified: tsc --noEmit clean (0 errors); commands.test.ts +
commands-deep.test.ts: 431/431 passing.
2026-05-03 20:51:44 -04:00
Reuven 33cb210e67 perf: drop redundant dynamic imports of already-loaded stdlib modules
memory-tools.ts and hooks-tools.ts had 5 + 1 sites that did
\`await import('fs')\` / \`await import('os')\` inside handler bodies even
though the same exports were already imported statically at the top of
the file. Each await-import on a cached module adds:

  - one async microtask roundtrip (~2µs per call on this host)
  - an async boundary that propagates up the call chain
  - a TypeScript erasure that hides which module the binding came from

Microbench (50k iters, M2 Mac):
  dynamic await import('fs')+import('os'): 107.47 ms (2.15 µs/iter)
  static reference:                          0.25 ms (0.005 µs/iter)
  speedup: 423x

Sites changed:
  memory-tools.ts:
    - memory_import_claude: 1× await import('os') + 2× await import('fs')
    - memory_bridge_status: 1× await import('os') + 1× await import('fs')
    Pulled readdirSync + homedir into the static import block at top.
    Also removed dead line `const projects = readFileSync;` (was a leftover
    no-op assignment with a misleading comment).
  hooks-tools.ts:
    - file-scanner handler: 1× await import('node:fs') for readdirSync+
      statSync that were already imported at the top.

Verified:
  tsc --noEmit clean
  __tests__/mcp-tools-deep + memory-ruvector-deep: 252/252 passing.
2026-05-03 20:47:35 -04:00
Reuven c1b57e4fd5 fix(security): close shell injection in update/executor (audit_1776853149979)
executeUpdate and rollbackUpdate built `npm install ${pkg}@${version}
--save-exact` as a shell string and ran it via execSync. Both inputs
came from untrusted sources:

  update.package + update.latestVersion — parsed from `npm view <pkg>`
    output (a network response).
  lastUpdate.package + lastUpdate.fromVersion — read from
    ~/.claude-flow/update-history.json (writable by anyone with FS
    access to the user's home).

A tampered package name like 'evil; touch /tmp/x' would have been
interpreted by /bin/sh.

Two-layer fix:

  isSafePackageSpec(pkg, version) — pre-flight regex gate.
    SAFE_PKG_RE allows scoped/unscoped npm names but forbids the
    unscoped first char from being '-' (defangs CLI-flag confusion in
    the eventual `npm install <spec>`).
    SAFE_VERSION_RE allows semver/dist-tag/range chars only —
    no shell metas. Length capped 64.
    Spec rejects empties.

  execFileSync('npm', argv, { shell: false }) replaces the shell-string
    execSync. Even if the gate were widened later, argv elements aren't
    interpreted by /bin/sh — backticks, $(...), ; stay literal.

Tests:
  __tests__/update-executor-injection.test.ts — 28 cases
    happy path: 9 real-world specs (claude-flow@3.6.10, @claude-flow/cli,
      latest, ^1.0.0, ~2.3.4, 1.x, prerelease tags, build metadata)
    package-name injection: 8 payloads (;, `, $, |, &, >, \n, \\)
    version injection: 5 payloads
    edge cases: empty pkg/version, leading-dash/dot pkg, oversized,
      malformed scoped names

Verified: tsc --noEmit clean; full audit-fix surface 74/74 passing.
2026-05-03 20:37:21 -04:00
Reuven 73babfb06e fix(security): close shell injection in github-tools MCP (audit_1776853149979)
The run() helper used execSync with template-string interpolation, and
the inline `.replace(/"/g, '\\"')` was a porous escape — it only handled
double quotes, leaving backticks, $(...), \, and ; literal. Combined
with `prNumber as number` (a TS cast, not a runtime check), an MCP
client could send:

  prNumber: "1; touch /tmp/pwned; echo "
  title:    'foo`whoami`bar'
  labels:   ['bug; rm -rf $HOME']

…and run() would interpolate them straight into the shell.

Fixes:

  runArgv(file, args[], cwd?)
    New helper using execFileSync with shell:false. argv elements aren't
    interpreted by /bin/sh, so metas in user-supplied strings stay
    literal. Original run() preserved for the static-string callers
    (gh issue list, git rev-list — they need pipes).

  toPositiveInt(value)
    Coerces + validates prNumber/issueNumber/workflowId as a positive
    integer (≤ 2^31). "1; rm -rf /" → null. Number([1,2]) → null.

  sanitizeLabels(value)
    Each label must be string ∈ /^[A-Za-z0-9][A-Za-z0-9 _\-./]{0,63}$/.
    Backticks, $, ;, |, leading separator, length > 64, non-array, or
    non-string element → null.

Risky callers converted (10 sites):
  pr create  : title/body/branches via argv
  pr review  : prNumber via toPositiveInt + argv
  pr merge   : same
  pr close   : same
  issue create: title/body via argv, labels via sanitizeLabels
  issue update: issueNumber via toPositiveInt, title via argv,
                labels re-sanitized
  issue close: issueNumber via toPositiveInt + argv
  workflow status / trigger / cancel: workflowId/ref via argv
                (already validated by validateIdentifier — argv form
                kept for consistency / defense in depth)

Tests:
  __tests__/github-tools-injection.test.ts — 15 cases pinning the
  toPositiveInt + sanitizeLabels contracts. Includes payloads
  '1; rm -rf /', '1`whoami`', '1$(whoami)', 'bug`whoami`' so a future
  refactor that loosens the validators trips a CI failure.

Verified: tsc --noEmit clean; full audit-fix test surface 46/46 passing
(4 files: validate-input-agent-spawn, validate-input-env, fs-secure,
github-tools-injection).
2026-05-03 20:34:04 -04:00
Reuven de96b0eed4 fix(security): restrict file mode on session/memory/terminal stores (audit_1776853149979)
Defense-in-depth before encryption-at-rest. The audit flagged plaintext
storage of session, memory, and terminal data — files were previously
written with the process umask, which on most macOS/Linux setups leaves
them mode 0644 (world-readable). They contain conversation snapshots,
agent prompts, embeddings, and pasted shell command history that may
include credentials.

Added src/fs-secure.ts with two helpers:
  writeFileRestricted(path, data, encoding?) — write then chmod 0600
  mkdirRestricted(path) — recursive mkdir with mode 0700
Both no-op the chmod silently on Windows (POSIX modes don't apply).

Wired through:
  mcp-tools/session-tools.ts — saveSession + ensureSessionDir; also the
    memory/tasks/agents subdirs that session_restore writes
  mcp-tools/terminal-tools.ts — saveTerminalStore + ensureTerminalDir
  memory/memory-initializer.ts — all 7 dbPath writes for the sql.js
    SQLite database (memory entries + embeddings)

Encryption-at-rest is the next, larger step (separate ADR). This change
is the cheap, immediate win — every existing reader of these paths
already has the file open via the same process, so there are no
backwards-compat concerns.

Verified:
  tsc --noEmit clean (0 errors)
  Three converted writers, one new helper file, no other call sites
  changed.
2026-05-03 20:27:07 -04:00
Reuven fb256ac596 fix(security): denylist loader-hijack env vars in terminal_create (audit_1776853149979)
terminal_create accepted a Record<string,string> of env vars and merged it
straight into execSync's process env for every subsequent command in the
session. A caller that controls MCP input could set LD_PRELOAD,
DYLD_INSERT_LIBRARIES, or NODE_OPTIONS=--require ./evil.js — functionally
RCE on the host running the MCP server.

Added validateEnv() in validate-input.ts:
  - names must match /^[A-Za-z_][A-Za-z0-9_]{0,127}$/ (POSIX shape)
  - rejects LD_PRELOAD, LD_LIBRARY_PATH, LD_AUDIT, DYLD_INSERT_LIBRARIES,
    DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH, DYLD_FORCE_FLAT_NAMESPACE,
    NODE_OPTIONS, NODE_PATH (loader/runtime hijack vectors)
  - values must be string, no null bytes, ≤32K
  - undefined/null env yields {} (preserves existing API)

Wired through terminal_create. Replaced unchecked cast with sanitized output.

Verified via tsx fixture: 11 cases — empty/undefined/valid pass, all three
loader-hijack vectors rejected, bad names (= in key, digit-first) rejected,
non-object/non-string-value/null-byte rejected.

Closes audit_1776853149979 finding "missing input validation on session.update/
memory.set" — the session/memory tools already validate identifiers and value
sizes via validateMemoryInput / validateText / validateIdentifier; the actual
hole was env passthrough in terminal_create, which the audit's wording missed
but which has the same root cause (untrusted input reaches a privileged
context unfiltered).
2026-05-03 20:22:01 -04:00
Reuven d9fd359565 fix(security): add fetch timeouts to verify + IPFS HEAD probe (audit_1776853149979)
Two no-timeout fetch sites a hung remote could pin indefinitely:

  src/commands/verify.ts:fetchWitness
    Bare fetch(url) for the verification manifest. Now AbortSignal.timeout(30000) —
    a sub-MB JSON over a public CDN should never need more than 30s, and we'd
    rather fail fast than hang the verify CLI.

  src/transfer/ipfs/upload.ts:checkContent
    HEAD probe to an IPFS gateway, no timeout. Now AbortSignal.timeout(10000) —
    HEAD without a body has no excuse to take longer.

Other no-timeout sites (download.ts streaming, upload.ts large POSTs) are
deliberately left alone — an absolute timeout would falsely abort slow but
progressing transfers of large blobs. Those need a connect-vs-transfer
timeout split, deferred to a separate change.

Verified:
- tsc --noEmit clean
2026-05-03 20:18:56 -04:00
ReuvenandRuFlo 87cc2f323c fix(verify): resolve plugin paths from source-tree when running locally
When `ruflo verify` runs from a checked-out repo (maintainer's working
copy), packages like `@claude-flow/plugin-agent-federation` live at
`v3/@claude-flow/plugin-*/dist/...` rather than under
`node_modules/@claude-flow/plugin-*/`. The previous resolution path
only knew about node_modules layouts, so the plugin's witness entry
reported `missing` for source-tree runs (cosmetic — installed copies
still resolved correctly).

Added a third resolution lane: walk up from the script's location
looking for the literal repo-relative path itself. End users still
hit the node_modules paths first; maintainers now get clean 27/27
pass instead of 26/27 + 1 missing.

Verified: `node bin/cli.js verify --manifest verification.md.json`
from the repo root reports pass: 27 / drift: 0 / regressed: 0 /
missing: 0.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 20:03:15 -04:00
ReuvenandRuFlo b2716337f7 feat(G7): activate GuardedVectorBackend (5 of 6 controllers wired)
ADR-095 G7 progress: GuardedVectorBackend wraps the existing
vectorBackend with the mutationGuard + attestationLog activated in
the previous iteration. All three dependencies are reachable in the
post-init wire: vectorBackend from baseline, mutationGuard from the
candidates loop, attestationLog from the sqlite-backed activation.

The GuardedVectorBackend constructor takes (inner, guard, log) per
the agentdb ADR-060 design — every mutating op (insert/insertBatch/
search/remove/save/load) now goes through MutationGuard validation
before reaching the inner backend; denials throw ProofDeniedError.
Read-only ops (getStats/getLearning/setLearning/close) pass through.

Skip cleanly when any of the three deps is missing — no construction
with undefined dependencies.

The previous "needs key material" note in ADR-095 was wrong: the
class itself doesn't take key material in its constructor signature,
only the wrapped backend + guard + log. Updated the source comment
to reflect that.

G7 progress: 5 of 6 controllers now activated. graphAdapter still
needs a graph DB connection — separate ADR.

Build clean.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 19:20:54 -04:00
ReuvenandRuFlo 9f38ecc41a feat(G7): activate MutationGuard + AttestationLog (4 of 6 now wired)
ADR-095 G7 progress: two more disabled AgentDB controllers now
constructed in memory-bridge.ts post-init.

- MutationGuard: probed clean construction with no args; the class
  exposes WASM-backed proof generation (proofsIssuedCount/denialsCount)
  for write-policy enforcement. Added to the candidates loop alongside
  gnnService and rvfOptimizer.

- AttestationLog: requires a better-sqlite3 / sql.js compatible db
  handle. Wired with a dedicated db at .swarm/attestation.db (kept
  separate from the main memory.db so the audit trail is isolated)
  using better-sqlite3 from the existing dep tree. Schema init runs
  inside the constructor and creates the mutation_attestations table
  + indexes if not present. Best-effort: if better-sqlite3 isn't
  resolvable in this install, skips silently.

G7 progress: 4 of 6 controllers now activated (semanticRouter from
F9, gnnService + rvfOptimizer from earlier, plus these two). Two
remaining (guardedVectorBackend needs key material; graphAdapter
needs a graph DB) still tracked for follow-up ADRs.

Build clean.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 19:11:52 -04:00
ReuvenandRuFlo 591839304b feat(G4): WASM agent prompt routes to Anthropic when WASM echoes input
ADR-095 G4 close-out. The audit (@roman-rr) measured wasm_agent_prompt
returning "echo: <input>" — the bundled @ruvector/rvagent-wasm doesn't
ship an LLM, only a sandbox + echo handler.

Fix: detect the echo stub at the JS layer (response matches
"echo: <input>" prefix) and route the prompt through Anthropic's
Messages API instead. The WASM agent's sandbox (virtual filesystem,
write_file/read_file/edit_file via wasm_agent_tool) still works — we
only patched the missing-LLM hole, not the sandbox.

Two changes:

1. agent-execute-core.ts now exports a generic callAnthropicMessages()
   helper plus resolveAnthropicModel() that handles the WASM-style
   model prefix ("anthropic:claude-...") in addition to the logical
   names (haiku/sonnet/opus). No agent-registry coupling.

2. agent-wasm.ts:promptWasmAgent() detects the echo stub and falls
   through to callAnthropicMessages with the WASM agent's configured
   model + instructions. If ANTHROPIC_API_KEY is not set, returns the
   stub output verbatim with a note pointing at the env var (matches
   prior failure mode rather than throwing).

Failure semantics: WASM agent state stays consistent (idle on success,
error on throw); echo-stub fallback is transparent to callers — the
returned string is the real LLM output, not a wrapper.

Build clean. The audit's "wasm_agent_prompt echoes input" finding is
closed: when the env is configured for real LLM access, users get
real LLM responses; when not, they get the stub with an honest hint.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 18:19:44 -04:00
ReuvenandRuFlo 9c511cf035 feat(G7): activate gnnService + rvfOptimizer via file:// imports
ADR-095 G7 partial close-out. Two of six previously-disabled AgentDB
controllers are now wired into the registry on post-init:

- gnnService — agentdb's graph neural net service (constructs no-arg)
- rvfOptimizer — RVF format optimizer (constructs no-arg)

Both load via direct file:// URL imports from the cli's bundled
agentdb dist tree, sidestepping agentdb's strict exports field
(which doesn't expose these subpaths). The earlier attempt to patch
agentdb's exports field via postinstall didn't work reliably across
pnpm-hoisted multi-version trees — file URL imports avoid that
hoisting problem entirely.

Postinstall script extracted to v3/@claude-flow/cli/scripts/postinstall.cjs
(was inlined as a one-liner in package.json). Added scripts/ to the
files array so it ships in the published tarball. The script also
walks all reachable agentdb installations (top-level + .pnpm/agentdb@*
+ deep node_modules) and applies the existing #1721 sibling-copy fix
to every one — covers npm/pnpm/yarn install layouts.

Remaining four disabled controllers (mutationGuard, attestationLog,
guardedVectorBackend, graphAdapter) stay off pending per-controller
activation ADRs because each constructor needs config / key material
/ db handle the registry doesn't safely pass blindly. Tracked in
ADR-095 G7.

Build clean.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 18:17:20 -04:00
ReuvenandRuFlo 6206b93dab feat(G3): real workflow runtime — task/wait/condition step execution
ADR-095 G3 close-out, depends on G1.

Extracted the agent execution path into agent-execute-core.ts so both
the agent_execute MCP tool and the workflow runtime use the same wire
to api.anthropic.com. agent-tools.ts now delegates to the helper.

workflow_execute is no longer a state-only stub. It walks the steps
in source order and dispatches each by type:

- task: reads { agentId, prompt, [systemPrompt, maxTokens, temperature,
  timeoutMs] } from step.config, runs interpolation on prompt /
  systemPrompt ({{var}} references workflow.variables and prior step
  outputs), calls executeAgentTask, writes the result back into
  workflow.variables[stepId.output] and lastStepOutput.
- wait: sleeps for config.ms (capped at 60s).
- condition: evaluates a constrained expression (var === 'literal' or
  var === number) against workflow.variables; jumps to thenStep /
  elseStep step indices if specified.
- parallel/loop: honestly marked as 'skipped' rather than mock-
  completing — these need a proper runtime extension and are tracked
  for follow-up.

Variable interpolation: {{name}} resolves to workflow.variables[name],
or {{stepId.output}} resolves to the prior step's output. Output
piping enables multi-step LLM chains.

Pause / cancel: the loop reloads the workflow store between steps. If
status flips to 'paused' or 'failed' externally, the runtime halts
and persists currentStep so workflow_execute can resume from there.

Failure semantics: a failed step persists status='failed' on the
workflow record with the error message, marks the failing stepId,
returns durationMs and per-step results. No silent failures.

Build clean. The audit's "workflow_execute returns { error: 'Workflow
not found' } even when called with a workflow ID that DOES exist"
finding is closed — workflow_execute now actually runs the steps.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 18:08:01 -04:00
ReuvenandRuFlo 8b586363dc feat(G1): agent_execute wires real Anthropic Messages API to agent registry
ADR-095 G1 close-out. The April audit (@roman-rr) called this "the
missing wire": agent_spawn registered metadata, but no MCP tool
actually dispatched work to a provider, so spawned agents stayed idle
forever with taskCount=0 and lastResult=null. AnthropicProvider
existed in @claude-flow/providers but was never imported by the agent
path.

New MCP tool: agent_execute(agentId, prompt, [systemPrompt, maxTokens,
temperature, timeoutMs]).

Implementation:
- Reads ANTHROPIC_API_KEY from env at call time (not spawn time, so
  rotating the key doesn't require re-spawning).
- Maps the agent's logical model (haiku|sonnet|opus|inherit) to a
  Claude model ID, defaulting to claude-3-5-sonnet-latest.
- Direct fetch to https://api.anthropic.com/v1/messages — no mock,
  no shell, no echo stub.
- Marks the agent busy + bumps taskCount before the call; restores
  status to idle and persists lastResult on completion (or restores
  state on failure).
- Returns the model output, usage, durationMs, and the upstream
  message ID so callers can correlate.
- Honest error path: missing API key, terminated agent, or
  upstream HTTP errors all return success:false with a
  remediation hint.

agent_spawn's response note now lists the three execution paths
explicitly: (1) agent_execute, (2) Claude Code Task tool, (3)
claude -p headless.

The wire from registry → provider is now real. Build clean.

Closes the G1 row of ADR-095. G3 (workflow runtime) was blocked on
this; can proceed in the next iteration.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 18:05:00 -04:00
ReuvenandRuFlo 6d37a5ff97 feat(cli): add 'ruflo verify' for signed witness manifest verification
New CLI command that:
- Fetches verification.md.json from the live repo (or accepts a local
  --manifest path) and parses the witness manifest.
- Re-derives the Ed25519 public key from the manifest's git commit
  using the documented seed: sha256(gitCommit + ':ruflo-witness/v1').
- Verifies the manifest's SHA-256 hash + Ed25519 signature.
- Walks each fix entry, locates the corresponding installed file in
  node_modules, recomputes its SHA-256, and checks the marker
  substring is still present.
- Reports per-fix status as pass / drift / regressed / missing:
  - pass: SHA-256 matches AND marker present
  - drift: marker present but SHA-256 differs (file was edited;
    inspect the diff — could be benign)
  - regressed: marker absent (the fix has been rolled back or
    refactored out)
  - missing: file not found in node_modules

Exit codes:
  0 — all pass and signature valid
  1 — any regression, missing file, or invalid signature

Output formats: human-readable table (default) or `--json` for CI.

Self-tested locally against branch HEAD's verification.md.json:
  pass: 18
  drift: 0
  regressed: 0
  missing: 0

This closes the loop on the verification workflow: users now have a
single command to confirm their installed ruflo matches the
cryptographically-witnessed manifest, AND the same command runs in CI
for regression detection across releases.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 18:00:50 -04:00
ReuvenandRuFlo 21f668c550 feat: implement ADR-094 transformers migration + ADR-095 gap tracking
ADR-094 — transformers loader (try-prefer-fallback):
- New v3/@claude-flow/embeddings/src/transformers-loader.ts exposes
  loadTransformersPipeline() that prefers @huggingface/transformers
  (clears protobufjs <7.5.5 critical RCE chain), falls back to legacy
  @xenova/transformers for backwards compat. Caches the resolved
  source so repeated callers don't re-import.
- Updated v3/@claude-flow/embeddings/src/embedding-service.ts:387 to
  use the loader instead of direct @xenova import.
- Updated v3/@claude-flow/cli/src/memory/memory-initializer.ts:1539
  with inlined try-prefer-fallback (avoids circular optional-dep at
  install time).
- v3/@claude-flow/embeddings/package.json: added @huggingface/transformers
  to optionalDependencies (^4.2.0) and peerDependenciesMeta.optional.

Both packages build clean. The loader uses a string-variable specifier
in dynamic import so tsc doesn't try to resolve types at compile time
(both packages are runtime-optional).

ADR-095 — architectural gap tracking from April audit (@roman-rr):
- Documents the 7 gaps the May audit/ADR-093 honesty work didn't
  address: G1 agent_spawn no subprocess, G2 single-process consensus,
  G3 workflow runtime missing, G4 WASM echo stub, G5 transformers
  CVE chain (now ADR-094), G6 auto-memory graph 100MB bloat for 20
  unique entries, G7 6 disabled AgentDB controllers.
- Reserves ADR-096..ADR-107 numbers for the per-gap follow-up ADRs.
- Explicit "tracking only — no decisions" status so gaps don't dilute
  through the issue tracker.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 17:44:11 -04:00
ReuvenandRuFlo aeeeff72f5 fix(cli): extract suppression to side-effect module imported FIRST
3.6.18 smoke test caught that the [AgentDB Patch] warning still leaked
through the ruflo wrapper — even after iteration #11's "move to
src/index.ts" attempt. Root cause: ES module imports hoist above any
top-level code in the same module, so the inline suppression block
ran AFTER `import { commands } from './commands/index.js'`, by which
point agentic-flow had already been loaded transitively and emitted
its warning.

Fix: extracted the patch into `src/log-filters.ts` as a side-effect
module and imported it as the FIRST import statement in src/index.ts:

  import './log-filters.js';     // ← evaluated first in import graph
  import { readFileSync } from 'fs';
  import { commands } from './commands/index.js';
  ...

ES module evaluation order is the source order of imports, so
log-filters.js runs its side effect (patches console.warn/log) before
any sibling import can transitively load agentic-flow.

bin/cli.js and bin/mcp-server.js keep their inline suppression as
defense-in-depth (covers cases where the bin file's own crypto/etc.
imports run before src/index.js loads).

Verified via ruflo wrapper:
  $ node ruflo/bin/ruflo.js --version
  ruflo v3.6.18    # no warning prefix anymore

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 17:34:22 -04:00
ReuvenandRuFlo 28fed919bd fix(cli): move [AgentDB Patch] suppression to dist/src/index.js
Iteration #9 audit caught the cosmetic warning still leaking through
when ruflo was invoked via the ruflo wrapper script. Root cause: the
suppression patch lived only in v3/@claude-flow/cli/bin/cli.js and
v3/@claude-flow/cli/bin/mcp-server.js. The ruflo wrapper bypasses both
and imports dist/src/index.js directly, so console.warn/log were not
patched when the cosmetic warning fired.

Fix: move the same tight-match suppression into the top of
src/index.ts so it runs on every entry point — bin/cli.js,
bin/mcp-server.js, ruflo/bin/ruflo.js (which imports dist/src/index.js),
tests, and any future entry. The bin patches remain as defense-in-depth
for cases where bin/* runs before src/index.js loads.

Tight match preserved: still requires BOTH "[AgentDB Patch]" AND
"Controller index not found" — other [AgentDB Patch] messages flow
through unchanged.

Verified locally: `node ruflo/bin/ruflo.js --version` prints
`ruflo v3.6.17` with no warning prefix (was emitting the warning
in iteration #9 audit).

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 17:31:04 -04:00
ReuvenandRuFlo ea312c8508 fix(aidefence): quick-mode PII detection + wrapper-level stats counters
Two related audit findings from the May verification swarm:

1. aidefence_scan quick mode missed obvious PII (email + API key combo
   returned safe:true). Quick mode used defender.quickScan(input) which
   focuses on prompt-injection / jailbreak patterns and skips PII.
   Fix: layer a fast defender.hasPII(input) check on top so quick-mode
   covers both threat classes; surface piiDetected and
   promptInjectionDetected as separate fields so callers can see what
   triggered the verdict.

2. aidefence_stats stayed at 0 regardless of has_pii / is_safe / scan-
   quick calls. Those tools bypass the underlying defender's stats
   tracking — only the full detect() path increments stats.
   Fix: added wrapper-level counters (wrapperStats) tracking calls and
   hits/threats for each lightweight tool. aidefence_stats now returns
   both the underlying defender stats AND a wrapper sub-object so the
   user sees real activity from the lightweight paths.

Bonus: aidefence_is_safe previously did `import('@claude-flow/aidefence')
.isSafe(input)` which bypassed the singleton entirely. Now routes
through getAIDefence() and combines the prompt-safety verdict with a
PII check so a safe verdict requires BOTH (matching common defender
expectations).

Build clean.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 17:26:29 -04:00
ReuvenandRuFlo bd55cd7cb5 perf(memory-bridge): parallelize post-init wiring (intelligence + agentdb)
The post-registry-init step previously chained four serial awaits:
  1. import('./intelligence.js') + initializeIntelligence
  2. register reasoningBank + learningSystem (depends on 1)
  3. import('agentdb') + register SkillLibrary
  4. import('agentdb') again + probe SemanticRouter/IntentRouter/TaskRouter

Steps 1+2 are independent of 3+4. Step 3 and 4 share the same agentdb
import. Now:

- Two top-level Promises (intelligencePromise, agentdbPromise) run in
  parallel via Promise.allSettled — a single failing path doesn't tear
  down the other.
- agentdb is imported once per registry init and reused for both the
  SkillLibrary registration and the F9 router probe (was importing
  twice).
- Each path keeps its own try/catch so partial failures degrade
  gracefully (matches the previous semantics).

Local cold memory init dropped from prior measurements; verify the
change against published artifact post-3.6.16 in the next /loop
verification swarm pass.

No behavioral change beyond timing — same controllers register, same
fall-through paths, same failure modes. Build clean.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 17:07:36 -04:00
ReuvenandRuFlo e3528f206a fix: F9 — actionable bridgeSemanticRoute error + multi-version router probe
ADR-093 F9 (last item from the May audit). Investigation:

The 8 disabled AgentDB controllers (vectorBackend, mutationGuard,
gnnService, attestationLog, semanticRouter, guardedVectorBackend,
rvfOptimizer, graphAdapter) ship disabled because their constructors
require either external dependencies, key material, or a sqlite db
handle the registry does not expose.

For semanticRouter specifically: the API renamed across agentdb alpha
versions — alpha.10 exported SemanticRouter; alpha.11 (the version
@claude-flow/cli@3.6.14 resolves to via ^3.0.0-alpha.11) dropped it
in favor of @ruvector/router as a separate package. So the previous
F9 attempt to construct SemanticRouter would silently fail in current
builds.

Two changes:

1. memory-bridge.ts post-init: probe multiple constructor names
   (SemanticRouter / IntentRouter / TaskRouter) to handle both legacy
   and future agentdb versions. Wire only if the constructed instance
   has a working `route` method. All wrapped in try/catch so a missing
   class doesn't tear down post-init.

2. bridgeSemanticRoute: when the router is genuinely missing, return
   an actionable error pointing callers at bridgeRouteTask (which IS
   wired and works) and hooks_model-route (ADR-026 model selection).
   Replaces the previous unhelpful "SemanticRouter not available"
   one-liner that left callers without a next step.

Other disabled controllers (mutationGuard, attestationLog, gnnService,
guardedVectorBackend, rvfOptimizer, graphAdapter) remain disabled and
tracked in code comments. Each needs a separate ADR for activation
because their requirements (config / key material / heavy deps / db
handle) are non-trivial and have security implications.

Build passes. bridgeSemanticRoute({input:"…"}) now returns:
  { route: null, error, recommendation, controller: "none" }

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 17:00:33 -04:00
ReuvenandRuFlo 565681fff8 fix: F7 coordination_orchestrate honesty + F11 neural_predict classifier
Iteration #3 of /loop.

ADR-093 F7 — coordination_orchestrate stops lying about completion time:
- Removed hardcoded `estimatedCompletion: "${agents.length * 50}ms"` —
  the tool never actually executed an orchestration. It scheduled an
  orchestration record and pretended it would finish in 50ms.
- Now persists the orchestration record to the coord store (last 100
  retained), returns `status: "scheduled"` with `executor: "none"`, and
  surfaces `_note` pointing callers at agent_spawn + the Task tool or
  hive-mind_spawn for real multi-agent execution.

ADR-093 F11 — neural_predict gets a real classifier head:
- Pattern labels: extract from common semantic fields (label, category,
  class, tag, intent, name, title) before falling back to the input text
  itself, then to a stable model:type:index id. Eliminates the audit-
  flagged "label is the raw JSON dump of training data" behavior.
- Confidence: replaced raw cosine clamp with a real classifier head —
  k-NN with cosine distance, then temperature-softmax (tau=0.1) over the
  top-K so confidence is a proper distribution that sums to 1.
- Surface `cosineSimilarity` alongside `confidence` so callers can
  distinguish "this is the closest match" from "this is the closest
  match AND the embedding actually agrees". Top-level `topPrediction`,
  `topConfidence`, `topSimilarity` for callers that want the head.
- `_classifierHead: 'knn-cosine+softmax(tau=0.1)'` declares the method.

Build clean. No publish (batched per loop directive).

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 16:51:07 -04:00
ReuvenandRuFlo e4b4a3e1e0 fix: security overrides + F8 perf metrics + F10 attention placeholder
Iteration #2 of /loop. Three concrete improvements, no publish (batched
for the next release per the loop directive).

Security (npm audit baseline):
- Add overrides for high/critical CVEs in claude-flow umbrella and ruflo:
  @hono/node-server >=1.19.10 (auth bypass), flatted >=3.4.0 (DoS),
  tar >=7.5.0, picomatch >=4.0.3, path-to-regexp >=8.2.1,
  undici >=7.18.0, minimatch >=10.0.0, @isaacs/brace-expansion >=5.0.1,
  cacache >=20.0.0, make-fetch-happen >=15.0.0, express-rate-limit >=8.4.1.
  npm overrides only apply at the install root, so these primarily
  protect our own CI/dev environment and signal intent to consumers.
  Transitive CVEs through @xenova/transformers/onnxruntime-web/protobufjs
  remain blocked on upstream releases.

ADR-093 F8 — performance_metrics fixtures replaced with self-measured
latency:
- Probe a tiny CPU+memory loop with process.hrtime.bigint, derive avg
  and p50/p95/p99 from real recent samples instead of the hardcoded
  50/40/100/200ms defaults.
- Throughput now reports actual ops/second from samples in the last 60s
  instead of an arbitrary +1/+10 increment per call.

ADR-093 F10 — hooks_intelligence_attention now attends over real stored
patterns when available:
- searchEntries(query) -> top-K stored patterns become the attention
  keys/values; labels include pattern IDs and excerpted content.
- When no patterns exist yet, falls back to the previous cosine-harness
  but labels them honestly as "(synthetic harness) pattern #N" and
  reports implementation: 'real-flash-attention+synthetic-harness'.
- Eliminates the audit-flagged "Flash attention target #1/2/3" placeholder
  strings with uniform 0.333 weights when stored patterns are present.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 16:48:24 -04:00
ReuvenandRuFlo c5915a718d fix(mcp): ADR-093 — remediate 7 audit findings, ship 3.6.14
Six-agent verification swarm against 3.6.13 surfaced mocks, broken tools,
and partial fixes. ADR-093 documents the findings and decisions; this
commit implements F1, F2, F3, F4, F5, F6, F12 (the in-scope subset).

- F1: hooks_metrics now reads getIntelligenceStatsFromMemory + routing
  outcomes instead of substring-matching memory keys. The 3.6.13 #1686
  fix landed in v3/mcp/tools/hooks-tools.ts but the runtime uses
  v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts — counters now actually
  increment after hooks_post-task.
- F2: hooks_worker-dispatch detects daemon presence via .claude-flow/
  daemon.pid and returns honest verdicts (`queued`, `no-daemon`,
  `synthetic-completed`) instead of the audit-flagged status:"completed"
  in 0ms (#1700 item 1).
- F3: hive-mind_init schema now exposes `consensus` (raft|byzantine|
  gossip|crdt|quorum, default raft per anti-drift posture) and persists
  consensusStrategy into HiveState; hive-mind_status surfaces the
  persisted value (#1700 item 4).
- F4: agentdb_pattern-store falls back to memory_store when the
  ReasoningBank registry is unavailable, instead of silently failing
  with "AgentDB bridge not available" while agentdb_health.reasoningBank.
  enabled === true.
- F5: embeddings_status adds a structured ruvectorStatus field
  ({available, enabled, version}) so callers can distinguish "package
  not installed" from "not wired into the pipeline" (#1698 partial
  regression at MCP boundary).
- F6: session_list now accepts both writer shapes (`{sessionId, name,
  savedAt}` from session_save and `{id, startedAt}` from the auto-session
  writer); previously the second shape collapsed to empty objects.
- F12: config_list enumerates the full union (defaults + stored + every
  scope) with accurate `source` labels, matching config_export totals.

Deferred (separate ADRs): F7 coordination_orchestrate stub,
F8 performance_metrics latency/throughput fixtures, F9 disabled AgentDB
controllers (route/feedback/semantic-route), F10 hooks_intelligence_
attention placeholder, F11 neural_predict classifier head.

Bumps @claude-flow/cli, claude-flow umbrella, and ruflo umbrella to
3.6.14 with all dist-tags updated. Smoke-tested in clean /tmp install:
ruflo memory init still 6/6 ✓; ruflo --version reports 3.6.14.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 16:36:56 -04:00
ReuvenandRuFlo a10a13e623 fix(cli,ui): resolve five issues from May 1-3 reports
Bumps all three packages to 3.6.13 with the following fixes:

- #1697 (rvf-wasm SyntaxError): pin @ruvector/rvf-wasm to 0.1.5 via
  npm overrides in root and ruflo umbrella package.json. Upstream
  republished 0.1.6 with the missing exports map, so fresh installs
  also work — the override is defense-in-depth for cached resolves.
- #1698 (HNSW false-negative): await getHNSWIndex() before reading
  status in `embeddings index status` and `performance benchmark`.
  Differentiate "package not installed" vs "index empty" in the
  remediation hint instead of always pointing to npm install.
- #1686 (metrics zeros + null.toFixed crash): pass dbPath to
  ReasoningBank so post-* writes persist to .swarm/memory.db,
  normalize CLI dashboard against both `statistics`/`stats` and
  `executionTime`/`duration` shapes, and add ?? 0 guards on every
  toFixed call.
- #1691 (Windows daemon spawn): replace spawn(process.execPath,...,
  {shell:true}) with fork(cliPath, ...) so cmd.exe never sees the
  spaced node.exe path. Also removes the [DEP0190] security warning.
  macOS regression-checked against published 3.6.13.
- #1694 (UI auto-execute): remove 500ms auto-call to executeResearch
  in goal_ui/Index.tsx and add an explicit "Start Research" gate
  button so the plan is reviewable. Validated in Playwright with
  zero console errors.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 15:22:46 -04:00
rUvandReuven 643ed0024c chore: bump to v3.6.12 — RuFlo branding, portable MCP server config (#1679)
- Bump @claude-flow/cli, claude-flow umbrella, and ruflo to 3.6.12
- init mcp-generator: spawn `npx ruflo@latest mcp start` (was @claude-flow/cli@latest)
  for cleaner branding via the ruflo wrapper package
- init settings-generator: emit RuFlo-branded attribution
  (Co-Authored-By: RuFlo <ruv@ruv.net>; Generated with [RuFlo])
- Project .claude/settings.json: replace hardcoded /workspaces/... MCP path
  with portable npx ruflo@latest, wire statusLine.command to existing helper,
  drop invalid hook events (TeammateIdle, TaskCompleted, SubagentStart),
  drop ruv-swarm from enabledMcpjsonServers (not configured)

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-04-30 11:15:25 -04:00
rUvandReuven 1405eab669 fix: rename plugin commands to avoid built-in conflicts; bump default Opus to 4.7 (#1678)
* chore: bump all packages to v3.6.11 — published to npm

SmartRetrieval integration + 4 bug fixes (#1604, #1605, #1606, #1616).

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

* fix: rename plugin commands to avoid built-in conflicts; bump default Opus model

- Rename 9 plugin commands/skills whose bare names collided with built-in
  Claude Code slash commands and skills (/doctor, /loop, /schedule, /browser,
  /status, /cost, /memory, /docs, /sparc) to ruflo-* prefixed names
- Update ruflo init to default to claude-opus-4-7 (was 4.6) in
  settings.json modelPreferences and statusline display
- Update statusline pkgVersion fallback 3.5 -> 3.6 to match published version
- Add plugin showcase GIF above Quick Start in README

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

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-04-30 10:56:47 -04:00
rUvandReuven c1eb37d535 fix: 4 high-priority bugs — browser ENOENT, memory path, stdio crash, settings (#1604, #1605, #1606, #1616)
#1605: Guard browser_* MCP tool registration behind agent-browser
availability check. Tools are no longer advertised when the binary
is missing.

#1604: Align memory-tools.ts MEMORY_DIR with memory-initializer.ts
(.swarm/memory.db). Legacy migration now correctly reads from the
old .claude-flow/memory/ path.

#1606: Wrap ensureInitialized() in try/catch to prevent unhandled
exceptions from killing the stdio transport. Fix cli.js outer catch
to return -32603 (internal error) instead of -32700 (parse error)
for handleMessage failures.

#1616: Rename .claude/settings copy.json → settings.json.bak so
VSCode Copilot no longer treats it as an active settings file.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-04-30 00:33:27 -04:00
rUvandReuven d663581497 feat: wire SmartRetrieval (ADR-090) into production memory pipeline
Integrates the 5-phase SmartRetrieval pipeline into production:
- Export smartSearch + types from @claude-flow/memory package index
- Add `smart` flag to memory_search MCP tool
- Add `--smart` / `-s` flag to CLI `memory search` command
- Update ruflo-rag-memory plugin skill and README

Pipeline: query expansion → RRF fusion → recency boost → MMR diversity → session round-robin.
11/11 tests pass, both packages build clean.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-04-30 00:24:52 -04:00
Reuvenandclaude-flow f25bcf2073 feat: add 10 new ruflo plugins, optimize all 32, add READMEs and user guide
New plugins: ruflo-adr (ADR lifecycle), ruflo-ddd (domain-driven design),
ruflo-sparc (SPARC methodology), ruflo-neural-trader (trading strategies),
ruflo-ruvector (vector embeddings), ruflo-knowledge-graph (entity graphs),
ruflo-market-data (OHLCV ingestion), ruflo-migrations (schema management),
ruflo-observability (logging/tracing), ruflo-cost-tracker (token budgets).

Optimizations across all 32 plugins:
- All pass `claude plugin validate` (removed invalid manifest arrays)
- 51/51 skills have argument-hint frontmatter
- Model routing: 4 haiku, 24 sonnet, 2 opus (cost-optimized)
- Neural learning hooks on 25/30 agents
- Cross-references between 6 related plugin pairs
- Pathfinder graph traversal algo for researcher agent
- READMEs for all 32 plugins + plugins/README.md catalog
- discover-plugins skill updated with full 32-plugin catalog

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-29 23:46:54 -04:00
Reuvenandclaude-flow c44f527a1e feat: lean CLAUDE.md generator with SendMessage-first coordination
Rewrites claudemd-generator.ts from ~577 to ~280 lines (~50% token reduction).
Adds agent comms (SendMessage pipeline) as core section in every template.
Updates root CLAUDE.md to v3.6.10 with comms-first agent teams section.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-29 19:29:02 -04:00
Reuvenandclaude-flow b239c6246c feat: ruflo-federation native plugin, registry entry, README overhaul
- Add ruflo-federation to plugins/ (21st native Claude Code plugin)
  with federation-coordinator agent, /federation command, and 3 skills
  (federation-init, federation-status, federation-audit)
- Register @claude-flow/plugin-agent-federation in discovery.ts
  (official, featured, trending, newest, realNpmPackages)
- README: rewrite intro, add "Slack for Agents" federation section
  with ASCII comms diagram, capabilities table, install commands,
  update plugin count to 21+21

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-29 18:57:35 -04:00
Reuvenandclaude-flow 3983d8aad5 fix: browser args comma-join + proper ESM fs import for sysctl (v3.6.8)
Bug D final: args.join(',') not args.join(' ') — agent-browser expects
comma-separated single string: --args "--no-sandbox,--disable-dev-shm"

Bug E final: readSysctl used require('fs') which fails silently in ESM.
Now uses top-level import { readFileSync, existsSync } from 'node:fs'.
AppArmor check was already present but never executed due to require().

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-28 00:44:17 -04:00
Reuvenandclaude-flow c2c21f6ae5 fix: browser --args flag + AppArmor detect + guidance ab-test executor (v3.6.7)
Bug D: --arg → --args (agent-browser CLI expects plural flag with
joined args string, not per-arg iteration).

Bug E: needsNoSandbox now checks apparmor_restrict_unprivileged_userns
in addition to unprivileged_userns_clone for Ubuntu 24.04+.

Issue #1652: DefaultHeadlessExecutor now implements IContentAwareExecutor
with setContext(). Config A removes CLAUDE.md, Config B writes provided
content. Backup/restore ensures original file is preserved.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-28 00:38:58 -04:00
Reuvenandclaude-flow 911bd4e940 fix: browser ENOENT/args/hover + RaBitQ bridge store alignment (v3.6.6)
Browser MCP: ENOENT fallback to npx, --args passthrough with Linux
sandbox auto-detect, hover @eN ref parity with click/fill.

RaBitQ: buildRabitqIndex now reads through bridge (better-sqlite3)
first so it sees WAL data from memory_store. Fixes vectorCount: 0
after store. embeddings_search defaults to namespace 'all'.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-28 00:33:36 -04:00
Reuvenandclaude-flow ca4d1f0a4d feat: add RaBitQ 1-bit quantized search + fix HNSW/RRF bugs (v3.6.5)
- Integrate @ruvector/rabitq-wasm for 32x vector compression and
  Hamming-scan pre-filtering in the memory search pipeline
- Add 3 MCP tools: embeddings_rabitq_build, _search, _status
- Fix: bridgeStoreEntry now returns rawEmbedding for HNSW sync
- Fix: storeEntry adds to HNSW index after bridge store succeeds
- Fix: bridgeStorePattern adds to HNSW in bridge-fallback path
- Fix: RRF scoring uses pure BM25 when row has no embedding
  (prevents 0.3x crush of keyword scores below threshold)
- Fix: pattern-store recognizes bridge-fallback for hnswIndexed

Closes #1659

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-28 00:22:17 -04:00
Reuvenandclaude-flow 23090ddbee fix: transfer_plugin-search null guard on tags/keywords/categories (v3.6.3)
Plugin entries with undefined tags, keywords, categories, or permissions
arrays caused .some()/.includes()/.filter() to crash with "Cannot read
properties of undefined". Added || [] fallback across all array accesses
in search.ts.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-27 23:48:57 -04:00
Reuvenandclaude-flow 01c764f6fb fix: microlora adapt auto-pads to 768-dim, system_info reads real version (v3.6.2)
- microlora_adapt: zero-pad input to MICROLORA_WASM_MIN_DIM (768) so
  smaller inputDim values work without user intervention
- system_info: search both ../.. and ../../.. for package.json to find
  the real version from compiled dist/ paths

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-27 23:45:10 -04:00
Reuvenandclaude-flow 39c3ffe962 fix: 6 MCP tool validation bugs — git refs, npm names, WASM serialization (v3.6.1)
- analyze_diff: allow ~, ^, / in git refs via new validateGitRef()
- transfer_plugin-info: allow @ in npm-scoped names via new validatePackageName()
- agentdb_batch: guard null embedder with actionable error message
- ruvllm_hnsw_route: serialize WASM objects to plain {name, score, metadata}
- ruvllm_microlora_adapt: catch 768-dim mismatch with helpful error
- agentdb_batch: clarify entries go to episodes table, not memory_search
- ADR-092 documents all fixes

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-27 23:39:56 -04:00
rUvandReuven 8824fe3c49 fix: Tier A+B blockers — 13 issues across CLI, memory, hooks, daemon (v3.5.82) (#1655)
Tier A (6 bugs):
- #1647: trajectory-start now persists pending record to disk; intelligence_stats wrapped in try/catch
- #1646: guidance capability catalog referenced 'memory_import' instead of 'memory_import_claude'
- #1617: getProjectCwd() rejects CLAUDE_FLOW_CWD when set to $HOME or '/'
- #1619: system_health checks for agentdb.sqlite and store.rvf, not just legacy store.json
- #1614: RvfBackend persistToDisk uses write queue instead of silently dropping concurrent writes
- #1610: ControllerRegistry.initialize() now receives vectorBackend: 'auto' config

Tier B (7 issues):
- #1636: worker-dispatch returns honest 'scheduled' status instead of faking completion via setTimeout
- #1637: daemon-state.json uses atomic write (tmp + rename) to prevent corruption from concurrent writes
- #1620: init 'Next steps' uses brand-aware binary name (ruflo vs claude-flow)
- #1635/#1633: Windows tasklist command improved with /NH flag and 3s timeout
- #1631: neural_train response includes platformNote when ONNX embeddings unavailable

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-04-27 18:05:33 -04:00