swrm (formerly openswarm, renamed as of v0.3.1, with old links redirected) is a distributed, heterogeneous agent task scheduler designed for coding agents. Its core idea is: the planner (Claude Code) is responsible for breaking down tasks, writing acceptance criteria, reviewing diffs, and integrating; the executors are responsible for actual coding. swrm routes each task according to real-time quotas to the cheapest executor that can handle it, runs it in an isolated git worktree, sets a hard time budget, verifies the result on the host side, and then reports back.
Main capabilities include:
- Real-time model discovery: reads the current model catalogs of Codex and OpenCode, sorts them into fast, balanced, and deep tiers, and places older models last.
- Quota-aware routing: checks the 5-hour, 7-day, and 30-day windows, consumption rate, and reset time; under soft limits, simple work overflows to other enabled backends; under hard limits, that backend is skipped; quota that is about to expire unused is consumed at a higher effort level.
- Declarative custom backends: any CLI agent can join routing through a single JSON configuration file, with no code changes required.
- Isolated execution: each run gets an independent git worktree and an openswarm/<id> branch; dependency directories (node_modules, .venv) are brought in via symlinks and are not committed; workspace.prepare can be configured to install dependencies inside each worktree; nothing is pushed.
- Hard budget: --budget-minutes starts timing when the executor first obtains capacity, and on timeout kills the executor's entire process tree; capacity waiting does not count toward the budget and is recorded as queued_seconds.
- Host-side verification: --verify '<cmd>' runs the test command on the committed worktree, and its exit code overrides the executor's self-reported result; --verify-baseline ignores failures that already exist on the baseline commit; --auto-rework [N] automatically redispatches up to N times when verification fails (default 2), injecting the new failing tests and output tail each time, and after retries are exhausted, escalates to a stronger backend tier and re-verifies.
- Automatic fallback: one-off Pi, Codex, and Cursor runs retry visible 429s within the same session; other retryable rate-limit and model-capacity errors can be transferred to another backend.
- Rate-limit recovery and provider caps: resident channels use rate_limit.backoff_seconds (default [30, 60, 120, 240]) and rate_limit.max_retries (default 4) to retry visible provider 429s; concurrency accepts provider/backend limits plus a total, defaulting to {"codex": 4, "minimax-cn": 6, "total": 10}.
- Risk alerts: openswarm watch streams progress and flags dangerous executor commands (push, rm -rf .., printing secrets, sudo, publish), while also reporting stalls and heartbeats.
- Planner-friendly: SKILL.md teaches Claude Code the entire loop; templates/openswarm-workflow.js dispatches tasks in parallel; openswarm report provides scheduled checks.
- GitHub issue bus: routes tasks to uncontrolled external executors via a dedicated repository, while controlled hosts continue to use the SSH cluster channel.
- Learning loop: the ledger records the pass decision, injected lessons and patterns, and routing suggestions for each run; lessons propose, patterns propose, and retro turn these records into reviewable drafts.
Usage: requires Python 3.9+, git, and at least one executor (a logged-in codex CLI, opencode with an OpenCode Go plan, or a DeepSeek API key). Codex CLI is the primary executor; OpenCode Go and DeepSeek are optional backends that can be forced with --backend or enabled for automatic routing by adding them to routing.default_order; Cursor CLI (cursor-agent) runs only with --backend cursor or when added to routing.default_order, and is not part of automatic routing. Automatic routing uses only Codex by default.
Use cases: developers who have multiple AI subscriptions and want to concentrate the tokens of an expensive planner (such as Claude Pro) on decomposition and review while distributing coding work to cheaper executors or those with more ample quota; coding agent workflows that require isolated execution, hard budgets, and host-side verification.
Limitations: the project is a single Python file with zero dependencies, but requires externalexecutor CLIs and corresponding subscriptions/API keys; automatic routing uses only Codex by default, and other backends must be explicitly configured; Cursor is not part of automatic routing; benchmark results are based on specific versions and conditions (n=1, etc.) and do not represent general performance; some features (such as the GitHub issue bus and the learning loop) require additional configuration.