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
Added on

NPX Install

npx skill4agent add alchaincyf/huashu-skills huashu-agent-swarm

SKILL.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:
  • AGENT_PROMPT.md
    - Generated from template, needs to be customized according to user requirements
  • TASKS.md
    - Initial task list
  • current_tasks/
    - Task claim directory
  • agent_logs/
    - Log directory
Then I customize
AGENT_PROMPT.md
based on
references/agent-prompt-template.md
, filling in specific project information.

Step 3: Start the Swarm

bash
bash SKILL_DIR/scripts/start_swarm.sh <number of agents> <project directory>
This will:
  1. Create a git worktree for each agent (shares .git object library, no disk waste)
  2. Create a tmux session, one agent per pane
  3. 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> 8420
Open 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
    current_tasks/*.lock
    files
  • 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
    git worktree
    for isolation
  • All worktrees share the same
    .git
    object library
  • 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

ParameterDefault ValueDescription
Number of agents8Specifiable at startup
Sleep interval5 secondsAdjustable in agent_loop.sh
Modelclaude-opus-4-6Adjustable in agent_loop.sh

Risks and Countermeasures

RiskCountermeasure
API rate limitsSleep intervals + adjustable number of agents
Merge conflictsAGENT_PROMPT guides small-grained commits
Infinite loop of useless workLog monitoring + stop conditions
Disk space issuesstop_swarm.sh automatically cleans up
Uncontrolled costsLimit 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"