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 从公开仓库中收录这些内容。

举报或申请下架