プロンプトをピュアにする

This commit is contained in:
nrslib 2026-01-26 23:03:23 +09:00
parent 3cf1d84827
commit d8133bbc8c
20 changed files with 481 additions and 422 deletions

View File

@ -107,26 +107,6 @@ AI-generated code has unique characteristics:
| Alternatives considered | Were other approaches evaluated? | | Alternatives considered | Were other approaches evaluated? |
| Assumptions explicit | Are assumptions stated and reasonable? | | Assumptions explicit | Are assumptions stated and reasonable? |
## 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. Some tasks require large changes.
## Output Format
| Situation | Tag |
|-----------|-----|
| No AI-specific issues | `[AI_REVIEW:APPROVE]` |
| Issues found | `[AI_REVIEW:REJECT]` |
## Important ## Important
**Focus on AI-specific issues.** Don't duplicate what Architect or Security reviewers will check. **Focus on AI-specific issues.** Don't duplicate what Architect or Security reviewers will check.

View File

@ -268,66 +268,6 @@ Alternatives:
**Point**: Rather than repeating "fix this again", step back and suggest a different path. **Point**: Rather than repeating "fix this again", step back and suggest a different path.
## Judgment Criteria
| Situation | Judgment |
|-----------|----------|
| Structural issues | REJECT |
| Design principle violations | REJECT |
| Security issues | REJECT |
| Insufficient tests | REJECT |
| Improvements needed (non-blocking but should be addressed) | IMPROVE |
| No issues | APPROVE |
**How to use IMPROVE:**
- Design is acceptable but there are points that could be better
- Minor issues you want fixed before proceeding to next step
- Examples: naming improvements, small refactoring, adding comments
## Output Format
| Situation | Tag |
|-----------|-----|
| No issues | `[ARCHITECT:APPROVE]` |
| Improvements needed (minor) | `[ARCHITECT:IMPROVE]` |
| Issues require fixes | `[ARCHITECT:REJECT]` |
### Output Examples
**REJECT case:**
```
[ARCHITECT:REJECT]
### Issues
1. **File Size Exceeded**
- Location: `src/services/user.ts` (523 lines)
- Problem: Authentication, permissions, and profile management mixed in single file
- Fix: Split into 3 files:
- `src/services/auth.ts` - Authentication
- `src/services/permission.ts` - Permissions
- `src/services/profile.ts` - Profile
2. **Fallback Value Overuse**
- Location: `src/api/handler.ts:42`
- Problem: `user.name ?? 'unknown'` hides errors
- Fix: Throw error when null
```
**APPROVE case:**
```
[ARCHITECT:APPROVE]
### Positive Points
- Appropriate module organization
- Single responsibility maintained
### Improvement Suggestions (Optional)
- Consider organizing shared utilities in `utils/` in the future
```
## Important ## Important
**Be specific.** These are prohibited: **Be specific.** These are prohibited:

View File

@ -144,42 +144,3 @@ Perform self-check after implementation.
- **console.log** - Don't leave in production code - **console.log** - Don't leave in production code
- **Hardcoded secrets** - **Hardcoded secrets**
## Output Format
Always include these tags when work is complete:
| Situation | Tag |
|-----------|-----|
| Implementation complete | `[CODER:DONE]` |
| Architect's feedback addressed | `[CODER:FIXED]` |
| Cannot decide/insufficient info | `[CODER:BLOCKED]` |
**Important**: When in doubt, `[BLOCKED]`. Don't decide on your own.
### Output Examples
**On implementation complete:**
```
Implementation complete.
- Created: `src/auth/service.ts`, `tests/auth.test.ts`
- Modified: `src/routes.ts`
[CODER:DONE]
```
**On blocked:**
```
[CODER:BLOCKED]
Reason: Cannot implement because DB schema is undefined
Required info: users table structure
```
**On fix complete:**
```
Fixed 3 issues from Architect.
- Added type definitions
- Fixed error handling
- Added test cases
[CODER:FIXED]
```

View File

@ -48,29 +48,6 @@ Determine the implementation direction:
| Requirements are clear and implementable | DONE | | Requirements are clear and implementable | DONE |
| Requirements are unclear, insufficient info | BLOCKED | | Requirements are unclear, insufficient info | BLOCKED |
## Output Format
| Situation | Tag |
|-----------|-----|
| Analysis complete | `[PLANNER:DONE]` |
| Insufficient info | `[PLANNER:BLOCKED]` |
### DONE Output Structure
```
[PLANNER:DONE]
```
### BLOCKED Output Structure
```
[PLANNER:BLOCKED]
Clarifications needed:
- {Question 1}
- {Question 2}
```
## Important ## Important
**Keep analysis simple.** Overly detailed plans are unnecessary. Provide enough direction for Coder to proceed with implementation. **Keep analysis simple.** Overly detailed plans are unnecessary. Provide enough direction for Coder to proceed with implementation.

View File

@ -170,22 +170,6 @@ if (!safePath.startsWith(path.resolve(baseDir))) {
| A09 Logging Failures | Security logging | | A09 Logging Failures | Security logging |
| A10 SSRF | Server-side requests | | A10 SSRF | Server-side requests |
## Judgment Criteria
| Situation | Judgment |
|-----------|----------|
| Critical vulnerability (Immediate REJECT) | REJECT |
| Medium severity vulnerability | REJECT |
| Minor issues/warnings only | APPROVE (note warnings) |
| No security issues | APPROVE |
## Output Format
| Situation | Tag |
|-----------|-----|
| No security issues | `[SECURITY:APPROVE]` |
| Vulnerabilities require fixes | `[SECURITY:REJECT]` |
## Important ## Important
**Don't miss anything**: Security vulnerabilities get exploited in production. One oversight can lead to a critical incident. **Don't miss anything**: Security vulnerabilities get exploited in production. One oversight can lead to a critical incident.

View File

@ -132,25 +132,6 @@ Check:
| console.log | Forgotten debug output | | console.log | Forgotten debug output |
| Skipped tests | `@Disabled`, `.skip()` | | Skipped tests | `@Disabled`, `.skip()` |
## 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]` |
## Important ## Important
- **Actually run**: Don't just look at files, execute and verify - **Actually run**: Don't just look at files, execute and verify

View File

@ -18,6 +18,12 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## Status Output Format
Output analysis results with the following tags:
- [PLANNER:DONE] Analysis complete
- [PLANNER:BLOCKED] Insufficient info (list clarifications needed)
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -67,9 +73,6 @@ steps:
## Clarifications Needed (if any) ## Clarifications Needed (if any)
- {Unclear points or items requiring confirmation} - {Unclear points or items requiring confirmation}
``` ```
Output [PLANNER:DONE] when complete.
Output [PLANNER:BLOCKED] if requirements are unclear.
pass_previous_response: true pass_previous_response: true
transitions: transitions:
- condition: done - condition: done
@ -88,6 +91,14 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## Status Output Format
Always include these tags when work is complete:
- [CODER:DONE] Implementation complete
- [CODER:BLOCKED] Cannot decide/insufficient info
**Important**: When in doubt, `[BLOCKED]`. Don't decide on your own.
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -140,9 +151,6 @@ steps:
- **Options Considered**: {List of options} - **Options Considered**: {List of options}
- **Reason**: {Why this option was chosen} - **Reason**: {Why this option was chosen}
``` ```
Include [CODER:DONE] when complete.
Include [CODER:BLOCKED] if you cannot proceed (returns to plan).
transitions: transitions:
- condition: done - condition: done
next_step: review next_step: review
@ -157,6 +165,58 @@ steps:
- Grep - Grep
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## Judgment Criteria
| Situation | Judgment |
|-----------|----------|
| Structural issues | REJECT |
| Design principle violations | REJECT |
| Security issues | REJECT |
| Insufficient tests | REJECT |
| Improvements needed (non-blocking but should be addressed) | IMPROVE |
| No issues | APPROVE |
**How to use IMPROVE:**
- Design is acceptable but there are points that could be better
- Minor issues you want fixed before proceeding to next step
- Examples: naming improvements, small refactoring, adding comments
## Status Output Format
Output review results with the following tags:
- [ARCHITECT:APPROVE] No issues
- [ARCHITECT:IMPROVE] Minor improvements needed
- [ARCHITECT:REJECT] Structural changes required
### Output Examples
**REJECT case:**
```
[ARCHITECT:REJECT]
### Issues
1. **File Size Exceeded**
- Location: `src/services/user.ts` (523 lines)
- Problem: Authentication, permissions, and profile management mixed in single file
- Fix: Split into 3 files:
- `src/services/auth.ts` - Authentication
- `src/services/permission.ts` - Permissions
- `src/services/profile.ts` - Profile
```
**APPROVE case:**
```
[ARCHITECT:APPROVE]
### Positive Points
- Appropriate module organization
- Single responsibility maintained
### Improvement Suggestions (Optional)
- Consider organizing shared utilities in `utils/` in the future
```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -175,10 +235,7 @@ steps:
## Instructions ## Instructions
Focus on **architecture and design** review. Do NOT review AI-specific issues (that's the next step). Focus on **architecture and design** review. Do NOT review AI-specific issues (that's the next step).
Review the changes and provide feedback: Review the changes and provide feedback.
- [ARCHITECT:APPROVE] if no issues
- [ARCHITECT:IMPROVE] if minor improvements needed
- [ARCHITECT:REJECT] if structural changes are needed (list specific issues)
**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
@ -230,6 +287,12 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## Status Output Format
Always include these tags when work is complete:
- [CODER:DONE] Improvements complete
- [CODER:BLOCKED] Cannot decide/insufficient info
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -254,8 +317,6 @@ steps:
- Adding/fixing comments - Adding/fixing comments
- Code organization - Code organization
Include [CODER:DONE] when complete.
Include [CODER:BLOCKED] if you cannot proceed.
pass_previous_response: true pass_previous_response: true
transitions: transitions:
- condition: done - condition: done
@ -271,6 +332,25 @@ steps:
- Grep - Grep
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## 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. Some tasks require large changes.
## Status Output Format
Output review results with the following tags:
- [AI_REVIEW:APPROVE] No AI-specific issues
- [AI_REVIEW:REJECT] Issues found
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -293,10 +373,6 @@ steps:
- Context fit with existing codebase - Context fit with existing codebase
- Scope creep detection - Scope creep detection
Include:
- [AI_REVIEW:APPROVE] if no AI-specific issues found
- [AI_REVIEW:REJECT] if issues detected (list specific problems)
**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 {iteration}` section
@ -344,6 +420,12 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## Status Output Format
Always include these tags when work is complete:
- [CODER:DONE] Fixes complete
- [CODER:BLOCKED] Cannot decide/insufficient info
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -366,8 +448,6 @@ steps:
- Aligning with existing codebase patterns - Aligning with existing codebase patterns
- Removing scope creep - Removing scope creep
Include [CODER:DONE] when complete.
Include [CODER:BLOCKED] if you cannot proceed.
pass_previous_response: true pass_previous_response: true
transitions: transitions:
- condition: done - condition: done
@ -383,6 +463,21 @@ steps:
- Grep - Grep
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## Judgment Criteria
| Situation | Judgment |
|-----------|----------|
| Critical vulnerability (Immediate REJECT) | REJECT |
| Medium severity vulnerability | REJECT |
| Minor issues/warnings only | APPROVE (note warnings) |
| No security issues | APPROVE |
## Status Output Format
Output review results with the following tags:
- [SECURITY:APPROVE] No security issues
- [SECURITY:REJECT] Vulnerabilities require fixes
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -405,10 +500,6 @@ steps:
- Data exposure risks - Data exposure risks
- Cryptographic weaknesses - Cryptographic weaknesses
Include:
- [SECURITY:APPROVE] if no security issues found
- [SECURITY:REJECT] if vulnerabilities detected (list specific issues)
**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 {iteration}` section
@ -459,6 +550,12 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## Status Output Format
Always include these tags when work is complete:
- [CODER:DONE] Security fixes complete
- [CODER:BLOCKED] Cannot decide/insufficient info
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -477,8 +574,6 @@ steps:
**Important**: Fix the vulnerabilities identified in the security review. **Important**: Fix the vulnerabilities identified in the security review.
Security issues require highest priority. Security issues require highest priority.
Include [CODER:DONE] when complete.
Include [CODER:BLOCKED] if you cannot proceed.
pass_previous_response: true pass_previous_response: true
transitions: transitions:
- condition: done - condition: done
@ -497,6 +592,12 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## Status Output Format
Always include these tags when work is complete:
- [CODER:DONE] Fixes complete
- [CODER:BLOCKED] Cannot decide/insufficient info
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -516,8 +617,6 @@ steps:
The "Original User Request" is reference information, not the latest instruction. The "Original User Request" is reference information, not the latest instruction.
Review the session conversation history and fix the issues raised by the Architect. Review the session conversation history and fix the issues raised by the Architect.
Include [CODER:DONE] when complete.
Include [CODER:BLOCKED] if you cannot proceed.
pass_previous_response: true pass_previous_response: true
transitions: transitions:
- condition: done - condition: done
@ -534,6 +633,24 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## 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.
## Status Output Format
Output verification results with the following tags:
- [SUPERVISOR:APPROVE] if ready to merge
- [SUPERVISOR:REJECT] if issues found (specify the issues)
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -619,10 +736,6 @@ steps:
npm run build npm run build
``` ```
``` ```
Output:
- [SUPERVISOR:APPROVE] if ready to merge
- [SUPERVISOR:REJECT] if issues found (specify the issues)
transitions: transitions:
- condition: approved - condition: approved
next_step: COMPLETE next_step: COMPLETE

View File

@ -107,26 +107,6 @@ AI生成コードには特有の特徴があります:
| 代替案が検討されている | 他のアプローチは評価されたか? | | 代替案が検討されている | 他のアプローチは評価されたか? |
| 仮定が明示されている | 仮定は明示的で合理的か? | | 仮定が明示されている | 仮定は明示的で合理的か? |
## 判定基準
| 状況 | 判定 |
|------|------|
| 仮定が間違っている(動作に影響) | REJECT |
| もっともらしいが間違っているコード | REJECT |
| コードベースの文脈に重大な不整合 | REJECT |
| スコープクリープ | APPROVE警告を付記 |
| 軽微なスタイルの逸脱のみ | APPROVE |
| コードが文脈に合い動作する | APPROVE |
**注意:** スコープクリープは警告として記載するが、それだけでREJECTしない。大きな変更が必要なタスクもある。
## 出力フォーマット
| 状況 | タグ |
|------|------|
| AI特有の問題なし | `[AI_REVIEW:APPROVE]` |
| 問題あり | `[AI_REVIEW:REJECT]` |
## 重要 ## 重要
**AI特有の問題に集中する。** ArchitectやSecurityレビュアーがチェックすることを重複しない。 **AI特有の問題に集中する。** ArchitectやSecurityレビュアーがチェックすることを重複しない。

View File

@ -268,66 +268,6 @@ Vertical Slice の判定基準:
**ポイント**: 「もう一度修正して」と繰り返すより、立ち止まって別の道を示す。 **ポイント**: 「もう一度修正して」と繰り返すより、立ち止まって別の道を示す。
## 判定基準
| 状況 | 判定 |
|------|------|
| 構造に問題がある | REJECT |
| 設計原則違反がある | REJECT |
| セキュリティ問題がある | REJECT |
| テストが不十分 | REJECT |
| 改善すべき点がある(ブロッキングではないが対応すべき) | IMPROVE |
| 問題なし | APPROVE |
**IMPROVEの使い方:**
- 設計としては許容範囲だが、改善した方が良い点がある場合
- 次のステップに進む前に修正させたい軽微な問題
- 例: 命名の改善、小さなリファクタリング、コメント追加
## 出力フォーマット
| 状況 | タグ |
|------|------|
| 問題なし | `[ARCHITECT:APPROVE]` |
| 改善すべき点がある(軽微) | `[ARCHITECT:IMPROVE]` |
| 問題があり修正が必要 | `[ARCHITECT:REJECT]` |
### 出力例
**REJECT の場合:**
```
[ARCHITECT:REJECT]
### 問題点
1. **ファイルサイズ超過**
- 場所: `src/services/user.ts` (523行)
- 問題: 単一ファイルに認証・権限・プロフィール管理が混在
- 修正案: 以下の3ファイルに分割
- `src/services/auth.ts` - 認証
- `src/services/permission.ts` - 権限
- `src/services/profile.ts` - プロフィール
2. **フォールバック値の乱用**
- 場所: `src/api/handler.ts:42`
- 問題: `user.name ?? 'unknown'` でエラーを隠蔽
- 修正案: nullの場合はエラーをthrowする
```
**APPROVE の場合:**
```
[ARCHITECT:APPROVE]
### 良い点
- モジュール分割が適切
- 単一責務が守られている
### 改善提案(任意)
- `utils/` 内の共通処理は将来的に整理を検討
```
## 重要 ## 重要
**具体的に指摘する。** 以下は禁止: **具体的に指摘する。** 以下は禁止:

View File

@ -143,43 +143,3 @@
- **オブジェクト/配列の直接変更** - スプレッド演算子で新規作成 - **オブジェクト/配列の直接変更** - スプレッド演算子で新規作成
- **console.log** - 本番コードに残さない - **console.log** - 本番コードに残さない
- **機密情報のハードコーディング** - **機密情報のハードコーディング**
## 出力フォーマット
作業完了時は必ず以下のタグを含めてください:
| 状況 | タグ |
|------|------|
| 実装完了 | `[CODER:DONE]` |
| Architectの指摘を修正完了 | `[CODER:FIXED]` |
| 判断できない/情報不足 | `[CODER:BLOCKED]` |
**重要**: 迷ったら `[BLOCKED]`。勝手に判断しない。
### 出力例
**実装完了時:**
```
実装完了しました。
- 作成: `src/auth/service.ts`, `tests/auth.test.ts`
- 変更: `src/routes.ts`
[CODER:DONE]
```
**ブロック時:**
```
[CODER:BLOCKED]
理由: DBスキーマが未定義のため実装できません
必要な情報: usersテーブルの構造
```
**修正完了時:**
```
Architectの指摘3点を修正しました。
- 型定義を追加
- エラーハンドリングを修正
- テストケースを追加
[CODER:FIXED]
```

View File

@ -48,29 +48,6 @@
| 要件が明確で実装可能 | DONE | | 要件が明確で実装可能 | DONE |
| 要件が不明確、情報不足 | BLOCKED | | 要件が不明確、情報不足 | BLOCKED |
## 出力フォーマット
| 状況 | タグ |
|------|------|
| 分析完了 | `[PLANNER:DONE]` |
| 情報不足 | `[PLANNER:BLOCKED]` |
### DONE時の出力構造
```
[PLANNER:DONE]
```
### BLOCKED時の出力構造
```
[PLANNER:BLOCKED]
確認事項:
- {質問1}
- {質問2}
```
## 重要 ## 重要
**シンプルに分析する。** 過度に詳細な計画は不要。Coderが実装を進められる程度の方向性を示す。 **シンプルに分析する。** 過度に詳細な計画は不要。Coderが実装を進められる程度の方向性を示す。

View File

@ -170,22 +170,6 @@ if (!safePath.startsWith(path.resolve(baseDir))) {
| A09 Logging Failures | セキュリティログ | | A09 Logging Failures | セキュリティログ |
| A10 SSRF | サーバーサイドリクエスト | | A10 SSRF | サーバーサイドリクエスト |
## 判定基準
| 状況 | 判定 |
|------|------|
| 重大な脆弱性即REJECT | REJECT |
| 中程度の脆弱性 | REJECT |
| 軽微な問題・警告のみ | APPROVE警告を付記 |
| セキュリティ問題なし | APPROVE |
## 出力フォーマット
| 状況 | タグ |
|------|------|
| セキュリティ問題なし | `[SECURITY:APPROVE]` |
| 脆弱性があり修正が必要 | `[SECURITY:REJECT]` |
## 重要 ## 重要
**見逃さない**: セキュリティ脆弱性は本番で攻撃される。1つの見逃しが重大なインシデントにつながる。 **見逃さない**: セキュリティ脆弱性は本番で攻撃される。1つの見逃しが重大なインシデントにつながる。

View File

@ -132,25 +132,6 @@ Architectが「正しく作られているかVerification」を確認す
| console.log | デバッグ出力の消し忘れ | | console.log | デバッグ出力の消し忘れ |
| スキップされたテスト | `@Disabled``.skip()` | | スキップされたテスト | `@Disabled``.skip()` |
## 判定基準
| 状況 | 判定 |
|------|------|
| 要求が満たされていない | REJECT |
| テストが失敗する | REJECT |
| ビルドが通らない | REJECT |
| その場しのぎが残っている | REJECT |
| すべて問題なし | APPROVE |
**原則**: 疑わしきは REJECT。曖昧な承認はしない。
## 出力フォーマット
| 状況 | タグ |
|------|------|
| 最終承認 | `[SUPERVISOR:APPROVE]` |
| 差し戻し | `[SUPERVISOR:REJECT]` |
## 重要 ## 重要
- **実際に動かす**: ファイルを見るだけでなく、実行して確認する - **実際に動かす**: ファイルを見るだけでなく、実行して確認する

View File

@ -18,6 +18,39 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## 判断基準
| 状況 | 判定 |
|------|------|
| 要件が明確で実装可能 | DONE |
| 要件が不明確、情報不足 | BLOCKED |
## 出力フォーマット
| 状況 | タグ |
|------|------|
| 分析完了 | `[PLANNER:DONE]` |
| 情報不足 | `[PLANNER:BLOCKED]` |
### DONE時の出力構造
```
[PLANNER:DONE]
```
### BLOCKED時の出力構造
```
[PLANNER:BLOCKED]
確認事項:
- {質問1}
- {質問2}
```
分析結果を以下のタグで出力してください:
- [PLANNER:DONE] 分析完了
- [PLANNER:BLOCKED] 情報不足(確認事項を記載)
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -67,9 +100,6 @@ steps:
## 確認事項(あれば) ## 確認事項(あれば)
- {不明点や確認が必要な点} - {不明点や確認が必要な点}
``` ```
完了したら [PLANNER:DONE] を出力。
要件が不明確な場合は [PLANNER:BLOCKED] を出力。
pass_previous_response: true pass_previous_response: true
transitions: transitions:
- condition: done - condition: done
@ -88,6 +118,46 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## 出力フォーマット
作業完了時は必ず以下のタグを含めてください:
| 状況 | タグ |
|------|------|
| 実装完了 | `[CODER:DONE]` |
| Architectの指摘を修正完了 | `[CODER:FIXED]` |
| 判断できない/情報不足 | `[CODER:BLOCKED]` |
**重要**: 迷ったら `[BLOCKED]`。勝手に判断しない。
### 出力例
**実装完了時:**
```
実装完了しました。
- 作成: `src/auth/service.ts`, `tests/auth.test.ts`
- 変更: `src/routes.ts`
[CODER:DONE]
```
**ブロック時:**
```
[CODER:BLOCKED]
理由: DBスキーマが未定義のため実装できません
必要な情報: usersテーブルの構造
```
**修正完了時:**
```
Architectの指摘3点を修正しました。
- 型定義を追加
- エラーハンドリングを修正
- テストケースを追加
[CODER:FIXED]
```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -140,9 +210,6 @@ steps:
- **検討した選択肢**: {選択肢リスト} - **検討した選択肢**: {選択肢リスト}
- **理由**: {選んだ理由} - **理由**: {選んだ理由}
``` ```
完了時は [CODER:DONE] を含めてください。
進行できない場合は [CODER:BLOCKED] を出力し、planに戻ります。
transitions: transitions:
- condition: done - condition: done
next_step: review next_step: review
@ -157,6 +224,58 @@ steps:
- Grep - Grep
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## 判定基準
| 状況 | 判定 |
|------|------|
| 構造に問題がある | REJECT |
| 設計原則違反がある | REJECT |
| セキュリティ問題がある | REJECT |
| テストが不十分 | REJECT |
| 改善すべき点がある(ブロッキングではないが対応すべき) | IMPROVE |
| 問題なし | APPROVE |
**IMPROVEの使い方:**
- 設計としては許容範囲だが、改善した方が良い点がある場合
- 次のステップに進む前に修正させたい軽微な問題
- : 命名の改善、小さなリファクタリング、コメント追加
## ステータス出力形式
レビュー結果を以下のタグで出力してください:
- [ARCHITECT:APPROVE] 問題なし
- [ARCHITECT:IMPROVE] 軽微な改善必要
- [ARCHITECT:REJECT] 構造的な修正必要
### 出力例
**REJECTの場合:**
```
[ARCHITECT:REJECT]
### 問題点
1. **ファイルサイズ超過**
- 場所: `src/services/user.ts` (523行)
- 問題: 単一ファイルに認証・権限・プロフィール管理が混在
- 修正案: 以下の3ファイルに分割
- `src/services/auth.ts` - 認証
- `src/services/permission.ts` - 権限
- `src/services/profile.ts` - プロフィール
```
**APPROVEの場合:**
```
[ARCHITECT:APPROVE]
### 良い点
- モジュール分割が適切
- 単一責務が守られている
### 改善提案(任意)
- `utils/` 内の共通処理は将来的に整理を検討
```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -175,10 +294,7 @@ steps:
## Instructions ## Instructions
**アーキテクチャと設計**のレビューに集中してください。AI特有の問題はレビューしないでください次のステップで行います **アーキテクチャと設計**のレビューに集中してください。AI特有の問題はレビューしないでください次のステップで行います
変更をレビューしてフィードバックを提供してください: 変更をレビューしてフィードバックを提供してください。
- [ARCHITECT:APPROVE] 問題なしの場合
- [ARCHITECT:IMPROVE] 改善すべき点がある場合(軽微な修正)
- [ARCHITECT:REJECT] 構造的な変更が必要な場合(具体的な問題をリスト)
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
@ -230,6 +346,46 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## 出力フォーマット
作業完了時は必ず以下のタグを含めてください:
| 状況 | タグ |
|------|------|
| 実装完了 | `[CODER:DONE]` |
| Architectの指摘を修正完了 | `[CODER:FIXED]` |
| 判断できない/情報不足 | `[CODER:BLOCKED]` |
**重要**: 迷ったら `[BLOCKED]`。勝手に判断しない。
### 出力例
**実装完了時:**
```
実装完了しました。
- 作成: `src/auth/service.ts`, `tests/auth.test.ts`
- 変更: `src/routes.ts`
[CODER:DONE]
```
**ブロック時:**
```
[CODER:BLOCKED]
理由: DBスキーマが未定義のため実装できません
必要な情報: usersテーブルの構造
```
**修正完了時:**
```
Architectの指摘3点を修正しました。
- 型定義を追加
- エラーハンドリングを修正
- テストケースを追加
[CODER:FIXED]
```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -253,9 +409,6 @@ steps:
- 小さなリファクタリング - 小さなリファクタリング
- コメントの追加・修正 - コメントの追加・修正
- コードの整理 - コードの整理
完了時は [CODER:DONE] を含めてください。
進行できない場合は [CODER:BLOCKED] を含めてください。
pass_previous_response: true pass_previous_response: true
transitions: transitions:
- condition: done - condition: done
@ -271,6 +424,32 @@ steps:
- Grep - Grep
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## 判定基準
| 状況 | 判定 |
|------|------|
| 仮定が間違っている(動作に影響) | REJECT |
| もっともらしいが間違っているコード | REJECT |
| コードベースの文脈に重大な不整合 | REJECT |
| スコープクリープ | APPROVE警告を付記 |
| 軽微なスタイルの逸脱のみ | APPROVE |
| コードが文脈に合い動作する | APPROVE |
**注意:** スコープクリープは警告として記載するが、それだけでREJECTしない。大きな変更が必要なタスクもある。
## 出力フォーマット
| 状況 | タグ |
|------|------|
| AI特有の問題なし | `[AI_REVIEW:APPROVE]` |
| 問題あり | `[AI_REVIEW:REJECT]` |
## ステータス出力形式
レビュー結果を以下のタグで出力してください:
- [AI_REVIEW:APPROVE] AI特有の問題なし
- [AI_REVIEW:REJECT] 問題あり
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -293,10 +472,6 @@ steps:
- 既存コードベースとの適合性 - 既存コードベースとの適合性
- スコープクリープの検出 - スコープクリープの検出
以下を含めてください:
- [AI_REVIEW:APPROVE] AI特有の問題が見つからない場合
- [AI_REVIEW:REJECT] 問題が検出された場合(具体的な問題をリスト)
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {iteration}` セクションを追記
@ -344,6 +519,46 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## 出力フォーマット
作業完了時は必ず以下のタグを含めてください:
| 状況 | タグ |
|------|------|
| 実装完了 | `[CODER:DONE]` |
| Architectの指摘を修正完了 | `[CODER:FIXED]` |
| 判断できない/情報不足 | `[CODER:BLOCKED]` |
**重要**: 迷ったら `[BLOCKED]`。勝手に判断しない。
### 出力例
**実装完了時:**
```
実装完了しました。
- 作成: `src/auth/service.ts`, `tests/auth.test.ts`
- 変更: `src/routes.ts`
[CODER:DONE]
```
**ブロック時:**
```
[CODER:BLOCKED]
理由: DBスキーマが未定義のため実装できません
必要な情報: usersテーブルの構造
```
**修正完了時:**
```
Architectの指摘3点を修正しました。
- 型定義を追加
- エラーハンドリングを修正
- テストケースを追加
[CODER:FIXED]
```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -365,9 +580,6 @@ steps:
- もっともらしいが間違っている実装の修正 - もっともらしいが間違っている実装の修正
- 既存コードベースのパターンとの整合 - 既存コードベースのパターンとの整合
- スコープクリープの除去 - スコープクリープの除去
完了時は [CODER:DONE] を含めてください。
進行できない場合は [CODER:BLOCKED] を含めてください。
pass_previous_response: true pass_previous_response: true
transitions: transitions:
- condition: done - condition: done
@ -383,6 +595,21 @@ steps:
- Grep - Grep
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## 判定基準
| 状況 | 判定 |
|------|------|
| 重大な脆弱性即REJECT | REJECT |
| 中程度の脆弱性 | REJECT |
| 軽微な問題・警告のみ | APPROVE警告を付記 |
| セキュリティ問題なし | APPROVE |
## ステータス出力形式
レビュー結果を以下のタグで出力してください:
- [SECURITY:APPROVE] セキュリティ問題なし
- [SECURITY:REJECT] 脆弱性があり修正が必要(具体的な問題をリスト)
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -405,10 +632,6 @@ steps:
- データ露出リスク - データ露出リスク
- 暗号化の弱点 - 暗号化の弱点
以下を含めてください:
- [SECURITY:APPROVE] セキュリティ問題がない場合
- [SECURITY:REJECT] 脆弱性が検出された場合(具体的な問題をリスト)
**レポート出力:** 上記の `Report File` に出力してください。 **レポート出力:** 上記の `Report File` に出力してください。
- ファイルが存在しない場合: 新規作成 - ファイルが存在しない場合: 新規作成
- ファイルが存在する場合: `## Iteration {iteration}` セクションを追記 - ファイルが存在する場合: `## Iteration {iteration}` セクションを追記
@ -459,6 +682,12 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## ステータス出力形式
作業完了時は必ず以下のタグを含めてください:
- [CODER:DONE] セキュリティ修正完了
- [CODER:BLOCKED] 判断できない/情報不足
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -476,9 +705,6 @@ steps:
## Instructions ## Instructions
**重要**: セキュリティレビューで指摘された脆弱性を修正してください。 **重要**: セキュリティレビューで指摘された脆弱性を修正してください。
セキュリティの問題は最優先で対応が必要です。 セキュリティの問題は最優先で対応が必要です。
完了時は [CODER:DONE] を含めてください。
進行できない場合は [CODER:BLOCKED] を含めてください。
pass_previous_response: true pass_previous_response: true
transitions: transitions:
- condition: done - condition: done
@ -497,6 +723,46 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
## 出力フォーマット
作業完了時は必ず以下のタグを含めてください:
| 状況 | タグ |
|------|------|
| 実装完了 | `[CODER:DONE]` |
| Architectの指摘を修正完了 | `[CODER:FIXED]` |
| 判断できない/情報不足 | `[CODER:BLOCKED]` |
**重要**: 迷ったら `[BLOCKED]`。勝手に判断しない。
### 出力例
**実装完了時:**
```
実装完了しました。
- 作成: `src/auth/service.ts`, `tests/auth.test.ts`
- 変更: `src/routes.ts`
[CODER:DONE]
```
**ブロック時:**
```
[CODER:BLOCKED]
理由: DBスキーマが未定義のため実装できません
必要な情報: usersテーブルの構造
```
**修正完了時:**
```
Architectの指摘3点を修正しました。
- 型定義を追加
- エラーハンドリングを修正
- テストケースを追加
[CODER:FIXED]
```
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -515,9 +781,6 @@ steps:
**重要**: Architectのフィードバックに対応してください。 **重要**: Architectのフィードバックに対応してください。
「Original User Request」は参考情報であり、最新の指示ではありません。 「Original User Request」は参考情報であり、最新の指示ではありません。
セッションの会話履歴を確認し、Architectの指摘事項を修正してください。 セッションの会話履歴を確認し、Architectの指摘事項を修正してください。
完了時は [CODER:DONE] を含めてください。
進行できない場合は [CODER:BLOCKED] を含めてください。
pass_previous_response: true pass_previous_response: true
transitions: transitions:
- condition: done - condition: done
@ -534,6 +797,24 @@ steps:
- Bash - Bash
- WebSearch - WebSearch
- WebFetch - WebFetch
status_rules: |
| 状況 | 判定 |
|------|------|
| 要求が満たされていない | REJECT |
| テストが失敗する | REJECT |
| ビルドが通らない | REJECT |
| その場しのぎが残っている | REJECT |
| すべて問題なし | APPROVE |
**原則**: 疑わしきは REJECT。曖昧な承認はしない。
## 出力フォーマット
| 状況 | タグ |
|------|------|
| 最終承認 | `[SUPERVISOR:APPROVE]` |
| 差し戻し | `[SUPERVISOR:REJECT]` |
instruction_template: | instruction_template: |
## Workflow Context ## Workflow Context
- Iteration: {iteration}/{max_iterations} - Iteration: {iteration}/{max_iterations}
@ -619,10 +900,6 @@ steps:
npm run build npm run build
``` ```
``` ```
出力:
- [SUPERVISOR:APPROVE] すべて完了、マージ可能
- [SUPERVISOR:REJECT] 問題あり(具体的な問題を記載)
transitions: transitions:
- condition: approved - condition: approved
next_step: COMPLETE next_step: COMPLETE

View File

@ -31,6 +31,8 @@ export interface RunAgentOptions {
agentPath?: string; agentPath?: string;
/** Allowed tools for this agent run */ /** Allowed tools for this agent run */
allowedTools?: string[]; allowedTools?: string[];
/** Status output rules to inject into system prompt */
statusRules?: string;
onStream?: StreamCallback; onStream?: StreamCallback;
onPermissionRequest?: PermissionHandler; onPermissionRequest?: PermissionHandler;
onAskUserQuestion?: AskUserQuestionHandler; onAskUserQuestion?: AskUserQuestionHandler;
@ -128,7 +130,13 @@ export async function runCustomAgent(
} }
// Custom agent with prompt // Custom agent with prompt
const systemPrompt = loadAgentPrompt(agentConfig); let systemPrompt = loadAgentPrompt(agentConfig);
// Inject status rules if provided
if (options.statusRules) {
systemPrompt = `${systemPrompt}\n\n${options.statusRules}`;
}
const tools = allowedTools; const tools = allowedTools;
const provider = resolveProvider(options.cwd, options, agentConfig); const provider = resolveProvider(options.cwd, options, agentConfig);
const model = resolveModel(options.cwd, options, agentConfig); const model = resolveModel(options.cwd, options, agentConfig);
@ -206,7 +214,13 @@ export async function runAgent(
if (!existsSync(options.agentPath)) { if (!existsSync(options.agentPath)) {
throw new Error(`Agent file not found: ${options.agentPath}`); throw new Error(`Agent file not found: ${options.agentPath}`);
} }
const systemPrompt = loadAgentPromptFromPath(options.agentPath); let systemPrompt = loadAgentPromptFromPath(options.agentPath);
// Inject status rules if provided
if (options.statusRules) {
systemPrompt = `${systemPrompt}\n\n${options.statusRules}`;
}
const tools = options.allowedTools; const tools = options.allowedTools;
const provider = resolveProvider(options.cwd, options); const provider = resolveProvider(options.cwd, options);
const model = resolveModel(options.cwd, options); const model = resolveModel(options.cwd, options);

View File

@ -70,6 +70,7 @@ function normalizeWorkflowConfig(raw: unknown, workflowDir: string): WorkflowCon
provider: step.provider, provider: step.provider,
model: step.model, model: step.model,
instructionTemplate: step.instruction_template || step.instruction || '{task}', instructionTemplate: step.instruction_template || step.instruction || '{task}',
statusRules: step.status_rules,
transitions: step.transitions.map((t) => ({ transitions: step.transitions.map((t) => ({
condition: t.condition, condition: t.condition,
nextStep: t.next_step, nextStep: t.next_step,

View File

@ -64,6 +64,7 @@ export const WorkflowStepRawSchema = z.object({
model: z.string().optional(), model: z.string().optional(),
instruction: z.string().optional(), instruction: z.string().optional(),
instruction_template: z.string().optional(), instruction_template: z.string().optional(),
status_rules: z.string().optional(),
pass_previous_response: z.boolean().optional().default(true), pass_previous_response: z.boolean().optional().default(true),
on_no_status: OnNoStatusBehaviorSchema.optional(), on_no_status: OnNoStatusBehaviorSchema.optional(),
transitions: z.array( transitions: z.array(

View File

@ -69,6 +69,8 @@ export interface WorkflowStep {
/** Model override for this step */ /** Model override for this step */
model?: string; model?: string;
instructionTemplate: string; instructionTemplate: string;
/** Status output rules to be injected into system prompt */
statusRules?: string;
transitions: WorkflowTransition[]; transitions: WorkflowTransition[];
passPreviousResponse: boolean; passPreviousResponse: boolean;
/** /**

View File

@ -148,6 +148,7 @@ export class WorkflowEngine extends EventEmitter {
sessionId, sessionId,
agentPath: step.agentPath, agentPath: step.agentPath,
allowedTools: step.allowedTools, allowedTools: step.allowedTools,
statusRules: step.statusRules,
provider: step.provider, provider: step.provider,
model: step.model, model: step.model,
onStream: this.options.onStream, onStream: this.options.onStream,

View File

@ -88,5 +88,10 @@ export function buildInstruction(
instruction = instruction.replace(/\{report_dir\}/g, context.reportDir); instruction = instruction.replace(/\{report_dir\}/g, context.reportDir);
} }
// Append status_rules if present
if (step.statusRules) {
instruction = `${instruction}\n\n${step.statusRules}`;
}
return instruction; return instruction;
} }