change pieces

This commit is contained in:
nrslib 2026-02-07 07:24:18 +09:00
parent 191ca1f35e
commit 6473f97f47
28 changed files with 1797 additions and 4088 deletions

View File

@ -32,43 +32,38 @@ description: Lightweight development piece with planning and parallel reviews (p
max_iterations: 20
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
architect-planner: ../personas/architect-planner.md
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
architecture-reviewer: ../personas/architecture-reviewer.md
instructions:
plan: ../instructions/plan.md
implement: ../instructions/implement.md
ai-review: ../instructions/ai-review.md
review-arch: ../instructions/review-arch.md
fix: ../instructions/fix.md
report_formats:
plan: ../report-formats/plan.md
ai-review: ../report-formats/ai-review.md
architecture-review: ../report-formats/architecture-review.md
initial_movement: plan
movements:
- name: plan
edit: false
agent: ../agents/default/architect-planner.md
persona: architect-planner
report:
name: 00-plan.md
format: |
```markdown
# タスク計画
## 元の要求
{ユーザーの要求をそのまま記載}
## 分析結果
### 目的
{達成すべきこと}
### スコープ
**変更対象ファイル:**
| ファイル | 変更内容 |
|---------|---------|
**テストへの影響:**
| ファイル | 影響 |
|---------|------|
### 設計判断(必要な場合)
- ファイル構成: {新規ファイルの配置、根拠}
- 設計パターン: {採用するパターンとその理由}
### 実装アプローチ
{どう進めるか}
```
format: plan
allowed_tools:
- Read
- Glob
@ -83,24 +78,14 @@ movements:
next: COMPLETE
- condition: 要件が不明確、情報不足
next: ABORT
instruction_template: |
タスクを分析し、実装方針を立ててください。
**不明点の扱い(重要):**
タスクに Open Questions や不明点がある場合は、コードを読んで調査し自力で解決してください。
調査しても解決できない外部要因(ユーザーの意図が判断できない等)のみ「要件が不明確」と判断してください。
コードを読めば分かることは「不明確」ではありません。
**やること:**
1. タスクの要件を理解する
2. 関連するコードを読んで現状を把握する
3. 不明点があればコード調査で解決する
4. 影響範囲を特定する
5. 実装アプローチを決める
instruction: plan
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
session: refresh
report:
@ -127,94 +112,17 @@ movements:
next: implement
requires_user_input: true
interactive_only: true
instruction_template: |
planムーブメントで立てた計画に従って実装してください。
**参照するレポート:**
- 計画: {report:00-plan.md}
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**重要:** 計画で決定されたアプローチに従ってください。
不明点や方針の変更が必要な場合は報告してください。
**重要**: 実装と同時に単体テストを追加してください。
- 新規作成したクラス・関数には単体テストを追加
- 既存コードを変更した場合は該当するテストを更新
- テストファイルの配置: プロジェクトの規約に従う(例: `__tests__/`, `*.test.ts`
- **テスト実行は必須です。** 実装完了後、必ずテストを実行して結果を確認してください。
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
- name: reviewers
parallel:
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 04-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
@ -224,53 +132,15 @@ movements:
rules:
- condition: AI特有の問題なし
- condition: AI特有の問題あり
instruction_template: |
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
**参照するレポート:**
- 実装スコープ: {report:02-coder-scope.md}
- 決定ログ: {report:03-coder-decisions.md}(存在する場合)
instruction: ai-review
- name: arch-review
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
report:
name: 05-architect-review.md
format: |
```markdown
# アーキテクチャレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
- [x] 構造・設計
- [x] コード品質
- [x] 変更スコープ
- [x] テストカバレッジ
- [x] デッドコード
- [x] 呼び出しチェーン検証
## 問題点REJECTの場合
| # | スコープ | 場所 | 問題 | 修正案 |
|---|---------|------|------|--------|
| 1 | スコープ内 | `src/file.ts:42` | 問題の説明 | 修正方法 |
スコープ: 「スコープ内」(今回修正可能)/ 「スコープ外」(既存問題・非ブロッキング)
## 既存問題(参考・非ブロッキング)
- {既存問題の記録。今回の変更と無関係な問題}
```
**認知負荷軽減ルール:**
- APPROVE → サマリーのみ5行以内
- REJECT → 問題点を表形式で30行以内
format: architecture-review
allowed_tools:
- Read
- Glob
@ -280,21 +150,7 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
**実装が計画に従っているか**を確認してください。
AI特有の問題はレビューしないでくださいai_reviewムーブメントで行います
**参照するレポート:**
- 計画: {report:00-plan.md}
- 実装スコープ: {report:02-coder-scope.md}
**レビュー観点:**
- 計画との整合性(計画で定めたスコープ・アプローチに従っているか)
- コード品質DRY、YAGNI、Fail Fast、イディオマティック
- 変更スコープの適切性
- テストカバレッジ
- デッドコード
- 呼び出しチェーン検証
instruction: review-arch
rules:
- condition: all("AI特有の問題なし", "approved")
@ -304,7 +160,10 @@ movements:
- name: fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -321,30 +180,4 @@ movements:
next: reviewers
- condition: 判断できない、情報不足
next: ABORT
instruction_template: |
レビュアーのフィードバックに対応してください。
**両方のレビュー結果を確認してください:**
- AI Review: {report:04-ai-review.md}
- Architecture Review: {report:05-architect-review.md}
**重要:** 両方のレビューで指摘された問題を全て修正してください。
- AI Reviewの指摘: 幻覚API、仮定の妥当性、スコープクリープ等
- Architecture Reviewの指摘: 設計との整合性、コード品質、テストカバレッジ等
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く
2. 問題箇所を確認する
3. Edit tool で修正する
4. **テストを実行して検証する(必須)**
5. 修正内容を具体的に報告する
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix

View File

@ -32,43 +32,38 @@ description: Lightweight development piece with planning and parallel reviews (p
max_iterations: 20
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
architect-planner: ../personas/architect-planner.md
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
architecture-reviewer: ../personas/architecture-reviewer.md
instructions:
plan: ../instructions/plan.md
implement: ../instructions/implement.md
ai-review: ../instructions/ai-review.md
review-arch: ../instructions/review-arch.md
fix: ../instructions/fix.md
report_formats:
plan: ../report-formats/plan.md
ai-review: ../report-formats/ai-review.md
architecture-review: ../report-formats/architecture-review.md
initial_movement: plan
movements:
- name: plan
edit: false
agent: ../agents/default/architect-planner.md
persona: architect-planner
report:
name: 00-plan.md
format: |
```markdown
# タスク計画
## 元の要求
{ユーザーの要求をそのまま記載}
## 分析結果
### 目的
{達成すべきこと}
### スコープ
**変更対象ファイル:**
| ファイル | 変更内容 |
|---------|---------|
**テストへの影響:**
| ファイル | 影響 |
|---------|------|
### 設計判断(必要な場合)
- ファイル構成: {新規ファイルの配置、根拠}
- 設計パターン: {採用するパターンとその理由}
### 実装アプローチ
{どう進めるか}
```
format: plan
allowed_tools:
- Read
- Glob
@ -83,24 +78,14 @@ movements:
next: COMPLETE
- condition: 要件が不明確、情報不足
next: ABORT
instruction_template: |
タスクを分析し、実装方針を立ててください。
**不明点の扱い(重要):**
タスクに Open Questions や不明点がある場合は、コードを読んで調査し自力で解決してください。
調査しても解決できない外部要因(ユーザーの意図が判断できない等)のみ「要件が不明確」と判断してください。
コードを読めば分かることは「不明確」ではありません。
**やること:**
1. タスクの要件を理解する
2. 関連するコードを読んで現状を把握する
3. 不明点があればコード調査で解決する
4. 影響範囲を特定する
5. 実装アプローチを決める
instruction: plan
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
session: refresh
report:
- Scope: 02-coder-scope.md
@ -126,94 +111,17 @@ movements:
next: implement
requires_user_input: true
interactive_only: true
instruction_template: |
planムーブメントで立てた計画に従って実装してください。
**参照するレポート:**
- 計画: {report:00-plan.md}
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**重要:** 計画で決定されたアプローチに従ってください。
不明点や方針の変更が必要な場合は報告してください。
**重要**: 実装と同時に単体テストを追加してください。
- 新規作成したクラス・関数には単体テストを追加
- 既存コードを変更した場合は該当するテストを更新
- テストファイルの配置: プロジェクトの規約に従う(例: `__tests__/`, `*.test.ts`
- **テスト実行は必須です。** 実装完了後、必ずテストを実行して結果を確認してください。
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
- name: reviewers
parallel:
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 04-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
@ -223,53 +131,15 @@ movements:
rules:
- condition: AI特有の問題なし
- condition: AI特有の問題あり
instruction_template: |
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
**参照するレポート:**
- 実装スコープ: {report:02-coder-scope.md}
- 決定ログ: {report:03-coder-decisions.md}(存在する場合)
instruction: ai-review
- name: arch-review
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
report:
name: 05-architect-review.md
format: |
```markdown
# アーキテクチャレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
- [x] 構造・設計
- [x] コード品質
- [x] 変更スコープ
- [x] テストカバレッジ
- [x] デッドコード
- [x] 呼び出しチェーン検証
## 問題点REJECTの場合
| # | スコープ | 場所 | 問題 | 修正案 |
|---|---------|------|------|--------|
| 1 | スコープ内 | `src/file.ts:42` | 問題の説明 | 修正方法 |
スコープ: 「スコープ内」(今回修正可能)/ 「スコープ外」(既存問題・非ブロッキング)
## 既存問題(参考・非ブロッキング)
- {既存問題の記録。今回の変更と無関係な問題}
```
**認知負荷軽減ルール:**
- APPROVE → サマリーのみ5行以内
- REJECT → 問題点を表形式で30行以内
format: architecture-review
allowed_tools:
- Read
- Glob
@ -279,21 +149,7 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
**実装が計画に従っているか**を確認してください。
AI特有の問題はレビューしないでくださいai_reviewムーブメントで行います
**参照するレポート:**
- 計画: {report:00-plan.md}
- 実装スコープ: {report:02-coder-scope.md}
**レビュー観点:**
- 計画との整合性(計画で定めたスコープ・アプローチに従っているか)
- コード品質DRY、YAGNI、Fail Fast、イディオマティック
- 変更スコープの適切性
- テストカバレッジ
- デッドコード
- 呼び出しチェーン検証
instruction: review-arch
rules:
- condition: all("AI特有の問題なし", "approved")
@ -303,7 +159,10 @@ movements:
- name: fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -319,30 +178,4 @@ movements:
next: reviewers
- condition: 判断できない、情報不足
next: ABORT
instruction_template: |
レビュアーのフィードバックに対応してください。
**両方のレビュー結果を確認してください:**
- AI Review: {report:04-ai-review.md}
- Architecture Review: {report:05-architect-review.md}
**重要:** 両方のレビューで指摘された問題を全て修正してください。
- AI Reviewの指摘: 幻覚API、仮定の妥当性、スコープクリープ等
- Architecture Reviewの指摘: 設計との整合性、コード品質、テストカバレッジ等
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く
2. 問題箇所を確認する
3. Edit tool で修正する
4. **テストを実行して検証する(必須)**
5. 修正内容を具体的に報告する
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix

View File

@ -15,6 +15,41 @@ description: Standard development piece with planning and specialized reviews
max_iterations: 30
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
planner: ../personas/planner.md
architect-planner: ../personas/architect-planner.md
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
architecture-reviewer: ../personas/architecture-reviewer.md
qa-reviewer: ../personas/qa-reviewer.md
supervisor: ../personas/supervisor.md
instructions:
plan: ../instructions/plan.md
architect: ../instructions/architect.md
implement: ../instructions/implement.md
ai-review: ../instructions/ai-review.md
ai-fix: ../instructions/ai-fix.md
arbitrate: ../instructions/arbitrate.md
review-arch: ../instructions/review-arch.md
review-qa: ../instructions/review-qa.md
fix: ../instructions/fix.md
supervise: ../instructions/supervise.md
report_formats:
plan: ../report-formats/plan.md
architecture-design: ../report-formats/architecture-design.md
ai-review: ../report-formats/ai-review.md
architecture-review: ../report-formats/architecture-review.md
qa-review: ../report-formats/qa-review.md
validation: ../report-formats/validation.md
summary: ../report-formats/summary.md
initial_movement: plan
loop_monitors:
@ -44,30 +79,10 @@ loop_monitors:
movements:
- name: plan
edit: false
agent: ../agents/default/planner.md
persona: planner
report:
name: 00-plan.md
format: |
```markdown
# タスク計画
## 元の要求
{ユーザーの要求をそのまま記載}
## 分析結果
### 目的
{達成すべきこと}
### スコープ
{影響範囲}
### 実装アプローチ
{どう進めるか}
## 確認事項(あれば)
- {不明点や確認が必要な点}
```
format: plan
allowed_tools:
- Read
- Glob
@ -86,45 +101,14 @@ movements:
確認事項:
- {質問1}
- {質問2}
instruction_template: |
タスクを分析し、実装方針を立ててください。
**注意:** Previous Responseがある場合は差し戻しのため、
その内容を踏まえて計画を見直してくださいreplan
**やること(実装タスクの場合):**
1. タスクの要件を理解する
2. 影響範囲を特定する
3. 実装アプローチを決める
instruction: plan
- name: architect
edit: false
agent: ../agents/default/architect.md
persona: architect-planner
report:
name: 01-architecture.md
format: |
```markdown
# アーキテクチャ設計
## タスク規模
Small / Medium / Large
## 設計判断
### ファイル構成
| ファイル | 役割 |
|---------|------|
| `src/example.ts` | 概要 |
### 技術選定
- {選定した技術・ライブラリとその理由}
### 設計パターン
- {採用するパターンと適用箇所}
## 実装ガイドライン
- {Coderが実装時に従うべき指針}
```
format: architecture-design
allowed_tools:
- Read
- Glob
@ -138,32 +122,14 @@ movements:
next: implement
- condition: 情報不足、判断できない
next: ABORT
instruction_template: |
計画レポート({report:00-plan.md})を読み、アーキテクチャ設計を行ってください。
**小規模タスクの判断基準:**
- 1-2ファイルの変更のみ
- 設計判断が不要
- 技術選定が不要
小規模タスクの場合は設計レポートを作成せず、「小規模タスク(設計不要)」のルールに対応してください。
**設計が必要なタスク:**
- 3ファイル以上の変更
- 新しいモジュール・機能の追加
- 技術選定が必要
- アーキテクチャパターンの決定が必要
**やること:**
1. タスクの規模を評価
2. ファイル構成を決定
3. 技術選定(必要な場合)
4. 設計パターンの選択
5. Coderへの実装ガイドライン作成
instruction: architect
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
session: refresh
report:
@ -190,93 +156,15 @@ movements:
next: implement
requires_user_input: true
interactive_only: true
instruction_template: |
planムーブメントで立てた計画と、architectムーブメントで決定した設計に従って実装してください。
**参照するレポート:**
- 計画: {report:00-plan.md}
- 設計: {report:01-architecture.md}(存在する場合)
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**重要:** 設計判断はせず、architectムーブメントで決定された設計に従ってください。
不明点や設計の変更が必要な場合は報告してください。
**重要**: 実装と同時に単体テストを追加してください。
- 新規作成したクラス・関数には単体テストを追加
- 既存コードを変更した場合は該当するテストを更新
- テストファイルの配置: プロジェクトの規約に従う(例: `__tests__/`, `*.test.ts`
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 04-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
@ -288,21 +176,14 @@ movements:
next: reviewers
- condition: AI特有の問題あり
next: ai_fix
instruction_template: |
**これは {movement_iteration} 回目のAI Reviewです。**
初回は網羅的にレビューし、指摘すべき問題をすべて出し切ってください。
2回目以降は、前回REJECTした項目が修正されたかの確認を優先してください。
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: ai-review
- name: ai_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
session: refresh
allowed_tools:
@ -322,51 +203,12 @@ movements:
next: ai_no_fix
- condition: 判断できない、情報不足
next: ai_no_fix
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(`./gradlew :backend:test` 等)
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「判断できない、情報不足」に対応するタグを出力する
- 修正不要の場合は「判断できない、情報不足」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
instruction: ai-fix
- name: ai_no_fix
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
allowed_tools:
- Read
- Glob
@ -376,60 +218,17 @@ movements:
next: ai_fix
- condition: ai_fixの判断が妥当修正不要
next: reviewers
instruction_template: |
ai_reviewレビュアーと ai_fixコーダーの意見が食い違っています。
- ai_review は問題を指摘し REJECT しました
- ai_fix は確認の上「修正不要」と判断しました
両者の出力を確認し、どちらの判断が妥当か裁定してください。
**参照するレポート:**
- AIレビュー結果: {report:04-ai-review.md}
**判断基準:**
- ai_review の指摘が具体的で、コード上の実在する問題を指しているか
- ai_fix の反論に根拠(ファイル確認結果、テスト結果)があるか
- 指摘が非ブロッキング(記録のみ)レベルか、実際に修正が必要か
instruction: arbitrate
- name: reviewers
parallel:
- name: arch-review
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
report:
name: 05-architect-review.md
format: |
```markdown
# アーキテクチャレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
- [x] 構造・設計
- [x] コード品質
- [x] 変更スコープ
- [x] テストカバレッジ
- [x] デッドコード
- [x] 呼び出しチェーン検証
## 問題点REJECTの場合
| # | スコープ | 場所 | 問題 | 修正案 |
|---|---------|------|------|--------|
| 1 | スコープ内 | `src/file.ts:42` | 問題の説明 | 修正方法 |
スコープ: 「スコープ内」(今回修正可能)/ 「スコープ外」(既存問題・非ブロッキング)
## 既存問題(参考・非ブロッキング)
- {既存問題の記録。今回の変更と無関係な問題}
```
**認知負荷軽減ルール:**
- APPROVE → サマリーのみ5行以内
- REJECT → 問題点を表形式で30行以内
format: architecture-review
allowed_tools:
- Read
- Glob
@ -439,52 +238,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
**実装がarchitectムーブメントの設計に従っているか**を確認してください。
AI特有の問題はレビューしないでくださいai_reviewムーブメントで行います
**参照するレポート:**
- 設計: {report:01-architecture.md}(存在する場合)
- 実装スコープ: {report:02-coder-scope.md}
**レビュー観点:**
- 設計との整合性architectが定めたファイル構成・パターンに従っているか
- コード品質
- 変更スコープの適切性
- テストカバレッジ
- デッドコード
- 呼び出しチェーン検証
**注意:** architectムーブメントをスキップした小規模タスクの場合は、従来通り設計の妥当性も確認してください。
instruction: review-arch
- name: qa-review
edit: false
agent: ../agents/default/qa-reviewer.md
persona: qa-reviewer
stance: review
report:
name: 06-qa-review.md
format: |
```markdown
# QAレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## レビュー観点
| 観点 | 結果 | 備考 |
|------|------|------|
| テストカバレッジ | ✅ | - |
| テスト品質 | ✅ | - |
| エラーハンドリング | ✅ | - |
| ドキュメント | ✅ | - |
| 保守性 | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 問題 | 修正案 |
|---|---------|------|--------|
| 1 | テスト | 問題の説明 | 修正方法 |
```
format: qa-review
allowed_tools:
- Read
- Glob
@ -494,15 +256,7 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
品質保証の観点から変更をレビューしてください。
**レビュー観点:**
- テストカバレッジと品質
- テスト戦略unit/integration/E2E
- エラーハンドリング
- ログとモニタリング
- 保守性
instruction: review-qa
rules:
- condition: all("approved")
next: supervise
@ -511,7 +265,10 @@ movements:
- name: fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -528,24 +285,12 @@ movements:
next: reviewers
- condition: 判断できない、情報不足
next: plan
instruction_template: |
レビュアーのフィードバックに対応してください。
セッションの会話履歴を確認し、レビュアーの指摘事項を修正してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix
- name: supervise
edit: false
agent: ../agents/default/supervisor.md
persona: supervisor
stance: review
report:
- Validation: 07-supervisor-validation.md
- Summary: summary.md
@ -561,68 +306,4 @@ movements:
next: COMPLETE
- condition: 要求未達成、テスト失敗、ビルドエラー
next: plan
instruction_template: |
テスト実行、ビルド確認、最終承認を行ってください。
**ピース全体の確認:**
1. 計画({report:00-plan.md})と設計({report:01-architecture.md}、存在する場合)に従った実装か
2. 各レビュームーブメントの指摘が対応されているか
3. 元のタスク目的が達成されているか
**レポートの確認:** Report Directory内の全レポートを読み、
未対応の改善提案がないか確認してください。
**Validationレポートフォーマット:**
```markdown
# 最終検証結果
## 結果: APPROVE / REJECT
## 検証サマリー
| 項目 | 状態 | 確認方法 |
|------|------|---------|
| 要求充足 | ✅ | 要求リストと照合 |
| テスト | ✅ | `npm test` (N passed) |
| ビルド | ✅ | `npm run build` 成功 |
| 動作確認 | ✅ | 主要フロー確認 |
## 成果物
- 作成: {作成したファイル}
- 変更: {変更したファイル}
## 未完了項目REJECTの場合
| # | 項目 | 理由 |
|---|------|------|
| 1 | {項目} | {理由} |
```
**SummaryレポートフォーマットAPPROVEの場合のみ:**
```markdown
# タスク完了サマリー
## タスク
{元の要求を1-2文で}
## 結果
✅ 完了
## 変更内容
| 種別 | ファイル | 概要 |
|------|---------|------|
| 作成 | `src/file.ts` | 概要説明 |
## レビュー結果
| レビュー | 結果 |
|---------|------|
| Architecture Design | ✅ 完了 |
| AI Review | ✅ APPROVE |
| Architect Review | ✅ APPROVE |
| QA | ✅ APPROVE |
| Supervisor | ✅ APPROVE |
## 確認コマンド
```bash
npm test
npm run build
```
```
instruction: supervise

View File

@ -15,6 +15,41 @@ description: Standard development piece with planning and specialized reviews
max_iterations: 30
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
planner: ../personas/planner.md
architect-planner: ../personas/architect-planner.md
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
architecture-reviewer: ../personas/architecture-reviewer.md
qa-reviewer: ../personas/qa-reviewer.md
supervisor: ../personas/supervisor.md
instructions:
plan: ../instructions/plan.md
architect: ../instructions/architect.md
implement: ../instructions/implement.md
ai-review: ../instructions/ai-review.md
ai-fix: ../instructions/ai-fix.md
arbitrate: ../instructions/arbitrate.md
review-arch: ../instructions/review-arch.md
review-qa: ../instructions/review-qa.md
fix: ../instructions/fix.md
supervise: ../instructions/supervise.md
report_formats:
plan: ../report-formats/plan.md
architecture-design: ../report-formats/architecture-design.md
ai-review: ../report-formats/ai-review.md
architecture-review: ../report-formats/architecture-review.md
qa-review: ../report-formats/qa-review.md
validation: ../report-formats/validation.md
summary: ../report-formats/summary.md
initial_movement: plan
loop_monitors:
@ -44,30 +79,10 @@ loop_monitors:
movements:
- name: plan
edit: false
agent: ../agents/default/planner.md
persona: planner
report:
name: 00-plan.md
format: |
```markdown
# タスク計画
## 元の要求
{ユーザーの要求をそのまま記載}
## 分析結果
### 目的
{達成すべきこと}
### スコープ
{影響範囲}
### 実装アプローチ
{どう進めるか}
## 確認事項(あれば)
- {不明点や確認が必要な点}
```
format: plan
allowed_tools:
- Read
- Glob
@ -86,45 +101,14 @@ movements:
確認事項:
- {質問1}
- {質問2}
instruction_template: |
タスクを分析し、実装方針を立ててください。
**注意:** Previous Responseがある場合は差し戻しのため、
その内容を踏まえて計画を見直してくださいreplan
**やること(実装タスクの場合):**
1. タスクの要件を理解する
2. 影響範囲を特定する
3. 実装アプローチを決める
instruction: plan
- name: architect
edit: false
agent: ../agents/default/architect.md
persona: architect-planner
report:
name: 01-architecture.md
format: |
```markdown
# アーキテクチャ設計
## タスク規模
Small / Medium / Large
## 設計判断
### ファイル構成
| ファイル | 役割 |
|---------|------|
| `src/example.ts` | 概要 |
### 技術選定
- {選定した技術・ライブラリとその理由}
### 設計パターン
- {採用するパターンと適用箇所}
## 実装ガイドライン
- {Coderが実装時に従うべき指針}
```
format: architecture-design
allowed_tools:
- Read
- Glob
@ -138,32 +122,14 @@ movements:
next: implement
- condition: 情報不足、判断できない
next: ABORT
instruction_template: |
計画レポート({report:00-plan.md})を読み、アーキテクチャ設計を行ってください。
**小規模タスクの判断基準:**
- 1-2ファイルの変更のみ
- 設計判断が不要
- 技術選定が不要
小規模タスクの場合は設計レポートを作成せず、「小規模タスク(設計不要)」のルールに対応してください。
**設計が必要なタスク:**
- 3ファイル以上の変更
- 新しいモジュール・機能の追加
- 技術選定が必要
- アーキテクチャパターンの決定が必要
**やること:**
1. タスクの規模を評価
2. ファイル構成を決定
3. 技術選定(必要な場合)
4. 設計パターンの選択
5. Coderへの実装ガイドライン作成
instruction: architect
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
session: refresh
report:
- Scope: 02-coder-scope.md
@ -189,93 +155,15 @@ movements:
next: implement
requires_user_input: true
interactive_only: true
instruction_template: |
planムーブメントで立てた計画と、architectムーブメントで決定した設計に従って実装してください。
**参照するレポート:**
- 計画: {report:00-plan.md}
- 設計: {report:01-architecture.md}(存在する場合)
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**重要:** 設計判断はせず、architectムーブメントで決定された設計に従ってください。
不明点や設計の変更が必要な場合は報告してください。
**重要**: 実装と同時に単体テストを追加してください。
- 新規作成したクラス・関数には単体テストを追加
- 既存コードを変更した場合は該当するテストを更新
- テストファイルの配置: プロジェクトの規約に従う(例: `__tests__/`, `*.test.ts`
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 04-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
@ -287,21 +175,14 @@ movements:
next: reviewers
- condition: AI特有の問題あり
next: ai_fix
instruction_template: |
**これは {movement_iteration} 回目のAI Reviewです。**
初回は網羅的にレビューし、指摘すべき問題をすべて出し切ってください。
2回目以降は、前回REJECTした項目が修正されたかの確認を優先してください。
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: ai-review
- name: ai_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
session: refresh
allowed_tools:
- Read
@ -320,51 +201,12 @@ movements:
next: ai_no_fix
- condition: 判断できない、情報不足
next: ai_no_fix
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(`./gradlew :backend:test` 等)
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「判断できない、情報不足」に対応するタグを出力する
- 修正不要の場合は「判断できない、情報不足」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
instruction: ai-fix
- name: ai_no_fix
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
allowed_tools:
- Read
- Glob
@ -374,60 +216,17 @@ movements:
next: ai_fix
- condition: ai_fixの判断が妥当修正不要
next: reviewers
instruction_template: |
ai_reviewレビュアーと ai_fixコーダーの意見が食い違っています。
- ai_review は問題を指摘し REJECT しました
- ai_fix は確認の上「修正不要」と判断しました
両者の出力を確認し、どちらの判断が妥当か裁定してください。
**参照するレポート:**
- AIレビュー結果: {report:04-ai-review.md}
**判断基準:**
- ai_review の指摘が具体的で、コード上の実在する問題を指しているか
- ai_fix の反論に根拠(ファイル確認結果、テスト結果)があるか
- 指摘が非ブロッキング(記録のみ)レベルか、実際に修正が必要か
instruction: arbitrate
- name: reviewers
parallel:
- name: arch-review
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
report:
name: 05-architect-review.md
format: |
```markdown
# アーキテクチャレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
- [x] 構造・設計
- [x] コード品質
- [x] 変更スコープ
- [x] テストカバレッジ
- [x] デッドコード
- [x] 呼び出しチェーン検証
## 問題点REJECTの場合
| # | スコープ | 場所 | 問題 | 修正案 |
|---|---------|------|------|--------|
| 1 | スコープ内 | `src/file.ts:42` | 問題の説明 | 修正方法 |
スコープ: 「スコープ内」(今回修正可能)/ 「スコープ外」(既存問題・非ブロッキング)
## 既存問題(参考・非ブロッキング)
- {既存問題の記録。今回の変更と無関係な問題}
```
**認知負荷軽減ルール:**
- APPROVE → サマリーのみ5行以内
- REJECT → 問題点を表形式で30行以内
format: architecture-review
allowed_tools:
- Read
- Glob
@ -437,52 +236,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
**実装がarchitectムーブメントの設計に従っているか**を確認してください。
AI特有の問題はレビューしないでくださいai_reviewムーブメントで行います
**参照するレポート:**
- 設計: {report:01-architecture.md}(存在する場合)
- 実装スコープ: {report:02-coder-scope.md}
**レビュー観点:**
- 設計との整合性architectが定めたファイル構成・パターンに従っているか
- コード品質
- 変更スコープの適切性
- テストカバレッジ
- デッドコード
- 呼び出しチェーン検証
**注意:** architectムーブメントをスキップした小規模タスクの場合は、従来通り設計の妥当性も確認してください。
instruction: review-arch
- name: qa-review
edit: false
agent: ../agents/default/qa-reviewer.md
persona: qa-reviewer
stance: review
report:
name: 06-qa-review.md
format: |
```markdown
# QAレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## レビュー観点
| 観点 | 結果 | 備考 |
|------|------|------|
| テストカバレッジ | ✅ | - |
| テスト品質 | ✅ | - |
| エラーハンドリング | ✅ | - |
| ドキュメント | ✅ | - |
| 保守性 | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 問題 | 修正案 |
|---|---------|------|--------|
| 1 | テスト | 問題の説明 | 修正方法 |
```
format: qa-review
allowed_tools:
- Read
- Glob
@ -492,15 +254,7 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
品質保証の観点から変更をレビューしてください。
**レビュー観点:**
- テストカバレッジと品質
- テスト戦略unit/integration/E2E
- エラーハンドリング
- ログとモニタリング
- 保守性
instruction: review-qa
rules:
- condition: all("approved")
next: supervise
@ -509,7 +263,10 @@ movements:
- name: fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -525,24 +282,12 @@ movements:
next: reviewers
- condition: 判断できない、情報不足
next: plan
instruction_template: |
レビュアーのフィードバックに対応してください。
セッションの会話履歴を確認し、レビュアーの指摘事項を修正してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix
- name: supervise
edit: false
agent: ../agents/default/supervisor.md
persona: supervisor
stance: review
report:
- Validation: 07-supervisor-validation.md
- Summary: summary.md
@ -558,68 +303,4 @@ movements:
next: COMPLETE
- condition: 要求未達成、テスト失敗、ビルドエラー
next: plan
instruction_template: |
テスト実行、ビルド確認、最終承認を行ってください。
**ピース全体の確認:**
1. 計画({report:00-plan.md})と設計({report:01-architecture.md}、存在する場合)に従った実装か
2. 各レビュームーブメントの指摘が対応されているか
3. 元のタスク目的が達成されているか
**レポートの確認:** Report Directory内の全レポートを読み、
未対応の改善提案がないか確認してください。
**Validationレポートフォーマット:**
```markdown
# 最終検証結果
## 結果: APPROVE / REJECT
## 検証サマリー
| 項目 | 状態 | 確認方法 |
|------|------|---------|
| 要求充足 | ✅ | 要求リストと照合 |
| テスト | ✅ | `npm test` (N passed) |
| ビルド | ✅ | `npm run build` 成功 |
| 動作確認 | ✅ | 主要フロー確認 |
## 成果物
- 作成: {作成したファイル}
- 変更: {変更したファイル}
## 未完了項目REJECTの場合
| # | 項目 | 理由 |
|---|------|------|
| 1 | {項目} | {理由} |
```
**SummaryレポートフォーマットAPPROVEの場合のみ:**
```markdown
# タスク完了サマリー
## タスク
{元の要求を1-2文で}
## 結果
✅ 完了
## 変更内容
| 種別 | ファイル | 概要 |
|------|---------|------|
| 作成 | `src/file.ts` | 概要説明 |
## レビュー結果
| レビュー | 結果 |
|---------|------|
| Architecture Design | ✅ 完了 |
| AI Review | ✅ APPROVE |
| Architect Review | ✅ APPROVE |
| QA | ✅ APPROVE |
| Supervisor | ✅ APPROVE |
## 確認コマンド
```bash
npm test
npm run build
```
```
instruction: supervise

View File

@ -32,6 +32,46 @@ description: CQRS+ES・フロントエンド・セキュリティ・QA専門家
max_iterations: 30
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
planner: ../personas/planner.md
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
architecture-reviewer: ../personas/architecture-reviewer.md
cqrs-es-reviewer: ../personas/cqrs-es-reviewer.md
frontend-reviewer: ../personas/frontend-reviewer.md
security-reviewer: ../personas/security-reviewer.md
qa-reviewer: ../personas/qa-reviewer.md
expert-supervisor: ../personas/expert-supervisor.md
instructions:
plan: ../instructions/plan.md
implement: ../instructions/implement.md
ai-review: ../instructions/ai-review.md
ai-fix: ../instructions/ai-fix.md
arbitrate: ../instructions/arbitrate.md
review-cqrs-es: ../instructions/review-cqrs-es.md
review-frontend: ../instructions/review-frontend.md
review-security: ../instructions/review-security.md
review-qa: ../instructions/review-qa.md
fix: ../instructions/fix.md
supervise: ../instructions/supervise.md
fix-supervisor: ../instructions/fix-supervisor.md
report_formats:
plan: ../report-formats/plan.md
ai-review: ../report-formats/ai-review.md
cqrs-es-review: ../report-formats/cqrs-es-review.md
frontend-review: ../report-formats/frontend-review.md
security-review: ../report-formats/security-review.md
qa-review: ../report-formats/qa-review.md
validation: ../report-formats/validation.md
summary: ../report-formats/summary.md
initial_movement: plan
movements:
@ -40,30 +80,10 @@ movements:
# ===========================================
- name: plan
edit: false
agent: ../agents/default/planner.md
persona: planner
report:
name: 00-plan.md
format: |
```markdown
# タスク計画
## 元の要求
{ユーザーの要求をそのまま記載}
## 分析結果
### 目的
{達成すべきこと}
### スコープ
{影響範囲}
### 実装アプローチ
{どう進めるか}
## 確認事項(あれば)
- {不明点や確認が必要な点}
```
format: plan
allowed_tools:
- Read
- Glob
@ -71,16 +91,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
タスクを分析し、実装方針を立ててください。
**注意:** Previous Responseがある場合は差し戻しのため、
その内容を踏まえて計画を見直してくださいreplan
**やること:**
1. タスクの要件を理解する
2. 影響範囲を特定する
3. 実装アプローチを決める
instruction: plan
rules:
- condition: タスク分析と計画が完了した
next: implement
@ -92,7 +103,10 @@ movements:
# ===========================================
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
session: refresh
report:
@ -107,48 +121,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
planムーブメントで立てた計画に従って実装してください。
計画レポート({report:00-plan.md})を参照し、実装を進めてください。
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
rules:
- condition: 実装が完了した
next: ai_review
@ -166,52 +139,18 @@ movements:
# ===========================================
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 03-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
- Grep
- WebSearch
- WebFetch
instruction_template: |
**これは {movement_iteration} 回目のAI Reviewです。**
初回は網羅的にレビューし、指摘すべき問題をすべて出し切ってください。
2回目以降は、前回REJECTした項目が修正されたかの確認を優先してください。
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: ai-review
rules:
- condition: AI特有の問題が見つからない
next: reviewers
@ -220,7 +159,10 @@ movements:
- name: ai_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
session: refresh
allowed_tools:
@ -232,47 +174,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(`./gradlew :backend:test` 等)
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「修正を進行できない」に対応するタグを出力する
- 修正不要の場合は「修正を進行できない」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
rules:
- condition: AI Reviewerの指摘に対する修正が完了した
next: ai_review
@ -283,7 +185,8 @@ movements:
- name: ai_no_fix
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
allowed_tools:
- Read
- Glob
@ -293,21 +196,7 @@ movements:
next: ai_fix
- condition: ai_fixの判断が妥当修正不要
next: reviewers
instruction_template: |
ai_reviewレビュアーと ai_fixコーダーの意見が食い違っています。
- ai_review は問題を指摘し REJECT しました
- ai_fix は確認の上「修正不要」と判断しました
両者の出力を確認し、どちらの判断が妥当か裁定してください。
**参照するレポート:**
- AIレビュー結果: {report:03-ai-review.md}
**判断基準:**
- ai_review の指摘が具体的で、コード上の実在する問題を指しているか
- ai_fix の反論に根拠(ファイル確認結果、テスト結果)があるか
- 指摘が非ブロッキング(記録のみ)レベルか、実際に修正が必要か
instruction: arbitrate
# ===========================================
# Movement 3: Expert Reviews (Parallel)
@ -316,37 +205,11 @@ movements:
parallel:
- name: cqrs-es-review
edit: false
agent: ../agents/expert-cqrs/cqrs-es-reviewer.md
persona: cqrs-es-reviewer
stance: review
report:
name: 04-cqrs-es-review.md
format: |
```markdown
# CQRS+ESレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
| 観点 | 結果 | 備考 |
|------|------|------|
| Aggregate設計 | ✅ | - |
| イベント設計 | ✅ | - |
| Command/Query分離 | ✅ | - |
| プロジェクション | ✅ | - |
| 結果整合性 | ✅ | - |
## 問題点REJECTの場合
| # | スコープ | 場所 | 問題 | 修正案 |
|---|---------|------|------|--------|
| 1 | スコープ内 | `src/file.ts:42` | 問題の説明 | 修正方法 |
スコープ: 「スコープ内」(今回修正可能)/ 「スコープ外」(既存問題・非ブロッキング)
## 既存問題(参考・非ブロッキング)
- {既存問題の記録。今回の変更と無関係な問題}
```
format: cqrs-es-review
allowed_tools:
- Read
- Glob
@ -357,48 +220,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
CQRSコマンドクエリ責務分離とEvent Sourcingイベントソーシングの観点から
変更をレビューしてください。AI特有の問題のレビューは不要ですai_reviewムーブメントで実施済み
**レビュー観点:**
- Aggregate設計の妥当性
- イベント設計(粒度、命名、スキーマ)
- Command/Queryの分離
- プロジェクション設計
- 結果整合性の考慮
**注意**: このプロジェクトがCQRS+ESパターンを使用していない場合は、
一般的なドメイン設計の観点からレビューしてください。
instruction: review-cqrs-es
- name: frontend-review
edit: false
agent: ../agents/expert/frontend-reviewer.md
persona: frontend-reviewer
stance: review
report:
name: 05-frontend-review.md
format: |
```markdown
# フロントエンドレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
| 観点 | 結果 | 備考 |
|------|------|------|
| コンポーネント設計 | ✅ | - |
| 状態管理 | ✅ | - |
| パフォーマンス | ✅ | - |
| アクセシビリティ | ✅ | - |
| 型安全性 | ✅ | - |
## 問題点REJECTの場合
| # | 場所 | 問題 | 修正案 |
|---|------|------|--------|
| 1 | `src/file.tsx:42` | 問題の説明 | 修正方法 |
```
format: frontend-review
allowed_tools:
- Read
- Glob
@ -409,54 +239,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
フロントエンド開発の観点から変更をレビューしてください。
**レビュー観点:**
- コンポーネント設計(責務分離、粒度)
- 状態管理(ローカル/グローバルの判断)
- パフォーマンス(再レンダリング、メモ化)
- アクセシビリティキーボード操作、ARIA
- データフェッチパターン
- TypeScript型安全性
**注意**: このプロジェクトがフロントエンドを含まない場合は、
問題なしとして次に進んでください。
instruction: review-frontend
- name: security-review
edit: false
agent: ../agents/expert/security-reviewer.md
persona: security-reviewer
stance: review
report:
name: 06-security-review.md
format: |
```markdown
# セキュリティレビュー
## 結果: APPROVE / REJECT
## 重大度: None / Low / Medium / High / Critical
## チェック結果
| カテゴリ | 結果 | 備考 |
|---------|------|------|
| インジェクション | ✅ | - |
| 認証・認可 | ✅ | - |
| データ保護 | ✅ | - |
| 依存関係 | ✅ | - |
## 脆弱性REJECTの場合
| # | 重大度 | 種類 | 場所 | 修正案 |
|---|--------|------|------|--------|
| 1 | High | SQLi | `src/db.ts:42` | パラメータ化クエリを使用 |
## 警告(ブロッキングではない)
- {セキュリティに関する推奨事項}
```
**認知負荷軽減ルール:**
- 問題なし → チェック表のみ10行以内
- 警告 → + 警告1-2行15行以内
- 脆弱性 → + 表形式30行以内
format: security-review
allowed_tools:
- Read
- Glob
@ -467,41 +258,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
セキュリティの観点から変更をレビューしてください。以下の脆弱性をチェック:
- インジェクション攻撃SQL, コマンド, XSS
- 認証・認可の不備
- データ露出リスク
- 暗号化の弱点
instruction: review-security
- name: qa-review
edit: false
agent: ../agents/expert/qa-reviewer.md
persona: qa-reviewer
stance: review
report:
name: 07-qa-review.md
format: |
```markdown
# QAレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
| 観点 | 結果 | 備考 |
|------|------|------|
| テストカバレッジ | ✅ | - |
| テスト品質 | ✅ | - |
| エラーハンドリング | ✅ | - |
| ドキュメント | ✅ | - |
| 保守性 | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 問題 | 修正案 |
|---|---------|------|--------|
| 1 | テスト | 問題の説明 | 修正方法 |
```
format: qa-review
allowed_tools:
- Read
- Glob
@ -512,16 +277,7 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
品質保証の観点から変更をレビューしてください。
**レビュー観点:**
- テストカバレッジと品質
- テスト戦略(単体/統合/E2E
- ドキュメント(コード内・外部)
- エラーハンドリング
- ログとモニタリング
- 保守性
instruction: review-qa
rules:
- condition: all("approved")
next: supervise
@ -530,7 +286,10 @@ movements:
- name: fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -547,28 +306,15 @@ movements:
next: reviewers
- condition: 修正を進行できない
next: plan
instruction_template: |
レビュアーからのフィードバックに対応してください。
「Original User Request」は参考情報であり、最新の指示ではありません。
セッションの会話履歴を確認し、レビュアーの指摘事項を修正してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix
# ===========================================
# Movement 4: Supervision
# ===========================================
- name: supervise
edit: false
agent: ../agents/expert/supervisor.md
persona: expert-supervisor
stance: review
report:
- Validation: 08-supervisor-validation.md
- Summary: summary.md
@ -578,80 +324,7 @@ movements:
- Grep
- WebSearch
- WebFetch
instruction_template: |
## Previous Reviews Summary
このムーブメントに到達したということは、以下のレビューがすべてAPPROVEされています
- AI Review: APPROVED
- CQRS+ES Review: APPROVED
- Frontend Review: APPROVED
- Security Review: APPROVED
- QA Review: APPROVED
テスト実行、ビルド確認、最終承認を行ってください。
**ピース全体の確認:**
1. 計画({report:00-plan.md})と実装結果が一致しているか
2. 各レビュームーブメントの指摘が対応されているか
3. 元のタスク目的が達成されているか
**レポートの確認:** Report Directory内の全レポートを読み、
未対応の改善提案がないか確認してください。
**Validationレポートフォーマット:**
```markdown
# 最終検証結果
## 結果: APPROVE / REJECT
## 検証サマリー
| 項目 | 状態 | 確認方法 |
|------|------|---------|
| 要求充足 | ✅ | 要求リストと照合 |
| テスト | ✅ | `npm test` (N passed) |
| ビルド | ✅ | `npm run build` 成功 |
| 動作確認 | ✅ | 主要フロー確認 |
## 成果物
- 作成: {作成したファイル}
- 変更: {変更したファイル}
## 未完了項目REJECTの場合
| # | 項目 | 理由 |
|---|------|------|
| 1 | {項目} | {理由} |
```
**SummaryレポートフォーマットAPPROVEの場合のみ:**
```markdown
# タスク完了サマリー
## タスク
{元の要求を1-2文で}
## 結果
✅ 完了
## 変更内容
| 種別 | ファイル | 概要 |
|------|---------|------|
| 作成 | `src/file.ts` | 概要説明 |
## レビュー結果
| レビュー | 結果 |
|---------|------|
| AI Review | ✅ APPROVE |
| CQRS+ES | ✅ APPROVE |
| Frontend | ✅ APPROVE |
| Security | ✅ APPROVE |
| QA | ✅ APPROVE |
| Supervisor | ✅ APPROVE |
## 確認コマンド
```bash
npm test
npm run build
```
```
instruction: supervise
rules:
- condition: すべての検証が完了し、マージ可能な状態である
next: COMPLETE
@ -660,7 +333,10 @@ movements:
- name: fix_supervisor
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -671,22 +347,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor
rules:
- condition: 監督者の指摘に対する修正が完了した
next: supervise

View File

@ -32,6 +32,46 @@ description: CQRS+ES・フロントエンド・セキュリティ・QA専門家
max_iterations: 30
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
planner: ../personas/planner.md
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
architecture-reviewer: ../personas/architecture-reviewer.md
cqrs-es-reviewer: ../personas/cqrs-es-reviewer.md
frontend-reviewer: ../personas/frontend-reviewer.md
security-reviewer: ../personas/security-reviewer.md
qa-reviewer: ../personas/qa-reviewer.md
expert-supervisor: ../personas/expert-supervisor.md
instructions:
plan: ../instructions/plan.md
implement: ../instructions/implement.md
ai-review: ../instructions/ai-review.md
ai-fix: ../instructions/ai-fix.md
arbitrate: ../instructions/arbitrate.md
review-cqrs-es: ../instructions/review-cqrs-es.md
review-frontend: ../instructions/review-frontend.md
review-security: ../instructions/review-security.md
review-qa: ../instructions/review-qa.md
fix: ../instructions/fix.md
supervise: ../instructions/supervise.md
fix-supervisor: ../instructions/fix-supervisor.md
report_formats:
plan: ../report-formats/plan.md
ai-review: ../report-formats/ai-review.md
cqrs-es-review: ../report-formats/cqrs-es-review.md
frontend-review: ../report-formats/frontend-review.md
security-review: ../report-formats/security-review.md
qa-review: ../report-formats/qa-review.md
validation: ../report-formats/validation.md
summary: ../report-formats/summary.md
initial_movement: plan
movements:
@ -40,30 +80,10 @@ movements:
# ===========================================
- name: plan
edit: false
agent: ../agents/default/planner.md
persona: planner
report:
name: 00-plan.md
format: |
```markdown
# タスク計画
## 元の要求
{ユーザーの要求をそのまま記載}
## 分析結果
### 目的
{達成すべきこと}
### スコープ
{影響範囲}
### 実装アプローチ
{どう進めるか}
## 確認事項(あれば)
- {不明点や確認が必要な点}
```
format: plan
allowed_tools:
- Read
- Glob
@ -71,16 +91,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
タスクを分析し、実装方針を立ててください。
**注意:** Previous Responseがある場合は差し戻しのため、
その内容を踏まえて計画を見直してくださいreplan
**やること:**
1. タスクの要件を理解する
2. 影響範囲を特定する
3. 実装アプローチを決める
instruction: plan
rules:
- condition: タスク分析と計画が完了した
next: implement
@ -92,7 +103,10 @@ movements:
# ===========================================
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
session: refresh
report:
- Scope: 01-coder-scope.md
@ -106,48 +120,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
planムーブメントで立てた計画に従って実装してください。
計画レポート({report:00-plan.md})を参照し、実装を進めてください。
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
rules:
- condition: 実装が完了した
next: ai_review
@ -165,52 +138,18 @@ movements:
# ===========================================
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 03-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
- Grep
- WebSearch
- WebFetch
instruction_template: |
**これは {movement_iteration} 回目のAI Reviewです。**
初回は網羅的にレビューし、指摘すべき問題をすべて出し切ってください。
2回目以降は、前回REJECTした項目が修正されたかの確認を優先してください。
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: ai-review
rules:
- condition: AI特有の問題が見つからない
next: reviewers
@ -219,7 +158,10 @@ movements:
- name: ai_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
session: refresh
allowed_tools:
- Read
@ -230,47 +172,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(`./gradlew :backend:test` 等)
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「修正を進行できない」に対応するタグを出力する
- 修正不要の場合は「修正を進行できない」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
rules:
- condition: AI Reviewerの指摘に対する修正が完了した
next: ai_review
@ -281,7 +183,8 @@ movements:
- name: ai_no_fix
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
allowed_tools:
- Read
- Glob
@ -291,21 +194,7 @@ movements:
next: ai_fix
- condition: ai_fixの判断が妥当修正不要
next: reviewers
instruction_template: |
ai_reviewレビュアーと ai_fixコーダーの意見が食い違っています。
- ai_review は問題を指摘し REJECT しました
- ai_fix は確認の上「修正不要」と判断しました
両者の出力を確認し、どちらの判断が妥当か裁定してください。
**参照するレポート:**
- AIレビュー結果: {report:03-ai-review.md}
**判断基準:**
- ai_review の指摘が具体的で、コード上の実在する問題を指しているか
- ai_fix の反論に根拠(ファイル確認結果、テスト結果)があるか
- 指摘が非ブロッキング(記録のみ)レベルか、実際に修正が必要か
instruction: arbitrate
# ===========================================
# Movement 3: Expert Reviews (Parallel)
@ -314,37 +203,11 @@ movements:
parallel:
- name: cqrs-es-review
edit: false
agent: ../agents/expert-cqrs/cqrs-es-reviewer.md
persona: cqrs-es-reviewer
stance: review
report:
name: 04-cqrs-es-review.md
format: |
```markdown
# CQRS+ESレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
| 観点 | 結果 | 備考 |
|------|------|------|
| Aggregate設計 | ✅ | - |
| イベント設計 | ✅ | - |
| Command/Query分離 | ✅ | - |
| プロジェクション | ✅ | - |
| 結果整合性 | ✅ | - |
## 問題点REJECTの場合
| # | スコープ | 場所 | 問題 | 修正案 |
|---|---------|------|------|--------|
| 1 | スコープ内 | `src/file.ts:42` | 問題の説明 | 修正方法 |
スコープ: 「スコープ内」(今回修正可能)/ 「スコープ外」(既存問題・非ブロッキング)
## 既存問題(参考・非ブロッキング)
- {既存問題の記録。今回の変更と無関係な問題}
```
format: cqrs-es-review
allowed_tools:
- Read
- Glob
@ -355,48 +218,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
CQRSコマンドクエリ責務分離とEvent Sourcingイベントソーシングの観点から
変更をレビューしてください。AI特有の問題のレビューは不要ですai_reviewムーブメントで実施済み
**レビュー観点:**
- Aggregate設計の妥当性
- イベント設計(粒度、命名、スキーマ)
- Command/Queryの分離
- プロジェクション設計
- 結果整合性の考慮
**注意**: このプロジェクトがCQRS+ESパターンを使用していない場合は、
一般的なドメイン設計の観点からレビューしてください。
instruction: review-cqrs-es
- name: frontend-review
edit: false
agent: ../agents/expert/frontend-reviewer.md
persona: frontend-reviewer
stance: review
report:
name: 05-frontend-review.md
format: |
```markdown
# フロントエンドレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
| 観点 | 結果 | 備考 |
|------|------|------|
| コンポーネント設計 | ✅ | - |
| 状態管理 | ✅ | - |
| パフォーマンス | ✅ | - |
| アクセシビリティ | ✅ | - |
| 型安全性 | ✅ | - |
## 問題点REJECTの場合
| # | 場所 | 問題 | 修正案 |
|---|------|------|--------|
| 1 | `src/file.tsx:42` | 問題の説明 | 修正方法 |
```
format: frontend-review
allowed_tools:
- Read
- Glob
@ -407,54 +237,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
フロントエンド開発の観点から変更をレビューしてください。
**レビュー観点:**
- コンポーネント設計(責務分離、粒度)
- 状態管理(ローカル/グローバルの判断)
- パフォーマンス(再レンダリング、メモ化)
- アクセシビリティキーボード操作、ARIA
- データフェッチパターン
- TypeScript型安全性
**注意**: このプロジェクトがフロントエンドを含まない場合は、
問題なしとして次に進んでください。
instruction: review-frontend
- name: security-review
edit: false
agent: ../agents/expert/security-reviewer.md
persona: security-reviewer
stance: review
report:
name: 06-security-review.md
format: |
```markdown
# セキュリティレビュー
## 結果: APPROVE / REJECT
## 重大度: None / Low / Medium / High / Critical
## チェック結果
| カテゴリ | 結果 | 備考 |
|---------|------|------|
| インジェクション | ✅ | - |
| 認証・認可 | ✅ | - |
| データ保護 | ✅ | - |
| 依存関係 | ✅ | - |
## 脆弱性REJECTの場合
| # | 重大度 | 種類 | 場所 | 修正案 |
|---|--------|------|------|--------|
| 1 | High | SQLi | `src/db.ts:42` | パラメータ化クエリを使用 |
## 警告(ブロッキングではない)
- {セキュリティに関する推奨事項}
```
**認知負荷軽減ルール:**
- 問題なし → チェック表のみ10行以内
- 警告 → + 警告1-2行15行以内
- 脆弱性 → + 表形式30行以内
format: security-review
allowed_tools:
- Read
- Glob
@ -465,41 +256,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
セキュリティの観点から変更をレビューしてください。以下の脆弱性をチェック:
- インジェクション攻撃SQL, コマンド, XSS
- 認証・認可の不備
- データ露出リスク
- 暗号化の弱点
instruction: review-security
- name: qa-review
edit: false
agent: ../agents/expert/qa-reviewer.md
persona: qa-reviewer
stance: review
report:
name: 07-qa-review.md
format: |
```markdown
# QAレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
| 観点 | 結果 | 備考 |
|------|------|------|
| テストカバレッジ | ✅ | - |
| テスト品質 | ✅ | - |
| エラーハンドリング | ✅ | - |
| ドキュメント | ✅ | - |
| 保守性 | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 問題 | 修正案 |
|---|---------|------|--------|
| 1 | テスト | 問題の説明 | 修正方法 |
```
format: qa-review
allowed_tools:
- Read
- Glob
@ -510,16 +275,7 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
品質保証の観点から変更をレビューしてください。
**レビュー観点:**
- テストカバレッジと品質
- テスト戦略(単体/統合/E2E
- ドキュメント(コード内・外部)
- エラーハンドリング
- ログとモニタリング
- 保守性
instruction: review-qa
rules:
- condition: all("approved")
next: supervise
@ -528,7 +284,10 @@ movements:
- name: fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -544,28 +303,15 @@ movements:
next: reviewers
- condition: 修正を進行できない
next: plan
instruction_template: |
レビュアーからのフィードバックに対応してください。
「Original User Request」は参考情報であり、最新の指示ではありません。
セッションの会話履歴を確認し、レビュアーの指摘事項を修正してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix
# ===========================================
# Movement 4: Supervision
# ===========================================
- name: supervise
edit: false
agent: ../agents/expert/supervisor.md
persona: expert-supervisor
stance: review
report:
- Validation: 08-supervisor-validation.md
- Summary: summary.md
@ -575,80 +321,7 @@ movements:
- Grep
- WebSearch
- WebFetch
instruction_template: |
## Previous Reviews Summary
このムーブメントに到達したということは、以下のレビューがすべてAPPROVEされています
- AI Review: APPROVED
- CQRS+ES Review: APPROVED
- Frontend Review: APPROVED
- Security Review: APPROVED
- QA Review: APPROVED
テスト実行、ビルド確認、最終承認を行ってください。
**ピース全体の確認:**
1. 計画({report:00-plan.md})と実装結果が一致しているか
2. 各レビュームーブメントの指摘が対応されているか
3. 元のタスク目的が達成されているか
**レポートの確認:** Report Directory内の全レポートを読み、
未対応の改善提案がないか確認してください。
**Validationレポートフォーマット:**
```markdown
# 最終検証結果
## 結果: APPROVE / REJECT
## 検証サマリー
| 項目 | 状態 | 確認方法 |
|------|------|---------|
| 要求充足 | ✅ | 要求リストと照合 |
| テスト | ✅ | `npm test` (N passed) |
| ビルド | ✅ | `npm run build` 成功 |
| 動作確認 | ✅ | 主要フロー確認 |
## 成果物
- 作成: {作成したファイル}
- 変更: {変更したファイル}
## 未完了項目REJECTの場合
| # | 項目 | 理由 |
|---|------|------|
| 1 | {項目} | {理由} |
```
**SummaryレポートフォーマットAPPROVEの場合のみ:**
```markdown
# タスク完了サマリー
## タスク
{元の要求を1-2文で}
## 結果
✅ 完了
## 変更内容
| 種別 | ファイル | 概要 |
|------|---------|------|
| 作成 | `src/file.ts` | 概要説明 |
## レビュー結果
| レビュー | 結果 |
|---------|------|
| AI Review | ✅ APPROVE |
| CQRS+ES | ✅ APPROVE |
| Frontend | ✅ APPROVE |
| Security | ✅ APPROVE |
| QA | ✅ APPROVE |
| Supervisor | ✅ APPROVE |
## 確認コマンド
```bash
npm test
npm run build
```
```
instruction: supervise
rules:
- condition: すべての検証が完了し、マージ可能な状態である
next: COMPLETE
@ -657,7 +330,10 @@ movements:
- name: fix_supervisor
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -667,22 +343,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor
rules:
- condition: 監督者の指摘に対する修正が完了した
next: supervise

View File

@ -23,6 +23,45 @@ description: アーキテクチャ・フロントエンド・セキュリティ
max_iterations: 30
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
planner: ../personas/planner.md
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
architecture-reviewer: ../personas/architecture-reviewer.md
frontend-reviewer: ../personas/frontend-reviewer.md
security-reviewer: ../personas/security-reviewer.md
qa-reviewer: ../personas/qa-reviewer.md
expert-supervisor: ../personas/expert-supervisor.md
instructions:
plan: ../instructions/plan.md
implement: ../instructions/implement.md
ai-review: ../instructions/ai-review.md
ai-fix: ../instructions/ai-fix.md
arbitrate: ../instructions/arbitrate.md
review-arch: ../instructions/review-arch.md
review-frontend: ../instructions/review-frontend.md
review-security: ../instructions/review-security.md
review-qa: ../instructions/review-qa.md
fix: ../instructions/fix.md
supervise: ../instructions/supervise.md
fix-supervisor: ../instructions/fix-supervisor.md
report_formats:
plan: ../report-formats/plan.md
ai-review: ../report-formats/ai-review.md
architecture-review: ../report-formats/architecture-review.md
frontend-review: ../report-formats/frontend-review.md
security-review: ../report-formats/security-review.md
qa-review: ../report-formats/qa-review.md
validation: ../report-formats/validation.md
summary: ../report-formats/summary.md
initial_movement: plan
movements:
@ -31,30 +70,10 @@ movements:
# ===========================================
- name: plan
edit: false
agent: ../agents/default/planner.md
persona: planner
report:
name: 00-plan.md
format: |
```markdown
# タスク計画
## 元の要求
{ユーザーの要求をそのまま記載}
## 分析結果
### 目的
{達成すべきこと}
### スコープ
{影響範囲}
### 実装アプローチ
{どう進めるか}
## 確認事項(あれば)
- {不明点や確認が必要な点}
```
format: plan
allowed_tools:
- Read
- Glob
@ -62,16 +81,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
タスクを分析し、実装方針を立ててください。
**注意:** Previous Responseがある場合は差し戻しのため、
その内容を踏まえて計画を見直してくださいreplan
**やること:**
1. タスクの要件を理解する
2. 影響範囲を特定する
3. 実装アプローチを決める
instruction: plan
rules:
- condition: タスク分析と計画が完了した
next: implement
@ -83,7 +93,10 @@ movements:
# ===========================================
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
session: refresh
report:
@ -98,48 +111,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
planムーブメントで立てた計画に従って実装してください。
計画レポート({report:00-plan.md})を参照し、実装を進めてください。
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
rules:
- condition: 実装が完了した
next: ai_review
@ -157,52 +129,18 @@ movements:
# ===========================================
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 03-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
- Grep
- WebSearch
- WebFetch
instruction_template: |
**これは {movement_iteration} 回目のAI Reviewです。**
初回は網羅的にレビューし、指摘すべき問題をすべて出し切ってください。
2回目以降は、前回REJECTした項目が修正されたかの確認を優先してください。
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: ai-review
rules:
- condition: AI特有の問題が見つからない
next: reviewers
@ -211,7 +149,10 @@ movements:
- name: ai_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
session: refresh
allowed_tools:
@ -223,47 +164,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(`./gradlew :backend:test` 等)
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「修正を進行できない」に対応するタグを出力する
- 修正不要の場合は「修正を進行できない」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
rules:
- condition: AI Reviewerの指摘に対する修正が完了した
next: ai_review
@ -274,7 +175,8 @@ movements:
- name: ai_no_fix
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
allowed_tools:
- Read
- Glob
@ -284,21 +186,7 @@ movements:
next: ai_fix
- condition: ai_fixの判断が妥当修正不要
next: reviewers
instruction_template: |
ai_reviewレビュアーと ai_fixコーダーの意見が食い違っています。
- ai_review は問題を指摘し REJECT しました
- ai_fix は確認の上「修正不要」と判断しました
両者の出力を確認し、どちらの判断が妥当か裁定してください。
**参照するレポート:**
- AIレビュー結果: {report:03-ai-review.md}
**判断基準:**
- ai_review の指摘が具体的で、コード上の実在する問題を指しているか
- ai_fix の反論に根拠(ファイル確認結果、テスト結果)があるか
- 指摘が非ブロッキング(記録のみ)レベルか、実際に修正が必要か
instruction: arbitrate
# ===========================================
# Movement 3: Expert Reviews (Parallel)
@ -307,40 +195,11 @@ movements:
parallel:
- name: arch-review
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
report:
name: 04-architect-review.md
format: |
```markdown
# アーキテクチャレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
- [x] 構造・設計
- [x] コード品質
- [x] 変更スコープ
- [x] テストカバレッジ
- [x] デッドコード
- [x] 呼び出しチェーン検証
## 問題点REJECTの場合
| # | スコープ | 場所 | 問題 | 修正案 |
|---|---------|------|------|--------|
| 1 | スコープ内 | `src/file.ts:42` | 問題の説明 | 修正方法 |
スコープ: 「スコープ内」(今回修正可能)/ 「スコープ外」(既存問題・非ブロッキング)
## 既存問題(参考・非ブロッキング)
- {既存問題の記録。今回の変更と無関係な問題}
```
**認知負荷軽減ルール:**
- APPROVE → サマリーのみ5行以内
- REJECT → 問題点を表形式で30行以内
format: architecture-review
allowed_tools:
- Read
- Glob
@ -351,45 +210,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
**アーキテクチャと設計**のレビューに集中してください。AI特有の問題のレビューは不要ですai_reviewムーブメントで実施済み
**レビュー観点:**
- 構造・設計の妥当性
- コード品質
- 変更スコープの適切性
- テストカバレッジ
- デッドコード
- 呼び出しチェーン検証
instruction: review-arch
- name: frontend-review
edit: false
agent: ../agents/expert/frontend-reviewer.md
persona: frontend-reviewer
stance: review
report:
name: 05-frontend-review.md
format: |
```markdown
# フロントエンドレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
| 観点 | 結果 | 備考 |
|------|------|------|
| コンポーネント設計 | ✅ | - |
| 状態管理 | ✅ | - |
| パフォーマンス | ✅ | - |
| アクセシビリティ | ✅ | - |
| 型安全性 | ✅ | - |
## 問題点REJECTの場合
| # | 場所 | 問題 | 修正案 |
|---|------|------|--------|
| 1 | `src/file.tsx:42` | 問題の説明 | 修正方法 |
```
format: frontend-review
allowed_tools:
- Read
- Glob
@ -400,54 +229,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
フロントエンド開発の観点から変更をレビューしてください。
**レビュー観点:**
- コンポーネント設計(責務分離、粒度)
- 状態管理(ローカル/グローバルの判断)
- パフォーマンス(再レンダリング、メモ化)
- アクセシビリティキーボード操作、ARIA
- データフェッチパターン
- TypeScript型安全性
**注意**: このプロジェクトがフロントエンドを含まない場合は、
問題なしとして次に進んでください。
instruction: review-frontend
- name: security-review
edit: false
agent: ../agents/expert/security-reviewer.md
persona: security-reviewer
stance: review
report:
name: 06-security-review.md
format: |
```markdown
# セキュリティレビュー
## 結果: APPROVE / REJECT
## 重大度: None / Low / Medium / High / Critical
## チェック結果
| カテゴリ | 結果 | 備考 |
|---------|------|------|
| インジェクション | ✅ | - |
| 認証・認可 | ✅ | - |
| データ保護 | ✅ | - |
| 依存関係 | ✅ | - |
## 脆弱性REJECTの場合
| # | 重大度 | 種類 | 場所 | 修正案 |
|---|--------|------|------|--------|
| 1 | High | SQLi | `src/db.ts:42` | パラメータ化クエリを使用 |
## 警告(ブロッキングではない)
- {セキュリティに関する推奨事項}
```
**認知負荷軽減ルール:**
- 問題なし → チェック表のみ10行以内
- 警告 → + 警告1-2行15行以内
- 脆弱性 → + 表形式30行以内
format: security-review
allowed_tools:
- Read
- Glob
@ -458,41 +248,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
セキュリティの観点から変更をレビューしてください。以下の脆弱性をチェック:
- インジェクション攻撃SQL, コマンド, XSS
- 認証・認可の不備
- データ露出リスク
- 暗号化の弱点
instruction: review-security
- name: qa-review
edit: false
agent: ../agents/expert/qa-reviewer.md
persona: qa-reviewer
stance: review
report:
name: 07-qa-review.md
format: |
```markdown
# QAレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
| 観点 | 結果 | 備考 |
|------|------|------|
| テストカバレッジ | ✅ | - |
| テスト品質 | ✅ | - |
| エラーハンドリング | ✅ | - |
| ドキュメント | ✅ | - |
| 保守性 | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 問題 | 修正案 |
|---|---------|------|--------|
| 1 | テスト | 問題の説明 | 修正方法 |
```
format: qa-review
allowed_tools:
- Read
- Glob
@ -503,16 +267,7 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
品質保証の観点から変更をレビューしてください。
**レビュー観点:**
- テストカバレッジと品質
- テスト戦略(単体/統合/E2E
- ドキュメント(コード内・外部)
- エラーハンドリング
- ログとモニタリング
- 保守性
instruction: review-qa
rules:
- condition: all("approved")
next: supervise
@ -521,7 +276,10 @@ movements:
- name: fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -538,28 +296,15 @@ movements:
next: reviewers
- condition: 修正を進行できない
next: plan
instruction_template: |
レビュアーからのフィードバックに対応してください。
「Original User Request」は参考情報であり、最新の指示ではありません。
セッションの会話履歴を確認し、レビュアーの指摘事項を修正してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix
# ===========================================
# Movement 4: Supervision
# ===========================================
- name: supervise
edit: false
agent: ../agents/expert/supervisor.md
persona: expert-supervisor
stance: review
report:
- Validation: 08-supervisor-validation.md
- Summary: summary.md
@ -569,80 +314,7 @@ movements:
- Grep
- WebSearch
- WebFetch
instruction_template: |
## Previous Reviews Summary
このムーブメントに到達したということは、以下のレビューがすべてAPPROVEされています
- AI Review: APPROVED
- Architecture Review: APPROVED
- Frontend Review: APPROVED
- Security Review: APPROVED
- QA Review: APPROVED
テスト実行、ビルド確認、最終承認を行ってください。
**ピース全体の確認:**
1. 計画({report:00-plan.md})と実装結果が一致しているか
2. 各レビュームーブメントの指摘が対応されているか
3. 元のタスク目的が達成されているか
**レポートの確認:** Report Directory内の全レポートを読み、
未対応の改善提案がないか確認してください。
**Validationレポートフォーマット:**
```markdown
# 最終検証結果
## 結果: APPROVE / REJECT
## 検証サマリー
| 項目 | 状態 | 確認方法 |
|------|------|---------|
| 要求充足 | ✅ | 要求リストと照合 |
| テスト | ✅ | `npm test` (N passed) |
| ビルド | ✅ | `npm run build` 成功 |
| 動作確認 | ✅ | 主要フロー確認 |
## 成果物
- 作成: {作成したファイル}
- 変更: {変更したファイル}
## 未完了項目REJECTの場合
| # | 項目 | 理由 |
|---|------|------|
| 1 | {項目} | {理由} |
```
**SummaryレポートフォーマットAPPROVEの場合のみ:**
```markdown
# タスク完了サマリー
## タスク
{元の要求を1-2文で}
## 結果
✅ 完了
## 変更内容
| 種別 | ファイル | 概要 |
|------|---------|------|
| 作成 | `src/file.ts` | 概要説明 |
## レビュー結果
| レビュー | 結果 |
|---------|------|
| AI Review | ✅ APPROVE |
| Architecture | ✅ APPROVE |
| Frontend | ✅ APPROVE |
| Security | ✅ APPROVE |
| QA | ✅ APPROVE |
| Supervisor | ✅ APPROVE |
## 確認コマンド
```bash
npm test
npm run build
```
```
instruction: supervise
rules:
- condition: すべての検証が完了し、マージ可能な状態である
next: COMPLETE
@ -651,7 +323,10 @@ movements:
- name: fix_supervisor
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -662,22 +337,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor
rules:
- condition: 監督者の指摘に対する修正が完了した
next: supervise

View File

@ -23,6 +23,45 @@ description: アーキテクチャ・フロントエンド・セキュリティ
max_iterations: 30
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
planner: ../personas/planner.md
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
architecture-reviewer: ../personas/architecture-reviewer.md
frontend-reviewer: ../personas/frontend-reviewer.md
security-reviewer: ../personas/security-reviewer.md
qa-reviewer: ../personas/qa-reviewer.md
expert-supervisor: ../personas/expert-supervisor.md
instructions:
plan: ../instructions/plan.md
implement: ../instructions/implement.md
ai-review: ../instructions/ai-review.md
ai-fix: ../instructions/ai-fix.md
arbitrate: ../instructions/arbitrate.md
review-arch: ../instructions/review-arch.md
review-frontend: ../instructions/review-frontend.md
review-security: ../instructions/review-security.md
review-qa: ../instructions/review-qa.md
fix: ../instructions/fix.md
supervise: ../instructions/supervise.md
fix-supervisor: ../instructions/fix-supervisor.md
report_formats:
plan: ../report-formats/plan.md
ai-review: ../report-formats/ai-review.md
architecture-review: ../report-formats/architecture-review.md
frontend-review: ../report-formats/frontend-review.md
security-review: ../report-formats/security-review.md
qa-review: ../report-formats/qa-review.md
validation: ../report-formats/validation.md
summary: ../report-formats/summary.md
initial_movement: plan
movements:
@ -31,30 +70,10 @@ movements:
# ===========================================
- name: plan
edit: false
agent: ../agents/default/planner.md
persona: planner
report:
name: 00-plan.md
format: |
```markdown
# タスク計画
## 元の要求
{ユーザーの要求をそのまま記載}
## 分析結果
### 目的
{達成すべきこと}
### スコープ
{影響範囲}
### 実装アプローチ
{どう進めるか}
## 確認事項(あれば)
- {不明点や確認が必要な点}
```
format: plan
allowed_tools:
- Read
- Glob
@ -62,16 +81,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
タスクを分析し、実装方針を立ててください。
**注意:** Previous Responseがある場合は差し戻しのため、
その内容を踏まえて計画を見直してくださいreplan
**やること:**
1. タスクの要件を理解する
2. 影響範囲を特定する
3. 実装アプローチを決める
instruction: plan
rules:
- condition: タスク分析と計画が完了した
next: implement
@ -83,7 +93,10 @@ movements:
# ===========================================
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
session: refresh
report:
- Scope: 01-coder-scope.md
@ -97,48 +110,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
planムーブメントで立てた計画に従って実装してください。
計画レポート({report:00-plan.md})を参照し、実装を進めてください。
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
rules:
- condition: 実装が完了した
next: ai_review
@ -156,52 +128,18 @@ movements:
# ===========================================
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 03-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
- Grep
- WebSearch
- WebFetch
instruction_template: |
**これは {movement_iteration} 回目のAI Reviewです。**
初回は網羅的にレビューし、指摘すべき問題をすべて出し切ってください。
2回目以降は、前回REJECTした項目が修正されたかの確認を優先してください。
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: ai-review
rules:
- condition: AI特有の問題が見つからない
next: reviewers
@ -210,7 +148,10 @@ movements:
- name: ai_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
session: refresh
allowed_tools:
- Read
@ -221,47 +162,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(`./gradlew :backend:test` 等)
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「修正を進行できない」に対応するタグを出力する
- 修正不要の場合は「修正を進行できない」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
rules:
- condition: AI Reviewerの指摘に対する修正が完了した
next: ai_review
@ -272,7 +173,8 @@ movements:
- name: ai_no_fix
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
allowed_tools:
- Read
- Glob
@ -282,21 +184,7 @@ movements:
next: ai_fix
- condition: ai_fixの判断が妥当修正不要
next: reviewers
instruction_template: |
ai_reviewレビュアーと ai_fixコーダーの意見が食い違っています。
- ai_review は問題を指摘し REJECT しました
- ai_fix は確認の上「修正不要」と判断しました
両者の出力を確認し、どちらの判断が妥当か裁定してください。
**参照するレポート:**
- AIレビュー結果: {report:03-ai-review.md}
**判断基準:**
- ai_review の指摘が具体的で、コード上の実在する問題を指しているか
- ai_fix の反論に根拠(ファイル確認結果、テスト結果)があるか
- 指摘が非ブロッキング(記録のみ)レベルか、実際に修正が必要か
instruction: arbitrate
# ===========================================
# Movement 3: Expert Reviews (Parallel)
@ -305,40 +193,11 @@ movements:
parallel:
- name: arch-review
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
report:
name: 04-architect-review.md
format: |
```markdown
# アーキテクチャレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
- [x] 構造・設計
- [x] コード品質
- [x] 変更スコープ
- [x] テストカバレッジ
- [x] デッドコード
- [x] 呼び出しチェーン検証
## 問題点REJECTの場合
| # | スコープ | 場所 | 問題 | 修正案 |
|---|---------|------|------|--------|
| 1 | スコープ内 | `src/file.ts:42` | 問題の説明 | 修正方法 |
スコープ: 「スコープ内」(今回修正可能)/ 「スコープ外」(既存問題・非ブロッキング)
## 既存問題(参考・非ブロッキング)
- {既存問題の記録。今回の変更と無関係な問題}
```
**認知負荷軽減ルール:**
- APPROVE → サマリーのみ5行以内
- REJECT → 問題点を表形式で30行以内
format: architecture-review
allowed_tools:
- Read
- Glob
@ -349,45 +208,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
**アーキテクチャと設計**のレビューに集中してください。AI特有の問題のレビューは不要ですai_reviewムーブメントで実施済み
**レビュー観点:**
- 構造・設計の妥当性
- コード品質
- 変更スコープの適切性
- テストカバレッジ
- デッドコード
- 呼び出しチェーン検証
instruction: review-arch
- name: frontend-review
edit: false
agent: ../agents/expert/frontend-reviewer.md
persona: frontend-reviewer
stance: review
report:
name: 05-frontend-review.md
format: |
```markdown
# フロントエンドレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
| 観点 | 結果 | 備考 |
|------|------|------|
| コンポーネント設計 | ✅ | - |
| 状態管理 | ✅ | - |
| パフォーマンス | ✅ | - |
| アクセシビリティ | ✅ | - |
| 型安全性 | ✅ | - |
## 問題点REJECTの場合
| # | 場所 | 問題 | 修正案 |
|---|------|------|--------|
| 1 | `src/file.tsx:42` | 問題の説明 | 修正方法 |
```
format: frontend-review
allowed_tools:
- Read
- Glob
@ -398,54 +227,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
フロントエンド開発の観点から変更をレビューしてください。
**レビュー観点:**
- コンポーネント設計(責務分離、粒度)
- 状態管理(ローカル/グローバルの判断)
- パフォーマンス(再レンダリング、メモ化)
- アクセシビリティキーボード操作、ARIA
- データフェッチパターン
- TypeScript型安全性
**注意**: このプロジェクトがフロントエンドを含まない場合は、
問題なしとして次に進んでください。
instruction: review-frontend
- name: security-review
edit: false
agent: ../agents/expert/security-reviewer.md
persona: security-reviewer
stance: review
report:
name: 06-security-review.md
format: |
```markdown
# セキュリティレビュー
## 結果: APPROVE / REJECT
## 重大度: None / Low / Medium / High / Critical
## チェック結果
| カテゴリ | 結果 | 備考 |
|---------|------|------|
| インジェクション | ✅ | - |
| 認証・認可 | ✅ | - |
| データ保護 | ✅ | - |
| 依存関係 | ✅ | - |
## 脆弱性REJECTの場合
| # | 重大度 | 種類 | 場所 | 修正案 |
|---|--------|------|------|--------|
| 1 | High | SQLi | `src/db.ts:42` | パラメータ化クエリを使用 |
## 警告(ブロッキングではない)
- {セキュリティに関する推奨事項}
```
**認知負荷軽減ルール:**
- 問題なし → チェック表のみ10行以内
- 警告 → + 警告1-2行15行以内
- 脆弱性 → + 表形式30行以内
format: security-review
allowed_tools:
- Read
- Glob
@ -456,41 +246,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
セキュリティの観点から変更をレビューしてください。以下の脆弱性をチェック:
- インジェクション攻撃SQL, コマンド, XSS
- 認証・認可の不備
- データ露出リスク
- 暗号化の弱点
instruction: review-security
- name: qa-review
edit: false
agent: ../agents/expert/qa-reviewer.md
persona: qa-reviewer
stance: review
report:
name: 07-qa-review.md
format: |
```markdown
# QAレビュー
## 結果: APPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
| 観点 | 結果 | 備考 |
|------|------|------|
| テストカバレッジ | ✅ | - |
| テスト品質 | ✅ | - |
| エラーハンドリング | ✅ | - |
| ドキュメント | ✅ | - |
| 保守性 | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 問題 | 修正案 |
|---|---------|------|--------|
| 1 | テスト | 問題の説明 | 修正方法 |
```
format: qa-review
allowed_tools:
- Read
- Glob
@ -501,16 +265,7 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
品質保証の観点から変更をレビューしてください。
**レビュー観点:**
- テストカバレッジと品質
- テスト戦略(単体/統合/E2E
- ドキュメント(コード内・外部)
- エラーハンドリング
- ログとモニタリング
- 保守性
instruction: review-qa
rules:
- condition: all("approved")
next: supervise
@ -519,7 +274,10 @@ movements:
- name: fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -535,28 +293,15 @@ movements:
next: reviewers
- condition: 修正を進行できない
next: plan
instruction_template: |
レビュアーからのフィードバックに対応してください。
「Original User Request」は参考情報であり、最新の指示ではありません。
セッションの会話履歴を確認し、レビュアーの指摘事項を修正してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix
# ===========================================
# Movement 4: Supervision
# ===========================================
- name: supervise
edit: false
agent: ../agents/expert/supervisor.md
persona: expert-supervisor
stance: review
report:
- Validation: 08-supervisor-validation.md
- Summary: summary.md
@ -566,80 +311,7 @@ movements:
- Grep
- WebSearch
- WebFetch
instruction_template: |
## Previous Reviews Summary
このムーブメントに到達したということは、以下のレビューがすべてAPPROVEされています
- AI Review: APPROVED
- Architecture Review: APPROVED
- Frontend Review: APPROVED
- Security Review: APPROVED
- QA Review: APPROVED
テスト実行、ビルド確認、最終承認を行ってください。
**ピース全体の確認:**
1. 計画({report:00-plan.md})と実装結果が一致しているか
2. 各レビュームーブメントの指摘が対応されているか
3. 元のタスク目的が達成されているか
**レポートの確認:** Report Directory内の全レポートを読み、
未対応の改善提案がないか確認してください。
**Validationレポートフォーマット:**
```markdown
# 最終検証結果
## 結果: APPROVE / REJECT
## 検証サマリー
| 項目 | 状態 | 確認方法 |
|------|------|---------|
| 要求充足 | ✅ | 要求リストと照合 |
| テスト | ✅ | `npm test` (N passed) |
| ビルド | ✅ | `npm run build` 成功 |
| 動作確認 | ✅ | 主要フロー確認 |
## 成果物
- 作成: {作成したファイル}
- 変更: {変更したファイル}
## 未完了項目REJECTの場合
| # | 項目 | 理由 |
|---|------|------|
| 1 | {項目} | {理由} |
```
**SummaryレポートフォーマットAPPROVEの場合のみ:**
```markdown
# タスク完了サマリー
## タスク
{元の要求を1-2文で}
## 結果
✅ 完了
## 変更内容
| 種別 | ファイル | 概要 |
|------|---------|------|
| 作成 | `src/file.ts` | 概要説明 |
## レビュー結果
| レビュー | 結果 |
|---------|------|
| AI Review | ✅ APPROVE |
| Architecture | ✅ APPROVE |
| Frontend | ✅ APPROVE |
| Security | ✅ APPROVE |
| QA | ✅ APPROVE |
| Supervisor | ✅ APPROVE |
## 確認コマンド
```bash
npm test
npm run build
```
```
instruction: supervise
rules:
- condition: すべての検証が完了し、マージ可能な状態である
next: COMPLETE
@ -648,7 +320,10 @@ movements:
- name: fix_supervisor
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -658,22 +333,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor
rules:
- condition: 監督者の指摘に対する修正が完了した
next: supervise

View File

@ -16,9 +16,16 @@ description: MAGI合議システム - 3つの観点から分析し多数決で
max_iterations: 5
personas:
melchior: ../personas/melchior.md
balthasar: ../personas/balthasar.md
casper: ../personas/casper.md
initial_movement: melchior
movements:
- name: melchior
agent: ../agents/magi/melchior.md
persona: melchior
allowed_tools:
- Read
- Glob
@ -55,7 +62,7 @@ movements:
next: balthasar
- name: balthasar
agent: ../agents/magi/balthasar.md
persona: balthasar
allowed_tools:
- Read
- Glob
@ -96,7 +103,7 @@ movements:
next: casper
- name: casper
agent: ../agents/magi/casper.md
persona: casper
allowed_tools:
- Read
- Glob

View File

@ -16,12 +16,35 @@ description: Minimal development piece (implement -> parallel review -> fix if n
max_iterations: 20
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
supervisor: ../personas/supervisor.md
instructions:
implement: ../instructions/implement.md
review-ai: ../instructions/review-ai.md
ai-fix: ../instructions/ai-fix.md
supervise: ../instructions/supervise.md
fix-supervisor: ../instructions/fix-supervisor.md
report_formats:
ai-review: ../report-formats/ai-review.md
initial_movement: implement
movements:
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
report:
- Scope: 01-coder-scope.md
@ -36,48 +59,7 @@ movements:
- WebSearch
- WebFetch
permission_mode: edit
instruction_template: |
タスクを実装してください。
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
rules:
- condition: 実装が完了した
next: reviewers
@ -92,35 +74,11 @@ movements:
parallel:
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 03-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
@ -128,19 +86,15 @@ movements:
- WebSearch
- WebFetch
instruction_template: |
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: review-ai
rules:
- condition: "AI特有の問題なし"
- condition: "AI特有の問題あり"
- name: supervise
edit: false
agent: ../agents/default/supervisor.md
persona: supervisor
stance: review
report:
- Validation: 05-supervisor-validation.md
- Summary: summary.md
@ -152,68 +106,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
テスト実行、ビルド確認、最終承認を行ってください。
**ピース全体の確認:**
1. 実装結果が元の要求を満たしているか
2. AI Reviewの指摘が対応されているか
3. 元のタスク目的が達成されているか
**レポートの確認:** Report Directory内の全レポートを読み、
未対応の改善提案がないか確認してください。
**Validationレポートフォーマット:**
```markdown
# 最終検証結果
## 結果: APPROVE / REJECT
## 検証サマリー
| 項目 | 状態 | 確認方法 |
|------|------|---------|
| 要求充足 | ✅ | 要求リストと照合 |
| テスト | ✅ | `npm test` (N passed) |
| ビルド | ✅ | `npm run build` 成功 |
| 動作確認 | ✅ | 主要フロー確認 |
## 成果物
- 作成: {作成したファイル}
- 変更: {変更したファイル}
## 未完了項目REJECTの場合
| # | 項目 | 理由 |
|---|------|------|
| 1 | {項目} | {理由} |
```
**SummaryレポートフォーマットAPPROVEの場合のみ:**
```markdown
# タスク完了サマリー
## タスク
{元の要求を1-2文で}
## 結果
✅ 完了
## 変更内容
| 種別 | ファイル | 概要 |
|------|---------|------|
| 作成 | `src/file.ts` | 概要説明 |
## レビュー結果
| レビュー | 結果 |
|---------|------|
| AI Review | ✅ APPROVE |
| Supervisor | ✅ APPROVE |
## 確認コマンド
```bash
npm test
npm run build
```
```
instruction: supervise
rules:
- condition: "すべて問題なし"
- condition: "要求未達成、テスト失敗、ビルドエラー"
@ -232,7 +125,10 @@ movements:
parallel:
- name: ai_fix_parallel
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -248,51 +144,14 @@ movements:
- condition: AI問題の修正完了
- condition: 修正不要(指摘対象ファイル/仕様の確認済み)
- condition: 判断できない、情報不足
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(例: `npm test`, `./gradlew test`
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「判断できない、情報不足」に対応するタグを出力する
- 修正不要の場合は「判断できない、情報不足」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
- name: supervise_fix_parallel
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -307,21 +166,7 @@ movements:
rules:
- condition: 監督者の指摘に対する修正が完了した
- condition: 修正を進行できない
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor
rules:
- condition: all("AI問題の修正完了", "監督者の指摘に対する修正が完了した")
@ -331,7 +176,10 @@ movements:
- name: ai_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -350,51 +198,14 @@ movements:
next: implement
- condition: 判断できない、情報不足
next: implement
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(例: `npm test`, `./gradlew test`
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「判断できない、情報不足」に対応するタグを出力する
- 修正不要の場合は「判断できない、情報不足」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
- name: supervise_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -411,18 +222,4 @@ movements:
next: reviewers
- condition: 修正を進行できない
next: implement
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor

View File

@ -16,12 +16,35 @@ description: Minimal development piece (implement -> parallel review -> fix if n
max_iterations: 20
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
supervisor: ../personas/supervisor.md
instructions:
implement: ../instructions/implement.md
review-ai: ../instructions/review-ai.md
ai-fix: ../instructions/ai-fix.md
supervise: ../instructions/supervise.md
fix-supervisor: ../instructions/fix-supervisor.md
report_formats:
ai-review: ../report-formats/ai-review.md
initial_movement: implement
movements:
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
report:
- Scope: 01-coder-scope.md
- Decisions: 02-coder-decisions.md
@ -35,48 +58,7 @@ movements:
- WebSearch
- WebFetch
permission_mode: edit
instruction_template: |
タスクを実装してください。
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
rules:
- condition: 実装が完了した
next: reviewers
@ -91,35 +73,11 @@ movements:
parallel:
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 03-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
@ -127,19 +85,15 @@ movements:
- WebSearch
- WebFetch
instruction_template: |
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: review-ai
rules:
- condition: "AI特有の問題なし"
- condition: "AI特有の問題あり"
- name: supervise
edit: false
agent: ../agents/default/supervisor.md
persona: supervisor
stance: review
report:
- Validation: 05-supervisor-validation.md
- Summary: summary.md
@ -151,68 +105,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
テスト実行、ビルド確認、最終承認を行ってください。
**ピース全体の確認:**
1. 実装結果が元の要求を満たしているか
2. AI Reviewの指摘が対応されているか
3. 元のタスク目的が達成されているか
**レポートの確認:** Report Directory内の全レポートを読み、
未対応の改善提案がないか確認してください。
**Validationレポートフォーマット:**
```markdown
# 最終検証結果
## 結果: APPROVE / REJECT
## 検証サマリー
| 項目 | 状態 | 確認方法 |
|------|------|---------|
| 要求充足 | ✅ | 要求リストと照合 |
| テスト | ✅ | `npm test` (N passed) |
| ビルド | ✅ | `npm run build` 成功 |
| 動作確認 | ✅ | 主要フロー確認 |
## 成果物
- 作成: {作成したファイル}
- 変更: {変更したファイル}
## 未完了項目REJECTの場合
| # | 項目 | 理由 |
|---|------|------|
| 1 | {項目} | {理由} |
```
**SummaryレポートフォーマットAPPROVEの場合のみ:**
```markdown
# タスク完了サマリー
## タスク
{元の要求を1-2文で}
## 結果
✅ 完了
## 変更内容
| 種別 | ファイル | 概要 |
|------|---------|------|
| 作成 | `src/file.ts` | 概要説明 |
## レビュー結果
| レビュー | 結果 |
|---------|------|
| AI Review | ✅ APPROVE |
| Supervisor | ✅ APPROVE |
## 確認コマンド
```bash
npm test
npm run build
```
```
instruction: supervise
rules:
- condition: "すべて問題なし"
- condition: "要求未達成、テスト失敗、ビルドエラー"
@ -231,7 +124,10 @@ movements:
parallel:
- name: ai_fix_parallel
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -246,51 +142,14 @@ movements:
- condition: AI問題の修正完了
- condition: 修正不要(指摘対象ファイル/仕様の確認済み)
- condition: 判断できない、情報不足
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(例: `npm test`, `./gradlew test`
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「判断できない、情報不足」に対応するタグを出力する
- 修正不要の場合は「判断できない、情報不足」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
- name: supervise_fix_parallel
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -304,21 +163,7 @@ movements:
rules:
- condition: 監督者の指摘に対する修正が完了した
- condition: 修正を進行できない
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor
rules:
- condition: all("AI問題の修正完了", "監督者の指摘に対する修正が完了した")
@ -328,7 +173,10 @@ movements:
- name: ai_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -346,51 +194,14 @@ movements:
next: implement
- condition: 判断できない、情報不足
next: implement
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(例: `npm test`, `./gradlew test`
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「判断できない、情報不足」に対応するタグを出力する
- 修正不要の場合は「判断できない、情報不足」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
- name: supervise_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -406,18 +217,4 @@ movements:
next: reviewers
- condition: 修正を進行できない
next: implement
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor

View File

@ -11,12 +11,22 @@ description: Single-agent thin wrapper. Pass task directly to coder as-is.
max_iterations: 10
stances:
coding: ../stances/coding.md
testing: ../stances/testing.md
personas:
coder: ../personas/coder.md
initial_movement: execute
movements:
- name: execute
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
report:
- Summary: summary.md

View File

@ -11,12 +11,22 @@ description: Single-agent thin wrapper. Pass task directly to coder as-is.
max_iterations: 10
stances:
coding: ../stances/coding.md
testing: ../stances/testing.md
personas:
coder: ../personas/coder.md
initial_movement: execute
movements:
- name: execute
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
report:
- Summary: summary.md
allowed_tools:

View File

@ -20,9 +20,16 @@ description: 調査ピース - 質問せずに自律的に調査を実行
max_iterations: 10
personas:
research-planner: ../personas/research-planner.md
research-digger: ../personas/research-digger.md
research-supervisor: ../personas/research-supervisor.md
initial_movement: plan
movements:
- name: plan
agent: ../agents/research/planner.md
persona: research-planner
allowed_tools:
- Read
- Glob
@ -58,7 +65,7 @@ movements:
next: ABORT
- name: dig
agent: ../agents/research/digger.md
persona: research-digger
allowed_tools:
- Read
- Glob
@ -99,7 +106,7 @@ movements:
next: ABORT
- name: supervise
agent: ../agents/research/supervisor.md
persona: research-supervisor
allowed_tools:
- Read
- Glob
@ -127,5 +134,3 @@ movements:
next: COMPLETE
- condition: 調査結果が不十分であり、計画からやり直す必要がある
next: plan
initial_movement: plan

View File

@ -16,12 +16,35 @@ description: 既存コードのレビューと修正ピース(レビュー開
max_iterations: 20
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
supervisor: ../personas/supervisor.md
instructions:
implement: ../instructions/implement.md
review-ai: ../instructions/review-ai.md
ai-fix: ../instructions/ai-fix.md
supervise: ../instructions/supervise.md
fix-supervisor: ../instructions/fix-supervisor.md
report_formats:
ai-review: ../report-formats/ai-review.md
initial_movement: reviewers
movements:
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
report:
- Scope: 01-coder-scope.md
@ -36,48 +59,7 @@ movements:
- WebSearch
- WebFetch
permission_mode: edit
instruction_template: |
タスクを実装してください。
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
rules:
- condition: 実装が完了した
next: reviewers
@ -92,35 +74,11 @@ movements:
parallel:
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 03-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
@ -128,19 +86,15 @@ movements:
- WebSearch
- WebFetch
instruction_template: |
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: review-ai
rules:
- condition: "AI特有の問題なし"
- condition: "AI特有の問題あり"
- name: supervise
edit: false
agent: ../agents/default/supervisor.md
persona: supervisor
stance: review
report:
- Validation: 05-supervisor-validation.md
- Summary: summary.md
@ -152,68 +106,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
テスト実行、ビルド確認、最終承認を行ってください。
**ピース全体の確認:**
1. 実装結果が元の要求を満たしているか
2. AI Reviewの指摘が対応されているか
3. 元のタスク目的が達成されているか
**レポートの確認:** Report Directory内の全レポートを読み、
未対応の改善提案がないか確認してください。
**Validationレポートフォーマット:**
```markdown
# 最終検証結果
## 結果: APPROVE / REJECT
## 検証サマリー
| 項目 | 状態 | 確認方法 |
|------|------|---------|
| 要求充足 | ✅ | 要求リストと照合 |
| テスト | ✅ | `npm test` (N passed) |
| ビルド | ✅ | `npm run build` 成功 |
| 動作確認 | ✅ | 主要フロー確認 |
## 成果物
- 作成: {作成したファイル}
- 変更: {変更したファイル}
## 未完了項目REJECTの場合
| # | 項目 | 理由 |
|---|------|------|
| 1 | {項目} | {理由} |
```
**SummaryレポートフォーマットAPPROVEの場合のみ:**
```markdown
# タスク完了サマリー
## タスク
{元の要求を1-2文で}
## 結果
✅ 完了
## 変更内容
| 種別 | ファイル | 概要 |
|------|---------|------|
| 作成 | `src/file.ts` | 概要説明 |
## レビュー結果
| レビュー | 結果 |
|---------|------|
| AI Review | ✅ APPROVE |
| Supervisor | ✅ APPROVE |
## 確認コマンド
```bash
npm test
npm run build
```
```
instruction: supervise
rules:
- condition: "すべて問題なし"
- condition: "要求未達成、テスト失敗、ビルドエラー"
@ -232,7 +125,10 @@ movements:
parallel:
- name: ai_fix_parallel
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -248,51 +144,14 @@ movements:
- condition: AI問題の修正完了
- condition: 修正不要(指摘対象ファイル/仕様の確認済み)
- condition: 判断できない、情報不足
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(例: `npm test`, `./gradlew test`
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「判断できない、情報不足」に対応するタグを出力する
- 修正不要の場合は「判断できない、情報不足」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
- name: supervise_fix_parallel
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -307,21 +166,7 @@ movements:
rules:
- condition: 監督者の指摘に対する修正が完了した
- condition: 修正を進行できない
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor
rules:
- condition: all("AI問題の修正完了", "監督者の指摘に対する修正が完了した")
@ -331,7 +176,10 @@ movements:
- name: ai_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -350,51 +198,14 @@ movements:
next: implement
- condition: 判断できない、情報不足
next: implement
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(例: `npm test`, `./gradlew test`
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「判断できない、情報不足」に対応するタグを出力する
- 修正不要の場合は「判断できない、情報不足」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
- name: supervise_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
provider: codex
allowed_tools:
- Read
@ -411,18 +222,4 @@ movements:
next: reviewers
- condition: 修正を進行できない
next: implement
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor

View File

@ -16,12 +16,35 @@ description: 既存コードのレビューと修正ピース(レビュー開
max_iterations: 20
stances:
coding: ../stances/coding.md
review: ../stances/review.md
testing: ../stances/testing.md
personas:
coder: ../personas/coder.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
supervisor: ../personas/supervisor.md
instructions:
implement: ../instructions/implement.md
review-ai: ../instructions/review-ai.md
ai-fix: ../instructions/ai-fix.md
supervise: ../instructions/supervise.md
fix-supervisor: ../instructions/fix-supervisor.md
report_formats:
ai-review: ../report-formats/ai-review.md
initial_movement: reviewers
movements:
- name: implement
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
report:
- Scope: 01-coder-scope.md
- Decisions: 02-coder-decisions.md
@ -35,48 +58,7 @@ movements:
- WebSearch
- WebFetch
permission_mode: edit
instruction_template: |
タスクを実装してください。
Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
**Scopeレポートフォーマット実装開始時に作成:**
```markdown
# 変更スコープ宣言
## タスク
{タスクの1行要約}
## 変更予定
| 種別 | ファイル |
|------|---------|
| 作成 | `src/example.ts` |
| 変更 | `src/routes.ts` |
## 推定規模
Small / Medium / Large
## 影響範囲
- {影響するモジュールや機能}
```
**Decisionsレポートフォーマット実装完了時、決定がある場合のみ:**
```markdown
# 決定ログ
## 1. {決定内容}
- **背景**: {なぜ決定が必要だったか}
- **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由}
```
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
instruction: implement
rules:
- condition: 実装が完了した
next: reviewers
@ -91,35 +73,11 @@ movements:
parallel:
- name: ai_review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 03-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | ✅ | - |
| API/ライブラリの実在 | ✅ | - |
| コンテキスト適合 | ✅ | - |
| スコープ | ✅ | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
@ -127,19 +85,15 @@ movements:
- WebSearch
- WebFetch
instruction_template: |
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: review-ai
rules:
- condition: "AI特有の問題なし"
- condition: "AI特有の問題あり"
- name: supervise
edit: false
agent: ../agents/default/supervisor.md
persona: supervisor
stance: review
report:
- Validation: 05-supervisor-validation.md
- Summary: summary.md
@ -151,68 +105,7 @@ movements:
- Bash
- WebSearch
- WebFetch
instruction_template: |
テスト実行、ビルド確認、最終承認を行ってください。
**ピース全体の確認:**
1. 実装結果が元の要求を満たしているか
2. AI Reviewの指摘が対応されているか
3. 元のタスク目的が達成されているか
**レポートの確認:** Report Directory内の全レポートを読み、
未対応の改善提案がないか確認してください。
**Validationレポートフォーマット:**
```markdown
# 最終検証結果
## 結果: APPROVE / REJECT
## 検証サマリー
| 項目 | 状態 | 確認方法 |
|------|------|---------|
| 要求充足 | ✅ | 要求リストと照合 |
| テスト | ✅ | `npm test` (N passed) |
| ビルド | ✅ | `npm run build` 成功 |
| 動作確認 | ✅ | 主要フロー確認 |
## 成果物
- 作成: {作成したファイル}
- 変更: {変更したファイル}
## 未完了項目REJECTの場合
| # | 項目 | 理由 |
|---|------|------|
| 1 | {項目} | {理由} |
```
**SummaryレポートフォーマットAPPROVEの場合のみ:**
```markdown
# タスク完了サマリー
## タスク
{元の要求を1-2文で}
## 結果
✅ 完了
## 変更内容
| 種別 | ファイル | 概要 |
|------|---------|------|
| 作成 | `src/file.ts` | 概要説明 |
## レビュー結果
| レビュー | 結果 |
|---------|------|
| AI Review | ✅ APPROVE |
| Supervisor | ✅ APPROVE |
## 確認コマンド
```bash
npm test
npm run build
```
```
instruction: supervise
rules:
- condition: "すべて問題なし"
- condition: "要求未達成、テスト失敗、ビルドエラー"
@ -231,7 +124,10 @@ movements:
parallel:
- name: ai_fix_parallel
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -246,51 +142,14 @@ movements:
- condition: AI問題の修正完了
- condition: 修正不要(指摘対象ファイル/仕様の確認済み)
- condition: 判断できない、情報不足
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(例: `npm test`, `./gradlew test`
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「判断できない、情報不足」に対応するタグを出力する
- 修正不要の場合は「判断できない、情報不足」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
- name: supervise_fix_parallel
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -304,21 +163,7 @@ movements:
rules:
- condition: 監督者の指摘に対する修正が完了した
- condition: 修正を進行できない
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor
rules:
- condition: all("AI問題の修正完了", "監督者の指摘に対する修正が完了した")
@ -328,7 +173,10 @@ movements:
- name: ai_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -346,51 +194,14 @@ movements:
next: implement
- condition: 判断できない、情報不足
next: implement
instruction_template: |
**これは {movement_iteration} 回目の AI Review です。**
2回目以降は、前回の修正が実際には行われていなかったということです。
**あなたの「修正済み」という認識が間違っています。**
**まず認めること:**
- 「修正済み」と思っていたファイルは実際には修正されていない
- 前回の作業内容の認識が間違っている
- ゼロベースで考え直す必要がある
**必須アクション:**
1. 指摘された全ファイルを Read tool で開く(思い込みを捨てて事実確認)
2. 問題箇所を grep で検索して実在を確認する
3. 確認した問題を Edit tool で修正する
4. テストを実行して検証する(例: `npm test`, `./gradlew test`
5. 「何を確認して、何を修正したか」を具体的に報告する
**報告フォーマット:**
- ❌ 「既に修正されています」
- ✅ 「ファイルXのL123を確認した結果、問題Yが存在したため、Zに修正しました」
**絶対に禁止:**
- ファイルを開かずに「修正済み」と報告
- 思い込みで判断
- AI Reviewer が REJECT した問題の放置
**修正不要の扱い(必須)**
- AI Reviewの指摘ごとに「対象ファイルの確認結果」を示せない場合は修正不要と判断しない
- 指摘が「生成物」「仕様同期」に関係する場合は、生成元/仕様の確認ができなければ「判断できない、情報不足」に対応するタグを出力する
- 修正不要の場合は「判断できない、情報不足」に対応するタグを出力し、理由と確認範囲を明記する
**必須出力(見出しを含める)**
## 確認したファイル
- {ファイルパス:行番号}
## 実行した検索
- {コマンドと要約}
## 修正内容
- {変更内容}
## テスト結果
- {実行コマンドと結果}
instruction: ai-fix
- name: supervise_fix
edit: true
agent: ../agents/default/coder.md
persona: coder
stance:
- coding
- testing
allowed_tools:
- Read
- Glob
@ -406,18 +217,4 @@ movements:
next: reviewers
- condition: 修正を進行できない
next: implement
instruction_template: |
監督者からの指摘を修正してください。
監督者は全体を俯瞰した視点から問題を指摘しています。
優先度の高い項目から順に対応してください。
**必須出力(見出しを含める)**
## 作業結果
- {実施内容の要約}
## 変更内容
- {変更内容の要約}
## テスト結果
- {実行コマンドと結果}
## 証拠
- {確認したファイル/検索/差分/ログの要点を列挙}
instruction: fix-supervisor

View File

@ -24,12 +24,34 @@ description: レビュー専用ピース - コードをレビューするだけ
max_iterations: 10
stances:
review: ../stances/review.md
personas:
planner: ../personas/planner.md
architecture-reviewer: ../personas/architecture-reviewer.md
security-reviewer: ../personas/security-reviewer.md
ai-antipattern-reviewer: ../personas/ai-antipattern-reviewer.md
supervisor: ../personas/supervisor.md
pr-commenter: ../personas/pr-commenter.md
instructions:
review-arch: ../instructions/review-arch.md
review-security: ../instructions/review-security.md
review-ai: ../instructions/review-ai.md
report_formats:
architecture-review: ../report-formats/architecture-review.md
security-review: ../report-formats/security-review.md
ai-review: ../report-formats/ai-review.md
review-summary: ../report-formats/review-summary.md
initial_movement: plan
movements:
- name: plan
edit: false
agent: ../agents/default/planner.md
persona: planner
allowed_tools:
- Read
- Glob
@ -66,36 +88,11 @@ movements:
parallel:
- name: arch-review
edit: false
agent: ../agents/default/architecture-reviewer.md
persona: architecture-reviewer
stance: review
report:
name: 01-architect-review.md
format: |
```markdown
# アーキテクチャレビュー
## 結果: APPROVE / IMPROVE / REJECT
## サマリー
{1-2文で結果を要約}
## 確認した観点
- [x] 構造・設計
- [x] コード品質
- [x] 変更スコープ
## 問題点REJECTの場合
| # | 場所 | 問題 | 修正案 |
|---|------|------|--------|
| 1 | `src/file.ts:42` | 問題の説明 | 修正方法 |
## 改善提案(任意・ブロッキングではない)
- {将来的な改善提案}
```
**認知負荷軽減ルール:**
- APPROVE + 問題なし → サマリーのみ5行以内
- APPROVE + 軽微な提案 → サマリー + 改善提案15行以内
- REJECT → 問題点を表形式で30行以内
format: architecture-review
allowed_tools:
- Read
- Glob
@ -106,45 +103,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
**アーキテクチャと設計**のレビューに集中してください。AI特有の問題はレビューしないでくださいai_reviewムーブメントで行います
コードをレビューしてフィードバックを提供してください。
instruction: review-arch
- name: security-review
edit: false
agent: ../agents/default/security-reviewer.md
persona: security-reviewer
stance: review
report:
name: 02-security-review.md
format: |
```markdown
# セキュリティレビュー
## 結果: APPROVE / REJECT
## 重大度: None / Low / Medium / High / Critical
## チェック結果
| カテゴリ | 結果 | 備考 |
|---------|------|------|
| インジェクション | - | - |
| 認証・認可 | - | - |
| データ保護 | - | - |
| 依存関係 | - | - |
## 脆弱性REJECTの場合
| # | 重大度 | 種類 | 場所 | 修正案 |
|---|--------|------|------|--------|
| 1 | High | SQLi | `src/db.ts:42` | パラメータ化クエリを使用 |
## 警告(ブロッキングではない)
- {セキュリティに関する推奨事項}
```
**認知負荷軽減ルール:**
- 問題なし → チェック表のみ10行以内
- 警告あり → + 警告を1-2行15行以内
- 脆弱性あり → + 表形式で30行以内
format: security-review
allowed_tools:
- Read
- Glob
@ -155,44 +122,15 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
コードに対してセキュリティレビューを行ってください。以下の脆弱性を確認してください:
- インジェクション攻撃SQL, コマンド, XSS
- 認証・認可の問題
- データ露出リスク
- 暗号化の弱点
instruction: review-security
- name: ai-review
edit: false
agent: ../agents/default/ai-antipattern-reviewer.md
persona: ai-antipattern-reviewer
stance: review
report:
name: 03-ai-review.md
format: |
```markdown
# AI生成コードレビュー
## 結果: APPROVE / REJECT
## サマリー
{1文で結果を要約}
## 検証した項目
| 観点 | 結果 | 備考 |
|------|------|------|
| 仮定の妥当性 | - | - |
| API/ライブラリの実在 | - | - |
| コンテキスト適合 | - | - |
| スコープ | - | - |
## 問題点REJECTの場合
| # | カテゴリ | 場所 | 問題 |
|---|---------|------|------|
| 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド |
```
**認知負荷軽減ルール:**
- 問題なし → サマリー1文 + チェック表のみ10行以内
- 問題あり → + 問題を表形式で25行以内
format: ai-review
allowed_tools:
- Read
- Glob
@ -203,12 +141,7 @@ movements:
rules:
- condition: approved
- condition: needs_fix
instruction_template: |
AI特有の問題についてコードをレビューしてください:
- 仮定の検証
- もっともらしいが間違っているパターン
- 既存コードベースとの適合性
- スコープクリープの検出
instruction: review-ai
rules:
- condition: all("approved")
next: supervise
@ -217,7 +150,8 @@ movements:
- name: supervise
edit: false
agent: ../agents/default/supervisor.md
persona: supervisor
stance: review
report:
- Review Summary: 04-review-summary.md
allowed_tools:
@ -278,7 +212,7 @@ movements:
- name: pr-comment
edit: false
agent: ../agents/review/pr-commenter.md
persona: pr-commenter
allowed_tools:
- Read
- Glob

View File

@ -143,7 +143,7 @@ describe('default piece parallel reviewers movement', () => {
expect(archReview.agent).toContain('architecture-reviewer');
const qaReview = reviewersMovement.parallel!.find((s) => s.name === 'qa-review')!;
expect(qaReview.agent).toContain('default/qa-reviewer');
expect(qaReview.agent).toContain('qa-reviewer');
});
it('should have reports configured on sub-movements', () => {

View File

@ -0,0 +1,679 @@
/**
* Tests for stance and persona features.
*
* Covers:
* - persona/persona_name as aliases for agent/agent_name in piece YAML
* - Piece-level stances definition and resolution
* - Movement-level stance references
* - Stance injection in InstructionBuilder
* - File-based stance content loading via resolveContentPath
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { normalizePieceConfig } from '../infra/config/loaders/pieceParser.js';
import { InstructionBuilder } from '../core/piece/instruction/InstructionBuilder.js';
import type { InstructionContext } from '../core/piece/instruction/instruction-context.js';
// --- Test helpers ---
function createTestDir(): string {
return mkdtempSync(join(tmpdir(), 'takt-stance-'));
}
function makeContext(overrides: Partial<InstructionContext> = {}): InstructionContext {
return {
task: 'Test task',
iteration: 1,
maxIterations: 10,
movementIteration: 1,
cwd: '/tmp/test',
projectCwd: '/tmp/test',
userInputs: [],
language: 'ja',
...overrides,
};
}
// --- persona alias tests ---
describe('persona alias', () => {
let testDir: string;
beforeEach(() => {
testDir = createTestDir();
});
afterEach(() => {
rmSync(testDir, { recursive: true, force: true });
});
it('should treat persona as alias for agent', () => {
const raw = {
name: 'test-piece',
movements: [
{
name: 'step1',
persona: 'inline-prompt-text',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.agent).toBe('inline-prompt-text');
});
it('should prefer persona over agent when both specified', () => {
const raw = {
name: 'test-piece',
movements: [
{
name: 'step1',
agent: 'old-agent',
persona: 'new-persona',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.agent).toBe('new-persona');
});
it('should fall back to agent when persona not specified', () => {
const raw = {
name: 'test-piece',
movements: [
{
name: 'step1',
agent: 'regular-agent',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.agent).toBe('regular-agent');
});
it('should treat persona_name as alias for agent_name', () => {
const raw = {
name: 'test-piece',
movements: [
{
name: 'step1',
persona: 'some-prompt',
persona_name: 'My Persona',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.agentDisplayName).toBe('My Persona');
});
it('should prefer persona_name over agent_name', () => {
const raw = {
name: 'test-piece',
movements: [
{
name: 'step1',
agent: 'some-agent',
agent_name: 'Old Name',
persona_name: 'New Name',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.agentDisplayName).toBe('New Name');
});
it('should resolve persona .md file path like agent', () => {
const agentFile = join(testDir, 'my-persona.md');
writeFileSync(agentFile, '# Test Persona\nYou are a test persona.');
const raw = {
name: 'test-piece',
movements: [
{
name: 'step1',
persona: './my-persona.md',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.agent).toBe('./my-persona.md');
expect(config.movements[0]!.agentPath).toBe(agentFile);
});
it('should work with persona in parallel sub-movements', () => {
const raw = {
name: 'test-piece',
movements: [
{
name: 'parallel-step',
parallel: [
{
name: 'sub1',
persona: 'sub-persona-1',
instruction: '{task}',
},
{
name: 'sub2',
persona: 'sub-persona-2',
persona_name: 'Sub Persona 2',
instruction: '{task}',
},
],
rules: [{ condition: 'all("done")', next: 'COMPLETE' }],
},
],
};
const config = normalizePieceConfig(raw, testDir);
const parallel = config.movements[0]!.parallel!;
expect(parallel[0]!.agent).toBe('sub-persona-1');
expect(parallel[1]!.agent).toBe('sub-persona-2');
expect(parallel[1]!.agentDisplayName).toBe('Sub Persona 2');
});
});
// --- stance tests ---
describe('stances', () => {
let testDir: string;
beforeEach(() => {
testDir = createTestDir();
});
afterEach(() => {
rmSync(testDir, { recursive: true, force: true });
});
it('should resolve piece-level stances from inline content', () => {
const raw = {
name: 'test-piece',
stances: {
coding: 'Always write clean code.',
review: 'Be thorough in reviews.',
},
movements: [
{
name: 'step1',
agent: 'coder',
stance: 'coding',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.stances).toEqual({
coding: 'Always write clean code.',
review: 'Be thorough in reviews.',
});
expect(config.movements[0]!.stanceContents).toEqual(['Always write clean code.']);
});
it('should resolve stances from .md file paths', () => {
const stancesDir = join(testDir, 'stances');
mkdirSync(stancesDir, { recursive: true });
writeFileSync(join(stancesDir, 'coding.md'), '# Coding Stance\n\nWrite clean code.');
writeFileSync(join(stancesDir, 'review.md'), '# Review Stance\n\nBe thorough.');
const raw = {
name: 'test-piece',
stances: {
coding: './stances/coding.md',
review: './stances/review.md',
},
movements: [
{
name: 'step1',
agent: 'coder',
stance: 'coding',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.stances!['coding']).toBe('# Coding Stance\n\nWrite clean code.');
expect(config.stances!['review']).toBe('# Review Stance\n\nBe thorough.');
expect(config.movements[0]!.stanceContents).toEqual(['# Coding Stance\n\nWrite clean code.']);
});
it('should support multiple stance references (array)', () => {
const raw = {
name: 'test-piece',
stances: {
coding: 'Clean code rules.',
testing: 'Test everything.',
},
movements: [
{
name: 'step1',
agent: 'coder',
stance: ['coding', 'testing'],
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.stanceContents).toEqual([
'Clean code rules.',
'Test everything.',
]);
});
it('should leave stanceContents undefined when no stance specified', () => {
const raw = {
name: 'test-piece',
stances: {
coding: 'Clean code rules.',
},
movements: [
{
name: 'step1',
agent: 'coder',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.stanceContents).toBeUndefined();
});
it('should leave stanceContents undefined for unknown stance names', () => {
const raw = {
name: 'test-piece',
stances: {
coding: 'Clean code rules.',
},
movements: [
{
name: 'step1',
agent: 'coder',
stance: 'nonexistent',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.stanceContents).toBeUndefined();
});
it('should resolve stances in parallel sub-movements', () => {
const raw = {
name: 'test-piece',
stances: {
review: 'Be thorough.',
coding: 'Write clean code.',
},
movements: [
{
name: 'reviewers',
parallel: [
{
name: 'arch-review',
agent: 'reviewer',
stance: 'review',
instruction: '{task}',
},
{
name: 'code-fix',
agent: 'coder',
stance: ['coding', 'review'],
instruction: '{task}',
},
],
rules: [{ condition: 'all("done")', next: 'COMPLETE' }],
},
],
};
const config = normalizePieceConfig(raw, testDir);
const parallel = config.movements[0]!.parallel!;
expect(parallel[0]!.stanceContents).toEqual(['Be thorough.']);
expect(parallel[1]!.stanceContents).toEqual(['Write clean code.', 'Be thorough.']);
});
it('should leave config.stances undefined when no stances defined', () => {
const raw = {
name: 'test-piece',
movements: [
{
name: 'step1',
agent: 'coder',
instruction: '{task}',
},
],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.stances).toBeUndefined();
});
});
// --- stance injection in InstructionBuilder ---
describe('InstructionBuilder stance injection', () => {
it('should inject stance content into instruction (JA)', () => {
const step = {
name: 'test-step',
agentDisplayName: 'coder',
instructionTemplate: 'Do the thing.',
passPreviousResponse: false,
stanceContents: ['# Coding Stance\n\nWrite clean code.'],
};
const ctx = makeContext({ language: 'ja' });
const builder = new InstructionBuilder(step, ctx);
const result = builder.build();
expect(result).toContain('## Stance');
expect(result).toContain('# Coding Stance');
expect(result).toContain('Write clean code.');
expect(result).toContain('Stance Reminder');
});
it('should inject stance content into instruction (EN)', () => {
const step = {
name: 'test-step',
agentDisplayName: 'coder',
instructionTemplate: 'Do the thing.',
passPreviousResponse: false,
stanceContents: ['# Coding Stance\n\nWrite clean code.'],
};
const ctx = makeContext({ language: 'en' });
const builder = new InstructionBuilder(step, ctx);
const result = builder.build();
expect(result).toContain('## Stance');
expect(result).toContain('Write clean code.');
expect(result).toContain('Stance Reminder');
});
it('should not inject stance section when no stanceContents', () => {
const step = {
name: 'test-step',
agentDisplayName: 'coder',
instructionTemplate: 'Do the thing.',
passPreviousResponse: false,
};
const ctx = makeContext({ language: 'ja' });
const builder = new InstructionBuilder(step, ctx);
const result = builder.build();
expect(result).not.toContain('## Stance');
expect(result).not.toContain('Stance Reminder');
});
it('should join multiple stances with separator', () => {
const step = {
name: 'test-step',
agentDisplayName: 'coder',
instructionTemplate: 'Do the thing.',
passPreviousResponse: false,
stanceContents: ['Stance A content.', 'Stance B content.'],
};
const ctx = makeContext({ language: 'en' });
const builder = new InstructionBuilder(step, ctx);
const result = builder.build();
expect(result).toContain('Stance A content.');
expect(result).toContain('Stance B content.');
expect(result).toContain('---');
});
it('should prefer context stanceContents over step stanceContents', () => {
const step = {
name: 'test-step',
agentDisplayName: 'coder',
instructionTemplate: 'Do the thing.',
passPreviousResponse: false,
stanceContents: ['Step stance.'],
};
const ctx = makeContext({
language: 'en',
stanceContents: ['Context stance.'],
});
const builder = new InstructionBuilder(step, ctx);
const result = builder.build();
expect(result).toContain('Context stance.');
expect(result).not.toContain('Step stance.');
});
});
// --- section reference tests ---
describe('section reference resolution', () => {
let testDir: string;
beforeEach(() => {
testDir = createTestDir();
// Create resource files
mkdirSync(join(testDir, 'personas'), { recursive: true });
mkdirSync(join(testDir, 'stances'), { recursive: true });
mkdirSync(join(testDir, 'instructions'), { recursive: true });
mkdirSync(join(testDir, 'report-formats'), { recursive: true });
writeFileSync(join(testDir, 'personas', 'coder.md'), '# Coder\nYou are a coder.');
writeFileSync(join(testDir, 'stances', 'coding.md'), '# Coding Stance\nWrite clean code.');
writeFileSync(join(testDir, 'stances', 'testing.md'), '# Testing Stance\nTest everything.');
writeFileSync(join(testDir, 'instructions', 'implement.md'), 'Implement the feature.');
writeFileSync(join(testDir, 'report-formats', 'plan.md'), '# Plan Report\n## Goal\n{goal}');
});
afterEach(() => {
rmSync(testDir, { recursive: true, force: true });
});
it('should resolve persona from personas section by name', () => {
const raw = {
name: 'test-piece',
personas: { coder: './personas/coder.md' },
movements: [{
name: 'impl',
persona: 'coder',
instruction: '{task}',
}],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.agent).toBe('./personas/coder.md');
expect(config.movements[0]!.agentPath).toBe(join(testDir, 'personas', 'coder.md'));
});
it('should resolve stance from stances section by name', () => {
const raw = {
name: 'test-piece',
stances: { coding: './stances/coding.md' },
movements: [{
name: 'impl',
agent: 'coder',
stance: 'coding',
instruction: '{task}',
}],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.stanceContents).toEqual(['# Coding Stance\nWrite clean code.']);
});
it('should resolve mixed stance array: [section-name, ./path]', () => {
const raw = {
name: 'test-piece',
stances: { coding: './stances/coding.md' },
movements: [{
name: 'impl',
agent: 'coder',
stance: ['coding', './stances/testing.md'],
instruction: '{task}',
}],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.stanceContents).toEqual([
'# Coding Stance\nWrite clean code.',
'# Testing Stance\nTest everything.',
]);
});
it('should resolve instruction from instructions section by name', () => {
const raw = {
name: 'test-piece',
instructions: { implement: './instructions/implement.md' },
movements: [{
name: 'impl',
agent: 'coder',
instruction: 'implement',
}],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.instructionTemplate).toBe('Implement the feature.');
});
it('should resolve report format from report_formats section by name', () => {
const raw = {
name: 'test-piece',
report_formats: { plan: './report-formats/plan.md' },
movements: [{
name: 'plan',
agent: 'planner',
instruction: '{task}',
report: {
name: '00-plan.md',
format: 'plan',
},
}],
};
const config = normalizePieceConfig(raw, testDir);
const report = config.movements[0]!.report as { name: string; format?: string };
expect(report.format).toBe('# Plan Report\n## Goal\n{goal}');
});
it('should treat unresolved name as inline value (no section match)', () => {
const raw = {
name: 'test-piece',
movements: [{
name: 'impl',
persona: 'nonexistent',
instruction: '{task}',
}],
};
const config = normalizePieceConfig(raw, testDir);
// No matching section key → treated as inline agent spec
expect(config.movements[0]!.agent).toBe('nonexistent');
});
it('should prefer instruction_template over instruction section reference', () => {
const raw = {
name: 'test-piece',
instructions: { implement: './instructions/implement.md' },
movements: [{
name: 'impl',
agent: 'coder',
instruction: 'implement',
instruction_template: 'Inline template takes priority.',
}],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.instructionTemplate).toBe('Inline template takes priority.');
});
it('should store resolved sections on PieceConfig', () => {
const raw = {
name: 'test-piece',
personas: { coder: './personas/coder.md' },
stances: { coding: './stances/coding.md' },
instructions: { implement: './instructions/implement.md' },
report_formats: { plan: './report-formats/plan.md' },
movements: [{
name: 'impl',
agent: 'coder',
instruction: '{task}',
}],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.personas).toEqual({ coder: './personas/coder.md' });
expect(config.stances).toEqual({ coding: '# Coding Stance\nWrite clean code.' });
expect(config.instructions).toEqual({ implement: 'Implement the feature.' });
expect(config.reportFormats).toEqual({ plan: '# Plan Report\n## Goal\n{goal}' });
});
it('should work with section references in parallel sub-movements', () => {
const raw = {
name: 'test-piece',
personas: { coder: './personas/coder.md' },
stances: { coding: './stances/coding.md', testing: './stances/testing.md' },
instructions: { implement: './instructions/implement.md' },
movements: [{
name: 'parallel-step',
parallel: [
{
name: 'sub1',
persona: 'coder',
stance: 'coding',
instruction: 'implement',
},
{
name: 'sub2',
persona: 'coder',
stance: ['coding', 'testing'],
instruction: '{task}',
},
],
rules: [{ condition: 'all("done")', next: 'COMPLETE' }],
}],
};
const config = normalizePieceConfig(raw, testDir);
const parallel = config.movements[0]!.parallel!;
expect(parallel[0]!.agent).toBe('./personas/coder.md');
expect(parallel[0]!.stanceContents).toEqual(['# Coding Stance\nWrite clean code.']);
expect(parallel[0]!.instructionTemplate).toBe('Implement the feature.');
expect(parallel[1]!.stanceContents).toEqual([
'# Coding Stance\nWrite clean code.',
'# Testing Stance\nTest everything.',
]);
});
it('should resolve stance by plain name (primary mechanism)', () => {
const raw = {
name: 'test-piece',
stances: { coding: './stances/coding.md' },
movements: [{
name: 'impl',
agent: 'coder',
stance: 'coding',
instruction: '{task}',
}],
};
const config = normalizePieceConfig(raw, testDir);
expect(config.movements[0]!.stanceContents).toEqual(['# Coding Stance\nWrite clean code.']);
});
});

View File

@ -81,6 +81,8 @@ export interface PieceMovement {
passPreviousResponse: boolean;
/** Sub-movements to execute in parallel. When set, this movement runs all sub-movements concurrently. */
parallel?: PieceMovement[];
/** Resolved stance content strings (from piece-level stances map, resolved at parse time) */
stanceContents?: string[];
}
/** Loop detection configuration */
@ -125,6 +127,14 @@ export interface LoopMonitorConfig {
export interface PieceConfig {
name: string;
description?: string;
/** Persona definitions — map of name to file path or inline content (raw, not content-resolved) */
personas?: Record<string, string>;
/** Resolved stance definitions — map of name to file content (resolved at parse time) */
stances?: Record<string, string>;
/** Resolved instruction definitions — map of name to file content (resolved at parse time) */
instructions?: Record<string, string>;
/** Resolved report format definitions — map of name to file content (resolved at parse time) */
reportFormats?: Record<string, string>;
movements: PieceMovement[];
initialMovement: string;
maxIterations: number;

View File

@ -118,6 +118,12 @@ export const ParallelSubMovementRawSchema = z.object({
name: z.string().min(1),
agent: z.string().optional(),
agent_name: z.string().optional(),
/** Alias for agent (persona-first naming) */
persona: z.string().optional(),
/** Alias for agent_name (persona-first naming) */
persona_name: z.string().optional(),
/** Stance reference(s) — key name(s) from piece-level stances map */
stance: z.union([z.string(), z.array(z.string())]).optional(),
allowed_tools: z.array(z.string()).optional(),
provider: z.enum(['claude', 'codex', 'mock']).optional(),
model: z.string().optional(),
@ -140,6 +146,12 @@ export const PieceMovementRawSchema = z.object({
session: z.enum(['continue', 'refresh']).optional(),
/** Display name for the agent (shown in output). Falls back to agent basename if not specified */
agent_name: z.string().optional(),
/** Alias for agent (persona-first naming) */
persona: z.string().optional(),
/** Alias for agent_name (persona-first naming) */
persona_name: z.string().optional(),
/** Stance reference(s) — key name(s) from piece-level stances map */
stance: z.union([z.string(), z.array(z.string())]).optional(),
allowed_tools: z.array(z.string()).optional(),
provider: z.enum(['claude', 'codex', 'mock']).optional(),
model: z.string().optional(),
@ -190,6 +202,14 @@ export const LoopMonitorSchema = z.object({
export const PieceConfigRawSchema = z.object({
name: z.string().min(1),
description: z.string().optional(),
/** Piece-level persona definitions — map of name to .md file path or inline content */
personas: z.record(z.string(), z.string()).optional(),
/** Piece-level stance definitions — map of name to .md file path or inline content */
stances: z.record(z.string(), z.string()).optional(),
/** Piece-level instruction definitions — map of name to .md file path or inline content */
instructions: z.record(z.string(), z.string()).optional(),
/** Piece-level report format definitions — map of name to .md file path or inline content */
report_formats: z.record(z.string(), z.string()).optional(),
movements: z.array(PieceMovementRawSchema).min(1),
initial_movement: z.string().optional(),
max_iterations: z.number().int().positive().optional().default(10),

View File

@ -77,6 +77,7 @@ export class MovementExecutor {
pieceName: this.deps.getPieceName(),
pieceDescription: this.deps.getPieceDescription(),
retryNote: this.deps.getRetryNote(),
stanceContents: step.stanceContents,
}).build();
}

View File

@ -98,6 +98,12 @@ export class InstructionBuilder {
const hasRetryNote = !!this.context.retryNote;
const retryNote = hasRetryNote ? escapeTemplateChars(this.context.retryNote!) : '';
// Stance injection (top + bottom reminder per "Lost in the Middle" research)
const stanceContents = this.context.stanceContents ?? this.step.stanceContents;
const hasStance = !!(stanceContents && stanceContents.length > 0);
const stanceContent = hasStance ? stanceContents!.join('\n\n---\n\n') : '';
const stanceReminder = ''; // Reminder text is in the template itself
return loadTemplate('perform_phase1_message', language, {
workingDirectory: this.context.cwd,
editRule,
@ -119,6 +125,9 @@ export class InstructionBuilder {
userInputs,
hasRetryNote,
retryNote,
hasStance,
stanceContent,
stanceReminder,
instructions,
});
}

View File

@ -42,6 +42,8 @@ export interface InstructionContext {
pieceDescription?: string;
/** Retry note explaining why task is being retried */
retryNote?: string;
/** Resolved stance content strings for injection into instruction */
stanceContents?: string[];
}
/**

View File

@ -16,9 +16,9 @@ import {
getProjectPiecesDir,
getProjectAgentsDir,
getBuiltinPiecesDir,
getBuiltinAgentsDir,
getLanguage,
} from '../../infra/config/index.js';
import { getLanguageResourcesDir } from '../../infra/resources/index.js';
import { header, success, info, warn, error, blankLine } from '../../shared/ui/index.js';
export interface EjectOptions {
@ -52,8 +52,8 @@ export async function ejectBuiltin(name?: string, options: EjectOptions = {}): P
const projectDir = options.projectDir || process.cwd();
const targetPiecesDir = options.global ? getGlobalPiecesDir() : getProjectPiecesDir(projectDir);
const targetAgentsDir = options.global ? getGlobalAgentsDir() : getProjectAgentsDir(projectDir);
const builtinAgentsDir = getBuiltinAgentsDir(lang);
const targetBaseDir = options.global ? dirname(getGlobalAgentsDir()) : dirname(getProjectAgentsDir(projectDir));
const builtinBaseDir = getLanguageResourcesDir(lang);
const targetLabel = options.global ? 'global (~/.takt/)' : 'project (.takt/)';
info(`Ejecting to ${targetLabel}`);
@ -71,29 +71,29 @@ export async function ejectBuiltin(name?: string, options: EjectOptions = {}): P
success(`Ejected piece: ${pieceDest}`);
}
// Copy related agent files
const agentPaths = extractAgentRelativePaths(builtinPath);
let copiedAgents = 0;
// Copy related resource files (agents, personas, stances, instructions, report-formats)
const resourceRefs = extractResourceRelativePaths(builtinPath);
let copiedCount = 0;
for (const relPath of agentPaths) {
const srcPath = join(builtinAgentsDir, relPath);
const destPath = join(targetAgentsDir, relPath);
for (const ref of resourceRefs) {
const srcPath = join(builtinBaseDir, ref.type, ref.path);
const destPath = join(targetBaseDir, ref.type, ref.path);
if (!existsSync(srcPath)) continue;
if (existsSync(destPath)) {
info(` Agent already exists: ${destPath}`);
info(` Already exists: ${destPath}`);
continue;
}
mkdirSync(dirname(destPath), { recursive: true });
writeFileSync(destPath, readFileSync(srcPath));
info(` ${destPath}`);
copiedAgents++;
info(` ${destPath}`);
copiedCount++;
}
if (copiedAgents > 0) {
success(`${copiedAgents} agent file(s) ejected.`);
if (copiedCount > 0) {
success(`${copiedCount} resource file(s) ejected.`);
}
}
@ -123,21 +123,43 @@ function listAvailableBuiltins(builtinPiecesDir: string, isGlobal?: boolean): vo
}
}
/** Resource reference extracted from piece YAML */
interface ResourceRef {
/** Resource type directory (agents, personas, stances, instructions, report-formats) */
type: string;
/** Relative path within the resource type directory */
path: string;
}
/** Known resource type directories that can be referenced from piece YAML */
const RESOURCE_TYPES = ['agents', 'personas', 'stances', 'instructions', 'report-formats'];
/**
* Extract agent relative paths from a builtin piece YAML.
* Matches `agent: ../agents/{path}` and returns the {path} portions.
* Extract resource relative paths from a builtin piece YAML.
* Matches `../{type}/{path}` patterns for all known resource types.
*/
function extractAgentRelativePaths(piecePath: string): string[] {
function extractResourceRelativePaths(piecePath: string): ResourceRef[] {
const content = readFileSync(piecePath, 'utf-8');
const paths = new Set<string>();
const regex = /agent:\s*\.\.\/agents\/(.+)/g;
const seen = new Set<string>();
const refs: ResourceRef[] = [];
const typePattern = RESOURCE_TYPES.join('|');
const regex = new RegExp(`\\.\\.\\/(?:${typePattern})\\/(.+)`, 'g');
let match: RegExpExecArray | null;
while ((match = regex.exec(content)) !== null) {
if (match[1]) {
paths.add(match[1].trim());
// Re-parse to extract type and path separately
const fullMatch = match[0];
const typeMatch = fullMatch.match(/\.\.\/([^/]+)\/(.+)/);
if (typeMatch?.[1] && typeMatch[2]) {
const type = typeMatch[1];
const path = typeMatch[2].trim();
const key = `${type}/${path}`;
if (!seen.has(key)) {
seen.add(key);
refs.push({ type, path });
}
}
}
return Array.from(paths);
return refs;
}

View File

@ -66,6 +66,29 @@ function resolveContentPath(value: string | undefined, pieceDir: string): string
return value;
}
/**
* Resolve a value from a section map by key lookup.
* If the value matches a key in sectionMap, return the mapped value.
* Otherwise return the value as-is (treated as file path or inline content).
*/
function resolveSectionReference(
value: string,
sectionMap: Record<string, string> | undefined,
): string {
const resolved = sectionMap?.[value];
return resolved ?? value;
}
/** Section maps parsed from piece YAML for section reference expansion */
interface PieceSections {
personas?: Record<string, string>;
stances?: Record<string, string>;
/** Stances resolved to file content (for backward-compat plain name lookup) */
resolvedStances?: Record<string, string>;
instructions?: Record<string, string>;
reportFormats?: Record<string, string>;
}
/** Check if a raw report value is the object form (has 'name' property). */
function isReportObject(raw: unknown): raw is { name: string; order?: string; format?: string } {
return typeof raw === 'object' && raw !== null && !Array.isArray(raw) && 'name' in raw;
@ -73,18 +96,22 @@ function isReportObject(raw: unknown): raw is { name: string; order?: string; fo
/**
* Normalize the raw report field from YAML into internal format.
* Supports section references for format/order fields via rawReportFormats section.
*/
function normalizeReport(
raw: string | Record<string, string>[] | { name: string; order?: string; format?: string } | undefined,
pieceDir: string,
rawReportFormats?: Record<string, string>,
): string | ReportConfig[] | ReportObjectConfig | undefined {
if (raw == null) return undefined;
if (typeof raw === 'string') return raw;
if (isReportObject(raw)) {
const expandedFormat = raw.format ? resolveSectionReference(raw.format, rawReportFormats) : undefined;
const expandedOrder = raw.order ? resolveSectionReference(raw.order, rawReportFormats) : undefined;
return {
name: raw.name,
order: resolveContentPath(raw.order, pieceDir),
format: resolveContentPath(raw.format, pieceDir),
order: resolveContentPath(expandedOrder, pieceDir),
format: resolveContentPath(expandedFormat, pieceDir),
};
}
return (raw as Record<string, string>[]).flatMap((entry) =>
@ -170,10 +197,46 @@ function normalizeRule(r: {
};
}
/**
* Resolve stance references for a movement.
*
* Resolution priority:
* 1. Section key look up in resolvedStances (pre-resolved content)
* 2. File path (`./path`, `../path`, `*.md`) resolve file directly
* 3. Unknown names are silently ignored
*/
function resolveStanceContents(
stanceRef: string | string[] | undefined,
sections: PieceSections,
pieceDir: string,
): string[] | undefined {
if (stanceRef == null) return undefined;
const refs = Array.isArray(stanceRef) ? stanceRef : [stanceRef];
const contents: string[] = [];
for (const ref of refs) {
const sectionContent = sections.resolvedStances?.[ref];
if (sectionContent) {
contents.push(sectionContent);
} else if (ref.endsWith('.md') || ref.startsWith('./') || ref.startsWith('../')) {
const content = resolveContentPath(ref, pieceDir);
if (content) contents.push(content);
}
}
return contents.length > 0 ? contents : undefined;
}
/** Normalize a raw step into internal PieceMovement format. */
function normalizeStepFromRaw(step: RawStep, pieceDir: string): PieceMovement {
function normalizeStepFromRaw(
step: RawStep,
pieceDir: string,
sections: PieceSections,
): PieceMovement {
const rules: PieceRule[] | undefined = step.rules?.map(normalizeRule);
const agentSpec: string | undefined = step.agent || undefined;
// persona is an alias for agent (persona takes priority), with section reference expansion
const rawPersona = (step as Record<string, unknown>).persona as string | undefined;
const expandedPersona = rawPersona ? resolveSectionReference(rawPersona, sections.personas) : undefined;
const agentSpec: string | undefined = expandedPersona || step.agent || undefined;
// Resolve agent path: if the resolved path exists on disk, use it; otherwise leave agentPath undefined
// so that the runner treats agentSpec as an inline system prompt string.
@ -185,26 +248,41 @@ function normalizeStepFromRaw(step: RawStep, pieceDir: string): PieceMovement {
}
}
// persona_name is an alias for agent_name (persona_name takes priority)
const displayName: string | undefined = (step as Record<string, unknown>).persona_name as string
|| step.agent_name
|| undefined;
// Resolve stance references (supports section key, file paths)
const stanceRef = (step as Record<string, unknown>).stance as string | string[] | undefined;
const stanceContents = resolveStanceContents(stanceRef, sections, pieceDir);
// Resolve instruction: instruction_template > instruction (with section reference expansion) > default
const expandedInstruction = step.instruction
? resolveContentPath(resolveSectionReference(step.instruction, sections.instructions), pieceDir)
: undefined;
const result: PieceMovement = {
name: step.name,
description: step.description,
agent: agentSpec,
session: step.session,
agentDisplayName: step.agent_name || (agentSpec ? extractAgentDisplayName(agentSpec) : step.name),
agentDisplayName: displayName || (agentSpec ? extractAgentDisplayName(agentSpec) : step.name),
agentPath,
allowedTools: step.allowed_tools,
provider: step.provider,
model: step.model,
permissionMode: step.permission_mode,
edit: step.edit,
instructionTemplate: resolveContentPath(step.instruction_template, pieceDir) || step.instruction || '{task}',
instructionTemplate: resolveContentPath(step.instruction_template, pieceDir) || expandedInstruction || '{task}',
rules,
report: normalizeReport(step.report, pieceDir),
report: normalizeReport(step.report, pieceDir, sections.reportFormats),
passPreviousResponse: step.pass_previous_response ?? true,
stanceContents,
};
if (step.parallel && step.parallel.length > 0) {
result.parallel = step.parallel.map((sub: RawStep) => normalizeStepFromRaw(sub, pieceDir));
result.parallel = step.parallel.map((sub: RawStep) => normalizeStepFromRaw(sub, pieceDir, sections));
}
return result;
@ -251,6 +329,26 @@ function normalizeLoopMonitors(
}));
}
/**
* Resolve a piece-level section map.
* Each value is resolved via resolveContentPath (supports .md file references).
* Used for stances, instructions, and report_formats.
*/
function resolveSectionMap(
raw: Record<string, string> | undefined,
pieceDir: string,
): Record<string, string> | undefined {
if (!raw) return undefined;
const resolved: Record<string, string> = {};
for (const [name, value] of Object.entries(raw)) {
const content = resolveContentPath(value, pieceDir);
if (content) {
resolved[name] = content;
}
}
return Object.keys(resolved).length > 0 ? resolved : undefined;
}
/**
* Convert raw YAML piece config to internal format.
* Agent paths are resolved relative to the piece directory.
@ -258,8 +356,22 @@ function normalizeLoopMonitors(
export function normalizePieceConfig(raw: unknown, pieceDir: string): PieceConfig {
const parsed = PieceConfigRawSchema.parse(raw);
// Resolve piece-level section maps
const resolvedStances = resolveSectionMap(parsed.stances, pieceDir);
const resolvedInstructions = resolveSectionMap(parsed.instructions, pieceDir);
const resolvedReportFormats = resolveSectionMap(parsed.report_formats, pieceDir);
// Build sections for section reference expansion in movements
const sections: PieceSections = {
personas: parsed.personas,
stances: parsed.stances,
resolvedStances,
instructions: parsed.instructions,
reportFormats: parsed.report_formats,
};
const movements: PieceMovement[] = parsed.movements.map((step) =>
normalizeStepFromRaw(step, pieceDir),
normalizeStepFromRaw(step, pieceDir, sections),
);
const initialMovement = parsed.initial_movement ?? movements[0]?.name ?? '';
@ -267,6 +379,10 @@ export function normalizePieceConfig(raw: unknown, pieceDir: string): PieceConfi
return {
name: parsed.name,
description: parsed.description,
personas: parsed.personas,
stances: resolvedStances,
instructions: resolvedInstructions,
reportFormats: resolvedReportFormats,
movements,
initialMovement,
maxIterations: parsed.max_iterations,

View File

@ -4,7 +4,8 @@
vars: workingDirectory, editRule, pieceName, pieceDescription, hasPieceDescription,
pieceStructure, iteration, movementIteration, movement, hasReport, reportInfo,
phaseNote, hasTaskSection, userRequest, hasPreviousResponse, previousResponse,
hasUserInputs, userInputs, hasRetryNote, retryNote, instructions
hasUserInputs, userInputs, hasRetryNote, retryNote, hasStance, stanceContent,
stanceReminder, instructions
builder: InstructionBuilder
-->
## Execution Context
@ -16,6 +17,13 @@
{{#if editRule}}- {{editRule}}
{{/if}}
Note: This section is metadata. Follow the language used in the rest of the prompt.
{{#if hasStance}}
## Stance
The following stances are behavioral standards applied to this movement. You MUST comply with them.
{{stanceContent}}
{{/if}}
## Piece Context
{{#if pieceName}}- Piece: {{pieceName}}
@ -52,3 +60,8 @@ Note: This section is metadata. Follow the language used in the rest of the prom
## Instructions
{{instructions}}
{{#if hasStance}}
---
**Stance Reminder:** Comply with the stance standards defined in the Stance section above.{{stanceReminder}}
{{/if}}

View File

@ -4,7 +4,8 @@
vars: workingDirectory, editRule, pieceName, pieceDescription, hasPieceDescription,
pieceStructure, iteration, movementIteration, movement, hasReport, reportInfo,
phaseNote, hasTaskSection, userRequest, hasPreviousResponse, previousResponse,
hasUserInputs, userInputs, hasRetryNote, retryNote, instructions
hasUserInputs, userInputs, hasRetryNote, retryNote, hasStance, stanceContent,
stanceReminder, instructions
builder: InstructionBuilder
-->
## 実行コンテキスト
@ -15,6 +16,13 @@
- **Bashコマンドで `cd` を使用しないでください。** 作業ディレクトリは既に正しく設定されています。ディレクトリを変更せずにコマンドを実行してください。
{{#if editRule}}- {{editRule}}
{{/if}}
{{#if hasStance}}
## Stance
以下のスタンスはこのムーブメントに適用される行動規範です。必ず遵守してください。
{{stanceContent}}
{{/if}}
## Piece Context
{{#if pieceName}}- ピース: {{pieceName}}
@ -51,3 +59,8 @@
## Instructions
{{instructions}}
{{#if hasStance}}
---
**Stance Reminder:** 上記の Stance セクションで定義されたスタンス規範を遵守してください。{{stanceReminder}}
{{/if}}