Run Claude Code agents in parallel from a YAML-frontmatter Markdown manifest, with git worktree isolation for write tasks.
Project description
parallel-orchestra (PO)
複数の Claude Code ヘッドレスエージェントを 並列実行し、結果を一つのブランチに自動マージする CLI ツール。
claude -p を内部でオーケストレートし、書き込みタスクごとに独立した git worktree を確保するので、お互いの変更が衝突しません。タスクが終わると PO が auto-commit して main に取り込みます。
できること
- 1 枚の Markdown マニフェスト(YAML フロントマター)から複数タスクを定義し、並列起動する
- 書き込みタスクは worktree に隔離 → 自動コミット → 完了後に元ブランチへマージ
- 失敗・タイムアウト・transient エラーをカテゴリ分けして、必要に応じて自動リトライ(デフォルト 1 回・1 秒バックオフ・係数 2)
- タスク間の依存関係(
depends_on)と書き込みパスの宣言(writes)でスケジュールを最適化 - ANSI 進捗ダッシュボード、JSON / Markdown サマリレポート、レジューム機能(
--resume)
インストール
pip install parallel-orchestra
要件: Python 3.10+ / Claude Code CLI が claude コマンドとして PATH に通っていること。
開発版を入れたい場合
ソースから編集可能インストール:
git clone https://github.com/satoh-y-0323/parallel-orchestra.git
cd parallel-orchestra
pip install -e ".[dev]"
5 分で動かす
リポジトリ直下に example/ という自己完結の雛形が入っています。
parallel-orchestra run example/.claude/reports/plan-report-tdd-example.md
これは以下を並列で実行します:
example/src/addition.pyのadd(a, b)を TDD で実装example/src/multiplication.pyのmultiply(a, b)を TDD で実装
それぞれが独立した worktree で tester → developer → tester のサブエージェントを回し、テスト全件合格を確認してから main へマージされます。
マニフェスト形式
---
po_plan_version: "0.1"
name: "my-plan"
cwd: "."
tasks:
- id: feature-a
agent: developer
read_only: false
prompt: |
実装してください: ...
- id: feature-b
agent: developer
read_only: false
depends_on:
- feature-a
prompt: |
...
---
# 自由記述の説明文
このセクション以降は人間向けのメモ。PO は読みません。
主なフィールド:
| フィールド | 必須 | 説明 |
|---|---|---|
po_plan_version |
✅ | "0.1" 固定 |
name |
✅ | プランの名前(ログ等に使われる) |
cwd |
✅ | manifest からの相対パスで「プロジェクトの作業ディレクトリ」を指す。worktree のコピー元 .claude/ もここから探す |
tasks[].id |
✅ | [A-Za-z0-9_-]+ |
tasks[].agent |
✅ | claude -p --agent <agent> に渡される名前。<cwd>/.claude/agents/<agent>.md が定義 |
tasks[].read_only |
✅ | false の場合 worktree が作られる |
tasks[].prompt |
エージェントへの指示文 | |
tasks[].depends_on |
先に成功している必要のあるタスク ID | |
tasks[].max_retries |
リトライ回数(未指定なら defaults.max_retries、それも無ければ 1) |
|
defaults.max_retries |
manifest 全体のデフォルトリトライ回数 |
詳細な仕様は example/.claude/docs/parallel-orchestra-manifest.md にあります。
CLI
parallel-orchestra run <manifest_path> [options]
| オプション | 既定値 | 説明 |
|---|---|---|
--max-workers N |
3 | 並列タスクの最大数 |
--claude-exe PATH |
claude |
claude 実行ファイルの場所 |
--quiet |
off | 成功タスクの詳細出力を抑制 |
--log-dir PATH |
<git-root>/.claude/logs |
per-task の stdout/stderr 保存先 |
--no-log |
off | per-task ログを保存しない |
--dry-run |
off | 計画だけ表示して実行しない |
--resume |
off | 前回成功タスクをスキップして再開 |
--report PATH |
– | .json / .md でサマリレポートを出力 |
--dashboard / --no-dashboard |
TTY 自動 | ANSI ダッシュボード強制 ON/OFF |
python -m parallel_orchestra ... でも同じ CLI が呼べます。
終了コード
| コード | 意味 |
|---|---|
| 0 | すべてのタスクが成功 |
| 1 | 1 つ以上のタスクが失敗 |
| 2 | マニフェストエラー |
| 3 | ランナーエラー(claude バイナリ不在など) |
アーキテクチャ
parallel-orchestra run <manifest>
│
├─ マニフェスト解析(manifest.py)
│ └─ Task / Defaults / Manifest dataclass
│
├─ DependencyScheduler(runner.py)
│ └─ depends_on と writes に従って起動順を決定
│
└─ タスクごと:
├─ read_only=true → cwd でそのまま claude -p を起動
└─ read_only=false → git worktree を切り、.claude/ を複製
↓
claude -p --agent <name> -p <prompt>
↓
auto-commit
↓
元ブランチへ merge
↓
worktree cleanup
成功時の test-report 等は worktree branch の auto-commit に乗って merge 経由で main に取り込まれます。失敗時は worktree から手元へ post-mortem 用にコピーされます。
環境変数
| 変数 | 用途 |
|---|---|
PO_KEEP_WORKTREE=1 |
タスク終了後も worktree を残す(デバッグ用) |
PO_WORKTREE_GUARD |
内部用。ユーザーは設定しない |
開発
pip install -e ".[dev]"
pytest # 185 件のユニット / 統合テスト
ruff check src tests
mypy src
example/ を使ったエンドツーエンド検証:
parallel-orchestra run example/.claude/reports/plan-report-tdd-example.md
ライセンス
未定(公開時に追記)。
関連
並列で動かす個々のエージェントを「どう書くか」「どうワークフローを定義するか」は本ツールの守備範囲外です。example/.claude/agents/ と example/.claude/skills/ に TDD ワークフローの最小例を含めているので参考にしてください。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parallel_orchestra-0.1.2.tar.gz.
File metadata
- Download URL: parallel_orchestra-0.1.2.tar.gz
- Upload date:
- Size: 65.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d84224f4542af6cc74ef77e9fd920fc01d507962c877ed1a5fbe6a9fae0ead3
|
|
| MD5 |
35f72f94790b20b4f0484bc693cc10a7
|
|
| BLAKE2b-256 |
958c52aa00bdb98d5ea800c1eb441a68ccc345736dbbb02cdf4ed72d20595521
|
Provenance
The following attestation bundles were made for parallel_orchestra-0.1.2.tar.gz:
Publisher:
publish.yml on satoh-y-0323/parallel-orchestra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parallel_orchestra-0.1.2.tar.gz -
Subject digest:
5d84224f4542af6cc74ef77e9fd920fc01d507962c877ed1a5fbe6a9fae0ead3 - Sigstore transparency entry: 1417849789
- Sigstore integration time:
-
Permalink:
satoh-y-0323/parallel-orchestra@f764c9156dd42e22ecdebb01fb04c556e3897eb9 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/satoh-y-0323
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f764c9156dd42e22ecdebb01fb04c556e3897eb9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file parallel_orchestra-0.1.2-py3-none-any.whl.
File metadata
- Download URL: parallel_orchestra-0.1.2-py3-none-any.whl
- Upload date:
- Size: 35.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9f48fb3b700229fdf721baf106855066a0c254a14bfa753a56a45d33c371e4e
|
|
| MD5 |
07fa83238423949c8e1da7a495bb2dc1
|
|
| BLAKE2b-256 |
f8f1dbc6f8c6279579dffa911634977e3ecf5f5a1b46ddfab4473c4a995e47f3
|
Provenance
The following attestation bundles were made for parallel_orchestra-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on satoh-y-0323/parallel-orchestra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
parallel_orchestra-0.1.2-py3-none-any.whl -
Subject digest:
f9f48fb3b700229fdf721baf106855066a0c254a14bfa753a56a45d33c371e4e - Sigstore transparency entry: 1417849854
- Sigstore integration time:
-
Permalink:
satoh-y-0323/parallel-orchestra@f764c9156dd42e22ecdebb01fb04c556e3897eb9 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/satoh-y-0323
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f764c9156dd42e22ecdebb01fb04c556e3897eb9 -
Trigger Event:
release
-
Statement type: