Hybrid: the classic UserPromptSubmit hook runs everywhere; the module loads only where function hooks are on (Claude Code >= 2.1.287, or…

<a href="https://cognitum.one/agentic-engineering"><img src="ruflo/assets/ruflo-neon-flicker.gif" alt="Ruflo animated neon sign" width="100%"></a>
An agent meta-harness for Claude Code and Codex.
<!-- Try Ruflo — the 3 badges first-time visitors actually act on -->
<a href="docs/harness-origins.md"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/e69e4b95aa08d65ea0f7715489bbf8e62a83a0d2/docs/assets/readme/badges/first-commit.svg" width="300" height="76" alt="Claude Flow lineage: first commit June 2, 2025 by rUv; inspect the evidence"></a> <a href="data/npm-downloads.latest.json"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/275aff65a198af758923669acff36f03d1f41623/docs/assets/readme/badges/downloads.svg" width="300" height="76" alt="Illustrative download counter starts at 98,000,000 and adds varied amounts each second in a 30 second loop. Verified dataset: 97,022,120 download events."></a> <a href="https://github.com/ruvnet/claude-flow"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/d1e80400bdefe01d3b13e70395f88fffab76bb18/docs/assets/readme/badges/claude.svg" width="300" height="76" alt="Claude Code plugin"></a> <a href="https://www.npmjs.com/package/@claude-flow/codex"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/d1e80400bdefe01d3b13e70395f88fffab76bb18/docs/assets/readme/badges/codex.svg" width="300" height="76" alt="Codex plugin"></a> <a href="https://chatgpt.com/plugins/plugin_asdk_app_6ab674ff53c48191bb37040c343e31f3"><img src="docs/assets/readme/badges/chatgpt.svg" width="300" height="76" alt="ChatGPT plugin: RuFlo Federation"></a>
<a id="start-here"></a>
<img src="docs/assets/readme/icons/plugins.svg" width="28" height="28" alt=""> Start in Claude Code with core tools, the visual console and runtime mods. Requires Claude Code 2.1.287 or later. Run inside Claude Code:
/plugin marketplace add ruvnet/ruflo
/plugin install ruflo-core@ruflo
/plugin install ruflo-console@ruflo
/plugin install ruflo-mods@ruflo
/reload-plugins
/ruflo
Core provides foundation tools. Console opens the agent cockpit. Mods add routing and policy enforcement inside Claude Code. Mods run with your account's permissions; review their code before installing.
<img src="docs/assets/readme/icons/terminal.svg" width="28" height="28" alt=""> Using Codex or another MCP enabled tool? Use NPX for Ruflo project setup and connect your client to the Ruflo MCP server. Run the setup wizard in your project terminal:
npx ruflo@latest init wizard
For clients that support local stdio MCP servers, configure command npx and arguments ["-y", "ruflo@latest", "mcp", "start"]. The equivalent server command is:
npx -y ruflo@latest mcp start
MCP exposes Ruflo tools to your client. The console and mods above are Claude Code integrations; hook support depends on the client.
<img src="docs/assets/readme/icons/terminal.svg" width="28" height="28" alt=""> Prefer a plain terminal? Optional. The console also runs on its own, with no Claude Code: npx ruflo tui (add --plain to print one frame for scripts). It shows Overview, Cost, Swarm, Events and Missions, plus an optional AI page. Terminal UI guide
Compare install paths · Open the console · User guide
<a href="https://ruos.cognitum.one"><img src="ruflo/assets/ruos-animated.svg" alt="ruOS — A desktop that runs itself" width="100%"></a>
Connect ruOS to ChatGPT or Claude via MCP:
https://ruos.cognitum.one/mcp
<!-- RuVector promo --> <a href="https://github.com/ruvnet/ruvector"><img src="docs/assets/readme/ruvector-promo-depth.svg" width="100%" alt="RuVector: Give your agents memory. Local vector search, persistent context, graph relationships and feedback learning. Explore RuVector."></a>
npx ruvector
📖 RuFlo Explained — Build an AI Team That Plans, Remembers, Tests, and Improves A 14-chapter guide: from the basic idea to a first useful task, then memory, agent teams, plugins, cost and verification.
Agent = Model + Harness. The model writes; the harness gives it tools, memory, loops, sandboxes, and controls so it can actually work. Ruflo is the harness — the execution layer around Claude Code and Codex that adds 100+ specialized agents, coordinated swarms, self-learning memory, federated comms across machines, and enterprise security guardrails. So agents don't just run, they collaborate.
One npx ruflo init gives Claude Code a nervous system: agents self-organize into swarms, learn from every task, remember across sessions, and — with federation — securely talk to agents on other machines without leaking data. You keep writing code. Ruflo handles the coordination.
<sub>Conceptual learning loop. Local vector retrieval and contrastive updates can run without an LLM; embeddings and configured learning modules are still required. See the <a href="v3/@claude-flow/cli/src/services/ruvector-training.ts">RuVector training integration</a> and <a href="v3/@claude-flow/neural/src/modes/balanced.ts">trajectory contrastive learning</a>.</sub>
User → Ruflo (CLI/MCP) → Router → Swarm → Agents → Memory → LLM providers. Memory feeds useful experience back into routing. This is a conceptual flow, not a live execution trace.
New to Ruflo? You don't need to learn 314 MCP tools or 26 CLI commands. After
init, just use Claude Code normally — the hooks system automatically routes tasks, learns from successful patterns, and coordinates agents in the background.
Built by Reuven Cohen (rUv), originally as Claude Flow. The first commit, June 2, 2025, describes a code orchestration layer for recursive agent cycles: Claude writes, edits, tests and improves. The June 10 source snapshot adds orchestration, task scheduling, memory and terminal modules.
A harness is the workbench around the model: it organizes tasks, carries context between steps and helps check results. This establishes Ruflo's lineage, not a universal first across every Claude Code tool. See the illustrated explainer, exact commits and earlier ecosystem context.
Grok Build: npx ruflo init --grok writes the project host surface (.grok/, the team bus, and the operator guide) and nothing outside the project; add --dry-run to preview. Setup, the spawn_subagent contract, the optional status row, and what to re-check when Grok updates: the Grok operator guide.
Claude Flow is now Ruflo — named by
rUv, who loves Rust, flow states, and building things that feel inevitable. The "Ru" is the rUv. The "flo" is working until 3am. Underneath, powered byCognitum.Oneagentic architecture, running a supercharged Rust-based AI engine, embeddings, memory, and plugin system.
Open animated demo · Theme Studio guide · Workflow demo
<img src="docs/assets/readme/console-icon-workflows.svg" width="28" height="28" alt=""> Your agent cockpit. Track workflows, agents, models, tokens and cost beside Claude Code. The 38 second animation shows Orbital and Theme Studio through actual renderer frames, including boot checks, six palettes, customization, saved themes, JSON import and resizing. This compact 3.84 MB SVG retains all 456 frames. Native host and AI provider execution are not demonstrated.
<img src="docs/assets/readme/console-icon-inspect.svg" width="28" height="28" alt=""> Inspect any run. Open agent logs and results, search, triage failures, replay and compare. Start with npx ruflo init, restart Claude Code, then /ruflo. Full console tour.
<img src="docs/assets/readme/console-icon-control.svg" width="28" height="28" alt=""> Let Claude drive. You set the limits. Enable Settings → Claude control to navigate and run console actions. Choose read, write, manage or full, with ask or auto approval. The current default is read + ask; raising the level is your choice. Actions above your permission level are refused, and network, spending and destructive actions require confirmation even in auto. Review the live action log or press Take back control to stop Claude control. Details.
<a id="console-walkthrough"></a>
<img src="docs/assets/readme/console-icon-workflows.svg" width="28" height="28" alt=""> Watch the recorded console session below. Claude creates a mission, opens the Learning and Security pages, and reports its actions in Overview.
/ruflo, then choose Settings → Claude control → write + ask.What the recording demonstrates: a real Claude Haiku session with write + auto, mission creation, page navigation, a refused swarm stop, and control being taken back. The steps above use ask so you approve creation yourself. The linked workflow animation uses sample data, while the theme demo replays renderer frames. Neither is evidence of completed swarm work or memory recall.
Implementation and recorded test findings · Reproduction script
Install the mods from the ruflo marketplace (Claude Code 2.1.287 or later; mods run with your account's permissions and are not sandboxed, so read the code first):
/plugin marketplace add ruvnet/ruflo
/plugin install ruflo-console@ruflo
/plugin install ruflo-mods@ruflo
/reload-plugins
ruflo-console is the cockpit above, ruflo-mods routes prompts and enforces policy in-process, ruflo-swarm shows the swarm in a pane, and ruflo-ruos adds the ruOS status segment. Open /plugin to confirm they appear in the active mods line. Inside the console, /ruflo market is the Plugin Catalog: every ruflo plugin, mod and skill with what it ships, and buttons to install, enable, disable and update (each asks first).
There are two different install paths with very different surface areas. Pick based on what you need (#1744):
| Claude Code Plugin | CLI install (npx ruflo init) | |
|---|---|---|
| What it gives you | Slash commands + a few skills + agent definitions per-plugin | Full Ruflo loop — 98 agents, 60+ commands, 30 skills, MCP server, hooks, daemon |
| Files in your workspace | Zero | .claude/, .claude-flow/, CLAUDE.md, helpers, settings |
| MCP server registered | Only if ruflo-core is installed (it ships its own .mcp.json) — most other plugins don't | Yes |
| Hooks installed | No | Yes |
| Best for | Try a single plugin's commands without committing to the full install | Production use — everything works as documented |
# Add the marketplace
/plugin marketplace add ruvnet/ruflo
# Install core + any plugins you need
/plugin install ruflo-core@ruflo
/plugin install ruflo-swarm@ruflo
/plugin install ruflo-rag-memory@ruflo
/plugin install ruflo-neural-trader@ruflo
This adds slash commands and agent definitions. ruflo-core (installed above) does register its own MCP server on install — its tools are callable as mcp__plugin_ruflo-core_ruflo__* (e.g. mcp__plugin_ruflo-core_ruflo__memory_store), not the bare memory_store/swarm_init/agent_spawn names the CLI-track scaffold uses. Other plugins generally don't ship their own MCP server. For the full loop with the CLI-track tool names, use Path B below.
| Plugin | What it does |
|---|---|
| ruflo-core | Foundation — server, health checks, plugin discovery |
| ruflo-swarm | Coordinate multiple agents as a team |
| ruflo-autopilot | Let agents run autonomously in a loop |
| ruflo-loop-workers | Schedule background tasks on a timer |
| ruflo-workflows | Reusable multi-step task templates |
| ruflo-federation | Agents on different machines collaborate securely |
| Plugin | What it does |
|---|---|
| ruflo-agentdb | Fast vector database for agent memory |
| ruflo-rag-memory | Smart retrieval — hybrid search, graph hops, diversity ranking |
| ruflo-rvf | Save and restore agent memory across sessions |
| ruflo-ruvector | ruvector — GPU-accelerated search, Graph RAG, 103 tools |
| ruflo-knowledge-graph | Build and traverse entity relationship maps |
| Plugin | What it does |
|---|---|
| ruflo-intelligence | Agents learn from past successes and get smarter |
| ruflo-graph-intelligence | Sublinear graph reasoning — PageRank, delta updates, complexity-aware execution (ADR-123) |
| ruflo-daa | Dynamic agent behavior and cognitive patterns |
| ruflo-ruvllm | Run local LLMs (Ollama, etc.) with smart routing |
| ruflo-goals | Break big goals into plans and track progress |
| Plugin | What it does |
|---|---|
| ruflo-testgen | Find missing tests and generate them automatically |
| ruflo-browser | Automate browser testing with Playwright |
| ruflo-jujutsu | Analyze git diffs, score risk, suggest reviewers |
| ruflo-docs | Generate and maintain documentation automatically |
| agentic-qe-fleet | External, maintained by Agentic QE: 11 QE agents, test generation, coverage, chaos and TDD skills, the agentic-qe MCP server, and a guard for AQE learning data (/plugin install agentic-qe-fleet@ruflo). Install it from one marketplace only, agentic-qe or ruflo: enabled from both, its mod and commands load twice |
| Plugin | What it does |
|---|---|
| ruflo-security-audit | Scan for vulnerabilities and CVEs |
| ruflo-aidefence | Block prompt injection, detect PII, safety scanning |
| Plugin | What it does |
|---|---|
| ruflo-adr | Track architecture decisions with a living record |
| ruflo-ddd | Scaffold domain-driven design — contexts, aggregates, events |
| ruflo-sparc | Guided 5-phase development methodology with quality gates |
| ruflo-metaharness | Grade your agent setup, scan tool configs for security risks, and track changes over time (guide) |
| ruflo-arena | Competitive ruliology — pit agent strategies against each other in tournaments, hill-climb and co-evolve the winners (ADR-147/148) |
| Plugin | What it does |
|---|---|
| ruflo-migrations | Manage database schema changes safely |
| ruflo-observability | Structured logs, traces, and metrics in one place |
| ruflo-cost-tracker | Track token usage, set budgets, get cost alerts |
| Plugin | What it does |
|---|---|
| ruflo-agent | Run agents — local WASM sandbox (rvagent) + Anthropic Claude Managed Agents (cloud), with opt-in bounded dynamic workflows, gated session controls and verified advisory learning |
| ruflo-plugin-creator | Scaffold, validate, and publish your own plugins |
| Plugin | What it does |
|---|---|
| ruflo-iot-cognitum | IoT device management — trust scoring, anomaly detection, fleets |
| ruflo-neural-trader | neural-trader — AI trading with 4 agents, backtesting, 112+ tools |
| ruflo-market-data | Ingest market data, vectorize OHLCV, detect patterns |
macOS / Linux / WSL / Git-Bash:
# One-line install (POSIX shells only — see Windows note below)
curl -fsSL https://cdn.jsdelivr.net/gh/ruvnet/ruflo@main/scripts/install.sh | bash
All platforms (including native Windows PowerShell / cmd):
# Interactive setup wizard — runs identically on every platform
npx ruflo@latest init wizard
# Quick non-interactive init
# npx ruflo@latest init
# Or install globally
npm install -g ruflo@latest
💡 Windows users: the
curl ... | bashform needs a POSIX shell (Git-Bash, WSL, MSYS). Thenpx ruflo@latest init wizardline works natively in PowerShell and cmd. If you hit an'bash' is not recognizederror, use thenpxline instead — both end up running the same init flow.
# Add Ruflo as an MCP server in Claude Code
claude mcp add claude-flow -- npx ruflo@latest mcp start
<table> <tr><td width="50%"><a href="plugins/ruflo-swarm/README.md"><img src="docs/assets/readme/card-swarm.svg" width="100%" alt="Agent teams"></a></td><td width="50%"><a href="plugins/ruflo-rag-memory/README.md"><img src="docs/assets/readme/card-memory.svg" width="100%" alt="Persistent memory"></a></td></tr> <tr><td width="50%"><a href="plugins/ruflo-intelligence/README.md"><img src="docs/assets/readme/card-learning.svg" width="100%" alt="Learning loops"></a></td><td width="50%"><a href="plugins/ruflo-security-audit/README.md"><img src="docs/assets/readme/card-security.svg" width="100%" alt="Security controls"></a></td></tr> <tr><td width="50%"><a href="https://ruvnet.github.io/ruflo"><img src="docs/assets/readme/card-plugins.svg" width="100%" alt="Plugin marketplace"></a></td><td width="50%"><a href="plugins/ruflo-ruvllm/README.md"><img src="docs/assets/readme/card-routing.svg" width="100%" alt="Models and routing"></a></td></tr> </table>
| Capability | Description |
|---|---|
| <img src="docs/assets/readme/icons/agents.svg" width="28" height="28" alt=""> 100+ Agents | Specialized agents for coding, testing, security, docs, architecture |
| <img src="docs/assets/readme/icons/network.svg" width="28" height="28" alt=""> Comms Layer | Zero-trust federation — agents across machines/orgs discover, authenticate, and exchange work securely |
| <img src="docs/assets/readme/icons/swarm.svg" width="28" height="28" alt=""> Swarm Coordination | Hierarchical, mesh, and adaptive topologies with consensus |
hooks/register.ts 62 lines1import type { Hook, Register } from 'claude-code'
2
3import { show, statusLine, type Host } from './host'
4import { newCounters, STATUS_PATH, statusText, type Counters } from './status'
5
6type Dollar = Parameters<Hook<'session.start'>>[0]
7
8/** What one session keeps: the counters for the status file, the project root and the start time. */
9type Session = { readonly counters: Counters; root?: string; startedMs: number }
10
11/** A top-level function declaration, so `import type { Hook, Register } from 'claude-code'
12
13import { show, statusLine, type Host } from './host'
14 may be passed to it; a refused write is ignored (the status file is a courtesy). */
15async function flush($: Dollar, s: Session): Promise<void> {
16 if (s.root === undefined) return
17 try {
18 await $.fs.write(`${s.root}/${STATUS_PATH}`, statusText(s.counters, await $.clock.now(), s.startedMs))
19 } catch {
20 // never fail a hook over the status file
21 }
22}
23
24/**
25 * A mod scaffolded by ruflo-plugin-creator (ADR-404 patterns):
26 * - observe: `const r = await next(e); …; return r` on tool.call;
27 * - every `$` call literal, wrapped in a host adapter, refusal-tolerant;
28 * - namespaced command (`my-mod-status`), never a built-in's name;
29 * - the classic fallback handed over through MY_MOD_ACTIVE;
30 * - a status file (status.ts) the console reads: keep `calls` a number.
31 * Hot reload re-runs register and session.start: keep anything that must
32 * survive a reload in `$.store` or `$.state`, not in these variables.
33 */
34export const register: Register = (on, options) => {
35 const showLine = options.statusLine !== false
36 const s: Session = { counters: newCounters(), startedMs: 0 }
37
38 on('session.start', async ($, e, next) => {
39 await $.env.set('MY_MOD_ACTIVE', '1').catch(() => undefined)
40 await $.command.register({ name: 'my-mod-status', description: 'my-mod: tool calls this session' }).catch(() => undefined)
41 try {
42 s.root = (await $.session.root()) as string | undefined
43 s.startedMs = await $.clock.now()
44 } catch {
45 // no project root: the mod still runs, it just writes no status file
46 }
47 await flush($, s)
48 return next(e)
49 })
50
51 on('tool.call', async ($, e, next) => {
52 const result = await next(e)
53 s.counters.calls++
54 const host: Host = { status: text => $.ui.status(text) }
55 if (showLine) show(host, s.counters.calls)
56 await flush($, s)
57 return result
58 })
59
60 on('command.run', { command: 'my-mod-status' }, () => ({ text: statusLine(s.counters.calls) }))
61}
62hooks/host.ts 23 lines1/**
2 * What the pure logic needs from the engine, as plain functions. The engine
3 * reads what a module calls off its source, so `$` never leaves a hook: the
4 * hook builds this from literal `$.noun.method(...)` calls (register.ts).
5 */
6export type Host = {
7 readonly status: (text: string | undefined) => void
8}
9
10/** The tool-call tally and the line it shows; pure, testable without the engine. */
11export function statusLine(calls: number): string {
12 return `my-mod · ${calls} tool call${calls === 1 ? '' : 's'}`
13}
14
15/** Draws through the host; a refused `ui.status` (an admin may withhold it) is ignored. */
16export function show(host: Host, calls: number): void {
17 try {
18 host.status(statusLine(calls))
19 } catch {
20 // never fail a hook over the status line
21 }
22}
23hooks/status.ts 41 lines1/**
2 * The status contract (ADR-446): the file the console's Mods section reads. It scans `.claude-flow` for `<name>-mod` folders (the folder name
3 * must match /^[a-z0-9][a-z0-9-]{0,40}-mod$/) and keeps a file only when `version` is 1. Anything else you write is ignored by the console.
4 */
5export const STATUS_PATH = '.claude-flow/my-mod/status.json'
6
7/** What the console reads; `calls` is a number (not a per-tool object), `lastDenied` is a short reason, left out until the mod refuses something. */
8export type ModStatus = {
9 version: 1
10 updatedMs: number
11 startedMs: number
12 modVersion: string
13 summary: string
14 guard: boolean
15 calls: number
16 blocked: number
17 lastDenied?: string
18}
19
20/** The counters the mod keeps for one session. This template guards nothing, so `blocked` stays 0 and `guard` is false. */
21export type Counters = { calls: number; blocked: number; lastDenied?: string }
22
23export const newCounters = (): Counters => ({ calls: 0, blocked: 0 })
24
25/** Builds the document; pure, so a test can assert the shape without the engine. */
26export function modStatus(c: Counters, nowMs: number, startedMs: number): ModStatus {
27 return {
28 version: 1,
29 updatedMs: nowMs,
30 startedMs,
31 modVersion: '0.1.0',
32 summary: 'counts tool calls; guards nothing',
33 guard: false,
34 calls: c.calls,
35 blocked: c.blocked,
36 ...(c.lastDenied !== undefined && { lastDenied: c.lastDenied }),
37 }
38}
39
40export const statusText = (c: Counters, nowMs: number, startedMs: number): string => `${JSON.stringify(modStatus(c, nowMs, startedMs), null, 2)}\n`
41