parallel-execution
并行执行框架:基于 Git worktree 的多实例并行、任务分发与动态扩展。 当任务可拆分、需要加速执行、或需要多分支并行开发时使用。
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- parallel-execution
- description
- 并行执行框架:基于 Git worktree 的多实例并行、任务分发与动态扩展。 当任务可拆分、需要加速执行、或需要多分支并行开发时使用。
02 资源文件 1
- 参考文档agents/openai.yaml1.6 KB
03 SKILL.md 正文
Parallel Execution Framework
用途
- 任务并行:拆分可独立执行的任务并并行处理
- 分支隔离:使用 Git worktree 实现多分支并行开发
- 资源扩展:根据任务复杂度动态扩展执行实例
- 级联执行:串联依赖任务,并行独立任务
核心概念
1. 任务类型
| 类型 | 说明 | 并行策略 |
|---|---|---|
independent |
无依赖,可立即执行 | 并行 |
sequential |
依赖前一任务输出 | 串行 |
parallel |
多个独立任务 | 并行 |
cascade |
主任务触发子任务 | 级联 |
2. Git Worktree 并行
worktree add <path> <branch> # 创建新 worktree
worktree list # 列出所有 worktree
worktree prune # 清理无效 worktree
3. 扩展策略
- Scale Out:增加并行实例数(横向扩展)
- Scale Up:提升实例规格(纵向扩展)
- Cascade:主任务完成后触发子任务
触发信号
- 任务可明确拆分为多个独立子任务
- 需要在多个分支上并行开发
- 任务耗时超过 10 分钟且可拆分
- 需要同时验证多个方案
使用约束
- 任务拆分后,每个子任务必须有明确的输入输出
- 并行任务之间不能有写冲突
- 需要共享的状态通过文件或消息传递
- 主任务负责汇总子任务结果
- 失败处理:部分失败时,主任务决定是重试、跳过还是中止
配套工具
scripts/lib/parallel_execution.py- 底层并行执行接口GitWorktreeManager- worktree 管理TaskDistributor- 任务分发ResultAggregator- 结果汇总
命令接入
/parallel <task描述>- 分解并并行执行任务/worktree-create <branch>- 创建 worktree 分支/worktree-list- 列出所有 worktree/scale-out <num>- 扩展到 N 个并行实例
04 同仓库更多 Skills
worktable-review-with-annotations
Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.
worktable-find-and-synthesize-context
Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.
worktable-create-or-update-docs
Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.
worktable-create-or-manage-records
Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.
worktable-create-or-manage-interactive-html
Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.
worktable-collaborate-threads
Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.