Orchestrator for running parallel Claude Code agents on multiple tasks
Project description
claude-code-orchestrator
Orchestrator for running parallel Claude Code agents on multiple tasks. Each task runs in its own git worktree with a dedicated agent instance.
Features
- Parallel Task Execution: Run multiple Claude Code agents simultaneously on different tasks
- Git Worktree Isolation: Each task runs in its own worktree to prevent conflicts
- Auto-detect Git Provider: Automatically detects Bitbucket or GitHub from remote URL
- MCP Integration: Uses Bitbucket MCP for Bitbucket repos,
ghCLI for GitHub - Extensible MCP Registry: Configure additional MCPs (Atlassian, Linear, Postgres, Chrome, etc.)
- Project Discovery: Automatically analyzes project structure and conventions
- Task Generation: Generate task configurations from todo.md files
Installation
# Basic installation (uses Claude CLI)
pip install claude-code-orchestrator
# With Anthropic SDK for structured outputs (recommended)
pip install claude-code-orchestrator[sdk]
# With uv
uv add claude-code-orchestrator
uv add anthropic # Optional: for structured outputs
# With pipx (for CLI usage)
pipx install claude-code-orchestrator
Structured Outputs (Recommended)
For better task generation with guaranteed JSON schema compliance:
# Set your Anthropic API key
export ANTHROPIC_API_KEY=your-key-here
# Install with SDK support
pip install claude-code-orchestrator[sdk]
When ANTHROPIC_API_KEY is set, task generation uses Anthropic's structured outputs for more reliable parsing. Falls back to Claude CLI if not configured.
Prerequisites
For GitHub Repositories
# Install GitHub CLI
brew install gh # macOS
# or: sudo apt install gh # Ubuntu
# Authenticate
gh auth login
For Bitbucket Repositories
# Install Bitbucket MCP
pipx install mcp-server-bitbucket
# Configure MCP
claude mcp add bitbucket -s user \
-e BITBUCKET_WORKSPACE=your-workspace \
-e BITBUCKET_EMAIL=your-email \
-e BITBUCKET_API_TOKEN=your-token \
-- mcp-server-bitbucket
Quick Start
# Check prerequisites
claude-orchestrator doctor
# Initialize project configuration
claude-orchestrator init
# Generate tasks from a todo file
claude-orchestrator generate --from-todo todo.md
# Run all tasks
claude-orchestrator run
# Or combine generation and execution
claude-orchestrator run --from-todo todo.md --execute
Configuration
Configuration is loaded from two sources (later overrides earlier):
- Global config:
~/.config/claude-orchestrator/config.yaml - Project config:
.claude-orchestrator.yaml
Project Configuration
Create .claude-orchestrator.yaml in your project root:
# Git settings (auto-detected if not specified)
git:
provider: auto # "bitbucket" / "github" / auto-detect
base_branch: develop
destination_branch: develop
repo_slug: my-repo # Required for Bitbucket
worktree_dir: ../worktrees
# MCPs to enable for agents
mcps:
enabled:
- atlassian # For Jira ticket updates
- linear # For issue tracking
# Project context (auto-discovered if not specified)
project:
key_files:
- src/main.py
- tests/
test_command: pytest tests/
Global Configuration
Set defaults that apply to all projects:
# Set global default base branch
claude-orchestrator config --global git.base_branch develop
# View global config
claude-orchestrator config --global --list
Global config is stored in ~/.config/claude-orchestrator/config.yaml.
CLI Commands
doctor
Check all prerequisites and configuration:
claude-orchestrator doctor
Output:
✓ Git provider: GitHub (github.com detected)
✓ gh CLI: installed and authenticated
✓ MCP atlassian: configured
✗ MCP linear: not configured
Run: pipx install mcp-server-linear && claude mcp add linear...
init
Initialize project configuration:
claude-orchestrator init
This will:
- Detect git provider
- Analyze project structure
- Create
.claude-orchestrator.yaml
generate
Generate task configuration from a todo file:
claude-orchestrator generate --from-todo todo.md
config
Get or set configuration values (similar to git config or gh config):
# List all configuration (merged: global + project)
claude-orchestrator config --list
# Get a specific value
claude-orchestrator config git.base_branch
# Set a project-level value
claude-orchestrator config git.base_branch develop
# Set a global value (applies to all projects)
claude-orchestrator config --global git.base_branch develop
Available keys:
git.provider- Git provider ("auto", "github", "bitbucket")git.base_branch- Base branch for PRsgit.destination_branch- Target branch for PRsgit.repo_slug- Repository slug (Bitbucket)worktree_dir- Directory for git worktreesproject.test_command- Test command to runmcps.enabled- Comma-separated list of MCPsworkflow.mode- Workflow mode ("review" or "yolo")workflow.auto_approve- Auto-approve agent actions (true/false)workflow.auto_pr- Create PRs automatically (true/false)workflow.stop_after_generate- Stop after generating tasks (true/false)tools.permission_mode- Permission mode (default, acceptEdits, plan, dontAsk, bypassPermissions)tools.allowed_cli- Comma-separated CLI tools to allow (gh, az, aws, docker, etc.)tools.allowed_tools- Comma-separated tool patterns (Bash(git:*), Edit, Read)tools.disallowed_tools- Comma-separated tool patterns to denytools.skip_permissions- Skip all permissions (true/false, DANGEROUS)agent.inactivity_timeout- Seconds without output before timeout (default: 300)agent.max_runtime- Maximum seconds per task (default: 3600)agent.max_retries- Number of retry attempts (default: 2)agent.use_resume- Useclaude --resumefor retries (true/false)agent.retry_delay- Seconds to wait between retries (default: 5)
run
Execute tasks:
# Run all tasks (from existing task_config.yaml)
claude-orchestrator run
# Run specific tasks
claude-orchestrator run --tasks task1,task2
# Generate from todo, stop for review (default)
claude-orchestrator run --from-todo todo.md
# Generate and execute without stopping
claude-orchestrator run --from-todo todo.md --execute
# YOLO: Generate, execute, and create PRs without stopping
claude-orchestrator run --from-todo todo.md --yolo
# Auto-approve all agent actions
claude-orchestrator run --auto-approve
yolo
Shortcut for full YOLO mode:
# Generate tasks, execute, and create PRs in one go
claude-orchestrator yolo TODO.md
# Equivalent to:
claude-orchestrator run --from-todo TODO.md --yolo
review
Review and test pull requests using Claude Code agents:
# Interactive: list open PRs and select
claude-orchestrator review
# Review specific PR
claude-orchestrator review --pr 42
# Review PRs from last run
claude-orchestrator review --from-run
# Auto-merge after successful review
claude-orchestrator review --automerge --auto-approve
Note for Bitbucket repositories: The review command needs to fetch PRs directly via the Bitbucket API (agents use the MCP). Set these environment variables:
export BITBUCKET_WORKSPACE=your-workspace
export BITBUCKET_EMAIL=your-email@example.com
export BITBUCKET_API_TOKEN=your-app-password
You can get an App Password from Bitbucket Settings.
status
Show status of previous run:
claude-orchestrator status
Workflow Modes
Configure how much the orchestrator stops for review:
| Mode | Description |
|---|---|
review (default) |
Stop after generating tasks for review |
yolo |
Run everything without stopping |
Configure via CLI
# Set workflow mode globally
claude-orchestrator config --global workflow.mode yolo
# Or per-project
claude-orchestrator config workflow.mode yolo
# Enable auto-approve (agents won't ask for confirmation)
claude-orchestrator config workflow.auto_approve true
# Disable automatic PR creation
claude-orchestrator config workflow.auto_pr false
Configure in .claude-orchestrator.yaml
workflow:
mode: yolo # "review" or "yolo"
auto_approve: true # Automatically approve agent actions
auto_pr: true # Create PRs automatically
stop_after_generate: false # Fine-grained: stop after task generation
Tools & Permissions
Configure which CLI tools agents can use and their permission levels:
Allow CLI Tools
# Allow specific CLI tools (gh, aws, az, docker, etc.)
claude-orchestrator config tools.allowed_cli "gh,az,aws,docker"
# View current settings
claude-orchestrator config tools.allowed_cli
These get converted to --allowedTools Bash(gh:*) Bash(az:*) ... when running agents.
Permission Modes
# Set permission mode for agents
claude-orchestrator config tools.permission_mode acceptEdits
Available modes:
| Mode | Description |
|---|---|
default |
Normal permissions with prompts |
acceptEdits |
Auto-accept file edits |
plan |
Show plan before executing |
dontAsk |
Don't ask for confirmations |
bypassPermissions |
Skip all permission checks |
Advanced Tool Configuration
# Allow specific tools patterns
claude-orchestrator config tools.allowed_tools "Bash(git:*),Edit,Read"
# Disallow dangerous tools
claude-orchestrator config tools.disallowed_tools "Bash(rm:*),Bash(sudo:*)"
# Skip all permissions (only for sandboxed environments!)
claude-orchestrator config tools.skip_permissions true
# Add extra directories for tool access
claude-orchestrator config tools.add_dirs "/path/to/shared/config"
Configuration in .claude-orchestrator.yaml
tools:
permission_mode: acceptEdits
allowed_cli:
- gh
- az
- aws
- docker
allowed_tools:
- "Bash(git:*)"
- Edit
- Read
disallowed_tools:
- "Bash(rm:-rf:*)"
add_dirs:
- ../shared-config
skip_permissions: false # Only for sandboxed environments!
Project-specific vs CLAUDE.md
You have two options for tool configuration:
-
.claude-orchestrator.yaml(recommended for orchestrator tasks)- Centralized configuration
- Applies to all agents launched by the orchestrator
- Version controlled with your project
-
CLAUDE.mdin your project- Applies to all Claude Code sessions in that project
- Good for general project instructions
- Not specific to orchestrator tasks
Agent Timeouts & Retry
Agents can get stuck or hang. The orchestrator monitors agent activity in real-time and can automatically retry with session resume.
How It Works
- Real-time Streaming: Uses
claude --output-format stream-jsonto receive events in real-time - Activity Monitoring: Each JSON event resets the inactivity timer (tool calls, text output, etc.)
- Inactivity Timeout: If no events for N seconds, the agent is considered stuck
- Retry with Resume: Use
claude --resume <session_id>to continue from where it left off - Max Runtime: Hard limit on total agent execution time
Log Format
The orchestrator converts JSON events to human-readable logs:
[INIT] Session: 8b05f910... Model: claude-opus-4-5-20251101
I'll help you with this task...
[TOOL] Bash: git status
[RESULT] On branch feature/my-task...
[COMPLETE] Duration: 45.2s
Configuration
# Set inactivity timeout (default: 300s = 5 minutes)
claude-orchestrator config agent.inactivity_timeout 300
# Set max runtime per task (default: 3600s = 1 hour)
claude-orchestrator config agent.max_runtime 3600
# Set number of retries (default: 2)
claude-orchestrator config agent.max_retries 2
# Enable/disable session resume (default: true)
claude-orchestrator config agent.use_resume true
# Delay between retries (default: 5s)
claude-orchestrator config agent.retry_delay 5
In .claude-orchestrator.yaml
agent:
inactivity_timeout: 300 # 5 minutes no output = stuck
max_runtime: 3600 # 1 hour max per task
max_retries: 2 # Try up to 3 times total
use_resume: true # Resume from session state
retry_delay: 5 # Wait 5s between retries
Execution Summary
After running tasks, you'll see retry information:
EXECUTION SUMMARY
================
✓ task-1 (feature/task-1)
Status: success
Attempts: 1
⏱ task-2 (feature/task-2)
Status: timeout
Attempts: 3
Error: Agent timed out (inactivity) after 3 attempt(s)
Session ID (for manual resume): abc123-def456
Manual Resume
If a task times out after all retries, you can manually resume:
cd path/to/worktree
claude --resume abc123-def456
Custom Testing Instructions
For projects with complex testing requirements, you can provide detailed testing instructions:
Configuration
# .claude-orchestrator.yaml
project:
test_command: "pytest tests/unit/" # Quick command fallback
# Detailed instructions (overrides test_command in prompts)
test_instructions: |
## Testing Requirements
1. Run unit tests first:
```bash
pytest tests/unit/ -v
```
2. For final validation, run the full pipeline test:
```bash
python scripts/test_full_pipeline.py
```
**Important**: This test can take up to 15 minutes to complete.
Monitor the status output and check logs to verify everything works.
3. Only commit if all tests pass.
When test_instructions is provided, it completely replaces the simple "run this command" instruction with your detailed markdown instructions.
PR Review Phase
After tasks complete and create PRs, you can have Claude agents review, test, and fix them:
Review Commands
# Interactive: list open PRs and select which to review
claude-orchestrator review
# Review a specific PR by ID
claude-orchestrator review --pr 42
# Review PRs from the last orchestrator run
claude-orchestrator review --from-run
# Auto-merge PRs after successful review
claude-orchestrator review --automerge
# Combine with task execution
claude-orchestrator run --from-todo todo.md --with-review
Review Configuration
# .claude-orchestrator.yaml
review:
automerge: false # Merge PRs after successful review
test_before_merge: true # Run tests before approving
require_all_tests_pass: true # All tests must pass
# Optional: different tool permissions for reviewers
tools:
permission_mode: acceptEdits
allowed_cli:
- gh
Review Workflow
- Checkout: Agent checks out the PR branch
- Code Review: Reviews changes for correctness and conventions
- Testing: Runs tests using
test_instructions(if configured) - Fix Issues: If issues found, fixes and commits them
- Approve/Merge: Approves the PR or merges (if automerge enabled)
Interactive PR Selection
When running claude-orchestrator review without arguments:
Available Pull Requests:
# │ ID │ Title │ Branch │ Author
──┼────┼───────────────────────────┼───────────────────┼─────────
1 │ 42 │ feat: add user auth │ feature/user-auth │ alice
2 │ 43 │ fix: database connection │ fix/db-conn │ bob
3 │ 44 │ docs: update readme │ docs/readme │ charlie
Select PRs to review (comma-separated numbers, 'all', or 'q' to quit): 1,2
Optional MCPs
| MCP | Auth Type | Use Case |
|---|---|---|
atlassian |
OAuth | Jira/Confluence integration |
linear |
OAuth | Issue tracking |
postgres |
Env vars | Database access |
chrome |
Pre-configured | Browser automation |
Setting up OAuth MCPs
# Install the MCP
pipx install mcp-server-atlassian
# Add to Claude (first run will open browser for OAuth)
claude mcp add atlassian -s user -- mcp-server-atlassian
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_code_orchestrator-0.4.1.tar.gz.
File metadata
- Download URL: claude_code_orchestrator-0.4.1.tar.gz
- Upload date:
- Size: 40.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d9b24ea9618cd9cf3663010c980128e6a88ce2c03a884277fd7b580e3d3e917
|
|
| MD5 |
70d00beed50f01d00a8c754997656101
|
|
| BLAKE2b-256 |
f62489c652cd7ffe1029422de4af68494d8844c60fd2a83f16ce2a2d64a8ea86
|
Provenance
The following attestation bundles were made for claude_code_orchestrator-0.4.1.tar.gz:
Publisher:
publish.yml on JaviMaligno/claude-code-orchestrator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_code_orchestrator-0.4.1.tar.gz -
Subject digest:
7d9b24ea9618cd9cf3663010c980128e6a88ce2c03a884277fd7b580e3d3e917 - Sigstore transparency entry: 773087584
- Sigstore integration time:
-
Permalink:
JaviMaligno/claude-code-orchestrator@aa933c6ebeccbd1a11ef9097ceba1bcc79dd5c33 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/JaviMaligno
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aa933c6ebeccbd1a11ef9097ceba1bcc79dd5c33 -
Trigger Event:
push
-
Statement type:
File details
Details for the file claude_code_orchestrator-0.4.1-py3-none-any.whl.
File metadata
- Download URL: claude_code_orchestrator-0.4.1-py3-none-any.whl
- Upload date:
- Size: 46.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad85e0413285b9fb1dca7444787ad036329749ec5ccb73609c5b66c71ab25168
|
|
| MD5 |
5f8fbcf6227b53aee2c11435ff49b79b
|
|
| BLAKE2b-256 |
c6a8149299a500af66a0ce620a43d8f4e6745ee005dd12b753393dd37f8545d2
|
Provenance
The following attestation bundles were made for claude_code_orchestrator-0.4.1-py3-none-any.whl:
Publisher:
publish.yml on JaviMaligno/claude-code-orchestrator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_code_orchestrator-0.4.1-py3-none-any.whl -
Subject digest:
ad85e0413285b9fb1dca7444787ad036329749ec5ccb73609c5b66c71ab25168 - Sigstore transparency entry: 773087648
- Sigstore integration time:
-
Permalink:
JaviMaligno/claude-code-orchestrator@aa933c6ebeccbd1a11ef9097ceba1bcc79dd5c33 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/JaviMaligno
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aa933c6ebeccbd1a11ef9097ceba1bcc79dd5c33 -
Trigger Event:
push
-
Statement type: