Parallel Agents

parcadei/continuous-claude-v3/.claude/skills/parallel-agents

作者 parcadeid07ff4b06b62無授權條款3.9K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫8 個月前更新

Parallel Agent Orchestration

僅含說明AI & Agents
AI 產生的概覽

透過以檔案為基礎的狀態追蹤,平行啟動多個子代理並避免上下文膨脹的模式。

功能
這個技能記錄了一套協調模式:在背景同時執行多個代理,並讓每個代理以附加一行到共用狀態檔案的方式確認完成,而不是回傳輸出。它也說明了用來保存代理詳細發現的目錄結構,以及監控批次進度的指令。
適用情境
當任務可拆分為許多應同時執行的獨立子任務時使用,例如批次回填或平行研究。它適合每批最多協調十五個代理,同時不讓它們的輸出淹沒主要上下文。
執行需求
需要支援背景子代理任務的代理執行環境,以及用來寫入與讀取狀態檔案的 shell 存取權限;不包含任何指令碼或套件。

Parallel Agent Orchestration

When launching multiple agents in parallel, follow this pattern to avoid context bloat.

Core Principles

  1. No TaskOutput calls - TaskOutput returns full agent output, bloating context
  2. Run in background - Always use run_in_background: true
  3. File-based confirmation - Agents write status to files, not return values
  4. Append, don't overwrite - Multiple agents can write to same status file

Output Patterns

Simple Confirmation (parallel batch work)

For tasks where agents just need to confirm completion:

bash
# Agent writes to shared status fileecho "COMPLETE: <task-name> - $(date)" >> .claude/cache/<batch-name>-status.txt
  • Use >> to append (not > which overwrites)
  • Include timestamp for ordering
  • One line per agent completion
  • Check with: cat .claude/cache/<batch-name>-status.txt

Detailed Output (research/exploration)

For tasks requiring detailed findings:

.claude/cache/agents/<task-type>/<agent-id>/├── output.md      # Main findings├── artifacts/     # Any generated files└── status.txt     # Completion confirmation
  • Each agent gets own directory
  • Full output preserved for later reading
  • Status file still used for quick completion check

Task Prompt Template

markdown
# Task: <TASK_NAME>
## Your Mission<clear objective>
## OutputWhen done, write confirmation:\`\`\`bashecho "COMPLETE: <identifier> - $(date)" >> .claude/cache/<batch>-status.txt\`\`\`
Do NOT return large output. Complete work silently.

Launching Pattern

typescript
// Launch all in single message block (parallel)Task({  description: "Task 1",  prompt: "...",  subagent_type: "general-purpose",  run_in_background: true})Task({  description: "Task 2",  prompt: "...",  subagent_type: "general-purpose",  run_in_background: true})// ... up to 15 parallel agents

Monitoring

bash
# Check completion statuscat .claude/cache/<batch>-status.txt
# Count completionswc -l .claude/cache/<batch>-status.txt
# Watch for updatestail -f .claude/cache/<batch>-status.txt

Batch Size

  • Max 15 agents per parallel batch
  • Wait for batch to complete before launching next
  • Use status file to track which completed

DO

  • Use run_in_background: true always
  • Have agents write to status files
  • Use append (>>) not overwrite (>)
  • Give each agent clear, self-contained instructions
  • Include all context in prompt (agents don't share memory)

DON'T

  • Call TaskOutput (bloats context)
  • Return large outputs from agents
  • Launch more than 15 at once
  • Rely on agent return values for orchestration

Example: Provider Backfill

bash
# Status file.claude/cache/provider-backfill-status.txt
# Each agent appends on completionecho "COMPLETE: anthropic - Thu Jan 2 12:34:56 2025" >> .claude/cache/provider-backfill-status.txtecho "COMPLETE: openai - Thu Jan 2 12:35:12 2025" >> .claude/cache/provider-backfill-status.txt

Check progress:

bash
cat .claude/cache/provider-backfill-status.txt# COMPLETE: anthropic - Thu Jan 2 12:34:56 2025# COMPLETE: openai - Thu Jan 2 12:35:12 2025

來源與署名

來源:parcadei/continuous-claude-v3位於.claude/skills/parallel-agents提交d07ff4b

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架