ワークフローが意図せず停止してしまう問題を修正

This commit is contained in:
nrslib 2026-01-27 09:50:11 +09:00
parent f643eac190
commit 5772ccd735
15 changed files with 250 additions and 89 deletions

View File

@ -1,5 +1,15 @@
# Default TAKT Workflow # Default TAKT Workflow
# Plan -> Coder -> Architect Review -> AI Review -> Security Review -> Supervisor Approval # Plan -> Coder -> Architect Review -> AI Review -> Security Review -> Supervisor Approval
#
# 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: default name: default
description: Standard development workflow with planning and specialized reviews description: Standard development workflow with planning and specialized reviews
@ -55,7 +65,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: plan (Task Analysis) - Step: plan (Task Analysis)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/00-plan.md - Report File: .takt/reports/{report_dir}/00-plan.md
@ -79,7 +90,7 @@ steps:
**Report output:** Output to the `Report File` specified above. **Report output:** Output to the `Report File` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Report format:** **Report format:**
```markdown ```markdown
@ -155,7 +166,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: implement - Step: implement
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report Files: - Report Files:
@ -174,7 +186,7 @@ steps:
**Report output:** Output to the `Report Files` specified above. **Report output:** Output to the `Report Files` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Scope report format (create at implementation start):** **Scope report format (create at implementation start):**
```markdown ```markdown
@ -279,7 +291,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: review (Architecture Review) - Step: review (Architecture Review)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/03-architect-review.md - Report File: .takt/reports/{report_dir}/03-architect-review.md
@ -299,7 +312,7 @@ steps:
**Report output:** Output to the `Report File` specified above. **Report output:** Output to the `Report File` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Report format:** **Report format:**
```markdown ```markdown
@ -382,7 +395,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: improve - Step: improve
## Architect Feedback (This is the latest instruction - prioritize this) ## Architect Feedback (This is the latest instruction - prioritize this)
@ -463,7 +477,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: ai_review (AI-Generated Code Review) - Step: ai_review (AI-Generated Code Review)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/04-ai-review.md - Report File: .takt/reports/{report_dir}/04-ai-review.md
@ -485,7 +500,7 @@ steps:
**Report output:** Output to the `Report File` specified above. **Report output:** Output to the `Report File` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Report format:** **Report format:**
```markdown ```markdown
@ -564,7 +579,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: ai_fix - Step: ai_fix
## AI Review Feedback (This is the latest instruction - prioritize this) ## AI Review Feedback (This is the latest instruction - prioritize this)
@ -640,7 +656,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: security_review - Step: security_review
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/05-security-review.md - Report File: .takt/reports/{report_dir}/05-security-review.md
@ -662,7 +679,7 @@ steps:
**Report output:** Output to the `Report File` specified above. **Report output:** Output to the `Report File` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Report format:** **Report format:**
```markdown ```markdown
@ -744,7 +761,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: security_fix - Step: security_fix
## Security Review Feedback (This is the latest instruction - prioritize this) ## Security Review Feedback (This is the latest instruction - prioritize this)
@ -813,7 +831,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: fix - Step: fix
## Architect Feedback (This is the latest instruction - prioritize this) ## Architect Feedback (This is the latest instruction - prioritize this)
@ -893,7 +912,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: supervise (final verification) - Step: supervise (final verification)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report Files: - Report Files:
@ -921,7 +941,7 @@ steps:
**Report output:** Output to the `Report Files` specified above. **Report output:** Output to the `Report Files` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Validation report format:** **Validation report format:**
```markdown ```markdown

View File

@ -9,6 +9,16 @@
# Fix destination is determined by Coder based on change impact: # Fix destination is determined by Coder based on change impact:
# - fix_security: MINOR→security_review, MAJOR→cqrs_es_review # - fix_security: MINOR→security_review, MAJOR→cqrs_es_review
# - fix_qa: MINOR→qa_review, SECURITY→security_review, MAJOR→cqrs_es_review # - fix_qa: MINOR→qa_review, SECURITY→security_review, MAJOR→cqrs_es_review
#
# 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: expert-review name: expert-review
description: CQRS+ES, Frontend, Security, QA Expert Review description: CQRS+ES, Frontend, Security, QA Expert Review
@ -44,7 +54,8 @@ steps:
| Requirements unclear | `[PLANNER:BLOCKED]` | | Requirements unclear | `[PLANNER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: plan (Task Analysis) - Step: plan (Task Analysis)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/00-plan.md - Report File: .takt/reports/{report_dir}/00-plan.md
@ -68,7 +79,7 @@ steps:
**Report output:** Output to the `Report File` specified above. **Report output:** Output to the `Report File` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Report format:** **Report format:**
```markdown ```markdown
@ -129,7 +140,8 @@ steps:
| Cannot proceed | `[CODER:BLOCKED]` | | Cannot proceed | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: implement - Step: implement
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report Files: - Report Files:
@ -148,7 +160,7 @@ steps:
**Report output:** Output to the `Report Files` specified above. **Report output:** Output to the `Report Files` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Scope report format (create at implementation start):** **Scope report format (create at implementation start):**
```markdown ```markdown
@ -213,7 +225,8 @@ steps:
| Design issues found | `[CQRS-ES:REJECT]` | | Design issues found | `[CQRS-ES:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: cqrs_es_review (CQRS+ES Expert Review) - Step: cqrs_es_review (CQRS+ES Expert Review)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/03-cqrs-es-review.md - Report File: .takt/reports/{report_dir}/03-cqrs-es-review.md
@ -242,7 +255,7 @@ steps:
**Report output:** Output to the `Report File` specified above. **Report output:** Output to the `Report File` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Report format:** **Report format:**
```markdown ```markdown
@ -302,7 +315,8 @@ steps:
| Cannot proceed | `[CODER:BLOCKED]` | | Cannot proceed | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: fix_cqrs_es - Step: fix_cqrs_es
## CQRS+ES Review Feedback (This is the latest instruction - prioritize this) ## CQRS+ES Review Feedback (This is the latest instruction - prioritize this)
@ -358,7 +372,8 @@ steps:
| Design issues found | `[FRONTEND:REJECT]` | | Design issues found | `[FRONTEND:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: frontend_review (Frontend Expert Review) - Step: frontend_review (Frontend Expert Review)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/04-frontend-review.md - Report File: .takt/reports/{report_dir}/04-frontend-review.md
@ -387,7 +402,7 @@ steps:
**Report output:** Output to the `Report File` specified above. **Report output:** Output to the `Report File` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Report format:** **Report format:**
```markdown ```markdown
@ -447,7 +462,8 @@ steps:
| Cannot proceed | `[CODER:BLOCKED]` | | Cannot proceed | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: fix_frontend - Step: fix_frontend
## Frontend Review Feedback (This is the latest instruction - prioritize this) ## Frontend Review Feedback (This is the latest instruction - prioritize this)
@ -503,7 +519,8 @@ steps:
| Issues found | `[AI_REVIEW:REJECT]` | | Issues found | `[AI_REVIEW:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: ai_review (AI-Generated Code Review) - Step: ai_review (AI-Generated Code Review)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/05-ai-review.md - Report File: .takt/reports/{report_dir}/05-ai-review.md
@ -525,7 +542,7 @@ steps:
**Report output:** Output to the `Report File` specified above. **Report output:** Output to the `Report File` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Report format:** **Report format:**
```markdown ```markdown
@ -588,7 +605,8 @@ steps:
| Cannot proceed | `[CODER:BLOCKED]` | | Cannot proceed | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: ai_fix - Step: ai_fix
## AI Review Feedback (This is the latest instruction - prioritize this) ## AI Review Feedback (This is the latest instruction - prioritize this)
@ -642,7 +660,8 @@ steps:
| Vulnerabilities found | `[SECURITY:REJECT]` | | Vulnerabilities found | `[SECURITY:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: security_review (Security Expert Review) - Step: security_review (Security Expert Review)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/06-security-review.md - Report File: .takt/reports/{report_dir}/06-security-review.md
@ -667,7 +686,7 @@ steps:
**Report output:** Output to the `Report File` specified above. **Report output:** Output to the `Report File` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Report format:** **Report format:**
```markdown ```markdown
@ -729,7 +748,8 @@ steps:
| Cannot proceed | `[CODER:BLOCKED]` | | Cannot proceed | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: fix_security - Step: fix_security
## Security Review Feedback (This is the latest instruction - prioritize this) ## Security Review Feedback (This is the latest instruction - prioritize this)
@ -794,7 +814,8 @@ steps:
| Quality issues found | `[QA:REJECT]` | | Quality issues found | `[QA:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: qa_review (QA Expert Review) - Step: qa_review (QA Expert Review)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/07-qa-review.md - Report File: .takt/reports/{report_dir}/07-qa-review.md
@ -820,7 +841,7 @@ steps:
**Report output:** Output to the `Report File` specified above. **Report output:** Output to the `Report File` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Report format:** **Report format:**
```markdown ```markdown
@ -882,7 +903,8 @@ steps:
| Cannot proceed | `[CODER:BLOCKED]` | | Cannot proceed | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: fix_qa - Step: fix_qa
## QA Review Feedback (This is the latest instruction - prioritize this) ## QA Review Feedback (This is the latest instruction - prioritize this)
@ -951,7 +973,8 @@ steps:
| Issues found | `[SUPERVISOR:REJECT]` | | Issues found | `[SUPERVISOR:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: supervise (Final Review) - Step: supervise (Final Review)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report Files: - Report Files:
@ -987,7 +1010,7 @@ steps:
**Report output:** Output to the `Report Files` specified above. **Report output:** Output to the `Report Files` specified above.
- If file does not exist: Create new file - If file does not exist: Create new file
- If file exists: Append with `## Iteration {iteration}` section - If file exists: Append with `## Iteration {step_iteration}` section
**Validation report format:** **Validation report format:**
```markdown ```markdown
@ -1079,7 +1102,8 @@ steps:
| Cannot proceed | `[CODER:BLOCKED]` | | Cannot proceed | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: fix_supervisor - Step: fix_supervisor
## Supervisor Feedback (This is the latest instruction - prioritize this) ## Supervisor Feedback (This is the latest instruction - prioritize this)

View File

@ -1,6 +1,16 @@
# MAGI System Workflow # MAGI System Workflow
# A deliberation workflow modeled after Evangelion's MAGI system # A deliberation workflow modeled after Evangelion's MAGI system
# Three personas (scientist, nurturer, pragmatist) analyze from different perspectives and vote # Three personas (scientist, nurturer, pragmatist) analyze from different perspectives and vote
#
# 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: magi name: magi
description: MAGI Deliberation System - Analyze from 3 perspectives and decide by majority description: MAGI Deliberation System - Analyze from 3 perspectives and decide by majority

View File

@ -5,6 +5,16 @@
# Flow: # Flow:
# plan -> dig -> supervise -> COMPLETE (approved) # plan -> dig -> supervise -> COMPLETE (approved)
# -> plan (rejected: restart from planning) # -> plan (rejected: restart from planning)
#
# 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: research name: research
description: Research workflow - autonomously executes research without asking questions description: Research workflow - autonomously executes research without asking questions
@ -49,7 +59,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Status ## Workflow Status
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: plan - Step: plan
## Research Request ## Research Request
@ -111,7 +122,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Status ## Workflow Status
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: dig - Step: dig
## Original Research Request ## Original Research Request
@ -188,7 +200,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Status ## Workflow Status
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations} (workflow-wide)
- Step Iteration: {step_iteration} (times this step has run)
- Step: supervise (research quality evaluation) - Step: supervise (research quality evaluation)
## Original Research Request ## Original Research Request

View File

@ -1,5 +1,15 @@
# Default TAKT Workflow # Default TAKT Workflow
# Plan -> Coder -> Architect Review -> AI Review -> Security Review -> Supervisor Approval # Plan -> Coder -> Architect Review -> AI Review -> Security Review -> Supervisor Approval
#
# 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: default name: default
description: Standard development workflow with planning and specialized reviews description: Standard development workflow with planning and specialized reviews
@ -55,7 +65,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: plan (タスク分析) - Step: plan (タスク分析)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/00-plan.md - Report File: .takt/reports/{report_dir}/00-plan.md
@ -79,7 +90,7 @@ steps:
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**レポートフォーマット:** **レポートフォーマット:**
```markdown ```markdown
@ -155,7 +166,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: implement - Step: implement
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report Files: - Report Files:
@ -174,7 +186,7 @@ steps:
**レポート出力:** 上記の `Report Files` に出力してください。 **レポート出力:** 上記の `Report Files` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**Scopeレポートフォーマット実装開始時に作成:** **Scopeレポートフォーマット実装開始時に作成:**
```markdown ```markdown
@ -279,7 +291,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: review (アーキテクチャレビュー) - Step: review (アーキテクチャレビュー)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/03-architect-review.md - Report File: .takt/reports/{report_dir}/03-architect-review.md
@ -299,7 +312,7 @@ steps:
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**レポートフォーマット:** **レポートフォーマット:**
```markdown ```markdown
@ -382,7 +395,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: improve - Step: improve
## Architect Feedback (これが最新の指示です - 優先して対応してください) ## Architect Feedback (これが最新の指示です - 優先して対応してください)
@ -462,7 +476,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: ai_review (AI生成コードレビュー) - Step: ai_review (AI生成コードレビュー)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/04-ai-review.md - Report File: .takt/reports/{report_dir}/04-ai-review.md
@ -484,7 +499,7 @@ steps:
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**レポートフォーマット:** **レポートフォーマット:**
```markdown ```markdown
@ -563,7 +578,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: ai_fix - Step: ai_fix
## AI Review Feedback (これが最新の指示です - 優先して対応してください) ## AI Review Feedback (これが最新の指示です - 優先して対応してください)
@ -638,7 +654,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: security_review - Step: security_review
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/05-security-review.md - Report File: .takt/reports/{report_dir}/05-security-review.md
@ -660,7 +677,7 @@ steps:
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**レポートフォーマット:** **レポートフォーマット:**
```markdown ```markdown
@ -742,7 +759,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: security_fix - Step: security_fix
## Security Review Feedback (これが最新の指示です - 優先して対応してください) ## Security Review Feedback (これが最新の指示です - 優先して対応してください)
@ -810,7 +828,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: fix - Step: fix
## Architect Feedback (これが最新の指示です - 優先して対応してください) ## Architect Feedback (これが最新の指示です - 優先して対応してください)
@ -889,7 +908,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: supervise (final verification) - Step: supervise (final verification)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report Files: - Report Files:
@ -917,7 +937,7 @@ steps:
**レポート出力:** 上記の `Report Files` に出力してください。 **レポート出力:** 上記の `Report Files` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**Validationレポートフォーマット:** **Validationレポートフォーマット:**
```markdown ```markdown

View File

@ -9,6 +9,16 @@
# 修正時の戻り先はCoderが判断: # 修正時の戻り先はCoderが判断:
# - fix_security: MINOR→security_review, MAJOR→cqrs_es_review # - fix_security: MINOR→security_review, MAJOR→cqrs_es_review
# - fix_qa: MINOR→qa_review, SECURITY→security_review, MAJOR→cqrs_es_review # - fix_qa: MINOR→qa_review, SECURITY→security_review, MAJOR→cqrs_es_review
#
# テンプレート変数:
# {iteration} - ワークフロー全体のターン数(全エージェントで実行されたステップの合計)
# {max_iterations} - ワークフローの最大イテレーション数
# {step_iteration} - ステップごとのイテレーション数(このステップが何回実行されたか)
# {task} - 元のユーザー要求
# {previous_response} - 前のステップの出力
# {git_diff} - 現在のコミットされていない変更git diff
# {user_inputs} - ワークフロー中に蓄積されたユーザー入力
# {report_dir} - レポートディレクトリ名(例: "20250126-143052-task-summary"
name: expert-review name: expert-review
description: CQRS+ES・フロントエンド・セキュリティ・QA専門家レビュー description: CQRS+ES・フロントエンド・セキュリティ・QA専門家レビュー
@ -44,7 +54,8 @@ steps:
| 要件不明確 | `[PLANNER:BLOCKED]` | | 要件不明確 | `[PLANNER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: plan (タスク分析) - Step: plan (タスク分析)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/00-plan.md - Report File: .takt/reports/{report_dir}/00-plan.md
@ -68,7 +79,7 @@ steps:
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**レポートフォーマット:** **レポートフォーマット:**
```markdown ```markdown
@ -129,7 +140,8 @@ steps:
| 進行不可 | `[CODER:BLOCKED]` | | 進行不可 | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: implement - Step: implement
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report Files: - Report Files:
@ -148,7 +160,7 @@ steps:
**レポート出力:** 上記の `Report Files` に出力してください。 **レポート出力:** 上記の `Report Files` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**Scopeレポートフォーマット実装開始時に作成:** **Scopeレポートフォーマット実装開始時に作成:**
```markdown ```markdown
@ -213,7 +225,8 @@ steps:
| 設計に問題あり | `[CQRS-ES:REJECT]` | | 設計に問題あり | `[CQRS-ES:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: cqrs_es_review (CQRS+ES専門レビュー) - Step: cqrs_es_review (CQRS+ES専門レビュー)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/03-cqrs-es-review.md - Report File: .takt/reports/{report_dir}/03-cqrs-es-review.md
@ -242,7 +255,7 @@ steps:
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**レポートフォーマット:** **レポートフォーマット:**
```markdown ```markdown
@ -302,7 +315,8 @@ steps:
| 進行不可 | `[CODER:BLOCKED]` | | 進行不可 | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: fix_cqrs_es - Step: fix_cqrs_es
## CQRS+ES Review Feedback (これが最新の指示です - 優先して対応してください) ## CQRS+ES Review Feedback (これが最新の指示です - 優先して対応してください)
@ -358,7 +372,8 @@ steps:
| フロントエンド設計に問題あり | `[FRONTEND:REJECT]` | | フロントエンド設計に問題あり | `[FRONTEND:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: frontend_review (フロントエンド専門レビュー) - Step: frontend_review (フロントエンド専門レビュー)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/04-frontend-review.md - Report File: .takt/reports/{report_dir}/04-frontend-review.md
@ -387,7 +402,7 @@ steps:
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**レポートフォーマット:** **レポートフォーマット:**
```markdown ```markdown
@ -447,7 +462,8 @@ steps:
| 進行不可 | `[CODER:BLOCKED]` | | 進行不可 | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: fix_frontend - Step: fix_frontend
## Frontend Review Feedback (これが最新の指示です - 優先して対応してください) ## Frontend Review Feedback (これが最新の指示です - 優先して対応してください)
@ -503,7 +519,8 @@ steps:
| 問題あり | `[AI_REVIEW:REJECT]` | | 問題あり | `[AI_REVIEW:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: ai_review (AI生成コードレビュー) - Step: ai_review (AI生成コードレビュー)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/05-ai-review.md - Report File: .takt/reports/{report_dir}/05-ai-review.md
@ -525,7 +542,7 @@ steps:
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**レポートフォーマット:** **レポートフォーマット:**
```markdown ```markdown
@ -588,7 +605,8 @@ steps:
| 進行不可 | `[CODER:BLOCKED]` | | 進行不可 | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: ai_fix - Step: ai_fix
## AI Review Feedback (これが最新の指示です - 優先して対応してください) ## AI Review Feedback (これが最新の指示です - 優先して対応してください)
@ -642,7 +660,8 @@ steps:
| 脆弱性あり | `[SECURITY:REJECT]` | | 脆弱性あり | `[SECURITY:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: security_review (セキュリティ専門レビュー) - Step: security_review (セキュリティ専門レビュー)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/06-security-review.md - Report File: .takt/reports/{report_dir}/06-security-review.md
@ -667,7 +686,7 @@ steps:
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**レポートフォーマット:** **レポートフォーマット:**
```markdown ```markdown
@ -729,7 +748,8 @@ steps:
| 進行不可 | `[CODER:BLOCKED]` | | 進行不可 | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: fix_security - Step: fix_security
## Security Review Feedback (これが最新の指示です - 優先して対応してください) ## Security Review Feedback (これが最新の指示です - 優先して対応してください)
@ -794,7 +814,8 @@ steps:
| 品質問題あり | `[QA:REJECT]` | | 品質問題あり | `[QA:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: qa_review (QA専門レビュー) - Step: qa_review (QA専門レビュー)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report File: .takt/reports/{report_dir}/07-qa-review.md - Report File: .takt/reports/{report_dir}/07-qa-review.md
@ -820,7 +841,7 @@ steps:
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**レポートフォーマット:** **レポートフォーマット:**
```markdown ```markdown
@ -882,7 +903,8 @@ steps:
| 進行不可 | `[CODER:BLOCKED]` | | 進行不可 | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: fix_qa - Step: fix_qa
## QA Review Feedback (これが最新の指示です - 優先して対応してください) ## QA Review Feedback (これが最新の指示です - 優先して対応してください)
@ -951,7 +973,8 @@ steps:
| 問題あり | `[SUPERVISOR:REJECT]` | | 問題あり | `[SUPERVISOR:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: supervise (最終確認) - Step: supervise (最終確認)
- Report Directory: .takt/reports/{report_dir}/ - Report Directory: .takt/reports/{report_dir}/
- Report Files: - Report Files:
@ -987,7 +1010,7 @@ steps:
**レポート出力:** 上記の `Report Files` に出力してください。 **レポート出力:** 上記の `Report Files` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記
**Validationレポートフォーマット:** **Validationレポートフォーマット:**
```markdown ```markdown
@ -1079,7 +1102,8 @@ steps:
| 進行不可 | `[CODER:BLOCKED]` | | 進行不可 | `[CODER:BLOCKED]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}(ワークフロー全体)
- Step Iteration: {step_iteration}(このステップの実行回数)
- Step: fix_supervisor - Step: fix_supervisor
## Supervisor Feedback (これが最新の指示です - 優先して対応してください) ## Supervisor Feedback (これが最新の指示です - 優先して対応してください)

View File

@ -1,6 +1,16 @@
# MAGI System Workflow # MAGI System Workflow
# エヴァンゲリオンのMAGIシステムを模した合議制ワークフロー # エヴァンゲリオンのMAGIシステムを模した合議制ワークフロー
# 3つの人格科学者・育成者・実務家が異なる観点から分析・投票する # 3つの人格科学者・育成者・実務家が異なる観点から分析・投票する
#
# テンプレート変数:
# {iteration} - ワークフロー全体のターン数(全エージェントで実行されたステップの合計)
# {max_iterations} - ワークフローの最大イテレーション数
# {step_iteration} - ステップごとのイテレーション数(このステップが何回実行されたか)
# {task} - 元のユーザー要求
# {previous_response} - 前のステップの出力
# {git_diff} - 現在のコミットされていない変更git diff
# {user_inputs} - ワークフロー中に蓄積されたユーザー入力
# {report_dir} - レポートディレクトリ名(例: "20250126-143052-task-summary"
name: magi name: magi
description: MAGI合議システム - 3つの観点から分析し多数決で判定 description: MAGI合議システム - 3つの観点から分析し多数決で判定

View File

@ -5,6 +5,16 @@
# フロー: # フロー:
# plan -> dig -> supervise -> COMPLETE (approved) # plan -> dig -> supervise -> COMPLETE (approved)
# -> plan (rejected: 計画からやり直し) # -> plan (rejected: 計画からやり直し)
#
# テンプレート変数:
# {iteration} - ワークフロー全体のターン数(全エージェントで実行されたステップの合計)
# {max_iterations} - ワークフローの最大イテレーション数
# {step_iteration} - ステップごとのイテレーション数(このステップが何回実行されたか)
# {task} - 元のユーザー要求
# {previous_response} - 前のステップの出力
# {git_diff} - 現在のコミットされていない変更git diff
# {user_inputs} - ワークフロー中に蓄積されたユーザー入力
# {report_dir} - レポートディレクトリ名(例: "20250126-143052-task-summary"
name: research name: research
description: 調査ワークフロー - 質問せずに自律的に調査を実行 description: 調査ワークフロー - 質問せずに自律的に調査を実行
@ -49,7 +59,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## ワークフロー状況 ## ワークフロー状況
- イテレーション: {iteration}/{max_iterations} - イテレーション: {iteration}/{max_iterations}(ワークフロー全体)
- ステップ実行回数: {step_iteration}(このステップの実行回数)
- ステップ: plan - ステップ: plan
## 調査依頼 ## 調査依頼
@ -111,7 +122,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## ワークフロー状況 ## ワークフロー状況
- イテレーション: {iteration}/{max_iterations} - イテレーション: {iteration}/{max_iterations}(ワークフロー全体)
- ステップ実行回数: {step_iteration}(このステップの実行回数)
- ステップ: dig - ステップ: dig
## 元の調査依頼 ## 元の調査依頼
@ -188,7 +200,8 @@ steps:
``` ```
instruction_template: | instruction_template: |
## ワークフロー状況 ## ワークフロー状況
- イテレーション: {iteration}/{max_iterations} - イテレーション: {iteration}/{max_iterations}(ワークフロー全体)
- ステップ実行回数: {step_iteration}(このステップの実行回数)
- ステップ: supervise (調査品質評価) - ステップ: supervise (調査品質評価)
## 元の調査依頼 ## 元の調査依頼

View File

@ -82,7 +82,7 @@ export function getBuiltinStatusPatterns(_agentType: string): Record<string, str
/** Determine status from result */ /** Determine status from result */
function determineStatus( function determineStatus(
result: { success: boolean; interrupted?: boolean; content: string }, result: { success: boolean; interrupted?: boolean; content: string; fullContent?: string },
patterns: Record<string, string> patterns: Record<string, string>
): Status { ): Status {
if (!result.success) { if (!result.success) {
@ -92,7 +92,10 @@ function determineStatus(
} }
return 'blocked'; return 'blocked';
} }
return detectStatus(result.content, patterns); // Use fullContent for status detection (contains all assistant messages)
// Fall back to content if fullContent is not available
const textForStatusDetection = result.fullContent || result.content;
return detectStatus(textForStatusDetection, patterns);
} }
/** Call Claude with an agent prompt */ /** Call Claude with an agent prompt */

View File

@ -179,6 +179,7 @@ export async function executeClaudeQuery(
success, success,
content: finalContent.trim(), content: finalContent.trim(),
sessionId, sessionId,
fullContent: accumulatedAssistantText.trim(),
}; };
} catch (error) { } catch (error) {
unregisterQuery(queryId); unregisterQuery(queryId);

View File

@ -104,6 +104,8 @@ export interface ClaudeResult {
sessionId?: string; sessionId?: string;
error?: string; error?: string;
interrupted?: boolean; interrupted?: boolean;
/** All assistant text accumulated during execution (for status detection) */
fullContent?: string;
} }
/** Extended result with query ID for concurrent execution */ /** Extended result with query ID for concurrent execution */

View File

@ -115,6 +115,8 @@ export interface WorkflowState {
stepOutputs: Map<string, AgentResponse>; stepOutputs: Map<string, AgentResponse>;
userInputs: string[]; userInputs: string[];
agentSessions: Map<string, string>; agentSessions: Map<string, string>;
/** Per-step iteration counters (how many times each step has been executed) */
stepIterations: Map<string, number>;
status: 'running' | 'completed' | 'aborted'; status: 'running' | 'completed' | 'aborted';
} }

View File

@ -22,6 +22,7 @@ import {
createInitialState, createInitialState,
addUserInput, addUserInput,
getPreviousOutput, getPreviousOutput,
incrementStepIteration,
} from './state-manager.js'; } from './state-manager.js';
import { generateReportDir } from '../utils/session.js'; import { generateReportDir } from '../utils/session.js';
@ -117,11 +118,12 @@ export class WorkflowEngine extends EventEmitter {
} }
/** Build instruction from template */ /** Build instruction from template */
private buildInstruction(step: WorkflowStep): string { private buildInstruction(step: WorkflowStep, stepIteration: number): string {
return buildInstructionFromTemplate(step, { return buildInstructionFromTemplate(step, {
task: this.task, task: this.task,
iteration: this.state.iteration, iteration: this.state.iteration,
maxIterations: this.config.maxIterations, maxIterations: this.config.maxIterations,
stepIteration,
cwd: this.cwd, cwd: this.cwd,
userInputs: this.state.userInputs, userInputs: this.state.userInputs,
previousOutput: getPreviousOutput(this.state), previousOutput: getPreviousOutput(this.state),
@ -140,7 +142,9 @@ export class WorkflowEngine extends EventEmitter {
/** Run a single step */ /** Run a single step */
private async runStep(step: WorkflowStep): Promise<AgentResponse> { private async runStep(step: WorkflowStep): Promise<AgentResponse> {
const instruction = this.buildInstruction(step); // Increment step iteration counter before building instruction
const stepIteration = incrementStepIteration(this.state, step.name);
const instruction = this.buildInstruction(step, stepIteration);
const sessionId = this.state.agentSessions.get(step.agent); const sessionId = this.state.agentSessions.get(step.agent);
const agentOptions: RunAgentOptions = { const agentOptions: RunAgentOptions = {

View File

@ -14,10 +14,12 @@ import { getGitDiff } from '../agents/runner.js';
export interface InstructionContext { export interface InstructionContext {
/** The main task/prompt */ /** The main task/prompt */
task: string; task: string;
/** Current iteration number */ /** Current iteration number (workflow-wide turn count) */
iteration: number; iteration: number;
/** Maximum iterations allowed */ /** Maximum iterations allowed */
maxIterations: number; maxIterations: number;
/** Current step's iteration number (how many times this step has been executed) */
stepIteration: number;
/** Working directory */ /** Working directory */
cwd: string; cwd: string;
/** User inputs accumulated during workflow */ /** User inputs accumulated during workflow */
@ -40,8 +42,9 @@ function escapeTemplateChars(str: string): string {
* *
* Supported placeholders: * Supported placeholders:
* - {task} - The main task/prompt * - {task} - The main task/prompt
* - {iteration} - Current iteration number * - {iteration} - Current iteration number (workflow-wide turn count)
* - {max_iterations} - Maximum iterations allowed * - {max_iterations} - Maximum iterations allowed
* - {step_iteration} - Current step's iteration number (how many times this step has been executed)
* - {previous_response} - Output from previous step (if passPreviousResponse is true) * - {previous_response} - Output from previous step (if passPreviousResponse is true)
* - {git_diff} - Current git diff output * - {git_diff} - Current git diff output
* - {user_inputs} - Accumulated user inputs * - {user_inputs} - Accumulated user inputs
@ -56,9 +59,10 @@ export function buildInstruction(
// Replace {task} // Replace {task}
instruction = instruction.replace(/\{task\}/g, escapeTemplateChars(context.task)); instruction = instruction.replace(/\{task\}/g, escapeTemplateChars(context.task));
// Replace {iteration} and {max_iterations} // Replace {iteration}, {max_iterations}, and {step_iteration}
instruction = instruction.replace(/\{iteration\}/g, String(context.iteration)); instruction = instruction.replace(/\{iteration\}/g, String(context.iteration));
instruction = instruction.replace(/\{max_iterations\}/g, String(context.maxIterations)); instruction = instruction.replace(/\{max_iterations\}/g, String(context.maxIterations));
instruction = instruction.replace(/\{step_iteration\}/g, String(context.stepIteration));
// Replace {previous_response} // Replace {previous_response}
if (step.passPreviousResponse) { if (step.passPreviousResponse) {

View File

@ -39,10 +39,21 @@ export function createInitialState(
stepOutputs: new Map(), stepOutputs: new Map(),
userInputs, userInputs,
agentSessions, agentSessions,
stepIterations: new Map(),
status: 'running', status: 'running',
}; };
} }
/**
* Increment the iteration counter for a step and return the new value.
*/
export function incrementStepIteration(state: WorkflowState, stepName: string): number {
const current = state.stepIterations.get(stepName) ?? 0;
const next = current + 1;
state.stepIterations.set(stepName, next);
return next;
}
/** /**
* Add user input to state with truncation and limit handling. * Add user input to state with truncation and limit handling.
*/ */