Skip to content

実装: impl-review-loop の contract blocked 時エスカレーションを blocked reason 3 分類と worker 自律修正手順に置換する #569

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "impl-review-loop が issue-contract-review status: blocked を受けた際、blocked reason を 3 分類し simple_contract_hygiene_fix では worker が自律修正・再開できる手順を preparation.md に明文化する"
change_kind: workflow

Parent Issue

none

Parent Goal Ref

  • Goal: なし(単独改善)
  • Desired Destination: なし

Current Validated Scope

  • .claude/skills/impl-review-loop/steps/preparation.md の vc_preflight.status: blocked 処理に、CONTRACT_REVIEW_RESULT_V1.checks.vc_preflight.classifications[] を消費して blocked reason を 3 分類し、simple_contract_hygiene_fix では worker 自律修正フロー(issue-refinement-loop 経由 Issue 本文更新 → issue-contract-review 再実行 → status: go 確認後再開)を明文化
  • .claude/skills/impl-review-loop/SKILL.md の vc_preflight.status: blocked 停止パスを intake_gate_failed.vc_preflight.contract_blocked_reason 語彙に接続し、#564 の fail-only intake gate との整合を明記

Remaining Parent Gaps

なし

Outcome

.claude/skills/impl-review-loop/steps/preparation.md が更新され、issue-contract-review status: blocked 受信時に blocked reason を simple_contract_hygiene_fix / contract_refinement_required / human_decision_required の 3 種に分類し、simple_contract_hygiene_fix の場合は ClaudeCode が推奨修正案と理由を提示して自律修正後に issue-contract-review を再実行できる手順が明文化された状態で、pnpm typecheck / lint / test / build が全て PASS している。

Background

Issue #543 の impl-review-loop を実行した際、issue-contract-review が status: blocked を返し、preparation ステップで停止した。停止理由は AC4 の VC rg "tested_commit:" docs/playtest/m2-combat-mvp.md が baseline で既に pass していたこと(既存 frontmatter に tested_commit: フィールドが存在)。

停止時の出力は「修正後に impl-review-loop 543 を再実行してください」であり、修正主体を人間と想定した表現になっていた。impl-review-loop では修正主体は ClaudeCode / worker であるべきで、人間に対しては方針選択の承認か、自律修正の可否を問うべきである。

現在 preparation.md の blocked 処理は「停止し termination_reason: human_escalation を記録して人間判断へ送る」のみで、blocked reason の分類・推奨修正案・自律再開手順が規定されていない。

In Scope

  • .claude/skills/impl-review-loop/steps/preparation.md に vc_preflight.status: blocked 時の blocked reason 3 分類を追加
    • simple_contract_hygiene_fix: 以下の全条件を満たす場合のみ許容される hygiene 修正
      • AC テキストが変更されない
      • Allowed Paths が変更されない
      • 対象の evidence object が変更されない
      • VC は意図した post-change セクション/スコープへの絞り込みのみ(意味論の変更なし)
      • blocked reason は vc_preflight.classifications[] から決定論的に再現できる
      • product / spec / playtest / artifact 充足性判断を含まない
      • Issue 本文変更は issue-refinement-loop 経由のみ
      • 新しい body_sha256 に対する fresh issue-contract-review が status: go を返す
      • (例)preflight-scope: pr_review_only 付与(VC 意味論変更なし)
      • (負例)動画証跡 URL、環境情報、tested_commit 由来、accepted/deferred 判定は simple_contract_hygiene_fix に含めない
    • contract_refinement_required: AC の意味・VC の本質・scope が変わる修正(issue-refinement-loop 推奨)
    • human_decision_required: 仕様判断・playtest 証跡正当性・プロダクト方針判断が必要なケース
  • 各分類に対応するエスカレーション出力仕様(推奨案・理由・代替案・自律実行可否)を preparation.md に追加
  • simple_contract_hygiene_fix の場合: impl-review-loop orchestrator(preparation step)が推奨修正案と理由を提示し、issue-refinement-loop 経由で Issue 本文を修正したうえで issue-contract-review を再実行し status: go を確認してから再開する手順を明文化(control-plane が直接 Issue 本文を mutation しない)
  • contract_refinement_required の場合: issue-refinement-loop への差し戻しを推奨する手順を明文化
  • SKILL.md の vc_preflight.status: blocked 時の停止パスを、実装: issue-refinement-loop と impl-review-loop の implementation-ready handoff を contract gate 化する #564 の intake_gate_failed vocabulary に接続する形で更新する(human_escalation を置換するのではなく、intake_gate_failed.vc_preflight.contract_blocked_reason として 3 分類を統合する)
  • simple_contract_hygiene_fix / contract_refinement_required / human_decision_required を判定するための decision table(CONTRACT_REVIEW_RESULT_V1.checks.vc_preflight.classifications[] からの入力条件→分類 matrix)を preparation.md に明示する
  • decision table は CONTRACT_REVIEW_RESULT_V1.checks.vc_preflight.classifications[] の既存 category を 消費して routing するのみであり、新規 classifier logic の実装・再実装を行わない(classifier 責務は 実装: issue-contract-review の VC preflight に trivially-pass パターン検出を追加する #201 が保有する)
  • CONTRACT_BLOCKED_ROUTING_V1 構造化出力スキーマを preparation.md に定義する:
    CONTRACT_BLOCKED_ROUTING_V1:
      issue: int
      source_contract_review_comment_url: string
      body_sha256_before: string
      vc_preflight_status: blocked | human_judgment
      classifications:
        - ac_id: string
          category: string
          original_vc: string
          observed_baseline_result: pass | fail | unknown
      contract_blocked_reason: simple_contract_hygiene_fix | contract_refinement_required | human_decision_required
      autonomous_fix_allowed: boolean
      required_route: issue-refinement-loop | human_escalation
      proposed_issue_body_patch_summary: string
      rerun_required:
        tool: issue-contract-review
        require_status: go
        require_body_sha256_after: string

Out of Scope

Acceptance Criteria

  • AC1: preparation.md に simple_contract_hygiene_fix の定義と worker 自律修正フローが明文化されている
  • AC2: preparation.md に contract_refinement_required の定義と issue-refinement-loop 差し戻し手順が明文化されている
  • AC3: preparation.md に human_decision_required の定義が明文化されている
  • AC4: pnpm typecheck が PASS する(TypeScript 型エラーなし)
  • AC5: pnpm lint が PASS する(ESLint エラーなし)
  • AC6: pnpm test が PASS する(Vitest 全件 PASS)
  • AC7: pnpm build が PASS する(ビルド成功)
  • AC8: preparation.md に 3 分類への decision table(入力条件→分類 matrix)が明示されている
  • AC0: impl-review-loop が通常入口で issue-contract-review を自動実行しないことを SKILL.md と preparation.md の両方で明記し、実装: issue-refinement-loop と impl-review-loop の implementation-ready handoff を contract gate 化する #564 の intake gate 仕様との齟齬を解消する
  • AC9: preparation.md に CONTRACT_BLOCKED_ROUTING_V1 構造化出力スキーマを定義し、source_contract_review_comment_url / body_sha256_before / contract_blocked_reason / autonomous_fix_allowed / required_route / rerun_required を必須フィールドとする
  • AC10: decision table に simple_contract_hygiene_fix の positive / negative examples を含める(positive: preflight-scope: pr_review_only 付与;negative: 動画証跡 URL、環境情報、tested_commit 由来、accepted/deferred 判定)
  • AC11: Issue body の変更は control-plane から直接行わず issue-refinement-loop 経由に限定する。変更後は fresh body_sha256 に対する issue-contract-review status: go が必須(preparation.md に明記)
  • AC12: decision table は vc_preflight.classifications[] の既存 category を routing input とし、classifier logic の新設・再実装を行わない(preparation.md に明記)
  • AC13: PR body に Safety Claim Matrix を含める(control-plane が Issue body を直接 mutate しない / 権限・認証・sandbox・hook 実行範囲を拡張しない / autonomous fix は contract hygiene のみ / human_decision_required では必ず停止する)
  • AC14: human_decision_required の場合は worker autonomous fix / retry / resume を禁止し、必ず停止する(preparation.md に明記)

Verification Commands

# AC1
$ rg "simple_contract_hygiene_fix" .claude/skills/impl-review-loop/steps/preparation.md

# AC2
$ rg "contract_refinement_required" .claude/skills/impl-review-loop/steps/preparation.md

# AC3
$ rg "human_decision_required" .claude/skills/impl-review-loop/steps/preparation.md

# AC4
# preflight-scope: runtime_only
$ pnpm typecheck

# AC5
# preflight-scope: runtime_only
$ pnpm lint

# AC6
# preflight-scope: runtime_only
$ pnpm test

# AC7
# preflight-scope: runtime_only
$ pnpm build

# AC8
$ rg "decision.table|分類.*matrix|contract_blocked_reason.*class" .claude/skills/impl-review-loop/steps/preparation.md

# AC0
$ rg "issue-contract-review.*自動実行しない|auto.*run.*deprecated|fail-only.*gate" .claude/skills/impl-review-loop/SKILL.md
$ rg "contract_blocked_reason|vc_preflight_contract_blocked" .claude/skills/impl-review-loop/steps/preparation.md

# AC9
$ rg "CONTRACT_BLOCKED_ROUTING_V1" .claude/skills/impl-review-loop/steps/preparation.md
$ rg "source_contract_review_comment_url|body_sha256_before|autonomous_fix_allowed|required_route|rerun_required" .claude/skills/impl-review-loop/steps/preparation.md

# AC10
$ rg "positive.*example|negative.*example|正例|負例|preflight-scope.*pr_review_only" .claude/skills/impl-review-loop/steps/preparation.md

# AC11
$ rg "require_body_sha256_after|本文変更は.*issue-refinement-loop 経由" .claude/skills/impl-review-loop/steps/preparation.md

# AC12
$ rg "classifier.*logic.*新設.*禁止|routing.*のみ|classifications\[\].*消費" .claude/skills/impl-review-loop/steps/preparation.md

# AC13
$ rg "Safety Claim Matrix" .claude/skills/impl-review-loop/steps/preparation.md

# AC14
$ rg "human_decision_required.*停止|autonomous.*fix.*禁止" .claude/skills/impl-review-loop/steps/preparation.md

Allowed Paths

  • .claude/skills/impl-review-loop/steps/preparation.md
  • .claude/skills/impl-review-loop/SKILL.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • issue-contract-review 側のロジック変更が必要と判明した場合(実装: issue-contract-review の VC preflight に trivially-pass パターン検出を追加する #201 に委ねる)

Required Skills

なし

Scope Delta(任意)

N/A

Runtime Verification Applicability

本 Issue は .claude/skills/impl-review-loop/steps/preparation.md と .claude/skills/impl-review-loop/SKILL.md のみを変更するドキュメント更新です。実行時の新規ランタイム動作は追加されません。

decision: not_applicable
reason: "Markdown documentation-only change. No runtime behavior added or changed."

Delivery Rule

1 Issue = 1 PR、worktree 作業、Draft PR 既定。

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Jun 2, 2026
  2. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    結論: REQUEST_CHANGES / 実装着手は止めるべき

    #569 は方向性自体は妥当です。#543 で tested_commit: の VC が baseline で既に pass し、impl-review-loop が「修正後に再実行してください」という人間向け停止に落ちた、という問題設定は正しいです。#569 はこれを simple_contract_hygiene_fix / contract_refinement_required / human_decision_required の 3 分類で扱う設計にしようとしています。(GitHub)

    ただし、現 Issue は 自分自身が同じ contract preflight 問題を再発させる形 になっており、さらに #560 / #564 と責務境界が衝突しています。このまま ClaudeCode に実装させると、また issue-contract-review status: blocked か、control-plane が data-plane 作業を抱える設計劣化を起こす可能性が高いです。


    Blocker 1: #569 自身の VC が baseline pass し得る。preflight-scope がない

    #569 の Verification Commands は AC1〜AC3 の rg に加えて、AC4〜AC7 に pnpm typecheck / lint / test / build をそのまま並べています。(GitHub)
    しかし #560 では、VC baseline 差分性と preflight-scope marker の per-command 規約を導入し、runtime-only の確認は各 $ コマンド直前に明示する前提になっています。(GitHub)

    このため、#569 は最低限こう直すべきです。

    # AC4
    # preflight-scope: runtime_only
    $ pnpm typecheck
    

    AC5

    preflight-scope: runtime_only

    $ pnpm lint

    AC6

    preflight-scope: runtime_only

    $ pnpm test

    AC7

    preflight-scope: runtime_only

    $ pnpm build

    AC1〜AC3 も、baseline で tokens がまだ存在しないことを期待するなら runtime_only ではなく差分 VC として成立します。ただし実装後に token だけを入れても意味論が満たされたとは限らないため、後述の matrix / examples の検証が必要です。


    Blocker 2: 「worker が Issue 本文を修正する」の actor が未定義

    #569 は simple_contract_hygiene_fix の場合に “worker が Issue 本文を修正し issue-contract-review を再実行する” としています。(GitHub)
    一方、現在の impl-review-loop preparation は vc_preflight.status が pass の場合だけ implementation-worker を起動し、blocked / human_judgment は停止して human_escalation に送る設計です。(<a href="https://raw.githubusercontent.com/squne121/loop-protocol/main/.claude/skills/impl-review-loop/steps/preparation.md" title="" | sed 's/.: //; s/[^a-zA-Z0-9]/-/g; s/--/-/g; s/^-//; s/-$//' | tr A-Z a-z | cut -c1-40)
    WORKTREE=".claude/worktrees/issue-${issue_number}-${SLUG}"
    BRANCH="worktree-issue-${issue_number}-${SLUG}"

    既存衝突確認

    git worktree list | grep "$WORKTREE" && echo "[WARN] worktree 既存" || echo "[OK] worktree 未作成"
    git branch --list "$BRANCH" && echo "[WARN] branch 既存" || echo "[OK] branch 未作成"

    
    既存衝突あり → 過去のイテレーションの残骸の可能性。人間判断を仰ぐ。
    
    ## 4. Product Spec Gate 評価完了後の LOOP_STATE 初期化
    
    Product Spec Check 評価(1-d)を完了後、iteration = 0 で以下の状態で開始:
    
    ```yaml
    LOOP_STATE:
      issue_number: &lt;int&gt;
      contract_snapshot_url: &lt;URL&gt;
      contract_snapshot_source: provided | detected_existing | materialized_by_issue_contract_review
      iteration: 0
      max_iterations: 3
      worktree: .claude/worktrees/issue-&lt;番号&gt;-&lt;slug&gt;
      branch: worktree-issue-&lt;番号&gt;-&lt;slug&gt;
      last_step: null
      last_loop_verdict: null
      blockers_history: []
      external_research_skip_basis: null
      termination_reason: null
      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: &quot;&lt;url&gt;&quot;
        body_sha256: &quot;&lt;sha256&gt;&quot;
        routing_action: continue | stop_human | refresh_contract_snapshot
    

    routing_action が stop_human または refresh_contract_snapshot の場合は、ループを開始せず人間判断へ escalate する。

    5. 外部仕様調査スキップ判断(任意)

    internal-only 変更(src/state / src/systems 内の純粋ロジック変更等)なら external_research_skip_basis に理由を記録してスキップ。
    外部仕様が絡む場合は gemini-cli-headless-delegation を先行起動して情報を集める。

    出力

    LOOP_STATE 初期値を会話履歴に明示記録し、Step 1(Implementation)へ進む。
    ">GitHub)

    つまり、blocked 時点では通常の implementation-worker はまだ起動されません。ここで “worker” とだけ書くと、実際には orchestrator / main session が Issue 本文編集や gh issue edit を実行する余地が残ります。これは #564 の「control-plane が作業内容や gate 判断を抱えず、worker / deterministic checker 側に責務を寄せる」という設計方針と衝突します。(GitHub)

    修正方針は二択です。

    1. 既存 issue-refinement-loop に戻す
      simple_contract_hygiene_fix でも、Issue 本文 mutation は issue-refinement 系 worker の責務に寄せる。

    2. 新しい contract-hygiene-worker を定義する
      ただし 実装: impl-review-loop の contract blocked 時エスカレーションを blocked reason 3 分類と worker 自律修正手順に置換する #569 の Allowed Paths は preparation.md と SKILL.md だけなので、subagent 定義や hook 追加が必要なら 実装: impl-review-loop の contract blocked 時エスカレーションを blocked reason 3 分類と worker 自律修正手順に置換する #569 のスコープを広げるか、別 Issue に分ける必要があります。現在の Stop Conditions は nested SubAgent delegation を止めるため、worker 導入とも矛盾します。(GitHub)


    Blocker 3: #564 の intake_gate_failed と #569 の human_escalation 更新が衝突する

    #564 は impl-review-loop preparation に intake_gate_failed を独立した termination_reason として追加し、missing_contract_go / metadata_not_ready / stale_contract_review / body_snapshot_mismatch のサブ理由を持たせる設計です。(GitHub)
    #569 は SKILL.md の human_escalation 説明を新分類に沿って更新するだけなので、#564 の状態体系を取り込まないと termination taxonomy が二重化します。(GitHub)

    推奨は、#569 の分類を human_escalation の置換ではなく、次のように #564 側の intake gate vocabulary に接続することです。

    termination_reason: intake_gate_failed
    intake_gate_failed:
    gate: vc_preflight
    contract_blocked_reason:
    class: simple_contract_hygiene_fix | contract_refinement_required | human_decision_required
    source: latest CONTRACT_REVIEW_RESULT_V1.checks.vc_preflight
    autonomous_fix_allowed: true | false

    Blocker 4: 3分類の判定基準が LLM 任せで、決定論的でない

    #569 は分類自動化スクリプト追加を Out of Scope にしています。(GitHub)
    それ自体は許容できますが、ならば preparation.md に 既存 CONTRACT_REVIEW_RESULT_V1.checks.vc_preflight.classifications[] から 3分類へ落とす決定表 が必要です。現在の preparation は vc_preflight.classifications[] を正本として参照する設計なので、分類もこの既存データから派生させるべきです。(<a href="https://raw.githubusercontent.com/squne121/loop-protocol/main/.claude/skills/impl-review-loop/steps/preparation.md" title="" | sed 's/.: //; s/[^a-zA-Z0-9]/-/g; s/--/-/g; s/^-//; s/-$//' | tr A-Z a-z | cut -c1-40)
    WORKTREE=".claude/worktrees/issue-${issue_number}-${SLUG}"
    BRANCH="worktree-issue-${issue_number}-${SLUG}"

    既存衝突確認

    git worktree list | grep "$WORKTREE" && echo "[WARN] worktree 既存" || echo "[OK] worktree 未作成"
    git branch --list "$BRANCH" && echo "[WARN] branch 既存" || echo "[OK] branch 未作成"

    
    既存衝突あり → 過去のイテレーションの残骸の可能性。人間判断を仰ぐ。
    
    ## 4. Product Spec Gate 評価完了後の LOOP_STATE 初期化
    
    Product Spec Check 評価(1-d)を完了後、iteration = 0 で以下の状態で開始:
    
    ```yaml
    LOOP_STATE:
      issue_number: &lt;int&gt;
      contract_snapshot_url: &lt;URL&gt;
      contract_snapshot_source: provided | detected_existing | materialized_by_issue_contract_review
      iteration: 0
      max_iterations: 3
      worktree: .claude/worktrees/issue-&lt;番号&gt;-&lt;slug&gt;
      branch: worktree-issue-&lt;番号&gt;-&lt;slug&gt;
      last_step: null
      last_loop_verdict: null
      blockers_history: []
      external_research_skip_basis: null
      termination_reason: null
      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: &quot;&lt;url&gt;&quot;
        body_sha256: &quot;&lt;sha256&gt;&quot;
        routing_action: continue | stop_human | refresh_contract_snapshot
    

    routing_action が stop_human または refresh_contract_snapshot の場合は、ループを開始せず人間判断へ escalate する。

    5. 外部仕様調査スキップ判断(任意)

    internal-only 変更(src/state / src/systems 内の純粋ロジック変更等)なら external_research_skip_basis に理由を記録してスキップ。
    外部仕様が絡む場合は gemini-cli-headless-delegation を先行起動して情報を集める。

    出力

    LOOP_STATE 初期値を会話履歴に明示記録し、Step 1(Implementation)へ進む。
    ">GitHub)

    最低限、こういう表が必要です。

    入力条件 分類
    unexpected_pass で、修正が preflight-scope 付与または対象セクション限定に閉じ、AC/VC/Allowed Paths/acceptance semantics を変えない simple_contract_hygiene_fix
    VC の対象、AC の意味、Allowed Paths、Outcome、scope を変える必要がある contract_refinement_required
    playtest 証跡の正当性、仕様判断、人間操作の事実確認が必要 human_decision_required
    分類根拠が不足 human_decision_required または fail-closed

    Claude Code 公式ドキュメント上も、Markdown の指示は挙動を形成するもので、強制層ではありません。強制したい場合は settings / hooks 側でブロックする必要があります。(Claude API Docs)


    Blocker 5: Issue 本文 mutation 後の stale snapshot 無効化が不足

    #560 は、human_escalation 後に Issue 本文を 1 文字でも変更した場合、prior contract-review result は stale になり、full contract review 再実行が必要だと定義しています。(GitHub)
    #564 も body_sha256 と comment freshness を intake gate に入れ、古い status: go を無効化する設計です。(GitHub)

    #569 は “Issue 本文を修正し issue-contract-review を再実行” とは書いていますが、以下が足りません。

    after_issue_body_mutation:
      must_record:
        - old_body_sha256
        - new_body_sha256
        - edited_issue_url
        - edit_reason
      must_discard:
        - all prior CONTRACT_REVIEW_RESULT_V1 comments whose body_sha256 != current body
      must_rerun:
        - issue-contract-review against current body
      resume_only_if:
        - latest valid CONTRACT_REVIEW_RESULT_V1.status == go
        - generated_by == issue-contract-review
        - issue_url == current issue
        - body_sha256 == current body
    

    Major: #543 の例を simple_contract_hygiene_fix と断定するのは危険

    #543 は人間の manual playtest 証跡を docs/playtest/m2-combat-mvp.md に追加する Issue で、AI / Playwright の自動代替は不可と明記されています。(GitHub)
    その中で tested_commit: が既存 frontmatter にあるため baseline pass した、という問題は単なる preflight-scope: pr_review_only 付与で済むとは限りません。(GitHub)

    より安全な修正は、VC を 対象セクション限定 にすることです。

    awk '/^## Human Playtest Evidence/{flag=1} flag' docs/playtest/m2-combat-mvp.md \
      | rg "tested_commit:"
    

    preflight-scope: pr_review_only は「存在確認が baseline 差分性を持てないが、PR reviewer が変更 diff 上で確認すればよい」場合に限るべきです。人間 playtest 証跡の正当性や実施事実は human_decision_required に寄せる方が安全です。


    Major: AC が token grep だけで、workflow 品質を検証していない

    #569 の AC1〜AC3 は simple_contract_hygiene_fix などの token が preparation.md に存在することだけを検証しています。(GitHub)
    これは「3分類が運用できる」「worker mutation が安全」「body_sha256 stale を扱える」「#543 型の停止が再発しない」を検証しません。

    #564 は同種の handoff 問題に対し、#561 型の regression fixture / integration test を追加する方針を取っています。(GitHub)
    #569 も docs-only にこだわるなら、最低限 preparation.md 内に decision table と worked examples を AC 化すべきです。より堅い実装なら .claude/skills/impl-review-loop/tests/ を Allowed Paths に加えて fixture 化するべきです。


    外部仕様調査からの実装上の示唆

    Claude Code skills は prompt-based で、Claude に詳細手順を与えてツール orchestration させる仕組みです。つまり skill 文書だけでは deterministic enforcement にはなりません。(Claude API Docs)
    一方、Claude Code hooks は PreToolUse / PostToolUse / Stop / SubagentStop などで tool call や停止をブロックでき、JSON decision や exit code 2 による制御が可能です。(Claude API Docs)
    subagent には frontmatter hooks や project-level SubagentStart / SubagentStop hooks も設定できます。(Claude API Docs)

    従って #569 の高品質化方向は、単なる prose 追加ではなく、少なくとも将来 Issue として次を切ることです。

    実装: contract-hygiene-worker の Issue body mutation を PreToolUse hook で制限する
    

    目的:

    • simple_contract_hygiene_fix のみ Issue body edit を許可
    • Allowed mutation は preflight-scope 付与、VC 対象セクション限定、comment 追記に限定
    • Outcome / AC / Allowed Paths / acceptance semantics の変更を deny
    • body_sha256 mismatch 時は必ず issue-contract-review rerun

    Claude Code のセキュリティモデルも、編集・コマンド実行は権限ベースで扱われ、write scope や許可ルールを明示する前提です。(Claude API Docs)


    推奨する #569 修正方針

    1. 実装: impl-review-loop の contract blocked 時エスカレーションを blocked reason 3 分類と worker 自律修正手順に置換する #569 を 実装: issue-refinement-loop と impl-review-loop の implementation-ready handoff を contract gate 化する #564 後続または 実装: issue-refinement-loop と impl-review-loop の implementation-ready handoff を contract gate 化する #564 依存 と明記する。human_escalation 置換ではなく intake_gate_failed.vc_preflight.contract_blocked_reason として統合する。

    2. Verification Commands に preflight-scope を付ける。特に pnpm typecheck/lint/test/build は runtime_only。

    3. “worker” を明確化する。
      implementation-worker ではなく、contract-hygiene-worker または issue-refinement-loop に route する。blocked 時に orchestrator が直接 Issue 本文を書き換えない。

    4. simple_contract_hygiene_fix の自律修正許可条件を限定する。
      許可してよいのは preflight-scope 付与、section-scoped VC、明らかな grep 対象の限定などに限る。AC / Outcome / Allowed Paths / acceptance semantics 変更は不可。

    5. body mutation 後の body_sha256 stale invalidation と latest CONTRACT_REVIEW_RESULT_V1.status == go 再取得を必須化する。

    6. test(#483): manual playtest の実施証跡を docs/playtest/m2-combat-mvp.md に追加する #543 型 example を明記する。
      tested_commit: は pr_review_only ではなく、まず ## Human Playtest Evidence セクション限定 VC に修正する例を載せる。人間 playtest 実施事実の判断は human_decision_required。

    7. AC を token grep から decision table / examples / stale handling の存在確認へ強化する。


    そのまま Issue コメントに投げるなら

    REQUEST_CHANGES.
    
    

    主な blocker:

    1. Verification Commands の AC4-AC7 に preflight-scope: runtime_only がなく、#560 で定義した per-command marker 規約に反している。この Issue 自身が baseline pass による contract blocked を再発させる可能性がある。

    2. simple_contract_hygiene_fix 時に “worker が Issue 本文を修正” とあるが、blocked 時点では implementation-worker は起動されない。orchestrator が Issue body mutation を行う設計に読め、control-plane / data-plane 分離に反する。contract-hygiene-worker を定義するか、既存 issue-refinement-loop に route すること。

    3. #564 の intake_gate_failed / missing_contract_go / stale_contract_review / body_snapshot_mismatch taxonomy と衝突している。#569 の分類は human_escalation の置換ではなく、intake_gate_failed.vc_preflight.contract_blocked_reason として統合すべき。

    4. Issue 本文 mutation 後の body_sha256 stale invalidation、latest CONTRACT_REVIEW_RESULT_V1.status == go 再取得、古い go comment 無効化が AC に入っていない。

    5. #543 の tested_commit: 問題は単純な preflight-scope: pr_review_only 付与では危険。まず ## Human Playtest Evidence セクション限定 VC にする例を simple_contract_hygiene_fix の canonical example とし、playtest 証跡の正当性判断は human_decision_required に分類すること。

    6. AC1-AC3 が token grep だけで、3分類が運用可能か検証していない。decision table と worked examples の存在確認、可能なら regression fixture を追加すること。

    #569 は 発想は正しいが、現在の契約は実装準備未完了 です。修正後に issue-contract-review を再実行して status: go を得てから impl-review-loop に渡すべきです。

    ## 結論: **REQUEST_CHANGES / 実装着手は止めるべき**

    #569 は方向性自体は妥当です。#543 で tested_commit: の VC が baseline で既に pass し、impl-review-loop が「修正後に再実行してください」という人間向け停止に落ちた、という問題設定は正しいです。#569 はこれを simple_contract_hygiene_fix / contract_refinement_required / human_decision_required の 3 分類で扱う設計にしようとしています。([GitHub]1)

    ただし、現 Issue は 自分自身が同じ contract preflight 問題を再発させる形 になっており、さらに #560 / #564 と責務境界が衝突しています。このまま ClaudeCode に実装させると、また issue-contract-review status: blocked か、control-plane が data-plane 作業を抱える設計劣化を起こす可能性が高いです。


    Blocker 1: #569 自身の VC が baseline pass し得る。preflight-scope がない

    #569 の Verification Commands は AC1〜AC3 の rg に加えて、AC4〜AC7 に pnpm typecheck / lint / test / build をそのまま並べています。([GitHub]1)
    しかし #560 では、VC baseline 差分性と preflight-scope marker の per-command 規約を導入し、runtime-only の確認は各 $ コマンド直前に明示する前提になっています。([GitHub]2)

    このため、#569 は最低限こう直すべきです。

    # AC4
    # preflight-scope: runtime_only
    $ pnpm typecheck
    
    # AC5
    # preflight-scope: runtime_only
    $ pnpm lint
    
    # AC6
    # preflight-scope: runtime_only
    $ pnpm test
    
    # AC7
    # preflight-scope: runtime_only
    $ pnpm build

    AC1〜AC3 も、baseline で tokens がまだ存在しないことを期待するなら runtime_only ではなく差分 VC として成立します。ただし実装後に token だけを入れても意味論が満たされたとは限らないため、後述の matrix / examples の検証が必要です。


    Blocker 2: 「worker が Issue 本文を修正する」の actor が未定義

    #569 は simple_contract_hygiene_fix の場合に “worker が Issue 本文を修正し issue-contract-review を再実行する” としています。([GitHub]1)
    一方、現在の impl-review-loop preparation は vc_preflight.status が pass の場合だけ implementation-worker を起動し、blocked / human_judgment は停止して human_escalation に送る設計です。([GitHub]3)

    つまり、blocked 時点では通常の implementation-worker はまだ起動されません。ここで “worker” とだけ書くと、実際には orchestrator / main session が Issue 本文編集や gh issue edit を実行する余地が残ります。これは #564 の「control-plane が作業内容や gate 判断を抱えず、worker / deterministic checker 側に責務を寄せる」という設計方針と衝突します。([GitHub][4])

    修正方針は二択です。

    1. 既存 issue-refinement-loop に戻す
      simple_contract_hygiene_fix でも、Issue 本文 mutation は issue-refinement 系 worker の責務に寄せる。

    2. 新しい contract-hygiene-worker を定義する
      ただし 実装: impl-review-loop の contract blocked 時エスカレーションを blocked reason 3 分類と worker 自律修正手順に置換する #569 の Allowed Paths は preparation.md と SKILL.md だけなので、subagent 定義や hook 追加が必要なら 実装: impl-review-loop の contract blocked 時エスカレーションを blocked reason 3 分類と worker 自律修正手順に置換する #569 のスコープを広げるか、別 Issue に分ける必要があります。現在の Stop Conditions は nested SubAgent delegation を止めるため、worker 導入とも矛盾します。([GitHub]1)


    Blocker 3: #564 の intake_gate_failed と #569 の human_escalation 更新が衝突する

    #564 は impl-review-loop preparation に intake_gate_failed を独立した termination_reason として追加し、missing_contract_go / metadata_not_ready / stale_contract_review / body_snapshot_mismatch のサブ理由を持たせる設計です。([GitHub][4])
    #569 は SKILL.md の human_escalation 説明を新分類に沿って更新するだけなので、#564 の状態体系を取り込まないと termination taxonomy が二重化します。([GitHub]1)

    推奨は、#569 の分類を human_escalation の置換ではなく、次のように #564 側の intake gate vocabulary に接続することです。

    termination_reason: intake_gate_failed
    intake_gate_failed:
      gate: vc_preflight
      contract_blocked_reason:
        class: simple_contract_hygiene_fix | contract_refinement_required | human_decision_required
        source: latest CONTRACT_REVIEW_RESULT_V1.checks.vc_preflight
        autonomous_fix_allowed: true | false

    Blocker 4: 3分類の判定基準が LLM 任せで、決定論的でない

    #569 は分類自動化スクリプト追加を Out of Scope にしています。([GitHub]1)
    それ自体は許容できますが、ならば preparation.md に 既存 CONTRACT_REVIEW_RESULT_V1.checks.vc_preflight.classifications[] から 3分類へ落とす決定表 が必要です。現在の preparation は vc_preflight.classifications[] を正本として参照する設計なので、分類もこの既存データから派生させるべきです。([GitHub]3)

    最低限、こういう表が必要です。

    入力条件 分類
    unexpected_pass で、修正が preflight-scope 付与または対象セクション限定に閉じ、AC/VC/Allowed Paths/acceptance semantics を変えない simple_contract_hygiene_fix
    VC の対象、AC の意味、Allowed Paths、Outcome、scope を変える必要がある contract_refinement_required
    playtest 証跡の正当性、仕様判断、人間操作の事実確認が必要 human_decision_required
    分類根拠が不足 human_decision_required または fail-closed

    Claude Code 公式ドキュメント上も、Markdown の指示は挙動を形成するもので、強制層ではありません。強制したい場合は settings / hooks 側でブロックする必要があります。([Claude API Docs][5])


    Blocker 5: Issue 本文 mutation 後の stale snapshot 無効化が不足

    #560 は、human_escalation 後に Issue 本文を 1 文字でも変更した場合、prior contract-review result は stale になり、full contract review 再実行が必要だと定義しています。([GitHub]2)
    #564 も body_sha256 と comment freshness を intake gate に入れ、古い status: go を無効化する設計です。([GitHub][4])

    #569 は “Issue 本文を修正し issue-contract-review を再実行” とは書いていますが、以下が足りません。

    after_issue_body_mutation:
      must_record:
        - old_body_sha256
        - new_body_sha256
        - edited_issue_url
        - edit_reason
      must_discard:
        - all prior CONTRACT_REVIEW_RESULT_V1 comments whose body_sha256 != current body
      must_rerun:
        - issue-contract-review against current body
      resume_only_if:
        - latest valid CONTRACT_REVIEW_RESULT_V1.status == go
        - generated_by == issue-contract-review
        - issue_url == current issue
        - body_sha256 == current body

    Major: #543 の例を simple_contract_hygiene_fix と断定するのは危険

    #543 は人間の manual playtest 証跡を docs/playtest/m2-combat-mvp.md に追加する Issue で、AI / Playwright の自動代替は不可と明記されています。([GitHub][6])
    その中で tested_commit: が既存 frontmatter にあるため baseline pass した、という問題は単なる preflight-scope: pr_review_only 付与で済むとは限りません。([GitHub]1)

    より安全な修正は、VC を 対象セクション限定 にすることです。

    awk '/^## Human Playtest Evidence/{flag=1} flag' docs/playtest/m2-combat-mvp.md \
      | rg "tested_commit:"

    preflight-scope: pr_review_only は「存在確認が baseline 差分性を持てないが、PR reviewer が変更 diff 上で確認すればよい」場合に限るべきです。人間 playtest 証跡の正当性や実施事実は human_decision_required に寄せる方が安全です。


    Major: AC が token grep だけで、workflow 品質を検証していない

    #569 の AC1〜AC3 は simple_contract_hygiene_fix などの token が preparation.md に存在することだけを検証しています。([GitHub]1)
    これは「3分類が運用できる」「worker mutation が安全」「body_sha256 stale を扱える」「#543 型の停止が再発しない」を検証しません。

    #564 は同種の handoff 問題に対し、#561 型の regression fixture / integration test を追加する方針を取っています。([GitHub][4])
    #569 も docs-only にこだわるなら、最低限 preparation.md 内に decision table と worked examples を AC 化すべきです。より堅い実装なら .claude/skills/impl-review-loop/tests/ を Allowed Paths に加えて fixture 化するべきです。


    外部仕様調査からの実装上の示唆

    Claude Code skills は prompt-based で、Claude に詳細手順を与えてツール orchestration させる仕組みです。つまり skill 文書だけでは deterministic enforcement にはなりません。([Claude API Docs][7])
    一方、Claude Code hooks は PreToolUse / PostToolUse / Stop / SubagentStop などで tool call や停止をブロックでき、JSON decision や exit code 2 による制御が可能です。([Claude API Docs][8])
    subagent には frontmatter hooks や project-level SubagentStart / SubagentStop hooks も設定できます。([Claude API Docs][9])

    従って #569 の高品質化方向は、単なる prose 追加ではなく、少なくとも将来 Issue として次を切ることです。

    実装: contract-hygiene-worker の Issue body mutation を PreToolUse hook で制限する
    
    目的:
    - simple_contract_hygiene_fix のみ Issue body edit を許可
    - Allowed mutation は preflight-scope 付与、VC 対象セクション限定、comment 追記に限定
    - Outcome / AC / Allowed Paths / acceptance semantics の変更を deny
    - body_sha256 mismatch 時は必ず issue-contract-review rerun

    Claude Code のセキュリティモデルも、編集・コマンド実行は権限ベースで扱われ、write scope や許可ルールを明示する前提です。([Claude API Docs][10])


    推奨する #569 修正方針

    1. 実装: impl-review-loop の contract blocked 時エスカレーションを blocked reason 3 分類と worker 自律修正手順に置換する #569 を 実装: issue-refinement-loop と impl-review-loop の implementation-ready handoff を contract gate 化する #564 後続または 実装: issue-refinement-loop と impl-review-loop の implementation-ready handoff を contract gate 化する #564 依存 と明記する。human_escalation 置換ではなく intake_gate_failed.vc_preflight.contract_blocked_reason として統合する。

    2. Verification Commands に preflight-scope を付ける。特に pnpm typecheck/lint/test/build は runtime_only。

    3. “worker” を明確化する。
      implementation-worker ではなく、contract-hygiene-worker または issue-refinement-loop に route する。blocked 時に orchestrator が直接 Issue 本文を書き換えない。

    4. simple_contract_hygiene_fix の自律修正許可条件を限定する。
      許可してよいのは preflight-scope 付与、section-scoped VC、明らかな grep 対象の限定などに限る。AC / Outcome / Allowed Paths / acceptance semantics 変更は不可。

    5. body mutation 後の body_sha256 stale invalidation と latest CONTRACT_REVIEW_RESULT_V1.status == go 再取得を必須化する。

    6. test(#483): manual playtest の実施証跡を docs/playtest/m2-combat-mvp.md に追加する #543 型 example を明記する。
      tested_commit: は pr_review_only ではなく、まず ## Human Playtest Evidence セクション限定 VC に修正する例を載せる。人間 playtest 実施事実の判断は human_decision_required。

    7. AC を token grep から decision table / examples / stale handling の存在確認へ強化する。


    そのまま Issue コメントに投げるなら

    REQUEST_CHANGES.
    
    主な blocker:
    
    1. Verification Commands の AC4-AC7 に `preflight-scope: runtime_only` がなく、#560 で定義した per-command marker 規約に反している。この Issue 自身が baseline pass による contract blocked を再発させる可能性がある。
    
    2. `simple_contract_hygiene_fix` 時に “worker が Issue 本文を修正” とあるが、blocked 時点では implementation-worker は起動されない。orchestrator が Issue body mutation を行う設計に読め、control-plane / data-plane 分離に反する。`contract-hygiene-worker` を定義するか、既存 issue-refinement-loop に route すること。
    
    3. #564 の `intake_gate_failed` / `missing_contract_go` / `stale_contract_review` / `body_snapshot_mismatch` taxonomy と衝突している。#569 の分類は `human_escalation` の置換ではなく、`intake_gate_failed.vc_preflight.contract_blocked_reason` として統合すべき。
    
    4. Issue 本文 mutation 後の `body_sha256` stale invalidation、latest `CONTRACT_REVIEW_RESULT_V1.status == go` 再取得、古い go comment 無効化が AC に入っていない。
    
    5. #543 の `tested_commit:` 問題は単純な `preflight-scope: pr_review_only` 付与では危険。まず `## Human Playtest Evidence` セクション限定 VC にする例を `simple_contract_hygiene_fix` の canonical example とし、playtest 証跡の正当性判断は `human_decision_required` に分類すること。
    
    6. AC1-AC3 が token grep だけで、3分類が運用可能か検証していない。decision table と worked examples の存在確認、可能なら regression fixture を追加すること。

    #569 は 発想は正しいが、現在の契約は実装準備未完了 です。修正後に issue-contract-review を再実行して status: go を得てから impl-review-loop に渡すべきです。

    # 既存衝突確認
    git worktree list | grep "$WORKTREE" && echo "[WARN] worktree 既存" || echo "[OK] worktree 未作成"
    git branch --list "$BRANCH" && echo "[WARN] branch 既存" || echo "[OK] branch 未作成"
    ```

    既存衝突あり → 過去のイテレーションの残骸の可能性。人間判断を仰ぐ。

    ## 4. Product Spec Gate 評価完了後の LOOP_STATE 初期化

    Product Spec Check 評価(1-d)を完了後、iteration = 0 で以下の状態で開始:

    ```yaml
    LOOP_STATE:
    issue_number:
    contract_snapshot_url:
    contract_snapshot_source: provided | detected_existing | materialized_by_issue_contract_review
    iteration: 0
    max_iterations: 3
    worktree: .claude/worktrees/issue-<番号>-
    branch: worktree-issue-<番号>-
    last_step: null
    last_loop_verdict: null
    blockers_history: []
    external_research_skip_basis: null
    termination_reason: null
    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: ""
    body_sha256: ""
    routing_action: continue | stop_human | refresh_contract_snapshot
    ```

    routing_action が stop_human または refresh_contract_snapshot の場合は、ループを開始せず人間判断へ escalate する。

    ## 5. 外部仕様調査スキップ判断(任意)

    internal-only 変更(src/state / src/systems 内の純粋ロジック変更等)なら external_research_skip_basis に理由を記録してスキップ。
    外部仕様が絡む場合は gemini-cli-headless-delegation を先行起動して情報を集める。

    ## 出力

    LOOP_STATE 初期値を会話履歴に明示記録し、Step 1(Implementation)へ進む。
    "
    [4]: #564 "実装: issue-refinement-loop と impl-review-loop の implementation-ready handoff を contract gate 化する · Issue #564 · squne121/loop-protocol · GitHub"
    [5]: https://docs.anthropic.com/en/docs/claude-code/memory "How Claude remembers your project - Claude Code Docs"
    [6]: #543 "test(#483): manual playtest の実施証跡を docs/playtest/m2-combat-mvp.md に追加する · Issue #543 · squne121/loop-protocol · GitHub"
    [7]: https://docs.anthropic.com/en/docs/claude-code/skills "Extend Claude with skills - Claude Code Docs"
    [8]: https://docs.anthropic.com/en/docs/claude-code/hooks "Hooks reference - Claude Code Docs"
    [9]: https://docs.anthropic.com/en/docs/claude-code/sub-agents "Create custom subagents - Claude Code Docs"
    [10]: https://docs.anthropic.com/en/docs/claude-code/security "Security - Claude Code Docs"

  3. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    人間からのコメントです。
    「ただし、現 Issue は 自分自身が同じ contract preflight 問題を再発させる形 になっており、さらに #560 / #564 と責務境界が衝突しています。このまま ClaudeCode に実装させると、また issue-contract-review status: blocked か、control-plane が data-plane 作業を抱える設計劣化を起こす可能性が高いです。」再発しないようにエージェントスキルの改善案を別イシューとして検討してほしい。

  4. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    #569 (comment)

    推奨は #569 をこのまま実装させず、新規 Issue で「Issue 作成・編集・refinement 出力の公開前 self-preflight」を先に設計する です。

    理由は明確です。#569 は impl-review-loop の blocked 時分類を追加する Issue ですが、検証コマンドに pnpm typecheck/lint/test/build のような baseline で既に PASS し得る一般検証を含んでおり、再び contract preflight に引っかかる構造です。さらに #560 は refinement 完了後の CONTRACT_REVIEW_RESULT_V1.status == "go" final gate、#564 は issue-refinement-loop → issue-contract-review → impl-review-loop の handoff gate を扱っており、#569 が「blocked 後の worker 自律修正」まで持つと責務境界が衝突します。([GitHub]1)

    Claude Code 的にも、これは「手順書に注意書きを足す」だけでなく、hook / script / subagent の組み合わせで公開前に止めるのが筋です。Claude Code hooks は PreToolUse で tool call 前に実行でき、JSON 出力で allow/block/escalate を制御できます。subagent は独立 context・tool 制限を持てるため、control-plane に data-plane の契約判断を抱え込ませない用途に合います。([Claude Code]2)

    別 Issue 起票案

    Title

    実装: Issue 作成・編集スキルに contract draft self-preflight と scope-collision guard を追加する
    

    Body

    ## Machine-Readable Contract
    
    ```yaml
    contract_schema_version: v1
    issue_kind: implementation
    parent_issue: "569"
    goal_ref: "create-issue / edit-issue / issue-refinement-loop が implementation Issue を公開する前に、contract draft self-preflight と scope collision check を実行し、baseline で通る VC・既存 gate Issue との責務衝突・control-plane/data-plane 混入を fail-closed で防ぐ"
    change_kind: workflow

    Parent Issue

    #569 の post-mortem / scope split。

    Parent Goal Ref

    Goal: #569 型の「contract preflight 問題を直す Issue 自体が、同じ contract preflight 問題を再発させる」構造を公開前に検出する。

    Desired Destination: Issue 本文を gh issue create/edit または gh api で公開する前に、draft body に対して machine-readable な self-preflight が走り、以下を fail-closed で止める。

    Background

    #569 は impl-review-loop が issue-contract-review status: blocked を受けた後の分類・自律修正手順を追加する Issue だが、Issue 自体に generic verification command が含まれており、baseline で通り得る VC を再導入する危険がある。

    また、#560 は issue-refinement-loop の complete 条件に contract gate を追加する scope、#564 は issue-refinement-loop と impl-review-loop の handoff を contract gate 化する scopeであり、#569 が worker 自律修正・contract gate・handoff を同時に持つと責務境界が崩れる。

    この問題は #569 内で直すのではなく、Issue 作成・編集・refinement 出力を公開する前段で防ぐ必要がある。

    Current Validated Scope

    • .claude/skills/create-issue/SKILL.md に ISSUE_CONTRACT_DRAFT_PREFLIGHT_V1 を mandatory step として追加する
    • .claude/skills/edit-issue/SKILL.md に Issue 本文更新前の同 self-preflight を追加する
    • .claude/skills/issue-refinement-loop/references/termination-policy.md に「implementation-ready handoff 前に draft self-preflight が pass していること」を追記する
    • .claude/hooks/guard-gh-issue-contract-draft.sh を追加し、gh issue create/edit と gh api .../issues/... の body 更新を対象に、公開前 draft body を検査する
    • .claude/skills/create-issue/scripts/contract_draft_self_preflight.py を追加し、hook と skill の両方から同じ判定ロジックを使う
    • 必要なら .claude/agents/contract-boundary-reviewer.md を追加し、scope-collision 判定のみを read-only subagent に委譲する

    In Scope

    Out of Scope

    Acceptance Criteria

    Verification Commands

    # AC1
    rg -n 'ISSUE_CONTRACT_DRAFT_PREFLIGHT_V1|contract_draft_self_preflight' .claude/skills/create-issue/SKILL.md
    
    # AC2
    rg -n 'ISSUE_CONTRACT_DRAFT_PREFLIGHT_V1|contract_draft_self_preflight' .claude/skills/edit-issue/SKILL.md
    
    # AC3
    test -f .claude/skills/create-issue/scripts/contract_draft_self_preflight.py
    
    # AC4
    test -f .claude/hooks/guard-gh-issue-contract-draft.sh
    
    # AC5
    rg -n 'scope_collision_with_active_gate_issue|560|564|569' .claude/skills/create-issue .claude/skills/edit-issue .claude/agents .claude/hooks
    
    # AC6
    rg -n 'generic_pass_command_without_pr_review_only|preflight-scope: pr_review_only' .claude/skills/create-issue .claude/skills/edit-issue .claude/hooks
    
    # AC7
    rg -n 'control_plane_data_plane_boundary_violation|contract-boundary-reviewer|data-plane' .claude/skills/create-issue .claude/skills/edit-issue .claude/agents docs/dev

    Allowed Paths

    • .claude/skills/create-issue/SKILL.md
    • .claude/skills/edit-issue/SKILL.md
    • .claude/skills/issue-refinement-loop/references/termination-policy.md
    • .claude/skills/create-issue/scripts/contract_draft_self_preflight.py
    • .claude/hooks/guard-gh-issue-contract-draft.sh
    • .claude/hooks/tests/**
    • .claude/agents/contract-boundary-reviewer.md
    • docs/dev/agent-skill-boundaries.md
    • docs/dev/github-ops.md

    Stop Conditions

    Delivery Rule

    1 Issue = 1 PR。まずこの Issue で公開前 self-preflight を導入し、その後 #569 を再 refine する。

    
    ## #569 への即時コメント案
    
    ```markdown
    この Issue は一旦そのまま実装に流さないでください。
    
    理由:
    - 現 Issue 自体が generic verification command を含み、baseline で PASS し得る VC を再導入している
    - #560 / #564 と contract gate / handoff / responsibility boundary が重なっている
    - blocked 後の worker 自律修正を `impl-review-loop` に寄せる前に、Issue 作成・編集・refinement 出力の公開前 self-preflight を導入すべき
    
    推奨:
    1. 新規 Issue「Issue 作成・編集スキルに contract draft self-preflight と scope-collision guard を追加する」を先に起票
    2. その完了後に #569 を再 refine
    3. #569 の generic `pnpm typecheck/lint/test/build` は primary VC から外すか、`preflight-scope: pr_review_only` を per-command で付与する
    4. #560 / #564 で扱う final gate / handoff gate は #569 の Out of Scope に明示する
    

    結論として、#569 の前にこの新規 Issue を挟むべきです。既に .claude/hooks と PreToolUse 設定は存在するため、単なる運用文書ではなく hook で publish 前に止める実装まで含めるのが妥当です。([GitHub]3)

    推奨は #569 をこのまま実装させず、新規 Issue で「Issue 作成・編集・refinement 出力の公開前 self-preflight」を先に設計する です。

    理由は明確です。#569 は impl-review-loop の blocked 時分類を追加する Issue ですが、検証コマンドに pnpm typecheck/lint/test/build のような baseline で既に PASS し得る一般検証を含んでおり、再び contract preflight に引っかかる構造です。さらに #560 は refinement 完了後の CONTRACT_REVIEW_RESULT_V1.status == "go" final gate、#564 は issue-refinement-loop → issue-contract-review → impl-review-loop の handoff gate を扱っており、#569 が「blocked 後の worker 自律修正」まで持つと責務境界が衝突します。([GitHub]1)

    Claude Code 的にも、これは「手順書に注意書きを足す」だけでなく、hook / script / subagent の組み合わせで公開前に止めるのが筋です。Claude Code hooks は PreToolUse で tool call 前に実行でき、JSON 出力で allow/block/escalate を制御できます。subagent は独立 context・tool 制限を持てるため、control-plane に data-plane の契約判断を抱え込ませない用途に合います。([Claude Code]2)

    別 Issue 起票案

    Title

    実装: Issue 作成・編集スキルに contract draft self-preflight と scope-collision guard を追加する
    

    Body

    ## Machine-Readable Contract
    
    ```yaml
    contract_schema_version: v1
    issue_kind: implementation
    parent_issue: "569"
    goal_ref: "create-issue / edit-issue / issue-refinement-loop が implementation Issue を公開する前に、contract draft self-preflight と scope collision check を実行し、baseline で通る VC・既存 gate Issue との責務衝突・control-plane/data-plane 混入を fail-closed で防ぐ"
    change_kind: workflow

    Parent Issue

    #569 の post-mortem / scope split。

    Parent Goal Ref

    Goal: #569 型の「contract preflight 問題を直す Issue 自体が、同じ contract preflight 問題を再発させる」構造を公開前に検出する。

    Desired Destination: Issue 本文を gh issue create/edit または gh api で公開する前に、draft body に対して machine-readable な self-preflight が走り、以下を fail-closed で止める。

    Background

    #569 は impl-review-loop が issue-contract-review status: blocked を受けた後の分類・自律修正手順を追加する Issue だが、Issue 自体に generic verification command が含まれており、baseline で通り得る VC を再導入する危険がある。

    また、#560 は issue-refinement-loop の complete 条件に contract gate を追加する scope、#564 は issue-refinement-loop と impl-review-loop の handoff を contract gate 化する scopeであり、#569 が worker 自律修正・contract gate・handoff を同時に持つと責務境界が崩れる。

    この問題は #569 内で直すのではなく、Issue 作成・編集・refinement 出力を公開する前段で防ぐ必要がある。

    Current Validated Scope

    • .claude/skills/create-issue/SKILL.md に ISSUE_CONTRACT_DRAFT_PREFLIGHT_V1 を mandatory step として追加する
    • .claude/skills/edit-issue/SKILL.md に Issue 本文更新前の同 self-preflight を追加する
    • .claude/skills/issue-refinement-loop/references/termination-policy.md に「implementation-ready handoff 前に draft self-preflight が pass していること」を追記する
    • .claude/hooks/guard-gh-issue-contract-draft.sh を追加し、gh issue create/edit と gh api .../issues/... の body 更新を対象に、公開前 draft body を検査する
    • .claude/skills/create-issue/scripts/contract_draft_self_preflight.py を追加し、hook と skill の両方から同じ判定ロジックを使う
    • 必要なら .claude/agents/contract-boundary-reviewer.md を追加し、scope-collision 判定のみを read-only subagent に委譲する

    In Scope

    Out of Scope

    Acceptance Criteria

    Verification Commands

    # AC1
    rg -n 'ISSUE_CONTRACT_DRAFT_PREFLIGHT_V1|contract_draft_self_preflight' .claude/skills/create-issue/SKILL.md
    
    # AC2
    rg -n 'ISSUE_CONTRACT_DRAFT_PREFLIGHT_V1|contract_draft_self_preflight' .claude/skills/edit-issue/SKILL.md
    
    # AC3
    test -f .claude/skills/create-issue/scripts/contract_draft_self_preflight.py
    
    # AC4
    test -f .claude/hooks/guard-gh-issue-contract-draft.sh
    
    # AC5
    rg -n 'scope_collision_with_active_gate_issue|560|564|569' .claude/skills/create-issue .claude/skills/edit-issue .claude/agents .claude/hooks
    
    # AC6
    rg -n 'generic_pass_command_without_pr_review_only|preflight-scope: pr_review_only' .claude/skills/create-issue .claude/skills/edit-issue .claude/hooks
    
    # AC7
    rg -n 'control_plane_data_plane_boundary_violation|contract-boundary-reviewer|data-plane' .claude/skills/create-issue .claude/skills/edit-issue .claude/agents docs/dev

    Allowed Paths

    • .claude/skills/create-issue/SKILL.md
    • .claude/skills/edit-issue/SKILL.md
    • .claude/skills/issue-refinement-loop/references/termination-policy.md
    • .claude/skills/create-issue/scripts/contract_draft_self_preflight.py
    • .claude/hooks/guard-gh-issue-contract-draft.sh
    • .claude/hooks/tests/**
    • .claude/agents/contract-boundary-reviewer.md
    • docs/dev/agent-skill-boundaries.md
    • docs/dev/github-ops.md

    Stop Conditions

    Delivery Rule

    1 Issue = 1 PR。まずこの Issue で公開前 self-preflight を導入し、その後 #569 を再 refine する。

    
    ## #569 への即時コメント案
    
    ```markdown
    この Issue は一旦そのまま実装に流さないでください。
    
    理由:
    - 現 Issue 自体が generic verification command を含み、baseline で PASS し得る VC を再導入している
    - #560 / #564 と contract gate / handoff / responsibility boundary が重なっている
    - blocked 後の worker 自律修正を `impl-review-loop` に寄せる前に、Issue 作成・編集・refinement 出力の公開前 self-preflight を導入すべき
    
    推奨:
    1. 新規 Issue「Issue 作成・編集スキルに contract draft self-preflight と scope-collision guard を追加する」を先に起票
    2. その完了後に #569 を再 refine
    3. #569 の generic `pnpm typecheck/lint/test/build` は primary VC から外すか、`preflight-scope: pr_review_only` を per-command で付与する
    4. #560 / #564 で扱う final gate / handoff gate は #569 の Out of Scope に明示する
    

    結論として、#569 の前にこの新規 Issue を挟むべきです。既に .claude/hooks と PreToolUse 設定は存在するため、単なる運用文書ではなく hook で publish 前に止める実装まで含めるのが妥当です。([GitHub]3)

  5. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了レポート

    LOOP_TERMINATION_RESULT_V1:
      termination_reason: human_escalation
      max_iterations: 3
      iterations_completed: 3
      final_verdict: needs-fix
    
    blockers_history:
      - iteration: 0
        blockers:
          - "C4 FAIL: Verification Commands に $ prefix がない"
          - "Blocker 1: AC4-AC7 に preflight-scope: runtime_only marker がない"
          - "Blocker 2: simple_contract_hygiene_fix の修正主体(worker)が未定義"
          - "Blocker 3: #564 intake_gate_failed vocabulary との衝突"
          - "Blocker 4: decision table / matrix が未定義"
        applied_fixes:
          - "AC4-AC7 pnpm コマンドに # preflight-scope: runtime_only 追加"
          - "worker 修正主体を orchestrator + issue-refinement-loop 経由に明確化"
          - "SKILL.md 更新を intake_gate_failed subpath 統合形式に変更"
          - "decision table を In Scope に追加"
          - "AC8 と対応 VC 追加"
          - "Out of Scope: human_escalation 置換禁止補足追加"
    
      - iteration: 1
        blockers:
          - "C4 FAIL: Verification Commands の各コマンドに $ prefix がない"
        applied_fixes:
          - "AC1-AC8 の全コマンドに $ prefix 追加"
    
      - iteration: 2
        blockers:
          - "C9 FAIL: ## Runtime Verification Applicability セクションが存在しない (legacy_missing_applicability)"
        applied_fixes: []
        reason_not_fixed: "max_iterations=3 を超過したため自動継続不可"

    残存 Blocker(人間修正待ち)

    C9: ## Runtime Verification Applicability セクションの欠如

    Issue 本文に以下のセクションを追加してください:

    ## Runtime Verification Applicability
    
    本 Issue は `.claude/skills/impl-review-loop/steps/preparation.md` と `.claude/skills/impl-review-loop/SKILL.md` のみを変更するドキュメント更新です。実行時の新規ランタイム動作は追加されません。
    
    \`\`\`yaml
    runtime_verification_applicability: not_applicable
    reason: "Markdown documentation-only change. No runtime behavior added or changed."
    \`\`\`

    修正後、再度 issue-refinement-loop 569 を実行するか、issue-contract-review を実行してください。


    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues:
        - title: "実装: Issue 作成・編集スキルに contract draft self-preflight と scope-collision guard を追加する"
          status: candidate
          source: "issuecomment-4599574596 (anchor comment 推奨)"
          dedupe_key: "create-issue-edit-issue-contract-draft-self-preflight"
          action: not_materialized
          reason: "human 承認後に起票推奨。#569 のスコープ外。"
      note_only_observations:
        - "anchor comment 4599574596 は #569 のスコープ分割と別 Issue 起票を推奨しており、C9 修正後に issue-contract-review が go になれば #569 の実装は進められる設計。"
  6. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    Contract Snapshot (2026-06-02T07:25:02Z)

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: 2026-06-02T07:25:02Z
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/569
      body_sha256: sha256:6f00d3ea77cab8f884c486b12b3dbcc01ab5303f74ca37131ecc45c9ba3f75eb
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: pass
        vc_preflight:
          passed: true
          vc_failed_as_expected: 4
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
          vc_expected_pass: 0
          vc_skipped: 4
          classifications:
            - ac: AC1
              command: 'rg "simple_contract_hygiene_fix" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC2
              command: 'rg "contract_refinement_required" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC3
              command: 'rg "human_decision_required" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC4
              command: pnpm typecheck
              exit_code: null
              classification: skipped
              category: preflight_scope_runtime_only
              scope_class: runtime_only
              confidence: low
              decision: go
              verification_owner: impl-review-loop
              deferred_reason: VC marked runtime_only; verification deferred to post-implementation runtime
              runtime_verification_required: true
            - ac: AC5
              command: pnpm lint
              exit_code: null
              classification: skipped
              category: preflight_scope_runtime_only
              scope_class: runtime_only
              confidence: low
              decision: go
              verification_owner: impl-review-loop
              deferred_reason: VC marked runtime_only; verification deferred to post-implementation runtime
              runtime_verification_required: true
            - ac: AC6
              command: pnpm test
              exit_code: null
              classification: skipped
              category: preflight_scope_runtime_only
              scope_class: runtime_only
              confidence: low
              decision: go
              verification_owner: impl-review-loop
              deferred_reason: VC marked runtime_only; verification deferred to post-implementation runtime
              runtime_verification_required: true
            - ac: AC7
              command: pnpm build
              exit_code: null
              classification: skipped
              category: preflight_scope_runtime_only
              scope_class: runtime_only
              confidence: low
              decision: go
              verification_owner: impl-review-loop
              deferred_reason: VC marked runtime_only; verification deferred to post-implementation runtime
              runtime_verification_required: true
            - ac: AC8
              command: 'rg "decision.table|分類.*matrix|contract_blocked_reason.*class" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
        ac_verifiability: pass
        product_spec_check:
          applicability: not_applicable
          decision: pass
        worktree_branch_collision: clear
      next_action: implement_issue
      blocked_reasons: []
      warnings: []

    Contract Summary

    • Outcome: .claude/skills/impl-review-loop/steps/preparation.md が更新され、issue-contract-review status: blocked 受信時に blocked reason を simple_contract_hygiene_fix / contract_refinement_required / human_decision_required の 3 種に分類し、simple_contract_hygiene_fix の場合は orchestrator が推奨修正案を提示して issue-refinement-loop 経由で自律修正後に issue-contract-review を再実行できる手順が明文化された状態で、pnpm typecheck / lint / test / build が全て PASS している。
    • Acceptance Criteria: AC1〜AC8
    • Verification Commands: AC1〜AC3, AC8: expected baseline fail (rg 0-hit) / AC4〜AC7: runtime_only (skipped)
    • Allowed Paths: .claude/skills/impl-review-loop/steps/preparation.md, .claude/skills/impl-review-loop/SKILL.md
    • Worktree: .claude/worktrees/issue-569-impl-review-loop-contract-blocked-blocke
    • Branch: worktree-issue-569-impl-review-loop-contract-blocked-blocke
    • VC preflight: baseline fail = 4, 想定外 pass = 0, 実行不可 = 0, skipped (runtime_only) = 4
  7. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES 相当。
    #569 の方向性は妥当ですが、このまま実装すると impl-review-loop の入口ゲート、契約レビュー再実行、Issue本文更新、VC preflight 分類の責務境界が曖昧になり、「contract blocked を自動修正できる」と見せかけて、実際には契約意味論や人間証跡判断まで自動化してしまう危険があります。#569 本体は preparation.md と SKILL.md の更新を対象にし、blocked reason を simple_contract_hygiene_fix / contract_refinement_required / human_decision_required に分ける設計ですが、現状のAC/VCはほぼ文字列存在確認で、制御フローの安全性を検証できません。([GitHub]1)

    主要ブロッカー

    1. #564 の fail-only intake gate と衝突する記述が残る

    #564 / PR #568 では、impl-review-loop は issue-contract-review を自動実行せず、最新の CONTRACT_REVIEW_RESULT_V1 status: go がなければ intake_gate_failed で止める方針になっています。PR #568 でも「auto issue-contract-review execution path」を deprecated にしています。([GitHub]2)

    一方、現在の SKILL.md にはまだ「contract_snapshot_url がなければ go コメントを探し、なければ issue-contract-review を auto-invoke する」という古い説明が残っています。([GitHub]3)
    #569 は human_escalation 語彙との統合だけでなく、この stale documentation を必ず修正対象に含めるべきです。

    修正方針:

    intake_gate_failed:
      subreason: vc_preflight_contract_blocked
      contract_blocked_reason:
        enum:
          - simple_contract_hygiene_fix
          - contract_refinement_required
          - human_decision_required
      auto_run_issue_contract_review: false
      rerun_allowed_only_after_issue_refinement_loop_mutation: true

    2. “simple_contract_hygiene_fix” の定義が広すぎる

    #569 は、preflight-scope: pr_review_only 追加や VC の対象セクション限定を「semantics unchanged」な簡易修正例として挙げています。([GitHub]1)
    しかし、VC の対象範囲を変えることは、場合によっては検証意味論の変更です。特に #543 の AC4 は tested_commit: が既存frontmatterにも存在しうるため、単純な rg "tested_commit:" は baseline で通ってしまう、という背景があります。#543 側では Human Playtest Evidence セクション、tested_commit、実行証跡、手動操作証跡がAC/VCに絡んでいます。([GitHub]4)

    simple_contract_hygiene_fix にしてよい条件を、最低限こう固定すべきです。

    simple_contract_hygiene_fix_allowed_if_all_true:
      - AC text is unchanged
      - Allowed Paths are unchanged
      - target evidence object is unchanged
      - VC is only narrowed to the intended post-change section/scope
      - blocked reason is deterministic and reproduced from vc_preflight.classifications[]
      - no product/spec/playtest/artifact sufficiency judgment is involved
      - issue body mutation is performed only through issue-refinement-loop
      - fresh issue-contract-review returns status: go for the new body_sha256

    逆に、動画証跡URL、環境情報、tested_commit の由来、accepted/deferred 判定、ローカルmp4のレビュー可能性などは、人間判断または契約再設計です。PR #570 のレビューでも、ローカル動画パス、環境情報不足、ビルド証跡不足、commit provenance 不明確性がブロッカーとして指摘されています。これらを “simple hygiene” に混ぜると危険です。([GitHub]5)

    3. #201 / PR #583 の classifier 境界を侵食している

    #569 の out-of-scope には「issue-contract-review baseline VC classifier logic change」は #201 が扱うと明記されています。([GitHub]1)
    実際、#201 / PR #583 は trivially_pass 分類を baseline_vc_preflight.py 側に追加し、match-ssot.sh --keywords --paths のような強制include系を classifier 側で扱う実装です。([GitHub]6)

    したがって #569 は新しい分類ロジックを作るのではなく、CONTRACT_REVIEW_RESULT_V1.checks.vc_preflight.classifications[] を消費して routing するだけに限定すべきです。分類が不明な場合は human_decision_required または contract_refinement_required に落とすのが安全です。

    4. issue-refinement-loop 経由の本文変更が未定義

    #569 は「simple の場合、issue-refinement-loop に route して Issue body を変更し、issue-contract-review を再実行し、go を得て再開」としています。([GitHub]1)
    ただし、#569 の out-of-scope では issue-refinement-loop 自体の変更を除外しています。つまり、どのI/O contractで issue-refinement-loop を呼ぶのか、本文更新後にどの hash を検証するのか、同時編集をどう検出するのかが未定義です。

    GitHub CLI では gh issue edit --body-file で本文更新でき、gh issue comment --body-file でコメントも追加できますが、制御プレーンが直接編集しないという #569 の意図を守るなら、編集主体・body hash・再レビュー結果URLを明示する必要があります。([GitHub CLI]7)

    推奨する出力スキーマ:

    CONTRACT_BLOCKED_ROUTING_V1:
      issue: 569
      source_contract_review_comment_url: string
      body_sha256_before: string
      vc_preflight_status: blocked | human_judgment
      classifications:
        - ac_id: string
          category: string
          original_vc: string
          observed_baseline_result: pass | fail | unknown
      contract_blocked_reason: simple_contract_hygiene_fix | contract_refinement_required | human_decision_required
      autonomous_fix_allowed: boolean
      required_route: issue-refinement-loop | human_escalation
      proposed_issue_body_patch_summary: string
      rerun_required:
        tool: issue-contract-review
        require_status: go
        require_body_sha256_after: string

    5. Safety Claim Matrix がACにない

    .claude/skills/** は安全性に関わる制御文書です。PR #568 ではこの点で一度 REQUEST_CHANGES になり、Safety Claim Matrix 追加後に approve されています。([GitHub]8)
    PR #583 も skills 配下変更に対して Safety Claim Matrix を含めています。([GitHub]9)

    #569 は .claude/skills/impl-review-loop/steps/preparation.md と SKILL.md を直接触るため、ACに以下を追加すべきです。

    - AC9: PR body に Safety Claim Matrix を含め、少なくとも以下を明示する:
      - Control-plane は Issue body を直接 mutate しない
      - 権限・認証・sandbox・hook 実行範囲を拡張しない
      - autonomous fix は contract hygiene のみに限定する
      - human_decision_required では必ず停止する

    Web調査に基づく高品質化ポイント

    Claude Code の Subagent は独立コンテキストで動作し、最終結果だけをメインに返すため、issue-refinement-loop や契約診断をサブエージェントに分離する設計とは相性がよいです。一方で、hooks は deterministic な制御・監査・ブロックに向いており、自然言語手順だけで安全性を担保するより、可能なら PreToolUse/PostToolUse/Stop hook やテストで不変条件を検査した方が堅いです。([Claude Code]10)

    ただし #569 は automation script 追加を out-of-scope にしているため、実装信頼性を上げるなら Allowed Paths を拡張してテストを追加するか、docs-only 改修であることを明記して期待値を下げるべきです。現状の rg だけのVCでは、単語が書いてあるだけでACを満たしてしまいます。([GitHub]1)

    動画・プレイテスト証跡については、GitHub は issue/PR コメントへのファイル添付をサポートし、動画は free plan で 10MB、paid plan で 100MB まで添付可能です。公開リポジトリの添付ファイルは認証なしで閲覧可能になる点も明記されています。ローカル file:// や docs/playtest/*.mp4 参照より、PR/Issueコメント添付URL + sha256 の方がレビュー可能性は高いです。([GitHub Docs]11)

    #569 に追加すべき修正版AC

    最低限、以下を足してください。

    - AC0: SKILL.md と preparation.md の #564 intake gate 仕様の齟齬を解消し、
      impl-review-loop が通常入口で issue-contract-review を自動実行しないことを明記する。
    
    - AC9: CONTRACT_BLOCKED_ROUTING_V1 の構造化出力を定義する。
      recommendation / reason / alternatives / autonomous_fix_allowed / required_route /
      body_sha256_before / rerun_required を必須にする。
    
    - AC10: simple_contract_hygiene_fix の positive/negative examples を decision table に含める。
      #543 AC4 の section-anchored tested_commit は positive example にできるが、
      動画証跡URL、環境情報、provenance、accepted/deferred 判定は negative example とする。
    
    - AC11: Issue body の変更は control-plane から直接行わず、
      issue-refinement-loop 経由に限定する。
      変更後は fresh body_sha256 に対する issue-contract-review status: go が必須。
    
    - AC12: vc_preflight.classifications[] の既存 category を routing input とし、
      classifier logic の新設・再実装を禁止する。
    
    - AC13: PR body に Safety Claim Matrix を必須化する。
    
    - AC14: human_decision_required の場合は必ず停止し、
      worker autonomous fix / retry / resume を禁止する。

    最終結論

    #569 は「blocked だから人間へ丸投げ」を改善するIssueとしては価値があります。
    ただし現状は、contract hygiene 自動修正、契約再設計、人間証跡判断、classifier 責務、intake gate の再開条件が混ざっています。

    このIssueは、実装前に次の形へ絞るべきです。

    目的:
      contract blocked 時に、impl-review-loop が classifier 結果を消費して
      安全に停止・迂回・再レビュー要求を出す routing 仕様を追加する。
    
    非目的:
      classifier logic の追加
      issue-refinement-loop の新機能追加
      人間証跡の妥当性判断
      契約意味論の自動変更
    
    自動修正可能:
      deterministic かつ semantics-preserving な VC hygiene のみ
    
    自動修正不可:
      artifact reviewability
      playtest acceptance
      product/spec judgment
      AC/Allowed Paths/acceptance semantics change
    

    この修正を入れないまま進めると、impl-review-loop が「blocked を賢く分類する」のではなく、blocked の意味を曖昧にして go に持ち込む危険な抜け道になります。

  8. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    Contract Review: BLOCKED — 実装着手不可(2026-06-03)

    VC preflight の結果、unexpected_pass が 2 件あり status: blocked となりました。

    CONTRACT_REVIEW_RESULT_V1:
      status: blocked
      generated_at: 2026-06-03T00:22:00Z
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/569
      body_sha256: sha256:efe304d0b50f0c8e8cfcc0318d466b68ebf4c881daf8906536b43f2941e1dc6c
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: pass
        vc_preflight:
          passed: false
          vc_failed_as_expected: 11
          vc_passed_unexpectedly: 2
          vc_unrunnable: 0
          vc_expected_pass: 0
          vc_skipped: 4
          blocked_items:
            - ac: AC0
              command: 'rg "issue-contract-review.*自動実行しない|auto.*run.*deprecated|fail-only.*gate" .claude/skills/impl-review-loop/SKILL.md'
              exit_code: 0
              classification: unexpected_pass
              decision: blocked
            - ac: AC11
              command: 'rg "issue-refinement-loop.*経由|control-plane.*直接.*mutate.*しない|body_sha256.*go" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 0
              classification: unexpected_pass
              decision: blocked
        ac_verifiability: n/a
        product_spec_check:
          applicability: not_applicable
          decision: pass
        worktree_branch_collision: clear
      next_action: propose_refinement_loop
      blocked_reasons:
        - ac: AC0
          reason: SKILL.md が baseline で既に fail-only gate 相当の文言を含んでいる
        - ac: AC11
          reason: preparation.md が baseline で既に body_sha256 関連テキストを含んでいる

    ブロック理由の詳細

    AC0:SKILL.md の VC が baseline で pass してしまう

    対象コマンド:

    rg "issue-contract-review.*自動実行しない|auto.*run.*deprecated|fail-only.*gate" .claude/skills/impl-review-loop/SKILL.md

    現状の SKILL.md の Step 1-b セクションに fail-only gate や「自動実行しない」相当の文言がすでに存在するため、実装前の baseline でも exit_code 0 になります。「実装後に初めて出現するパターン」という前提が成立しません。

    修正案(#569 が新たに追加するコンテンツにのみヒットするパターンへ変更):

    # AC0
    $ rg "vc_preflight_contract_blocked|intake_gate_failed.*vc_preflight" .claude/skills/impl-review-loop/SKILL.md

    AC11:preparation.md の VC が baseline で pass してしまう

    対象コマンド:

    rg "issue-refinement-loop.*経由|control-plane.*直接.*mutate.*しない|body_sha256.*go" .claude/skills/impl-review-loop/steps/preparation.md

    preparation.md の stale_contract_review 処理セクション(Step 0.3)が body_sha256 と go を含むため、body_sha256.*go パターンが baseline でヒットします。

    修正案(CONTRACT_BLOCKED_ROUTING_V1 スキーマ固有のフィールド名を使う):

    # AC11
    $ rg "require_body_sha256_after|Issue 本文変更は.*issue-refinement-loop 経由に限定" .claude/skills/impl-review-loop/steps/preparation.md

    推奨アクション

    issue-refinement-loop の起動を推奨します。承認後に実行可能です。

    修正対象は ## Verification Commands 内の AC0(SKILL.md 確認コマンド)と AC11 です。いずれも「baseline で必ず fail するパターン」に更新してください。

  9. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    Contract Snapshot — 実装着手許可 (2026-06-03T00:35:00Z)

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: 2026-06-03T00:35:00Z
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/569
      body_sha256: sha256:a9baac9f419c6fd68d5f7097a08d766453abec0cfb3e37ad1df46106d4732ce8
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: pass
        vc_preflight:
          passed: true
          vc_failed_as_expected: 13
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
          vc_expected_pass: 0
          vc_skipped: 4
          classifications:
            - ac: AC1
              command: 'rg "simple_contract_hygiene_fix" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC2
              command: 'rg "contract_refinement_required" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC3
              command: 'rg "human_decision_required" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC4
              command: pnpm typecheck
              exit_code: null
              classification: skipped
              category: preflight_scope_runtime_only
              scope_class: runtime_only
              confidence: low
              decision: go
              verification_owner: impl-review-loop
              deferred_reason: VC marked runtime_only; verification deferred to post-implementation runtime
              runtime_verification_required: true
            - ac: AC5
              command: pnpm lint
              exit_code: null
              classification: skipped
              category: preflight_scope_runtime_only
              scope_class: runtime_only
              confidence: low
              decision: go
              verification_owner: impl-review-loop
              deferred_reason: VC marked runtime_only; verification deferred to post-implementation runtime
              runtime_verification_required: true
            - ac: AC6
              command: pnpm test
              exit_code: null
              classification: skipped
              category: preflight_scope_runtime_only
              scope_class: runtime_only
              confidence: low
              decision: go
              verification_owner: impl-review-loop
              deferred_reason: VC marked runtime_only; verification deferred to post-implementation runtime
              runtime_verification_required: true
            - ac: AC7
              command: pnpm build
              exit_code: null
              classification: skipped
              category: preflight_scope_runtime_only
              scope_class: runtime_only
              confidence: low
              decision: go
              verification_owner: impl-review-loop
              deferred_reason: VC marked runtime_only; verification deferred to post-implementation runtime
              runtime_verification_required: true
            - ac: AC8
              command: 'rg "decision.table|分類.*matrix|contract_blocked_reason.*class" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC0
              command: 'rg "issue-contract-review.*自動実行しない|auto.*run.*deprecated|fail-only.*gate" .claude/skills/impl-review-loop/SKILL.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC0
              command: 'rg "contract_blocked_reason|vc_preflight_contract_blocked" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC9
              command: 'rg "CONTRACT_BLOCKED_ROUTING_V1" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC9
              command: 'rg "source_contract_review_comment_url|body_sha256_before|autonomous_fix_allowed|required_route|rerun_required" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC10
              command: 'rg "positive.*example|negative.*example|正例|負例|preflight-scope.*pr_review_only" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC11
              command: 'rg "require_body_sha256_after|本文変更は.*issue-refinement-loop 経由" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC12
              command: 'rg "classifier.*logic.*新設.*禁止|routing.*のみ|classifications\[\].*消費" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC13
              command: 'rg "Safety Claim Matrix" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC14
              command: 'rg "human_decision_required.*停止|autonomous.*fix.*禁止" .claude/skills/impl-review-loop/steps/preparation.md'
              exit_code: 1
              classification: expected_fail
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
        ac_verifiability: pass
        product_spec_check:
          applicability: not_applicable
          decision: pass
        worktree_branch_collision: clear
      next_action: implement_issue
      blocked_reasons: []
      warnings: []

    Contract Summary — 契約概要

    • Outcome: .claude/skills/impl-review-loop/steps/preparation.md が更新され、issue-contract-review status: blocked 受信時に blocked reason を simple_contract_hygiene_fix / contract_refinement_required / human_decision_required の 3 種に分類し、simple_contract_hygiene_fix の場合は orchestrator が推奨修正案を提示して issue-refinement-loop 経由で自律修正後に issue-contract-review を再実行できる手順が明文化された状態で、pnpm typecheck / lint / test / build が全て PASS している。
    • Acceptance Criteria: AC0〜AC3、AC8〜AC14(13 items)
    • Allowed Paths: .claude/skills/impl-review-loop/steps/preparation.md、.claude/skills/impl-review-loop/SKILL.md
    • Worktree: .claude/worktrees/issue-569-impl-review-loop-contract-blocked-blocke
    • Branch: worktree-issue-569-impl-review-loop-contract-blocked-blocke
    • VC preflight: baseline fail = 13、想定外 pass = 0、実行不可 = 0、skipped (runtime_only) = 4
  10. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    人間判断:scope rollup ブロック解除

    scope_rollup が Issue #597(同一 Allowed Paths の OPEN Issue)を検出して停止しました。以下の通り判断します。

    判断:#569 を先に進める。#597 は設計再整合が完了するまで実装レーンから外す。

    理由

    #597 の現在の Outcome は #564 の fail-only gate 設計と競合する可能性があり、permissionMode: dontAsk を含む権限関連の自動実行変更が含まれているため、設計再整合が先に必要です。

    #569 の実装スコープ(変更なし)

    • vc_preflight.status: blocked 受信時の blocked reason 3 分類の追加
    • simple_contract_hygiene_fix / contract_refinement_required / human_decision_required の分類と worker 自律修正フローの明文化
    • preparation.md と SKILL.md への記述追加

    #569 のスコープ外(明示)

    • missing_contract_go 時の自動マテリアライゼーション
    • issue-contract-review の自動実行 SubAgent
    • permissionMode: dontAsk 関連の変更
    • 自律実行権限を拡大するいかなる変更も対象外

    #597 の対応

    phase/implementation ラベルを除去し、#564 fail-only gate との整合が確認されるまで実装レーンから外します。


    /impl-review-loop 569 を再実行します。

  11. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-06-03T08:35:00Z)

    Issue #569 の実装が完了しました。

  12. added a commit that references this issue on Jun 2, 2026
  13. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    REQUEST_CHANGES 修正を完了しました。

    対応した修正点

    BLOCKER-1 の解消

    preflight-scope: pr_review_only の付与を positive example(正例)に移動しました。Issue contract の AC10 が指定する通り、これは「VC 意味論変更なし」の正例として位置づけられます。

    BLOCKER-2 の解消

    negative examples に以下の 4 項目を追加しました。

    • 動画証跡 URL を VC コマンドに含める変更 — 証跡保存先の指定は意味論変更であり autonomous fix 禁止
    • 環境情報(OS、node version 等)の記述を VC に追加する変更 — VC 意味論変更であり simple_contract_hygiene_fix 対象外
    • tested_commit: 由来の値を VC コマンドに組み込む変更 — 実行時依存の注入は意味論変更であり autonomous fix 禁止
    • accepted / deferred 判定を VC の結果評価に追加する変更 — VC 合否の意味論変更であり human_decision_required に該当

    品質ゲート

    typecheck: pass / lint: pass / test: 313 passed (16 files) / build: pass

    commit: 8a9c1ec

  14. added a commit that references this issue on Jun 3, 2026
  15. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    REQUEST_CHANGES 対応完了

    PR #603 に対する人間レビューの指摘を全件修正してコミット・プッシュしました。

    修正内容(全件)

    BLOCKER-1: Step 1-c の blocked 分岐を Section 6 routing に接続。blocked は Section 6 の 3 分類ルーティングへ委譲し、human_judgment のみ即停止する。

    BLOCKER-2/4: Section 6.4 LOOP_STATE の state path を intake_gate.vc_preflight.contract_blocked_routing 配下に修正。source_contract_review_comment_url、body_sha256_before、classification_basis の全フィールドを追加。

    BLOCKER-3: simple_contract_hygiene_fix の分類条件を拡張。trivially_pass/unexpected_pass の section-scoped VC rewrite と preflight-scope:pr_review_only の付与を追加。正例も追記。

    MAJOR-5: PR body の Safety Claim Matrix を正確な記述に更新(docs-only 安全の誤った主張を除去)。

    MAJOR-7: Unicode 制御文字チェック実施済み、問題なし。

    検証結果

    • pnpm typecheck: pass
    • pnpm lint: pass
    • pnpm test: 313 passed (16 files)
    • pnpm build: pass
    • AC1/AC2/AC3/AC8/AC9a/AC9b/AC10/AC11/AC12/AC14: 全件 pass

    コミット: 23874d8

  16. added a commit that references this issue on Jun 3, 2026
  17. added a commit that references this issue on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions