Skip to content

実装: issue-contract-review に scope_collision_check を JSON / script-first で追加する #387

Closed as not planned

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#384"
goal_ref: "issue-contract-review が OPEN implementation issue の Allowed Paths overlap を構造化 collision evidence として出力し、SKILL.md の preflight gate がその evidence を消費して status: go の判定に組み込めるところまで materialize された状態"
change_kind: workflow

Parent Issue

#384

Depends On

Delivery Rule の自由文ではなく独立セクションとして宣言する。.claude/skills/issue-contract-review/scripts/check_blockers.sh の fallback Depends on #N 検出(#262 false positive を踏まえた #265 改善対象)が確実に拾えるよう、line-anchored で記載する。

Parent Goal Ref

  • Goal: docs/dev/workflow.md に固定した Scope Collision Classification / script-first 原則を、docs-only で終わらせず deterministic checker 側と issue-contract-review の preflight gate へ materialize する
  • Desired Destination: issue-contract-review が OPEN implementation issue の Allowed Paths overlap を構造化 collision evidence として出力し、CONTRACT_REVIEW_RESULT_V1 に最小 wiring された結果として caller が C0/C1/C2/C3 判定を最小入力で行える状態

Current Validated Scope

  • .claude/skills/issue-contract-review/scripts/scope_collision_check.py に OPEN implementation issue の Allowed Paths overlap を JSON evidence 化する helper を追加する
  • .claude/skills/issue-contract-review/scripts/tests/test_scope_collision_check.py に fixture-driven tests を追加する
  • .claude/skills/issue-contract-review/scripts/tests/fixtures/scope_collision/ に no-collision / ordered overlap (predecessor open / predecessor closed) / no-dependency-ordering / malformed-dependency / needs-classification fixture を追加する
  • .claude/skills/issue-contract-review/references/scope-collision-check-output.md に output schema と caller-facing field contract(schema_version, source metadata, dependency_relation, fail-closed source_status)を追加する
  • .claude/skills/issue-contract-review/SKILL.md への 最小 wiring を追加する(CONTRACT_REVIEW_RESULT_V1 への scope_collision_check フィールド追加と、Step に Scope Collision Preflight の呼び出し / decision 反映 1 段を入れる)

Remaining Parent Gaps

Background

PR #386 の review comment では、docs/dev/workflow.md に Scope Collision Classification を追加しただけでは SSOT 変更と実行層の間にギャップが残り、少なくとも HOW-layer の #385 と、deterministic checker 側の follow-up が必要だと指摘された。今回の follow-up はそのうち checker / JSON evidence 層と、issue-contract-review preflight への最小 wiring を切り出す。

採用方針は自然言語 workaround ではなく script-first である。つまり「LLM が長文 SSOT を読んで overlap を都度再解釈する」のではなく、OPEN implementation issue の Allowed Paths と依存状態から collision_candidates / candidate_class / required_action を機械的に返す helper を追加し、caller はその短い evidence だけを入力として判定できるようにする。

#385 との差分は明確に保つ。#385 は impl-review-loop / ssot-discovery が docs/dev/workflow.md 全文へ逃げずに section-limited context を扱う HOW-layer の更新であり、本 Issue は issue-contract-review が deterministic な collision evidence producer を持ち、かつ preflight gate がその evidence を消費するところまでを目的とする。スコープと責務が異なるため統合しないが、用語と caller contract を揃えるため schema reference は本 Issue で先に凍結し、#385 はそれを consume する。

#387 を「便利な standalone helper」で終わらせないために、SKILL.md 最小 wiring(preflight 呼び出し + CONTRACT_REVIEW_RESULT_V1 への field 追加)を In Scope に取り込む(OWNER 判断)。広範な template 書き換えや SKILL.md の手順大改修は含めない。

Outcome

.claude/skills/issue-contract-review/scripts/scope_collision_check.py と対応 tests / reference が追加され、OPEN implementation issue の Allowed Paths overlap について scope_collision_check JSON を返し、collision_candidates / candidate_class / required_action を caller が最小入力で利用できる状態。さらに .claude/skills/issue-contract-review/SKILL.md の preflight に最小 wiring 1 段が追加され、CONTRACT_REVIEW_RESULT_V1 に scope_collision_check フィールドが含まれ、preflight の status: go / no-go 判定にこの evidence が反映される。

In Scope

  • OPEN implementation issue 一覧から Allowed Paths と dependency 状態を取得し、対象 Issue との差分を比較する helper を追加する
    • 候補取得は gh issue list --state open --json number,title,body,labels,state,url を用いる
    • issue_kind: implementation(Machine-Readable Contract)または phase/implementation label を持つものを implementation issue と見なす
    • 両者が矛盾する場合(label のみ / contract のみ / 両者が disagree 等)は needs_classification として扱い required_action: human_classification_required
    • target issue 自身は候補から除外する
  • Allowed Paths を以下の path normalization contract に従って正規化する
    • Markdown backtick / list marker (-, *, 数字) を除去
    • 連続スラッシュを 1 つに畳む
    • trailing slash 付き directory は prefix overlap として扱う
    • ** glob は prefix overlap として扱う
    • file path は exact match、または directory/glob 配下の場合のみ overlap
    • deleted / renamed file の解釈は行わない(現本文表記をそのまま扱う)
  • overlap がない場合は candidate_class: C0 / required_action: proceed を JSON で返す
  • overlap があり deterministic に C2a/C2b 判定できる場合は candidate_class: C2a / C2b と対応する required_action を返す
  • overlap があるが自動分類できない場合は fail-open せず candidate_class: needs_classification / required_action: human_classification_required を返す
  • GitHub API / gh CLI 失敗時は fail-closed で source_status に失敗内容を記録し、decision: human_classification_required または blocked を返す
  • fixture-driven tests と reference で field 名 / enum / expected action を固定する
  • .claude/skills/issue-contract-review/SKILL.md への 最小 wiring:
    • preflight 手順に Scope Collision Preflight 1 段を追加し scope_collision_check.py を呼び出す
    • CONTRACT_REVIEW_RESULT_V1 に scope_collision_check フィールドを追加し、decision を status: go / no-go に反映する
    • 既存 step の意味論大改修・既存 step 番号の付け替え・新規 SKILL.md セクションの広範追加は含めない

Out of Scope

Scope Collision Checker Contract(caller-facing schema 固定)

reference (.claude/skills/issue-contract-review/references/scope-collision-check-output.md) では最低以下を凍結する。#385 の consumer はこの schema を前提に implementation する。

scope_collision_check:
  schema_version: scope_collision_check/v1
  target_issue_number: <int>
  generated_at: <ISO-8601 UTC>
  source:
    repo: <owner/name>
    open_issue_count: <int>
    implementation_issue_count: <int>
  source_status:
    issue_list: ok | failed | partial
    issue_fetch_failures:
      - issue_number: <int>
        error: gh_auth_failed | gh_timeout | gh_json_parse_error | unknown
  decision: proceed | wait | human_classification_required | blocked
  collision_candidates:
    - overlapping_issue_number: <int>
      overlapping_issue_url: <string>
      overlapping_issue_state: open | closed
      overlapping_paths: [<string>, ...]
      dependency_relation:
        relation: predecessor | successor | none | ambiguous
        evidence: native_dependency | line_anchored_depends_on | parent_work_ordering | none
      candidate_class: C0 | C2a | C2b | needs_classification
      required_action: proceed | wait_for_predecessor | human_classification_required

enum 固定:

  • candidate_class: C0 | C2a | C2b | needs_classification
  • required_action: proceed | wait_for_predecessor | human_classification_required
  • decision: proceed | wait | human_classification_required | blocked

C1 / C3 は本 helper では自動最終判定しない。C1 相当(同一 path だが意味的 conflict なし)は追加入力が必要なため needs_classification に倒す。C3 相当(明示的に競合 / human escalation 必要)は dependency ordering 検出 + overlap class 判定で間接的に human_classification_required に到達する。

Fail-closed rule:

  • source_status.issue_list != ok → decision: human_classification_required または blocked
  • source_status.issue_fetch_failures が空でない → decision: human_classification_required
  • overlap はあるが C2a/C2b に deterministic に振れない → candidate_class: needs_classification / required_action: human_classification_required
  • implementation issue 判定が矛盾する候補は needs_classification として残す

Acceptance Criteria

  • AC1: .claude/skills/issue-contract-review/scripts/scope_collision_check.py が存在し、上記 schema(scope_collision_check / schema_version / source_status / collision_candidates / candidate_class / required_action / decision)を含む JSON evidence を stdout に出力できる
  • AC2: no-collision fixture では candidate_class: C0 / required_action: proceed / decision: proceed が返る
  • AC3: predecessor が closed の ordered overlap fixture では candidate_class: C2a / required_action: proceed が返る
  • AC4: predecessor が open の ordered overlap fixture では candidate_class: C2b / required_action: wait_for_predecessor / decision: wait が返る
  • AC5: overlap あり・dependency ordering 不明の fixture では fail-open せず candidate_class: needs_classification / required_action: human_classification_required が返る
  • AC6: overlap あり・dependency 宣言が malformed / ambiguous の fixture でも fail-open せず candidate_class: needs_classification / required_action: human_classification_required が返る
  • AC7: gh issue list が失敗(exit !=0 もしくは JSON parse 失敗)の simulation で source_status.issue_list != ok が記録され decision が human_classification_required または blocked になる
  • AC8: .claude/skills/issue-contract-review/references/scope-collision-check-output.md に上記 caller-facing schema と enum、fail-closed rule、path normalization contract が記載されている
  • AC9: .claude/skills/issue-contract-review/scripts/tests/test_scope_collision_check.py と fixture 群が存在し、uv run --with pytest python -m pytest .claude/skills/issue-contract-review/scripts/tests/test_scope_collision_check.py で PASS する
  • AC10: .claude/skills/issue-contract-review/SKILL.md の preflight 手順に Scope Collision Preflight 1 段が追加され、scope_collision_check.py を呼び出して CONTRACT_REVIEW_RESULT_V1.scope_collision_check に結果を格納し、decision が status: go / no-go 判定に反映される旨が記載されている

Verification Commands

$ test -f .claude/skills/issue-contract-review/scripts/scope_collision_check.py # AC1
$ rg -n "scope_collision_check|schema_version|source_status|collision_candidates|candidate_class|required_action|decision" .claude/skills/issue-contract-review/scripts/scope_collision_check.py # AC1
$ rg -n "C0|proceed" .claude/skills/issue-contract-review/scripts/tests/fixtures/scope_collision/ # AC2
$ rg -n "C2a" .claude/skills/issue-contract-review/scripts/tests/fixtures/scope_collision/ # AC3
$ rg -n "C2b|wait_for_predecessor" .claude/skills/issue-contract-review/scripts/tests/fixtures/scope_collision/ # AC4
$ rg -n "needs_classification|human_classification_required" .claude/skills/issue-contract-review/scripts/tests/fixtures/scope_collision/no_dependency_ordering # AC5
$ rg -n "needs_classification|human_classification_required" .claude/skills/issue-contract-review/scripts/tests/fixtures/scope_collision/malformed_dependency # AC6
$ rg -n "source_status|issue_fetch_failures|gh_auth_failed|gh_timeout" .claude/skills/issue-contract-review/scripts/scope_collision_check.py .claude/skills/issue-contract-review/scripts/tests/test_scope_collision_check.py # AC7
$ rg -n "scope_collision_check/v1|overlapping_issue_number|dependency_relation|path_normalization|fail-closed|fail.closed" .claude/skills/issue-contract-review/references/scope-collision-check-output.md # AC8
$ uv run --with pytest python -m pytest .claude/skills/issue-contract-review/scripts/tests/test_scope_collision_check.py # AC9
$ rg -n "Scope Collision Preflight|scope_collision_check" .claude/skills/issue-contract-review/SKILL.md # AC10

Allowed Paths

  • .claude/skills/issue-contract-review/scripts/scope_collision_check.py
  • .claude/skills/issue-contract-review/scripts/tests/test_scope_collision_check.py
  • .claude/skills/issue-contract-review/scripts/tests/fixtures/scope_collision/
  • .claude/skills/issue-contract-review/references/scope-collision-check-output.md
  • .claude/skills/issue-contract-review/SKILL.md(最小 wiring の範囲のみ。preflight 1 段追加と CONTRACT_REVIEW_RESULT_V1 の scope_collision_check フィールド追加に限る)

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • caller-facing schema(scope_collision_check key 名、collision_candidates schema、candidate_class / required_action / decision enum、source_status の構造)の変更が必要になった場合
  • SKILL.md の最小 wiring を超える広範な step 構造変更が必要と判断した場合
  • check_blockers.sh の Depends on #N 抽出ロジック修正が不可避と判明した場合(その場合は 実装: check_blockers.sh の条件付き依存記述による false positive を改善する #265 に escalate)
  • 新規 Issue の起票が必要と判断した場合(template / 他 checker / 他 SKILL までスコープ分割が必要な場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

なし

Runtime Verification Applicability

runtime_verification_applicability:
  decision: not_applicable
  rationale: >
    Outcome は issue-contract-review helper / fixture / reference / SKILL.md の最小 wiring 更新であり、
    検証はファイル存在確認、`rg`、および単体 pytest(gh CLI 失敗の simulation を含む)で完結する。
    実ランタイム I/O や外部 UI 操作は含まない。SKILL.md wiring の動作は preflight の dry-run 経路ではなく
    `CONTRACT_REVIEW_RESULT_V1` schema と SKILL.md 内記載の存在確認で代替する。
  verification_commands_ref: AC1-AC10

Scope Delta(任意)

validated_scope_delta: .claude/skills/issue-contract-review/scripts/ と対応 tests、必要最小限の reference、および .claude/skills/issue-contract-review/SKILL.md の最小 wiring(preflight 1 段 + CONTRACT_REVIEW_RESULT_V1 field 追加)に限定する。SKILL.md の手順大改修や implementation template / check_blockers.sh 更新、impl-review-loop / ssot-discovery の HOW-layer 更新(#385)は本 Issue に統合しない。

Source

Delivery Rule

Activity

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

    @squne121
    OwnerAuthor

    結論

    #387 の方向性は正しいです。#384 / PR #386 で SSOT に固定した「Allowed Paths overlap は一律 hard stop ではなく分類する」という方針を、issue-contract-review の script-first evidence producer に落とす Issue です。#384 は docs/dev/workflow.md の policy-only 更新で、実行層は out of scope としていました。#387 はその checker / JSON evidence 層を担う設計なので、親子関係は妥当です。

    ただし、現状の #387 は このまま実装すると「便利な standalone helper」で止まり、issue-contract-review status: go の判定経路に materialize されないリスクが高い です。敵対的に見ると、最大の穴は「script を作る」と「preflight gate がそれを消費する」の間が out of scope で切断されている点です。

    関連 Issue / PR の整理

    #384 は docs/dev/workflow.md に C0/C1/C2/C3、C2a/C2b、required_action 相当の運用を固定し、Allowed Paths overlap 単独では hard stop ではないと明記しました。現行 workflow.md でも、C1 は着手可、C2b は predecessor close まで wait、C3 は human escalation とされています。

    PR #386 は #384 を merge 済みで、PR body 上も #385 を mandatory follow-up、#387 を checker / JSON evidence follow-up と位置づけています。PR #386 では policy-only PR の例外として、HOW 層や guardrail 層が未反映のまま放置されない routing を記録しています。

    #385 は sibling follow-up で、impl-review-loop / ssot-discovery 側を consume-only / section-limited retrieval にする Issue です。#385 は collision_class / required_action を自前で持たず、#387 の structured evidence producer を消費する前提です。

    #338 は今回の問題の実例側です。review-issue 周辺の小改善群が Allowed Paths overlap で過度に停止し、script-first な判定が必要になった背景として参照できます。

    Blocker 1: #387 は issue-contract-review/SKILL.md 連携を out of scope にしており、実行層に入らない

    #387 の Allowed Paths は新規 script、test、fixture、reference のみです。さらに Out of Scope に check_blockers.sh / SKILL.md / implementation template の更新を明示しています。

    これは危険です。現行 issue-contract-review/SKILL.md の CONTRACT_REVIEW_RESULT_V1 には scope_collision_check が存在せず、Step 2〜7 のどこにも Scope Collision Preflight の実行・判定・handoff がありません。

    つまり #387 を完了しても、issue-contract-review は status: go を返す判断にこの script を使わない可能性があります。これは #387 の Goal「caller が C0/C1/C2/C3 判定を最小入力で行える状態」には届いても、#384 の実運用 gap を閉じるには不足です。

    修正案: #387 を二択にしてください。

    1. 実装: issue-contract-review に scope_collision_check を JSON / script-first で追加する #387 に .claude/skills/issue-contract-review/SKILL.md への最小 wiring を In Scope として追加する。

    2. それがスコープ過大なら、実装: issue-contract-review に scope_collision_check を JSON / script-first で追加する #387 の Remaining Parent Gaps に「issue-contract-review Step 3.x / CONTRACT_REVIEW_RESULT_V1 に scope_collision_check を組み込む follow-up」を必須 Issue として明記する。

    個人的には 1 を推奨します。script-first 原則なのに caller integration を別 Issue に逃がすと、また自然言語運用に戻ります。

    Blocker 2: Depends on #385 merge が Delivery Rule 内だけだと依存 gate として不安定

    #387 は Delivery Rule に Depends on #385 merge と書いていますが、現行 issue-contract-review/SKILL.md は fallback Depends on #N parsing を「専用セクションまたは line-anchored 宣言文」に限定すると説明しています。

    一方、実装済み check_blockers.sh は現状 grep -oP '(?i)Depends on #\K[0-9]+' で本文全体を拾っており、これは過去に条件文から false positive を起こした既知問題です。 #265 もその false positive 改善を扱う Issue です。

    #387 が「#385 merge 後」を本当に gate にしたいなら、Delivery Rule の自由文では弱いです。

    修正案: #387 本文に以下を追加してください。

    Depends On

    または GitHub native dependency を設定してください。gh issue list はデフォルトで open issue を返し、--state と --json で state / body / labels / number 等を取得できます。gh issue view も --json body をサポートしています。実装が GitHub CLI 経由ならこの仕様に沿って依存・issue body を明示的に扱うべきです。

    Blocker 3: 「OPEN implementation issue 一覧」の取得条件が未定義

    #387 は「OPEN implementation issue 一覧から Allowed Paths と dependency 状態を取得」と書いていますが、どの issue を implementation issue と見なすかが未定義です。候補は少なくとも 3 つあります。

    label phase/implementation

    Machine-Readable Contract の issue_kind: implementation

    issue template / section 構造

    この定義が曖昧だと、helper は repo 内の issue を過剰検出または見逃します。特に phase/implementation label が漏れている Issue、あるいは parent tracker だが Allowed Paths を持つ Issueを拾うと false positive になります。

    修正案: #387 の In Scope / AC に以下を足すべきです。

    • Candidate issue source は gh issue list --state open --json number,title,body,labels,state,url とし、
      issue_kind: implementation または phase/implementation label のいずれかで implementation issue と判定する。
    • issue_kind と label が矛盾する場合は needs_classification / human_judgment に倒す。
    • target issue 自身は候補から除外する。

    Blocker 4: path overlap の意味論が未定義

    Allowed Paths の overlap と言っても、以下をどう扱うかで判定結果が変わります。

    foo/ と foo/bar.py

    foo/** と foo/bar.py

    .claude/skills/issue-contract-review/scripts/ と .claude/skills/issue-contract-review/scripts/scope_collision_check.py

    Markdown list の backtick 有無

    glob / directory / file path の正規化

    trailing slash

    deleted / renamed file

    #387 の AC は overlapping_paths を返すことだけを要求しており、overlap 判定アルゴリズムを固定していません。これでは fixture が通っても本番挙動が揺れます。

    修正案: reference に以下の path normalization contract を固定してください。

    path_normalization:
    strip_markdown_backticks: true
    strip_list_marker: true
    collapse_redundant_slashes: true
    directory_path_trailing_slash_means_prefix: true
    glob_star_star_supported: true
    exact_file_match_required_for_file_paths: true
    target_issue_excluded: true

    Major: candidate_class と required_action の enum が足りない

    #387 は candidate_class / required_action を固定契約にしていますが、enum が本文にありません。#384 の policy は C0/C1/C2/C3 と C2a/C2b を持ち、停止条件も分けています。

    #387 側では deterministic に判断できるものを C2a/C2b、できないものを needs_classification とする方針ですが、needs_classification が candidate_class なのか required_action なのかが曖昧です。

    修正案: 最低限この enum を reference に固定してください。

    candidate_class:

    • C0
    • C2a
    • C2b
    • needs_classification

    required_action:

    • proceed
    • wait_for_predecessor
    • human_classification_required

    C1/C3 を script が完全自動判定しないなら、それは明記した方が安全です。C1 は edit_intent / non_conflict_reason が必要なので、現状の #387 の入力だけで自動判定させると誤分類しやすいです。

    Major: dependency state と overlap class の対応が弱い

    #387 は「predecessor が open の ordered overlap fixture では C2b」とだけ書いています。では predecessor が closed の ordered overlap はどうするのか、依存順が明記されていない overlap はどうするのかが AC にありません。

    #384 の SSOT では、C2 は Depends on #N または parent Work Ordering が必要で、C2b は predecessor open なら wait、依存順未記録なら停止です。

    修正案: fixture を最低 5 つに増やしてください。

    no collision → C0 / proceed

    overlap + explicit predecessor closed → C2a / proceed

    overlap + explicit predecessor open → C2b / wait_for_predecessor

    overlap + no dependency ordering → needs_classification / human_classification_required

    overlap + malformed / ambiguous dependency source → needs_classification / human_classification_required

    Major: GitHub API / gh CLI failure 時の fail-closed 方針がない

    gh issue list / gh issue view / dependency API は認証・権限・pagination・rate limit・network failure で失敗します。GitHub REST の issue list 系 endpoint も state / pagination / response status を持つため、実装側は open issue の完全性を前提にしない方が安全です。

    #387 には external service 利用・権限昇格は Stop Conditions としてありますが、script 実行時に gh が失敗した場合の JSON contract がありません。

    修正案: output に source_status を入れて fail-closed してください。

    source_status:
    issue_list: ok | failed | partial
    issue_fetch_failures:
    - issue_number: 123
    error: gh_auth_failed | gh_timeout | gh_json_parse_error | unknown
    decision:
    ok only if source_status.issue_list == ok and no issue_fetch_failures

    Major: reference の schema だけでは caller-facing contract として不足

    #387 の AC5 は overlapping_issue_number / overlapping_paths / candidate_class / required_action の記載だけを要求しています。これは最小すぎます。

    caller が安全に routing するには、少なくとも以下も必要です。

    scope_collision_check:
    schema_version: scope_collision_check/v1
    target_issue_number: 387
    generated_at: ISO-8601
    source:
    repo: owner/name
    open_issue_count: int
    implementation_issue_count: int
    decision: proceed | wait | human_classification_required | blocked
    collision_candidates:
    - overlapping_issue_number: int
    overlapping_issue_url: string
    overlapping_issue_state: open | closed
    overlapping_paths: [string]
    dependency_relation:
    relation: predecessor | successor | none | ambiguous
    evidence: native_dependency | line_anchored_depends_on | parent_work_ordering | none
    candidate_class: C2a | C2b | needs_classification
    required_action: proceed | wait_for_predecessor | human_classification_required

    Non-blocker: required_action は wait ではなく machine-readable action に寄せる

    AC3 は「wait 系 required_action」と書いていますが、文字列が揺れると consumer が壊れます。wait / wait_for_predecessor / human_escalation のような enum は reference で固定してください。

    Non-blocker: #385 との実装順は正しいが、相互依存の表現が弱い

    #385 は #387 の field contract と整合しない暫定 consumer contract しか書けない場合を Stop Condition にしています。 逆に #387 側も「#385 がまだ未 merge なら実装できない」のではなく、「#385 が必要とする field contract を先に凍結する」責務を持つべきです。

    実装順を #385 → #387 に固定するより、schema reference だけは #387 で先に凍結し、#385 はそれを consume する方が自然です。現状の Depends on #385 merge はやや逆順に見えます。

    推奨する #387 本文修正案

    #387 は以下を追加・変更してから実装に回すのが安全です。

    Depends On

    Scope Collision Checker Contract

    • Candidate source:

      • gh issue list --state open --json number,title,body,labels,state,url
      • target issue 自身は除外する
      • issue_kind: implementation または phase/implementation label を implementation issue と見なす
      • 判定不能・body 取得失敗・JSON parse 失敗は fail-open せず human_classification_required
    • Path normalization:

      • Markdown backtick / list marker を除去
      • trailing slash directory は prefix overlap として扱う
      • ** glob は prefix overlap として扱う
      • file path は exact match または directory/glob 配下の場合のみ overlap
    • Output enum:

      • candidate_class: C0 | C2a | C2b | needs_classification
      • required_action: proceed | wait_for_predecessor | human_classification_required
      • decision: proceed | wait | human_classification_required | blocked
    • Dependency evidence:

      • GitHub native dependency
      • line-anchored Depends on #N
      • parent Work Ordering
      • none / ambiguous
    • Fail-closed rule:

      • open issue list が完全取得できない
      • implementation issue 判定が矛盾する
      • dependency ordering が不明
      • overlap はあるが C2a/C2b に deterministic 分類できない
        → needs_classification / human_classification_required

    最終判定

    Verdict: 修正してから着手。

    #387 は必要な follow-up ですが、現状は「script を追加する Issue」としては成立していても、「#384 の Scope Collision Preflight を issue-contract-review の実行層に materialize する Issue」としては不足があります。特に SKILL.md / CONTRACT_REVIEW_RESULT_V1 連携を out of scope にしている点は、script-first 原則の実効性を落とします。

    最低限、依存 gate、issue 取得条件、path overlap semantics、enum、fail-closed 出力、caller integration のいずれかを #387 内に入れてください。入れない場合は、#387 完了後にさらに wiring follow-up が必須です。

  3. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Step 4 (Body Update) Complete

    Body updated per anchor comment #387 (comment) – refinement feedback.

    Fact-Check Summary: All 8 claims fact-checked and supported by codebase-investigator.

    Primary Changes:

    1. ✓ ## Depends On section added (line-anchored; Depends on 実装: ssot-discovery に汎用 section retrieval evidence を追加する #385)
    2. ✓ In Scope / Allowed Paths / AC / VC updated with .claude/skills/issue-contract-review/SKILL.md minimum wiring
    3. ✓ Out of Scope cleaned (SKILL.md references removed; scope moved to In Scope)
    4. ✓ Candidate issue source / implementation issue classification rules added
    5. ✓ Path normalization contract formalized (backtick/list removal, glob handling, exact match)
    6. ✓ Caller-facing schema frozen under ## Scope Collision Checker Contract
    7. ✓ Enums fixed: candidate_class (C0|C2a|C2b|needs_classification), required_action (proceed|wait_for_predecessor|human_classification_required), decision (proceed|wait|human_classification_required|blocked)
    8. ✓ Fixtures extended to 5 types (AC2–AC6)
    9. ✓ AC7: fail-closed simulation added
    10. ✓ AC10: SKILL.md minimum wiring verification added
    11. ✓ VC updated to match AC1–AC10 (rg / test -f / pytest commands)
    12. ✓ Stop Conditions: schema/enum change handling added
    13. ✓ Remaining Parent Gaps: 実装: check_blockers.sh の条件付き依存記述による false positive を改善する #265 (check_blockers.sh false positive) now explicit
    14. ✓ Delivery Rule: dependency SSOT and schema consumption contract clarified
    15. ✓ Source: refinement anchor comment URL added

    Title unchanged (Goal/Outcome direction preserved; SKILL.md wiring within original scope).

    Body edited via gh issue edit --body-file. Ready for next step: orchestrator → issue-author (Implementation Step 1).

  4. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    iteration 2: C5 AC5/AC6 VC 行分離

    Verification Commands で AC5 と AC6 の個別検査を可視化するため、共有していた # AC5,AC6 の行を分離し以下のように修正しました:

    • AC5: no_dependency_ordering fixture の needs_classification / human_classification_required 検査
    • AC6: malformed_dependency fixture の needs_classification / human_classification_required 検査

    これにより review-issue の VC個別チェック(tag: # AC5 と # AC6)が正確に検出できます。

  5. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: 完了 (2026-05-25T04:09:32Z)

    改善履歴

    • iteration 1: anchor comment の Blockers/Majors を反映
    • iteration 2: review-issue C5 needs-fix 対応
      • VC で AC5/AC6 が共有していた行を分離(no_dependency_ordering / malformed_dependency fixture へ個別対応)
    • iteration 3: re-review で C1–C11 全 PASS / verdict: approve

    次アクション

    • 実装着手前に issue-contract-review skill を起動し、status: go を取得してから worktree / Draft PR を作成する
    • 実装順は schema reference を本 Issue で先に固定 → 実装: ssot-discovery に汎用 section retrieval evidence を追加する #385 が consume する整理(Delivery Rule 記載)。Depends on #385 merge の gate は本 Issue 内で着手判断時に再確認する

    scope rollup preflight

  6. squne121 commented on May 25, 2026

    @squne121
    OwnerAuthor

    Contract Review: BLOCKED (2026-05-25T04:12:39Z)

    不足項目

    判定

    status: blocked / fail-closed / human_escalation。impl-review-loop は preparation step 1-b の status: go 取得に進めません。

    推奨アクション

    1. 実装: ssot-discovery に汎用 section retrieval evidence を追加する #385 を先にマージする — 本 Issue の Delivery Rule に「schema reference は本 Issue で先に凍結し、実装: ssot-discovery に汎用 section retrieval evidence を追加する #385 が consume する」とある一方で Depends on #385 merge を gate として宣言済み。両者の整合のために実装順を見直すか、実装: ssot-discovery に汎用 section retrieval evidence を追加する #385 を先行させてマージするのが第一候補。
    2. または、Depends 関係を schema-only に縮退させ ## Depends On から 実装: ssot-discovery に汎用 section retrieval evidence を追加する #385 を外す(refinement loop で本文修正が必要)。

    人間判断を待ちます。


    CONTRACT_REVIEW_RESULT_V1:
      status: blocked
      generated_at: 2026-05-25T04:12:39Z
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/387
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: pass
        blocker_dependency_check: fail
        open_blockers:
          - issue_number: 385
            state: OPEN
            url: https://github.com/squne121/loop-protocol/issues/385
      next_action: human_judgment
      blocked_reasons:
        - rule: open_blocker_dependency
          blocker: "#385 OPEN (line-anchored Depends on #385 in ## Depends On)"
      warnings: []
  7. added 3 commits that reference this issue on Jun 17, 2026
  8. squne121 commented on Sep 2, 2026

    @squne121
    OwnerAuthor

    結論

    Verdict: REQUEST_CHANGES より一段強く、2026-09-02 時点では #387 は「実装しないで supersede/close」が妥当です。

    #387 は 2026-05-25 の refinement で、当初レビューされた「SKILL.md wiring不足」「enum不足」「path normalization 未定義」「fail-closed 不足」などをかなり丁寧に修正し、最終的には approve されています。 その直後に #385 が OPEN のため contract review が blocked になりましたが、#385 自体は 2026-07-11 に completed で close 済みです。

    しかし、その後の設計変更の方が決定的です。#1674 は OPEN Issue 間の semantic relation / dependency ordering / priority 判定は issue-refinement-loop だけが行い、downstream は再分類しないという authority 分離を正本化しています。issue-contract-review に #387 の classifier を置くこと自体が、現在は「第二の planning authority」を作るアンチパターンになっています。 #1680 はさらに machine-readable に issue_387.decision: supersede / destination: #1674 と決定しています。

    そしてこれは文書だけの予定ではありません。PR #1794 は merge 済みで、issue-contract-review を fresh structural/freshness gate に縮小し、OPEN PR の changed-file overlap を declared_path_overlap advisory-only として実装しています。PR 本文は #387 scope_collision_check.py を「supersede 方針のため実装しない」と明記しています。 現行 main には ISSUE_EXECUTION_DECISION_V1 の schema、canonical producer、validator、handoff が既に存在します。

    したがって #387 のアイデアが悪いのではなく、責務の置き場所が現在のアーキテクチャでは古い、という判定です。

    敵対的レビュー

    優先度 | Finding | 判定 -- | -- | -- P0 | #387 を実装すると planning authority が二重化する | #387 は issue-contract-review 内で C0/C2a/C2b/needs_classification を決定し、その decision を status: go/no-go に反映する契約です。 一方、現 canonical policy は issue-refinement-loop だけが semantic planning を行い、downstream は再分類禁止です。 scope_collision_check.py は作るべきではありません。 P0 | #2406 が supersede 済み #387 を2026-08-29に復活させている | #2406 は OPEN で Depends on #387、scope_collision_check/v1 consumer を明記しています。 これは7月の #1674/#1680 の architecture decision より後に作られた設計ドリフトです。#387 を実装して辻褄を合わせるのではなく、#2406 側を直すべきです。 P1 | 候補 inventory が静かに30件で切れる | #387 は gh issue list --state open --json ... と指定しますが --limit がありません。 現行 GitHub CLI の gh issue list は既定 --limit 30 です。31件目以降に overlap があっても issue_list: ok → proceed が起こり得ます。(GitHub CLI) これは fail-closed を掲げながら false-green を作る欠陥です。 P1 | OPEN-only source と closed predecessor AC が矛盾する | source は OPEN issue 限定なのに、schema は overlapping_issue_state: open \| closed、AC3 は「predecessor closed → C2a」を要求しています。 OPEN 一覧だけでは closed predecessor は取得できません。別 dependency graph read が必要です。 P1 | implementation issue 判定が自己矛盾している | 「issue_kind: implementation または phase/implementation label なら implementation」とした直後に、「label のみ / contract のみ」を disagreement として human classification に倒しています。 OR 条件なら単独存在は正常です。ここをそのまま実装すると不要な human stop が量産されます。 P1 | path grammar を新しく実装すると現在の matcher と不一致になる | #387 は redundant slash を圧縮し ** を prefix として扱います。 一方 current main の AllowedPathsMatcher は malformed path を reject し、*=1 segment / **=0+ segments として dependency-free に厳密実装されています。 PR #1794 も既にこれを再利用して tests/* と tests/** の誤同一視を修正しています。 別 normalize_path を増やす理由がありません。 P1 | freshness contract が現在の基準より弱い | #387 v1 は generated_at は持つものの、target body hash、updatedAt、policy version、source completeness digest 等を持ちません。 #1674 はこれらを downstream freshness 検証項目として明示しています。 semantic decision を新 schema に複製すると stale 判定も二重実装になります。 P1 | fail-closed が人間への fail-closed になっている | gh timeout・partial・分類不能の大半を human_classification_required / blocked にしています。 個人開発では「安全に proceed しない」ことと「毎回人間を止める」ことを分離すべきです。source unavailable は indeterminate → bounded rerun / issue-refinement-loop reroute、人間介入は本当に semantic contradiction の場合だけで十分です。 P2 | C0 の schema placement が不自然 | candidate_class は collision_candidates[] 内にしかないのに、no-collision AC が C0 を要求します。 collision がないなら普通は collision_candidates: [], decision: proceed です。C0 のためだけに「衝突していない candidate」を collision list に入れる設計は避けるべきです。 P2 | verification が文字列存在確認に寄りすぎている | AC のかなりの部分が rg で enum/文字列を探す verification です。 今から #387 用の harness を増築する価値はありません。必要な挙動は既存 producer/validator の unit tests に寄せた方が軽いです。

    WEB調査を踏まえた実装面

    GitHub 側の capability も #387 起票時から進んでいます。現在の gh issue view / gh issue list --json は blockedBy / blocking を正式な JSON field として提供し、gh issue edit にも --add-blocked-by / --remove-blocked-by / --add-blocking / --remove-blocking が存在します。本文の Depends on #N を grep して native dependency を推測する優先度は下げてよいです。(GitHub CLI) GitHub 自体も issue dependency の native API を提供しています。(GitHub Docs)

    ただし、installed gh のバージョン差を吸収するために大きな compatibility layer を作る必要はありません。実行時に gh issue view --json blockedBy,blocking が使えるか軽く capability check し、なければ既存の REST/GraphQL 経路へ落とす程度で十分です。個人開発ならこの程度の bounded fallback の方が維持費が低いです。

    さらに、「同じファイルを触る」と「Git が衝突する」は別物という #1674/#1794 の判断は技術的にも正しいです。gh pr diff --name-only は changed-file 名を返すだけです。(GitHub CLI) 実際の three-way merge conflict は git merge-tree --write-tree で worktree/index を汚さず検査でき、非競合なら exit 0、競合なら exit 1 という明確な機械判定ができます。(Git) したがって path overlap は advisory、実 Git conflict だけ後段 blocking が、品質とワークフロー速度のバランスとして適切です。

    現行リポジトリに残った設計ドリフト

    current main で scope_collision_check を検索すると、実装ではなく workflow.md と check_issue_overlap.py の「#387 との共有は後続」という参照が残っています。 一方、issue-contract-review 側には既に declared_path_overlap.py があり、runner・parser・snapshot・direct producer test まで wiring 済みです。

    さらに check_issue_overlap.py 自身が「#387 merge 後に共有正規化へ寄せる」とまだ書いています。 ここは #387 を実装する根拠ではなく、stale comment / migration debt と見るべきです。

    推奨アクション

    1. 実装: issue-contract-review に scope_collision_check を JSON / script-first で追加する #387 を not planned / superseded by #1674/#1680 で close。scope_collision_check.py は作らない。

    2. 実装: issue-refinement-loop で scope_collision_check/v1 を消費する #2406 を再 refinement。Depends on #387 と scope_collision_check/v1 consumer を外し、consumer gap が本当に残っているなら既存 canonical ISSUE_EXECUTION_DECISION_V1 を consume する Issue に変更する。current main には schema・validator・producer が既にあります。

    3. follow-up(#948): check_issue_overlap と #387 scope_collision_check の path 正規化を統一する #973 と stale repo references を再評価。実装: issue-contract-review に scope_collision_check を JSON / script-first で追加する #387 待ちではなく、必要な path grammar 共通化だけを現在の dependency-free AllowedPathsMatcher へ収束させる。新 matcher / broker / ledger は作らない。

    4. issue-contract-review は現状どおり structural/freshness + advisory overlap に限定する。semantic relation は issue-refinement-loop、実競合は commit/PR 後の git merge-tree / GitHub mergeability に任せる。

    5. source failure は「人間を止める」より indeterminate → bounded reroute を標準にする。human escalation は semantic contradiction、native dependency の不整合、実 Git conflict の解消方針が必要な場合に絞る。

    要するに、#387 を高品質化する最善策は #387 の checker を高機能化することではなく、既に成立した後継 architecture に統合して旧 producer を消すことです。特に今回の「個人趣味開発で品質・有用性優先、ハーネスが作業を止めない」という条件では、その方が明確に優れています。

    ## 結論

    Verdict: REQUEST_CHANGES より一段強く、2026-09-02 時点では #387 は「実装しないで supersede/close」が妥当です。

    #387 は 2026-05-25 の refinement で、当初レビューされた「SKILL.md wiring不足」「enum不足」「path normalization 未定義」「fail-closed 不足」などをかなり丁寧に修正し、最終的には approve されています。 その直後に #385 が OPEN のため contract review が blocked になりましたが、#385 自体は 2026-07-11 に completed で close 済みです。

    しかし、その後の設計変更の方が決定的です。#1674 は OPEN Issue 間の semantic relation / dependency ordering / priority 判定は issue-refinement-loop だけが行い、downstream は再分類しないという authority 分離を正本化しています。issue-contract-review に #387 の classifier を置くこと自体が、現在は「第二の planning authority」を作るアンチパターンになっています。 #1680 はさらに machine-readable に issue_387.decision: supersede / destination: #1674 と決定しています。

    そしてこれは文書だけの予定ではありません。PR #1794 は merge 済みで、issue-contract-review を fresh structural/freshness gate に縮小し、OPEN PR の changed-file overlap を declared_path_overlap advisory-only として実装しています。PR 本文は #387 scope_collision_check.py を「supersede 方針のため実装しない」と明記しています。 現行 main には ISSUE_EXECUTION_DECISION_V1 の schema、canonical producer、validator、handoff が既に存在します。

    したがって #387 のアイデアが悪いのではなく、責務の置き場所が現在のアーキテクチャでは古い、という判定です。

    敵対的レビュー

    優先度 Finding 判定
    P0 #387 を実装すると planning authority が二重化する #387 は issue-contract-review 内で C0/C2a/C2b/needs_classification を決定し、その decision を status: go/no-go に反映する契約です。 一方、現 canonical policy は issue-refinement-loop だけが semantic planning を行い、downstream は再分類禁止です。 scope_collision_check.py は作るべきではありません。
    P0 #2406 が supersede 済み #387 を2026-08-29に復活させている #2406 は OPEN で Depends on #387、scope_collision_check/v1 consumer を明記しています。 これは7月の #1674/#1680 の architecture decision より後に作られた設計ドリフトです。#387 を実装して辻褄を合わせるのではなく、#2406 側を直すべきです。
    P1 候補 inventory が静かに30件で切れる #387 は gh issue list --state open --json ... と指定しますが --limit がありません。 現行 GitHub CLI の gh issue list は既定 --limit 30 です。31件目以降に overlap があっても issue_list: ok → proceed が起こり得ます。(GitHub CLI) これは fail-closed を掲げながら false-green を作る欠陥です。
    P1 OPEN-only source と closed predecessor AC が矛盾する source は OPEN issue 限定なのに、schema は overlapping_issue_state: open | closed、AC3 は「predecessor closed → C2a」を要求しています。 OPEN 一覧だけでは closed predecessor は取得できません。別 dependency graph read が必要です。
    P1 implementation issue 判定が自己矛盾している 「issue_kind: implementation または phase/implementation label なら implementation」とした直後に、「label のみ / contract のみ」を disagreement として human classification に倒しています。 OR 条件なら単独存在は正常です。ここをそのまま実装すると不要な human stop が量産されます。
    P1 path grammar を新しく実装すると現在の matcher と不一致になる #387 は redundant slash を圧縮し ** を prefix として扱います。 一方 current main の AllowedPathsMatcher は malformed path を reject し、*=1 segment / **=0+ segments として dependency-free に厳密実装されています。 PR #1794 も既にこれを再利用して tests/* と tests/** の誤同一視を修正しています。 別 normalize_path を増やす理由がありません。
    P1 freshness contract が現在の基準より弱い #387 v1 は generated_at は持つものの、target body hash、updatedAt、policy version、source completeness digest 等を持ちません。 #1674 はこれらを downstream freshness 検証項目として明示しています。 semantic decision を新 schema に複製すると stale 判定も二重実装になります。
    P1 fail-closed が人間への fail-closed になっている gh timeout・partial・分類不能の大半を human_classification_required / blocked にしています。 個人開発では「安全に proceed しない」ことと「毎回人間を止める」ことを分離すべきです。source unavailable は indeterminate → bounded rerun / issue-refinement-loop reroute、人間介入は本当に semantic contradiction の場合だけで十分です。
    P2 C0 の schema placement が不自然 candidate_class は collision_candidates[] 内にしかないのに、no-collision AC が C0 を要求します。 collision がないなら普通は collision_candidates: [], decision: proceed です。C0 のためだけに「衝突していない candidate」を collision list に入れる設計は避けるべきです。
    P2 verification が文字列存在確認に寄りすぎている AC のかなりの部分が rg で enum/文字列を探す verification です。 今から #387 用の harness を増築する価値はありません。必要な挙動は既存 producer/validator の unit tests に寄せた方が軽いです。

    WEB調査を踏まえた実装面

    GitHub 側の capability も #387 起票時から進んでいます。現在の gh issue view / gh issue list --json は blockedBy / blocking を正式な JSON field として提供し、gh issue edit にも --add-blocked-by / --remove-blocked-by / --add-blocking / --remove-blocking が存在します。本文の Depends on #N を grep して native dependency を推測する優先度は下げてよいです。([GitHub CLI]2) GitHub 自体も issue dependency の native API を提供しています。([GitHub Docs]3)

    ただし、installed gh のバージョン差を吸収するために大きな compatibility layer を作る必要はありません。実行時に gh issue view --json blockedBy,blocking が使えるか軽く capability check し、なければ既存の REST/GraphQL 経路へ落とす程度で十分です。個人開発ならこの程度の bounded fallback の方が維持費が低いです。

    さらに、「同じファイルを触る」と「Git が衝突する」は別物という #1674/#1794 の判断は技術的にも正しいです。gh pr diff --name-only は changed-file 名を返すだけです。([GitHub CLI]4) 実際の three-way merge conflict は git merge-tree --write-tree で worktree/index を汚さず検査でき、非競合なら exit 0、競合なら exit 1 という明確な機械判定ができます。([Git]5) したがって path overlap は advisory、実 Git conflict だけ後段 blocking が、品質とワークフロー速度のバランスとして適切です。

    現行リポジトリに残った設計ドリフト

    current main で scope_collision_check を検索すると、実装ではなく workflow.md と check_issue_overlap.py の「#387 との共有は後続」という参照が残っています。 一方、issue-contract-review 側には既に declared_path_overlap.py があり、runner・parser・snapshot・direct producer test まで wiring 済みです。

    さらに check_issue_overlap.py 自身が「#387 merge 後に共有正規化へ寄せる」とまだ書いています。 ここは #387 を実装する根拠ではなく、stale comment / migration debt と見るべきです。

    推奨アクション

    1. 実装: issue-contract-review に scope_collision_check を JSON / script-first で追加する #387 を not planned / superseded by #1674/#1680 で close。scope_collision_check.py は作らない。
    2. 実装: issue-refinement-loop で scope_collision_check/v1 を消費する #2406 を再 refinement。Depends on #387 と scope_collision_check/v1 consumer を外し、consumer gap が本当に残っているなら既存 canonical ISSUE_EXECUTION_DECISION_V1 を consume する Issue に変更する。current main には schema・validator・producer が既にあります。
    3. follow-up(#948): check_issue_overlap と #387 scope_collision_check の path 正規化を統一する #973 と stale repo references を再評価。実装: issue-contract-review に scope_collision_check を JSON / script-first で追加する #387 待ちではなく、必要な path grammar 共通化だけを現在の dependency-free AllowedPathsMatcher へ収束させる。新 matcher / broker / ledger は作らない。
    4. issue-contract-review は現状どおり structural/freshness + advisory overlap に限定する。semantic relation は issue-refinement-loop、実競合は commit/PR 後の git merge-tree / GitHub mergeability に任せる。
    5. source failure は「人間を止める」より indeterminate → bounded reroute を標準にする。human escalation は semantic contradiction、native dependency の不整合、実 Git conflict の解消方針が必要な場合に絞る。

    要するに、#387 を高品質化する最善策は #387 の checker を高機能化することではなく、既に成立した後継 architecture に統合して旧 producer を消すことです。特に今回の「個人趣味開発で品質・有用性優先、ハーネスが作業を止めない」という条件では、その方が明確に優れています。

  9. squne121 commented on Sep 2, 2026

    @squne121
    OwnerAuthor

    推奨は、#387 を実装方向へ refine しないことです。対象 OWNER コメントの「scope_collision_check.py を作らず supersede/close」という結論自体は妥当です。#1680 でも #387 の supersede が機械可読で記録され、PR #1794 では issue-contract-review が declared_path_overlap の advisory-only producer として既に実装されています。

    ただし、対象コメントの 「#1674 が現在の canonical authority なので #1674 へ supersede」部分は再検証必須です。その後の #1860/#1869 とマージ済み PR #1871 ではさらに minimal-harness 化が進み、semantic planning / overlap artifact を通常作業の blocking authority にしない方針へ変更されています。current docs/dev/workflow.md でも collision 由来の実質的 hard stop は実 3-way Git conflict と target PR の CONFLICTING / DIRTY に絞られています。したがって、#387 → #1674 と機械的に閉じるのではなく、#1674 → #1860/#1869/PR #1871 まで supersession chain を fact-check してから最終 close reason を確定させるのがよいです。

    また #2406 は現在も Depends on #387 / scope_collision_check/v1 consumer を要求しており、#973 も「#387 マージ後」の path normalization 共有を前提にしています。どちらも #387 を復活させる理由にはせず、#2406/#973 自体を current-main に対して再 refinement し、固有の残存 Outcome がなければ not planned、残るなら既存 AllowedPathsMatcher 等への最小収束へ reframeするのがよいです。

    issue-refinement-loop 自体は routine iteration の loop_iteration_approval_gate.default_required: false なので、この用途では各 iteration ごとの承認を求める必要はありません。ただし、これは Claude Code 自体の permission mode を無効化する意味ではありません。既存の canonical executor / guard は維持させるのが適切です。

    以下をそのまま Claude Code に渡すのを推奨します。

    対象リポジトリ:
    squne121/loop-protocol

    対象 Issue:
    #387

    human anchor:
    #387 (comment)

    この OWNER anchor を operator_asserted_human_context として、canonical issue-refinement-loop を実行してください。

    目的

    Issue #387 に対して current main / live GitHub state を再調査したうえで refinement を完了し、現在の architecture 上で #387 の固有 Outcome が既に supersede / absorbed されているなら、superseded_by_decision の canonical 終了経路まで materialize してください。

    この作業は「#387 を実装可能な形へ無理に改善する」ことを目的としません。

    現時点の強い仮説は:

    というものです。

    仮説を結論として固定せず、必ず live evidence で検証してください。

    人間承認について

    この refinement run の routine な iteration approval は不要です。

    • iteration 間で私に「続行してよいですか」と確認しない
    • needs-fix → rewrite → re-review の bounded loop は repository の issue-refinement-loop 契約に従って自動継続する
    • safe / deterministic と canonical workflow が判断した Issue 本文修正、contract update、termination materialization、supersede/close 処理について追加承認を求めない
    • OWNER anchor により既に明示された disposition を、同じ内容について再度人間へ確認しない
    • max_iterations は既定値を使用してよい

    ただし、これは Claude Code 自体の permission system を無効化する指示ではありません。

    以下は禁止します。

    • --dangerously-skip-permissions 等をこの作業のために勝手に有効化する
    • permission mode を変更する
    • guard / canonical executor を迂回する
    • protected path / secret / destructive Git guard を弱体化する

    現在のセッションに与えられている権限と repository の canonical executor の範囲内で自律実行してください。

    本当に repository contract 上の human-only hard stop に到達した場合だけ停止し、その exact blocker を報告してください。
    単なる overlap、advisory artifact の stale/missing、旧 control-plane artifact の不整合を理由に人間を止めないでください。

    canonical entry

    まず root/main control-plane から、human context lane を明示して canonical preflight を実行してください。

    uv run --locked python3 scripts/agent-guards/skill_runtime_exec.py \
      --command-id preflight.run.with_human_context \
      --issue-number 387 \
      --repo squne121/loop-protocol \
      --anchor-comment-url 'https://github.com/squne121/loop-protocol/issues/387#issuecomment-5508429148'

    planner / command registry が別の canonical invocation を返した場合は、手書きコマンドより registry を優先してください。

    trusted contract patch plan が生成され、canonical workflow が contract update を要求した場合だけ、main control-plane から以下の canonical mutation phase を使用してください。

    uv run --locked python3 scripts/agent-guards/skill_runtime_exec.py \
      --command-id contract_update.run.with_human_context \
      --issue-number 387 \
      --repo squne121/loop-protocol \
      --anchor-comment-url 'https://github.com/squne121/loop-protocol/issues/387#issuecomment-5508429148'

    SubAgent からこの mutation command を直接実行させないでください。

    SubAgent 使用を必須とする

    Step 1 では必ず read-only SubAgent を使用してください。

    最低1つ、codebase-investigator を起動して、anchor comment 内の repository / Issue / PR に関する技術的主張を current main と live GitHub state で fact-check してください。

    可能なら調査を以下の2系統へ分けてください。

    SubAgent A — architecture / supersession fact-check

    read-only codebase-investigator に以下を検証させる:

    SubAgent B — stale dependency / implementation debt inventory

    別の read-only SubAgent を利用可能なら起動し、以下を検証させる:

    SubAgent は read-only としてください。
    Issue edit、comment、close、label mutation、branch/worktree/commit/PR 作成を SubAgent に行わせないでください。

    SubAgent 完了待機は必須

    SubAgent を background で起動した場合も、全 SubAgent の完了を必ず待ってください。

    「完了通知を後で待つ」と書いて main thread を終了してはいけません。

    • launch
    • wait / join
    • 完了結果を取得
    • evidence を統合
    • その後にのみ final classification

    の順序を厳守してください。

    1つでも起動した SubAgent が未完了の状態で Step 2、Issue mutation、supersede classification、termination へ進まないでください。

    nested SubAgent delegation は行わせず、SubAgent の起動・join は main control-plane が所有してください。

    anchor classification

    anchor comment は OWNER comment ですが、そこに含まれる factual claim は current-main evidence で検証してください。

    特に次を区別してください。

    1. 「実装: issue-contract-review に scope_collision_check を JSON / script-first で追加する #387 の scope_collision_check.py を実装すべきではない」
    2. 「実装: issue-contract-review に scope_collision_check を JSON / script-first で追加する #387 の replacement destination は 導入: OPEN Issue 重複・依存順・実装優先順位判定を issue-refinement-loop に一元化する #1674/実装: issue-contract-review を fresh structural gate に縮小し、OPEN PR の実編集競合のときだけ停止させる #1680 である」
    3. 「現在も ISSUE_EXECUTION_DECISION_V1 が blocking planning authority である」

    1 は current evidence と整合する可能性が非常に高いです。

    2 と 3 は #1860/#1869/PR #1871 という後続 owner decision が存在するため、anchor の文章をそのまま最新 authority とみなさず必ず再検証してください。

    後続 policy が #1674 の semantic-planning authority 自体を supersede / advisory 化しているなら、#387 の close comment / superseded_decision ではその最新 chain を記録してください。

    #387 の判断ルール

    調査結果が以下を満たす場合:

    final_classification: superseded_by_decision
    として扱ってください。

    その場合:

    canonical close/replacement flowを完了し、Issue #387 を repository policy に適合する not planned / superseded disposition で close してください。

    close reason/comment には少なくとも:

    を簡潔に記録してください。

    古い #1674 だけを replacement として記録し、より新しい owner decision を落とさないでください。

    #2406 の処置

    #387 の disposition を確定した後、#2406 を current main に対して再評価してください。

    #2406 が現在も:

    を要求している場合、#387 を実装して dependency を満たそうとしてはいけません。

    current #1860/#1869 minimal-harness policyと照合し、

    • 独立した残存 Outcome がない → superseded/not planned
    • 実在する小さな gap がある → current architecture に沿って reframe
    • ISSUE_EXECUTION_DECISION_V1 等の別 artifact を新たな blocking authority にするだけ →採用しない

    の順で判断してください。

    #2406 を reframe/close する必要がある場合は、可能なら同じ control-plane から canonical issue-refinement-loop を別 target として実行してください。
    #387 の本文へ #2406 の implementation scope を混載しないでください。

    #973 の処置

    #973 も #387 merge 後の path normalization 共通化を前提にしています。

    current AllowedPathsMatcher と既存 consumer を調査し、

    としてください。

    新 matcher、新 schema、新 broker は作らないでください。

    stale repository references

    current main に

    • #387 scope_collision_check との正規化共有は follow-up
    • #387 マージ後に共有正規化へ寄せる

    等の stale reference が残っている場合、それを #387 実装の根拠にしないでください。

    これは migration debt / stale documentation candidate として分類してください。

    既存 Issue(例 #973)で適切に扱えるならそこへ reframe し、新規 Issue を増やさないでください。

    本 refinement run の最中に直接 production code cleanup を混載しないでください。

    Web research

    planner の web_research_policy が要求する場合のみ web-researcher SubAgent を使ってください。

    外部仕様確認が必要なら current official documentation を優先してください。

    ただし repository facts / architecture precedence は current repo と live GitHub Issue/PR evidence を優先してください。

    web-researcher を起動した場合も完了を必ず wait/join してから判定してください。

    最終 review / termination

    canonical root-owned review pipeline を使用してください。
    legacy issue-reviewer SubAgent を canonical Step 2 の代替として勝手に起動しないでください。

    superseded_by_decision が fact-check 済みで成立する場合は、implementation-ready にするための rewrite loopへ無理に進めず、canonical supersede termination flow を完了してください。

    最終終了条件:

    最終報告

    終了時は簡潔に以下を報告してください。

    routine approvalを求めて停止せず、canonical workflow が許すところまで現在のセッション内で完了してください。

    この形なら、対象コメントの結論を利用しつつ、9月2日時点では古くなっている可能性のある #1674 authority を再び正本化してしまう事故を避けられます。特に #2406 は 8月29日起票なので、今回の refinement で一緒に設計ドリフトを解消する優先度が高いです。

  10. squne121 commented on Sep 2, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: 完了 (2026-09-02)

    判定根拠

    1. 実装: issue-contract-review を fresh structural gate に縮小し、OPEN PR の実編集競合のときだけ停止させる #1680(Machine-Readable Contract, CLOSED)が migration_decisions.issue_387: {decision: supersede, destination: "#1674"} を記録済み。
    2. 導入: OPEN Issue 重複・依存順・実装優先順位判定を issue-refinement-loop に一元化する #1674(CLOSED / NOT_PLANNED, 2026-07-31)は「OPEN Issue 間の semantic relation / dependency ordering 判定を issue-refinement-loop に一元化する」方針だった。ただし 導入: OPEN Issue 重複・依存順・実装優先順位判定を issue-refinement-loop に一元化する #1674 自身も後続 owner decision で置き換わっている(下記3)。
    3. 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860(OPEN, minimal-harness 縮退 parent)→ 実装: semantic planning・overlap・contract artifactのblocking authorityを撤去する #1869(CLOSED, 実装)→ PR 実装: semantic planning・overlap・contract artifactのblocking authorityを撤去する #1871(MERGED 2026-07-31) が現行 authority。導入: OPEN Issue 重複・依存順・実装優先順位判定を issue-refinement-loop に一元化する #1674 の「一元化」路線ではなく、semantic planning / scope-rollup / contract snapshot / overlap evidence の blocking authority を全面撤去し、実 Git conflict・target PR mergeability(mergeable==CONFLICTING / merge_state_status==DIRTY)のみを hard stop として残す方向で確定。導入: OPEN Issue 重複・依存順・実装優先順位判定を issue-refinement-loop に一元化する #1674 のクローズコメント自身が「本 Issue が要求した一元化方向は 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 owner decision と逆行するため、その通りには実装されなかった」と明記している。
    4. PR 実装: issue-contract-review を fresh structural gate に縮小し declared_path_overlap(advisory)を追加する #1794(MERGED 2026-07-26)で issue-contract-review は fresh structural/freshness gate に縮小され、declared_path_overlap.py(AllowedPathsMatcher 再利用、advisory-only)が実装済み。scope_collision_check.py は現行 main に存在しない。
    5. ISSUE_EXECUTION_DECISION_V1(schema/producer/validator)は現行 main に存在するが、実装: semantic planning・overlap・contract artifactのblocking authorityを撤去する #1869 の Scope(validate_issue_execution_decision.py 関連 routing で「missing/stale を hard stop にしない」)により advisory 化済みであり、blocking planning authority ではない。

    したがって #387(scope_collision_check.py を issue-contract-review の新しい semantic blocking classifier として追加する Issue)は、#1674 単独ではなく #1674 → #1860/#1869/PR#1871 という更新済み chain によって二重に supersede されている。#1674 が望んだ「一元化」自体も採用されず、代わりに「新しい blocking authority / 新schema を一切増やさない」方針が確定しているため、#387 を今実装すると、この現行方針に反する新しい semantic blocking classifier を作ることになる。

    実施しないこと

    • scope_collision_check.py の新規実装
    • 新しい scope_collision_check/v1 schema
    • generic collision broker / 新しい path matcher
    • ledger・persistent state・receipt・専用 authority artifact の追加

    remaining work は #387 側ではない

    SubAgent 検証(read-only, 2件・完了済み)

    Close disposition: not planned(superseded by #1860 / #1869 / PR #1871; historical migration destination recorded in #1680)。

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