20以上のClaude Codeエージェントを並列実行するオーケストレーションフレームワーク。tmuxモニタリング対応。
Orchestrate multiple Claude Code agents working in parallel to improve your codebase through automated bug fixing or systematic best practices implementation
Claude Code Agent Farm is a powerful orchestration framework that runs multiple Claude Code (cc) sessions in parallel to systematically improve your codebase. It supports multiple technology stacks and workflow types, allowing teams of AI agents to work together on large-scale code improvements.
max_agents config)uv)claude command installed and configured)bun for Next.js, mypy/ruff for Python)cc AliasThe agent farm requires a special cc alias to launch Claude Code with the necessary permissions:
alias cc="ENABLE_BACKGROUND_TASKS=1 claude --dangerously-skip-permissions"
This alias will be configured automatically by the setup script.
git clone https://github.com/Dicklesworthstone/claude_code_agent_farm.git
cd claude_code_agent_farm
chmod +x setup.sh
./setup.sh
The setup script will:
cc alias with automatic detection and fixing of common mis-quotingsRun the pre-flight verifier to ensure everything is configured correctly:
claude-code-agent-farm doctor --path /path/to/project
This command checks:
For faster command entry with tab completion:
# Auto-detect shell and install completion
claude-code-agent-farm install-completion
# Or specify shell explicitly
claude-code-agent-farm install-completion --shell bash
claude-code-agent-farm install-completion --shell zsh
claude-code-agent-farm install-completion --shell fish
# Next.js project
claude-code-agent-farm --path /path/to/project --config configs/nextjs_config.json
# Python project
claude-code-agent-farm --path /path/to/project --config configs/python_config.json
# Ensure you have a best practices guide in place
cp best_practices_guides/NEXTJS15_BEST_PRACTICES.md /path/to/project/best_practices_guides/
# Run with best practices config
claude-code-agent-farm --path /path/to/project --config configs/nextjs_best_practices_config.json
The project includes a comprehensive modular system for setting up development environments:
Run the interactive menu:
cd tool_setup_scripts
./setup.sh
Or run specific setups directly:
Python FastAPI (setup_python_fastapi.sh)
Go Web Apps (setup_go_webapps.sh)
Next.js (setup_nextjs.sh)
SvelteKit/Remix/Astro (setup_sveltekit_remix_astro.sh)
Rust Development (setup_rust.sh)
Java Enterprise (setup_java_enterprise.sh)
Bash/Zsh Scripting (setup_bash_zsh.sh)
Cloud Native DevOps (setup_cloud_native_devops.sh)
GenAI/LLM Ops (setup_genai_llm_ops.sh)
Data Engineering (setup_data_engineering.sh)
Serverless Edge (setup_serverless_edge.sh)
Terraform Azure (setup_terraform_azure.sh)
Angular (setup_angular.sh)
Flutter (setup_flutter.sh)
React Native (setup_react_native.sh)
Additional setup scripts are available for:
setup_php_laravel.sh)setup_cpp_systems.sh)setup_solana_anchor.sh)setup_ansible.sh)setup_llm_dev_testing.sh)setup_llm_eval_observability.sh)setup_kubernetes_ai_inference.sh)This project consists of two independent scripts that work together:
claude_code_agent_farm.py) - The Brain 🧠This is the main orchestrator that does all the heavy lifting:
You run this script and it stays running (unless using --no-monitor mode). The monitoring dashboard is displayed in the tmux session's controller window, not in the launching terminal.
view_agents.sh) - The Window 🪟This is an optional convenience tool for viewing the tmux session:
Think of it like this:
There's a hidden command for running just the monitor display:
claude-code-agent-farm monitor-only --path /project --session claude_agents
This reads the monitor state file and displays the dashboard without launching agents.
Agents work through type-checker and linter problems in parallel:
Agents systematically implement modern best practices:
@<STACK>_BEST_PRACTICES_IMPLEMENTATION_PROGRESS.md)The most sophisticated workflow option transforms the agent farm into a coordinated development team capable of complex, strategic improvements. Amazingly, this powerful feature is implemented entire by means of the prompt file! No actual code is needed to effectuate the system; rather, the LLM (particularly Opus 4) is simply smart enough to understand and reliably implement the system autonomously:
This workflow implements a distributed coordination protocol that allows multiple agents to work on the same codebase simultaneously without conflicts. The system creates a /coordination/ directory structure in your project:
/coordination/
├── active_work_registry.json # Central registry of all active work
├── completed_work_log.json # Log of completed tasks
├── agent_locks/ # Directory for individual agent locks
│ └── {agent_id}_{timestamp}.lock
└── planned_work_queue.json # Queue of planned but not started work
Unique Agent Identity: Each agent generates a unique ID (agent_{timestamp}_{random_4_chars})
Work Claiming Process: Before starting any work, agents must:
Conflict Prevention: The lock file system prevents multiple agents from:
Smart Work Distribution: Agents automatically:
This coordination system solves several critical problems:
This workflow excels at:
To use this workflow, specify the cooperating agents prompt:
claude-code-agent-farm \
--path /project \
--prompt-file prompts/cooperating_agents_improvement_prompt_for_python_fastapi_postgres.txt \
--agents 5
The project includes pre-configured support for:
Each stack includes:
Create your own configuration:
{
"comment": "Custom Rust configuration",
"tech_stack": "rust",
"problem_commands": {
"type_check": ["cargo", "check"],
"lint": ["cargo", "clippy", "--", "-D", "warnings"]
},
"best_practices_files": ["./guides/RUST_BEST_PRACTICES.md"],
"chunk_size": 30,
"prompt_file": "prompts/rust_prompt.txt",
"agents": 15,
"max_agents": 50,
"auto_restart": true,
"git_branch": "feature/rust-improvements",
"git_remote": "origin"
}
{
"comment": "Human-readable description",
"tech_stack": "nextjs",
"problem_commands": {
"type_check": ["bun", "run", "type-check"],
"lint": ["bun", "run", "lint"],
"test": ["bun", "run", "test"]
},
"best_practices_files": ["./best_practices_guides/NEXTJS15_BEST_PRACTICES.md"],
"chunk_size": 50,
"agents": 20,
"max_agents": 50,
"session": "claude_agents",
"prompt_file": "prompts/default_prompt_nextjs.txt",
"auto_restart": true,
"context_threshold": 20,
"idle_timeout": 60,
"max_errors": 3,
"git_branch": null,
"git_remote": "origin",
"tmux_kill_on_exit": true,
"tmux_mouse": true,
"stagger": 10.0,
"wait_after_cc": 15.0,
"check_interval": 10,
"skip_regenerate": false,
"skip_commit": false,
"no_monitor": false,
"attach": false,
"fast_start": false,
"full_backup": false
}
All configuration options can be overridden via CLI:
claude-code-agent-farm \
--path /project \
--config configs/base.json \
--agents 10 \
--chunk-size 30 \
--auto-restart
Commands:
doctor Run pre-flight verification checks
monitor-only Display monitor dashboard (internal use)
Required:
--path PATH Project root directory
Agent Configuration:
--agents N, -n N Number of agents (default: 20)
--session NAME, -s NAME tmux session name (default: claude_agents)
--chunk-size N Override config chunk size
Timing:
--stagger SECONDS Delay between starting agents (default: 10.0)
--wait-after-cc SECONDS Wait time after launching cc (default: 15.0)
--check-interval SECONDS Health check interval (default: 10)
Features:
--skip-regenerate Skip regenerating problems file
--skip-commit Skip git commit/push
--auto-restart Enable automatic agent restart
--no-monitor Just launch agents and exit
--attach Attach to tmux after setup
Advanced:
--prompt-file PATH Custom prompt file
--config PATH JSON configuration file
--context-threshold N Auto-clear context when context ≤ N% (default: 20)
--idle-timeout SECONDS Mark agent idle after N seconds (default: 60)
--max-errors N Disable agent after N errors (default: 3)
--commit-every N Commit after every N regeneration cycles
--tmux-kill-on-exit Kill tmux session on exit (default: true)
--no-tmux-kill-on-exit Keep tmux session running after exit
--tmux-mouse Enable tmux mouse support (default: true)
--no-tmux-mouse Disable tmux mouse support
--fast-start Skip shell prompt detection
--full-backup Full backup of Claude settings before start
The system includes specialized prompts for all workflows and tech stacks:
default_prompt.txt - Generic bug fixingdefault_prompt_nextjs.txt - Next.js specificdefault_prompt_python.txt - Python specificbug_fixing_prompt_for_nextjs.txt - Advanced Next.js fixingcooperating_agents_improvement_prompt_for_python_fastapi_postgres.txt - Multi-agent coordination systemdefault_best_practices_prompt.txt - Generic implementationcontinue_best_practices_prompt.txt - Continue existing workdefault_best_practices_prompt_nextjs.txt - Next.js 15default_best_practices_prompt_angular.txt - Angulardefault_best_practices_prompt_sveltekit.txt - SvelteKitdefault_best_practices_prompt_remix_astro.txt - Remix/Astrodefault_best_practices_prompt_flutter.txt - Flutterdefault_best_practices_prompt_laravel.txt - Laraveldefault_best_practices_prompt_php.txt - PHPdefault_best_practices_prompt_python.txt - Python/FastAPIdefault_best_practices_prompt_rust_web.txt - Rust web appsdefault_best_practices_prompt_rust_system.txt - Rust systemsdefault_best_practices_prompt_rust_cli.txt - Rust CLI toolsdefault_best_practices_prompt_go.txt - Go applicationsdefault_best_practices_prompt_java.txt - Java enterprisedefault_best_practices_prompt_cpp.txt - C++ systemsdefault_best_practices_prompt_bash_zsh.txt - Shell scriptingdefault_best_practices_prompt_terraform_azure.txt - IaCdefault_best_practices_prompt_cloud_native_devops.txt - DevOpsdefault_best_practices_prompt_ansible.txt - Ansible automationdefault_best_practices_prompt_vault.txt - HashiCorp Vaultdefault_best_practices_prompt_genai_llm_ops.txt - AI/ML opsdefault_best_practices_prompt_llm_dev_testing.txt - LLM developmentdefault_best_practices_prompt_llm_eval_observability.txt - LLM evaluationdefault_best_practices_prompt_data_engineering.txt - Data pipelinesdefault_best_practices_prompt_data_lakes.txt - Data lakesdefault_best_practices_prompt_polars.txt - Polars/DuckDBdefault_best_practices_prompt_excel.txt - Excel automationdefault_best_practices_prompt_serverless_edge.txt - Edge computingdefault_best_practices_prompt_kubernetes_ai.txt - Kubernetes AIdefault_best_practices_prompt_security.txt - Security engineeringdefault_best_practices_prompt_hardware.txt - Hardware developmentdefault_best_practices_prompt_unreal.txt - Unreal Enginedefault_best_practices_prompt_solana.txt - Solana blockchaindefault_best_practices_prompt_cosmos.txt - Cosmos blockchaindefault_best_practices_prompt_react_native.txt - React NativePrompts support dynamic variables:
{chunk_size} - Replaced with configured chunk sizeExample in prompt:
Work on approximately {chunk_size} improvements at a time...
.claude_agent_farm_backups/ in your project--full-backup flag~/.claude/.agent_farm_launch.lockThe Python script includes a real-time monitoring dashboard that shows:
Each tmux pane displays context warnings in its title bar:
The monitoring dashboard runs in the tmux controller window:
Claude Agent Farm - 14:32:15
┏━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━┓
┃ Agent ┃ Status ┃ Cycles ┃ Context ┃ Runtime ┃ Heartbeat┃ Errors ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━┩
│ Pane 00 │ working │ 2 │ 75% │ 0:05:23 │ 12s │ 0 │
│ Pane 01 │ working │ 2 │ 82% │ 0:05:19 │ 8s │ 0 │
│ Pane 02 │ idle │ 3 │ 45% │ 0:05:15 │ 45s │ 0 │
└──────────┴────────────┴────────┴──────────┴──────────────┴──────────┴────────┘
# Use the viewer script
./view_agents.sh
# Direct tmux commands
tmux attach -t claude_agents
tmux attach -t claude_agents:controller # Dashboard only
Press Ctrl+R from any tmux window to broadcast the /clear command to all agents simultaneously. This frees up context across all agents with a single keystroke, useful when multiple agents are running low on context.
When --auto-restart is enabled:
The system writes monitor state to .claude_agent_farm_state.json in the project directory. This file contains:
Structure:
{
"session": "claude_agents",
"num_agents": 20,
"agents": {
"0": {
"status": "working",
"start_time": "2024-01-15T10:30:00",
"last_activity": "2024-01-15T10:35:00",
"last_restart": null,
"cycles": 2,
"last_context": 75,
"errors": 0,
"restart_count": 0
}
},
"start_time": "2024-01-15T10:30:00",
"timestamp": "2024-01-15T10:35:00"
}
External tools can read this file to monitor the farm's progress.
At the end of each run, the system generates a comprehensive HTML report with:
Reports are saved as agent_farm_report_YYYYMMDD_HHMMSS.html in the project directory.
Features:
# 5 agents, skip git operations
claude-code-agent-farm --path /project -n 5 --skip-regenerate --skip-commit
# Full run with Python project
claude-code-agent-farm \
--path /python/project \
--config configs/python_uv_config.json \
--agents 15 \
--auto-restart
# Systematic improvements
claude-code-agent-farm \
--path /nextjs/project \
--config configs/nextjs_best_practices_config.json \
--agents 10
# Commit progress every 5 cycles
claude-code-agent-farm \
--path /project \
--config configs/python_config.json \
--agents 20 \
--commit-every 5 \
--auto-restart
# Override config settings
claude-code-agent-farm \
--path /project \
--config configs/base.json \
--chunk-size 25 \
--context-threshold 15 \
--idle-timeout 120
# Run without monitoring (for CI/CD)
claude-code-agent-farm \
--path /project \
--config configs/ci-config.json \
--no-monitor \
--auto-restart
# Angular development
claude-code-agent-farm \
--path /angular/project \
--config configs/angular_config.json
# Blockchain development
claude-code-agent-farm \
--path /solana/project \
--config configs/solana_anchor_config.json
# Data engineering
claude-code-agent-farm \
--path /data/project \
--config configs/polars_duckdb_config.json
# Advanced multi-agent coordination for complex improvements
claude-code-agent-farm \
--path /project \
--prompt-file prompts/cooperating_agents_improvement_prompt_for_python_fastapi_postgres.txt \
--agents 20 \
--auto-restart
cc alias: alias | grep cccc--wait-after-cc timing--full-backup flag if settings corruption suspectedhtop~/.claude/backups/--full-backup for comprehensive backup.claude_agent_farm_state.json for agent status.heartbeats/agent*.heartbeat for activity tracking.agent_farm_launch.lock in ~/.claude/.claude_agent_farm_backups/ in project contains settings backupsclaude-code-agent-farm doctor to diagnose issuestmux kill-session -t claude_agents to force cleanupclaude_code_agent_farm/
├── claude_code_agent_farm.py # Main orchestrator
├── view_agents.sh # Tmux viewer utility
├── setup.sh # Automated setup
├── pyproject.toml # Python project configuration
├── uv.lock # Locked dependencies
├── .envrc # direnv configuration
├── .gitignore # Git ignore patterns
├── configs/ # 33 configuration files
│ ├── nextjs_config.json # Next.js bug fixing
│ ├── python_config.json # Python bug fixing
│ ├── python_uv_config.json # Python with uv
│ ├── nextjs_best_practices_config.json
│ ├── angular_config.json # Angular development
│ ├── flutter_config.json # Flutter mobile
│ ├── rust_system_config.json # Rust systems programming
│ ├── rust_webapps_config.json # Rust web apps
│ ├── rust_cli_config.json # Rust CLI tools
│ ├── go_webapps_config.json # Go web development
│ ├── java_enterprise_config.json # Java enterprise
│ ├── cpp_systems_config.json # C++ systems
│ ├── php_config.json # PHP development
│ ├── laravel_config.json # Laravel framework
│ ├── sveltekit2_config.json # SvelteKit framework
│ ├── remix_astro_config.json # Remix/Astro frameworks
│ ├── bash_zsh_config.json # Shell scripting
│ ├── terraform_azure_config.json # Infrastructure as Code
│ ├── cloud_native_devops_config.json # DevOps tools
│ ├── ansible_config.json # Ansible automation
│ ├── vault_config.json # HashiCorp Vault
│ ├── genai_llm_ops_config.json # AI/ML operations
│ ├── data_engineering_config.json # Data pipelines
│ ├── data_lakes_config.json # Kafka/Snowflake/Spark
│ ├── polars_duckdb_config.json # Data processing
│ ├── excel_automation_config.json # Excel automation
│ ├── serverless_edge_config.json # Edge computing
│ ├── security_engineering_config.json # Security
│ ├── hardware_dev_config.json # Hardware development
│ ├── unreal_engine_config.json # Game development
│ ├── solana_anchor_config.json # Solana blockchain
│ ├── cosmos_blockchain_config.json # Cosmos blockchain
│ └── sample.json # Example configuration
├── prompts/ # 37 prompt templates
│ ├── Bug fixing prompts (4)
│ ├── Cooperating agents prompts (1)
│ ├── Generic best practices prompts (2)
│ └── Stack-specific best practices prompts (30)
├── best_practices_guides/ # 35 best practices documents
│ ├── Web Development (7 guides)
│ ├── Systems & Languages (7 guides)
│ ├── DevOps & Infrastructure (5 guides)
│ ├── Data & AI (6 guides)
│ └── Specialized Domains (6 guides)
├── tool_setup_scripts/ # 24 development environment setup scripts
│ ├── setup.sh # Interactive menu
│ ├── common_utils.sh # Shared utilities
│ ├── README.md # Setup scripts documentation
│ ├── Web Development (4 scripts)
│ ├── Systems & Languages (3 scripts)
│ ├── DevOps & Infrastructure (3 scripts)
│ └── Data & AI (3 scripts)
└── __pycache__/ # Python cache (gitignored)
max_agents)--no-monitor for headless operation#!/bin/bash
# Automated code improvement script
claude-code-agent-farm \
--path $PROJECT_PATH \
--config configs/ci-config.json \
--no-monitor \
--auto-restart \
--skip-commit \
--agents 10
Configure custom git branches and remotes in your config:
{
"git_branch": "feature/ai-improvements",
"git_remote": "upstream",
"skip_commit": false
}
max(10, total_lines / agents / 2)--commit-every N to commit progress periodically
{chunk_size} - Replaced with configured chunk size--fast-start flag skips prompt detection for faster launchesecho with a unique marker and waits for the response – works even with minimal or heavily customised prompts
Works seamlessly with bash, zsh, fish, and other POSIX-compatible shells
--fast-start flag remains available to skip detection entirely for advanced users who want the quickest possible launchContributions welcome! Please:
configs/ (34 examples to follow)prompts/ (37 examples available)best_practices_guides/ (35 examples)tool_setup_scripts/ (15 examples)Created by Jeffrey Emanuel (jeffrey.emanuel@gmail.com)
MIT License (with OpenAI/Anthropic Rider) — see LICENSE file
.claude_agent_farm_state.json) for external integrations.heartbeats/agent*.heartbeat) track agent activity.claude_agent_farm_backups/ in your projectrm ~/.claude/.agent_farm_launch.locktmux kill-session -t claude_agentshtop during runsHappy farming! 🚜 May your code be clean and your agents productive.
| Category | Count | Examples |
|---|---|---|
| Web Development | 8 | Next.js, Angular, Flutter, Laravel, React Native |
| Systems & Languages | 7 | Python, Rust, Go, Java, C++ |
| DevOps & Infrastructure | 6 | Terraform, Kubernetes, Ansible |
| Data & AI | 8 | GenAI/LLM, Data Lakes, PostgreSQL 17, Polars |
| Specialized | 5 | Security, Hardware, Blockchain |
| Total | 34 |
| Resource | Count |
|---|---|
| Configuration Files | 37 |
| Prompt Templates | 37 |
| Best Practices Guides | 35 |
| Tool Setup Scripts | 24 |
互換性
トピック