HN 표시: 샤드 – 45분 동안 하나의 AI 에이전트 코드 시청을 중지합니다. 4개를 동시에 실행
hackernews
|
|
📦 오픈소스
#ai 딜
#ai 코딩
#anthropic
#claude
#git worktree
#gpt-4
#openai
#tdd
#병렬 실행
#에이전트
원문 출처: hackernews · Genesis Park에서 요약 및 분석
요약
Shard는 복잡한 코딩 작업을 여러 하위 작업으로 분해하여 병렬로 실행하는 AI 코딩 오케스트레이터입니다. git worktree를 활용해 에이전트 간 파일 충돌 없이 동시에 작업하게 하며, 자동으로 병합하고 테스트를 통해 실패를 복구하는 '셀프 힐링' 기능을 제공합니다. Claude Code나 Aider 등 다양한 AI 에이전트와 호환되며, `shard.toml`을 통해 에이전트 수, 타임아웃, 최대 비용 등 세부 설정을 관리할 수 있습니다.
본문
A TDD-driven, parallelized AI coding orchestrator that breaks down complex tasks and executes them concurrently using git worktrees. Shard takes a natural language prompt describing a coding task and automatically: - Plans - Uses an LLM to decompose your task into a DAG of parallel sub-tasks, each with exclusive file ownership - Partitions - Creates isolated git worktrees so agents can work simultaneously without conflicts - Dispatches - Runs AI coding agents (Claude Code, Aider, or Cursor) in parallel across tasks - Aggregates - Merges all branches back together, resolving structural conflicts automatically - Self-heals - Runs your test suite and automatically fixes failures Required: - Python 3.11+ - Git 2.20+ AI Agent (install one): # Claude Code (recommended) npm install -g @anthropic-ai/claude-code # Aider pip install aider-chat # Cursor CLI # Install from https://cursor.sh # From PyPI pip install shard-code # From source git clone https://github.com/nihalgunu/Shard.git cd Shard pip install -e ".[dev]" cd your-project # Run a full pipeline shard run -p "Add user authentication with JWT tokens and refresh token support" # Preview the execution plan without running shard plan -p "Refactor the database layer to use async operations" # Check status of current run shard status # Resume an interrupted run shard resume # View logs for a specific task shard logs | Command | Description | |---|---| shard run -p "..." | Execute a full pipeline with the given prompt | shard run -f prompt.txt | Execute using prompt from file | shard plan -p "..." | Preview execution DAG without running | shard status | Show current execution status | shard resume | Resume an interrupted run | shard logs | View agent stdout/stderr | shard abort | Stop all running agents | shard clean | Remove worktrees, branches, artifacts | shard config | Show current configuration | shard run -p "Your prompt" \ --agents 4 \ # Max concurrent agents (default: 4) --backend claude-code \ # Agent backend: claude-code, aider, cursor-cli --timeout 3600 \ # Global timeout in seconds --max-cost 10.0 # Maximum spend in USD Create shard.toml in your repository root: [agent] backend = "claude-code" # claude-code | aider | cursor-cli | custom binary = "" # Custom agent binary path (for custom backend) max_concurrent = 4 # Max parallel agents stagger_delay_s = 2.0 # Delay between agent launches [planner] provider = "anthropic" # anthropic | openai model = "claude-sonnet-4-20250514" # or "gpt-4o" for OpenAI temperature = 0.2 [timeouts] per_task_s = 600 # Per-task timeout global_s = 3600 # Global timeout output_stall_s = 120 # Kill agent if no output for this long commit_stall_s = 300 # Kill agent if no commit for this long [retries] max_per_task = 3 # Max retries per failed task max_global = 5 # Max total retries across all tasks [cost] max_usd = 5.00 # Hard spending limit warn_usd = 3.00 # Warning threshold [git] worktree_dir = "../worktrees" # Where to create worktrees branch_prefix = "wt" # Branch naming prefix auto_cleanup = true # Clean up on success [test] runner = "pytest" # Test command args = ["-xvs"] # Test arguments json_report = true # Use pytest-json-report for better parsing [logging] level = "INFO" # DEBUG | INFO | WARNING | ERROR format = "json" # json | text Set the API key for your chosen planner provider: # For Anthropic (default) export ANTHROPIC_API_KEY=sk-ant-... # For OpenAI export OPENAI_API_KEY=sk-... Traditional approaches to parallel AI coding have a problem: file conflicts. If two agents try to edit the same file simultaneously, you get race conditions, merge conflicts, or corrupted state. Shard solves this with git worktrees: | Approach | Problem | |---|---| | Single working directory | Agents overwrite each other's changes | | Multiple clones | Wastes disk space, slow to set up | | File locking | Serializes work, kills parallelism | | Git worktrees | Lightweight, isolated, native git support | How worktrees help: - Each agent gets its own complete working directory - All worktrees share the same .git folder (minimal disk overhead) - Each worktree is on its own branch - Merging is just git merge - git handles the complexity - Native git tooling works everywhere This means 4 agents can simultaneously edit 4 different parts of your codebase with zero coordination overhead. ┌─────────────────────────────────────────────────────────────────┐ │ SHARD PIPELINE │ ├─────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │ │ Stage 1 │───▶│ Stage 2 │───▶│ Stage 3 │───▶│ Stage 4 │ │ │ │ Planner │ │Partitioner│ │Dispatcher │ │Aggregator│ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │ │ │ │ │ │ ▼ ▼ ▼ │ │ DAG + Tests Parallel Agents Merge + Test │ │ │ │ │ │ │ ┌───────┴───────┐ │ │ │ │ Stage 5 │ │ │ │ │ Self-Healer │ │ │ │ └───────────────┘ │ └─────────────────────────────────────────────────────────────────┘ Stage 1: Planner - Analyzes your codebase structure - De
Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.
공유