Multi-agent AI development pipeline — remote-controllable, self-healing, provider-flexible
A single shell script that orchestrates Claude Code, GitHub Copilot, OpenCode, and Pi into a fully automated design → implement → review loop. Configure which AI handles which role, start a remote session, and send feature requests from your phone.
You (mobile / browser — anywhere)
↓ "add order filtering by date range"
Main provider (architect + reviewer: Claude or Copilot)
↓ precise implementation spec
Worker provider (implementer: Claude | Copilot | OpenCode | Pi)
↓ commit
Main provider (reviews git diff vs spec)
↓
APPROVED ✅ or loop back for fixes ⚠️
↓ auto-failover if any provider hits its rate limit
📖 USAGE.md — Five complete end-to-end walkthroughs
📊 DEVLOOP-GRAPH.md — 11 Mermaid architecture diagrams
| Tool | Role | Install |
|---|---|---|
claude |
Main/worker CLI | curl -fsSL https://claude.ai/install.sh | bash |
copilot |
Main/worker CLI | npm install -g @github/copilot |
opencode |
Worker only (optional) | npm install -g opencode-ai |
pi |
Worker only (optional) | https://pi.dev/docs/latest |
gh |
GitHub agent mode | brew install gh |
git |
Always required | https://git-scm.com |
# Download and install globally
curl -fsSL https://raw.githubusercontent.com/you/devloop/main/devloop.sh -o /tmp/devloop
chmod +x /tmp/devloop && sudo mv /tmp/devloop /usr/local/bin/devloop
# Or use the built-in installer if you already have the file:
devloop install # → /usr/local/bin/devloop
devloop install ~/bin/devloop # custom path
# Verify
devloop --version # DevLoop v4.1.0Enable self-updates by setting in devloop.config.sh:
DEVLOOP_SOURCE_URL="https://raw.githubusercontent.com/you/devloop/main/devloop.sh"Then run devloop update to upgrade in place.
cd your-project/
# 1. Initialize (one-time per project)
devloop init
# 2. Review auto-generated stack/config (optional adjustments)
nano devloop.config.sh
# 3. Validate everything is wired up
devloop doctor
# 4. Start the session
devloop start
# → find "DevLoop: your-project" in Claude app or claude.ai/code
# 5. From your phone:
# "add GET /orders endpoint with date range filter"
# → providers design, implement, and review automatically→ Full walkthrough in USAGE.md — Scenario 1
Detailed Mermaid diagrams covering every aspect of the pipeline:
| Diagram | Description |
|---|---|
| 1. Full Pipeline | End-to-end flow from user request to APPROVED |
| 2. Command Reference | Every command grouped by category with aliases |
3. devloop init |
All files created and provider/model propagation |
| 4. File Lifecycle | All 4 files per task — who writes, reads, and deletes each |
| 5. Git Baseline | How .pre-commit enables precise multi-commit diffs |
6. devloop work prompt |
Exact structure sent to the worker provider |
7. devloop review prompt |
Diff computation, compact spec assembly, main provider prompt |
| 8. Daemon & Auto-restart | Background loop, backoff, launchd/systemd registration |
| 9. Status State Machine | pending → approved/needs_work/rejected transitions |
| 10. Agent Collaboration | Orchestrator ↔ Architect ↔ Reviewer ↔ Worker roles |
11. devloop clean |
File selection logic and dry-run path |
Copies the script to /usr/local/bin/devloop (or a custom path). Uses sudo if needed.
Sets up DevLoop in the current project. Run once per project (safe to re-run — existing files are merged/upserted).
Creates:
| File | Purpose |
|---|---|
devloop.config.sh |
Your project stack, patterns, conventions |
CLAUDE.md |
Persistent instructions for Claude Code sessions |
.github/copilot-instructions.md |
Persistent instructions for Copilot |
.claude/agents/devloop-orchestrator.md |
Main agent — coordinates the loop |
.claude/agents/devloop-architect.md |
Subagent — designs specs |
.claude/agents/devloop-reviewer.md |
Subagent — reviews implementation |
.devloop/specs/ |
Task specs and reviews |
.devloop/prompts/ |
Extracted Copilot instruction blocks |
Running devloop init again is safe — existing files are merged: DevLoop-managed blocks are updated and missing config keys are appended, while custom content is preserved.
devloop init auto-populates stack/config values by analyzing the current project. Review and adjust as needed:
PROJECT_NAME="MyProject"
PROJECT_STACK="Python, FastAPI, PostgreSQL"
PROJECT_PATTERNS="SOLID, Repository Pattern, Clean Architecture"
PROJECT_CONVENTIONS="type hints everywhere, custom exceptions, no magic strings"
TEST_FRAMEWORK="pytest"
DEVLOOP_MAIN_PROVIDER="claude" # claude | copilot
DEVLOOP_WORKER_PROVIDER="copilot" # claude | copilot | opencode | pi
CLAUDE_MODEL="sonnet" # sonnet | opus
DEVLOOP_FAILOVER_ENABLED="true" # auto-switch on rate limits
DEVLOOP_PROBE_INTERVAL="5" # minutes between provider availability probesLaunches the main provider session with remote control enabled.
- Prevents Mac sleep via
caffeinate -isfor the entire session - Session name appears in Claude app / claude.ai/code for remote access
devloop start
devloop start "Avail OMS" # custom session nameRuns DevLoop in the background with auto-restart and sleep prevention.
devloop daemon # start in background (close terminal safely)
devloop daemon status # check if running + last 10 log lines
devloop daemon log # tail live logs
devloop daemon stop # stop the daemon
devloop daemon uninstall # remove auto-start (launchd or systemd)What daemon does differently:
- Runs in a background process — you can close the terminal
- Auto-restarts on crash with exponential backoff (5s → 60s max, 20 retries)
- macOS: Registers a launchd agent → starts on login automatically
- Linux: Registers a systemd user service → starts on login automatically
→ Walkthrough: USAGE.md — Scenario 2
The configured main provider designs a precise implementation spec.
devloop architect "add GET /orders endpoint with date range filter"
devloop architect "null ref in OrderService.GetActive()" bugfix "OrderService.cs"
devloop architect "extract IOrderRepository interface" refactorTypes: feature (default) | bugfix | refactor | test
Produces:
- Full spec in
.devloop/specs/TASK-YYYYMMDD-HHMMSS.md - Copilot Instructions Block printed to terminal and saved to
.devloop/prompts/
Launches the configured worker provider with the full task spec pre-loaded.
devloop work # uses latest task
devloop work TASK-20260509-143022- Records a git baseline so
devloop reviewdiffs exactly what changed - Prepends live runtime context (stack, patterns, conventions, test framework)
- Worker failover: if the worker hits its limit, automatically cascades to the next in chain (copilot → opencode → pi)
| Mode | Behaviour |
|---|---|
cli (default) |
Runs the worker provider as a local CLI process |
github-agent |
Creates a GitHub Issue; Copilot coding agent opens a PR |
Set DEVLOOP_WORKER_MODE in devloop.config.sh.
The configured main provider reviews the implementation against the original spec using git diff.
devloop review
devloop review TASK-20260509-143022Verdicts:
| Verdict | Meaning |
|---|---|
✅ APPROVED |
Implementation matches spec, tests present |
⚠️ NEEDS_WORK |
Fixable issues — fix instructions provided |
❌ REJECTED |
Wrong approach — consider redesigning spec |
- Canonical machine-readable line (preferred, deterministic):
Verdict: APPROVED|NEEDS_WORK|REJECTED - Reviewer output should put that canonical line as the first non-empty line.
- Parser tolerates fallback variants when canonical line is absent (examples:
### Verdict: NEEDS_WORK,**Verdict:** REJECTED, lowercase/emoji variants likeVerdict: approved ✅). - If canonical
Verdict:exists but value is invalid (example:Verdict: HOLD), result isUNKNOWN(no coercion). - If parsing returns
UNKNOWN, re-run review with a canonical first line:Verdict: APPROVEDVerdict: NEEDS_WORKVerdict: REJECTED
Review is saved to .devloop/specs/TASK-ID-review.md.
Launches the configured worker provider with the reviewer's fix instructions.
devloop fix
devloop fix TASK-20260509-143022Updates the git baseline after fixing, so the next devloop review diffs only the new changes.
Manage automatic provider failover when rate limits hit.
devloop failover status # show current health + probe timing
devloop failover reset # clear all overrides, restore configured providers
devloop failover probe # test all providers right now
devloop failover main copilot # force main to Copilot
devloop failover main clear # restore configured main
devloop failover worker opencode # force worker to OpenCode
devloop failover worker clear # restore configured workerHow auto-failover works:
- Every provider call captures output and checks for rate-limit patterns
- On detection: saves health state, switches to next provider in chain, continues
- On every subsequent command: probes the limited provider (at most every
DEVLOOP_PROBE_INTERVALminutes) - Restores the original provider the moment the probe succeeds — no fixed wait time
Failover chains:
- Main:
claude → copilot - Worker:
copilot → opencode → pi
→ Walkthrough: USAGE.md — Scenario 5
Fetches and caches the latest documentation for all configured providers (24h TTL), checks installed versions, and uses the main AI to analyse what's new.
devloop agent-sync- Cached in
.devloop/agent-docs/— read by Claude on every session - Updates
CLAUDE.mdwith provider-specific insights devloop doctorwarns if docs are stale (>7 days)
Lists all task specs with status icons.
devloop tasks
# ✅ TASK-20260509-143022 add order filtering by date range ✅ approved
# ⚠️ TASK-20260508-141530 paginate product listing ⚠️ needs-work
# ⏳ TASK-20260508-110045 add auth middleware pendingShows the full spec, latest review, and current provider health.
devloop status # latest task
devloop status TASK-20260509-143022Opens the task spec in $EDITOR.
devloop open
devloop open TASK-20260509-143022Prints the Copilot Instructions Block — useful for pasting into Copilot chat manually.
devloop block
devloop block TASK-20260509-143022Removes finalized specs (approved/rejected) older than N days. Pending and needs-work tasks are always preserved.
devloop clean # remove approved/rejected older than 30 days
devloop clean --days 7
devloop clean --dry-run # preview — no changes madeExtracts lessons from the latest review and appends them to CLAUDE.md → ## Learned Patterns. Claude reads these patterns in every future session — this is the self-improvement loop.
devloop learn
devloop learn TASK-20260509-143022Checks for a newer DevLoop version against DEVLOOP_VERSION_URL.
# Set in devloop.config.sh:
DEVLOOP_VERSION_URL="https://raw.githubusercontent.com/you/devloop/main/VERSION"
devloop checkInstalls Claude Code pipeline hooks into .claude/settings.json.
devloop hooks| Hook event | Matcher | What it captures |
|---|---|---|
PreToolUse |
Bash | 3-tier permission classification (BLOCK / ALLOW / ESCALATE) |
PostToolUse |
All | Audit log of every tool call → .devloop/permissions.log |
Stop |
— | Task summary when Claude finishes |
SubagentStop |
— | Which subagent completed + verdict keywords |
Notification |
— | All Claude notifications → .devloop/notifications.log |
SessionStart/End |
— | Session boundaries → .devloop/sessions.log |
Smart permission tiers (PreToolUse on Bash, applied in the interactive Claude session):
| Tier | Action | Examples |
|---|---|---|
| 🚫 BLOCK | Immediate deny | rm -rf /, `curl |
| ✅ ALLOW | Auto-approve | git *, cat/grep/find, pytest, npm test, make, linters |
| ❓ ESCALATE | Ask user | Everything else — dialog → queue → auto-deny after timeout |
Worker providers (non-interactive pipe mode) are not affected by hooks. Instead, Claude worker calls use --allowedTools to scope allowed operations, and Copilot calls use --allow-all-tools --allow-all-paths which is required for non-interactive scripting.
Inspect and manage the permission gate.
devloop permit status # show current mode, pending requests, recent log
devloop permit watch # live-poll pending requests (Linux headless)
devloop permit grant "CMD" # manually approve a queued command
devloop permit deny "CMD" # manually deny a queued command
devloop permit log # show last 50 audit log entries
devloop permit mode smart # smart (default) | auto | strict | offPermission modes:
| Mode | Behaviour |
|---|---|
smart |
Block dangerous, allow known-safe, escalate unknown |
auto |
Allow everything (no interactive prompts — use carefully) |
strict |
Escalate everything except BLOCK list |
off |
Disable DevLoop permission hook entirely |
Set DEVLOOP_PERMISSION_MODE in devloop.config.sh. Set DEVLOOP_PERMISSION_TIMEOUT (default: 60s) for auto-deny timeout.
Views DevLoop pipeline logs.
devloop logs # pipeline log
devloop logs notifications # Claude notifications
devloop logs sessions # session boundariesValidates all dependencies and configuration.
devloop doctorChecks: provider auth, git config, agent files, config file, version currency, stale agent docs.
Generates .github/workflows/devloop-review.yml — a GitHub Actions workflow that triggers Claude to review PRs automatically.
Requires ANTHROPIC_API_KEY secret in the repository.
Manage MCP servers, cross-agent skills (Claude + Copilot), plugins, and Copilot path-specific instructions.
devloop tools audit # global vs project tool inventory
devloop tools suggest # stack-based recommendations
devloop tools add # interactive install
devloop tools sync # copy global tools to project level# Non-interactive flags:
devloop tools add --mcp context7 npx -y @upstash/context7-mcp
devloop tools add --skill code-review "Thorough code review with security checks"
devloop tools add --instruction tests "**/*.test.ts,**/*.spec.ts"
devloop tools add --plugin playwrightSelf-upgrades devloop from DEVLOOP_SOURCE_URL.
devloop update # shows diff, backs up current binary, applies update| Main | Worker | Use case |
|---|---|---|
claude |
copilot |
Default — best balance |
claude |
claude |
Uniform Claude, no Copilot needed |
copilot |
copilot |
Uniform Copilot, no Claude needed |
copilot |
claude |
Copilot orchestrates, Claude implements |
claude |
opencode |
Lightweight worker for smaller tasks |
claude |
pi |
Minimal footprint worker |
Set in devloop.config.sh:
DEVLOOP_MAIN_PROVIDER="claude"
DEVLOOP_WORKER_PROVIDER="copilot"Note:
opencodeandpiare worker-only — they have no remote-control support.
When a provider hits its rate limit, DevLoop automatically switches to the next:
Main: claude → copilot
Worker: copilot → opencode → pi
Each provider is probed for availability every DEVLOOP_PROBE_INTERVAL minutes (default: 5). When it responds, it is restored immediately — no fixed waiting period.
→ Walkthrough: USAGE.md — Scenario 5
# On your Mac (once):
devloop daemon # start, close terminal
# On your phone (Claude app → "DevLoop: MyProject"):
"add pagination to the orders list endpoint"
# Orchestrator responds automatically:
# 📐 Designing spec... (Claude architect)
# 🤖 Implementing... (Copilot worker)
# 🔍 Reviewing... (Claude reviewer)
# ✅ Approved — routes.py, repository.py, test_orders.py changed→ Full walkthroughs: USAGE.md
your-project/
├── devloop.config.sh ← edit this with your stack
├── CLAUDE.md ← Claude Code persistent context
├── copilot-setup-steps.yml ← Copilot agent env (github-agent mode)
├── .github/
│ ├── copilot-instructions.md ← Copilot persistent context
│ ├── copilot/skills/ ← Copilot project skills (repo-shared)
│ ├── instructions/ ← Path-specific Copilot instructions
│ └── workflows/
│ └── devloop-review.yml ← CI review workflow (devloop ci)
├── .copilot/
│ └── skills/ ← Copilot local skills
├── .vscode/
│ └── mcp.json ← Copilot/VS Code MCP servers
├── .mcp.json ← Claude project MCP servers
├── .claude/
│ ├── settings.json ← Claude hooks config (7 events)
│ ├── hooks/
│ │ ├── devloop-permission.sh ← PreToolUse: 3-tier bash classifier
│ │ ├── devloop-audit.sh ← PostToolUse: tool call audit logger
│ │ ├── devloop-stop.sh ← Stop: task summary capture
│ │ ├── devloop-subagent-stop.sh ← SubagentStop: verdict detection
│ │ ├── devloop-notification.sh ← Notification logger
│ │ └── devloop-session.sh ← SessionStart/End logger
│ ├── skills/ ← Claude skills
│ └── agents/
│ ├── devloop-orchestrator.md ← main agent
│ ├── devloop-architect.md ← subagent
│ └── devloop-reviewer.md ← subagent
└── .devloop/
├── provider-health.sh ← auto-failover state (runtime, gitignore)
├── agent-docs/ ← cached provider docs (devloop agent-sync)
│ ├── claude-docs.md
│ ├── copilot-docs.md
│ └── provider-context.md
├── permission-queue/ ← escalated permission requests (runtime)
├── permissions.log ← PostToolUse audit log (runtime)
├── daemon.pid / daemon.log ← daemon state
├── pipeline.log ← hook-captured events
├── notifications.log / sessions.log ← Claude logs
├── specs/
│ ├── TASK-20260509-143022.md ← full spec
│ ├── TASK-20260509-143022.pre-commit ← git baseline
│ ├── TASK-20260509-143022-review.md ← review
│ └── ...
└── prompts/
├── TASK-20260509-143022-copilot.txt ← extracted Copilot block
└── ...
Recommended .gitignore additions:
.devloop/daemon.pid
.devloop/daemon.log
.devloop/launchd*.log
.devloop/provider-health.sh
.devloop/permission-queue/
.devloop/permissions.log
# keep: .devloop/specs/ .devloop/prompts/ .devloop/agent-docs/
| Problem | Solution |
|---|---|
| Mac sleeps → session drops | devloop daemon uses caffeinate -is |
| Terminal closed → session dies | devloop daemon runs in background |
| Mac reboots → session gone | devloop daemon registers launchd agent |
| Linux reboots → session gone | devloop daemon registers systemd user service |
| Provider hits rate limit | Auto-failover to next in chain |
| Crash loop | Exponential backoff (5s→60s), stops after 20 restarts |
| Check what happened | devloop daemon log |
| Start fresh | devloop daemon stop && devloop daemon |
| Remove auto-start | devloop daemon uninstall |
Model cost control:
CLAUDE_MODEL="sonnet" # fast + cheap (default)
CLAUDE_MODEL="opus" # more capable for complex architectureMultiple projects:
Each project gets its own daemon. Run devloop daemon in each project directory.
Refresh Copilot instructions after config changes:
rm .github/copilot-instructions.md && devloop initKeep agent docs current:
devloop agent-sync # refresh provider docs and check for updatesKeep specs in git:
Add .devloop/specs/ to version control — specs document every decision and review.
VS Code integration:
{ "label": "DevLoop Review", "type": "shell", "command": "devloop review", "group": "build" }Preview before cleaning:
devloop clean --days 14 --dry-run # preview
devloop clean --days 14 # applyUnderstand the full data flow: See DEVLOOP-GRAPH.md for 11 Mermaid diagrams.