Repository navigation
Open
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "issue-refinement-loop の SubAgent 起動を planner-declared launch plan に拘束し、placeholder 起動と重複調査を決定論的に止める"
change_kind: codeParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: refinement loop 中の SubAgent 起動が planner output に宣言されたものだけになる
- Desired Destination: placeholder 起動・同一 claim の重複 investigation・raw transcript の main context 混入がゼロになる
Current Validated Scope
.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.pyの output にsubagent_launch_planを追加scripts/check_subagent_launch_ledger.pyに launch plan 照合検証を追加- launch plan / ledger policy テストの追加
Remaining Parent Gaps
- SubAgent 起動を runtime で hard block する hook 化(SubAgentStart 相当)は、ledger 検出で不足が確認された場合の follow-up とする
- reviewer claim replay の taxonomy parity は別 Issue で扱う
Outcome
plan_refinement_loop.py が subagent_launch_plan(allowed_launches / forbidden_launches / cheap_probe_required_first)を出力し、check_subagent_launch_ledger.py が plan 外起動・placeholder prompt・同一 issue/claim/path の重複 investigation を violation として決定論的に検出し、対応テストが CI で PASS している状態。
Background
#1277 の refinement 作業ログでは、不要な placeholder agent が誤起動され直後に無視され、また anchor claim の検証で codebase-investigator を使った後に同じ事実を grep / read で再確認する重複調査が発生した。issue-refinement-loop は Step 1 investigation を planner が required と判断した場合のみ行う設計だが、SubAgent 起動そのものを planner output に拘束する runtime check が弱い。docs/dev/agent-skill-boundaries.md は root thread を control-plane、worker を data-plane とし、ledger evidence を canonical とする方針を既に持つ。
In Scope
subagent_launch_planの schema 追加(agent / reason_code / max_prompt_chars / expected_artifact_schema / cheap_probe_required_first を持つ allowed_launches、および forbidden_launches)check_subagent_launch_ledger.pyへの検証追加: plan 外起動は violation、placeholder / status check / 空 prompt は violation、同一 issue + claim + path set の 2 回目以降 investigation はduplicate_investigation- SubAgent output を artifact ref + 短い summary に制限する契約の ledger 検証
- テスト追加と
scripts/python-test-plan.json登録
Out of Scope
- SubAgent 起動の realtime hard block hook の新設(検出は ledger ベースで行い、hook 化は follow-up)
- issue-reviewer / codebase-investigator の agent 定義変更
- refinement loop 以外の skill への launch plan 展開
Acceptance Criteria
- AC1: planner output にない SubAgent 起動が ledger 検証で violation として検出される
- AC2: prompt が placeholder / status check / 空に近い SubAgent 起動が violation として検出される
- AC3:
cheap_probe_required_firstが真の場合、grep / read / schema probe の inconclusive artifact なしの codebase-investigator 起動が violation になる - AC4: SubAgent output が artifact ref + 5 行以内 summary の契約を破る場合に violation として検出される
- AC5: 同一 issue / claim / path の investigation が 2 回目以降
duplicate_investigationとして検出される
Verification Commands
# AC1
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_subagent_launch_plan.py::test_ac1_unplanned_launch_detected -q
# AC2
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_subagent_launch_plan.py::test_ac2_placeholder_prompt_detected -q
# AC3
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_subagent_launch_plan.py::test_ac3_cheap_probe_required_first_enforced -q
# AC4
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_subagent_launch_plan.py::test_ac4_output_bounded_artifact_ref_summary -q
# AC5
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_subagent_launch_plan.py::test_ac5_duplicate_investigation_detected -qAllowed Paths
- .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py
- .claude/skills/issue-refinement-loop/tests/test_subagent_launch_plan.py
- .claude/skills/issue-refinement-loop/SKILL.md
- scripts/check_subagent_launch_ledger.py
- tests/test_subagent_launch_ledger_policy.py
- tests/fixtures/subagent-ledger/
- docs/dev/agent-skill-boundaries.md
- scripts/python-test-plan.json
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Scope Delta(任意)
N/A
Notes for Reviewer
- 既存 ledger fixture(tests/fixtures/subagent-ledger/)の後方互換を維持し、追加 violation 種別は既存 schema の superset として実装する
REFINEMENT_LOOP_PLAN_V1にsubagent_launch_planを追加する場合は planner consumer 側の後方互換(欠落時は現行挙動)を保つ
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity