Skip to content

実装: skill-invocation runtime smoke に SKILL.md 変更前テキストとの対照実行を追加し、SKILL.md を戻しても通る non-discriminative な false-green を検出する #2981

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "SKILL.md を変更する PR の skill-invocation runtime smoke が、変更前 SKILL.md では FAIL し変更後 SKILL.md では PASS することを、SKILL.md 1 ファイル以外を同一にした対照実行で決定論的に示せるようにし、SKILL.md を戻しても通る non-discriminative な false-green を検出可能にする"
change_kind: code
dedupe_key: "skill-invocation-runtime-smoke-v1:skill-text-counterfactual-control"

Parent Issue

なし(単独の再発防止)

Parent Goal Ref

  • Goal: skill-invocation runtime smoke の PASS が「候補の SKILL.md の手順文が挙動を駆動した」ことの証拠になるよう、SKILL.md text のみを treatment とする対照(counterfactual)実行で discrimination を示せるようにする。
  • Desired Destination: N/A(単独改善 Issue のため)

Current Validated Scope

発見元: #2971 / PR #2976(#2976 、head 147ad2b3b601e75e80d31def4e97f93c680ed881)の pr-reviewer warning(non-blocker、APPROVE)。

#2971 の AC8 smoke(uv run --locked pytest .claude/skills/impl-review-loop/tests/test_body_only_lane_runtime_smoke.py -m claude_live -v)は、scripts/agent-ops/run_worktree_agent_runtime_smoke.py --runtime claude --mode structured --claude-adapter native --expect-skill-command impl-review-loop --expect-ordered-marker ... を実行する。この smoke は .claude/skills/impl-review-loop/SKILL.md を変更前へ戻しても PASS(exit 0、ordered_evidence_match.verified=True)した。同一 worktree に production の dry-run CLI(body_only_repair_plan.py)が存在し、モデルが repo を探索して発見・実行したためである。marker は production 関数の実出力であり捏造ではないが、候補 SKILL.md の手順文が挙動を駆動したことは証明されない。#2971 の契約は prompt への CLI path / marker / command line の記載と Allowed Paths の拡大を禁じていたため、#2971 内では解消できなかった。対照実行の事実は PR #2976 本文の ## Runtime Verification Evidence に記録済みである。

現状 runner は --expect-ordered-marker を候補 worktree の 1 回の実行にのみ適用し、同一 prompt を変更前 SKILL.md に対して実行して FAIL を確認する経路を持たない。

OWNER の adversarial review(#2981 (comment) )が、旧 contract の対照実験が causal discrimination として閉じていない点を指摘し、現 main(50870949)の runner 実装で次を確認した。

  • verify_worktree_identity()(scripts/agent-ops/run_worktree_agent_runtime_smoke.py:343)は canonical root checkout、別 git-common-dir、.claude/worktrees/ 外の path を拒否する。plain filesystem copy は identity contract と互換ではない。
  • --require-clean-postcondition は実行前後の増分変更だけを検査し、実行前の dirty state を拒否しない。
  • runner 自身は worktree を生成しない。detached worktree の生成と git worktree remove --force による回収の既存例は scripts/agent-ops/pr_head_replay_publish_exec.py にある。
  • summary は既に ordered_evidence_match、prompt_sha256、resolved_executable_sha256、mutation_boundary.settings_digest_sha256、exit_code、errors を持つ。BASE run の valid / invalid 判定は新規 schema・registry なしに、既存 summary field の closed mapping で表現できる。

Remaining Parent Gaps

なし(単独改善 Issue のため)

Dedupe / Ownership

起票前に全 state の dedupe 検索(skill-invocation runtime smoke の discrimination / revert false-green / negative control / control run、および dedupe_key)を実施し、本 Outcome を所有する既存 Issue / PR は無いことを確認済み。以下の既存 OPEN Issue とは責務が異なり、重複させない。

Outcome

scripts/agent-ops/run_worktree_agent_runtime_smoke.py(runner)に、対象 SKILL.md 1 ファイルの変更前(BASE)テキストだけを treatment とする opt-in の skill_text_counterfactual モードが追加される。候補 arm と BASE arm は同一の captured candidate commit から runner が作る detached・clean な ephemeral linked worktree で実行され、BASE arm だけが対象 SKILL.md の blob を BASE 版に差し替える。判定は次の closed mapping に従い、summary と exit code に機械可読で記録される。

  • 候補 PASS、BASE control valid、BASE の ordered assertion のみ不成立 → discriminative(PASS)
  • 候補 PASS、BASE control valid、BASE も ordered assertion 成立 → non_discriminative(非 PASS)
  • 候補 PASS、BASE control invalid(timeout・terminal event 欠落・Skill invocation 未観測・permission/runtime error・postcondition failure・SKIP 等)→ control_invalid(非 PASS)
  • 候補 FAIL → 既存どおり FAIL

変更は runner、.claude/skills/worktree-agent-runtime-smoke/SKILL.md、docs/dev/runtime-verification-policy.md の手順追記、synthetic fixture による決定論 test、および実 CLI の live test(discriminative positive と non_discriminative negative の 2 ケース)で完結する。

Runtime Verification Applicability

decision: immediate
reason: runner が実 Claude Code の structured 実行を 2 回(候補 arm / BASE arm)行い、その差で discrimination を判定するため、synthetic fixture だけでは実 runtime での discriminative 成立と、元の false-green 類型(BASE でも ordered marker が成立する non_discriminative)の検出を証明できない。
applicable_acs: [AC9]
execution_environment: current installed/resolved Claude Code CLI(実行時 version を記録)、認証済み CLI と必要な network/capability、worktree-local の `scripts/agent-ops/run_worktree_agent_runtime_smoke.py --runtime claude --mode structured --claude-adapter native`。
skip_conditions: CLI 不在・auth / network 不可の場合、live test は stdout 先頭 `SKIP:` と exit 77(`pytest.exit(..., returncode=77)`)を使い、`pytest.skip` は使わない。SKIP / unverified は PASS ではなく Stop Condition とする。
fallback_policy: degraded / marker-only / BASE 実行不能 / control_invalid / 対照 worktree 構築失敗 / cleanup 失敗は FAIL(非 0 exit)であり PASS に昇格しない。
artifact_requirements: worktree-local `artifacts/runtime-verification-AC9-<UTC timestamp>.log`(AC / Timestamp / Environment: Claude Code version / Input: secret masked / Output: bounded / Verdict: Result・Exit Code・Reason)。runner の summary に requested base ref、resolved base commit SHA、candidate HEAD、candidate / BASE の対象 SKILL.md blob hash、両 arm の ordered_evidence_match を束縛し、redacted な要約を PR の `## Runtime Verification Evidence` に引用する。main へ証跡を commit しない。
runtime_assertion_bindings:
  - profile: skill-invocation-runtime-smoke
    assertion: procedure_steps_executed_in_declared_order
    ac: AC9
    disposition: dispositive
  - profile: skill-invocation-runtime-smoke
    assertion: output_contract_schema_fields_present
    disposition: not_applicable
    reason: "出力 schema の field 集合を変更せず、対照実行の判定のみを追加する"
  - profile: subagent-lifecycle-causal-evidence-smoke
    assertion: subagent_start_stop_causal_evidence_correlated
    disposition: not_applicable
    reason: "対照モードは opt-in であり、SubagentStart / SubagentStop の causal evidence 収集・相関ロジックと、既存フラグ省略時の summary を変更しない"

In Scope

  • runner に opt-in の skill_text_counterfactual モードを追加する。caller は BASE の ref と、treatment とする対象 SKILL.md 1 ファイルの repo-relative path を明示入力する。省略時は既存 caller の argv・挙動・exit code・summary を一切変えない。
  • preflight で、requested BASE ref を git rev-parse --verify --end-of-options <ref>^{commit} 相当で immutable な commit SHA へ一度だけ resolve して pin する。以降の BASE blob 取得はこの SHA のみを使い、ref を再解決しない。
  • 対照モードは candidate worktree が clean(git status --porcelain が空)で committed な場合に限り実行する。runner は candidate HEAD の commit SHA を capture し、候補 arm と BASE arm の両方を、その SHA を --detach で checkout した runner-owned ephemeral linked worktree(.claude/worktrees/ 配下の high-entropy な名前。既存 verify_worktree_identity() を満たす)で実行する。plain filesystem copy は使わない。
  • 両 arm は同一 prompt(prompt_sha256 一致)、同一 --expect-skill-command、同一 --expect-ordered-marker、同一 runtime executable / settings で実行する。BASE arm だけが対象 SKILL.md の working tree content を、pin した BASE commit の blob に差し替える。それ以外の file は両 arm で同一である。
  • treatment は指定した SKILL.md 1 ファイルに固定する。複数 path・SKILL.md 以外の path・同一 skill 配下の追加 path は受け付けない。candidate と BASE の blob が同一で treatment 差が無い場合は fail-closed とする。
  • 判定は既存の evaluate_ordered_evidence_match() の literal 順序一致と既存 summary field のみで行い、SKILL.md の意味解釈や LLM による semantic parsing は行わない。BASE arm を valid な negative control と扱う条件は、BASE の process が timeout せず完了し、terminal event を観測し、--expect-skill-command の Skill invocation を観測し、permission / runtime error が無く、clean postcondition が成立し、かつ ordered assertion のみが不成立であることとする。
  • runner が作った control worktree(候補 arm・BASE arm)は finally で回収する。回収対象は runner が生成して記録した exact path のみとし、foreign worktree には触れない。cleanup 失敗は summary に明示し、discriminative PASS にしない。summary と evidence は ephemeral worktree の外(caller 指定の output dir)に保存する。
  • .claude/skills/worktree-agent-runtime-smoke/SKILL.md に対照モードの使い方・判定表・限界(対象 SKILL.md 以外の repo 内 production script は BASE に戻らないため、それで marker に到達できる場合は non_discriminative になり得る。treatment を複数 path へ広げた結果は skill_text_counterfactual の根拠にしない)を追記する。
  • docs/dev/runtime-verification-policy.md に、skill-invocation smoke の対照実行を任意の discrimination 証跡として扱う手順を追記する(既存 profile の assertion 集合と適用要否は変更しない)。
  • synthetic fixture による決定論 test を新規追加する(実 CLI を呼ばない)。arm の実行結果は注入可能な関数境界で差し替える。
  • 【OWNER 承認済みの限定的例外】.claude/skills/impl-review-loop/tests/test_body_only_lane_runtime_smoke.py の feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971) #2976 由来の旧 tripwire test(test_ac8_the_real_runner_currently_exposes_no_counterfactual_option_so_the_live_smoke_cannot_pass)の obsolete assertion(runner に counterfactual option が無いこと)だけを、runner の documented counterfactual flag が存在する現状へ合わせて修正し、必要な hermetic regression を追加・更新する。BASE 対照が未配線の間は SKIP: + exit 77 の fail-closed を維持し、option の存在を BASE discrimination の成立と混同しない。test の削除・skip 化・xfail 化・assertion 無効化はしない。
  • 実 CLI の live test を @pytest.mark.claude_live で 2 ケース追加する(通常 CI では deselect)。positive ケースは、テキストのみで marker が決まる最小 fixture skill で BASE arm が valid control かつ ordered marker 不成立、候補 arm が成立する。negative ケースは、BASE テキストでも ordered marker が成立する fixture(候補と BASE で手順文が同一で非挙動 text のみ異なる)で、実 run の結果から runner 全体が non_discriminative かつ非 0 exit になる。

Out of Scope

Acceptance Criteria

  • AC1: 対照モードのフラグを省略した場合、runner の既存 argv 解析・summary・exit code が変わらない。既存 runner test 群が全て PASS する。
  • AC2: synthetic fixture で、候補 PASS、BASE control valid、BASE の ordered assertion のみ不成立の場合に判定が discriminative(PASS、exit 0)となり、summary に requested base ref、resolved base commit SHA、candidate HEAD、candidate / BASE の対象 SKILL.md blob hash、両 arm の ordered_evidence_match 結果、同一 prompt_sha256 が機械可読で記録される。
  • AC3: synthetic fixture で、候補 PASS、BASE control valid、BASE も ordered assertion 成立の場合に判定が non_discriminative となり、非 PASS(非 0 exit)で理由が summary に記録される。候補 FAIL の場合は既存どおり FAIL となり discriminative にならない。
  • AC4: synthetic fixture で、BASE arm が timeout、terminal event 欠落、Skill invocation 未観測、permission / runtime error、clean postcondition failure、SKIP のいずれかである場合は、ordered_evidence_match.verified == false であっても control_invalid となり、非 0 exit で discriminative にならない。
  • AC5: BASE ref の resolve 失敗、対象 path が candidate または BASE commit に存在しない、対象が SKILL.md 1 ファイルでない(複数 path・SKILL.md 以外)、candidate worktree が dirty、candidate と BASE の blob が同一、control worktree の構築失敗、BASE arm の実行不能のいずれの場合も fail-closed(非 0 exit)となり、PASS に昇格しない。
  • AC6: BASE ref は preflight で一度だけ commit SHA に resolve され、以降 ref が移動しても BASE blob と summary の identity が変わらない。候補 arm と BASE arm は同一 candidate commit の detached・clean な worktree で実行され、BASE arm と候補 arm の差が対象 SKILL.md 1 ファイルの content のみであり、元の candidate worktree の git status --porcelain と HEAD が対照実行の前後で不変であることを test で固定する。
  • AC7: runner が生成した control worktree は成功・失敗の全経路で回収され、foreign worktree(runner が生成していないもの)には触れない。回収に失敗した場合は summary に cleanup 失敗と残存 path を明示し、判定が discriminative であっても全体を非 PASS(非 0 exit)にする。
  • AC8: .claude/skills/worktree-agent-runtime-smoke/SKILL.md と docs/dev/runtime-verification-policy.md が対照モードの判定表(discriminative / non_discriminative / control_invalid / 候補 FAIL)と限界(対象 SKILL.md 以外の production script は BASE に戻らず、それで marker に到達できる場合は non_discriminative になり得る。treatment を SKILL.md 1 ファイルに限定する)を記述している。
  • AC9: current installed Claude Code 上の実 structured run で、(a) positive ケース: テキストのみで marker が決まる最小 fixture skill について BASE arm は valid control かつ期待 ordered marker を得られず、候補 arm は得られる(判定 discriminative、exit 0)。(b) negative ケース: BASE テキストでも ordered marker が得られる fixture について、runner 全体が non_discriminative かつ非 0 exit になる。Claude Code version と両 arm の run identity を証跡に記録する。

Verification Commands

# AC1
$ uv run --locked pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke.py scripts/agent-ops/tests/test_skill_invocation_runtime_smoke_profile.py -q

# AC2
$ uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k discriminative -q

# AC3
$ uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k non_discriminative -q

# AC4
$ uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k control_invalid -q

# AC5
$ uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k fail_closed -q

# AC6
$ uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k isolation -q

# AC7
$ uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k cleanup -q

# AC8
$ uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k docs_contract -q

# AC9
# preflight-scope: runtime_only
$ uv run --locked pytest -q -s -m claude_live scripts/agent-ops/tests/test_skill_text_counterfactual_control_live.py

Allowed Paths

  • scripts/agent-ops/run_worktree_agent_runtime_smoke.py
  • scripts/agent-ops/tests/test_skill_text_counterfactual_control.py
  • scripts/agent-ops/tests/test_skill_text_counterfactual_control_live.py
  • scripts/agent-ops/tests/fixtures/skill_text_counterfactual_control/**
  • .claude/skills/impl-review-loop/tests/test_body_only_lane_runtime_smoke.py
  • .claude/skills/worktree-agent-runtime-smoke/SKILL.md
  • docs/dev/runtime-verification-policy.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合(.claude/skills/impl-review-loop/tests/test_body_only_lane_runtime_smoke.py は旧 tripwire 期待値修正に限定して許可済み。それ以外の同ファイル変更や feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971) #2976 AC8 を PASS にする変更は停止対象)
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • 判定に SKILL.md の意味解釈や LLM による semantic parsing、または generic harness・新規 registry / ledger の新設が必要になった場合
  • treatment を SKILL.md 1 ファイル以外へ広げる必要がある場合、または candidate / BASE を同一 commit 由来の detached・clean な linked worktree 以外(plain copy 等)で実行する必要がある場合
  • foreign worktree への操作、または runner が生成していない worktree の回収が必要になった場合
  • extension-surface-runtime-policy.yaml の profile / assertion 定義の変更が必要となり、再発防止: skill-invocation-runtime-smoke の assertion applicability を明示化する #2775 の所有範囲と衝突する場合
  • real runtime VC が環境不可で SKIP(stdout SKIP:、exit 77)を返す、または evidence が unverified の場合。SKIP / 未検証は PASS ではなく owner 判断へ送る
  • degraded / fallback / BASE 実行不能 / control_invalid の経路でのみ成功する場合は FAIL として停止する

Required Skills

  • なし

Required Design References

  • docs/dev/runtime-verification-policy.md
  • docs/dev/extension-surface-runtime-policy.yaml
  • .claude/skills/worktree-agent-runtime-smoke/SKILL.md

Scope Delta

Delivery Rule

  • 1 Issue = 1 PR
  • Draft PR を既定とする
  • worktree を使用する
  • merge / auto-merge は別途人間判断

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Oct 7, 2026
  2. squne121 commented on Oct 7, 2026

    @squne121
    OwnerAuthor

    2026-10-07 21:51 JST 時点で、Issue #2981、#2971、PR #2976 の本文・コメント、#2775 / #2944 / #2874、current main の runtime-smoke runner / Skill / runtime policy / worktree 関連実装を確認しました。#2981 自体にはまだコメントがなく、専用の実装PRも見つかっていません。

    結論は 方向性は妥当だが、現 contract のまま implementation-ready にはしない方がよい です。特に High が4件あります。Anthropic の current 公式ドキュメント自身も、Skill 評価では「fresh session で skill 有効/無効の baseline comparison」を推奨し、version A/B も評価手法として扱っています。したがって counterfactual 自体は妥当です。問題は、#2981 の現在の対照実験が causal discrimination としてまだ閉じていない点です。Claude Code

    1. [High] 元の false-green を real runtime regression で固定していません。 発見元 PR feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971) #2976 で実際に起きた failure class は「candidate が PASS した」ことではなく、SKILL.md を変更前へ戻した BASE も、Claude が repo 内の production CLI を自力発見して PASS したことです。PR #2976 現 AC3 は candidate PASS + BASE PASS を synthetic injection でしか検証せず、AC7 の live test は逆に candidate PASS + BASE FAIL の成功例だけです。これだと BASE の実 Claude 起動、prompt forwarding、summary aggregation、exit mapping のどこかが壊れても、incident class を再発させたまま AC7 が green になり得ます。最小修正は AC7 を live 2 ケースにすることです。live_discriminative_positive は現状どおり candidate PASS / BASE FAIL、もう1つ live_non_discriminative_negative で candidate PASS / BASE PASS を実際に起こし、runner 全体が non_discriminative / non-zero になることを要求してください。通常CIは引き続き claude_live deselect でよく、恒久gate化は不要です。

    2. [High] 「BASE FAIL」の failure taxonomy が広すぎ、別原因の失敗を discriminative と誤認できます。 現 contract は「candidate PASS + BASE FAIL = discriminative PASS」と定義し、AC4 は「BASE 実行不能」を fail-closed にしています。しかし BASE が起動はしたものの、timeout、terminal event 欠落、Skill command 非観測、permission/runtime error、postcondition failure などで exit 1 になった場合を閉じていません。この実装を単純な exit-code comparison にすると、その種の故障まで「candidate SKILL.md が効いた証拠」に昇格します。最小修正は discriminative を candidate overall PASS && base_control_valid && base.ordered_evidence_match.verified == false に限定することです。BASE の process/runtime/Skill invocation が正常で、失敗理由が目的 assertion の ordered-marker 不一致だけの場合に限り negative control 成立。それ以外は control_invalid / FAIL にしてください。新しい汎用 failure framework は不要で、既存 summary fields の closed mapping で十分です。

    3. [High] candidate と BASE が「SKILL.md 以外同一」という対照実験になっていません。 現 In Scope は candidate を既存 issue worktree で走らせ、BASE は「一時 worktree またはコピー」としています。しかし current runner の verify_worktree_identity() は canonical root、別 git-common-dir、.claude/worktrees/ 外を拒否するため、単なる filesystem copy は現在の identity contract と互換ではありません。また --require-clean-postcondition は「実行前後で増分変更なし」を見るだけで、実行前の dirty state を禁止しません。したがって candidate に uncommitted fixture/script があり、BASE を candidate HEAD から新規作成すれば、SKILL.md 以外も違います。branch vs detached、dirty state、artifact/path も Claude が観測可能です。feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971) #2976 の事故そのものが「Claude が repo を探索する」ことを示しているので、この confound は無視できません。公式 Claude Code も baseline は fresh session で比較することを推奨し、Git 自身も testing 用には detached throwaway worktree を正式な用途として説明しています。Claude Code 推奨は plain copy を削除し、candidate/BASE の両方を同じ captured candidate commit 由来の runner-owned ephemeral linked worktree で実行することです。両方 detached・clean、同一 prompt SHA、同一 runtime executable SHA/settings とし、BASE 側だけ control blob を変える。これが重過ぎるなら、少なくとも counterfactual mode を clean committed candidate 限定にし、causal「証明」ではなく heuristic evidence と明記すべきです。

    4. [High] 「追加 control path」を許すと、SKILL.md text の因果性を証明できません。 In Scope は caller が「同一 skill 配下の追加 path」も BASE に戻せるとしています。この状態で candidate PASS / BASE FAIL になっても、効いたのが SKILL.md なのか追加した reference/script なのか分離不能です。Issue title / Outcome は明確に SKILL.md 変更前テキストとの discrimination を主張しているため、契約と証拠の意味がずれています。最小修正は 実装: skill-invocation runtime smoke に SKILL.md 変更前テキストとの対照実行を追加し、SKILL.md を戻しても通る non-discriminative な false-green を検出する #2981 の skill_text_counterfactual では treatment を指定 SKILL.md 1ファイルだけに固定することです。追加pathを将来残すなら、結果名を control_path_set_discriminative に変え、その結果から「SKILL.md text が causal」と主張しないようにしてください。feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971) #2976 の実事故を捕まえるだけなら SKILL.md-only で十分です。

    5. [Medium] BASE ref が movable ref のままで、evidence identity が再現可能な commit に pin されていません。 AC2 は summary に「ref / path」、AC5 は git show <ref>:<path> 相当を要求していますが、main や origin/main は実行途中にも動き得ます。Git の ref は branch/tag 等の symbolic name であり、git rev-parse --verify --end-of-options <ref>^{commit} で具体的 commit object に解決できます。Git preflight で一度だけ requested_base_ref → resolved_base_commit_sha に固定し、その SHA だけで全 blob を取得してください。summary には requested ref、resolved commit SHA、candidate HEAD、candidate/base SKILL blob hash を残すのが十分です。新schemaやregistryは不要です。

    6. [Medium] runner-owned control worktree の cleanup 契約がありません。 AC4 は「構築失敗」を扱いますが、成功/失敗後の removal を要求していません。Git は untracked/modified file がある worktree を通常の worktree remove では消せず、--force が必要です。Git current repo にも .claude/worktrees/ 内で detached temporary worktree を生成する実装例があります。一方、対照runは summary/artifact を残すので cleanup 漏れは実用上すぐ residue 化します。runner が作った high-entropy path だけを finally で回収し、foreign worktree には触らない契約を追加すれば十分です。cleanup failure は少なくとも summary に明示し、discriminative PASS にはしないのが妥当です。global GC、lock daemon、registry は不要です。

    推奨する判定表

    Candidate | BASE runtime/control | BASE ordered assertion | 最終判定 -- | -- | -- | -- PASS | valid | FAIL | discriminative / PASS PASS | valid | PASS | non_discriminative / FAIL PASS | invalid / timeout / SKIP / unrelated failure | 不問 | control_invalid / FAIL FAIL | 不問 | 不問 | candidate の既存 FAIL PASS | BASE ref/path/build unavailable | 不問 | FAIL

    この形なら「negative control が失敗したから成功」ではなく、「正常に成立した negative-control run が、狙った assertion だけを満たさなかった」ことを要求できます。

    関連Issueの ownership 分離自体は適切です。#2775 は assertion applicability、#2944 は prompt-echo/source-scoping、#2874 は ordered-marker と causal provenance の接続で、#2981 の counterfactual discrimination と重複していません。また、current Claude Code では SKILL.md が実行時の instructions として conversation に入り、Skill は prompt-based で tools を使って作業を orchestrate します。つまり #2976 の「Skill 文面を外しても repo 探索で答えへ到達できる」という問題設定は upstream semantics と整合します。Claude Code structured runner が使っている -p / stream-json / --no-session-persistence も current 公式CLI契約に沿っています。Claude Code

    判定: refinement required / REQUEST_CHANGES 相当。 とくに 1〜4 を Issue contract に入れてから実装へ進めることを推奨します。これらは security/harness hardening ではなく、#2981 が主張する「candidate SKILL.md change が必要だった」という証拠自体の validity を守る修正です。追加の approval layer や generic evaluator は要りません。

    2026-10-07 21:51 JST 時点で、[[Issue #2981](https://github.com//issues/2981?utm_source=chatgpt.com)](https://github.com//issues/2981?utm_source=chatgpt.com)、#2971、PR #2976 の本文・コメント、#2775 / #2944 / #2874、current `main` の runtime-smoke runner / Skill / runtime policy / worktree 関連実装を確認しました。#2981 自体にはまだコメントがなく、専用の実装PRも見つかっていません。

    結論は 方向性は妥当だが、現 contract のまま implementation-ready にはしない方がよい です。特に High が4件あります。Anthropic の current 公式ドキュメント自身も、Skill 評価では「fresh session で skill 有効/無効の baseline comparison」を推奨し、version A/B も評価手法として扱っています。したがって counterfactual 自体は妥当です。問題は、#2981 の現在の対照実験が causal discrimination としてまだ閉じていない点です。[Claude Code](https://code.claude.com/docs/en/skills)

    1. [High] 元の false-green を real runtime regression で固定していません。 発見元 PR feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971) #2976 で実際に起きた failure class は「candidate が PASS した」ことではなく、SKILL.md を変更前へ戻した BASE も、Claude が repo 内の production CLI を自力発見して PASS したことです。[PR #2976](https://github.com/squne121/loop-protocol/pull/2976?utm_source=chatgpt.com) 現 AC3 は candidate PASS + BASE PASS を synthetic injection でしか検証せず、AC7 の live test は逆に candidate PASS + BASE FAIL の成功例だけです。これだと BASE の実 Claude 起動、prompt forwarding、summary aggregation、exit mapping のどこかが壊れても、incident class を再発させたまま AC7 が green になり得ます。最小修正は AC7 を live 2 ケースにすることです。live_discriminative_positive は現状どおり candidate PASS / BASE FAIL、もう1つ live_non_discriminative_negative で candidate PASS / BASE PASS を実際に起こし、runner 全体が non_discriminative / non-zero になることを要求してください。通常CIは引き続き claude_live deselect でよく、恒久gate化は不要です。

    2. [High] 「BASE FAIL」の failure taxonomy が広すぎ、別原因の失敗を discriminative と誤認できます。 現 contract は「candidate PASS + BASE FAIL = discriminative PASS」と定義し、AC4 は「BASE 実行不能」を fail-closed にしています。しかし BASE が起動はしたものの、timeout、terminal event 欠落、Skill command 非観測、permission/runtime error、postcondition failure などで exit 1 になった場合を閉じていません。この実装を単純な exit-code comparison にすると、その種の故障まで「candidate SKILL.md が効いた証拠」に昇格します。最小修正は discriminative を candidate overall PASS && base_control_valid && base.ordered_evidence_match.verified == false に限定することです。BASE の process/runtime/Skill invocation が正常で、失敗理由が目的 assertion の ordered-marker 不一致だけの場合に限り negative control 成立。それ以外は control_invalid / FAIL にしてください。新しい汎用 failure framework は不要で、既存 summary fields の closed mapping で十分です。

    3. [High] candidate と BASE が「SKILL.md 以外同一」という対照実験になっていません。 現 In Scope は candidate を既存 issue worktree で走らせ、BASE は「一時 worktree またはコピー」としています。しかし current runner の verify_worktree_identity() は canonical root、別 git-common-dir、.claude/worktrees/ 外を拒否するため、単なる filesystem copy は現在の identity contract と互換ではありません。また --require-clean-postcondition は「実行前後で増分変更なし」を見るだけで、実行前の dirty state を禁止しません。したがって candidate に uncommitted fixture/script があり、BASE を candidate HEAD から新規作成すれば、SKILL.md 以外も違います。branch vs detached、dirty state、artifact/path も Claude が観測可能です。feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971) #2976 の事故そのものが「Claude が repo を探索する」ことを示しているので、この confound は無視できません。公式 Claude Code も baseline は fresh session で比較することを推奨し、Git 自身も testing 用には detached throwaway worktree を正式な用途として説明しています。Claude Code 推奨は plain copy を削除し、candidate/BASE の両方を同じ captured candidate commit 由来の runner-owned ephemeral linked worktree で実行することです。両方 detached・clean、同一 prompt SHA、同一 runtime executable SHA/settings とし、BASE 側だけ control blob を変える。これが重過ぎるなら、少なくとも counterfactual mode を clean committed candidate 限定にし、causal「証明」ではなく heuristic evidence と明記すべきです。

    4. [High] 「追加 control path」を許すと、SKILL.md text の因果性を証明できません。 In Scope は caller が「同一 skill 配下の追加 path」も BASE に戻せるとしています。この状態で candidate PASS / BASE FAIL になっても、効いたのが SKILL.md なのか追加した reference/script なのか分離不能です。Issue title / Outcome は明確に SKILL.md 変更前テキストとの discrimination を主張しているため、契約と証拠の意味がずれています。最小修正は 実装: skill-invocation runtime smoke に SKILL.md 変更前テキストとの対照実行を追加し、SKILL.md を戻しても通る non-discriminative な false-green を検出する #2981 の skill_text_counterfactual では treatment を指定 SKILL.md 1ファイルだけに固定することです。追加pathを将来残すなら、結果名を control_path_set_discriminative に変え、その結果から「SKILL.md text が causal」と主張しないようにしてください。feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971) #2976 の実事故を捕まえるだけなら SKILL.md-only で十分です。

    5. [Medium] BASE ref が movable ref のままで、evidence identity が再現可能な commit に pin されていません。 AC2 は summary に「ref / path」、AC5 は git show <ref>:<path> 相当を要求していますが、main や origin/main は実行途中にも動き得ます。Git の ref は branch/tag 等の symbolic name であり、git rev-parse --verify --end-of-options <ref>^{commit} で具体的 commit object に解決できます。Git preflight で一度だけ requested_base_ref → resolved_base_commit_sha に固定し、その SHA だけで全 blob を取得してください。summary には requested ref、resolved commit SHA、candidate HEAD、candidate/base SKILL blob hash を残すのが十分です。新schemaやregistryは不要です。

    6. [Medium] runner-owned control worktree の cleanup 契約がありません。 AC4 は「構築失敗」を扱いますが、成功/失敗後の removal を要求していません。Git は untracked/modified file がある worktree を通常の worktree remove では消せず、--force が必要です。Git current repo にも .claude/worktrees/ 内で detached temporary worktree を生成する実装例があります。一方、対照runは summary/artifact を残すので cleanup 漏れは実用上すぐ residue 化します。runner が作った high-entropy path だけを finally で回収し、foreign worktree には触らない契約を追加すれば十分です。cleanup failure は少なくとも summary に明示し、discriminative PASS にはしないのが妥当です。global GC、lock daemon、registry は不要です。

    推奨する判定表

    Candidate BASE runtime/control BASE ordered assertion 最終判定
    PASS valid FAIL discriminative / PASS
    PASS valid PASS non_discriminative / FAIL
    PASS invalid / timeout / SKIP / unrelated failure 不問 control_invalid / FAIL
    FAIL 不問 不問 candidate の既存 FAIL
    PASS BASE ref/path/build unavailable 不問 FAIL

    この形なら「negative control が失敗したから成功」ではなく、「正常に成立した negative-control run が、狙った assertion だけを満たさなかった」ことを要求できます。

    関連Issueの ownership 分離自体は適切です。#2775 は assertion applicability、#2944 は prompt-echo/source-scoping、#2874 は ordered-marker と causal provenance の接続で、#2981 の counterfactual discrimination と重複していません。また、current Claude Code では SKILL.md が実行時の instructions として conversation に入り、Skill は prompt-based で tools を使って作業を orchestrate します。つまり #2976 の「Skill 文面を外しても repo 探索で答えへ到達できる」という問題設定は upstream semantics と整合します。[Claude Code](https://code.claude.com/docs/en/skills) structured runner が使っている -p / stream-json / --no-session-persistence も current 公式CLI契約に沿っています。Claude Code

    判定: refinement required / REQUEST_CHANGES 相当。 とくに 1〜4 を Issue contract に入れてから実装へ進めることを推奨します。これらは security/harness hardening ではなく、#2981 が主張する「candidate SKILL.md change が必要だった」という証拠自体の validity を守る修正です。追加の approval layer や generic evaluator は要りません。

  3. squne121 commented on Oct 7, 2026

    @squne121
    OwnerAuthor

    GitHub live stateを確認しました。#2981 の対象コメントは OWNER 投稿で、現 contract に対して refinement required / REQUEST_CHANGES 相当、High 4件+Medium 2件を提示しています。また current issue-refinement-loop では canonical Step 2 は issue-reviewer SubAgent を使わず、root-owned review pipeline を background 起動して完了結果をjoinしてから routing する契約です。専用の #2981 実装PRは現時点では見当たりません。

    以下を、そのまま既に auto mode で起動済みの fresh 対話的 Claude Code に貼り付けてください。

    repo: squne121/loop-protocol

    対象:

    この対話は fresh Claude Code session で、auto mode は既に有効です。既存 session をそのまま継続してください。Claude Code の permission mode、hooks、bypassPermissions、--dangerously-skip-permissions 等は変更しないでください。

    実行指示

    Issue #2981 に対して、current HEAD の .claude/skills/issue-refinement-loop/SKILL.md を正本として issue-refinement-loop を最後まで実行してください。

    最初に repository / GitHub の live state を fresh に取得し、過去セッションの状態・過去のSkill contract・このprompt作成時点のSHAを正本として再利用しないでください。

    今回の invocation では、対象 OWNER comment

    https://github.com/squne121/loop-protocol/issues/2981#issuecomment-6038533193

    を operator-selected human context / anchor comment として扱ってください。URLだけから origin を推測せず、GitHub上の author / author_association / issue binding をfreshに検証したうえで、current Skill が規定する with_human_context lane を使用してください。

    明示的な人間承認

    このユーザーメッセージを、今回の refinement invocation に対する新しい明示的人間指示・承認として扱ってください。

    以下を明示的に承認します。

    1. Issue 実装: skill-invocation runtime smoke に SKILL.md 変更前テキストとの対照実行を追加し、SKILL.md を戻しても通る non-discriminative な false-green を検出する #2981 の調査・contract refinement・Issue本文更新・review/rewrite iterationを、current issue-refinement-loop の上限内で追加の iteration ごとの人間承認なしに実行すること。
    2. 対象 OWNER comment の adversarial review findings を fresh repository / upstream evidence と照合し、成立する finding を Issue contract に反映すること。
    3. 特に、fresh evidence が反証しない限り、対象コメントの High 1〜4 を implementation-ready にするための必須修正候補として扱うこと:
      • 元の false-green failure class を real runtime regression で固定する live_non_discriminative_negative 相当の live case
      • candidate PASS + 任意の BASE FAIL ではなく、BASE runtime/control が正常かつ狙った ordered assertion だけが不成立の場合に限定した discrimination 判定
      • candidate / BASE を同じ captured candidate commit 由来の clean / detached / runner-owned ephemeral linked worktree 等で比較し、SKILL.md以外のconfoundを除くこと
      • skill_text_counterfactual の treatment を対象 SKILL.md 1ファイルに限定し、追加control pathの差を「SKILL.md text causal」と誤認しないこと
    4. 対象コメントの Medium 5〜6 も fresh evidence が支持するなら同じ Issue の contract に反映すること:
      • requested BASE ref を preflight で immutable commit SHA に一度だけresolveしてpinする
      • runner-owned control worktree の bounded cleanup、foreign worktree非干渉、cleanup failureをPASSにしない契約
    5. 上記を反映するために必要な Outcome / In Scope / Acceptance Criteria / Verification Commands / Runtime Verification Applicability / Stop Conditions / Allowed Paths 等の整合的な書き換えを行うこと。
    6. current canonical path が deterministic contract update を選ぶならそれを使用し、full rewrite が必要なら current Skill の issue_editor_required / issue-editor route を使用すること。
    7. Issue本文 mutation、comment publish、follow-up materialization は必ず current repository が指定する controlled mutation route を使用すること。raw GitHub mutation commandでcanonical guardを迂回しないこと。
    8. refinement loopの通常の needs-fix、deterministic repair、rewrite、fresh review は自動継続すること。
    9. distinct な再発性 defect / workflow defect が新たに確認され、実装: skill-invocation runtime smoke に SKILL.md 変更前テキストとの対照実行を追加し、SKILL.md を戻しても通る non-discriminative な false-green を検出する #2981 の Outcome に押し込むべきでない場合は、既存 OPEN/CLOSED Issue・PR・dedupe_key を先に検索し、既存ownerがなければ再発防止のGitHub Issueを起票すること。単に 実装: skill-invocation runtime smoke に SKILL.md 変更前テキストとの対照実行を追加し、SKILL.md を戻しても通る non-discriminative な false-green を検出する #2981 の High/Medium findings を別Issueへ逃がしてはいけません。
    10. follow-up Issue 起票が必要な場合は current issue-refinement-loop の materialization contract と issue-creator SubAgent を使い、SubAgentの完了結果を取得してから後続処理へ進むこと。重複Issueは作らないこと。

    ただし、この承認は deterministic guard / evidence-integrity gate / repository contract を無視する承認ではありません。human_judgment_required、environment/integrity failure、irreconcilable scope conflict 等が canonical authority から本当に返された場合に、その判定を捏造して proceed に変換してはいけません。本promptで既に判断済みの事項についてだけ、同じ承認を再質問しないでください。

    最初に fresh 確認するもの

    少なくとも以下を確認してください。

    対象コメントに外部仕様claimがあり planner が web research を required と判断した場合は、current Skillどおり web-researcher を使用してください。公式一次資料を優先してください。

    SubAgent運用

    current Skillが要求・許可するSubAgentを使用してください。

    特に:

    • Step 1 の repository investigation は current contractに従って codebase-investigator を使う。
    • Step 1b が required なら web-researcher を使う。
    • Issue rewrite route では issue-editor を使う。
    • distinct follow-up Issue materialization が必要なら issue-creator を使う。

    各SubAgentには、親会話の暗黙contextに依存させず、最低限以下を明示してください。

    • task / purpose
    • target Issue / comment / paths
    • authority
    • constraints
    • evidence requirements
    • expected structured output

    SubAgentをdispatchしただけで完了扱いにしないでください。必ず実際のterminal completionと最終resultを取得・検証してから後続phaseへ進んでください。

    独立な Step 1 / Step 1b は current Skill が許す場合のみ並列化して構いませんが、両方の結果を Step 2 前に必ずjoinしてください。

    canonical Step 2について重要

    current issue-refinement-loop が規定するとおり、canonical Step 2 のために issue-reviewer SubAgentを独自に起動してはいけません。

    run_root_review_pipeline.py produce の current canonical routeを使用し、Skillが要求している場合は明示的 background execution とし、background起動を完了扱いせず、task completion notification / completed JSON resultを必ずjoinしてから canonical_step2_route をconsumeしてください。

    status / verdict / next_action から proseで独自routingを再実装しないでください。

    refinementで確認すべき中心論点

    対象コメントをblindlyコピーせず、fresh evidenceで以下を検証してください。

    A. live regression coverage

    #2976 の実failure classは、candidateがPASSしただけでなく「旧SKILL.mdでもClaudeがproduction CLIを探索してBASE PASSした」ことです。

    したがって、synthetic candidate PASS / BASE PASS だけでなく、実Claude runtimeで同じ non-discriminative classを成立させ、runner全体が non_discriminative / non-zero になるnegative live caseがIssue contractに必要かを確認してください。

    恒久CI gate化や通常CIでのlive実行必須化は目的ではありません。個人趣味開発なので、必要な証拠を得る最小の claude_live testを優先してください。

    B. valid negative control

    BASE exit != 0 を一括で discriminative としてはいけません。

    timeout、permission/runtime failure、terminal event欠落、Skill invocation未成立、control worktree構築失敗、SKIP、postcondition failure等と、正常なBASE runで目的ordered assertionだけが不成立なケースを区別できる最小のclosed mappingを検討してください。

    generic failure framework / 新規registry / approval layerを増やさず、既存summary fieldで閉じられるならそれを優先してください。

    C. experiment isolation

    candidateとBASEで観測可能な差が treatment以外に存在しないか確認してください。

    対象コメントが推奨する

    • same captured candidate commit
    • clean
    • detached
    • fresh session
    • same prompt identity
    • same runtime executable/settings
    • BASE側だけ対象SKILL.md blobを変更

    が current runner/worktree contract と整合するか、current repository実装から確認してください。

    plain filesystem copyを現runner identity contractが受理しないなら、Issue contractから曖昧な「worktreeまたはcopy」を残さないでください。

    D. treatment ownership

    #2981 が主張するのは SKILL.md text の discrimination です。

    追加control pathまでBASEへ戻した結果を SKILL.md text causal の証拠として扱わないでください。別path setをtreatmentにする一般化が必要なら、それは別Outcomeか別結果名として扱い、#2981 の主目的をぼかさないでください。

    E. reproducibility / cleanup

    movable refは一度immutable commitへresolveし、そのidentityをsummary/evidenceに残す必要があるか確認してください。

    runner自身が生成したephemeral control worktreeだけを安全にcleanupし、foreign worktreeには触らない最小contractを検討してください。cleanup failureをdiscriminative PASSとして隠さないでください。

    scope方針

    品質・有用性を優先します。今回の目的は counterfactual evidence の validity です。

    以下は避けてください。

    既存runner / existing worktree mechanism / existing summary fields / existing controlled workflowで最小修正できるならそれを選んでください。

    一方、証拠のcausal validityを壊す false-green は「個人開発だから無視」で済ませずcontract上閉じてください。

    loop completion

    current Skillの planner / deterministic checker / semantic review / rewrite routing をauthorityとして、最大iterationまで自動で反復してください。

    rewrite後は必ず:

    • Issue body/title readback
    • fresh preflight
    • fresh Step 2 review
    • applicabilityがあれば fresh Step 2.5 semantic design review
    • fresh readiness

    を通してください。

    古い review artifact、古い body SHA、古い main HEAD を terminal approval に流用しないでください。

    canonical resultが approved になった場合は current Skillの termination / handoff contractに従って終了コメントを投稿してください。issue_kind: implementation に必要な LOOP_HANDOFF_RESULT_V1 がcurrent Skill上適用されるならそれも正規形式で出力してください。

    今回は refinement の依頼であり implementation の依頼ではありません。
    approved後に impl-review-loop、implementation worker、production implementation、commit/push、PR作成へ進まないでください。refinement承認と実装開始承認を混同しないでください。

    merge / auto-merge は行わないでください。

    再発防止Issue

    調査・review中に #2981 とは独立した再発性問題が見つかった場合:

    1. 全stateで既存Issue / PR / dedupe_keyを検索
    2. 実装: skill-invocation runtime smoke に SKILL.md 変更前テキストとの対照実行を追加し、SKILL.md を戻しても通る non-discriminative な false-green を検出する #2981・再発防止: skill-invocation-runtime-smoke の assertion applicability を明示化する #2775・実装: runtime smoke の expected_markers_missing が prompt echo を child marker と誤認する false-green を除去する #2944・#2874等の既存ownershipで解消されるか確認
    3. 本Issueへ入れるとscope driftになる独立Outcomeであることを確認
    4. 既存ownerがなければ current canonical materialization / issue-creator 経由で再発防止Issueを起票
    5. 起票結果をjoinしてURLを取得
    6. 実装: skill-invocation runtime smoke に SKILL.md 変更前テキストとの対照実行を追加し、SKILL.md を戻しても通る non-discriminative な false-green を検出する #2981 の終了報告に関連Issueとして記載

    単なる今回のreview findingを機械的に別Issue化しないでください。

    最終報告

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

    • freshに確認した Issue / anchor / main binding
    • 対象コメント High 1〜4、Medium 5〜6 の各 disposition
    • Issue本文へ実際に反映した変更
    • 実行した SubAgent と、それぞれの terminal result
    • deterministic review / semantic review の最終結果
    • final body SHA / terminal disposition
    • 起票した再発防止Issue(あればURL、なければ「distinct follow-upなし」)
    • 残blocker / environment failure / genuine human_judgment_required の有無
    • implementation-ready になったか
    • implementationは開始していないこと

    通常のneeds-fixや修正可能なreview findingを理由に途中で止まらず、current canonical loopの許す範囲で修正→fresh reviewまで完遂してください。

    このpromptでは、対象コメントの6 findingを無条件に転記するのではなく、1〜4は強い修正候補、5〜6もfresh evidenceで支持されれば同一Issueに反映という形にしています。これにより current planner/reviewer のauthorityを壊さず、同じ承認を再質問する可能性を抑えています。

  4. squne121 commented on Oct 7, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-10-07T13:34:51Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/2981
      body_sha256: "sha256:1b3c34c16d2dcd9e7c641c4bff157a43c9558cad14629ed8f979bb3b09dd572e"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        product_spec_check: {"schema":"product_spec_check/v1","applicability":"applicable","decision":"pass","triggers":{"docs_product_allowed_paths":false,"tasks_md_mentioned":false,"specify_artifact_mentioned":false,"generated_task_mentioned":false,"product_spec_context_present":false,"machine_readable_contract_present":true},"conditions":{"docs_product_requires_spec_evidence":{"status":"pass","evidence":[]},"tasks_md_not_direct_source":{"status":"pass","evidence":[]},"specify_not_canonical":{"status":"pass","evidence":[]},"diff_first_rationale_present":{"status":"pass","evidence":[]},"generated_task_trace_present":{"status":"pass","evidence":[]},"task_dependencies_materialized":{"status":"pass","evidence":[]}},"blocked_reasons":[],"body_sha256":"sha256:1b3c34c16d2dcd9e7c641c4bff157a43c9558cad14629ed8f979bb3b09dd572e","source_provenance":{"source_type":"body_file","body_file":"/tmp/contract_review_once_body_2vo2yk4s.md"}}
        vc_preflight:
          decision: pass
          classifications: '[{"ac":"AC1","line":2,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke.py scripts/agent-ops/tests/test_skill_invocation_runtime_smoke_profile.py -q","command_hash":"sha256:3f58093a1bfae0ab56020756b98a3d8632348ad15cc65f67627f97abbb963b3e","execution_key_hash":"sha256:1dd264ed56261a8493e3c286fe77a8a6567c6bec6000f5bdc2b7ac7153ca3d48","runner":"exec","exit_code":0,"classification":"expected_pass","category":"regression_gate","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":["........................................................................ [ 51%]","....................................................................     [100%]","140 passed in 49.11s"],"stdout_truncated":false,"stdout_original_line_count":4,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":49406,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:aede31da20ec06193cc65e993683c12186840a20cc93654236f74a089b2ddc3f"}},{"ac":"AC2","line":5,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k discriminative -q","command_hash":"sha256:2399cb402b8bc71b8da3d5c7abbe520f56b356da840ce0fa28cf7a9ffc9b6c04","execution_key_hash":"sha256:873de51fcd0678177fbf2fd009a7d89c09c87a0c753d5fcc958b1c22cd6178b6","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.01s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_skill_text_counterfactual_control.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":223,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:a75ea3b11d6562ca8c3c34019410541669e238f6b95860c18e310409e7c27cab"}},{"ac":"AC3","line":8,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k non_discriminative -q","command_hash":"sha256:8d7f0fe9a172d8885434626631b812710fe52b8b2141203c75f53369cc368a16","execution_key_hash":"sha256:b08abad01ac61719e5f952ad6170cd49a3f2590f256488f06085e79048b8939e","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.01s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_skill_text_counterfactual_control.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":217,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:6fb202d54713aad3c53928dee001409887a68a463542e599b64d4fb9fc224893"}},{"ac":"AC4","line":11,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k control_invalid -q","command_hash":"sha256:092e2985adddf6fe9b20d41826fbb14f3697d3ecb827a51f49e7dd36126c9d00","execution_key_hash":"sha256:783e4187caf28955358329be9e615dadb3076171c035aece1b4bb93d80ee95c9","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.01s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_skill_text_counterfactual_control.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":175,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:4c411bafcacdb910622be9f3159df1ba748eeae1ad78f07dbdc68e32a0348b9b"}},{"ac":"AC5","line":14,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k fail_closed -q","command_hash":"sha256:36280d593666a052cfb3a64cfcf8849b8ca75d6bb53f1cc88cdf0da1a50036a4","execution_key_hash":"sha256:4a33c2bd65cde8cc21acf28a66fc136bd8ccac185c79361c077ad101ee7919af","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.01s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_skill_text_counterfactual_control.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":193,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:2cb11d50d7f4bc24e840138733f4228dc4bb5be4095ca55ee30af7ac435c3693"}},{"ac":"AC6","line":17,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k isolation -q","command_hash":"sha256:e6da143a91958b6c4dfbb8138ea1223629277d8422f8462f6e1e2b314cd967b2","execution_key_hash":"sha256:86ee07cccc77eddcc6655d3a34e3535566ba7069a1ad44b538b6d0e39bd026d8","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.01s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_skill_text_counterfactual_control.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":179,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:f48d5525db11eb2cbb67388ffd66087ac43849e6464c63bc1a68d419ad083668"}},{"ac":"AC7","line":20,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k cleanup -q","command_hash":"sha256:fdc3eb782a8f176a8ca1b222b0156a0eb49e874c0e3c2696ff475c0f5b9c642b","execution_key_hash":"sha256:1f774feae6f273f35612fa5af39875218d39583cc1d49626b40fa2076160e0af","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.00s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_skill_text_counterfactual_control.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":180,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:9c36ab8a6c4eba988e7970c88938dd80fc3d93519e54df213a8e19d3cd98e2c1"}},{"ac":"AC8","line":23,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_skill_text_counterfactual_control.py -k docs_contract -q","command_hash":"sha256:bb6b5c6f245b34f6f38261ae4fffd0568212d52b1503149a38b749453a3ca4dd","execution_key_hash":"sha256:77e55fecfd7ff6c9b90a7ae383562f69ba3197316ab02f26e1df3a892d7a8a20","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.01s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_skill_text_counterfactual_control.py"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":234,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:2eb9e492d350ecd9c107a9eacdf8631c687734bb30af99aa80be81f0b777dda7"}},{"ac":"AC9","line":27,"raw_command":"uv run --locked pytest -q -s -m claude_live scripts/agent-ops/tests/test_skill_text_counterfactual_control_live.py","command_hash":"sha256:a0d01c8956c9f4a5fc61d1b099a28f0f2b48bd0c3d2a24e1880b18b2bdfe38ce","execution_key_hash":null,"runner":"skipped","exit_code":null,"classification":"skipped","category":"preflight_scope_runtime_only","decision":"go","scope_class":"runtime_only","confidence":"low","stdout_head":[],"stdout_truncated":false,"stdout_original_line_count":1,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":0,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"verification_owner":"impl-review-loop","deferred_reason":"VC marked runtime_only; verification deferred to post-implementation runtime","runtime_verification_required":true,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:38baa8f7d7637ea6119399212368fbe1caba1cef7a8860602ec13158c01485bb"}}]'
          classifications_transport: {"schema":"vc_preflight_classifications_transport/v1","classification_count":9,"original_payload_sha256":"sha256:0e833ac8a4420b82739fc4112e534b5c137ea91e8f4373117734ecf573ce903a","compact":false,"truncated":false}
        declared_path_overlap: '{"schema":"declared_path_overlap/v1","advisory":true,"blocking":false,"decision":"advisory_only","disjoint":true,"overlapping_prs":[],"inventory":{"schema":"OPEN_PR_INVENTORY_V1","repo":"squne121/loop-protocol","state":"open","base_ref":"main","base_sha":"50870949dfd4332bcf85a0daffa7df6da0fd96a5","draft_policy":"include_drafts","prs":[{"number":2831,"title":"実装: Claude-GPT model/proxy runtime migration の3分類ルーティングを追加する","base_ref_name":"main","head_ref_name":"worktree-issue-2810-runtime-migration-classifier","head_ref_oid":"7c06e272c14b2d38e8f01899abdf85f3d0d5c9ec","is_draft":false,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2831","changed_files_count_graphql":20},{"number":2914,"title":"fix: test-runner が mergeStateStatus=BLOCKED/UNSTABLE だけで TEST_VERDICT を FAIL にしないようにする","base_ref_name":"main","head_ref_name":"worktree-issue-2908-test-runner-blocked-not-fail","head_ref_oid":"2f44329742e2117b1bbbb34452417362558175aa","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2914","changed_files_count_graphql":1},{"number":2931,"title":"fix: Auto mode の固定 /tmp scratch 上書き false-deny を run-scoped workspace で解消する","base_ref_name":"main","head_ref_name":"worktree-issue-2860-run-scoped-scratch","head_ref_oid":"344f5da35326e04dacd13aa57dd962674888f336","is_draft":false,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2931","changed_files_count_graphql":6},{"number":2940,"title":"feat: runner evidence に main-session init の permission_mode_observed を出力する","base_ref_name":"main","head_ref_name":"worktree-issue-2935-main-session-permission-mode","head_ref_oid":"37eb1ae20b98cc72fed816a7c88aca0d9b623a39","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2940","changed_files_count_graphql":3},{"number":2946,"title":"fix: runtime smoke fixture の child 起動先を general-purpose に是正し 2.1.289 で hook_id_correlated を成立させる (#2941)","base_ref_name":"main","head_ref_name":"worktree-issue-2941-claude-2-1-289-causal-evidence","head_ref_oid":"0fbc32e03e377b36d5800c940ab8311479c8cf46","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2946","changed_files_count_graphql":1},{"number":2974,"title":"fix: component-vrt-report の negative-control artifact を run_attempt 単位名に束縛する (#2969)","base_ref_name":"main","head_ref_name":"worktree-issue-2969-vrt-negctl-attempt-artifact","head_ref_oid":"d2b3619a51d895046813be754e2b969ab72ea539","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2974","changed_files_count_graphql":2},{"number":2976,"title":"feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971)","base_ref_name":"main","head_ref_name":"worktree-issue-2971-body-only-evidence-sync","head_ref_oid":"7c5ccdcd589bb0305466d8461e093fa204136080","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2976","changed_files_count_graphql":7},{"number":2978,"title":"feat: semantic design review で path 未列挙 role を bounded discovery で解決する (#2973)","base_ref_name":"main","head_ref_name":"worktree-issue-2973-bounded-discovery","head_ref_oid":"86231ef1a3e3a75851b621376069987a5d4c968d","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2978","changed_files_count_graphql":24}],"fetched_count":8,"totalCount":8,"has_next_page":false,"complete":true,"saturated":false,"limit":200,"page_count":1,"inventory_digest":"sha256:dd7a5433779ea0d9a1b65af8e56e5a999bb69de9c0c99727899d73032a8e33ab","errors":[]},"inventory_digest_extended":"sha256:d51a1e8a2a428db0668018ca4f87726efd9810626f3ae8e3e3f918e508e44191","errors":[],"note":"changed-file 名の単純な重なりのみを証明する advisory check。3-way merge・hunk 競合・rename/delete 競合は評価しない(実 Git merge 競合の判定は Issue #1792 の PAIRWISE_MERGE_OBSERVATION_V1 producer の責務)。単独では blocking にしない。disjoint は tri-state(true/false/null)— 観測が不完全な場合は null。"}'
      source: ensure_contract_snapshot_auto
      expected_contract_fingerprint: '{"issue_number":2981,"contract_source_kind":"issue_comment","contract_source_id":"6039095768","contract_body_sha256":"sha256:1b3c34c16d2dcd9e7c641c4bff157a43c9558cad14629ed8f979bb3b09dd572e","allowed_paths_normalized_sha256":"e7d79a9da1f1963c58e22b449416029534b193200911e1d52c2249fcb9fc2e35","base_ref":"main","base_sha_at_snapshot":"50870949dfd4332bcf85a0daffa7df6da0fd96a5"}'
  5. squne121 commented on Oct 7, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告(approved)

    anchor findings の反映(fresh な repository / upstream evidence と照合済み)

    finding 判定 反映内容
    High 1: 元の false-green 類型の live 固定が無い 成立 AC9 を live 2 ケース化し、negative は BASE でも ordered marker が成立する fixture で runner 全体が non_discriminative かつ非 0 exit を要求
    High 2: BASE FAIL の taxonomy が広い 成立 discriminative を「候補 PASS かつ BASE control valid かつ ordered assertion のみ不成立」に限定。timeout・terminal event 欠落・Skill 未観測・permission/runtime error・postcondition failure・SKIP は control_invalid(AC4)。新規 schema / registry なし
    High 3: SKILL.md 以外の confound 成立(verify_worktree_identity() は run_worktree_agent_runtime_smoke.py:343 で root・別 common-dir・.claude/worktrees/ 外を拒否、--require-clean-postcondition は実行前 dirty を拒否しない) plain copy を削除。候補 arm と BASE arm を同一 captured candidate commit の detached な runner-owned ephemeral linked worktree で実行し、candidate が dirty なら fail-closed(AC5 / AC6)
    High 4: 追加 control path が因果性を曖昧にする 成立 treatment を対象 SKILL.md 1 ファイルに固定。複数 path は受理せず、別 Outcome・別結果名の扱いを Out of Scope に明記
    Medium 5: BASE ref が movable 成立 preflight で一度だけ commit SHA に resolve して pin し、summary に requested ref・resolved SHA・candidate HEAD・blob hash を記録(AC2 / AC6)
    Medium 6: control worktree の cleanup 契約が無い 成立 runner 生成 path のみ finally で回収し、foreign worktree には触れない。cleanup 失敗は非 PASS(AC7)

    加えて、deterministic review が指摘した subagent-lifecycle-causal-evidence-smoke/subagent_start_stop_causal_evidence_correlated の runtime_assertion_bindings を not_applicable(理由付き)で補った。

    外部仕様 claim(Claude Code skills / CLI reference、git rev-parse / worktree / show)は web-researcher が公式一次資料で 5 件すべて supported と確認した。

    実装者向けの残 medium / low finding(blocking ではない。実装時に PR 側で解消または明記する)

    • closed mapping の valid-control 述語を既存 summary field(process_exit_code・timed_out・terminal_event_observed・expect_skill_command_observed・permission_denials・capability_decision・postcondition_unexpected_changes・errors)へ具体 binding し、driver が両 arm に --require-clean-postcondition / --evidence-json を強制することを fixture(permission_denials 非空・turn_limit_reached・evidence-json 欠落)で固定する。
    • BASE arm は SKILL.md の working tree 上書きで pre-run に M <path> となる。「clean」は「作成直後は clean、BASE arm のみ対象 1 ファイルの delta を持つ」と解釈し、git diff 経由で candidate text が BASE arm に見える漏えいは限界として SKILL.md に明記する(owner 選択余地あり。BASE 用の子 commit を作る案もある)。
    • live fixture skill は .claude/skills/<fixture>/SKILL.md として worktree に committed である必要があるため、live test が throwaway linked worktree 上で fixtures/** から 2 版を commit して candidate / BASE を構成する。
    • 新規 SHA / blob hash field は _PUBLIC_EVIDENCE_SHA_LENGTHS へ登録しないと <redacted> になる。cleanup 失敗の残存 path は canonical root 相対で記録する。
    • .claude/skills/worktree-agent-runtime-smoke/SKILL.md の Non-trigger / Safety Boundary に、opt-in の skill_text_counterfactual に限る例外条項を足す。
    • 対象 path は .claude/skills/<name>/SKILL.md 形に正規化し、..・絶対 path・symlink・非 regular blob mode を拒否する。
    • arm あたり 1 run のため、discriminative は確率的証拠であり証明ではないことを限界節に明記する(N 回実行は本 Issue のスコープ外。必要なら follow-up)。
    • AC2 の VC -k discriminative は non_discriminative にも部分一致するため、実装時に AC2 固有の test 名 token を使う。AC9 の Verdict Reason には「fixture skill に対する counterfactual 判定の検証であり、対象 SKILL.md の Procedure 順序の証明ではない」と記載する。

    再発防止 Issue: distinct follow-up なし(#2775 / #2944 / #2874 の所有範囲との重複なし、上記 finding はいずれも #2981 の Outcome 内で扱える)。

    LOOP_HANDOFF_RESULT_V1:
      status: refinement_approved
      routing_action: none
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: https://github.com/squne121/loop-protocol/issues/2981#issuecomment-6039095768
        generated_at: 2026-10-07T13:35:08Z
        body_sha256: sha256:1b3c34c16d2dcd9e7c641c4bff157a43c9558cad14629ed8f979bb3b09dd572e
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: labels unchanged (enhancement, phase/implementation, agent/implementer)
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: 2026-10-07T13:35:08Z
  6. squne121 commented on Oct 7, 2026

    @squne121
    OwnerAuthor

    推奨は #2981 の実装を今開始し、current impl-review-loop を merge-ready 直前まで自律完走させる です。fresh GitHub state では #2981 は OPEN / phase/implementation、contract snapshot は go、refinement 終了は approved です。main は確認時点で 50870949dfd4332bcf85a0daffa7df6da0fd96a5、#2981 専用 PR/branch は検索上まだありません。直前の refinement 実行でも「implementation は未開始」「残 blocker / genuine human_judgment_required なし」と報告されています。貼り付けたテキスト(1)

    一方、semantic review の medium/low finding は残っているため、実装時に無視せず reviewer 観点として消化するのが適切です。とくに BASE arm の clean 性と working-tree treatment の緊張、1-run LLM evidence の確率的限界は、実装上の解釈を明示して false-green を再導入しない方針を取ります。貼り付けたテキスト(1)

    以下をそのまま、既に auto mode で起動済みの fresh 対話的 Claude Code に貼り付けてください。

    repo: squne121/loop-protocol

    対象:

    この対話は fresh な対話的 Claude Code session で、auto mode は既に有効です。既存 session をそのまま継続してください。permission mode、hooks、MCP、その他の現在設定を変更しないでください。bypassPermissions、--dangerously-skip-permissions、force push、auto-merge 等を要求・使用しないでください。

    目的

    Issue #2981 を対象に、current HEAD の .claude/skills/impl-review-loop/SKILL.md とその current steps/** / references / agent definitions を正本として、実装 → 検証 → PR review → fix → 再検証 → fresh review を自律的に反復し、人間が merge 判断できる直前まで到達してください。

    merge / auto-merge は実行しないでください。

    今回のユーザーメッセージは、Issue #2981 の implementation を開始し、current impl-review-loop の通常の bounded loop を追加の iteration ごとの人間承認なしで実行するための新しい明示的人間指示・実装承認です。

    過去の LOOP_HANDOFF_RESULT_V1 や contract snapshot コメントを Step 1 起動 authority として再利用してはいけません。current impl-review-loop が規定する Root-Owned Synchronous Entry Transition を、この invocation の明示的実装依頼から fresh に実行してください。

    明示的に承認する作業

    以下を追加承認なしで実行して構いません。

    1. Issue 実装: skill-invocation runtime smoke に SKILL.md 変更前テキストとの対照実行を追加し、SKILL.md を戻しても通る non-discriminative な false-green を検出する #2981 の current contract の範囲内で production implementation を行うこと。
    2. current Skill が必要とする linked worktree / branch を作成または既存の canonical なものを再利用すること。
    3. Allowed Paths 内のファイル編集、test fixture 作成、docs 更新を行うこと。
    4. commit / push を行い、1 Issue = 1 PR の current delivery contract に従って既存 PR を再利用するか、存在しなければ Draft PR を作成すること。
    5. Issue の Verification Commands、current test-runner が要求する repository gate、runtime verification を実行すること。
    6. PR body / runtime evidence / current-head evidence を current repository の canonical mutation route / wrapper で同期すること。
    7. REQUEST_CHANGES、通常の test failure、修正可能な CI failure、stale-head rereview、update-branch routing を current Skill に従って自動修復・再実行すること。
    8. 修正後は必ず fresh HEAD に対して verification と PR review をやり直すこと。
    9. current max_iterations / loop budget の範囲内では iteration ごとの人間承認を求めないこと。
    10. 実装・レビュー中に distinct な再発性 defect が確認された場合、current Step 5 の follow-up materialization contract に従い、既存 Issue / PR / dedupe_key を全 state で検索した上で、owner が無ければ issue-creator SubAgent / create-issue canonical route から再発防止 Issue を起票すること。

    この承認は canonical deterministic guard、Allowed Paths、Issue contract、evidence integrity、current Skill の genuine human_judgment_required を無視する承認ではありません。canonical authority が本当に停止を要求した場合、その判定を prose で proceed に上書きしてはいけません。

    ただし、通常の REQUEST_CHANGES、test failure、CI failure、修正可能な review finding、stale evidence は停止理由ではありません。可能な範囲で修正 → 再検証 → fresh review を続けてください。

    最初に必ず fresh に確認すること

    この prompt 作成時点の SHA や過去セッション状態を正本として使わず、最初に current repository / GitHub state を fresh に取得してください。

    少なくとも以下を確認してください。

    既存の #2981 用 PR / branch / worktree が fresh 検索で見つかった場合、原則それを再利用し、重複作成しないでください。

    Root entry

    refinement の approved コメントだけを authority にして直接 implementation-worker を起動しないでください。

    current impl-review-loop の Root-Owned Synchronous Entry Transition を正規に通し、このユーザーメッセージの直接的な implementation request を起点として current-run contract review / live state / routing を成立させたうえで Step 1 に進んでください。

    legacy snapshot / ledger / session artifact の欠落だけを理由に停止しない一方、live Issue / worktree identity / dirty state / Allowed Paths / tests / CI / review といった current Skill の safety boundary は守ってください。

    SubAgent の必須運用

    current Skill が規定する SubAgent を使用してください。

    Step 1 — implementation-worker

    implementation-worker に current implement-issue contract で実装を委譲してください。

    task prompt には親会話の暗黙 context に依存せず、最低限:

    を明示してください。

    dispatch しただけで完了扱いにしないでください。terminal completion と final result を必ず受け取り、内容を検証してから Step 2 へ進んでください。

    Step 2 — test-runner

    implementation-worker の final result と fresh HEAD を束縛して test-runner を起動してください。

    Issue #2981 の Verification Commands を current body から読み取り、current Skill の verification contract に従って実行してください。

    特に AC9 は runtime_only / claude_live の実 runtime evidence です。SKIP / exit 77 / unverified / degraded result を PASS に昇格しないでください。

    test-runner についても terminal completion と final result の取得前に Step 4 へ進まないでください。

    Step 4 — pr-reviewer

    fresh current-head PR に対して pr-reviewer を起動してください。

    reviewer の final resultを取得するまで downstream へ進まないでください。

    reviewer の自己申告から mergeability / test status / routing を prose で再構築せず、current impl-review-loop の control-plane と route_loop_verdict_v2() 等の current canonical router を使ってください。

    REQUEST_CHANGES なら blocker / fix_delta を Step 1 に戻し、自動修正してください。

    stale reviewed head なら fresh head で re-review してください。

    follow-up — issue-creator

    実装 / verification / PR review で、本 Issue の Outcome に押し込むと scope drift になる distinct な再発性 defect / workflow defect が見つかった場合のみ候補化してください。

    起票前に必ず:

    1. OPEN / CLOSED の既存 Issue
    2. 関連 PR
    3. dedupe_key
    4. 再発防止: skill-invocation-runtime-smoke の assertion applicability を明示化する #2775 / 実装: runtime smoke の expected_markers_missing が prompt echo を child marker と誤認する false-green を除去する #2944 / 実装: runtime smoke の --expect-ordered-marker を causal evidence の marker provenance 検証へ接続する #2874 等の既存 ownership

    を確認してください。

    current Step 5 が materialization 対象と判定した場合のみ、main thread から issue-creator SubAgent に委譲してください。SubAgent 内から nested delegation しないでください。

    issue-creator も dispatch だけで完了扱いせず、terminal result と created/reused Issue URL を取得してから終了報告へ進んでください。

    単なる #2981 の implementation finding を機械的に別 Issue へ逃がさないでください。

    #2981 固有の実装レビュー観点

    refinement 時の semantic review では blocker / high は残りませんでしたが、medium / low finding が残っています。これらを無視せず、current contract の範囲内で実装または明示的な limitation として閉じてください。

    1. BASE control validity を曖昧にしない

    candidate PASS + BASE exit != 0 をそのまま discriminative にしないでください。

    既存 summary field に基づく肯定形の closed predicate を実装し、少なくとも:

    • process が正常終了
    • timeout なし
    • terminal event 観測済み
    • expected Skill invocation 観測済み
    • permission denial なし
    • runtime/capability failure なし
    • clean postcondition 成立
    • required evidence JSON が存在し parse / binding 可能
    • ordered_evidence_match.verified == false
    • 失敗が狙った ordered assertion だけに帰属可能

    の場合だけ BASE を valid negative control としてください。

    field 欠落・timeout・turn-limit・permission denial・evidence 欠落・SKIP 等は control_invalid にしてください。

    driver が candidate / BASE の双方に必要な observability flags(current implementation上必要な --require-clean-postcondition / evidence output 等)を同じ意味で適用することを test で固定してください。

    generic failure framework / registry / semantic LLM evaluator は追加しないでください。

    2. candidate / BASE isolation

    plain filesystem copy は使わないでください。

    両 arm は captured candidate state 由来の runner-owned ephemeral linked worktree とし、差分 treatment は対象 SKILL.md 1 ファイルだけに限定してください。

    refinement semantic review では「BASE SKILL.md を working tree に差し替えると git 上 dirty になり、clean という wording と緊張する」ことが指摘されています。

    推奨実装は causal isolation を優先し、BASE arm を runner-owned の clean な ephemeral Git state として構成し、candidate-derived tree から対象 SKILL.md blob だけが異なることを決定論的 test で証明する方式です。このユーザーメッセージでは、この実装解釈を current contract と矛盾しない範囲で採用することを明示的に承認します。

    ただし current deterministic contract / Allowed Paths がこの方式を semantic scope change と判定する場合、その guard を迂回して Issue contract を勝手に変更してはいけません。その場合のみ exact conflict を canonical stop reason として報告してください。

    「clean」を単に言葉だけ再定義して false-green を隠す方法は採用しないでください。

    3. treatment ownership

    skill_text_counterfactual の treatment は指定対象 SKILL.md 1 ファイルだけです。

    複数 path、reference file、production script を BASE に戻して SKILL.md text causal と主張してはいけません。

    multi-path counterfactual が必要なら本 Issue の別名義 result に混ぜず、distinct follow-up の候補です。

    4. BASE ref identity

    requested ref は preflight で一度だけ immutable commit SHA へ resolveし、その SHA だけで以降の blob / identity を取得してください。

    summary / evidence には current contract が要求する:

    • requested base ref
    • resolved base commit SHA
    • candidate HEAD
    • candidate SKILL blob identity
    • BASE SKILL blob identity

    を残してください。

    5. evidence redaction

    commit SHA / blob hash 等の新規 evidence path が current evidence redaction によって <redacted> にならないことを確認してください。

    必要なら runner 内の existing public-hash allow mechanism に current field path を登録し、machine-readable identity を保持してください。

    cleanup failure の残存 path は secret-like absolute path を露出させず canonical root 相対 path 等で記録してください。

    6. target path validation

    対象 treatment path は安全な repo-relative Skill path に限定してください。

    少なくとも current repository semantics に即して:

    • absolute path 拒否
    • .. traversal 拒否
    • .claude/skills/<name>/SKILL.md の expected shape
    • candidate / BASE の双方で存在確認
    • symlink / non-regular tracked object の拒否
    • unexpected mode の拒否

    を fail-closed にしてください。

    security一般論のための汎用 sandbox や新しい approval layerは追加不要です。今回の exact file replacement boundary を閉じるだけにしてください。

    7. live fixture

    repo 本体へ不要な permanent fixture Skill を追加しないでください。

    live test が必要な fixture Skill は current Allowed Paths 内の fixture source から runner/test-owned throwaway linked worktree 上へ materialize し、candidate / BASE の必要な状態を commit / construct して実行し、終了時に test-owned exact path だけ回収してください。

    foreign worktree は変更・削除しないでください。

    8. worktree cleanup

    cleanup は runner 自身が生成して記録した exact ephemeral path だけを対象にしてください。

    成功・失敗・exception の全経路で cleanup を試行し、cleanup failure を discriminative PASS に隠さないでください。

    global GC / lock daemon / registry は不要です。

    9. worktree-agent-runtime-smoke Skill の既存 contract との整合

    current .claude/skills/worktree-agent-runtime-smoke/SKILL.md の Non-trigger / Safety Boundary / verdict ownership と、新しい opt-in skill_text_counterfactual mode の責務が矛盾しないようにしてください。

    必要な例外は この opt-in mode に限定して docs を更新し、既存 mode の責務や default behavior を広げないでください。

    10. 1-run LLM evidence の限界

    arm あたり 1 live run なら、LLM output 自体は確率的です。

    本 Issue で deterministic と呼ぶのは input identity / closed classification / exit mapping が決定論的であることに限定してください。

    1 sample の BASE failure を数学的・統計的な causal proof と過大主張しないでください。docs / evidence に limitation を明記してください。

    このユーザーメッセージでは、N 回反復や新しい statistical harness は導入せず、1-run evidence の限界を明文化して本 Issue を完了する方針を明示的に承認します。

    11. test selector false-green

    AC2 の test selector が non_discriminative test まで部分一致して AC2 固有 test がなくても green になるような命名にしないでください。

    各 AC の verification command が意図する test を実際に選択することを確認し、一意な test token / exact selector を使用してください。

    12. AC9 evidence の意味

    AC9 の Runtime Verification Evidence には、

    • fixture skill に対する counterfactual classification を実 runtime で検証した証拠である
    • worktree-agent-runtime-smoke/SKILL.md 自身の全 procedure step の causal proof ではない

    という scope を明示してください。

    Verification Commands

    Issue body の fresh current version を正本として AC1〜AC9 の Verification Commands を実行してください。

    現時点での契約は概ね以下ですが、この prompt のコピーを正本にせず live Issue から再取得してください。

    • AC1: existing runner regression tests
    • AC2: discriminative positive synthetic
    • AC3: non_discriminative synthetic
    • AC4: control_invalid synthetic
    • AC5: fail_closed cases
    • AC6: isolation / immutable BASE identity
    • AC7: cleanup
    • AC8: docs contract
    • AC9: claude_live positive + non_discriminative negative

    AC9 が environment unavailable / auth unavailable / exit 77 / unverified なら PASS と主張しないでください。current Issue Stop Conditions / current Skill の routing に従ってください。

    review / fix loop

    通常フロー:

    fresh intake → root entry → implementation-worker → join → test-runner → join → current-head adjudication → pr-reviewer → join → Step 5 canonical routing

    としてください。

    REQUEST_CHANGES:

    • fix_delta を抽出
    • Step 1 に戻す
    • implementation-worker の final resultを取得
    • fresh test
    • fresh current-head review

    を current loop budget 内で自動反復してください。

    古い test result、古い reviewer verdict、古い PR head、古い runtime artifact を新 HEAD の PASS / APPROVE として再利用しないでください。

    independent な read-only investigation は current Skill が許す場合に並列化して構いませんが、dependency がある Step 1 → Step 2 → Step 4 → Step 5 は順序を守ってください。

    background SubAgent / command は、background 起動を completion とみなさず、必ず completion notification / terminal result を join してください。

    PR

    fresh 検索で #2981 用 PR が存在しない場合は current delivery contract に従い Draft PR を作成してください。

    既存 PR が存在する場合は原則再利用してください。

    PR には current repository contract が要求する:

    • Issue linkage / closing keyword
    • implementation summary
    • AC coverage
    • Verification Commands results
    • Allowed Paths
    • Runtime Verification Evidence
    • current tested HEAD identity
    • review/fix historyで必要な evidence

    を current Skill / repository conventions に従って記録してください。

    PR body の evidence は current HEAD に束縛してください。

    GitHub mutation は repository が指定する current controlled route / wrapper を使用し、raw mutation で canonical guard を迂回しないでください。

    再発防止 Issue

    実装中に見つかった defect が:

    という条件を満たす場合は再発防止 Issue 化してください。

    起票前に all-state search / dedupe_key / ownership を確認し、重複を作らないでください。

    current Step 5 の materialization timing を守り、issue-creator の terminal result を待って URL を取得してください。

    停止境界

    次は停止 / escalation 候補です。

    • current Skill が canonical に返す genuine human_judgment_required
    • current max_iterations 到達
    • irreconcilable Issue contract conflict
    • Allowed Paths 外の変更が不可避
    • fixed schema / contract の semantic change が不可避
    • destructive operation
    • secret / credential の取得・変更・公開が必要
    • force push / history rewrite が必要
    • evidence integrity を維持できない
    • AC9 の required live runtime が current contract 上 genuine unavailable
    • foreign worktree / branch を変更・削除する必要が生じる
    • merge / auto-merge

    通常の REQUEST_CHANGES、修正可能な test failure / CI failure、reviewer finding、stale head は停止理由にしないでください。

    到達点

    終了条件は、current impl-review-loop の canonical Step 5 が current PR head に対して merge-ready 相当の approved terminal route を返し、人間が merge 判断できる状態になることです。

    merge は実行しないでください。auto-merge も設定しないでください。

    最終報告

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

    • fresh intake 時の Issue / main binding
    • 使用した worktree / branch
    • PR URL / PR number / current HEAD
    • 実変更ファイル
    • AC1〜AC9 の disposition
    • 実行した Verification Commands と結果
    • AC9 runtime evidence:
      • Claude Code version
      • candidate / BASE identities
      • discriminative positive
      • non_discriminative negative
      • control_invalid を PASS にしていないこと
    • 各 SubAgent:
      • implementation-worker
      • test-runner
      • pr-reviewer
      • issue-creator(該当時のみ)
        の terminal result
    • review / fix iteration 数
    • final reviewer verdict と reviewed HEAD
    • live mergeability
    • CI 状態
    • 残 warning / blocker
    • 起票または reuse した再発防止 Issue URL
    • merge-ready か否か
    • merge / auto-merge は実行していないこと

    途中で調査報告だけを返して終了せず、current canonical loop の許す範囲で inspect → implement → test → review → fix → re-test → fresh review → PR evidence sync → terminal merge-ready judgment まで進めてください。

    特に重要なのは、refinement の approved コメントを Step 1 authority と誤認させず、この新しい実装依頼から current Root-Owned Entry を通すことと、SubAgent の dispatch 後に必ず terminal completion を待つことです。

  7. added a commit that references this issue on Oct 8, 2026
    4c2d900
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/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions