code-swarm is a single-machine coding-agent runner. It bootstraps a target repo, plans scoped tasks, runs builders in isolated git worktrees, verifies their changes, and reconciles failures until the repo is healthy or progress stops.
It works against either:
- a managed local vLLM server
- an external OpenAI-compatible endpoint such as OpenRouter
uv pip install --system -e '.[dev]'
uv run pytest -q tests -m 'not live_e2e'- Create a config.
cp swarm.example.toml swarm.toml-
Point
repo_path,workspace_root, andstate_db_pathat real locations. -
Validate the model endpoint.
code-swarm check-model --config swarm.toml- Start a run.
code-swarm start-run --config swarm.toml \
--request "Create a Python CLI that converts temperatures between Celsius and Fahrenheit with tests"- Watch the run.
code-swarm show-run --config swarm.toml --run-id 1 --watchcode-swarm bootstrap --config swarm.tomlcode-swarm serve-model --config swarm.tomlManaged mode expects:
vllminPATH- a supported GPU
HF_TOKENset for model downloads
[model]
profile = "custom"
thinking_default = "off"
api_key_env = "OPENROUTER_API_KEY"
timeout_seconds = 300.0
[serving]
mode = "external"
endpoint_url = "https://openrouter.ai/api/v1"
served_model_name = "google/gemini-2.5-flash"With mode = "external", endpoint_url is used directly and local vLLM checks are skipped.
code-swarm resume-run --config swarm.toml --run-id 1
code-swarm show-run --config swarm.toml --run-id 1
code-swarm dashboard --config swarm.toml --run-id 1
code-swarm cleanup-run --config swarm.toml --run-id 1code-swarm start-run --config swarm.toml --request "..." --max --max-waves 15Max mode chains multiple runs. After each completed wave, a feature agent inspects the repo and generates the next prompt.
Start from swarm.example.toml.
Important top-level fields:
repo_path: target repositoryworkspace_root: root for builder worktreesstate_db_path: SQLite state databaseverification_commands: commands that define project healthskip_setup: whentrue, setup is disabled andverification_commandsmust already be configuredmax_concurrent_builders: max parallel builders
Important [model] fields:
profile: built-in profile name orcustomthinking_default:onoroffapi_key_env: env var holding the API keytimeout_seconds: per-request HTTP timeout
Important [serving] fields:
mode:managedorexternalserved_model_name: model name expected from the endpointendpoint_url: explicit API base URL for external modehostandport: managed local endpoint settings
The orchestrator runs this loop:
- Setup agent prepares the repo or repairs environment issues.
- Root planner emits top-level tasks.
- Subplanners decompose broad tasks when needed.
- Builders work in isolated git worktrees.
- Merge gate cherry-picks and re-verifies passing work.
- Reconciler emits fix tasks when verification or merge fails.
- Finalization stops when the repo is healthy or no more progress is possible.
Greenfield repos with specs/tests but no implementation can start with a single repo-wide bootstrap builder task.
src/code_swarm/
cli.py CLI entrypoint
config.py TOML loading and validation
orchestrator.py main run loop
planner.py root planner, subplanner, reconciler
builder.py builder agent loop
setup_agent.py initial and reactive environment setup
verification.py baseline and project verification
merge.py merge gate
ecosystem.py ecosystem detection and command resolution
state.py SQLite state store
serving.py model endpoint and vLLM utilities
tools.py planner/builder/setup tool executors
dashboard.py Textual dashboard
tui.py Rich watch view
prompts/ agent system prompts
tests/ unit and scripted end-to-end coverage
docs/ architecture notes and known issues
showcase/ example generated projects
Fast core checks:
uv run pytest -q tests/test_cli.py tests/test_config.py tests/test_repo.pyFull non-live suite:
uv run pytest -q tests -m 'not live_e2e'Live end-to-end coverage requires a real API key and is marked with live_e2e.
- Setup runs automatically on empty repos or when verification commands are missing, unless
skip_setup = true. - Verification commands are canonicalized so merge/finalization checks run full-suite commands instead of narrow file-specific variants when the ecosystem is recognized.
- See
docs/ARCHITECTURE.mdfor module-level details anddocs/KNOWN-ISSUES.mdfor current limitations.