Ruflo — Claude Code Configuration

Rules

  • Do what has been asked; nothing more, nothing less
  • NEVER create files unless absolutely necessary — prefer editing existing files
  • NEVER create documentation files unless explicitly requested
  • NEVER save working files or tests to root — use /src, /tests, /docs, /config, /scripts
  • ALWAYS read a file before editing it
  • NEVER commit secrets, credentials, or .env files
  • NEVER add a Co-Authored-By trailer to user commits unless this project’s .claude/settings.json has attribution.commit set (#2078). The Claude Code Bash tool may suggest one in its default commit-message template — ignore it. Co-Authored-By is semantic authorship attribution under git/GitHub convention; the tool is the facilitator, not a co-author.
  • Keep files under 500 lines
  • Validate input at system boundaries

Agent Comms (SendMessage-First Coordination)

Named agents coordinate via SendMessage, not polling or shared state.

Lead (you) ←→ architect ←→ developer ←→ tester ←→ reviewer
              (named agents message each other directly)

Spawning a Coordinated Team

// ALL agents in ONE message, each knows WHO to message next
Agent({ prompt: "Research the codebase. SendMessage findings to 'architect'.",
  subagent_type: "researcher", name: "researcher", run_in_background: true })
Agent({ prompt: "Wait for 'researcher'. Design solution. SendMessage to 'coder'.",
  subagent_type: "system-architect", name: "architect", run_in_background: true })
Agent({ prompt: "Wait for 'architect'. Implement it. SendMessage to 'tester'.",
  subagent_type: "coder", name: "coder", run_in_background: true })
Agent({ prompt: "Wait for 'coder'. Write tests. SendMessage results to 'reviewer'.",
  subagent_type: "tester", name: "tester", run_in_background: true })
Agent({ prompt: "Wait for 'tester'. Review code quality and security.",
  subagent_type: "reviewer", name: "reviewer", run_in_background: true })
 
// Kick off the pipeline
SendMessage({ to: "researcher", summary: "Start", message: "[task context]" })

Patterns

PatternFlowUse When
PipelineA → B → C → DSequential dependencies (feature dev)
Fan-outLead → A, B, C → LeadIndependent parallel work (research)
SupervisorLead ↔ workersOngoing coordination (complex refactor)

Rules

  • ALWAYS name agents — name: "role" makes them addressable
  • ALWAYS include comms instructions in prompts — who to message, what to send
  • Spawn ALL agents in ONE message with run_in_background: true
  • After spawning: STOP, tell user what’s running, wait for results
  • NEVER poll status — agents message back or complete automatically

Swarm & Routing

Config

  • Topology: hierarchical-mesh (anti-drift)
  • Max Agents: 15
  • Memory: hybrid
  • HNSW: Enabled
  • Neural: Enabled
npx @claude-flow/cli@latest swarm init --topology hierarchical --max-agents 8 --strategy specialized

Agent Routing

TaskAgentsTopology
Bug Fixresearcher, coder, testerhierarchical
Featurearchitect, coder, tester, reviewerhierarchical
Refactorarchitect, coder, reviewerhierarchical
Performanceperf-engineer, coderhierarchical
Securitysecurity-architect, auditorhierarchical

When to Swarm

  • YES: 3+ files, new features, cross-module refactoring, API changes, security, performance
  • NO: single file edits, 1-2 line fixes, docs updates, config changes, questions

3-Tier Model Routing

TierHandlerUse Cases
1Agent Booster (WASM)Simple transforms — skip LLM, use Edit directly
2HaikuSimple tasks, low complexity
3Sonnet/OpusArchitecture, security, complex reasoning

Memory & Learning

Before Any Task

npx @claude-flow/cli@latest memory search --query "[task keywords]" --namespace patterns
npx @claude-flow/cli@latest hooks route --task "[task description]"

After Success

npx @claude-flow/cli@latest memory store --namespace patterns --key "[name]" --value "[what worked]"
npx @claude-flow/cli@latest hooks post-task --task-id "[id]" --success true --store-results true

MCP Tools (use ToolSearch("keyword") to discover)

CategoryKey Tools
Memorymemory_store, memory_search, memory_search_unified
Bridgememory_import_claude, memory_bridge_status
Swarmswarm_init, swarm_status, swarm_health
Agentsagent_spawn, agent_list, agent_status
Hookshooks_route, hooks_post-task, hooks_worker-dispatch
Securityaidefence_scan, aidefence_is_safe, aidefence_has_pii
Hive-Mindhive-mind_init, hive-mind_consensus, hive-mind_spawn

Background Workers

WorkerWhen
auditAfter security changes
optimizeAfter performance work
testgapsAfter adding features
mapEvery 5+ file changes
documentAfter API changes
npx @claude-flow/cli@latest hooks worker dispatch --trigger audit

Agents

Core: coder, reviewer, tester, planner, researcher
Architecture: system-architect, backend-dev, mobile-dev
Security: security-architect, security-auditor
Performance: performance-engineer, perf-analyzer
Coordination: hierarchical-coordinator, mesh-coordinator, adaptive-coordinator
GitHub: pr-manager, code-review-swarm, issue-tracker, release-manager

Any string works as a custom agent type.

Build & Test

  • ALWAYS run tests after code changes
  • ALWAYS verify build succeeds before committing
npm run build && npm test

CLI Quick Reference

npx @claude-flow/cli@latest init --wizard           # Setup
npx @claude-flow/cli@latest swarm init --v3-mode     # Start swarm
npx @claude-flow/cli@latest memory search --query "" # Vector search
npx @claude-flow/cli@latest hooks route --task ""    # Route to agent
npx @claude-flow/cli@latest doctor --fix             # Diagnostics
npx @claude-flow/cli@latest security scan            # Security scan
npx @claude-flow/cli@latest performance benchmark    # Benchmarks

26 commands, 140+ subcommands. Use --help on any command for details.

Setup

claude mcp add claude-flow -- npx -y ruflo@latest mcp start
npx ruflo@latest doctor --fix

The background daemon is optional. It runs interval workers that each spawn
a headless claude session, so it consumes tokens continuously. Start it only
if you want those sweeps: npx ruflo@latest daemon start (self-stops after 12h
by default; --ttl 0 to disable, daemon status --all to audit running daemons).

Agent tool handles execution (agents, files, code, git). MCP tools handle coordination (swarm, memory, hooks). CLI is the same via Bash.