Skip to main content
Glama
README.md
# Ruflo

> Multi-agent swarm orchestration for Claude Code, with vector memory, consensus and self-learning routing.

![TypeScript](https://img.shields.io/badge/TypeScript-5-3178C6?logo=typescript&logoColor=white)
![Node.js](https://img.shields.io/badge/Node.js-%E2%89%A520-339933?logo=nodedotjs&logoColor=white)
![MCP](https://img.shields.io/badge/Model%20Context%20Protocol-server-000000)
![Anthropic](https://img.shields.io/badge/Anthropic-Claude-D97757?logo=anthropic&logoColor=white)
![Vitest](https://img.shields.io/badge/Vitest-tested-6E9F18?logo=vitest&logoColor=white)
![Jest](https://img.shields.io/badge/Jest-tested-C21325?logo=jest&logoColor=white)
![Rust/WASM](https://img.shields.io/badge/Rust-WASM-000000?logo=rust&logoColor=white)
![PostgreSQL](https://img.shields.io/badge/PostgreSQL-ruvector-4169E1?logo=postgresql&logoColor=white)
![Docker](https://img.shields.io/badge/Docker-regression%20tests-2496ED?logo=docker&logoColor=white)

## Overview

Ruflo (formerly Claude Flow) turns Claude Code into a multi-agent development platform. It ships a CLI and an MCP server that spawn and coordinate swarms of specialized agents across mesh, hierarchical, ring and star topologies. The swarms are backed by a vector memory and a learning loop that improves task routing over time.

The codebase is a large TypeScript monorepo. It has about 20 scoped packages under `v3/@claude-flow/*`, and a legacy `v2` codebase sits alongside them. It combines distributed-systems ideas such as consensus, CRDTs and claims with WASM/Rust-powered vector and neural components.

## Features

- **Swarm coordination.** Spawn and coordinate agent swarms with mesh, hierarchical, ring and star topologies (`v3/@claude-flow/swarm`).
- **MCP server and tools.** Orchestration capabilities are exposed as MCP tools over multiple transports (`v3/@claude-flow/mcp`).
- **CLI.** The `claude-flow` command covers init, agents, swarms, hooks and memory (`bin/cli.js`, `v3/@claude-flow/cli`).
- **Vector memory.** Persistent memory with HNSW search, an RVF backend, an event log and a learning store (`v3/@claude-flow/memory`).
- **Self-learning routing.** A neural package with reinforcement-learning algorithms and pattern learning is used to route tasks (`v3/@claude-flow/neural`, `v3/@claude-flow/hooks`).
- **Hooks and Claude Code plugin.** Hook automation plus a Claude Code plugin with a marketplace manifest (`.claude-plugin/`).
- **AI defence and security.** Input safety scanning and a security package for hardening (`aidefence`, `security`).
- **Plugin ecosystem.** Domain plugins include code intelligence, test intelligence, financial risk, legal contracts and a quantum optimizer.
- **Providers and embeddings.** Abstractions over several LLM providers and embedding models.
- **Skills library.** More than 140 reusable skills and agent definitions for Codex and Claude.
- **Docker regression tests.** Containerized regression and install-verification suites.

## Architecture

Ruflo is a modular monorepo. The CLI and MCP server are the entry points, and they sit on top of shared domain packages. Requests pass through a security layer, then a router and hooks, and then the swarm coordinator. Agents use a vector memory and call LLM providers.

```mermaid
flowchart LR
    n_user(["Developer / Claude Code"])
    subgraph sg2["Backend"]
        n_cli["CLI and MCP server"]
        n_security["AIDefence and security"]
        n_router["Neural router and hooks"]
        n_swarm["Swarm coordinator"]
        n_agents["Specialized agents"]
        n_plugins["Plugins"]
    end
    subgraph sg3["Data"]
        n_memory[("Vector memory (AgentDB/RVF)")]
    end
    subgraph sg5["External services"]
        n_providers{{"LLM providers"}}
    end
    n_user -->|commands and MCP tool calls| n_cli
    n_cli -->|input validation| n_security
    n_security -->|safe requests| n_router
    n_router -->|task routing| n_swarm
    n_swarm -->|spawn and coordinate| n_agents
    n_agents -->|store and retrieve patterns| n_memory
    n_agents -->|LLM calls| n_providers
    n_memory -->|learning feedback| n_router
    n_cli -->|load extensions| n_plugins
```

**How it works**

1. A developer, or Claude Code through MCP, issues a command or tool call to the CLI/MCP server.
2. Input is validated by the AIDefence and security layer.
3. The neural router and hooks choose the agents and topology for the task.
4. The swarm coordinator spawns the specialized agents and coordinates them with consensus protocols.
5. Agents store and retrieve patterns in vector memory (AgentDB/RVF) and make LLM calls through the provider layer.
6. Outcomes feed back into the router as learning feedback. Plugins are loaded by the CLI as extensions.

## Tech Stack

| Layer | Technology |
|---|---|
| Language | TypeScript, Python, Rust/WASM |
| Runtime | Node.js |
| Protocol | Model Context Protocol |
| AI | Anthropic Claude SDK, RuVector (HNSW, SONA, attention) |
| Data | AgentDB, PostgreSQL (ruvector-postgres) |
| Validation | Zod |
| Testing | Vitest, Jest |
| Infra / CI | Docker, GitHub Actions |

## Project Structure

```
.
├── bin/cli.js            # CLI entry point
├── v3/
│   ├── @claude-flow/     # ~20 scoped packages (cli, mcp, swarm, memory, neural, hooks, ...)
│   ├── mcp/              # MCP tools and transports
│   ├── plugins/          # Domain plugins
│   └── swarm.config.ts
├── v2/                   # Legacy codebase
├── agents/               # Agent definitions
├── .agents/skills/       # Skills library
├── .claude-plugin/       # Claude Code plugin and marketplace manifests
├── tests/                # Tests, including docker-regression
├── scripts/
├── .env.example
└── LICENSE
```

## Getting Started

### Prerequisites

- Node.js >= 20 and npm
- Claude Code (optional, for MCP and plugin use)

### Installation

```bash
git clone https://github.com/zain-mirza-1060/claude-agent-swarm-orchestrator.git
cd claude-agent-swarm-orchestrator
npm install
```

> Note: the root `package.json` has a `preinstall` script that deletes entries mentioning `claude-flow` or `ruflo` from `~/.npm/_npx` and `~/.npm/_cacache`. Review it before running `npm install`. Many optional dependencies (`@ruvector/*`, `agentdb`, `agentic-flow`) are installed only if they are available.

### Environment Variables

All variables are optional. `.env.example` lists the full set. The main ones are:

| Variable | Description | Required |
|---|---|---|
| `ANTHROPIC_API_KEY` | Claude API key for LLM calls | No |
| `OPENAI_API_KEY` | OpenAI provider key | No |
| `CLAUDE_FLOW_LOG_LEVEL` | Logging verbosity | No |
| `CLAUDE_FLOW_MEMORY_BACKEND` | Memory backend selection | No |
| `CLAUDE_FLOW_MCP_PORT` | MCP server port | No |
| `CLAUDE_FLOW_MCP_TRANSPORT` | MCP transport type | No |
| `CLAUDE_FLOW_MAX_AGENTS` | Maximum concurrent agents | No |
| `CLAUDE_FLOW_TOPOLOGY` | Swarm topology | No |
| `RUVECTOR_HOST` | RuVector Postgres host | No |
| `GITHUB_TOKEN` | GitHub integration token | No |

### Running locally

```bash
node bin/cli.js --help
node bin/cli.js init
```

The root `dev` script points at `src/index.ts`, which does not exist at the repository root. The implementation lives under `v3/@claude-flow/*` and `v2`.

### Running tests

```bash
npm test
```

### Building

```bash
npm run build:ts
```

## Usage

```bash
# Show available commands
node bin/cli.js --help

# Initialize Ruflo in a project
node bin/cli.js init
```

Claude Code can connect to the MCP server to call orchestration tools directly. Configure the transport and port with `CLAUDE_FLOW_MCP_TRANSPORT` and `CLAUDE_FLOW_MCP_PORT`.

## License

Released under the MIT License, see [LICENSE](LICENSE).