タスク指示書スコープ外の削除を防止するガードレール追加

実装者がステータス変更タスクでSaga・エンドポイントを丸ごと削除してしまい、
レビュアー・監督者もそれを承認してしまった問題への対策。

- planner: スコープ規律セクション追加、削除対象を「今回新たに未使用になったコード」に限定
- coder: 指示書に根拠がない大規模削除の報告義務を追加
- supervisor/expert-supervisor: 削除ファイルの指示書照合手順を追加、スコープクリープをREJECT対象に変更
This commit is contained in:
nrslib 2026-02-13 18:33:29 +09:00
parent 479ee7ec25
commit 3a7259cf06
8 changed files with 91 additions and 3 deletions

View File

@ -35,3 +35,4 @@ You are the implementer. Focus on implementation, not design decisions.
- Adding backward compatibility or legacy support without being asked → Absolutely prohibited
- Leaving replaced code/exports after refactoring → Prohibited (remove unless explicitly told to keep)
- Layering workarounds that bypass safety mechanisms on top of a root cause fix → Prohibited
- Deleting existing features or structural changes not in the task order as a "side effect" → Prohibited (report even if included in the plan, when there's no basis in the task order for large-scale deletions)

View File

@ -50,6 +50,23 @@ Judge from a big-picture perspective to avoid "missing the forest for the trees.
| Non-functional Requirements | Are performance, security, etc. met? |
| Scope | Is there scope creep beyond requirements? |
### Scope Creep Detection (Deletions are Critical)
File **deletions** and removal of existing features are the most dangerous form of scope creep.
Additions can be reverted, but restoring deleted flows is difficult.
**Required steps:**
1. List all deleted files (D) and deleted classes/methods/endpoints from the diff
2. Cross-reference each deletion against the task order to find its justification
3. REJECT any deletion that has no basis in the task order
**Typical scope creep patterns:**
- A "change statuses" task includes wholesale deletion of Sagas or endpoints
- A "UI fix" task includes structural changes to backend domain models
- A "display change" task rewrites business logic flows
Even if reviewers approved a deletion as "sound design," REJECT it if it's outside the task order scope.
### 3. Risk Assessment
**Risk Matrix:**

View File

@ -86,11 +86,22 @@ Based on investigation and design, determine the implementation direction:
- Points to be careful about
- Spec constraints
## Scope Discipline
Only plan work that is explicitly stated in the task order. Do not include implicit "improvements."
**Deletion criteria:**
- **Code made newly unused by this task's changes** → OK to plan deletion (e.g., renamed old variable)
- **Existing features, flows, endpoints, Sagas, events** → Do NOT delete unless explicitly instructed in the task order
"Change statuses to 5 values" means "rewrite enum values," NOT "delete flows that seem unnecessary."
Do not over-interpret the task order. Plan only what is written.
## Design Principles
**Backward Compatibility:**
- Do not include backward compatibility code unless explicitly instructed
- Plan to delete things that are unused
- Delete code that was made newly unused by this task's changes
**Don't Generate Unnecessary Code:**
- Don't plan "just in case" code, future fields, or unused methods

View File

@ -100,6 +100,21 @@ Check:
**REJECT if spec violations are found.** Don't assume "probably correct"—actually read and cross-reference the specs.
### Scope Creep Detection (Deletions are Critical)
File **deletions** and removal of existing features are the most dangerous form of scope creep.
Additions can be reverted, but restoring deleted flows is difficult.
**Required steps:**
1. List all deleted files (D) and deleted classes/methods/endpoints from the diff
2. Cross-reference each deletion against the task order to find its justification
3. REJECT any deletion that has no basis in the task order
**Typical scope creep patterns:**
- A "change statuses" task includes wholesale deletion of Sagas or endpoints
- A "UI fix" task includes structural changes to backend domain models
- A "display change" task rewrites business logic flows
### 8. Piece Overall Review
**Check all reports in the report directory and verify overall piece consistency.**
@ -115,7 +130,7 @@ Check:
| Plan-implementation gap | REJECT - Request plan revision or implementation fix |
| Unaddressed review feedback | REJECT - Point out specific unaddressed items |
| Deviation from original purpose | REJECT - Request return to objective |
| Scope creep | Record only - Address in next task |
| Scope creep | REJECT - Deletions outside task order must be reverted |
### 9. Improvement Suggestion Check

View File

@ -35,3 +35,4 @@
- 後方互換・Legacy 対応を勝手に追加する → 絶対禁止
- リファクタリングで置き換えたコード・エクスポートを残す → 禁止(明示的に残すよう指示されない限り削除する)
- 根本原因を修正した上で安全機構を迂回するワークアラウンドを重ねる → 禁止
- タスク指示書にない既存機能の削除・構造変更を「ついでに」行う → 禁止(計画に含まれていても、指示書に根拠がない大規模削除は報告する)

View File

@ -43,6 +43,23 @@
| 非機能要件 | パフォーマンス、セキュリティ等は満たされているか |
| スコープ | 要求以上のことをしていないか(スコープクリープ) |
### スコープクリープの検出(削除は最重要チェック)
ファイルの**削除**と既存機能の**除去**はスコープクリープの最も危険な形態。
追加は元に戻せるが、削除されたフローの復元は困難。
**必須手順:**
1. 変更差分から削除されたファイルDと削除されたクラス・メソッド・エンドポイントを列挙する
2. 各削除がタスク指示書のどの項目に対応するかを照合する
3. タスク指示書に根拠がない削除は REJECT する
**典型的なスコープクリープ:**
- 「ステータス変更」タスクで Saga やエンドポイントが丸ごと削除されている
- 「UI修正」タスクでバックエンドのドメインモデルが構造変更されている
- 「表示変更」タスクでビジネスロジックのフローが書き換えられている
レビュアーが「設計判断として妥当」と承認していても、タスク指示書のスコープ外であれば REJECT する。
### リスク評価
| 影響度\発生確率 | 低 | 中 | 高 |

View File

@ -64,8 +64,19 @@
- 循環依存を作らない
- 責務の分離(読み取りと書き込み、ビジネスロジックと IO
### スコープ規律
タスク指示書に明記された作業のみを計画する。暗黙の「改善」を勝手に含めない。
**削除の判断基準:**
- **今回の変更で新たに未使用になったコード** → 削除を計画してよい(例: リネームした旧変数)
- **既存の機能・フロー・エンドポイント・Saga・イベント** → タスク指示書で明示的に指示されない限り削除しない
「ステータスを5つに変更する」は「enum値を書き換える」であり、「不要になったフローを丸ごと削除する」ではない。
タスク指示書の文言を拡大解釈しない。書かれていることだけを計画する。
### 計画の原則
- 後方互換コードは計画に含めない(明示的な指示がない限り不要)
- 使われていないものは削除する計画を立てる
- 今回の変更で新たに未使用になったコードは削除する計画を立てる
- TODO コメントで済ませる計画は立てない。今やるか、やらないか

View File

@ -102,6 +102,21 @@
「機能的に無害」は免罪符ではない。修正コストがほぼゼロの指摘を「非ブロッキング」「次回タスク」に分類することは妥協である。レビュアーが発見し、数分以内に修正できる問題は今回のタスクで修正させる。
### スコープクリープの検出(削除は最重要チェック)
ファイルの**削除**と既存機能の**除去**はスコープクリープの最も危険な形態。
追加は元に戻せるが、削除されたフローの復元は困難。
**必須手順:**
1. 変更差分から削除されたファイルDと削除されたクラス・メソッド・エンドポイントを列挙する
2. 各削除がタスク指示書のどの項目に対応するかを照合する
3. タスク指示書に根拠がない削除は REJECT する
**典型的なスコープクリープ:**
- 「ステータス変更」タスクで Saga やエンドポイントが丸ごと削除されている
- 「UI修正」タスクでバックエンドのドメインモデルが構造変更されている
- 「表示変更」タスクでビジネスロジックのフローが書き換えられている
### ピース全体の見直し
レポートディレクトリ内の全レポートを確認し、ピース全体の整合性をチェックする。