huashu-agent-swarm
Original:🇨🇳 Chinese
Translated
7 scriptsChecked / no sensitive code detected
Multi-Agent Swarm Parallel Collaboration, pure Git self-organization, suitable for large-scale project development. Use this when users mention "swarm mode", "multi-agent", "parallel development", "agent swarm".
11installs
Sourcealchaincyf/huashu-skills
Added on
NPX Install
npx skill4agent add alchaincyf/huashu-skills huashu-agent-swarmTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Infinite Agent Loop - Infinite Agent Swarm Mode
Inspired by Nicholas Carlini using 16 Claude instances to independently build a C compiler. No master agent, pure Git self-organization, each agent independently claims tasks, writes code, and pushes.
Trigger Conditions
Use this skill when users mention "swarm mode", "multi-agent parallel", "infinite loop", "agent swarm", "start swarm".
Prerequisites
- tmux ()
brew install tmux - claude CLI (installed)
- Git repository (existing or newly created)
Usage Process
Step 1: Describe the Project
Users tell me:
- Project directory path (must be a Git repository)
- Project goals and overall description
- Initial task list (or let agents break down tasks automatically)
- Number of agents (default: 8)
- Code specifications and test commands
Step 2: Initialize the Project
bash
bash SKILL_DIR/scripts/setup_project.sh <project directory>This will create in the project:
- - Generated from template, needs to be customized according to user requirements
AGENT_PROMPT.md - - Initial task list
TASKS.md - - Task claim directory
current_tasks/ - - Log directory
agent_logs/
Then I customize based on , filling in specific project information.
AGENT_PROMPT.mdreferences/agent-prompt-template.mdStep 3: Start the Swarm
bash
bash SKILL_DIR/scripts/start_swarm.sh <number of agents> <project directory>This will:
- Create a git worktree for each agent (shares .git object library, no disk waste)
- Create a tmux session, one agent per pane
- Each agent enters an infinite loop: pull → claim task → execute → push → next
Step 4: Open the Dashboard
bash
python3 SKILL_DIR/scripts/dashboard.py <project directory> 8420Open http://localhost:8420 in browser, you can:
- View real-time status of all agents, git log, task progress
- View the latest logs of each agent
- Send instructions directly to agents via input box (writes to HUMAN_INPUT.md)
- Stop all agents with one click
You can also monitor via command line:
bash
# Terminal status
bash SKILL_DIR/scripts/status.sh <project directory>
# Send instructions
bash SKILL_DIR/scripts/send_input.sh <project directory> "your instruction"
# Directly enter tmux to observe
tmux attach -t swarm-<project name>Step 5: Stop
bash
bash SKILL_DIR/scripts/stop_swarm.sh <project directory>Automatically stops all agents + merges branches + cleans up worktrees.
Core Mechanisms
Git Self-Organization Coordination
- Each agent claims tasks via files
current_tasks/*.lock - Understands global progress through
TASKS.md - Learns about other agents' work through
git log - Conflicts are resolved by agents themselves
Git Worktree Isolation
- No multiple clones, uses for isolation
git worktree - All worktrees share the same object library
.git - Each agent works independently in its own worktree
Infinite Loop
- Each agent automatically starts the next session after completing one
- Gets the latest results from other agents via
git pull - Uses sleep intervals to avoid API rate limits
Key Configurations
| Parameter | Default Value | Description |
|---|---|---|
| Number of agents | 8 | Specifiable at startup |
| Sleep interval | 5 seconds | Adjustable in agent_loop.sh |
| Model | claude-opus-4-6 | Adjustable in agent_loop.sh |
Risks and Countermeasures
| Risk | Countermeasure |
|---|---|
| API rate limits | Sleep intervals + adjustable number of agents |
| Merge conflicts | AGENT_PROMPT guides small-grained commits |
| Infinite loop of useless work | Log monitoring + stop conditions |
| Disk space issues | stop_swarm.sh automatically cleans up |
| Uncontrolled costs | Limit number of sessions in AGENT_PROMPT |
Produced by Uncle Hua | AI Native Coder · Independent Developer Official Account "Uncle Hua" | 300,000+ followers | AI Tools & Efficiency Improvement Masterpieces: Kitten Fill Light (Top 1 in AppStore Paid Charts) · "Mastering DeepSeek in One Book"