Skip to content

Commit ca08633

Browse files
committed
fix(breezing): resolve 5 contradictions in Phase 0 design
1. Replace project-analyzer with dedicated plan-analyst agent (project-analyzer is for tech stack detection, not task planning) 2. Move breezing-active.json write before Phase 0 for compaction safety 3. Change V1-V4 "skip" to "inform" after Phase 0 (Phase 0 = strategic review, V1-V4 = technical validation - different roles) 4. Remove circular Phase 0 auto-trigger from V1-V4 results (V1-V4 runs in Phase A which is after Phase 0) 5. Add Planner ↔ Critic direct dialogue in Round 2 (article emphasizes intra-round teammate discussion) https://claude.ai/code/session_011wQtWaurYoaTaofxCsistr
1 parent 06e928a commit ca08633

4 files changed

Lines changed: 161 additions & 35 deletions

File tree

agents/plan-analyst.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
name: plan-analyst
3+
description: タスク計画を分析し、粒度・依存関係・owns推定・リスク評価を行う
4+
tools: [Read, Glob, Grep]
5+
disallowedTools: [Write, Edit, Bash, Task]
6+
model: sonnet
7+
color: cyan
8+
memory: project
9+
---
10+
11+
# Plan Analyst Agent
12+
13+
Plans.md のタスク分解を分析し、実装前に粒度・依存関係・ファイル所有権・リスクを評価する専門エージェント。
14+
15+
---
16+
17+
## 永続メモリの活用
18+
19+
### 分析開始前
20+
21+
1. **メモリを確認**: 過去のタスク分析結果、プロジェクト固有の依存パターンを参照
22+
2. 前回の分析で学んだファイル構造や命名規約を活用
23+
24+
### 分析完了後
25+
26+
以下を学んだ場合、メモリに追記:
27+
28+
- **ファイル所有権パターン**: 「認証系は src/auth/ + src/middleware.ts」等
29+
- **依存関係パターン**: 「DB マイグレーションは必ず先行」等
30+
- **粒度の知見**: 「UI タスクは 5 ファイル以内に収まる傾向」等
31+
32+
---
33+
34+
## 分析観点
35+
36+
### 1. タスク粒度評価
37+
38+
各タスクについて以下を判定:
39+
40+
| 判定 | 条件 |
41+
|---|---|
42+
| `appropriate` | 推定ファイル数 ≤ 10、記述が具体的、受入条件あり |
43+
| `too_broad` | 推定ファイル数 > 10、サブタスク 5+ |
44+
| `too_vague` | ファイルパス/コンポーネント名/API 名がゼロ |
45+
| `too_small` | 単独では意味をなさない(他タスクとの統合を推奨) |
46+
47+
### 2. owns 推定
48+
49+
コードベースを Glob/Grep で調査し、各タスクの影響ファイルを推定:
50+
51+
```
52+
1. タスク説明のキーワードからファイル検索
53+
例: "ログインフォーム" → Glob("**/Login*.tsx")
54+
2. 関連ディレクトリの推定
55+
例: "認証" → src/auth/, src/lib/auth/
56+
3. import/export 依存の追跡
57+
例: middleware.ts が auth/ 内のモジュールを import
58+
```
59+
60+
### 3. 依存関係提案
61+
62+
- 同一ファイルを触るタスク間の依存を検出
63+
- 暗黙の依存を推定(API ← フロント、DB スキーマ ← アプリ層)
64+
- 不要な依存チェーンの指摘(並列度の改善提案)
65+
66+
### 4. リスク評価
67+
68+
| リスクレベル | 条件 |
69+
|---|---|
70+
| `high` | セキュリティ関連、外部 API 連携、DB スキーマ変更 |
71+
| `medium` | 複数タスクの統合点、共有ユーティリティの変更 |
72+
| `low` | 独立した UI コンポーネント、テスト追加 |
73+
74+
---
75+
76+
## 報告フォーマット
77+
78+
```json
79+
{
80+
"tasks": [
81+
{
82+
"id": "4.1",
83+
"title": "タスク名",
84+
"estimated_owns": ["src/path/file.ts"],
85+
"granularity": "appropriate",
86+
"risk": "low",
87+
"notes": "分析メモ"
88+
}
89+
],
90+
"proposed_dependencies": [
91+
{"from": "4.1", "to": "4.2", "reason": "依存理由"}
92+
],
93+
"parallelism_assessment": {
94+
"independent_tasks": 3,
95+
"max_parallel": 2,
96+
"bottleneck": "タスク 4.2 が長い依存チェーンの起点"
97+
}
98+
}
99+
```
100+
101+
---
102+
103+
## 制約
104+
105+
- **Read-only**: Write, Edit, Bash は使用禁止
106+
- コードベースの調査は Glob/Grep/Read のみ使用
107+
- 実装の提案はしない、分析と評価のみ

skills/breezing/references/execution-flow.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,22 @@ Agent Teams を活用した `/breezing` の実行フロー。Lead は状況に
77
```text
88
/breezing --discuss 認証機能からユーザー管理まで完了して
99
10+
Step 0: breezing-active.json 即時書き込み(全 Phase の前に実行)
11+
1012
┌─────────────────────────────────────────────────────────────┐
1113
│ Phase 0: Planning Discussion(--discuss 時のみ) │
1214
│ │
1315
│ Planner + Critic を spawn → 計画議論 2-3 ラウンド │
16+
│ Planner ↔ Critic 直接対話 + Lead 調整 │
1417
│ → 精査済み計画をユーザーに提示 → Planner/Critic shutdown │
1518
│ │
16-
│ ※ --discuss なし + バリデーション問題なし → Phase 0 スキップ │
19+
│ ※ --discuss なし → Phase 0 スキップ
1720
│ ※ 詳細: planning-discussion.md 参照 │
1821
└─────────────────────────────────────────────────────────────┘
1922
2023
┌─────────────────────────────────────────────────────────────┐
2124
│ Phase A: Pre-delegate(ユーザーのパーミッションモード維持) │
2225
│ │
23-
│ Step 0: breezing-active.json 即時書き込み │
2426
│ Step 1: 環境チェック │
2527
│ Step 2: 範囲確認(ユーザー承認) │
2628
│ Step 3: Team 初期化 → TaskCreate → Teammates spawn │
@@ -63,29 +65,9 @@ Agent Teams を活用した `/breezing` の実行フロー。Lead は状況に
6365
> delegate に切り替えると、bypass が失われて承認プロンプトが発生する。
6466
> Phase A/C では delegate に入らないことで、ユーザーのパーミッションモードを維持する。
6567
66-
## Phase 0: Planning Discussion(--discuss 時のみ)
67-
68-
`--discuss` フラグ指定時、またはタスク粒度バリデーションで warning 3+ 検出時に起動。
69-
70-
```text
71-
1. Planner (project-analyzer) + Critic (plan-critic) を spawn
72-
2. Round 1: Planner がタスク分析(owns 推定・依存提案・粒度評価・リスク)
73-
3. Round 2: Critic が Red Teaming 検証(ゴール達成性・粒度・依存・並列化・リスク・代替案)
74-
4. Round 3: Lead が統合判断 → ユーザーに提示
75-
5. (必要なら) ユーザーが Plans.md 修正 → 追加ラウンド(最大 3 ラウンド)
76-
6. Planner/Critic shutdown → Phase A へ
77-
```
78-
79-
Phase 0 で得られた情報(owns 推定、依存提案等)は Phase A に引き継がれ、
80-
バリデーション済みタスクは V1〜V4 チェックをスキップ可能。
81-
82-
詳細: [planning-discussion.md](references/planning-discussion.md) 参照
83-
84-
## 準備ステージ
85-
86-
### 0. breezing-active.json 即時書き込み(最優先)
68+
## Step 0: breezing-active.json 即時書き込み(最優先)
8769

88-
**環境チェックよりも前に実行する** Compaction 対策として、モード情報を永続化する。
70+
**Phase 0・Phase A のいずれよりも前に実行する** Compaction 対策として、モード情報を永続化する。
8971

9072
```jsonc
9173
// .claude/state/breezing-active.json に即時書き込み
@@ -119,6 +101,27 @@ Phase 0 で得られた情報(owns 推定、依存提案等)は Phase A に
119101
・Team 初期化の失敗
120102
```
121103

104+
## Phase 0: Planning Discussion(--discuss 時のみ)
105+
106+
`--discuss` フラグ指定時に起動。Step 0 の後、Phase A の前に実行する。
107+
108+
```text
109+
1. Planner (plan-analyst) + Critic (plan-critic) を spawn
110+
2. Round 1: Planner がタスク分析 → Planner ↔ Critic 直接対話で疑問点を解消
111+
3. Round 2: Critic が Red Teaming 検証 → Planner に確認が必要な点を直接質問
112+
4. Round 3: Lead が両者の分析を統合 → ユーザーに提示
113+
5. (必要なら) ユーザーが Plans.md 修正 → 追加ラウンド(最大 3 ラウンド)
114+
6. Planner/Critic shutdown → Phase A へ
115+
```
116+
117+
Phase 0 で得られた情報(owns 推定、依存提案等)は Phase A に引き継がれ、
118+
Phase A の V1〜V4 バリデーションの**参考情報**として活用する(ただしスキップはしない。
119+
Phase 0 は戦略/アーキテクチャ評価、V1〜V4 は技術的詳細チェックで役割が異なるため)。
120+
121+
詳細: [planning-discussion.md](references/planning-discussion.md) 参照
122+
123+
## 準備ステージ(Phase A)
124+
122125
### 1. 環境チェック
123126

124127
```bash

skills/breezing/references/planning-discussion.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,20 @@ Phase A: Pre-delegate(通常フローに合流)
2121
| 条件 | Phase 0 起動 |
2222
|---|---|
2323
| `--discuss` フラグ指定 | 常に起動 |
24-
| タスク粒度バリデーション(V1〜V4)で warning 3+ | 自動起動を推奨(Lead 判断) |
25-
| タスク数 10+ | 自動起動を推奨(Lead 判断) |
26-
| フラグなし + 問題なし | スキップ(直接 Phase A へ) |
24+
| フラグなし | スキップ(直接 Phase A へ) |
25+
26+
> ****: Phase A の V1〜V4 バリデーションで多数の warning が見つかった場合、
27+
> Lead は「次回は `--discuss` の使用を推奨」とユーザーに提案できる。
28+
> ただし Phase 0 は Phase A の****に実行されるため、
29+
> V1〜V4 の結果を見てから Phase 0 に戻ることはできない。
2730
2831
## Team 構成(Phase 0 限定)
2932

3033
```text
3134
Lead ─── 議論の調整、最終判断
3235
3336
├── Planner (sonnet) ─── タスク分析・依存推定・粒度精査
34-
│ subagent_type: claude-code-harness:project-analyzer
37+
│ subagent_type: claude-code-harness:plan-analyst
3538
│ mode: "bypassPermissions"
3639
3740
└── Critic (sonnet) ─── Red Teaming・批判的検証
@@ -81,13 +84,23 @@ Planner → SendMessage → Lead:
8184
}
8285
```
8386

84-
### Round 2: Critic の批判的レビュー
87+
### Round 2: Critic の批判的レビュー + Planner ↔ Critic 直接対話
88+
89+
**記事の知見**: Agent Teams の最大の強みは「Teammate 間の直接対話(intra-round discussion)」。
90+
Lead を仲介せず、Planner と Critic が直接やりとりして疑問点を解消する。
8591

8692
```text
8793
Lead → SendMessage → Critic:
8894
「Planner の分析結果を踏まえて、計画を批判的に検証してください。
89-
Red Teaming チェックリスト(ゴール達成性・粒度・依存・並列化・リスク・代替案)
90-
の各観点で問題を指摘してください。」
95+
不明点は Planner に直接質問してください。」
96+
97+
Critic → SendMessage → Planner: ← Teammate 間直接対話
98+
「タスク 4.2 が 4.1 の認証 API に依存するとのことですが、
99+
4.2 は JWT 検証だけなので独立実装可能では?」
100+
101+
Planner → SendMessage → Critic: ← Teammate 間直接対話
102+
「src/middleware.ts を確認したところ、4.1 で作成する loginHandler の
103+
レスポンス型を 4.2 の JWT 検証が参照しています。依存は正当です。」
91104
92105
Critic → SendMessage → Lead:
93106
{
@@ -113,8 +126,9 @@ Critic → SendMessage → Lead:
113126
"suggestion": "タスク 4.4 を独立化できないか検討"
114127
}
115128
],
129+
"planner_consultations": 1,
116130
"parallelism_score": "medium",
117-
"summary": "概ね妥当だが、タスク 4.3 の具体化とテストタスクの追加が推奨"
131+
"summary": "概ね妥当だが、タスク 4.3 の具体化とテストタスクの追加が推奨。依存関係は Planner と確認済み。"
118132
}
119133
```
120134

@@ -166,9 +180,11 @@ Phase 0 で得られた情報は Phase A に引き継ぐ:
166180

167181
```text
168182
Phase 0 → Phase A への引き継ぎ:
169-
1. Planner の estimated_owns → Phase A Step 3 の owns 推定に活用
183+
1. Planner の estimated_owns → Phase A Step 3 の owns 推定に活用(Glob 再検索を省略可能)
170184
2. Planner の proposed_dependencies → Phase A Step 3 の addBlockedBy に反映
171-
3. Critic の findings → バリデーション済みとして V1〜V4 チェックをスキップ可能
185+
3. Critic の findings → V1〜V4 バリデーションの参考情報(スキップはしない)
186+
※ Phase 0 は戦略/アーキテクチャ評価、V1〜V4 は技術的詳細チェック。
187+
役割が異なるため、Phase 0 を経てもバリデーションは必ず実行する。
172188
4. 修正された Plans.md → Phase A の入力として使用
173189
```
174190

skills/breezing/references/team-composition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ codex-review スキルの 4 エキスパートを MCP 経由で並列呼び出
214214

215215
| 項目 | 設定 |
216216
|------|------|
217-
| **subagent_type** | `claude-code-harness:project-analyzer` |
217+
| **subagent_type** | `claude-code-harness:plan-analyst` |
218218
| **モデル** | sonnet |
219219
| **** | 1 (常に) |
220220
| **責務** | タスク分析、owns 推定、依存関係提案、粒度評価、リスク評価 |

0 commit comments

Comments
 (0)