Swarm

作者 backnotprop3a604672c46c無授權條款1.3K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫今天更新

Fan out N parallel workers, drain them, and return one report. Use for /swarm, 'swarm this', or parallel coverage, races, gauntlets, and exploration.

AI 產生的概覽

平行派出 N 個 worker 處理切片或競速任務,彙整結果並回傳一份報告。

功能
此技能定義了一套四階段流程——框定、派出、彙整、報告——用來啟動 N 個平行 worker,讓它們分別涵蓋不同切片、對同一份任務簡報競速,或兩者混合。它說明了如何設定 worker 數量、挑選 worker 模型、撰寫自成一體的任務簡報,以及如何處理 worker 掉線或證據不足的情況。父層等待 worker 完成後,依事先宣告的競速選擇規則處理結果,並回傳一份合併的對話內報告,內含結果表、單行問題說明與缺口。
適用情境
當任務適合平行涵蓋時使用,例如把大範圍拆成多個切片、讓多個 worker 對同一份簡報競速,或進行探索與輪番驗證。適用於 /swarm、「swarm this」或類似的平行涵蓋請求。
執行需求
需要具備子代理或任務派發工具的執行環境(例如 Cursor 的 Task 工具、Claude Code 的 Agent、OpenCode 的 task 或 Codex 的 spawn_agent);若沒有,就只能由代理依序執行 worker。它會從 pstack 設定檔讀取 worker 模型,若該檔案或對應行缺漏則改用預設模型。雲端 worker 需要雲端環境存取權;本機 worker 需要各自獨立的工作樹或輸出路徑。不附帶任何指令碼。

Swarm

Fan out N parallel cloud workers. They may cover separate slices, race the same brief, or mix both. The parent waits, aggregates, and returns one report.

Start

Open a todolist with one entry per phase before launching anything.

  1. Frame
  2. Fan out
  3. Aggregate
  4. Report

Phase A: Frame

  1. State the done predicate and the artifact or report the swarm must return.
  2. Choose the shape. Partition into slices, race N workers on identical briefs, or mix both. For a race or mixed shape, declare first pass, rank all, or best-of before spawning.
  3. Set N from the user or derive it from the shape. N is total workers, not the cloud concurrency limit.
  4. Pick the worker model from the swarm workers line in the pstack settings file (~/.cursor/rules/pstack-models.mdc in Cursor, ~/.agents/pstack-models.md in other harnesses). If the file or that line is missing, use grok-4.7-xhigh-fast. For auto or inherit-parent, omit model so the workers run on the parent model. If your subagent tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message or your harness's model list. For a model race, name each arm's model up front.
  5. Give each worker its own writable output when it writes. When workers verify or measure commits, each brief names the exact SHAs. A measurement brief also names the method (sample count, what one sample is, order). The worker records both in its result.

Phase B: Fan out

Spawn all N workers in one message with subagent_type: generalPurpose, environment: "cloud", run_in_background: true, and the step 4 model, left unset for auto or inherit-parent. Use environment: "local" only when the worker needs access to something on the user's computer.

When a worker must start from a non-default pushed branch, pass cloud_base_branch.

Other harnesses. These parameters belong to Cursor's Task tool, and environment: "cloud" runs a Cursor cloud agent. In another harness, use its subagent tool: Agent in Claude Code (subagent_type: general-purpose), task in OpenCode (subagent_type: general), spawn_agent in Codex. Workers run locally there, so give each one its own worktree or output path. Keep the brief and the model. Drop parameters your tool doesn't have. If your harness has no subagent tool, as in Pi without an extension, run the workers yourself, one after another.

Every brief stands alone. Include the goal, scope, exact slice or race arm, how to verify, and what to report. Reports use PASS, ISSUES, or BLOCKED with evidence. A worker that can prove a defect reports ISSUES and lists every issue it can prove, not only the first.

If a worker drops out, proceed with N-1 and note it.

Phase C: Aggregate

Read the terminal results. Drop a result that does not record the SHAs and method its brief names, and respawn that worker once. After a second miss, record a gap. A gap does not count as a pass. For coverage, every required slice needs a result. For a race, apply the selection rule declared up front. Use first pass, rank all, or best-of. Do not paste raw worker dumps.

Keep a compact result table, one-line evidenced issues, and explicit gaps or dropouts.

Phase D: Report

Return one consolidated in-chat report with the table, issue one-liners, gaps or dropouts, and the race rule when used.

來源與署名

來源:backnotprop/pstack位於skills/swarm提交3a60467

授權條款: 無授權條款

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

檢舉或申請下架