Skip to main content
Glama

 CodeSwarm Turn GitHub issues into tested, reviewed pull requests — autonomously. Self-hosted, multi-agent AI engineering swarm for GitHub. Provider-agnostic. Parallel. Production-ready.

IMPORTANT

Give CodeSwarm a GitHub issue. It turns it into a tested and reviewed pull request. Not AI that writes codeAI engineering team that ships production-ready PRs.



Table of Contents

Related MCP server: genswarms-fleet-mcp

Why CodeSwarm

Before

With CodeSwarm

1 issue → hours of manual work

1 issue → 5 AI agents → 1 ready-to-merge PR

AI pair-programming

AI engineering team — GitHub-native, autonomous, self-hosted

TIP

Wow effect: 1 GitHub Issue → 5 AI agents → parallel development → tests → review → CI fixes → 1 ready-to-merge PR

How it Works

flowchart TD
    A[GitHub Issue<br/>ai:ready] --> B[Planner<br/>decomposes to JSON]
    B --> C1[Researcher]
    B --> C2[Coder]
    B --> C3[Tester]
    C1 --> D[Worktrees<br/>.codeswarm/task-xxx]
    C2 --> D
    C3 --> D
    D --> E[Tester<br/>npm test / typecheck / lint]
    E -->|fail| C2
    E -->|pass| F[Reviewer<br/>security + correctness]
    F -->|changes| C2
    F -->|approved| G[GitHub PR]
    G --> H{CI}
    H -->|pass| I[Ready to merge]
    H -->|fail| J[CI Agent<br/>parse logs → fix → push]
    J --> H
GitHub Issue (ai:ready)
  ↓ Planner → { goal, tasks: [...] }
  ├─ Researcher → finds files, git history, plan
  ├─ Coder ×N → isolated worktrees → commits
  └─ Tester → npm test / lint / typecheck
       ↓ fail → Coder
       ↓ pass → Reviewer
            ↓ changes → Coder
            ↓ approved → GitHub PR → CI → CI Agent fixes on fail → Ready

Features

Parallel worktrees

Every agent works in isolated git worktree under .codeswarm/task-xxx/ — no branch collisions.

Conflict Resolver

LLM-assisted 3-way merge. Detects CONFLICT, resolves, re-runs tests.

Autonomous PR loop

CI failure → parse logs → generate fix → push → re-run. Zero manual intervention.

Provider-agnostic

LLMProvider interface. OpenAI, Anthropic, OpenRouter, Google, Ollama, LiteLLM, any OpenAI-compatible + mock.

Cost & safety guards

max_agents, max_cost_usd, timeout_minutes, max_depth. Sandboxed filesystem: repository_only, network: restricted.

Full audit trail

Every tool.called, file.changed, test.*, pr.* stored in agent_events (SQLite now, Postgres in v0.3).

Notifications

Telegram + Dashboard + GitHub comments.

MCP native

Control swarm from Claude / Cursor / OpenCode via swarm.* tools.

Quick Start

1. Install

npx codeswarm init

Creates codeswarm.yml + .env. Fill .env:

DATABASE_URL=file:./data/codeswarm.db
GITHUB_TOKEN=ghp_xxx
GITHUB_OWNER=your-org
GITHUB_REPO=your-repo
OPENAI_API_KEY=sk-xxx
# or ANTHROPIC_API_KEY=sk-ant-xxx
# TELEGRAM_BOT_TOKEN=xxx
# TELEGRAM_CHAT_ID=xxx

2. Run

Docker (recommended)

docker-compose up --build
# API: http://localhost:3000
# Dashboard: http://localhost:3001

Local

npm install
npm run build
npm run dev
# or
node apps/api/dist/index.js &
node apps/dashboard/dist/index.js

3. Trigger

Via label — add ai:ready to any open issue (webhook auto-creates task).

Via CLI — mock (no keys needed)

codeswarm issue run 421 --mock
# ✅ Local pipeline done: completed PR: https://github.com/example/repo/pull/438

Via CLI — real

codeswarm issue run 421
codeswarm issue plan 421   # plan only, no code
NOTE

codeswarm issue run first tries API (http://localhost:3000); if API is down, it falls back to local mock pipeline — great for demos and CI.

CLI Reference

codeswarm init                  # init codeswarm.yml + .env
codeswarm run --mock            # start API + worker hint
codeswarm issue run <num> [--mock] [--repo owner/repo]
codeswarm issue plan <num>      # planner only
codeswarm pr review <num>
codeswarm pr fix <num>          # CI fix loop
codeswarm status                # ASCII dashboard in terminal
codeswarm agents
codeswarm queue
codeswarm mcp                   # MCP server over stdio

Architecture

GitHub
  │ webhook / poller
  ▼
Orchestrator ──► Task Queue ──► Agents (×N) ──► Git Worktrees ──► Tests / CI ──► GitHub PR
  │                 │                │
  │                 │                ├─ Planner / Researcher / Coder / Tester / Reviewer / CI Agent
  │                 │                └─ WorktreeManager + ConflictResolver
  │                 └─ InMemory (MVP) / Redis + BullMQ (prod)
  └─ projects / tasks / agents / worktrees / artifacts / pull_requests / reviews / costs / agent_events
     SQLite (MVP) → PostgreSQL (v0.3)

Repo layout

codeswarm/
├── apps/
│   ├── api/          # HTTP API, webhook, orchestrator
│   ├── worker/       # queue worker (scale horizontally)
│   └── dashboard/    # real-time Web UI
├── packages/
│   ├── core/         # types, state-machine, cost, DB schema
│   ├── llm/          # OpenAI/Anthropic/Google/Ollama/LiteLLM/Mock
│   ├── agents/       # 6 agents + orchestrator
│   ├── github/       # Issues/PRs/Comments/Checks
│   ├── git/          # worktree manager
│   ├── queue/        # InMemory / Redis
│   ├── sandbox/      # security
│   ├── mcp/          # MCP server
│   └── telegram/     # notifier
├── tests/            # vitest (15 tests)
├── examples/         # wallet race condition
└── docker/

MCP

Control the swarm from any MCP client:

{
  "mcpServers": {
    "codeswarm": { "command": "npx", "args": ["codeswarm", "mcp"] }
  }
}

Tool

Description

swarm.list_tasks()

List tasks with status & progress

swarm.run_task(issueNumber)

Start swarm for an issue

swarm.cancel_task(taskId)

Cancel running task

swarm.retry_task(taskId)

Retry failed task

swarm.spawn_agent(taskId, role)

Spawn specific agent

swarm.status()

activeAgents, queueLength, prsToday, successRate

swarm.review_pr(prNumber)

Trigger reviewer

Dashboard

http://localhost:3001 — live polling of http://localhost:3000/api/status

┌─────────────────────────────────────────┐
│ CODESWARM                               │
├─────────────────────────────────────────┤
│ ACTIVE AGENTS: 7                        │
│ QUEUE: 12                               │
│ PRs TODAY: 8                            │
│ SUCCESS RATE: 81%                       │
├─────────────────────────────────────────┤
│ #421 Wallet race condition   ██████ 80% │
│ #422 API timeout             ████░░ 55% │
└─────────────────────────────────────────┘

Terminal dashboard: codeswarm status

Configuration

codeswarm.yml (see codeswarm.yml.example):

task:
  max_agents: 4
  max_retries: 3
  max_cost_usd: 2.00
  timeout_minutes: 30
swarm:
  max_total_agents: 10
  max_depth: 2
llm:
  provider: openai # openai | anthropic | openrouter | google | ollama | litellm
  model: gpt-4o-mini
  temperature: 0.2
queue:
  type: memory # or redis
  redisUrl: redis://localhost:6379
sandbox:
  enabled: true
  network: restricted
  filesystem: repository_only

Cost example: gpt-4o-mini ≈ $0.15/$0.6 per 1M tokens. A full pipeline ~$0.01–0.05 with mock, ~$0.2–0.6 with real models.

Comparison

Tool

Positioning

OpenHands

AI developer

SWE-agent

Issue → code fix

Aider

AI pair programming

CodeSwarm

Orchestration of multiple AI developers — GitHub-native, multi-agent, parallel, autonomous, self-hosted, provider-agnostic

Roadmap

Full roadmap with timeline, Gantt, metrics and exit criteria → ROADMAP.md

gantt
    title CodeSwarm — Timeline
    dateFormat  YYYY-MM-DD
    axisFormat %b %Y
    section MVP
    v0.1 shipped    :done, v01, 2026-09-01, 2026-09-01
    section Scale
    v0.2 Parallel   :done, v02, 2026-09-01, 2026-09-02
    section Depth
    v0.3 Plugins    :done, v03, 2026-09-02, 2026-09-03
    section GA
    v1.0 Platform   :done, v10, 2026-09-03, 2026-09-04

Version

Status

Target

Highlights

v0.1

✅ Shipped

Sep 2026

Issues → Planner/Coder/Tester/Reviewer → PR, worktrees, OpenAI/Anthropic, Docker, SQLite, CLI

v0.2

✅ Shipped

Sep 2026

Parallel coders ×5, Redis/BullMQ, CI fix loop, Telegram, MCP, Dashboard SSE, cost guards

v0.3

✅ Shipped

Sep 2026

Conflict auto-merge, Postgres, multi-repo, vector memory, custom agents, plugin system

v1.0

✅ Shipped

Sep 2026

GitHub App, org RBAC, self-hosted models, marketplace, gVisor sandbox, analytics

  • 3 coders in parallel without file stomp

  • 80% red CI auto-fixed, cost never exceeds $2.00, p95 < 8 min visible in Dashboard

  • 90% conflicts auto-merged, SQLite → Postgres via flag, 2 community agents contributed

TIP

Want to shape the roadmap? React with 👍 on issues labeledroadmap or open a roadmap/proposal.

Contributing

See CONTRIBUTING.md. PRs welcome!

npm install
npm run build   # tsc -b
npm test        # vitest — 15 tests

License

MIT © 2026 CodeSwarm

Related MCP Connectors

Related MCP Servers