diff --git a/resources/global/en/workflows/simple.yaml b/resources/global/en/workflows/simple.yaml new file mode 100644 index 0000000..d368421 --- /dev/null +++ b/resources/global/en/workflows/simple.yaml @@ -0,0 +1,594 @@ +# Simple TAKT Workflow +# Plan -> Coder -> Architect Review -> AI Review -> Supervisor Approval +# (Simplified version of default - removed improve, fix, ai_fix, security_review, security_fix) +# +# Template Variables: +# {iteration} - Workflow-wide turn count (total steps executed across all agents) +# {max_iterations} - Maximum iterations allowed for the workflow +# {step_iteration} - Per-step iteration count (how many times THIS step has been executed) +# {task} - Original user request +# {previous_response} - Output from the previous step +# {git_diff} - Current uncommitted changes (git diff) +# {user_inputs} - Accumulated user inputs during workflow +# {report_dir} - Report directory name (e.g., "20250126-143052-task-summary") + +name: simple +description: Simplified development workflow (plan -> implement -> review -> ai_review -> supervise) + +max_iterations: 20 + +initial_step: plan + +steps: + - name: plan + agent: ~/.takt/agents/default/planner.md + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + status_rules_prompt: | + # ⚠️ REQUIRED: Status Output Rules ⚠️ + + **Without this tag, the workflow will stop.** + Your final output MUST include a status tag following the rules below. + + ## Judgment Criteria + + | Situation | Judgment | + |-----------|----------| + | Requirements clear and implementable | DONE | + | Requirements unclear, insufficient info | BLOCKED | + + ## Output Format + + | Situation | Tag | + |-----------|-----| + | Analysis complete | `[PLANNER:DONE]` | + | Insufficient info | `[PLANNER:BLOCKED]` | + + ### Output Examples + + **DONE case:** + ``` + [PLANNER:DONE] + ``` + + **BLOCKED case:** + ``` + [PLANNER:BLOCKED] + + Clarifications needed: + - {Question 1} + - {Question 2} + ``` + instruction_template: | + ## Workflow Context + - Iteration: {iteration}/{max_iterations} (workflow-wide) + - Step Iteration: {step_iteration} (times this step has run) + - Step: plan (Task Analysis) + - Report Directory: .takt/reports/{report_dir}/ + - Report File: .takt/reports/{report_dir}/00-plan.md + + ## User Request + {task} + + ## Previous Response (when returned from implement) + {previous_response} + + ## Instructions + Analyze the task and create an implementation plan. + + **Note:** If returned from implement step (Previous Response exists), + review and revise the plan based on that feedback (replan). + + **Tasks:** + 1. Understand the requirements + 2. Identify impact scope + 3. Decide implementation approach + + **Report output:** Output to the `Report File` specified above. + - If file does not exist: Create new file + - If file exists: Append with `## Iteration {step_iteration}` section + + **Report format:** + ```markdown + # Task Plan + + ## Original Request + {User's request as-is} + + ## Analysis Results + + ### Objective + {What needs to be achieved} + + ### Scope + {Impact scope} + + ### Implementation Approach + {How to proceed} + + ## Clarifications Needed (if any) + - {Unclear points or items requiring confirmation} + ``` + pass_previous_response: true + transitions: + - condition: done + next_step: implement + - condition: blocked + next_step: ABORT + + - name: implement + agent: ~/.takt/agents/default/coder.md + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + status_rules_prompt: | + # ⚠️ REQUIRED: Status Output Rules ⚠️ + + **Without this tag, the workflow will stop.** + Your final output MUST include a status tag following the rules below. + + ## Output Format + + | Situation | Tag | + |-----------|-----| + | Implementation complete | `[CODER:DONE]` | + | Cannot decide/insufficient info | `[CODER:BLOCKED]` | + + **Important**: When in doubt, `[BLOCKED]`. Don't decide on your own. + + ### Output Examples + + **DONE case:** + ``` + Implementation complete. + - Created: `src/auth/service.ts`, `tests/auth.test.ts` + - Modified: `src/routes.ts` + + [CODER:DONE] + ``` + + **BLOCKED case:** + ``` + [CODER:BLOCKED] + + Reason: DB schema is undefined, cannot implement + Required info: users table structure + ``` + instruction_template: | + ## Workflow Context + - Iteration: {iteration}/{max_iterations} (workflow-wide) + - Step Iteration: {step_iteration} (times this step has run) + - Step: implement + - Report Directory: .takt/reports/{report_dir}/ + - Report Files: + - Scope: .takt/reports/{report_dir}/01-coder-scope.md + - Decisions: .takt/reports/{report_dir}/02-coder-decisions.md + + ## User Request + {task} + + ## Additional User Inputs + {user_inputs} + + ## Instructions + Follow the plan from the plan step and implement. + Refer to the plan report (00-plan.md) and proceed with implementation. + + **Report output:** Output to the `Report Files` specified above. + - If file does not exist: Create new file + - If file exists: Append with `## Iteration {step_iteration}` section + + **Scope report format (create at implementation start):** + ```markdown + # Change Scope Declaration + + ## Task + {One-line task summary} + + ## Planned Changes + | Type | File | + |------|------| + | Create | `src/example.ts` | + | Modify | `src/routes.ts` | + + ## Estimated Size + Small / Medium / Large + + ## Impact Scope + - {Affected modules or features} + ``` + + **Decisions report format (on completion, only if decisions were made):** + ```markdown + # Decision Log + + ## 1. {Decision Content} + - **Background**: {Why the decision was needed} + - **Options Considered**: {List of options} + - **Reason**: {Why this option was chosen} + ``` + transitions: + - condition: done + next_step: review + - condition: blocked + next_step: plan + + - name: review + agent: ~/.takt/agents/default/architect.md + allowed_tools: + - Read + - Glob + - Grep + - WebSearch + - WebFetch + status_rules_prompt: | + # ⚠️ REQUIRED: Status Output Rules ⚠️ + + **Without this tag, the workflow will stop.** + Your final output MUST include a status tag following the rules below. + + ## Judgment Criteria + + | Situation | Judgment | + |-----------|----------| + | Structural issues | REJECT | + | Design principle violations | REJECT | + | Security issues | REJECT | + | Insufficient tests | REJECT | + | No issues | APPROVE | + + **Note:** In simple workflow, IMPROVE is not used. + If there are minor suggestions, use APPROVE + comments. + + ## Output Format + + | Situation | Tag | + |-----------|-----| + | No issues | `[ARCHITECT:APPROVE]` | + | Structural changes required | `[ARCHITECT:REJECT]` | + + ### Output Examples + + **APPROVE case:** + ``` + [ARCHITECT:APPROVE] + + Positive points: + - Appropriate module organization + - Single responsibility maintained + ``` + + **REJECT case:** + ``` + [ARCHITECT:REJECT] + + Issues: + 1. File size exceeded + - Location: `src/services/user.ts` (523 lines) + - Fix: Split into 3 files + ``` + instruction_template: | + ## Workflow Context + - Iteration: {iteration}/{max_iterations} (workflow-wide) + - Step Iteration: {step_iteration} (times this step has run) + - Step: review (Architecture Review) + - Report Directory: .takt/reports/{report_dir}/ + - Report File: .takt/reports/{report_dir}/03-architect-review.md + + ## Original User Request (Initial request from workflow start) + {task} + + ## Git Diff + ```diff + {git_diff} + ``` + + ## Instructions + Focus on **architecture and design** review. Do NOT review AI-specific issues (that's the next step). + + Review the changes and provide feedback. + + **Note:** In simple workflow, IMPROVE judgment is not used. + If there are minor suggestions, use APPROVE + comments. + + **Report output:** Output to the `Report File` specified above. + - If file does not exist: Create new file + - If file exists: Append with `## Iteration {step_iteration}` section + + **Report format:** + ```markdown + # Architecture Review + + ## Result: APPROVE / REJECT + + ## Summary + {1-2 sentences summarizing result} + + ## Reviewed Perspectives + - [x] Structure & Design + - [x] Code Quality + - [x] Change Scope + + ## Issues (if REJECT) + | # | Location | Issue | Fix | + |---|----------|-------|-----| + | 1 | `src/file.ts:42` | Issue description | Fix method | + + ## Improvement Suggestions (optional, non-blocking) + - {Future improvement suggestions} + ``` + + **Cognitive load reduction rules:** + - APPROVE + no issues → Summary only (5 lines or less) + - APPROVE + minor suggestions → Summary + suggestions (15 lines or less) + - REJECT → Issues in table format (30 lines or less) + transitions: + - condition: approved + next_step: ai_review + - condition: rejected + next_step: plan + + - name: ai_review + agent: ~/.takt/agents/default/ai-reviewer.md + allowed_tools: + - Read + - Glob + - Grep + - WebSearch + - WebFetch + status_rules_prompt: | + # ⚠️ REQUIRED: Status Output Rules ⚠️ + + **Without this tag, the workflow will stop.** + Your final output MUST include a status tag following the rules below. + + ## Judgment Criteria + + | Situation | Judgment | + |-----------|----------| + | Incorrect assumptions (affecting behavior) | REJECT | + | Plausible-but-wrong code | REJECT | + | Significant context mismatch with codebase | REJECT | + | Scope creep | APPROVE (with warning noted) | + | Minor style deviations only | APPROVE | + | Code fits context and works | APPROVE | + + **Note:** Scope creep is noted as a warning but doesn't warrant REJECT alone. + + ## Output Format + + | Situation | Tag | + |-----------|-----| + | No AI-specific issues | `[AI_REVIEW:APPROVE]` | + | Issues found | `[AI_REVIEW:REJECT]` | + + ### Output Examples + + **APPROVE case:** + ``` + [AI_REVIEW:APPROVE] + + Verification result: No issues + ``` + + **REJECT case:** + ``` + [AI_REVIEW:REJECT] + + Issues: + 1. Non-existent API used: `fetch.json()` → `response.json()` + ``` + instruction_template: | + ## Workflow Context + - Iteration: {iteration}/{max_iterations} (workflow-wide) + - Step Iteration: {step_iteration} (times this step has run) + - Step: ai_review (AI-Generated Code Review) + - Report Directory: .takt/reports/{report_dir}/ + - Report File: .takt/reports/{report_dir}/04-ai-review.md + + ## Original User Request (Initial request from workflow start) + {task} + + ## Git Diff + ```diff + {git_diff} + ``` + + ## Instructions + Review the code for AI-specific issues: + - Assumption validation + - Plausible but wrong patterns + - Context fit with existing codebase + - Scope creep detection + + **Report output:** Output to the `Report File` specified above. + - If file does not exist: Create new file + - If file exists: Append with `## Iteration {step_iteration}` section + + **Report format:** + ```markdown + # AI-Generated Code Review + + ## Result: APPROVE / REJECT + + ## Summary + {One sentence summarizing result} + + ## Verified Items + | Aspect | Result | Notes | + |--------|--------|-------| + | Assumption validity | ✅ | - | + | API/Library existence | ✅ | - | + | Context fit | ✅ | - | + | Scope | ✅ | - | + + ## Issues (if REJECT) + | # | Category | Location | Issue | + |---|----------|----------|-------| + | 1 | Hallucinated API | `src/file.ts:23` | Non-existent method | + ``` + + **Cognitive load reduction rules:** + - No issues → Summary 1 line + check table only (10 lines or less) + - Issues found → + Issues in table format (25 lines or less) + transitions: + - condition: approved + next_step: supervise + - condition: rejected + next_step: plan + + - name: supervise + agent: ~/.takt/agents/default/supervisor.md + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + status_rules_prompt: | + # ⚠️ REQUIRED: Status Output Rules ⚠️ + + **Without this tag, the workflow will stop.** + Your final output MUST include a status tag following the rules below. + + ## Judgment Criteria + + | Situation | Judgment | + |-----------|----------| + | Requirements not met | REJECT | + | Tests failing | REJECT | + | Build fails | REJECT | + | Workarounds remaining | REJECT | + | All OK | APPROVE | + + **Principle**: When in doubt, REJECT. Don't give ambiguous approval. + + ## Output Format + + | Situation | Tag | + |-----------|-----| + | Final approval | `[SUPERVISOR:APPROVE]` | + | Return for fixes | `[SUPERVISOR:REJECT]` | + + ### Output Examples + + **APPROVE case:** + ``` + [SUPERVISOR:APPROVE] + + Verification results: + - Tests: ✅ All passed + - Build: ✅ Succeeded + - Requirements met: ✅ + ``` + + **REJECT case:** + ``` + [SUPERVISOR:REJECT] + + Issues: + 1. Tests failing: `npm test` - 2 failures + 2. Requirements not met: Login feature not implemented + ``` + instruction_template: | + ## Workflow Context + - Iteration: {iteration}/{max_iterations} (workflow-wide) + - Step Iteration: {step_iteration} (times this step has run) + - Step: supervise (final verification) + - Report Directory: .takt/reports/{report_dir}/ + - Report Files: + - Validation: .takt/reports/{report_dir}/05-supervisor-validation.md + - Summary: .takt/reports/{report_dir}/summary.md + + ## Original User Request + {task} + + ## Git Diff + ```diff + {git_diff} + ``` + + ## Instructions + Run tests, verify the build, and perform final approval. + + **Workflow Overall Review:** + 1. Does the implementation match the plan (00-plan.md)? + 2. Were all review step issues addressed? + 3. Was the original task objective achieved? + + **Review Reports:** Read all reports in Report Directory and + check for any unaddressed improvement suggestions. + + **Report output:** Output to the `Report Files` specified above. + - If file does not exist: Create new file + - If file exists: Append with `## Iteration {step_iteration}` section + + **Validation report format:** + ```markdown + # Final Validation Results + + ## Result: APPROVE / REJECT + + ## Validation Summary + | Item | Status | Verification Method | + |------|--------|---------------------| + | Requirements met | ✅ | Matched against requirements list | + | Tests | ✅ | `npm test` (N passed) | + | Build | ✅ | `npm run build` succeeded | + | Functional check | ✅ | Main flows verified | + + ## Deliverables + - Created: {Created files} + - Modified: {Modified files} + + ## Incomplete Items (if REJECT) + | # | Item | Reason | + |---|------|--------| + | 1 | {Item} | {Reason} | + ``` + + **Summary report format (only if APPROVE):** + ```markdown + # Task Completion Summary + + ## Task + {Original request in 1-2 sentences} + + ## Result + ✅ Complete + + ## Changes + | Type | File | Summary | + |------|------|---------| + | Create | `src/file.ts` | Summary description | + + ## Review Results + | Review | Result | + |--------|--------| + | Architect | ✅ APPROVE | + | AI Review | ✅ APPROVE | + | Supervisor | ✅ APPROVE | + + ## Verification Commands + ```bash + npm test + npm run build + ``` + ``` + transitions: + - condition: approved + next_step: COMPLETE + - condition: rejected + next_step: plan diff --git a/resources/global/ja/workflows/simple.yaml b/resources/global/ja/workflows/simple.yaml new file mode 100644 index 0000000..679eeff --- /dev/null +++ b/resources/global/ja/workflows/simple.yaml @@ -0,0 +1,594 @@ +# Simple TAKT Workflow +# Plan -> Coder -> Architect Review -> AI Review -> Supervisor Approval +# (defaultの簡略版 - improve, fix, ai_fix, security_review, security_fix を削除) +# +# Template Variables: +# {iteration} - Workflow-wide turn count (total steps executed across all agents) +# {max_iterations} - Maximum iterations allowed for the workflow +# {step_iteration} - Per-step iteration count (how many times THIS step has been executed) +# {task} - Original user request +# {previous_response} - Output from the previous step +# {git_diff} - Current uncommitted changes (git diff) +# {user_inputs} - Accumulated user inputs during workflow +# {report_dir} - Report directory name (e.g., "20250126-143052-task-summary") + +name: simple +description: Simplified development workflow (plan -> implement -> review -> ai_review -> supervise) + +max_iterations: 20 + +initial_step: plan + +steps: + - name: plan + agent: ~/.takt/agents/default/planner.md + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + status_rules_prompt: | + # ⚠️ 必須: ステータス出力ルール ⚠️ + + **このタグがないとワークフローが停止します。** + 最終出力には必ず以下のルールに従ったステータスタグを含めてください。 + + ## 判定基準 + + | 状況 | 判定 | + |------|------| + | 要件が明確で実装可能 | DONE | + | 要件が不明確、情報不足 | BLOCKED | + + ## 出力フォーマット + + | 状況 | タグ | + |------|------| + | 分析完了 | `[PLANNER:DONE]` | + | 情報不足 | `[PLANNER:BLOCKED]` | + + ### 出力例 + + **DONE の場合:** + ``` + [PLANNER:DONE] + ``` + + **BLOCKED の場合:** + ``` + [PLANNER:BLOCKED] + + 確認事項: + - {質問1} + - {質問2} + ``` + instruction_template: | + ## Workflow Context + - Iteration: {iteration}/{max_iterations}(ワークフロー全体) + - Step Iteration: {step_iteration}(このステップの実行回数) + - Step: plan (タスク分析) + - Report Directory: .takt/reports/{report_dir}/ + - Report File: .takt/reports/{report_dir}/00-plan.md + + ## User Request + {task} + + ## Previous Response (implementからの差し戻し時) + {previous_response} + + ## Instructions + タスクを分析し、実装方針を立ててください。 + + **注意:** Previous Responseがある場合は差し戻しのため、 + その内容を踏まえて計画を見直してください(replan)。 + + **やること:** + 1. タスクの要件を理解する + 2. 影響範囲を特定する + 3. 実装アプローチを決める + + **レポート出力:** 上記の `Report File` に出力してください。 + - ファイルが存在しない場合: 新規作成 + - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記 + + **レポートフォーマット:** + ```markdown + # タスク計画 + + ## 元の要求 + {ユーザーの要求をそのまま記載} + + ## 分析結果 + + ### 目的 + {達成すべきこと} + + ### スコープ + {影響範囲} + + ### 実装アプローチ + {どう進めるか} + + ## 確認事項(あれば) + - {不明点や確認が必要な点} + ``` + pass_previous_response: true + transitions: + - condition: done + next_step: implement + - condition: blocked + next_step: ABORT + + - name: implement + agent: ~/.takt/agents/default/coder.md + allowed_tools: + - Read + - Glob + - Grep + - Edit + - Write + - Bash + - WebSearch + - WebFetch + status_rules_prompt: | + # ⚠️ 必須: ステータス出力ルール ⚠️ + + **このタグがないとワークフローが停止します。** + 最終出力には必ず以下のルールに従ったステータスタグを含めてください。 + + ## 出力フォーマット + + | 状況 | タグ | + |------|------| + | 実装完了 | `[CODER:DONE]` | + | 判断できない/情報不足 | `[CODER:BLOCKED]` | + + **重要**: 迷ったら `[BLOCKED]`。勝手に判断しない。 + + ### 出力例 + + **DONE の場合:** + ``` + 実装完了しました。 + - 作成: `src/auth/service.ts`, `tests/auth.test.ts` + - 変更: `src/routes.ts` + + [CODER:DONE] + ``` + + **BLOCKED の場合:** + ``` + [CODER:BLOCKED] + + 理由: DBスキーマが未定義のため実装できません + 必要な情報: usersテーブルの構造 + ``` + instruction_template: | + ## Workflow Context + - Iteration: {iteration}/{max_iterations}(ワークフロー全体) + - Step Iteration: {step_iteration}(このステップの実行回数) + - Step: implement + - Report Directory: .takt/reports/{report_dir}/ + - Report Files: + - Scope: .takt/reports/{report_dir}/01-coder-scope.md + - Decisions: .takt/reports/{report_dir}/02-coder-decisions.md + + ## User Request + {task} + + ## Additional User Inputs + {user_inputs} + + ## Instructions + planステップで立てた計画に従って実装してください。 + 計画レポート(00-plan.md)を参照し、実装を進めてください。 + + **レポート出力:** 上記の `Report Files` に出力してください。 + - ファイルが存在しない場合: 新規作成 + - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記 + + **Scopeレポートフォーマット(実装開始時に作成):** + ```markdown + # 変更スコープ宣言 + + ## タスク + {タスクの1行要約} + + ## 変更予定 + | 種別 | ファイル | + |------|---------| + | 作成 | `src/example.ts` | + | 変更 | `src/routes.ts` | + + ## 推定規模 + Small / Medium / Large + + ## 影響範囲 + - {影響するモジュールや機能} + ``` + + **Decisionsレポートフォーマット(実装完了時、決定がある場合のみ):** + ```markdown + # 決定ログ + + ## 1. {決定内容} + - **背景**: {なぜ決定が必要だったか} + - **検討した選択肢**: {選択肢リスト} + - **理由**: {選んだ理由} + ``` + transitions: + - condition: done + next_step: review + - condition: blocked + next_step: plan + + - name: review + agent: ~/.takt/agents/default/architect.md + allowed_tools: + - Read + - Glob + - Grep + - WebSearch + - WebFetch + status_rules_prompt: | + # ⚠️ 必須: ステータス出力ルール ⚠️ + + **このタグがないとワークフローが停止します。** + 最終出力には必ず以下のルールに従ったステータスタグを含めてください。 + + ## 判定基準 + + | 状況 | 判定 | + |------|------| + | 構造に問題がある | REJECT | + | 設計原則違反がある | REJECT | + | セキュリティ問題がある | REJECT | + | テストが不十分 | REJECT | + | 問題なし | APPROVE | + + **注意:** simpleワークフローでは IMPROVE は使用しません。 + 軽微な問題もある場合は APPROVE + コメントとしてください。 + + ## 出力フォーマット + + | 状況 | タグ | + |------|------| + | 問題なし | `[ARCHITECT:APPROVE]` | + | 構造的な修正必要 | `[ARCHITECT:REJECT]` | + + ### 出力例 + + **APPROVE の場合:** + ``` + [ARCHITECT:APPROVE] + + 良い点: + - モジュール分割が適切 + - 単一責務が守られている + ``` + + **REJECT の場合:** + ``` + [ARCHITECT:REJECT] + + 問題点: + 1. ファイルサイズ超過 + - 場所: `src/services/user.ts` (523行) + - 修正案: 3ファイルに分割 + ``` + instruction_template: | + ## Workflow Context + - Iteration: {iteration}/{max_iterations}(ワークフロー全体) + - Step Iteration: {step_iteration}(このステップの実行回数) + - Step: review (アーキテクチャレビュー) + - Report Directory: .takt/reports/{report_dir}/ + - Report File: .takt/reports/{report_dir}/03-architect-review.md + + ## Original User Request (ワークフロー開始時の元の要求) + {task} + + ## Git Diff + ```diff + {git_diff} + ``` + + ## Instructions + **アーキテクチャと設計**のレビューに集中してください。AI特有の問題はレビューしないでください(次のステップで行います)。 + + 変更をレビューしてフィードバックを提供してください。 + + **注意:** simpleワークフローではIMPROVE判定は使用しません。 + 軽微な改善提案がある場合は APPROVE + コメントとしてください。 + + **レポート出力:** 上記の `Report File` に出力してください。 + - ファイルが存在しない場合: 新規作成 + - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記 + + **レポートフォーマット:** + ```markdown + # アーキテクチャレビュー + + ## 結果: APPROVE / REJECT + + ## サマリー + {1-2文で結果を要約} + + ## 確認した観点 + - [x] 構造・設計 + - [x] コード品質 + - [x] 変更スコープ + + ## 問題点(REJECTの場合) + | # | 場所 | 問題 | 修正案 | + |---|------|------|--------| + | 1 | `src/file.ts:42` | 問題の説明 | 修正方法 | + + ## 改善提案(任意・ブロッキングではない) + - {将来的な改善提案} + ``` + + **認知負荷軽減ルール:** + - APPROVE + 問題なし → サマリーのみ(5行以内) + - APPROVE + 軽微な提案 → サマリー + 改善提案(15行以内) + - REJECT → 問題点を表形式で(30行以内) + transitions: + - condition: approved + next_step: ai_review + - condition: rejected + next_step: plan + + - name: ai_review + agent: ~/.takt/agents/default/ai-reviewer.md + allowed_tools: + - Read + - Glob + - Grep + - WebSearch + - WebFetch + status_rules_prompt: | + # ⚠️ 必須: ステータス出力ルール ⚠️ + + **このタグがないとワークフローが停止します。** + 最終出力には必ず以下のルールに従ったステータスタグを含めてください。 + + ## 判定基準 + + | 状況 | 判定 | + |------|------| + | 仮定が間違っている(動作に影響) | REJECT | + | もっともらしいが間違っているコード | REJECT | + | コードベースの文脈に重大な不整合 | REJECT | + | スコープクリープ | APPROVE(警告を付記) | + | 軽微なスタイルの逸脱のみ | APPROVE | + | コードが文脈に合い動作する | APPROVE | + + **注意:** スコープクリープは警告として記載するが、それだけでREJECTしない。 + + ## 出力フォーマット + + | 状況 | タグ | + |------|------| + | AI特有の問題なし | `[AI_REVIEW:APPROVE]` | + | 問題あり | `[AI_REVIEW:REJECT]` | + + ### 出力例 + + **APPROVE の場合:** + ``` + [AI_REVIEW:APPROVE] + + 検証結果: 問題なし + ``` + + **REJECT の場合:** + ``` + [AI_REVIEW:REJECT] + + 問題点: + 1. 存在しないAPIを使用: `fetch.json()` → `response.json()` + ``` + instruction_template: | + ## Workflow Context + - Iteration: {iteration}/{max_iterations}(ワークフロー全体) + - Step Iteration: {step_iteration}(このステップの実行回数) + - Step: ai_review (AI生成コードレビュー) + - Report Directory: .takt/reports/{report_dir}/ + - Report File: .takt/reports/{report_dir}/04-ai-review.md + + ## Original User Request (ワークフロー開始時の元の要求) + {task} + + ## Git Diff + ```diff + {git_diff} + ``` + + ## Instructions + AI特有の問題についてコードをレビューしてください: + - 仮定の検証 + - もっともらしいが間違っているパターン + - 既存コードベースとの適合性 + - スコープクリープの検出 + + **レポート出力:** 上記の `Report File` に出力してください。 + - ファイルが存在しない場合: 新規作成 + - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記 + + **レポートフォーマット:** + ```markdown + # AI生成コードレビュー + + ## 結果: APPROVE / REJECT + + ## サマリー + {1文で結果を要約} + + ## 検証した項目 + | 観点 | 結果 | 備考 | + |------|------|------| + | 仮定の妥当性 | ✅ | - | + | API/ライブラリの実在 | ✅ | - | + | コンテキスト適合 | ✅ | - | + | スコープ | ✅ | - | + + ## 問題点(REJECTの場合) + | # | カテゴリ | 場所 | 問題 | + |---|---------|------|------| + | 1 | 幻覚API | `src/file.ts:23` | 存在しないメソッド | + ``` + + **認知負荷軽減ルール:** + - 問題なし → サマリー1文 + チェック表のみ(10行以内) + - 問題あり → + 問題を表形式で(25行以内) + transitions: + - condition: approved + next_step: supervise + - condition: rejected + next_step: plan + + - name: supervise + agent: ~/.takt/agents/default/supervisor.md + allowed_tools: + - Read + - Glob + - Grep + - Bash + - WebSearch + - WebFetch + status_rules_prompt: | + # ⚠️ 必須: ステータス出力ルール ⚠️ + + **このタグがないとワークフローが停止します。** + 最終出力には必ず以下のルールに従ったステータスタグを含めてください。 + + ## 判定基準 + + | 状況 | 判定 | + |------|------| + | 要求が満たされていない | REJECT | + | テストが失敗する | REJECT | + | ビルドが通らない | REJECT | + | その場しのぎが残っている | REJECT | + | すべて問題なし | APPROVE | + + **原則**: 疑わしきは REJECT。曖昧な承認はしない。 + + ## 出力フォーマット + + | 状況 | タグ | + |------|------| + | 最終承認 | `[SUPERVISOR:APPROVE]` | + | 差し戻し | `[SUPERVISOR:REJECT]` | + + ### 出力例 + + **APPROVE の場合:** + ``` + [SUPERVISOR:APPROVE] + + 検証結果: + - テスト: ✅ 全件パス + - ビルド: ✅ 成功 + - 要求充足: ✅ + ``` + + **REJECT の場合:** + ``` + [SUPERVISOR:REJECT] + + 問題点: + 1. テストが失敗: `npm test` で 2 件失敗 + 2. 元の要求を満たしていない: ログイン機能が未実装 + ``` + instruction_template: | + ## Workflow Context + - Iteration: {iteration}/{max_iterations}(ワークフロー全体) + - Step Iteration: {step_iteration}(このステップの実行回数) + - Step: supervise (final verification) + - Report Directory: .takt/reports/{report_dir}/ + - Report Files: + - Validation: .takt/reports/{report_dir}/05-supervisor-validation.md + - Summary: .takt/reports/{report_dir}/summary.md + + ## Original User Request + {task} + + ## Git Diff + ```diff + {git_diff} + ``` + + ## Instructions + テスト実行、ビルド確認、最終承認を行ってください。 + + **ワークフロー全体の確認:** + 1. 計画(00-plan.md)と実装結果が一致しているか + 2. 各レビューステップの指摘が対応されているか + 3. 元のタスク目的が達成されているか + + **レポートの確認:** Report Directory内の全レポートを読み、 + 未対応の改善提案がないか確認してください。 + + **レポート出力:** 上記の `Report Files` に出力してください。 + - ファイルが存在しない場合: 新規作成 + - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記 + + **Validationレポートフォーマット:** + ```markdown + # 最終検証結果 + + ## 結果: APPROVE / REJECT + + ## 検証サマリー + | 項目 | 状態 | 確認方法 | + |------|------|---------| + | 要求充足 | ✅ | 要求リストと照合 | + | テスト | ✅ | `npm test` (N passed) | + | ビルド | ✅ | `npm run build` 成功 | + | 動作確認 | ✅ | 主要フロー確認 | + + ## 成果物 + - 作成: {作成したファイル} + - 変更: {変更したファイル} + + ## 未完了項目(REJECTの場合) + | # | 項目 | 理由 | + |---|------|------| + | 1 | {項目} | {理由} | + ``` + + **Summaryレポートフォーマット(APPROVEの場合のみ):** + ```markdown + # タスク完了サマリー + + ## タスク + {元の要求を1-2文で} + + ## 結果 + ✅ 完了 + + ## 変更内容 + | 種別 | ファイル | 概要 | + |------|---------|------| + | 作成 | `src/file.ts` | 概要説明 | + + ## レビュー結果 + | レビュー | 結果 | + |---------|------| + | Architect | ✅ APPROVE | + | AI Review | ✅ APPROVE | + | Supervisor | ✅ APPROVE | + + ## 確認コマンド + ```bash + npm test + npm run build + ``` + ``` + transitions: + - condition: approved + next_step: COMPLETE + - condition: rejected + next_step: plan diff --git a/src/models/schemas.ts b/src/models/schemas.ts index 7582737..9aed9a0 100644 --- a/src/models/schemas.ts +++ b/src/models/schemas.ts @@ -136,9 +136,9 @@ export const ProjectConfigSchema = z.object({ * Custom agents can override these patterns in their configuration. */ export const GENERIC_STATUS_PATTERNS: Record = { - approved: '\\[\\w+:APPROVE\\]', - rejected: '\\[\\w+:REJECT\\]', - improve: '\\[\\w+:IMPROVE\\]', - done: '\\[\\w+:(DONE|FIXED)\\]', - blocked: '\\[\\w+:BLOCKED\\]', + approved: '\\[[\\w-]+:APPROVE\\]', + rejected: '\\[[\\w-]+:REJECT\\]', + improve: '\\[[\\w-]+:IMPROVE\\]', + done: '\\[[\\w-]+:(DONE|FIXED)\\]', + blocked: '\\[[\\w-]+:BLOCKED\\]', };