Repository navigation
Description
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 とは責務が異なり、重複させない。
- 再発防止: skill-invocation-runtime-smoke の assertion applicability を明示化する #2775: skill-invocation-runtime-smoke の assertion 適用要否(どの assertion を必須とするか)。本 Issue は counterfactual による discrimination であり、適用要否ではない。
- 実装: runtime smoke の expected_markers_missing が prompt echo を child marker と誤認する false-green を除去する #2944:
--expect-marker-source subagentにおける prompt echo の false-green(child-produced source set)。別の false-green 機構である。 - 実装: runtime smoke の --expect-ordered-marker を causal evidence の marker provenance 検証へ接続する #2874:
--expect-ordered-markerを causal evidence の marker provenance へ配線する課題。別課題である。 - 再発防止: impl-review-loop の post-verification PR body-only evidence sync を iteration budget から分離する #2971 / PR feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971) #2976: body-only lane 自体。本 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.md1 ファイルに固定する。複数 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
max_iterationsの変更、再発防止: impl-review-loop の post-verification PR body-only evidence sync を iteration budget から分離する #2971 の body-only lane 自体。- 既存 smoke profile の他の assertion の変更(
docs/dev/extension-surface-runtime-policy.yamlの profile / assertion 定義は変更しない。assertion 適用要否は 再発防止: skill-invocation-runtime-smoke の assertion applicability を明示化する #2775 が所有する)。 --expect-marker-source subagentの prompt echo false-green(実装: runtime smoke の expected_markers_missing が prompt echo を child marker と誤認する false-green を除去する #2944)、causal evidence marker provenance への配線(実装: runtime smoke の --expect-ordered-marker を causal evidence の marker provenance 検証へ接続する #2874)。- 新規の generic harness、新規 registry / ledger / approval layer、SKILL.md の意味解釈、LLM による判定。
- SKILL.md 以外の path を treatment に含める対照実行(含める場合は別 Outcome・別結果名で扱い、本 Issue では実装しない)。
- global な worktree GC、lock daemon、foreign worktree の回収。
- 実 PR の SKILL.md を持つ既存 smoke test(再発防止: impl-review-loop の post-verification PR body-only evidence sync を iteration budget から分離する #2971 の smoke 等)の書き換え。ただし、下記 In Scope に明記した
.claude/skills/impl-review-loop/tests/test_body_only_lane_runtime_smoke.pyの旧 tripwire 期待値修正に限る限定的例外を除く。同 smoke の counterfactual 本格配線(BASE 対照の接続、marker provenance 改善、AC8 を PASS にすること)は 実装: impl-review-loop の body-only lane runtime smoke を #2981 の counterfactual control に接続し candidate PASS + BASE FAIL を AC8 の PASS 条件にする #2986 が所有し、本 Issue では実装しない。
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.md1 ファイルでない(複数 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.pyAllowed 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
- 追加: runner の opt-in
skill_text_counterfactualモード(SKILL.md 1 ファイル treatment、同一 candidate commit の detached ephemeral worktree、BASE commit SHA pin、control_invalid の closed mapping、runner-owned worktree の cleanup 契約)、synthetic / live test(live は positive / negative の 2 ケース)、SKILL.md と policy の手順追記。 - 変更: 旧 contract の「一時 worktree またはコピー」「同一 skill 配下の追加 path」を削除し、AC 番号を AC1〜AC9 へ再編した(BASE FAIL 一括 discriminative 判定を valid control 限定へ変更)。既存フラグ省略時の挙動は不変。
- 追加(OWNER 人間判断による限定的 Scope Delta): Allowed Paths に exact path
.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 期待値の修正のみを In Scope とした。feat: impl-review-loop に body-only evidence sync lane を追加し iteration budget から分離する (#2971) #2976 の AC8 は BASE 対照が未配線の間SKIP:+ exit 77 を維持し、本格配線は 実装: impl-review-loop の body-only lane runtime smoke を #2981 の counterfactual control に接続し candidate PASS + BASE FAIL を AC8 の PASS 条件にする #2986 が所有する。AC1〜AC9 の保証は弱めない。 - 削除: なし。
Delivery Rule
- 1 Issue = 1 PR
- Draft PR を既定とする
- worktree を使用する
- merge / auto-merge は別途人間判断
Activity
squne121 commentedon Oct 7, 2026
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
[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_livedeselect でよく、恒久gate化は不要です。[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 で十分です。[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 と明記すべきです。[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.md1ファイルだけに固定することです。追加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 で十分です。[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は不要です。[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 は不要です。推奨する判定表
この形なら「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)
[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_livedeselect でよく、恒久gate化は不要です。[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 で十分です。[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 と明記すべきです。[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.md1ファイルだけに固定することです。追加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 で十分です。[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は不要です。[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 は不要です。推奨する判定表
discriminative/ PASSnon_discriminative/ FAILcontrol_invalid/ 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 は要りません。
squne121 commentedon Oct 7, 2026
GitHub live stateを確認しました。#2981 の対象コメントは
OWNER投稿で、現 contract に対して refinement required / REQUEST_CHANGES 相当、High 4件+Medium 2件を提示しています。また currentissue-refinement-loopでは canonical Step 2 はissue-reviewerSubAgent を使わず、root-owned review pipeline を background 起動して完了結果をjoinしてから routing する契約です。専用の #2981 実装PRは現時点では見当たりません。以下を、そのまま既に auto mode で起動済みの fresh 対話的 Claude Code に貼り付けてください。
repo:
squne121/loop-protocol対象:
.claude/skills/issue-refinement-loop/SKILL.mdこの対話は 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_contextlane を使用してください。明示的な人間承認
このユーザーメッセージを、今回の refinement invocation に対する新しい明示的人間指示・承認として扱ってください。
以下を明示的に承認します。
issue-refinement-loopの上限内で追加の iteration ごとの人間承認なしに実行すること。live_non_discriminative_negative相当の live casecandidate PASS + 任意の BASE FAILではなく、BASE runtime/control が正常かつ狙った ordered assertion だけが不成立の場合に限定した discrimination 判定skill_text_counterfactualの treatment を対象SKILL.md1ファイルに限定し、追加control pathの差を「SKILL.md text causal」と誤認しないことissue_editor_required/issue-editorroute を使用すること。needs-fix、deterministic repair、rewrite、fresh review は自動継続すること。issue-refinement-loopの materialization contract とissue-creatorSubAgent を使い、SubAgentの完了結果を取得してから後続処理へ進むこと。重複Issueは作らないこと。ただし、この承認は deterministic guard / evidence-integrity gate / repository contract を無視する承認ではありません。
human_judgment_required、environment/integrity failure、irreconcilable scope conflict 等が canonical authority から本当に返された場合に、その判定を捏造してproceedに変換してはいけません。本promptで既に判断済みの事項についてだけ、同じ承認を再質問しないでください。最初に fresh 確認するもの
少なくとも以下を確認してください。
6038533193の current snapshot と author association.claude/skills/issue-refinement-loop/SKILL.mdreferences/**.claude/agents/codebase-investigator.md.claude/agents/issue-editor.md.claude/agents/issue-creator.md対象コメントに外部仕様claimがあり planner が web research を required と判断した場合は、current Skillどおり
web-researcherを使用してください。公式一次資料を優先してください。SubAgent運用
current Skillが要求・許可するSubAgentを使用してください。
特に:
codebase-investigatorを使う。web-researcherを使う。issue-editorを使う。issue-creatorを使う。各SubAgentには、親会話の暗黙contextに依存させず、最低限以下を明示してください。
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-reviewerSubAgentを独自に起動してはいけません。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_livetestを優先してください。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以外に存在しないか確認してください。
対象コメントが推奨する
が 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後は必ず:
を通してください。
古い 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 とは独立した再発性問題が見つかった場合:
issue-creator経由で再発防止Issueを起票単なる今回のreview findingを機械的に別Issue化しないでください。
最終報告
終了時に簡潔に以下を報告してください。
通常のneeds-fixや修正可能なreview findingを理由に途中で止まらず、current canonical loopの許す範囲で修正→fresh reviewまで完遂してください。
このpromptでは、対象コメントの6 findingを無条件に転記するのではなく、1〜4は強い修正候補、5〜6もfresh evidenceで支持されれば同一Issueに反映という形にしています。これにより current planner/reviewer のauthorityを壊さず、同じ承認を再質問する可能性を抑えています。
squne121 commentedon Oct 7, 2026
Contract Review Result
squne121 commentedon Oct 7, 2026
issue-refinement-loop 終了報告(approved)
with_human_contextlane、issue binding 検証済み)。impl-review-loopの起動・worktree 作成・commit/push・PR 作成は行っていない)。承認 body SHA-256:1b3c34c16d2dcd9e7c641c4bff157a43c9558cad14629ed8f979bb3b09dd572e(main50870949dfd4332bcf85a0daffa7df6da0fd96a5時点)。runtime_assertion_bindings欠落 1 件)、rewrite 後は approve(blocker 0)。semantic design review(Step 2.5): findings あり(blocker / high 0、medium 7、low 2。join_review_resultsのeffective_verdictは approve で、9 件は warning 扱い)。readiness / contract snapshot: go(https://github.com/squne121/loop-protocol/issues/2981#issuecomment-6039095768)。immediate(AC9。live は discriminative positive と non_discriminative negative の 2 ケース)。anchor findings の反映(fresh な repository / upstream evidence と照合済み)
non_discriminativeかつ非 0 exit を要求control_invalid(AC4)。新規 schema / registry なしverify_worktree_identity()はrun_worktree_agent_runtime_smoke.py:343で root・別 common-dir・.claude/worktrees/外を拒否、--require-clean-postconditionは実行前 dirty を拒否しない)SKILL.md1 ファイルに固定。複数 path は受理せず、別 Outcome・別結果名の扱いを Out of Scope に明記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 側で解消または明記する)
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 欠落)で固定する。M <path>となる。「clean」は「作成直後は clean、BASE arm のみ対象 1 ファイルの delta を持つ」と解釈し、git diff経由で candidate text が BASE arm に見える漏えいは限界として SKILL.md に明記する(owner 選択余地あり。BASE 用の子 commit を作る案もある)。.claude/skills/<fixture>/SKILL.mdとして worktree に committed である必要があるため、live test が throwaway linked worktree 上で fixtures/** から 2 版を commit して candidate / BASE を構成する。_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に限る例外条項を足す。.claude/skills/<name>/SKILL.md形に正規化し、..・絶対 path・symlink・非 regular blob mode を拒否する。-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 内で扱える)。
squne121 commentedon Oct 7, 2026
推奨は #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対象:
.claude/skills/impl-review-loop/SKILL.mdこの対話は 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とその currentsteps/**/ 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 として再利用してはいけません。currentimpl-review-loopが規定する Root-Owned Synchronous Entry Transition を、この invocation の明示的実装依頼から fresh に実行してください。明示的に承認する作業
以下を追加承認なしで実行して構いません。
REQUEST_CHANGES、通常の test failure、修正可能な CI failure、stale-head rereview、update-branch routing を current Skill に従って自動修復・再実行すること。max_iterations/ loop budget の範囲内では iteration ごとの人間承認を求めないこと。issue-creatorSubAgent /create-issuecanonical 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 に取得してください。
少なくとも以下を確認してください。
.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/steps/preparation.mdsteps/step-1-implementation.mdsteps/step-2-verification.mdsteps/step-4-pr-review.mdsteps/step-5-feedback-and-termination.mdsteps/step-5-mergeability-handling.md.claude/agents/implementation-worker.mdtest-runneragent definition.claude/agents/pr-reviewer.md.claude/agents/issue-creator.mdscripts/agent-ops/run_worktree_agent_runtime_smoke.py.claude/skills/worktree-agent-runtime-smoke/SKILL.mddocs/dev/runtime-verification-policy.mddocs/dev/extension-surface-runtime-policy.yaml既存の #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に currentimplement-issuecontract で実装を委譲してください。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 が見つかった場合のみ候補化してください。
起票前に必ず:
を確認してください。
current Step 5 が materialization 対象と判定した場合のみ、main thread から
issue-creatorSubAgent に委譲してください。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 を実装し、少なくとも:
ordered_evidence_match.verified == falseの場合だけ 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.md1 ファイルだけに限定してください。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.md1 ファイルだけです。複数 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 が要求する:
を残してください。
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 に即して:
..traversal 拒否.claude/skills/<name>/SKILL.mdの expected shapeを 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-inskill_text_counterfactualmode の責務が矛盾しないようにしてください。必要な例外は この 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_discriminativetest まで部分一致して AC2 固有 test がなくても green になるような命名にしないでください。各 AC の verification command が意図する test を実際に選択することを確認し、一意な test token / exact selector を使用してください。
12. AC9 evidence の意味
AC9 の Runtime Verification Evidence には、
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 から再取得してください。
claude_livepositive + non_discriminative negativeAC9 が 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:を 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 が要求する:
を 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 候補です。
human_judgment_requiredmax_iterations到達通常の 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 も設定しないでください。
最終報告
終了時に簡潔に以下を報告してください。
discriminativepositivenon_discriminativenegativecontrol_invalidを PASS にしていないことの terminal result
途中で調査報告だけを返して終了せず、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 を待つことです。
fix: F1 F2 F3 output dir 排他取得・中断時の子 process 停止・cleanup 失敗時の classific…
fix: #2981 旧 tripwire test を counterfactual option 存在の現状へ更新する
feat: skill-invocation runtime smoke に SKILL.md 対照実行 mode を追加する (#2983)
test: body-only lane runtime smoke を counterfactual control に接続する (#2986