Commit Graph
199 Commits
Author SHA1 Message Date
ruvandRuFlo 542481053c docs(adr): #ADR-130 — graph intelligence integration + improvement roadmap
ADR-130 (420 lines) — unify the four parallel graph layers (AgentDB
causal edges, ruflo-graph-intelligence, knowledge-graph adapter, SONA
trajectory) into one canonical graph substrate on AgentDB sql.js with
temporal semantics, PQ-compressed embeddings, complexity-budgeted
queries, and a 6-algorithm pathfinder (PageRank, mincut, spectral,
temporal centrality, component churn, witness divergence).

6 phases across 3.9.0 (P1-P3) and 3.10.0 (P4-P6). RETRIEVE step of the
4-step intelligence pipeline gets a graph backbone.

IMPROVEMENT-ROADMAP — 10 prioritized items beyond ADR-130: skipped
integration tests (#1872), witness drift (#2047), SOTA M5 real model,
CLAUDE_FLOW_DB_PATH env var (#2105), skill synthesis loop, branding
cleanup, Windows daemon, hive-mind under load, ed25519 v3 upgrade,
plugin marketplace tier promotion.

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
2026-05-24 22:01:37 -04:00
rUvandRuFlo 47a7825b0e feat(rvagent): #ADR-129 — full rvagent integration (4 phases) (#2123)
* docs(adr): ADR-129 — rvagent full integration (4 phases, post-3.7.0 baseline)

Proposes a 4-phase integration of @ruvector/rvagent-wasm@0.1.0 to make
WasmAgents first-class participants in the ruflo swarm.

## Gaps found in current code (verified by deep-researcher)

- agent-wasm.ts:165-196 — echo-stub bypass (JsModelProvider never
  constructed; verified by `grep -rn 'new JsModelProvider'` returns 0
  hits). WasmAgent.prompt() either echoes or hits a default — not
  routed through the v3 provider system from #2042.
- agent-wasm.ts:420-429 — buildRvfFromTemplate silently drops
  template.mcp_tools, so wasm_gallery_create can't surface MCP tools
  to the agent.
- 10 of 13 gallery methods unexposed (loadRvf, configure, getCategories,
  listByCategory, addCustom, removeCustom, importCustom, exportCustom,
  getActive, getConfig).
- 6 agent introspection methods unexposed (get_state, get_todos,
  get_tools, turn_count, is_stopped, reset).
- No bridge from any of the 35 ruflo plugins to the WASM agent runtime.

## 4 phases

| Phase | What | Smoke |
|---|---|---|
| 1 | JsModelProvider → callAnthropicMessages bridge | smoke-wasm-provider-bridge.mjs |
| 2 | wasm_agent_compose + addMcpTools bridge (314 tools) | smoke-wasm-rvf-compose.mjs |
| 3 | 16 new MCP tools (gallery CRUD + introspection) | smoke-wasm-gallery-crud.mjs |
| 4 | Plugin bridge contract | smoke-wasm-plugin-bridge.mjs |

## Top 3 risks

1. Billing expansion — Phase 1 turns wasm_agent_prompt into billable
   LLM calls (was echo).
2. addMcpTools over-permissioning — Phase 2 default must be explicit
   allowlist, not full dump (314 tools include destructive ones like
   memory_delete, federation_*).
3. importCustom prompt-injection — Phase 3 deserializes user JSON in
   the WASM runtime; AIDefence gate required.

No phase needs a separate ADR. Anchored in #2042 (provider routing),
ADR-115 (rvagent rename), ADR-127 (smoke pattern).

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>

* feat(rvagent): #ADR-129 P1 — JsModelProvider routes WasmAgent through v3 provider system

Wire set_model_provider() at agent-creation time so the WASM runtime's
internal conversation loop dispatches through callAnthropicMessages
(Anthropic / OpenRouter / Ollama, same routing as agent_execute #2042).
Echo-stub fallback preserved for keyless environments.  Smoke +
CI job added: smoke-wasm-provider-bridge.mjs / wasm-provider-bridge-smoke.

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

* feat(rvagent): #ADR-129 P2 — wasm_agent_compose + addMcpTools bridge (314-tool unlock with allowlist gate)

Fix silent drop of template.mcp_tools in buildRvfFromTemplate; extend
buildRvfContainer to accept mcpTools param → builder.addMcpTools().
Add wasm_agent_compose MCP tool with explicit allowlist, destructive-tool
gate (mcpToolsAllowDestructive required for *_delete/*_shutdown/federation_*),
and includePlugins P4 wire.  Smoke + CI job: smoke-wasm-rvf-compose.mjs.

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

* feat(rvagent): #ADR-129 P3 — 16 new MCP tools (10 gallery CRUD + 6 introspection) with AIDefence gate on import

Add wasm_gallery_load_rvf, configure, categories, list_by_category,
add_custom, remove_custom, import (HIGH_RISK + AIDefence gate), export,
active, config.  Add wasm_agent_state, todos, tools, turn_count,
is_stopped, reset.  Export 10 new functions from agent-wasm.ts.
Smoke + CI job: smoke-wasm-gallery-crud.mjs.

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

* feat(rvagent): #ADR-129 P4 — plugin manifest "rvagent" field + includePlugins in compose

Add loadPluginManifest() + extractPluginSkills() to wasm-agent-tools.ts.
wasm_agent_compose gains includePlugins?: string[] — reads each plugin's
.claude-plugin/plugin.json, parses rvagent.exposeSkillsAsTools, and adds
matching skills to the RVF container.  Unknown plugin name → warning,
not error.  Smoke + CI job: smoke-wasm-plugin-bridge.mjs.

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

* fix(ci): #2120 — memory smoke uses pnpm (workspace: protocol unsupported by npm)

The memory-stats-legacy-db-smoke job hit `EUNSUPPORTEDPROTOCOL:
Unsupported URL Type "workspace:"` in CI because `cd v3/@claude-flow/cli
&& npm install` ran against a package.json with workspace:* deps that
only pnpm understands. Same pattern as the agent-execute smoke fix.

Switch the job to pnpm/action-setup + `pnpm install` + `pnpm --filter
@claude-flow/cli build`. The smoke logic is unchanged.

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>

* fix(rvagent): #ADR-129 — pad 16 new wasm tool descriptions to ADR-112 spec (>=80 chars + Use-when guidance)

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

* feat(rvagent): #ADR-129 — benchmark suite (provider routing, compose, gallery CRUD, plugin enum)

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

* feat(witness): #ADR-103 — register ADR-129 P1-P4 fixes in witness manifest

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

* fix(ci): #2120 — pnpm install must run from v3/ (workspace root)

My prior fix (2d2091fe7) ran `pnpm install` at repo root, but the
pnpm-workspace.yaml lives in v3/, not at the root. Result: no
node_modules under v3/@claude-flow/cli, tsc errored on missing
@types/node, build never produced dist.

Mirror the working pattern used elsewhere in this workflow:
`working-directory: v3` + `pnpm install` + `pnpm --filter
@claude-flow/cli build`. Keep the root `npm install` for sql.js
which the smoke fixture imports from the repo root.

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>

* fix(ci): #2120 — recursive build (CLI tsc depends on swarm dist)

Previous fix (cec3cef48) installed correctly from v3/ but the CLI's tsc
emits TS6305 because it has project references to @claude-flow/swarm
and its dist hasn't been produced yet. `pnpm --filter @claude-flow/cli
build` only builds that one package and skips deps.

Switch to `pnpm --recursive --no-bail run build || true` — the proven
pattern used elsewhere in this workflow — then assert the specific dist
file the smoke imports (`dist/src/memory/memory-initializer.js`).

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>

* fix(memory): #2120 — getBridge honors CLAUDE_FLOW_DISABLE_BRIDGE=1

The #2120 smoke sets `CLAUDE_FLOW_DISABLE_BRIDGE=1` to force the raw
sql.js fallback path of `listEntries`, because the ensureSchemaColumns
backfill (NULL status → 'active') only runs in that fallback —
bridgeListEntries reads via a separate better-sqlite3 handle and skips
the migration.

`getBridge()` ignored that env var, so on CI Linux (where better-sqlite3
builds successfully) the bridge took over `listEntries`, the backfill
never ran, and the smoke's step-4 verification (reading the file with
plain sql.js) saw status=NULL on all rows and reported 0 active. The
test passed on macOS only because the bridge happened to fail to
initialize locally.

Honor the env var: when set to "1", short-circuit getBridge() before any
import attempt. Same value the smoke already sets — no other call site
relies on this flag, so the change is non-breaking.

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>

---------

Co-authored-by: RuFlo <ruflo-bot@users.noreply.github.com>
2026-05-24 14:32:43 -04:00
ruvandRuFlo cff24dbff6 perf(guidance): M4 quantization — 1-bit RaBitQ-style signatures, 2.7x at N=1000
Horizon: guidance-sota-2026-05 (M4). The real SOTA win.

## What changed

`ShardRetriever` now maintains a packed Uint32Array of 1-bit sign
signatures alongside the existing Float32 embedding matrix. For
dim=384 that's 12 Uint32 words = 48 bytes per shard (vs 1,536 bytes
for the Float32 embedding — a 32x memory reduction for the index).

`scoreShards` runs the cosine via Hamming-distance over those
signatures when (a) the index is current, (b) shard count ≥ 100 (to
amortise the query-signature build), and (c) dims match. The
sign-random-projection theorem (Charikar 2002) gives:

    cos(θ) ≈ cos(π · hamming(sig_q, sig_s) / dim)

which is accurate enough for the retriever's sort + intent-boost +
risk-boost downstream.

## Microbench (bench-quantization.mjs)

    cosine.dot (float32, 384-d)           3,006,455 ops/s   332.62 ns/pair
    hamming.popcount (uint32, 12 words)  32,862,982 ops/s    30.43 ns/pair
                                                         ────────────
                                          Hamming speedup vs dot: 10.93x

## End-to-end (bench-retriever-scale.mjs)

  N    baseline unfilt   M4 unfilt   speedup
  10        63,910         70,777      1.11x
  100       12,135         26,372      2.17x
  500        2,470          6,468      2.62x
  1000       1,303          3,522    🚀 2.70x

  N    baseline filt     M4 filt     speedup
  10       166,274        198,451     1.19x
  100       46,419         85,311     1.84x
  500       12,974         27,081     2.09x
  1000       6,662         16,073     2.41x

All 1,331 existing tests pass. Build clean.

## Why this works where Phase 1 + M3 didn't

Phase 1 / M3 attacked the dot product's *constants* (eliminate sqrt,
hoist regex, pack memory). Those are all within V8's optimisation
ceiling — the JIT already does most of it. M4 attacks the
*algorithm*: instead of 384 multiplies per pair, we do 12 XOR +
popcount. The instruction count itself drops ~30x, and even with JS's
no-native-popcnt penalty we measure 11x per-pair.

End-to-end speedup is bounded by Amdahl on the non-cosine work
(sorting, intent/risk boosts, result construction), so 2.7x is the
expected ceiling for this fixture. At larger N or with a heavier
embedding model, the cosine fraction grows and the speedup approaches
the full 11x.

## Memory

48 bytes/shard signature vs 1,536 bytes/embedding — a 32x reduction.
At N=10,000 shards: 480KB signatures vs 15MB embeddings. Real for
cold-start RAM on hooks-running daemons.

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
2026-05-21 23:51:48 -04:00
ruvandRuFlo 12ecb39cbc perf(guidance): M3 substrate — packed embedding matrix + filtered-query bench coverage
Horizon: guidance-sota-2026-05 (M3). Honest report of what works and
what didn't.

## What changed

retriever.ts gains a contiguous Float32Array pack of all shard
embeddings, populated once at indexShards() time. scoreShards then
walks the pack inline (sequential reads, V8-friendly inner loop)
instead of dereferencing per-shard heap Float32Array allocations.

bench-retriever-scale.mjs gains a filtered-query column so we can
measure the effect of risk-filter / repo-scope path. The original code
already does filter-then-continue (skipping cosine on filtered shards),
which is worth ~5x at N=1000 — the bench scaffold now proves that.

## Honest findings

After three iterations of "optimization":

  N | unfilt baseline | unfilt M3v2 | filt baseline | filt M3v2
  --|-----------------|-------------|---------------|----------
  10|         63,910  |     73,187  |     166,274   |   192,414
 100|         12,135  |     12,234  |      46,419   |    47,742
 500|          2,470  |      2,468  |      12,974   |    11,807
1000|          1,303  |      1,333  |       6,662   |     6,646

All speedups vs baseline are within ±5% (noise band). The package was
already well-tuned:
  - cosineSimilarity was the dominant cost at scale (~400µs of 760µs
    at N=1000)
  - The existing filter-then-continue ordering already short-circuits
    cosine on 80% of shards in the typical riskFilter case
  - V8's JIT optimizes the original filter-chain patterns nearly as
    well as the manually-unrolled forms

## What this proves

The benchmark infrastructure (multi-trial median, four scale points,
both filtered and unfiltered query paths) IS the SOTA scaffold. It
establishes:

  1. Reproducible per-N measurement at ±2% variance
  2. The filter optimization is real (5.1x at N=1000)
  3. The cosine dominates at scale — further gains require RaBitQ-style
     1-bit-per-dim quantization (M4) or algorithmic change (true HNSW
     with logarithmic graph traversal, requires sidecar dep)

This commit lands the substrate for M4 to measure against. M3 closure
is "infrastructure + filter-baseline proven", not "package made faster"
— V8 already did most of the work that's easily expressible in JS.

## Verification

- All 1,331 tests pass (`npm test` in v3/@claude-flow/guidance)
- Build clean
- 5-trial median benchmarks reproducible at ±2%

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
2026-05-21 23:27:23 -04:00
ruvandRuFlo 6d6d659ca9 perf(guidance): Phase 1 — hot-path cleanup + scaling benchmark infrastructure
Horizon: guidance-sota-2026-05 (M1 + M2). First commit on the path to
SOTA-with-proof for @claude-flow/guidance.

## What changed

Three localized hot-path cleanups + a benchmark infrastructure that
exposes the real opportunity (M3, HNSW substrate).

### Code changes (no public API surface change)

1. **analyzer.ts extractMetrics** — replace 6 separate `lines.filter()`
   passes + 2 `for-of` loops with a single iteration that accumulates
   every line-derived metric. Hoist 11 in-body regex literals to module
   scope. Net: cleaner code, no measurable speedup on V8 (the JIT
   already optimizes filter chains well).

2. **compiler.ts parseRule** — replace 4 `new RegExp(PATTERN.source, 'gi')`
   constructions per call with `text.matchAll(PATTERN)` against the
   existing module-level global patterns. Net: cleaner code, no
   measurable speedup (V8 internalizes the regex objects).

3. **retriever.ts cosineSimilarity** — drop the 3-accumulator
   sqrt-div-clamp form to a pure dot product. The embeddings this
   retriever consumes are always unit-normalised (HashEmbeddingProvider
   divides by L2 norm at line 134, ONNX providers emit unit vectors by
   design), so `sqrt(normA)*sqrt(normB) === 1` and the result already
   lies in [-1, 1]. Net: +8.2% at N=1000 shards, +10.9% at N=500.

### Benchmark infrastructure (new)

- `scripts/bench-phase-1.mjs` — multi-trial median microbenchmarks for
  the 3 hot paths. Stable to ~2%.
- `scripts/bench-retriever-scale.mjs` — end-to-end `retriever.retrieve()`
  at N ∈ {10, 100, 500, 1000}. Reveals the real scaling cliff.
- `scripts/README.md` — how to run + findings.
- `docs/benchmarks/guidance-{baseline,phase-1}.json` — captured runs.
- `docs/benchmarks/guidance-retriever-scale-{baseline,phase-1}.json` —
  scaling curves at four shard counts.

## Honest M2 status

Original target: ≥2x speedup or ≥30% reduction. Phase 1 delivers ~1.1x
at scale — short of the bar. **But the baseline benchmarks revealed
what the real lever is**: `scoreShards` linear scan goes from 14µs at
N=10 to 760µs at N=1000 — a 55x latency growth that's pure O(n).

M3 (HNSW substrate) targets that bottleneck directly. The infrastructure
landing here is the proof scaffold M3 will measure against.

## Verification

- `npm test` in v3/@claude-flow/guidance: all 1,331 tests pass
- `npm run build`: clean
- Bench scripts runnable end-to-end with JSON artifacts under
  `docs/benchmarks/`

Co-Authored-By: RuFlo <ruflo-bot@users.noreply.github.com>
2026-05-21 23:21:29 -04:00
rUvandReuven ef73a1616f feat(ruflo-agent): rename ruflo-wasm → ruflo-agent + Claude Managed Agents (cloud) runtime — ADR-115 (proposed→accepted, implemented) (#1929)
* docs(adr): ADR-115 — Claude Managed Agents as a cloud backend for rvagent (explored + validated)

Records the proposal to add `runtime: "managed"` to ruflo's rvagent
interface (ruflo-wasm / @ruvector/rvagent-wasm / wasm_agent_* MCP tools),
backed by Anthropic's Claude Managed Agents API (beta), as a second backend
alongside the local WASM sandbox — mirroring the ConsensusTransport
LocalTransport|FederationTransport pattern (ADR-095 G2 / ADR-104). The
agent/environment/session/events model maps ~1:1 to wasm_agent_create/
prompt/files/terminate + the gallery.

Validated live against api.anthropic.com/v1 with the org's Anthropic key
(GCP claude-flow/anthropic-api-key): created an agent + environment + session,
sent a bash task, observed the full event log (status_running → user.message
→ tool_use(bash) → tool_result → agent.message("Done.") → status_idle,
stop_reason end_turn), cleaned up. ~7s for a trivial Haiku task.

High-value combos noted: ruflo's own MCP server as a Managed Agent tool
source (cloud-hosted ruflo, zero local infra); Managed Agent session as a
third task_assign executor (closes #1916 items 3/4); long-running/async work;
skills + define-outcomes parity. Constraints: opt-in/off-by-default, needs
ANTHROPIC_API_KEY + beta access, plugin-level @anthropic-ai/sdk dep,
cost-tracking + orphaned-session GC, beta churn, branding.

Status: proposed. Registered in AgentDB (adr-ADR-115) + adr-patterns.

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

* refactor(plugins): rename ruflo-wasm → ruflo-agent (agent-runtimes home; ADR-115 prep)

`ruflo-wasm` only covered local WASM-sandboxed agents (rvagent —
@ruvector/rvagent-wasm, the wasm_agent_*/wasm_gallery_* MCP tools). It's
becoming the home for *all* ruflo agent runtimes: the existing local-WASM
backend plus Anthropic's Claude Managed Agents as a cloud backend (ADR-115),
behind one interface — same local-vs-cloud pattern as ConsensusTransport.

- git mv plugins/ruflo-wasm → plugins/ruflo-agent
- plugin.json: name ruflo-wasm → ruflo-agent; description/keywords now span
  both runtimes (rvagent/wasm + managed-agents/anthropic/cloud)
- .claude-plugin/marketplace.json entry renamed
- README / plugins/README / docs/index / cli README / ruflo README /
  discover-plugins SKILL / verification/inventory.json / ADR-115 — refs updated
- wasm_agent_* / wasm_gallery_* MCP tool names are unchanged (they stay; the
  plugin is just renamed). managed_agent_* tools land next per ADR-115.

(Left `ruflo-wasm-mcp` in ruvocal/workerClient.ts alone — unrelated worker MCP name.)

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

* feat(cli): managed_agent_* MCP tools — Claude Managed Agents cloud runtime (ADR-115)

Six new MCP tools wrapping Anthropic's Claude Managed Agents REST API (beta,
`anthropic-beta: managed-agents-2026-04-01`) via plain fetch — no new SDK dep:

  managed_agent_create    agents.create + environments.create + sessions.create   ↔ wasm_agent_create (CLOUD counterpart)
  managed_agent_prompt    events.send(user.message) + poll events until idle       ↔ wasm_agent_prompt
  managed_agent_status    GET /v1/sessions/{id}
  managed_agent_events    GET /v1/sessions/{id}/events  (full transcript)           ↔ wasm_agent_files
  managed_agent_list      GET /v1/sessions
  managed_agent_terminate DELETE /v1/sessions/{id} (+ optionally the env)           ↔ wasm_agent_terminate

Needs ANTHROPIC_API_KEY (or CLAUDE_API_KEY); every tool degrades gracefully
with a structured "use wasm_agent_* for a local no-key runtime" error when the
key is absent — the CLI/MCP server stays up. ADR-112-compliant descriptions
(each says when wasm_agent_* / native is the right call instead). Registered
in mcp-client.ts. Lives conceptually in the `ruflo-agent` plugin (the
`ruflo-wasm`→`ruflo-agent` rename in the prior commit).

Validated live against api.anthropic.com with the org's Anthropic key (GCP
claude-flow/anthropic-api-key) via `ruflo mcp exec -t managed_agent_*`:
create (haiku) → prompt ("echo … > /tmp/r.txt && cat") → got finished:true,
status:idle, stopReason:end_turn, assistantText:"Done.", toolUses:[bash],
13 events → terminate (sessionDeleted+environmentDeleted). No-key path returns
the graceful error. audit-cli-mcp-tools 311 registered/0 dangling;
audit-tool-descriptions 0 no-guidance; cli build clean.

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

* feat(ruflo-agent): wire the managed-agent (cloud) runtime into the plugin + CI smoke

- skills/managed-agent/SKILL.md — drives the cloud runtime: managed_agent_create
  / prompt / status / events / list / terminate, with the WASM-vs-managed
  decision table, the ANTHROPIC_API_KEY prereq + graceful fallback, the
  mcpServers-reachability caveat, and the cost/cleanup discipline (a cloud
  session bills until terminated). Explicit allowed-tools (no wildcard).
- commands/managed-agent.md — quick "list cloud sessions / status / transcript
  / clean up" command (the cloud sibling of /wasm).
- plugin.json — kept rvagent-wasm + ruvllm-wasm keywords (still built on those);
  added managed-agents/anthropic/cloud.
- smoke.sh: step 1 now also asserts name=ruflo-agent + the managed-agents
  keywords; step 10 expects ADR-0001 status `Accepted` (was stale `Proposed`,
  pre-existing red); new step 12 — managed-agent skill+command exist + all 6
  managed_agent_* tools referenced + the skill keeps an explicit allowed-tools
  list + offers the wasm_agent_create fallback. 12 passed / 0 failed.
- .github/workflows/ruflo-agent-smoke.yml — new CI job running smoke.sh on any
  plugins/ruflo-agent/** change (the plugin had no CI gate before).

Validated: `claude --plugin-dir plugins/ruflo-agent` loads the plugin and lists
its skills (managed-agent, wasm-agent, wasm-gallery); plugin.json + all skill
frontmatters parse; smoke.sh 12/0.

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

* docs(adr): ADR-115 → Accepted + Implementation section (managed_agent_* landed)

Status Proposed → Accepted. Added an Implementation (2026-05-12) section:
the ruflo-wasm→ruflo-agent rename, the 6 managed_agent_* MCP tools (plain
fetch, no new SDK dep, graceful no-key degradation, ADR-112 descriptions),
the managed-agent skill+command, the smoke.sh/ruflo-agent-smoke.yml CI guard,
the live e2e validation (create→prompt→terminate against api.anthropic.com
with the GCP anthropic-api-key) and `claude --plugin-dir` validation, and the
called-out follow-ups (runtime:"managed" unification, deployed HTTP ruflo MCP
server for the cloud-hosted-ruflo combo, task_assign/federation dispatch to a
Managed Agent session, cost-tracking + orphaned-session GC, multiagent/outcomes).
Tracking issue: #1931.

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

* test(cli): no-network guard for managed_agent_* tools (ADR-115)

__tests__/managed-agent-tools.test.ts (10 cases): the 6 managed_agent_*
tools are registered; each has an object inputSchema + a ≥80-char,
ADR-112-ish, unique description that names the wasm_agent_*/native fallback;
and — crucially — every handler degrades gracefully with no ANTHROPIC_API_KEY/
CLAUDE_API_KEY: no throw, structured error mentioning the key + the
wasm_agent_create fallback, no network call (so the CLI/MCP server stays up
offline). Plus managed_agent_prompt's missing-sessionId/message validation.

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

* docs(adr): ADR-115 — add the third runtime (Claude Agent SDK) to the picture

ADR-115 adds the *cloud* runtime (Managed Agents); add a section noting the
natural *third* runtime — the Claude Agent SDK (@anthropic-ai/claude-agent-sdk,
"Claude Code as a library": query()/ClaudeSDKClient, hooks, subagents, MCP,
permission modes, sessions, loads .claude/ config + plugins; runs in-process,
full host trust). ruflo-agent → three runtimes behind one model:

  WASM (rvagent)   local sandbox, no host fs/net   untrusted/portable/offline
  SDK  (future)    your process, your filesystem    a real Claude agent loop on the local repo — the in-process `claude -p`
  Managed          Anthropic cloud container        long-running/async, no local infra

The SDK runtime's killer combo: `mcpServers: { ruflo: { command: "npx", args: ["ruflo","mcp","start"] } }` — a *local* stdio MCP server, so the agent gets ruflo's 314 tools with zero deployment (vs Managed Agents needing a reachable URL). Anthropic positions SDK→Managed as prototype→production. Costs: heavy dep (bundles a Claude Code binary), full host trust (no sandbox — least isolated), needs an API key. Implementing it = a follow-up, likely ADR-116 (tracked in #1931).

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

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-12 10:24:03 -04:00
rUvandReuven 70e2339469 feat(federation): ADR-111 Phases 4-6 — firewall projection + witness chain + MCP tools (#1895)
* feat(federation): ADR-111 Phases 4-6 — firewall projection + witness chain + MCP tools

Phases 4-6 of ADR-111. Phase 7 (cross-OS WG mesh bringup) is operator-mediated
and lives outside the package — staged but not auto-executed per CLAUDE.md
destructive-actions guidance.

## Phase 4 — Trust-graded firewall projection
`domain/services/wg-firewall-service.ts` (new)
- Two backends: linux-nftables (atomic `nft -f`, table `inet ruflo_fed`,
  default DROP, interface-scoped) and darwin-pf (anchor-scoped pfctl).
- Projects WG_NETWORK_GATES → concrete rule lines per peer.
- UNTRUSTED excluded (no mesh IP), peers without wgMeshIP skipped.
- Defense-in-depth: regex-validated rule args (no shell metachars in
  pubkey/IP/iface).
- Returns rule file content + the load command the operator runs —
  service never shells out.
- 16 unit tests.

## Phase 5 — Witness attestation chain
`domain/services/wg-witness-service.ts` (new)
- Append-only chain of Ed25519-signed entries. Each entry hash-links to
  the previous (`prevHash` = sha256 of previous canonical encoding).
- Canonical encoding: sorted keys, no whitespace, omitted-on-undefined.
- `verifyWitnessChain` walks the chain and reports `failedAt` + reason
  (`broken-chain-link` | `invalid-signature-or-hash`).
- `attestWgCommand` adapter maps WgCommand.verb → event type.
- 11 unit tests (canonicalization stability, deterministic hash,
  chain link integrity, signature-tamper detection).

## Phase 6 — Operator MCP tools
`mcp-tools.ts` (extended)
- `federation_wg_status` — per-peer mesh state (trust, meshIP, AllowedIPs,
  suspended/evicted flags) via `WgMeshService.summarize()`.
- `federation_wg_attest` — operator-signed witness chain entry. v1 stub
  returns wire-up instructions until plugin.ts integrates WgWitnessService.
- `federation_wg_keyrotate` — emits a new X25519 keypair (public key only
  via MCP; private key write is operator-mediated) + the upgrade checklist.
  Requires `confirm: true` (destructive — drops existing tunnels until peers
  fetch updated manifest).
- `createMcpTools` gets optional `getWgMesh` getter (additive, no break).
- `FederationCoordinator.listPeers()` added as public discovery accessor.

## Tests
- 543/543 pre-existing + new tests pass (513 + 27 phase 4/5 + 3 plugin
  test count assertions for the new MCP tools).

## Not in this PR (Phase 7 — operator-mediated)
- Real WG mesh bringup on mac↔ruvultra over tailscale: stage configs,
  operator-approved `wg-quick up`, peer-add via federation manifests,
  SUSPEND → confirm L3 isolation → reactivate restores, witness-verify
  the change log. Tracked alongside #1879.

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

* fix(federation): security — validate peer wg fields before splice (ADR-111)

Manual security audit of ADR-111 Phases 1-6 found a real vulnerability in
Phase 2's WgMeshService that the existing tests did not catch.

## The bug

`WgMeshService.buildInterfaceConfig()` and `summarize()` spliced
`peer.metadata.wgPublicKey` / `wgMeshIP` / `wgEndpoint` into the wg-quick
config string *without validation*. The ADR's threat model explicitly
includes "compromised federation peer with valid WG key" — that peer
signs their own manifest, so the Ed25519 signature only proves origin,
not content safety.

Concrete attack: a compromised peer publishes

  wgEndpoint = "host:51820\n[Peer]\nPublicKey = attacker\nEndpoint = ..."

and the operator's wg-quick config ends up with an extra [Peer] block.
Cross-peer lateral movement, bypassing the per-peer trust gates.

Phase 4 (WgFirewallService) already validated meshIP via
`assertSafeRuleArg`. Phase 2 didn't — fixed here.

## The fix

New `readSafePeerWgFields(peer)` returns the validated triple or null.
Three regexes:
  - wgPublicKey: ^[A-Za-z0-9+/]{43}=$            (base64 X25519, 32 raw bytes)
  - wgMeshIP:    ^d.d.d.d/32$ + octet range check
  - wgEndpoint:  ^(hostname|ipv4|[ipv6]):port$  + port range check

Mismatched fields → peer is skipped entirely (no [Peer] block, no
AllowedIPs, summarize() returns empty strings). Silent skip beats partial
write because partial writes can leak attacker content into operator
review while looking syntactically valid.

## Tests

7 new adversarial cases under `WgMeshService — readSafePeerWgFields
(compromised-peer defense)`:
  - newline injection in wgEndpoint
  - wrong-length / non-base64 wgPublicKey
  - out-of-range octet in wgMeshIP
  - missing /32 CIDR
  - port out of range
  - IPv6 bracket positive case
  - summarize() also sanitizes (regression: it used the same unsafe path)

Full suite: 550/550 pass.

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

* feat(federation): ADR-111 Phase 7 staging helper

Generates WG keypair + wg-quick config + per-OS firewall rules on the
current host, naming a single peer. Outputs go to /tmp/adr-111-stage.
Nothing loaded into the kernel — wg-quick up / nft -f / pfctl -f are
operator-mediated.

Usage:
  node scripts/phase7-stage.mjs <localId> <peerId> <peerPk> <peerIP> <peerEndpoint>

Workflow:
  1. Run on host A with placeholder peer values → emit host-A pubkey
  2. Run on host B with placeholder peer values → emit host-B pubkey
  3. Re-run on both with the OTHER host's pubkey → final config files
  4. Operator reviews + activates per the printed checklist

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

* fix(federation): ADR-111 phase7-stage idempotent — reuse key file

Without persistence, every run generates a fresh keypair, which breaks
the cross-feed workflow (run on host A → capture pubkey → run on host B
with A's pubkey → A regenerates a different key on its next run).

Now reads /tmp/adr-111-stage/wg-key-<nodeId>.json if present, falls back
to fresh generation if not. Operator can delete the file to force
rotation.

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

* docs(federation): user guide + Phase 7 bringup procedure + README link

Adds:
  - docs/federation/README.md — full user guide (when to use, MCP tools,
    trust levels, breaker, ADR-111 mesh layer, claude -p headless usage)
  - docs/federation/phase7-mesh-bringup.md — step-by-step cross-OS WG
    mesh activation procedure with operator review checklist
  - README.md — link to docs/federation/ from the existing Federation
    section

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

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-10 23:03:19 -04:00
ReuvenandRuFlo b5a57cbf18 docs: add docs/validation/ — in-repo home for the agentic validation system
Single-file README at docs/validation/README.md covering all three
regression layers (behavioral smoke, cryptographic witness, temporal
history) with cross-references to ADR-102, ADR-103, the witness
manifest, the toolkit scripts, and the CI workflow.

Includes the four CI Integration Pitfalls discovered during the
2026-05-08 work — pnpm isolated linker, CLI dogfood gotcha,
workspace:* protocol, silent set -e exits — with concrete YAML/JS
fixes for each.

The public gist at gist.github.com/ruvnet/ee7763c36f7a9a1c1886da783abc872b
remains the external-friendly version (no ruflo-specific paths);
this doc is the authoritative in-repo source.

Linked from docs/index.md under "Trust & Security".

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-09 00:03:43 -04:00
ReuvenandRuFlo 6c14c912e5 docs(userguide): update for v3.7 — substrate upgrades + agentdb delete tools
- Header: v3.5 -> v3.7 reference; surface npx ruflo@latest version
- New "What is new in 3.7" section covering: cli-core split (alpha.5+),
  Thompson sampling router (alpha.5), neural@3.0.0-alpha.8 substrate
  upgrades (persistence / seedable RNG / self-consistency / Flash Attention
  + MoE migration / retrieval-path observability / SEO keywords), and the
  3 new agentdb_*-delete MCP tools (alpha.8)
- AgentDB integration: bumped reference 3.0.0-alpha.10 -> 3.0.0-alpha.13
  and called out the new Cypher-routed delete API

End-user CLI surface unchanged. The "What did not change" callout makes
that explicit so 3.6 users can upgrade without relearning anything.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-06 10:58:41 -04:00
rUvandReuven 2029c71e6a docs: fix init/MCP drift surfaced in #1744 install study (#1751)
* docs: fix init/MCP drift surfaced in #1744 install study

Two papercuts from @ruvnet's methodical install study (issue #1744):

1. README + USERGUIDE both show `npx ruflo@latest init --wizard` in
   five places. Per the source (`v3/@claude-flow/cli/src/commands/init.ts:445-447`),
   `wizard` is registered as a subcommand: `subcommands: [wizardCommand, ...]`.
   The flag form may parse but the canonical form (and what `init --help`
   surfaces) is `init wizard`. Updated all 5 occurrences.

2. README's MCP add command:
     claude mcp add ruflo -- npx -y @claude-flow/cli@latest
   uses the legacy package name. USERGUIDE.md and `ruflo mcp --help` use
   the canonical:
     claude mcp add ruflo -- npx ruflo@latest mcp start
   Both still work, but having two different commands across docs is
   the kind of "wait, what?" papercut #1744 logged. Updated README.

No CLI behavior changes. Pure doc consistency.

Closes part of #1744.

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

* docs(USERGUIDE): fix one straggler 'init --wizard' in command-mapping table

Companion to the previous commit on this branch. Caught the row at
USERGUIDE.md:7413 that the regex replace_all missed because the table
row had a different surrounding pattern.

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

---------

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
2026-05-05 09:46:27 -04:00
Reuven 8c0d580111 docs: split STATUS doc + cross-link verification.md from root README
Three docs for three audiences instead of two:
  - Status — what currently works (capability counts, test baselines,
    recent fixes, what's next)
  - User Guide — daily reference (deep, every-flag-documented)
  - Verification — cryptographic witness, run `ruflo verify`

docs/STATUS.md (new):
  Overview + Usage + Status in one document. Pulls live numbers
  (300 MCP / 49 CLI / 32 plugins / 43 agents from inventory script
  + 1933/1933 vitest baseline + ADR-093/095/096/097 status).
  Acts as the "is it ready?" doc — complements USERGUIDE.md
  (the "how do I?" doc) and verification.md (the "trust but
  verify" doc).

README.md:
  Documentation section restructured to a 3-row table with
  audience-keyed descriptions. User Guide section index kept
  intact. No other content churn — the pitch + install +
  feature sections are unchanged.

Closes the user request for a separate overview/usage/status doc
plus a README cross-link to verification.md.
2026-05-03 21:37:30 -04:00
Reuvenandclaude-flow 81418649c6 feat: add 19 Claude Code native plugins with 64 skills, 25 commands, 21 agents
Complete plugin marketplace for Ruflo with validated Claude Code plugin format:

- ruflo-core: MCP server, status, doctor, plugin discovery
- ruflo-swarm: swarm coordination, Monitor, worktree isolation
- ruflo-autopilot: autonomous /loop completion with learning
- ruflo-intelligence: SONA neural patterns, trajectory learning, routing
- ruflo-agentdb: AgentDB controllers, HNSW vector search, RuVector
- ruflo-aidefence: AI safety scanning, PII detection, prompt defense
- ruflo-browser: Playwright browser automation, testing, scraping
- ruflo-jujutsu: git diff analysis, risk scoring, reviewer recs
- ruflo-wasm: sandboxed WASM agents and gallery sharing
- ruflo-workflows: workflow templates, orchestration, lifecycle
- ruflo-daa: Dynamic Agentic Architecture, cognitive patterns
- ruflo-ruvllm: local LLM inference, MicroLoRA, SONA, chat format
- ruflo-rvf: RVF portable memory, session persistence, transfer
- ruflo-loop-workers: background /loop workers, CronCreate
- ruflo-security-audit: CVE scanning, dependency checks
- ruflo-rag-memory: simple store/search/recall interface
- ruflo-testgen: test gap detection, TDD workflow
- ruflo-docs: doc generation, drift detection
- ruflo-plugin-creator: scaffold, validate, publish new plugins

All 19 pass `claude plugin validate`. Skills auto-discovered from
directory structure (not declared in plugin.json). Each skill wires
to ruflo MCP tools via allowed-tools frontmatter.

Includes: marketplace.json, GitHub Pages storefront, CI validation
workflow, minimalist README with USERGUIDE split.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-27 23:07:33 -04:00
rUv 4c651cd098 release: v3.5.3 — publish fixes, branding, cleanup
- Bump all packages to 3.5.3 (@claude-flow/cli, claude-flow, ruflo)
- Update statusline branding: Claude Flow V3 → RuFlo V3
- Update settings.json version: 3.0.0 → 3.5.2
- Update README title: RuFlo v3.5
- Update ADR-059 with fix confirmations and resolution log
- Remove stale docs/ruvector-postgres (superseded by AgentDB)
- Remove stale packages/coflow (superseded by @claude-flow/cli)

Published to npm:
  @claude-flow/cli@3.5.3 (alpha, latest, v3alpha)
  claude-flow@3.5.3 (alpha, latest, v3alpha)
  ruflo@3.5.3 (alpha, latest)

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-05 18:30:28 +00:00
rUvandClaude Opus 4.5 98daec41f0 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T21:06:32Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:06:32 +00:00
rUvandClaude Opus 4.5 8a3d41ce5d Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T21:06:17Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:06:17 +00:00
rUvandClaude Opus 4.5 b42e8a1e44 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T21:06:05Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:06:05 +00:00
rUvandClaude Opus 4.5 5500f82c66 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T21:05:58Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:05:58 +00:00
rUvandClaude Opus 4.5 5dac60f00b Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:54:54Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:54:54 +00:00
rUvandClaude Opus 4.5 40fd95bb6b Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:50:37Z
- Changes: 6 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:50:37 +00:00
rUvandClaude Opus 4.5 4b0ad3ce90 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:48:52Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:48:52 +00:00
rUvandClaude Opus 4.5 56430b555a Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:45:49Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:45:49 +00:00
rUvandClaude Opus 4.5 1d3910bbef Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:44:33Z
- Changes: 2 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:44:33 +00:00
rUvandClaude Opus 4.5 7eff4ba8f4 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:40:57Z
- Changes: 10 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:40:57 +00:00
rUvandClaude Opus 4.5 481b84fa6e Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:37:25Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:37:25 +00:00
rUvandClaude Opus 4.5 4260c2a209 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:36:56Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:36:56 +00:00
rUvandClaude Opus 4.5 88ddf4c106 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:36:53Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:36:53 +00:00
rUvandClaude Opus 4.5 06f38f3271 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:36:49Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:36:49 +00:00
rUvandClaude Opus 4.5 db2421c8b0 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:34:04Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:34:04 +00:00
rUvandClaude Opus 4.5 cccdee45b4 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:33:18Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:33:19 +00:00
rUvandClaude Opus 4.5 a1119d7704 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:32:05Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:32:05 +00:00
rUvandClaude Opus 4.5 d1ab350ef1 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:31:13Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:31:13 +00:00
rUvandClaude Opus 4.5 e2b79c955c Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:31:12Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:31:12 +00:00
rUvandClaude Opus 4.5 a127f3d65f Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:31:11Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:31:11 +00:00
rUvandClaude Opus 4.5 95efea2721 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:31:09Z
- Changes: 6 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:31:09 +00:00
rUvandClaude Opus 4.5 70115d2ec5 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:27:03Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:27:03 +00:00
rUvandClaude Opus 4.5 ac990a2ad2 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:27:02Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:27:02 +00:00
rUvandClaude Opus 4.5 a207caa4e2 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:27:01Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:27:01 +00:00
rUvandClaude Opus 4.5 95f9257277 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:26:35Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:26:35 +00:00
rUvandClaude Opus 4.5 6adc8e9532 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:26:34Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:26:34 +00:00
rUvandClaude Opus 4.5 e464c11cdc Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:25:59Z
- Changes: 10 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:25:59 +00:00
rUvandClaude Opus 4.5 1b6a1971f7 feat(v3): add comprehensive v3 implementation plans and swarm architecture
- Reorganize v3/ into implementation/ subfolders:
  - planning/, architecture/, migration/, integration/
  - security/, adrs/, research/, swarm-plans/

- Add 15-agent concurrent swarm implementation plans:
  - SWARM-OVERVIEW.md: Hierarchical mesh topology, 4 phases
  - AGENT-SPECIFICATIONS.md: 15 agent configs with capabilities
  - TDD-LONDON-SCHOOL-PLAN.md: Mock-first TDD methodology
  - BENCHMARK-OPTIMIZATION.md: Performance targets (2.49x-7.47x)
  - DEPLOYMENT-PLAN.md: Release strategy, CI/CD, rollback
  - GITHUB-ISSUE-TRACKING.md: Issue workflow with agent replies

- Update .claude/settings.json with proper hooks format
- Add bash aliases for claude --dangerously-skip-permissions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 15:40:51 +00:00
Claude b592a9dc8b docs: add background worker system section to v3 SDK architecture
Comprehensive analysis of agentic-flow worker system:
- 12 built-in workers (ultralearn, optimize, audit, etc.)
- TriggerDetector with <5ms keyword detection
- WorkerDispatchService with RuVector integration
- Consolidated phase system (10 phases)
- Worker-agent integration with performance-based selection
- Custom worker factory with YAML config support
- Benchmark system with p95 latency targets
- RuVector trajectory tracking and learning
- @claude-flow/workers package specification
2026-01-03 22:30:32 +00:00
Claude ea23392bb0 docs: add comprehensive missing sections to v3 SDK architecture
Added 11 new sections (11.9-11.19) covering:
- Shared types package (@claude-flow/types)
- Monorepo management (pnpm + Turborepo + Changesets)
- Testing strategy (unit, integration, e2e, mocks)
- Error handling & recovery (error codes, circuit breaker)
- Security model (secrets, sandboxing, PII, audit)
- Telemetry & observability (OpenTelemetry, distributed tracing)
- Migration path v2→v3 (codemods, compat shim, timeline)
- Plugin & extension system (third-party hooks, agents)
- Configuration cascade (6-level priority)
- Build & CI/CD pipeline (GitHub Actions, changesets)
- Offline & degraded mode (feature detection, fallbacks)

Document now covers all aspects of modular package architecture.
2026-01-03 22:07:25 +00:00
Claude de0cb90b8b docs: add comprehensive SDK architecture analysis for v3
Deep review of agentic-flow@alpha and ruvector ecosystem:
- SDK foundation with 19 hooks, 9 RL algorithms
- Production wrappers fixing alpha issues (11-200x speedups)
- SONA+AgentDB integration (~1.25ms training)
- QUIC swarm coordination with attention mechanisms
- Cross-platform SQLite persistence

Modular package constellation design (@claude-flow/*):
- 10 packages: core, hooks, learning, swarm, memory, agents, mcp, neural, attention, vector
- Optional peer dependencies - works standalone or integrated
- Event-driven cross-module communication
- Progressive enhancement (50KB to 15MB)
- Mix and match installation combinations
2026-01-03 21:38:20 +00:00
Claude 0bb7c36ada docs: add hooks & learning integration analysis for v3
Key findings from agentic-flow@alpha research:
- 19 hook tools already available (10 original + 9 intelligence)
- 9 RL algorithms with automatic task-based selection
- Trajectory tracking with SQLite persistence
- TensorCompress tiered storage (50-97% memory savings)
- Parallel learning with 7 workers (3-4x faster)
- HNSW index for 150x faster pattern search

Recommendation: Use agentic-flow@alpha as learning backbone,
Claude-Flow v3 adds thin integration layer and swarm coordination.
2026-01-03 21:26:58 +00:00
Claude 076e59cb9a docs: add lightweight modular installation strategy for v3
- Add sections 16-20 to integration analysis:
  - Lightweight installation (~2MB core)
  - Modular components (memory, learning, attention, etc.)
  - Platform-specific guides (Linux/Mac/Windows)
  - Testing strategy with benchmark suite
  - Error handling & graceful degradation
  - Monitoring & observability
  - Security considerations

- Add sections 9-12 to learning plan:
  - Three-tier learning (basic/standard/advanced)
  - Platform-optimized learning installation
  - Lazy loading configuration
  - Quick start recipes for different use cases
  - Upgrade paths with data migration
  - Troubleshooting guide
2026-01-03 21:12:18 +00:00
Claude 8c89f82388 docs: add optimized learning plan integrating agentdb@alpha
New document: LEARNING-OPTIMIZED-PLAN.md
- Integrates agentic-flow@2.0.1-alpha.50 (19 hooks) + agentdb@2.0.0-alpha.3.1 (9 learning tools)
- Combined 28 learning hooks for comprehensive self-learning
- 9 RL algorithms: Q-Learning, SARSA, DQN, PPO, Actor-Critic, etc.
- Nightly learning pipeline with FlashAttention consolidation
- Pre/during/post task hooks for continuous learning

Key agentdb@alpha features analyzed:
- LearningSystem: 9 RL algorithms with policy training
- ReflexionMemory: Self-improvement through experience
- SkillLibrary: Pattern storage and retrieval
- CausalMemoryGraph: Cause-effect reasoning
- NightlyLearner: Automated causal discovery with doubly robust learner
- AttentionService: FlashAttention for memory-efficient consolidation
- HNSWIndex: 150x faster vector search
2026-01-03 20:44:27 +00:00
Claude 46055458d4 docs: complete deep review of agentic-flow@alpha integration opportunities
Added comprehensive analysis sections:
- Transport Layer: QUIC/WASM architecture with 5-15x connection speedup
- Current Usage Patterns: Mapped all 29 integration points
- SONA Integration: Self-Optimizing Neural Architecture tools
- Specific Recommendations: 10 prioritized integration points

Key findings:
- QUIC transport enables 16.8x faster agent spawn
- HybridReasoningBank provides WASM fallback for Windows
- Intelligence bridge adds 9 new learning tools
- AttentionCoordinator replaces basic voting with 5 mechanisms
- GNN-enhanced search provides +12.4% recall improvement
2026-01-03 20:08:00 +00:00
Claude 019d424244 docs: deep analysis of agentic-flow@alpha integration opportunities
Comprehensive analysis of agentic-flow@2.0.1-alpha.50 for v3 integration:

Key findings:
- EnhancedAgentDBWrapper: 50-200x faster than CLI
- AttentionCoordinator: 5 attention mechanisms (Flash, MoE, etc.)
- GNN Query Refinement: +12.4% recall improvement
- 19 hook tools (10 original + 9 intelligence tools)
- Auto runtime detection: NAPI → WASM → JS fallback

Integration points identified:
- SwarmCoordinator → AttentionCoordinator
- AgentManager → EnhancedAgentDBWrapper
- MemoryManager → HybridReasoningBank
- HookManager → Intelligence Bridge

Upgrade path from v1.9.4 to v2.0.1-alpha.50 documented
with 4-week implementation checklist.
2026-01-03 19:15:59 +00:00
Claude d2275169b9 feat: add optimized v3 plan focused on clean integration
Priority-focused implementation plan:
1. Security-first: Zero vulnerabilities, Zod validation, bcrypt
2. Speed: Flash Attention (2.49x-7.47x), lazy loading
3. Self-learning: SONA profiles, Reflexion, AgentDB
4. Backward compatibility: 100% v2 API preservation
5. Init system: Unified controller with mode initializers

4-week implementation timeline with zero breaking changes.
2026-01-03 18:58:02 +00:00