Skip to content

実装: impl-review-loop preparation の決定論的 preflight を Haiku SubAgent runner に委譲する #611

Closed

Description

@squne121

Machine-Readable Contract

以下に機械可読コントラクトを示す。

contract_schema_version: v1
issue_kind: research
parent_issue: "none"
goal_ref: "impl-review-loop preparation の scope rollup preflight を read-only Haiku SubAgent に委譲し、main conversation は検証済み summary marker のみ採用する"
change_kind: docs

Parent Issue

none(単独設計提案)

Parent Goal Ref

単独の設計改善であり、親 Issue は存在しない。

  • Goal: N/A(単独設計提案のため該当なし)
  • Desired Destination: N/A(同上)

Background

impl-review-loop の main conversation は orchestration / routing / final adoption を責務とするべきであり、plan_issue_scope_rollup.py のような決定論的 preflight 実行や大量の gh issue list / gh pr list 出力処理を main context に載せ続けるのは context 汚染・token 消費・責務肥大化につながる。

Claude Code SubAgent は独立 context、tool 制限、model: haiku、permissionMode を持てるため、read-only / mutation-free な preflight runner と相性がよい。

本 Issue は #607 の ## Scope Boundary Note で「別 Issue として扱う」と明記されたアーキテクチャ変更の設計 Issue である。

Outcome

この Issue の実装完了後、以下の状態になる。

.claude/agents/scope-rollup-runner.md が存在し、model: haiku / permissionMode: auto で plan_issue_scope_rollup.py を実行・結果 marker を生成する専用 agent が定義されている。impl-review-loop/steps/preparation.md の Step 2.5 は runner 委譲型に変更され、runner が stdout に ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1 marker を返す。marker は ref-based 設計とし、full plan の inline 埋め込みを禁止する。marker に含めるのは raw_plan_location(ファイルパス)、result_sha256(ファイルバイト列の sha256)、suggested_actions_summary(1-3 行の要約)のみ。main conversation は marker の検証後に raw_plan_location から plan を必要に応じて読み込む(default では読み込まない)。GitHub comment への直接投稿は runner の責務ではなく、main conversation が必要に応じて行う。

In Scope

  • .claude/agents/scope-rollup-runner.md の新規作成
    • model: haiku
    • permissionMode: auto
    • maxTurns の設定
    • tools: Read, Grep, Glob, Bash
    • Write/Edit/PR作成/Issue編集は禁止
    • plan_issue_scope_rollup.py 実行と summary marker 出力に限定
    • runner は GitHub mutation を行わない(gh issue comment, gh api -X POST/PATCH, git push, git commit 等を禁止)
  • .claude/skills/impl-review-loop/steps/preparation.md の Step 2.5 を runner 委譲型に変更
    • main は runner の marker を schema/issue/repo/invocation_id/input_sha/result_sha/script_sha で検証する
    • main は raw plan を default で読み込まない(raw_plan_location は debug 専用)
    • runner unavailable / permission denied の fallback を明示する(silent fallback で main が raw output を読むことを禁止)
  • runner 出力の machine-readable marker 仕様追加
    • ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1 は ref-based 設計(full plan inline 禁止)
    • 含むフィールド: schema_version, repo, current_issue, invocation_id, requested_at, generated_at, git_head_sha, script_path, script_blob_sha256
    • inputs: current_issue_sha256, issues_all_sha256, prs_all_sha256, issue_count, pr_count
    • result: plan_schema, raw_plan_location(ファイルパス), result_sha256(ファイルバイト列 sha256), suggested_actions_summary(1-3 行), candidate_count, high_confidence_count
    • full plan JSON は marker に含めない(main context 汚染防止)
  • result_sha256 計算仕様
    • 計算対象: raw_plan_location のファイルバイト列(sha256sum / shasum -a 256 コマンドの出力と同一)
    • 正規化不要: ファイルバイト列をそのまま sha256 計算するため canonical JSON(RFC 8785 等)は不要
    • runner: plan を raw_plan_location のパスに保存し、そのバイト列の sha256 を計算して result_sha256 に格納
    • main: marker の raw_plan_location からファイルを読み取り、バイト列の sha256 を計算して result_sha256 と照合する

Out of Scope

Acceptance Criteria

  • AC1: .claude/agents/scope-rollup-runner.md が存在し、name: scope-rollup-runner, model: haiku, tools: Read, Grep, Glob, Bash, maxTurns が設定されている
  • AC2: runner の agent 定義ファイルに GitHub mutation / repo mutation コマンドが記述されていない(テキスト禁止モデル)。対象禁止パターン: gh issue (edit|close|comment|create), gh pr (create|merge|close|edit), gh api -X (POST|PATCH|PUT|DELETE), git (push|commit|checkout|branch|worktree), tee のリポジトリパス出力
  • AC3: Step 2.5 は runner 委譲を明記し、main conversation で raw gh issue/pr list output を展開しない
  • AC4: ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1 は repo/current_issue/invocation_id/generated_at/script_blob_sha256/inputs_sha/result_sha を含む
  • AC5: main conversation は marker を検証し、不正・stale・issue mismatch・sha mismatch の場合は採用しない
  • AC6: proceed_with_coordination 候補は既存 実装: preflight scope rollup に proceed_with_coordination を追加し uncertain 衝突の過剰停止を廃止する #607/feat(#607): uncertain 衝突に proceed_with_coordination を導入しキーワードベース即時停止を廃止する #613 の semantics を維持し、LOOP_STATE.scope_rollup_decision.related_coordination[] に反映される
  • AC7: runner unavailable / permission denied の fallback は明示され、silent fallback で main が raw output を読むことを禁止する

Verification Commands

各 AC に対応する検証コマンドを以下に示す。

# AC1
$ test -f .claude/agents/scope-rollup-runner.md
# AC1
# preflight-scope: pr_review_only
$ rg -q "name: scope-rollup-runner" .claude/agents/scope-rollup-runner.md
# AC1
# preflight-scope: pr_review_only
$ rg -q "model: haiku" .claude/agents/scope-rollup-runner.md
# AC1
# preflight-scope: pr_review_only
$ rg -q "maxTurns:" .claude/agents/scope-rollup-runner.md
# AC2
$ ! rg -n "gh issue (edit|close|comment)|gh pr (create|merge|close|edit)|gh api .* -X (POST|PATCH|PUT|DELETE)|git (push|commit)|\\btee\\b" .claude/agents/scope-rollup-runner.md
# AC3
$ rg -q "scope-rollup-runner" .claude/skills/impl-review-loop/steps/preparation.md
# AC4
$ rg -q "ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1" .claude/skills/impl-review-loop/steps/preparation.md
# AC4
$ rg -q "invocation_id" .claude/skills/impl-review-loop/steps/preparation.md
# AC4
$ rg -q "raw_plan_location" .claude/skills/impl-review-loop/steps/preparation.md
# AC4
$ rg -q "suggested_actions_summary" .claude/skills/impl-review-loop/steps/preparation.md
# AC5
$ rg -q "mismatch\|stale\|採用しない\|reject" .claude/skills/impl-review-loop/steps/preparation.md
# AC6
$ rg -q "related_coordination\|proceed_with_coordination" .claude/skills/impl-review-loop/steps/preparation.md
# AC7
$ rg -q "scope_rollup_runner_unavailable\|fallback.*runner\|runner.*unavailable" .claude/skills/impl-review-loop/steps/preparation.md

Allowed Paths

変更対象ファイルを以下に限定する。

  • .claude/agents/scope-rollup-runner.md
  • .claude/skills/impl-review-loop/steps/preparation.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • runner が plan_issue_scope_rollup.py の判定ロジック変更を要求する場合
  • Haiku 以外のモデルが必要と判明した場合

Required Skills

なし

Runtime Verification Applicability

本 Issue はワークフロー文書および agent 定義の変更のみであり、ゲームの実行時挙動を変更しない。

decision: not_applicable
reason: "Workflow documentation and agent definition changes only. No runtime game behavior changed."

Handoff Contract

  • Current Objective: scope-rollup preflight を Haiku SubAgent runner に委譲し、main conversation への raw output 流入を防ぐ
  • Bounded Current Context: .claude/agents/scope-rollup-runner.md(新規)および .claude/skills/impl-review-loop/steps/preparation.md(Step 2.5 変更)
  • Open Questions: なし(AC/VC により定義済み)
  • Next Action: impl-review-loop で実装
  • Artifact Refs: なし

Activity

  1. added
    enhancement
    on Jun 3, 2026
  2. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES

    #611 の方向性は妥当です。plan_issue_scope_rollup.py の大量 gh issue/pr list 出力を main conversation に載せ続けない、という問題意識は Claude Code subagent の用途と一致しています。公式 docs でも、subagent は独立 context で作業し、main conversation には結果だけ返す用途に適しているとされています。([GitHub]1)

    ただし、現 Issue 契約のままだと実装時に破綻する可能性が高いです。主な問題は「read-only runner」と「GitHub comment marker 再取得」が同居している点です。

    Blocker 1: read-only runner と GitHub comment marker が矛盾している

    #611 は runner を Read, Grep, Glob, Bash に限定し、Write/Edit/PR 作成/Issue 編集を禁止するとしています。一方で Outcome では、main conversation が「GitHub comment の machine-readable marker を再取得」して採用すると書かれています。([GitHub]1)

    GitHub comment を生成するには gh issue comment や REST API POST などの mutation が必要です。ところが AC4 の禁止確認は gh issue edit|gh pr create|Edit|Write だけで、gh issue comment、gh api -X POST、gh api repos/.../issues/.../comments を捕捉できません。結果として、runner が「read-only」と称しながら GitHub にコメント投稿できる抜け道が残ります。([GitHub]1)

    修正方針はどちらかに寄せるべきです。

    1. read-only を守る: runner は stdout に ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1 の最小 marker だけを返す。main はその marker を検証して LOOP_STATE に採用する。GitHub comment は使わない。
    2. GitHub 証跡を残す: runner は read-only のままにし、main conversation が検証済み marker だけを GitHub comment として投稿し、その comment URL/id を再取得して採用する。
    3. runner に投稿させる: runner は read-only ではなく「commenting preflight runner」と定義し直し、許可 mutation を gh issue comment のみに限定する。この場合、AC4 と negative grep を全面的に書き換える必要があります。

    現時点の #611 は 1〜3 のどれでもなく、中途半端です。

    Blocker 2: permissionMode: dontAsk は Bash runner と相性が悪い

    #611 は permissionMode: dontAsk を AC2 に入れていますが、Claude Code docs では dontAsk は permission prompt を自動 deny する mode です。明示的に許可された tool は動く一方、Bash command の許可 prompt が発生する場合は失敗し得ます。([code.claude.com]2)

    この runner は gh issue view、gh issue list、gh pr list、python3 ...plan_issue_scope_rollup.py を Bash で実行する設計です。現在の #611 には、それらの Bash command を permission allowlist に入れる記述がありません。dontAsk 固定だと「自律 runner なのに許可 denied で止まる」実装になる可能性があります。([GitHub]3)

    修正案:

    permissionMode: auto

    または、dontAsk を維持するなら、project settings 側で以下のような許可範囲を明記する必要があります。

    allowed_bash_commands:
      - gh repo view --json nameWithOwner
      - gh issue view ...
      - gh issue list ...
      - gh pr list ...
      - python3 .claude/skills/issue-refinement-loop/scripts/plan_issue_scope_rollup.py ...

    ただし auto でも high-stakes mutation の代替にはならないため、runner は mutation-free に閉じるのが安全です。Anthropic も auto mode は高リスク操作に対する careful human review の完全代替ではないと説明しています。([Anthropic]4)

    Blocker 3: marker の真正性・鮮度検証が弱い

    #611 の marker fields は schema_version, current_issue, generated_at, script, input_refs, result_sha256, suggested_actions_summary, raw_plan_location です。([GitHub]1)

    これだけでは stale marker や別入力の流用を十分に防げません。最低限、以下を marker に追加すべきです。

    ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1:
      schema_version: 1
      repo: "squne121/loop-protocol"
      current_issue: 611
      invocation_id: "<uuid>"
      requested_at: "<ISO8601>"
      generated_at: "<ISO8601>"
      git_head_sha: "<sha>"
      script_path: ".claude/skills/issue-refinement-loop/scripts/plan_issue_scope_rollup.py"
      script_blob_sha256: "<sha256>"
      inputs:
        current_issue_sha256: "<sha256>"
        issues_all_sha256: "<sha256>"
        prs_all_sha256: "<sha256>"
        issue_count: <int>
        pr_count: <int>
        gh_state: "all"
        gh_limit: 1000
      result:
        plan_schema: "ISSUE_SCOPE_ROLLUP_PLAN_V2"
        result_sha256: "<sha256>"
        candidate_count: <int>
        high_confidence_count: <int>
      marker:
        comment_url: "<url|null>"
        comment_id: "<id|null>"

    main conversation 側は repo/current_issue/invocation_id/script_blob_sha256/input sha/result_sha/generated_at を検証してから採用するべきです。generated_at だけでは、古い正常 marker を再利用する攻撃・誤採用を防げません。

    Blocker 4: raw_plan_location が context 汚染を再発させる

    #611 は「raw output 流入を防ぐ」ことを goal にしていますが、marker に raw_plan_location を持たせる設計です。([GitHub]1)

    これは危険です。main conversation が raw_plan_location を開く運用になれば、結局 raw plan が main context に流入します。runner の価値は「大量探索を subagent に隔離し、main に summary だけ返す」点にあります。Claude Code docs でも、subagent は大量検索結果や file contents を main conversation に持ち込まない用途が想定されています。([code.claude.com]2)

    修正案:

    raw_plan_location:
      value: null
      policy: "main conversation must not load raw plan by default"

    または raw plan を保存するなら、main は通常 result_sha256 と summary だけを使い、debug 時だけ人間が明示的に読む設計にしてください。

    Blocker 5: Bash tool だけでは mutation-free を保証できない

    tools: Read, Grep, Glob, Bash から Write/Edit を外しても、Bash は shell redirection や CLI 経由でファイル作成・GitHub mutation・git 操作ができます。Claude Code docs も、tool access は allowlist/denylist で制御できる一方、Bash を許す場合は permission mode や policy が別途重要になります。([code.claude.com]2)

    #611 の AC4 は gh issue edit|gh pr create|Edit|Write の grep だけなので、以下を検出できません。

    gh issue comment
    gh api -X POST
    gh api -X PATCH
    git push
    git commit
    git worktree add
    cat > .claude/...
    python -c 'open(..., "w")'
    tee ...

    少なくとも negative verification はこの程度まで広げるべきです。

    ! rg -n \
      "gh issue (edit|close|comment)|gh pr (create|merge|close|edit)|gh api .* -X (POST|PATCH|PUT|DELETE)|git (push|commit|worktree|checkout|switch|branch -D)|\\btee\\b|>\\s*\\.claude/|open\\([^)]*['\"]w" \
      .claude/agents/scope-rollup-runner.md

    ただし grep は完全なセキュリティ境界ではありません。最終的には permissionMode と command allowlist で制御すべきです。

    Blocker 6: subagent のロード/起動条件が契約にない

    Claude Code の project subagent は .claude/agents/ に置けますが、docs では subagent file は session start 時にロードされ、直接 file を追加・編集した場合は session restart が必要とされています。([code.claude.com]2)

    #611 は .claude/agents/scope-rollup-runner.md を追加するだけで、impl-review-loop からの明示 invocation 方式が曖昧です。Step 2.5 に「scope-rollup-runner に委譲」と書くだけでは、既存 session で確実に起動できる保証がありません。([GitHub]1)

    preparation.md には、少なくとも以下を明記すべきです。

    - Invoke the project subagent explicitly: use `scope-rollup-runner`.
    - If the agent file was added in the current PR/session, restart Claude Code before runtime verification.
    - Do not fall back to running `plan_issue_scope_rollup.py` in main conversation unless `scope_rollup_runner_unavailable` is recorded.

    関連 Issue / PR との整合

    #607 は、uncertain を人間停止ではなく proceed_with_coordination に倒す修正で、#613 により merged 済みです。#613 は最終的に TEST_VERDICT_MACHINE v1 の検証コメント、44 件の pytest pass、typecheck/test/build pass を確認して approve/merge されています。([GitHub]5)

    現在 main の preparation Step 2.5 は、worktree 作成前に gh issue list / gh pr list / plan_issue_scope_rollup.py を main conversation 側で実行する設計です。#611 はここを subagent 委譲型に置換する後続設計なので、#607/#613 の判定ロジック自体には触れない、という Out of Scope は正しいです。([GitHub]3)

    #558 は「scope rollup は security gate ではない。security-risk gate は別責務」という整理です。#611 の runner は scope collision preflight executor に閉じ、security/auth/credential 判定を追加しないほうが整合します。([GitHub]6)

    #597 は似た「Haiku SubAgent による preflight materialization」案ですが、現在は “Closed as not planned” です。#611 の設計で permissionMode: dontAsk や GitHub comment 生成の前例として #597 を無批判に流用しないほうがよいです。([GitHub]7)

    推奨する #611 契約修正版

    最小修正ならこうです。

    contract_schema_version: v1
    issue_kind: design
    change_kind: docs
    goal_ref: "impl-review-loop preparation の scope rollup preflight を read-only Haiku SubAgent に委譲し、main conversation は検証済み summary marker のみ採用する"
    
    in_scope:
      - ".claude/agents/scope-rollup-runner.md を追加"
      - ".claude/skills/impl-review-loop/steps/preparation.md Step 2.5 を runner 委譲型に変更"
      - "runner は GitHub mutation を行わない"
      - "main は runner の marker を schema/issue/repo/invocation_id/input_sha/result_sha/script_sha で検証する"
      - "main は raw plan を default で読み込まない"
    
    out_of_scope:
      - "plan_issue_scope_rollup.py の判定ロジック変更"
      - "security-risk gate の設計"
      - "runner による Issue/PR/comment mutation"
      - "raw plan の main context 取り込み"

    AC もこう直すべきです。

    AC1: `.claude/agents/scope-rollup-runner.md` が存在し、`name: scope-rollup-runner`, `model: haiku`, `tools: Read, Grep, Glob, Bash`, `maxTurns` が設定されている。
    AC2: runner は `gh issue view/list`, `gh pr list`, `plan_issue_scope_rollup.py` の read-only 実行だけを許可し、GitHub mutation / repo mutation を禁止している。
    AC3: Step 2.5 は runner 委譲を明記し、main conversation で raw `gh issue/pr list` output を展開しない。
    AC4: `ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1` は repo/current_issue/invocation_id/generated_at/script_sha/input_sha/result_sha を含む。
    AC5: main conversation は marker を検証し、不正・stale・issue mismatch・sha mismatch の場合は採用しない。
    AC6: `proceed_with_coordination` 候補は既存 #607/#613 の semantics を維持し、`LOOP_STATE.scope_rollup_decision.related_coordination[]` に反映される。
    AC7: runner unavailable / permission denied の fallback は明示され、silent fallback で main が raw output を読むことを禁止する。

    最終コメント

    #611 は着眼点は良いですが、今のままだと「context 汚染を避けるための runner」が、GitHub comment mutation・Bash 書き込み・permission denied・stale marker 誤採用という別の事故源になります。

    実装に進める前に、まず runner は本当に read-only なのか、GitHub comment を誰が投稿するのか、main は何を検証して採用するのか を Issue 本文に固定してください。そこを直せば、#607/#613 の後続として実装可能です。

  3. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    コントラクトレビュー: BLOCKED (2026-06-03T07:00:00Z)

    CONTRACT_REVIEW_RESULT_V1:
      status: blocked
      generated_at: "2026-06-03T07:00:00Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/611
      checks:
        template_compliance: fail
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: n/a
        vc_preflight:
          passed: false
          vc_failed_as_expected: 8
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
          vc_expected_pass: 0
          vc_skipped: 0
          status: human_judgment
          classifications:
            - ac: AC1
              command: "test -f .claude/agents/scope-rollup-runner.md"
              exit_code: 1
              category: file_not_found_expected
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC1
              command: "rg -q \"name: scope-rollup-runner\" .claude/agents/scope-rollup-runner.md"
              exit_code: 2
              category: unknown
              scope_class: baseline_fail_expected
              confidence: low
              decision: human_judgment
            - ac: AC1
              command: "rg -q \"model: haiku\" .claude/agents/scope-rollup-runner.md"
              exit_code: 2
              category: unknown
              scope_class: baseline_fail_expected
              confidence: low
              decision: human_judgment
            - ac: AC1
              command: "rg -q \"maxTurns:\" .claude/agents/scope-rollup-runner.md"
              exit_code: 2
              category: unknown
              scope_class: baseline_fail_expected
              confidence: low
              decision: human_judgment
            - ac: AC2
              command: "! rg -n \"gh issue (edit|close|comment)|...\" .claude/agents/scope-rollup-runner.md"
              exit_code: null
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC3
              command: "rg -q \"scope-rollup-runner\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC4
              command: "rg -q \"ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC4
              command: "rg -q \"invocation_id\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC5
              command: "rg -q \"mismatch|stale|採用しない|reject\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC6
              command: "rg -q \"related_coordination|proceed_with_coordination\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC7
              command: "rg -q \"scope_rollup_runner_unavailable|fallback.*runner|runner.*unavailable\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              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: propose_refinement_loop
      blocked_reasons:
        - check: template_compliance
          detail: "issue_kind: research テンプレート(research.yml)の必須セクション ## Handoff Contract が存在しない"
        - check: vc_preflight
          detail: "AC1 の rg コマンド 3 件が対象ファイル非存在で exit code 2 を返し human_judgment に分類。ファイル不在時 rg は exit 2 を返すため baseline fail の証拠にならない。# preflight-scope: pr_review_only マーカーを追加してください(simple_contract_hygiene_fix)"

    不足項目と修正方法

    ブロッカー 1: ## Handoff Contract が存在しない(research.yml 必須)

    以下を Issue 本文末尾に追加してください:

    ## Handoff Contract
    
    - `Current Objective`: scope-rollup preflight を Haiku runner に委譲する
    - `Bounded Current Context`: `.claude/agents/scope-rollup-runner.md` および `preparation.md Step 2.5`
    - `Open Questions`: なし(AC により定義済み)
    - `Next Action`: impl-review-loop で実装
    - `Artifact Refs`: なし

    ブロッカー 2: AC1 の rg コマンドに # preflight-scope: pr_review_only マーカーを追加(simple_contract_hygiene_fix)

    rg はターゲットファイルが存在しない場合 exit code 2(エラー)を返すため、分類不能(human_judgment)になります。baseline では test -f が存在確認を担うため、コンテンツ検証 rg には pr_review_only マーカーを付与してください:

    # AC1
    $ test -f .claude/agents/scope-rollup-runner.md
    # AC1
    # preflight-scope: pr_review_only
    $ rg -q "name: scope-rollup-runner" .claude/agents/scope-rollup-runner.md
    # AC1
    # preflight-scope: pr_review_only
    $ rg -q "model: haiku" .claude/agents/scope-rollup-runner.md
    # AC1
    # preflight-scope: pr_review_only
    $ rg -q "maxTurns:" .claude/agents/scope-rollup-runner.md

    推奨アクション

    上記 2 点を修正後、issue-contract-review を再度実行してください。

    なお issue_kind: research かつ Allowed Paths に実装対象ファイルが含まれている点は、research テンプレートの想定範囲(読み取り専用・次 Issue 起票ゴール)と乖離しています。issue_kind: implementation への変更も検討してください。

  4. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    コントラクトスナップショット (2026-06-03T07:10:00Z)

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-06-03T07:10:00Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/611
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: n/a
        vc_preflight:
          passed: true
          vc_failed_as_expected: 8
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
          vc_expected_pass: 0
          vc_skipped: 3
          status: pass
          classifications:
            - ac: AC1
              command: "test -f .claude/agents/scope-rollup-runner.md"
              exit_code: 1
              category: file_not_found_expected
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC1
              command: "rg -q \"name: scope-rollup-runner\" .claude/agents/scope-rollup-runner.md"
              scope_class: pr_review_only
              classification: skipped
              decision: go
              verification_owner: pr-review-judge
              deferred_reason: "対象ファイル非存在時の rg は baseline fail の証拠にならない。ファイル存在後のコンテンツ検証は PR レビュー時に実施"
              runtime_verification_required: false
            - ac: AC1
              command: "rg -q \"model: haiku\" .claude/agents/scope-rollup-runner.md"
              scope_class: pr_review_only
              classification: skipped
              decision: go
              verification_owner: pr-review-judge
              deferred_reason: "同上"
              runtime_verification_required: false
            - ac: AC1
              command: "rg -q \"maxTurns:\" .claude/agents/scope-rollup-runner.md"
              scope_class: pr_review_only
              classification: skipped
              decision: go
              verification_owner: pr-review-judge
              deferred_reason: "同上"
              runtime_verification_required: false
            - ac: AC2
              command: "! rg -n \"gh issue (edit|close|comment)|...\" .claude/agents/scope-rollup-runner.md"
              exit_code: null
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC3
              command: "rg -q \"scope-rollup-runner\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC4
              command: "rg -q \"ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC4
              command: "rg -q \"invocation_id\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC5
              command: "rg -q \"mismatch|stale|採用しない|reject\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC6
              command: "rg -q \"related_coordination|proceed_with_coordination\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC7
              command: "rg -q \"scope_rollup_runner_unavailable|fallback.*runner|runner.*unavailable\" .claude/skills/impl-review-loop/steps/preparation.md"
              exit_code: 1
              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: []
    • Outcome: .claude/agents/scope-rollup-runner.md が model: haiku / permissionMode: auto で plan_issue_scope_rollup.py を実行し ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1 marker を stdout に返す専用 agent として定義され、impl-review-loop/steps/preparation.md の Step 2.5 が runner 委譲型に変更された状態
    • Acceptance Criteria: AC1〜AC7(7 件)
    • Verification Commands: baseline fail = 8、想定外 pass = 0、実行不可 = 0、skipped(pr_review_only) = 3
    • Allowed Paths:
      • .claude/agents/scope-rollup-runner.md
      • .claude/skills/impl-review-loop/steps/preparation.md
    • Worktree: .claude/worktrees/issue-611-impl-review-loop-preparation-preflight-h
    • Branch: worktree-issue-611-impl-review-loop-preparation-preflight-h
  5. changed the title [-]設計: impl-review-loop preparation の決定論的 preflight を Haiku SubAgent runner に委譲する[/-] [+]実装: impl-review-loop preparation の決定論的 preflight を Haiku SubAgent runner に委譲する[/+] on Jun 3, 2026
  6. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-06-03T07:12:45Z)

  7. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    コントラクトスナップショット v2 (2026-06-03T08:10:00Z)

    前回のスナップショット(status: go、07:10:00Z)は Issue #611 本文更新により無効化されました。本コメントが最新の有効スナップショットです。

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-06-03T08:10:00Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/611
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: n/a
        vc_preflight:
          passed: true
          vc_failed_as_expected: 10
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
          vc_expected_pass: 0
          vc_skipped: 3
          status: pass
        ac_verifiability: pass
        product_spec_check:
          applicability: not_applicable
          decision: pass
        worktree_branch_collision: clear
      next_action: implement_issue
      blocked_reasons: []
      warnings:
        - "前回スナップショット(07:10:00Z)は Issue 本文更新(marker ref-based 設計変更・AC2 enforcement 明示・sha256 仕様追加)により invalidated"
    • Outcome: .claude/agents/scope-rollup-runner.md が model: haiku / permissionMode: auto で plan_issue_scope_rollup.py を実行し ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1 marker(ref-based: raw_plan_location + result_sha256 + suggested_actions_summary)を stdout に返す専用 agent として定義され、impl-review-loop/steps/preparation.md の Step 2.5 が runner 委譲型に変更された状態
    • Acceptance Criteria: AC1〜AC7(7 件)
    • Verification Commands: baseline fail = 10、想定外 pass = 0、実行不可 = 0、skipped(pr_review_only)= 3
    • Allowed Paths:
      • .claude/agents/scope-rollup-runner.md
      • .claude/skills/impl-review-loop/steps/preparation.md
    • Worktree: .claude/worktrees/issue-611-impl-review-loop-preparation-preflight-h
    • Branch: worktree-issue-611-impl-review-loop-preparation-preflight-h

    主な変更点(前回スナップショットからの差分)

    • AC2 enforcement model を「テキスト禁止モデル」として明示(runtime hook は Out of Scope)
    • marker を ref-based 設計(raw_plan_location + result_sha256 + suggested_actions_summary)に変更
    • result_sha256 計算仕様追加(ファイルバイト列 sha256、RFC 8785 不要)
    • AC4 VC に raw_plan_location / suggested_actions_summary の確認コマンドを追加
  8. added 2 commits that reference this issue on Jun 3, 2026
  9. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    PR #625 がマージされたため本 Issue をクローズします。

  10. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-06-03T08:55:00Z)

    • status: partial
    • 次アクション: worktree-issue-572-quick-save-ssot branch(未マージ)と stash@{0} の処分を人間が判断
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: post-merge-cleanup
      follow_up_issues:
        - request_dedupe_key: "follow-up:squne121/loop-protocol:pr/625:scope-rollup-runner-bash-security"
          status: skipped_reuse_open
          issue:
            number: 558
            url: "https://github.com/squne121/loop-protocol/issues/558"
          reason: "#558(OPEN)が security gate 設計を tracking 済み。新規起票不要。"
    
      note_only_observations:
        - dedupe_key: "worktree-issue-572-quick-save-ssot-branch"
          summary: "issue-572 branch が未マージのため -d で削除不可。人間が -D または内容確認後に判断。"
        - dedupe_key: "stash-0-issue-611"
          summary: "stash@{0} は issue-611 worktree から。worktree 削除済みのため不要な可能性が高い。git stash drop stash@{0} を人間が判断。"

    実行結果

    アクション 結果
    Issue #611 クローズ ✓ 完了
    worktree issue-611 削除 ✓ 完了(--force、unstaged D は既知)
    worktree issue-572 削除 ✓ 完了(--force)
    branch issue-611 削除 ✓ 完了
    branch issue-572 削除 ✗ 未マージのため人間判断
    main sync ✓ 完了
    stash@{0} 未処理(人間判断)
  11. added a commit that references this issue on Jun 4, 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

    enhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions