Repository navigation
Closed
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: "#283"
goal_ref: "SDD 駆動運用 — impl-review-loop は Product/Spec Kit の意味論を再実装せず、issue-contract-review が生成した product_spec_check を contract snapshot から読み、Step 1 delegation 前に決定論的に routing する"
change_kind: workflowParent Issue
Parent Goal Ref
- Goal: SDD ライフサイクル(
docs/dev/product-spec-lifecycle.md)の確立と、それに基づく issue 管理・ループ運用の整合 - Desired Destination: impl-review-loop が orchestration 責務に留まりつつ、
docs/product/**変更および tasks.md materialized issue を 既存の決定論的 checker 結果 を消費して安全に gate できる状態
Current Validated Scope
.claude/skills/impl-review-loop/SKILL.mdおよびsteps/preparation.mdに、CONTRACT_REVIEW_RESULT_V1.checks.product_spec_checkを読み取って Step 1 delegation 前にcontinue / fail-close / human_judgment / refresh_contract_snapshotを決定する routing gate を追加する- 既存の
vc_preflightconsumption と同じパターンでproduct_spec_checkを扱う(LOOP_STATE.product_spec_preflightを記録 → Step 1 入力には summary のみ渡す) - ゲート評価ロジックを mutation-free CLI(例:
.claude/skills/impl-review-loop/scripts/evaluate_product_spec_gate.py)に切り出し、fixture-driven test で挙動を固定する
Remaining Parent Gaps
- なし(実装: docs/dev/product-spec-lifecycle.md を追加する — SDD ライフサイクル定義(C254-2) #283 / PR docs(#283): docs/dev/product-spec-lifecycle.md を追加 — SDD ライフサイクル定義(C254-2) #322 マージ済み、実装: issue-contract-review に product spec preflight gate を追加する(Follow-up B) #335 / PR feat(#335): add Product Spec Preflight to issue-contract-review skill #348 マージ済みで
product_spec_checkは既に contract snapshot に emit される前提が成立)
Outcome
impl-review-loopは Product Spec / Spec Kit の意味論判定(PS001〜PS006 等)を再実装しない- Step 1(Implementation)delegation の直前に、contract snapshot 内の
checks.product_spec_checkを decoder script 経由で読み取り、LOOP_STATE.product_spec_preflightに正規化結果を格納する decision: fail/decision: human_judgmentの場合は fail-closed で停止し、implementation-workerを起動しないapplicability: not_applicableの場合は無関係 Issue を block せず通常経路で続行する- product/spec trigger があるにもかかわらず
product_spec_checkが snapshot に存在しない場合は stale / incomplete contract snapshot として停止し、issue-contract-review再実行へ route する pnpm typecheck && pnpm lint && pnpm test && pnpm buildが PASS する
In Scope
-
.claude/skills/impl-review-loop/SKILL.mdの Procedure に、Step 1 delegation 前の routing gate セクションを追加(control-plane の責務に限定) -
.claude/skills/impl-review-loop/steps/preparation.mdの contract snapshot consumption 節にproduct_spec_check取得・正規化ロジックを追加 -
.claude/skills/impl-review-loop/scripts/evaluate_product_spec_gate.py(mutation-free CLI / JSON 出力)を追加- 入力: contract snapshot JSON(または stdin /
--snapshot-json) - 出力:
PRODUCT_SPEC_GATE_DECISION_V1(後述) - 仕様: PS001〜PS006 を 再実装しない。
checks.product_spec_checkを 読むだけ
- 入力: contract snapshot JSON(または stdin /
-
.claude/skills/impl-review-loop/scripts/tests/test_evaluate_product_spec_gate.pyおよびfixtures/を追加し、以下の fixture-driven test を成立させる:pass(applicability=applicable, decision=pass)→routing_action: continuenot_applicable→routing_action: continuefail(任意のblocked_rule_ids)→routing_action: stop_humanhuman_judgment→routing_action: stop_humanmissing-schema(product/spec trigger あり /product_spec_check欠落)→routing_action: refresh_contract_snapshotstale-snapshot(schema mismatch)→routing_action: refresh_contract_snapshot
-
LOOP_STATE.product_spec_preflightの正規化スキーマ:product_spec_preflight: source: contract_snapshot.checks.product_spec_check applicability: applicable | not_applicable | missing decision: pass | fail | human_judgment | missing blocked_rule_ids: [] contract_snapshot_url: "<url>" body_sha256: "<sha256>" routing_action: continue | stop_human | refresh_contract_snapshot
-
Step 1(
implementation-worker呼び出し)にはcontract_snapshot_urlとproduct_spec_preflightsummary のみを渡す(rawproduct_spec_check構造は転送しない)
Out of Scope
- PS001〜PS006 の意味論判定の再実装(
issue-contract-review/check_product_spec_contract.pyが正本) docs/dev/product-spec-lifecycle.md本文の編集(実装: docs/dev/product-spec-lifecycle.md を追加する — SDD ライフサイクル定義(C254-2) #283 のスコープ)- tasks.md /
.specify//docs/product/**の意味論判定そのもの(gate は consume のみ) implement-issue/issue-contract-review等、他 skill への同様の gate 追加(Spec Kit policy はissue-contract-reviewに既に集約済み)speckit-taskstoissuesadapter 改修(改善: speckit-taskstoissues に LOOP_PROTOCOL adapter alignment を追加する(Follow-up D) #339 のスコープ)tasks.md自動 materialize ルートの追加・変更
Acceptance Criteria
- AC1:
impl-review-loopはchecks.product_spec_checkを contract snapshot から読み、Step 1 delegation 前に判定する(SKILL.md/preparation.mdに routing gate が明記されている) - AC2:
decision: fail/decision: human_judgmentは fail-closed で停止し、implementation-workerを起動しない(fixture-driven test で確認) - AC3:
applicability: not_applicableは無関係 Issue を block しない(fixture-driven test で確認) - AC4: product/spec trigger があるのに
product_spec_checkが snapshot に存在しない場合、stale / incomplete contract snapshot として停止またはissue-contract-reviewrefresh に route する(fixture-driven test で確認) - AC5:
impl-review-loop内に PS001〜PS006 の意味論判定を再実装しない(grep / negative assertion で確認) - AC6:
LOOP_STATE.product_spec_preflightが正規化スキーマで記録され、後続 Step 1/2/4 はこの summary を参照する(SKILL.mdに明記) - AC7: fixture-driven tests(pass / not_applicable / fail / human_judgment / missing-schema / stale-snapshot)が PASS する
- AC8:
pnpm typecheck && pnpm lint && pnpm test && pnpm buildが PASS する
Runtime Verification Applicability
- decision: not_applicable
- reason: 本 Issue の Outcome は
impl-review-loopの SKILL/手順編集と mutation-free CLI(evaluate_product_spec_gate.py)+ fixture-driven unit test 追加であり、検証はpnpm typecheck/lint/test/buildとuv run pytestの静的検証で完結する。プロセス起動・通信・I/O・hooks ランタイム挙動を必要とせず、runtime-verification-policy.mdのnot_applicable条件(静的検証のみで完結)に合致する
Verification Commands
# AC1: routing gate が SKILL.md / preparation.md に存在する
$ rg -n "product_spec_check|product_spec_preflight" \
.claude/skills/impl-review-loop/SKILL.md \
.claude/skills/impl-review-loop/steps/preparation.md \
&& echo "PASS: AC1 gate referenced" || { echo "FAIL: AC1"; exit 1; }
# AC2: fail decision で fail-closed する fixture-driven test
$ uv run pytest .claude/skills/impl-review-loop/scripts/tests/test_evaluate_product_spec_gate.py::test_decision_fail_stops_human -q
# AC3: applicability=not_applicable は continue する fixture-driven test
$ uv run pytest .claude/skills/impl-review-loop/scripts/tests/test_evaluate_product_spec_gate.py::test_not_applicable_continues -q
# AC4: missing-schema / stale-snapshot は refresh_contract_snapshot に route する fixture-driven test
$ uv run pytest .claude/skills/impl-review-loop/scripts/tests/test_evaluate_product_spec_gate.py::test_missing_or_stale_routes_refresh -q
# AC5: PS001-PS006 意味論を impl-review-loop に再実装していない(negative assertion)
$ ! rg -nE "PS00[1-6]\b|docs/product/\*\*.*禁止|tasks\.md.*直接実装" \
.claude/skills/impl-review-loop/steps \
.claude/skills/impl-review-loop/SKILL.md \
&& echo "PASS: AC5 no semantic reimpl" \
|| { echo "FAIL: AC5 semantic reimplementation detected"; exit 1; }
# AC6: LOOP_STATE.product_spec_preflight が記載されている
$ rg -n "LOOP_STATE\.product_spec_preflight|product_spec_preflight:" \
.claude/skills/impl-review-loop/SKILL.md \
.claude/skills/impl-review-loop/steps/preparation.md \
&& echo "PASS: AC6 LOOP_STATE shape" || { echo "FAIL: AC6"; exit 1; }
# AC7: 全 fixture (pass / not_applicable / fail / human_judgment / missing-schema / stale-snapshot) が PASS する
$ uv run pytest .claude/skills/impl-review-loop/scripts/tests/test_evaluate_product_spec_gate.py -q
# AC8: 既存 quality gate
$ pnpm typecheck && pnpm lint && pnpm test && pnpm buildAllowed Paths
.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/steps/preparation.md.claude/skills/impl-review-loop/steps/step-1-implementation.md.claude/skills/impl-review-loop/scripts/.claude/skills/impl-review-loop/scripts/tests/.claude/skills/impl-review-loop/scripts/tests/fixtures/
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
issue-contract-review/check_product_spec_contract.py側のスキーマ変更が必要になった場合(その変更は 実装: issue-contract-review に product spec preflight gate を追加する(Follow-up B) #335 / 別 Issue で扱う)- PS001〜PS006 の意味論判定を
impl-review-loopに書こうとした場合(責務境界違反として停止) contract_snapshotのフォーマット自体の変更が必要になった場合- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- gate decision が静的判定不能で確率論的判断が必要になった場合(決定論的設計の前提を満たせない)
Required Skills
なし
Scope Delta(任意)
- 旧スコープ(reframe 前):
impl-review-loop内に Product Spec / Spec Kit preflight の判定ロジックを自然言語手順として追加する案 - 新スコープ(本 Issue):
impl-review-loopは判定を行わず、issue-contract-reviewが生成したproduct_spec_checkを contract snapshot 経由で consume する gate のみ を追加する - 変更理由: PR feat(#335): add Product Spec Preflight to issue-contract-review skill #348(実装: issue-contract-review に product spec preflight gate を追加する(Follow-up B) #335 実装)により
check_product_spec_contract.pyが PS001〜PS006 を決定論的に判定済みとなったため、impl-review-loop側で再実装すると二重実装・判定乖離・token 増加・orchestrator の data-plane 肥大化を招く(OWNER 指摘)
Source
- dedupe_key:
spec-kit-loop-integration:C - origin: PR docs(#283): docs/dev/product-spec-lifecycle.md を追加 — SDD ライフサイクル定義(C254-2) #322 human review comment — docs(#283): docs/dev/product-spec-lifecycle.md を追加 — SDD ライフサイクル定義(C254-2) #322 (comment)
- reframe origin: Issue 実装: impl-review-loop が issue-contract-review の product_spec_check を消費し、Step 1 前に fail-closed routing する — spec-kit-loop-integration:C #333 human review comment — 実装: impl-review-loop が issue-contract-review の product_spec_check を消費し、Step 1 前に fail-closed routing する — spec-kit-loop-integration:C #333 (comment)
- proposed_as: 後続 Issue C(reframed by OWNER 2026-05-24)
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
fix(#332): B1-B4 修正 — signal regex 化 / tasks_md fail-closed 強化 / foll…
feat(#332): issue-refinement-loop に Product/Spec Kit routing gate を追加…
squne121 commentedon May 24, 2026
人間からの指摘です。
impl-review-loop はオーケストラレーションスキルとして、オーケストラレーションの責務に注力すること。
AIエージェントへの自然言語での指示による確率論的な目的達成ではなく、可能な限りスクリプティングによる決定論的な解決方法を検討し、トークン消費の削減と成果物の品質向上と品質安定化を図ってください。
squne121 commentedon May 24, 2026
判定: REQUEST_CHANGES
Issue #333 は、現在のまま実装すると 「impl-review-loop に Product/Spec Kit の自然言語 preflight を追記するだけ」 になりやすく、人間指摘の「オーケストレーション責務へ集中」「決定論的スクリプティング化」と逆方向です。#333 の本文は
SKILL.md/preparation.md/step-1-implementation.mdへの preflight 追記を主眼にしていますが、同じ判定領域は既に #335 / PR #348 でissue-contract-review側に script-backed checker として実装済みです。#333 は checker を再実装せず、CONTRACT_REVIEW_RESULT_V1.checks.product_spec_checkを読む orchestration gate に絞るべきです。主要な問題
B1. #333 は責務境界が曖昧で、#335/#348 と重複する。
#335 は
issue-contract-reviewに Product Spec Preflight を追加し、PS001〜PS006をcheck_product_spec_contract.pyで決定論的に判定する設計です。PR #348 はこれをマージ済みで、tasks.md/.specify//docs/product/**を全面禁止ではなく「役割境界」として判定しています。したがって #333 が同じ条件をimpl-review-loopに自然言語で再掲すると、二重実装・判定乖離・token 増加の原因になります。B2. 現在の AC / Verification Commands が弱い。
#333 の検証は
rg "generated_from_tasks_md"、rg "docs/product"、rg "diff-first"、rg "tasks.md"のような文字列存在確認が中心です。これは「記載がある」だけを保証し、「Step 1 前に fail-closed する」「最新 contract snapshot を読む」「blocked / human_judgment を止める」「missing schema を stale と扱う」といった実挙動を保証しません。PR #322 でも、AC 文字列は満たしたが親 #254 の運用整合には届かない、という同型の問題が発生しています。B3.
impl-review-loopの正しい責務は checker ではなく gate / routing。既存の
impl-review-loopは実装→検証→PRレビューのオーケストレーターであり、Step 1 はimplementation-workerへ委譲する設計です。SKILL.md も「control-plane だけを担い、data-plane 操作は SubAgent に委譲」と明記しています。Product Spec の意味論判定をここへ入れると、orchestrator が data-plane / semantic checker へ肥大化します。B4. preflight の配置は Step 1 ではなく preparation 側が適切。
既存
preparation.mdは contract snapshot を決定し、vc_preflight.statusを見て Step 1 続行可否を判断する構造を持っています。product_spec_checkも同じ contract snapshot のchecks配下にあるため、Step 1 の直前で worker に渡す前に、orchestrator が 既存判定結果を読むだけ にするのが自然です。B5. token policy に反する実装になりやすい。
Claude Code skills の公式仕様では、skill 本文は使用時に読み込まれ、その内容は以後の context に残ります。長い手順・参照情報を SKILL.md に積むより、supporting files / scripts を置き、Claude が必要時に実行する構造が推奨されています。#333 で Product Spec policy を
impl-review-loopに転載すると、scoped_loading/compact_spec方針と衝突します。([Claude API Docs]1) ([Claude API Docs]2)B6. Spec Kit の
tasks.mdは実装実行入口になり得るため、fail-open は危険。Spec Kit 公式は
/speckit.tasksでtasks.mdを生成し、/speckit.implementがtasks.mdを解析してタスクを順に実行する流れを持ちます。LOOP_PROTOCOL 側の ADR 0002 は、この直接実装経路を禁止し、github_issue → issue-contract-review → impl-review-loop → test-runner → pr-review-judgeを必須経路にしています。したがって #333 は「tasks.md を見たら注意」では足りず、product_spec_check.decision != passを機械的に停止条件にする必要があります。([GitHub]3) ([GitHub]3) ([GitHub]3)#333 の高品質化案
#333 は次のように設計変更するのが妥当です。
LOOP_STATEには最小限の結果だけを保持します。preparation.mdの分岐はこの程度で十分です。変更すべき Acceptance Criteria
現在の AC は文字列存在確認なので、次へ差し替えるべきです。
Allowed Paths の見直し
人間指摘どおり決定論的 scripting を入れるなら、現行 Allowed Paths は不足しています。少なくとも次を追加すべきです。
ただし、意味論 checker は #348 の
check_product_spec_contract.pyを正本にし、#333 側の script は contract snapshot parser / gate evaluator に限定するべきです。既存のplan_issue_scope_rollup.pyのように、mutation-free CLI が JSON を出す形に揃えると、実装品質と再現性が上がります。推奨 Verification Commands
最終提案
#333 は「Product Spec / Spec Kit preflight を追加する」ではなく、次のタイトルに変えるべきです。
この形なら、
impl-review-loopはオーケストレーション責務に留まり、Product Spec の意味論は #335/#348 の決定論的 checker に集約されます。自然言語指示で worker が「うまくやる」前提を排除でき、token 消費もproduct_spec_checksummary の読み取りだけに抑えられます。[-]実装: impl-review-loop に Product Spec / Spec Kit preflight を追加する — spec-kit-loop-integration:C[/-][+]実装: impl-review-loop が issue-contract-review の product_spec_check を消費し、Step 1 前に fail-closed routing する — spec-kit-loop-integration:C[/+]squne121 commentedon May 24, 2026
edit-issue Change Log
Timestamp: 2026-05-24
Classification:
feedback_update_requiredwith scope impactreplaceAnchor Comment: #333 (comment)
Summary of Changes
Outcome Reframe:
product_spec_checkfrom contract snapshot and route deterministically at Step 1 (fail-closed gate only)"Scope Changes:
evaluate_product_spec_gate.py), fixture-driven tests, normalizedLOOP_STATE.product_spec_preflightschema, explicit negative assertions (grep for PS00[1-6] reimplementation)Title Update:
Body SHA256:
891d94ce864b5ef5de2247f4a2e1f0cf5281880af50f89b0b13b9675b2581f9a9a59a6106176e3f1128e79d25674cff3327dd6a4bf240a86ea1d332e68520045Key AC Updates
checks.product_spec_checkfrom contract snapshot (not reimplementing judgment logic)pass/not_applicable/fail/human_judgment/missing-schema/stale-snapshot)impl-review-loopLOOP_STATE.product_spec_preflightschema and fixture test coverageRationale
Per OWNER feedback (reframe origin),
issue-contract-review/check_product_spec_contract.py(PR #348) now emitsproduct_spec_checkto contract snapshot. Consuming this result via a deterministic gate script eliminates semantic reimplementation, token waste, data-plane inflation, and judgment drift. The skill boundary change (orchestration consumption ≠ semantic judgment) alignsimpl-review-loopresponsibility with its spec-kit-loop-integration role.Verified by: edit-issue Procedure ✓
squne121 commentedon May 24, 2026
issue-refinement-loop: 完了 (2026-05-24T10:13:00Z)
改善履歴
impl-review-loopを「Product/Spec Kit preflight を独自実装する」から「issue-contract-reviewが生成したproduct_spec_checkを contract snapshot から消費して Step 1 delegation 前に決定論的 routing する gate」に変更。タイトルも変更。Allowed Paths にscripts//scripts/tests/を追加。AC を文字列存在確認から fixture-driven 挙動テストに差し替え(pass / not_applicable / fail / human_judgment / missing-schema / stale-snapshot)。## Runtime Verification Applicabilityセクション追加、VC に$prefix 追加、AC1-AC8 を 1 行 1 コマンドに分割し各 VC に AC マーカー付与。applicability:→decision:に rename、runtime-verification-policy.md照合の結果 VC は完全静的(pnpm + pytest unit test のみ)であるためdecision: not_applicableに確定。Fact-check 結果サマリ
check_product_spec_contract.py存在 / PS001-PS006 実装済み ✓impl-review-loop構造(control-plane orchestrator)✓/speckit.implementが tasks.md を直接実行する仕様 ✓派生改善候補(自動起票判断)
なし。本 Issue の reframe は #335 (closed) / PR #348 (merged) の前提に乗っており、現時点で新規 follow-up 起票は不要。
次アクション
issue-contract-reviewskill を本 Issue 実装: impl-review-loop が issue-contract-review の product_spec_check を消費し、Step 1 前に fail-closed routing する — spec-kit-loop-integration:C #333 に対して起動し、status: goを確認後impl-review-loopで着手するsqune121 commentedon May 24, 2026
Contract Snapshot (2026-05-24T14:30:00Z)
product_spec_checkを decoder script 経由で consume し、Step 1 delegation 前に fail-closed routing する.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/steps/preparation.md.claude/skills/impl-review-loop/steps/step-1-implementation.md.claude/skills/impl-review-loop/scripts/.claude/skills/impl-review-loop/scripts/tests/.claude/skills/impl-review-loop/scripts/tests/fixtures/.claude/worktrees/issue-333-impl-review-loop-ga-issue-contract-review-no-proworktree-issue-333-impl-review-loop-ga-issue-contract-review-no-prosqune121 commentedon May 24, 2026
implement-issue: 実装完了 (2026-05-24T19:30:00Z)
Status: OK
Deliverables
.claude/worktrees/issue-333-impl-review-loop-ga-issue-contract-review-no-proworktree-issue-333-impl-review-loop-ga-issue-contract-review-no-pro3cb66f84d8ebd41008c68936dd200fec66c4fe7aVerification Results
All 8 AC PASS:
Implementation Summary
Adds deterministic, mutation-free routing gate to
impl-review-loop:evaluate_product_spec_gate.py: Readsproduct_spec_checkfrom contract snapshot, emits routing decisionPer Issue scope: gate acts as orchestration router only. No semantic judgment (PS001-PS006 remains in issue-contract-review).
feat(#333): add product spec gate evaluator to impl-review-loop
fix(#333): apply REQUEST_CHANGES blockers 1-4 to evaluate_product_spe…
fix(#333): apply REQUEST_CHANGES iteration 2 blockers and non-blockers
feat(#333): add product spec gate evaluator to impl-review-loop
fix(#333): apply REQUEST_CHANGES blockers 1-4 to evaluate_product_spe…
fix(#333): apply REQUEST_CHANGES iteration 2 blockers and non-blockers
fix(#333): add alias tests matching Issue #333 VC node names (AC2/AC4)
feat(#333): add product spec gate evaluator to impl-review-loop (#369)