Repository navigation
Description
Machine-Readable Contract
contract_schema_version: "v1"
issue_kind: implementation
parent_issue: "none"
goal_ref: "#2570 AC8"
change_kind: fixParent Issue
なし(単独改善。関連: #2570 で発見、#2568 は runtime-smoke isolation の実装元、PR #2708 が既に
task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke() を canonical entrypoint として
実装済み)
Parent Goal Ref
該当なし(Parent Issue なし)
Current Validated Scope
該当なし(Parent Issue なし)
Remaining Parent Gaps
該当なし(Parent Issue なし)
Outcome
scripts/task-context/task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke() を、
Task Context 自身の runtime 検証における唯一の canonical orchestration entrypoint として明文化・
回帰保護する設計変更 PR を作成する。
現状調査(2026-09-24 時点の repository state)で確認済みの事実として、orchestrate_runtime_smoke() は
既に子 generic runner(scripts/agent-ops/run_worktree_agent_runtime_smoke.py)へ、常に
--task-context-scope runtime_smoke と run-scoped isolated --task-context-state-root <isolated-root>
の両方を argv でハードコード的に渡している(#2568 / PR #2708 REQUEST_CHANGES fix_delta item 2 で導入済み)。
また generic runner 自身は --task-context-scope / --task-context-state-root を一切解釈せず、
両方 未指定(None/None)のときは子プロセス env を変更しない(_task_context_env_pairs(None, None) == [])。
この責務分離(generic runner = transport、Task Context semantics = verifier)は #2568/PR #2708 で
意図的に導入されたものであり、本 Issue ではこの境界を変更しない。
本 Issue が実際に発見した事故(#2570 AC8 検証時に production canonical Task Context DB へ余分な行が
書き込まれた件、Issue #2569 に紐づく)は、generic runner のデフォルト挙動が危険だったからではなく、
Task Context の acceptance/runtime-verification 手順が canonical entrypoint
(orchestrate_runtime_smoke()) を経由せず、generic runner を直接 unscoped で起動したことが原因である
(Issue #2570 acceptance comment
#2570 (comment) および本 Issue の
trusted anchor comment
#2744 (comment) で確認済み)。
したがって本 Issue の対応は、caller 側の canonical-route enforcement(呼び出し経路の強制)と
misuse-prevention documentation、および対応する deterministic/live 回帰検証の追加に限定する。
generic runner 側の default behavior 変更(fail-closed 化等)は採用しない。
完了条件は、該当 PR がマージされ、以下が満たされることとする。
orchestrate_runtime_smoke()が常に scope/root pair を子 generic runner へ渡すことを、deterministic
な回帰テストで検証できる。- disposable な shadow canonical root 上での live runtime 実行によって、synthetic/runtime-hook writes
が isolated runtime-smoke 側にのみ入り、shadow canonical 側へ想定外の mutation が入らないことを
確認できる。 .claude/skills/worktree-agent-runtime-smoke/SKILL.mdに、Task Context 自身を検証する場合は
generic runner を direct unscoped で呼ばず canonical entrypoint を使うという normative MUST が
明記されている。
Runtime Verification Applicability
- decision: immediate
- reason: 本 Issue の中心的な検証対象は、canonical entrypoint 経由の runtime-smoke 実行が実際に
production canonical Task Context DB を汚染しないことであり、静的な文字列/構造検証だけでは
証明できない。disposable な shadow canonical state root を用いた実行時 smoke 実行によって
isolation が有効であることを確認する必要がある(docs/dev/runtime-verification-policy.mdの
SKIP 規約・証跡保存・Stop Condition 連動に従う)。
applicable_acs:
- AC2
execution_environment: >
ローカル worktree 上、実 claude CLI が利用可能な環境。一時ディレクトリへ XDG_STATE_HOME を
設定した disposable shadow canonical state root と、runtime-smoke 用の run-scoped isolated
state root の 2 つを用意し、本物の ~/.local/state/loop-protocol/... には一切触れない。
skip_conditions: >
claude CLI が実行環境に存在しない、または起動権限がない場合は SKIP(exit code 77、stdout に
SKIP: プレフィックス)とし、docs/dev/runtime-verification-policy.md の SKIP 規約に従う。
--safe-mode / --restricted 等で project hooks 自体を無効化して SKIP・PASS を偽装しない
(Task Context hooks は production 同様に動作させ、state のみを隔離する)。
fallback_policy: >
fallback 経由(例: _*_fallback: true を含む結果)の「成功」は FAIL として扱う。SKIP を PASS と
誤認しない。
artifact_requirements: >
実行前後の shadow canonical DB における該当 4 テーブル(execution_runs / events /
runtime_locations / projection_outbox)の row identity/content delta、および isolated state
root 側に書き込まれた該当行を、docs/dev/runtime-verification-policy.md の証跡フォーマットに
従って PR に添付する。In Scope
.claude/skills/worktree-agent-runtime-smoke/SKILL.mdの該当記述を、Task Context 自身の runtime
検証では generic runner を direct unscoped で呼ばず、必ず canonical entrypoint
(task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()) を経由することを
normative MUST として明記する形に更新する。- 新規ファイル
tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.pyに、
orchestrate_runtime_smoke()が子 generic runner 呼び出し argv へ常に
--task-context-scope runtime_smokeと run-scoped isolated--task-context-state-rootを渡すことを
検証する deterministic な回帰テストを追加する(invoke_generic_runner相当の呼び出しを monkeypatch
し、実 subprocess を起動せず argv を捕捉する形でよい。tests/task-context/conftest.pyの既存 fixture
を再利用してよい)。既存tests/task-context/test_runtime_smoke_verifier.py自体は変更不要。 - 新規ファイル
tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pyに、
disposable な shadow canonical root(一時XDG_STATE_HOME)+ runtime-smoke 用 isolated state root
を用いた live runtime 検証テストを追加する。synthetic/runtime-hook writes が isolated 側にのみ入り、
shadow canonical 側の該当 4 テーブルへ想定外の mutation が入らないことを、table row count だけでなく
該当行の identity/content delta 比較で検証する。 - 上記テスト容易性のために必要な最小限の範囲で
scripts/task-context/task_context_runtime_smoke_verifier.pyのコメント・docstring・(必要なら)
内部シームを調整する。orchestrate_runtime_smoke()の既存の argv 構築ロジック・責務境界
(実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568/PR feat: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2708)自体は変更しないことを原則とするが、caller が渡すrunner_argv_extraに
予約済みの--task-context-scope/--task-context-state-rootと同名のオプションが含まれた場合に
実効値(子プロセスが実際に解釈する値)が上書きされてしまう構造上の欠陥については、
Task Context 側(orchestrate_runtime_smoke()自身)が所有する argv 構築の順序またはガードのみを
狭く修正してよい。scripts/agent-ops/run_worktree_agent_runtime_smoke.py(generic runner)側の
オプション解釈・デフォルト挙動は本修正でも変更しない(Out of Scope のまま維持する)。 - 現行 AC1(production canonical DB の row count 比較)と、それを検証できていなかった VC
(--help実行、rg -n "既定"のみ)を、上記の deterministic / live 検証へ置き換える。
Out of Scope
scripts/agent-ops/run_worktree_agent_runtime_smoke.pyの--task-context-scope/
--task-context-state-rootの解釈・デフォルト挙動の変更。現行の optional・verbatim additive
passthrough(_task_context_env_pairs(None, None) == []で child env 不変)契約は維持する
(実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568 / PR feat: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2708 の責務境界。generic runner はこの値を一切解釈・検証しない)。scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_task_context_carrier.pyの変更。
generic runner 側の契約を変更しないため、対応するこの回帰テストも変更不要。- 既に production canonical Task Context DB へ書き込まれてしまった、Issue 実装: Herdr cold restartでTask BindingとNative/Claude-GPT runtime flavorを自動復元する #2569 に紐づく余分な行
(execution_runs/events/runtime_locations/projection_outboxの該当行)自体のデータ
クリーンアップの実行。無条件の自動 DELETE を実装・実行しない。 task-contextctl側の scope gate ロジック自体の変更(scripts/task-context/task_contextctl.pyの
責務。実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568 で既に実装済み)。- 実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568 で既に完了した runtime-smoke isolation 実装(
orchestrate_runtime_smoke()の argv 構築・
isolated state root 構築ロジック自体)の再設計。 - 検証: Task Context v1統合runtime acceptanceをNative/Claude-GPT/Herdrで実証する #2570 の残り AC(AC7/AC9 等)の検証作業そのもの。
- 「a) caller 側必須化 / b) runner 側 fail-closed 化」の二択そのものの再検討。本 Issue では
trusted anchor comment(OWNER、
https://github.com/squne121/loop-protocol/issues/2744#issuecomment-5813327260)による disposition
に従い、caller-owned canonical-route enforcement(a 相当、既に部分実装済みの
orchestrate_runtime_smoke()を唯一の canonical entrypoint として明文化・回帰保護する方針)を
採用済み設計として固定する。この判断を実装中に再度対象範囲に含めない。
Acceptance Criteria
- AC1: 新規ファイル
tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.py
に、orchestrate_runtime_smoke()が子 generic runner 呼び出し argv へ常に
--task-context-scope runtime_smokeと run-scoped isolated
--task-context-state-root <isolated-root>の両方を渡すことを検証する deterministic な回帰
テストが存在し、pass する。tests/task-context/ディレクトリ全体の既存テストも pass する。
caller がrunner_argv_extraに予約済みオプション名と同じ--task-context-scope/
--task-context-state-rootを重複指定しても、子プロセスが実際に解釈する実効値が
canonical な予約値のまま保たれることを、argv 内の最初の出現位置だけでなく実効値ベースで
検証する adversarial regression テストが存在し、pass する。 - AC2: disposable な shadow canonical root(一時
XDG_STATE_HOME)上でorchestrate_runtime_smoke()
を実際の real subprocess として実行したとき、synthetic/runtime-hook writes が runtime-smoke
isolated state root 側にのみ着地し、shadow canonical 側の該当 4 テーブル
(execution_runs/events/runtime_locations/projection_outbox)へ想定外の mutation が
入らないことを、row count だけでなく該当行の identity/content delta 比較で確認できる。
project hooks を--safe-mode/--restricted等で無効化する設計は不可(hooks は production
同様に動作させ、state のみを隔離する)。 - AC3:
.claude/skills/worktree-agent-runtime-smoke/SKILL.mdに、Task Context 自身の runtime
検証では generic runner を direct unscoped で呼ばず、必ず canonical entrypoint
(task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()) を経由することが
normative MUST として明記されている。単に「既定」という文字列が存在するだけでは本 AC を
満たさない(該当記述を deterministic に一意な文言で検証する)。
Verification Commands
# targeted: canonical carrier argv/env regression (new file, must not yet exist)
# AC1
# baseline-expect: fail
$ uv run pytest tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.py -v# full existing + new Task Context runtime-smoke regression suite
# AC1
# baseline-expect: pass
$ uv run pytest tests/task-context/ -v# live runtime verification: disposable shadow canonical root + isolated runtime-smoke root
# AC2
# baseline-expect: fail
$ uv run pytest tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py -v# documentation / misuse prevention: normative MUST presence
# AC3
# baseline-expect: fail
$ rg -nF "generic runner を直接 unscoped で呼ばず、必ず canonical entrypoint" .claude/skills/worktree-agent-runtime-smoke/SKILL.mdAllowed Paths
.claude/skills/worktree-agent-runtime-smoke/SKILL.mdscripts/task-context/task_context_runtime_smoke_verifier.pytests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.pytests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
scripts/agent-ops/run_worktree_agent_runtime_smoke.pyの--task-context-scope/
--task-context-state-rootの解釈・デフォルト挙動(optional・verbatim additive passthrough・
None/None で env 不変)を変更する必要が生じた場合。その場合は generic runner 全 consumer への
影響確認を伴う別 Issue とし、本 Issue では実装しない- live runtime 検証を行う場合は、必ず disposable な shadow canonical root(一時
XDG_STATE_HOME)を
用意し、既存の稼働中 canonical DB(~/.local/state/loop-protocol/...)を直接汚染しない - 検証中に production canonical DB へ誤って書き込んでしまった場合は、直ちに作業を中断し、
影響範囲(テーブル・行)を記録した上で人間に報告する - 本 Issue の Out of Scope に記載した「Issue 実装: Herdr cold restartでTask BindingとNative/Claude-GPT runtime flavorを自動復元する #2569 に紐づく余分な行のクリーンアップ」を無条件の
自動 DELETE として実装しない - project hooks を
--safe-mode/--restricted等で無効化することで AC2 の live 検証を PASS させる
実装にしない
Required Skills
なし
Required Design References
docs/dev/runtime-verification-policy.md.claude/skills/worktree-agent-runtime-smoke/SKILL.md- Issue 実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568
- PR feat: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2708
Delivery Rule
1 Issue = 1 PR を原則とする。worktree を切って作業し、Draft PR を既定とする。
Notes for Reviewer
- 本 Issue は元々 検証: Task Context v1統合runtime acceptanceをNative/Claude-GPT/Herdrで実証する #2570 の AC8 検証中に発見した実際の観測事実(production canonical DB への余分な
行の書き込み)に基づいていたが、issue-refinement-loop(2026-09-24)で trusted human anchor comment
(OWNER、https://github.com/squne121/loop-protocol/issues/2744#issuecomment-5813327260)の
REQUEST_CHANGES 判定を反映し、設計を全面的に reframe した。 - 反映した主要な finding:
- P0: 「caller 側必須化」と旧 AC1(generic runner 既定 invocation は絶対 canonical へ書かない)が
論理的に両立しない → 旧 AC1 を撤去し、canonical entrypoint 経由に限定した AC2 へ置き換えた。 - P0: 修正責務を generic runner 側へ寄せる根拠が弱い(実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568/PR feat: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2708 は generic runner=transport /
Task Context semantics=verifier を意図的に分離済み)→ generic runner 側の変更を Out of Scope に
明記し、Allowed Paths からも除外した。 - P0: 旧 AC1 の VC(
--help)が実際には runtime/DB write path を一切検証していなかった →
real subprocess による live 検証(AC2)へ置き換えた。 - P0: 旧 Allowed Paths がどちらの実装案にも不足していた(caller-owned 案では
task_context_runtime_smoke_verifier.py/tests/task-context/test_runtime_smoke_verifier.pyが
scope 外だった)→ Allowed Paths を caller-owned 設計に合わせて更新した。 - P1: production DB の「行数比較」だけでは UPDATE/DELETE+INSERT を見逃し、並行 operator の正当な
書き込みを誤検知しうる → row count に加えて該当行の identity/content delta 比較を AC2 の検証方法
として明記した。 - P1: 旧 AC2 の VC(
rg -n "既定")が単語の存在だけで PASS してしまう弱いオラクルだった →
一意性の高い文言でのマッチに変更した。 - P1: Runtime Verification Applicability が
decision: immediateなのに実 runtime VC・runtime
verification タグ・免除フィールドを欠いていた →<!-- runtime-verification: true -->タグおよび
applicable_acs/execution_environment/skip_conditions/fallback_policy/
artifact_requirementsを追加した。 - P2: 「a/b どちらを採るか実装者が判断できなければ人間レビュー」という Stop Condition は、
anchor comment で設計判断(caller-owned canonical-route enforcement、a 相当)が既に確定済みのため
撤去した。
- P0: 「caller 側必須化」と旧 AC1(generic runner 既定 invocation は絶対 canonical へ書かない)が
- repository 調査(2026-09-24、codebase-investigator SubAgent による独立調査)で、
orchestrate_runtime_smoke()(scripts/task-context/task_context_runtime_smoke_verifier.py:680)が
既に子 generic runner へ--task-context-scope runtime_smokeと isolated state root を
ハードコードで渡していること(PR feat: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2708 で実装済み)、および
tests/task-context/test_runtime_smoke_verifier.pyに現状この argv 構築を直接検証する回帰テストが
存在しないことを確認済み。 - Issue 検証: Task Context v1統合runtime acceptanceをNative/Claude-GPT/Herdrで実証する #2570 acceptance comment
(https://github.com/squne121/loop-protocol/issues/2570#issuecomment-5813015469)は、
Native ↔ Claude-GPT peer discovery の未実施や locator 変更時の resume candidate 見逃しなど、
実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2744 の対象と直接関係しない別の P1 finding を含む(本 Issue の scope には含めない)。 - 2026-09-25、PR 実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745 に対する OWNER trusted レビューコメント
(実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanonical Task Context DBへunscopedで書き込む問題を解消する #2745 (comment) 、F2 finding)を反映し、
「既存の argv 構築ロジックを変更しない」という記述に、caller 側runner_argv_extraによる予約値
shadow を防ぐための狭い例外を追記した(generic runner 側の契約・デフォルト挙動は変更しない)。
Activity
squne121 commentedon Sep 24, 2026
判定
#2744 は
REQUEST_CHANGES相当です。 問題の観測自体は正しいですが、現在の Issue は「どの層で直すか」が未確定なままなのに、AC は一方の設計しか満たせない形になっています。さらに Verification Commands と Allowed Paths が実装方針と噛み合っていません。確認対象の
mainはcfa1cc9a166496d05402372ff0f7baa8bd764e05で、#2744 には現時点でコメント・対応PRはありません。Issue #2744最も重要なのは、これは generic runtime-smoke runner の「危険な設計」が新たに発覚したというより、#2568 で既に用意した Task Context 専用の正規入口を #2570 が通らず、generic runner を直接 unscoped で起動したことで発生した事故だという点です。#2570 acceptance result
敵対的レビュー結果
1. P0 — #2744 は原因レイヤーを取り違えている
#2568 ではこの境界がかなり明確に設計されています。
generic
run_worktree_agent_runtime_smoke.pyは--task-context-scope/--task-context-state-rootを解釈せず、そのまま渡すだけです。両方省略なら従来どおり環境を変更しません。一方、Task Context側にはtask_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()という 「ONE canonical Task Context orchestration entrypoint」 が既にあり、ここでは毎回、を generic runner に渡します。
#2568
PR #2708
current Task Context verifier
実装では
orchestrate_runtime_smoke()の runner argv に scope と state-root がハードコードされています。したがって今回の再発防止で最初に問うべきなのは、
「なぜ #2570 の Task Context acceptance が、このcanonical entrypointではなくgeneric runnerを直接呼べたのか」
です。
ここを直さず generic runner の全 invocation を fail-closed にすると、原因ではなく共有基盤を変更することになります。
2. Claude Code側は「想定どおり」に動いている
ここは外部仕様でも確認できます。
Claude Code は working directory の
.claude/settings.jsonを project settings として読みます。また--settingsは設定ファイル全体を置換するものではなく、指定したキーだけを上書きし、指定していないキーはproject settings側の値が残ります。Claudeさらに hooks はsettings source間で置換ではなくマージされます。
.claude/settings.jsonのproject hooksも実行対象です。Claude特に重要なのは
claude -pです。公式仕様では print/SDK session はworkspace trust dialogを出さず、そのfolderをtrustedとして扱うため、repoにcommitされた.claude/settings.jsonのhookが動作します。Claudeつまり現在の、
は upstream 的には自然な結果です。
generic runnerのバグというより、Task Context verificationがisolated carrierを付けずgeneric laneへ入ったcaller contract violationです。
3. P0 — 「aかbのどちらでもよい」は成立していない
現在のOutcomeは、
から実装者が選べる、としています。
一方AC1は、
です。
aだけではこのACを満たせません。
caller規約をいくら強化しても、人が直接、
と実行した場合の挙動は変わらないからです。
したがって Issue refinement で先に二択にしなければなりません。
私なら今回の前提では aを選び、ACを変更します。
理由はセキュリティではなく、generic runner の再利用性と検証忠実度です。
4. generic runnerのdefault isolation化は、ワークフロー上の副作用が大きい
このrunnerはTask Context専用ではなく、Agent persona、reviewer permission、provider route、Claude-GPT、skill invocationなど多数のruntime smokeから共有されています。
現在のcarrier regression testも、
および「flags省略ならchild envを変えない」を明示的に保証しています。
current carrier regression test
ここを「未指定なら自動disposable root」にすると、無関係なruntime smokeまでTask Context的にはproduction runtimeと異なる環境になります。
たとえば、
が、通常operatorとは異なる状態になる可能性があります。
これは安全になる代わりにruntime smokeの再現性を落とす変更です。
また
--allow-unscoped-canonical-writeを全generic callerへ要求する案も、Task Contextを意識する必要のないconsumerに追加ceremonyを押し付けます。個人開発用途では費用対効果が悪いです。5. P0 — 現Verification CommandsではAC1を一切検証できない
現在のAC1 VCは、
です。
これはClaude runtimeを起動しません。
したがって、
のどれも発生しません。
実装が完全に壊れていても100% PASSできます。
AC2の、
も同様で、「既定」という日本語が1個書かれていればPASSです。
さらにrepository自身のruntime verification policyは
decision: immediateに対しruntime AC、実VC、evidence、SKIP/fallback handlingを要求しています。現在のIssueは自分が参照しているpolicyと整合していません。runtime verification policy6. P0 — Allowed Pathsも実装不能に近い
runner defaultを変更するなら、少なくとも既存の
test_run_worktree_agent_runtime_smoke_task_context_carrier.pyを書き換えなければ、現在の「flags省略時はenv unchanged」というテスト契約と衝突します。
しかし #2744 の Allowed Paths にはこのtestがありません。
逆に私が推すcaller-owned fixなら、
task_context_runtime_smoke_verifier.pyと
tests/task-context/test_runtime_smoke_verifier.pyを改善・回帰検証したいところですが、こちらもscope外です。
つまり現在のAllowed Pathsでは、
aを選んでもbを選んでも、まともな回帰テストを追加しようとするとStop Conditionに入ります。
これは実装前に直した方がよいです。
7. P1 — 「production DBの行数」をoracleにしない方がいい
AC1は4テーブルのrow countをbefore/after比較しています。
これは二方向に弱いです。
まず、
ではrow countが変わらないのでmutationを見逃します。
逆に実際のproduction DBでは、別の通常Claude operatorが同時に
/clearやTask遷移を行っただけでrow countが変わり、#2744のrunが完全に無実でもFAILします。これは #2570 のレビューでも既に問題になった構図です。
検証用production DBを用意すべき
本物の
~/.local/state/...は触らず、たとえば一時的なXDG_STATE_HOMEを使い、を「canonical fallback先のshadow」として作る方がよいです。
ここなら、
です。
新しいharness frameworkは要りません。
8.
--safe-mode/--restrictedで逃げるのも不適切Claude Codeには現在、eval harness向けの
--restrictedがあり、project/user settingsを読み込まない実行ができます。また--safe-modeはhooksなどのcustomizationを無効化します。Claudeしかし今回これを使うべきではありません。
#2568の目的は、
candidate project Task Context hooksをfresh Claude runtimeで実際に動かしながら、stateだけ隔離する
ことだからです。
hooks自体を消してcanonical writeがなくなっても、検証対象を消しているだけです。
ここは現行設計の
を維持するのが正しいです。
推奨する #2744 の設計変更
今回の「個人趣味開発・ワークフローを止めない」という前提なら、私は generic runnerのdefault behaviorを変更しません。
次の契約へreframeするのが最も小さく、既存設計にも合います。
task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()を唯一のcanonical entrypointとする。worktree-agent-runtime-smoke/SKILL.mdには、Task Context自身を検証する場合にgeneric runnerを直接unscopedで呼ばず、canonical verifierを使用することをMUSTで明記する。None/None → env unchanged契約は維持する。Task Context semanticをgeneric runnerへ逆流させない。tests/task-context/test_runtime_smoke_verifier.pyで、canonical entrypointが必ずscope/root pairをchildへ渡すことを回帰検証する。その場合、#2744のAC1も、
ではなく、
に変えるべきです。
これなら #2568/PR #2708 の責務境界を壊さず、今回実際に起きた誤用経路を閉じられます。
逆に、どうしても 「generic runnerを直接叩いても絶対canonicalへ書かせたくない」 をOutcomeにするなら、a) caller必須化は選択肢から削除し、b) runner-level default isolationを明示決定すべきです。その場合は既存carrier testsとgeneric runner全consumerへの影響確認をscopeに含める必要があります。
結論
#2744で直す価値がある問題そのものは実在します。ただ、現在のIssueは 「Task Context verificationのcaller bug」を「generic harnessのdefault bug」として扱いかけているのが最大の問題です。
このまま実装へ進むより、まず #2744 を caller-owned canonical route固定へrefinementするのが、品質と日常の開発速度の両方に最も合います。
## 判定#2744 は
REQUEST_CHANGES相当です。 問題の観測自体は正しいですが、現在の Issue は「どの層で直すか」が未確定なままなのに、AC は一方の設計しか満たせない形になっています。さらに Verification Commands と Allowed Paths が実装方針と噛み合っていません。確認対象の
mainはcfa1cc9a166496d05402372ff0f7baa8bd764e05で、#2744 には現時点でコメント・対応PRはありません。[Issue #2744](https://github.com/squne121/loop-protocol/issues/2744?utm_source=chatgpt.com)最も重要なのは、これは generic runtime-smoke runner の「危険な設計」が新たに発覚したというより、#2568 で既に用意した Task Context 専用の正規入口を #2570 が通らず、generic runner を直接 unscoped で起動したことで発生した事故だという点です。[#2570 acceptance result](#2570)
敵対的レビュー結果
--helpはClaudeを起動せず、hookもDB writeも発生しないので、AC1が常に偽陽性PASSできる--task-context-*無し=必ずunscopedではないrg "既定"だけdecision: immediateなのに実runtime VCがなく、動的ACにruntime-verification markerもない1. P0 — #2744 は原因レイヤーを取り違えている
#2568 ではこの境界がかなり明確に設計されています。
generic
run_worktree_agent_runtime_smoke.pyは--task-context-scope/--task-context-state-rootを解釈せず、そのまま渡すだけです。両方省略なら従来どおり環境を変更しません。一方、Task Context側にはtask_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()という 「ONE canonical Task Context orchestration entrypoint」 が既にあり、ここでは毎回、を generic runner に渡します。
[#2568](https://github.com/squne121/loop-protocol/issues/2568?utm_source=chatgpt.com)
[PR #2708](https://github.com/squne121/loop-protocol/pull/2708?utm_source=chatgpt.com)
[current Task Context verifier](https://github.com/squne121/loop-protocol/blob/cfa1cc9a166496d05402372ff0f7baa8bd764e05/scripts/task-context/task_context_runtime_smoke_verifier.py?utm_source=chatgpt.com)
実装では
orchestrate_runtime_smoke()の runner argv に scope と state-root がハードコードされています。したがって今回の再発防止で最初に問うべきなのは、
「なぜ #2570 の Task Context acceptance が、このcanonical entrypointではなくgeneric runnerを直接呼べたのか」
です。
ここを直さず generic runner の全 invocation を fail-closed にすると、原因ではなく共有基盤を変更することになります。
2. Claude Code側は「想定どおり」に動いている
ここは外部仕様でも確認できます。
Claude Code は working directory の
.claude/settings.jsonを project settings として読みます。また--settingsは設定ファイル全体を置換するものではなく、指定したキーだけを上書きし、指定していないキーはproject settings側の値が残ります。:chatgpt-content-reference{index="5"}さらに hooks はsettings source間で置換ではなくマージされます。
.claude/settings.jsonのproject hooksも実行対象です。:chatgpt-content-reference{index="6"}特に重要なのは
claude -pです。公式仕様では print/SDK session はworkspace trust dialogを出さず、そのfolderをtrustedとして扱うため、repoにcommitされた.claude/settings.jsonのhookが動作します。:chatgpt-content-reference{index="7"}つまり現在の、
は upstream 的には自然な結果です。
generic runnerのバグというより、Task Context verificationがisolated carrierを付けずgeneric laneへ入ったcaller contract violationです。
3. P0 — 「aかbのどちらでもよい」は成立していない
現在のOutcomeは、
から実装者が選べる、としています。
一方AC1は、
です。
aだけではこのACを満たせません。
caller規約をいくら強化しても、人が直接、
と実行した場合の挙動は変わらないからです。
したがって Issue refinement で先に二択にしなければなりません。
私なら今回の前提では aを選び、ACを変更します。
理由はセキュリティではなく、generic runner の再利用性と検証忠実度です。
4. generic runnerのdefault isolation化は、ワークフロー上の副作用が大きい
このrunnerはTask Context専用ではなく、Agent persona、reviewer permission、provider route、Claude-GPT、skill invocationなど多数のruntime smokeから共有されています。
現在のcarrier regression testも、
および「flags省略ならchild envを変えない」を明示的に保証しています。
current carrier regression test
ここを「未指定なら自動disposable root」にすると、無関係なruntime smokeまでTask Context的にはproduction runtimeと異なる環境になります。
たとえば、
が、通常operatorとは異なる状態になる可能性があります。
これは安全になる代わりにruntime smokeの再現性を落とす変更です。
また
--allow-unscoped-canonical-writeを全generic callerへ要求する案も、Task Contextを意識する必要のないconsumerに追加ceremonyを押し付けます。個人開発用途では費用対効果が悪いです。5. P0 — 現Verification CommandsではAC1を一切検証できない
現在のAC1 VCは、
です。
これはClaude runtimeを起動しません。
したがって、
のどれも発生しません。
実装が完全に壊れていても100% PASSできます。
AC2の、
rg -n "既定" .claude/skills/worktree-agent-runtime-smoke/SKILL.mdも同様で、「既定」という日本語が1個書かれていればPASSです。
さらにrepository自身のruntime verification policyは
decision: immediateに対しruntime AC、実VC、evidence、SKIP/fallback handlingを要求しています。現在のIssueは自分が参照しているpolicyと整合していません。runtime verification policy6. P0 — Allowed Pathsも実装不能に近い
runner defaultを変更するなら、少なくとも既存の
test_run_worktree_agent_runtime_smoke_task_context_carrier.pyを書き換えなければ、現在の「flags省略時はenv unchanged」というテスト契約と衝突します。
しかし #2744 の Allowed Paths にはこのtestがありません。
逆に私が推すcaller-owned fixなら、
task_context_runtime_smoke_verifier.pyと
tests/task-context/test_runtime_smoke_verifier.pyを改善・回帰検証したいところですが、こちらもscope外です。
つまり現在のAllowed Pathsでは、
aを選んでもbを選んでも、まともな回帰テストを追加しようとするとStop Conditionに入ります。
これは実装前に直した方がよいです。
7. P1 — 「production DBの行数」をoracleにしない方がいい
AC1は4テーブルのrow countをbefore/after比較しています。
これは二方向に弱いです。
まず、
ではrow countが変わらないのでmutationを見逃します。
逆に実際のproduction DBでは、別の通常Claude operatorが同時に
/clearやTask遷移を行っただけでrow countが変わり、#2744のrunが完全に無実でもFAILします。これは #2570 のレビューでも既に問題になった構図です。
検証用production DBを用意すべき
本物の
~/.local/state/...は触らず、たとえば一時的なXDG_STATE_HOMEを使い、を「canonical fallback先のshadow」として作る方がよいです。
ここなら、
です。
新しいharness frameworkは要りません。
8.
--safe-mode/--restrictedで逃げるのも不適切Claude Codeには現在、eval harness向けの
--restrictedがあり、project/user settingsを読み込まない実行ができます。また--safe-modeはhooksなどのcustomizationを無効化します。:chatgpt-content-reference{index="10"}しかし今回これを使うべきではありません。
#2568の目的は、
candidate project Task Context hooksをfresh Claude runtimeで実際に動かしながら、stateだけ隔離する
ことだからです。
hooks自体を消してcanonical writeがなくなっても、検証対象を消しているだけです。
ここは現行設計の
を維持するのが正しいです。
推奨する #2744 の設計変更
今回の「個人趣味開発・ワークフローを止めない」という前提なら、私は generic runnerのdefault behaviorを変更しません。
次の契約へreframeするのが最も小さく、既存設計にも合います。
task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()を唯一のcanonical entrypointとする。worktree-agent-runtime-smoke/SKILL.mdには、Task Context自身を検証する場合にgeneric runnerを直接unscopedで呼ばず、canonical verifierを使用することをMUSTで明記する。None/None → env unchanged契約は維持する。Task Context semanticをgeneric runnerへ逆流させない。tests/task-context/test_runtime_smoke_verifier.pyで、canonical entrypointが必ずscope/root pairをchildへ渡すことを回帰検証する。その場合、#2744のAC1も、
ではなく、
に変えるべきです。
これなら #2568/PR #2708 の責務境界を壊さず、今回実際に起きた誤用経路を閉じられます。
逆に、どうしても 「generic runnerを直接叩いても絶対canonicalへ書かせたくない」 をOutcomeにするなら、a) caller必須化は選択肢から削除し、b) runner-level default isolationを明示決定すべきです。その場合は既存carrier testsとgeneric runner全consumerへの影響確認をscopeに含める必要があります。
結論
#2744で直す価値がある問題そのものは実在します。ただ、現在のIssueは 「Task Context verificationのcaller bug」を「generic harnessのdefault bug」として扱いかけているのが最大の問題です。
このまま実装へ進むより、まず #2744 を caller-owned canonical route固定へrefinementするのが、品質と日常の開発速度の両方に最も合います。
squne121 commentedon Sep 24, 2026
確認した範囲では、対象コメント
#issuecomment-5813327260の指摘を trusted human-context anchor としてissue-refinement-loopに投入し、Issue #2744 自体を caller-owned canonical route に再定義するのが適切です。現行
worktree-agent-runtime-smokeは--task-context-*を「解釈しない transport」と明記しており、task_context_runtime_smoke_verifier.pyが Task Context semantics を所有しています。またissue-refinement-loop自体はloop_iteration_approval_gate.default_required: falseなので、通常のneeds-fix → rewrite → re-reviewは人間承認なしで継続できます。推奨する refinement の着地点は次です。
None/None → child env unchangedは維持する。task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()に固定する。runtime_smokescope + run-scoped state root を付与し、production canonical DB に synthetic write を送らない」へ変更する。--helpとrg "既定"は VC として不十分なので廃止。canonical verifier の targeted regression test と disposable/shadow canonical root を使った live VC に置換する。scripts/task-context/task_context_runtime_smoke_verifier.pyとtests/task-context/test_runtime_smoke_verifier.pyを追加する。generic runner 本体は調査で必要性が立証されない限り変更対象にしない。codebase-investigator、必要ならweb-researcher、rewrite のissue-editorを使い、起動した全 SubAgent の terminal completion を待ってから次工程へ進む。approveになるところまで。そのまま対話中の Claude Code に渡すなら、以下を推奨します。
Issue #2744 を、以下の human review anchor を起点として
issue-refinement-loopで refinement してください。Target Issue:
#2744
Trusted human-context anchor:
#2744 (comment)
使用する skill:
.claude/skills/issue-refinement-loop/SKILL.md目的:
対象コメントの REQUEST_CHANGES findings を Issue #2744 の live contract に反映し、Issue 本文を implementation-ready な状態まで改善してください。
実行方針
issue-refinement-loopのloop_iteration_approval_gate.default_required: falseに従い、needs-fix → rewrite → fresh review を自律的に継続してください。with_human_contextroute を使用してください。max_iterationsは 6 を上限として開始してください。必須 SubAgent 方針
issue-refinement-loopが要求する SubAgent を実際に使用してください。特に:
codebase-investigatorを使用して current repository state を独立調査する。web-researcherを使用する。issue-editorを使用する。重要:
今回の設計 disposition
対象 anchor のレビュー結果を踏まえ、Issue #2744 は次の方向へ reframe してください。
1. ownership
generic:
scripts/agent-ops/run_worktree_agent_runtime_smoke.pyは Task Context 専用 runner ではなく generic transport として維持してください。
現行の:
--task-context-scope--task-context-state-rootについて、
None/Noneなら child env を変更しないという #2568 / PR #2708 の責務境界を、今回の理由だけで変更しないでください。
Task Context runtime verification の semantic ownership は:
scripts/task-context/task_context_runtime_smoke_verifier.py側に維持してください。
2. canonical entrypoint
Task Context 自身を runtime verification する場合は、
task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()を唯一の canonical orchestration entrypoint とする contract にしてください。
この canonical entrypoint は child generic runner に必ず:
--task-context-scope runtime_smokeおよび run-scoped isolated:
--task-context-state-root <isolated-root>を渡すものとしてください。
Task Context acceptance / runtime verification procedure から generic runner を direct unscoped invocation する経路を禁止してください。
3. 現 Issue の二択を解消
現在の Issue にある:
という未確定設計は削除してください。
今回の refinement では caller-owned canonical-route enforcement を採用済み設計として固定してください。
「a/b のどちらを採るか実装者が判断できなければ人間レビュー」という Stop Condition も削除してください。
その設計判断は、この trusted human anchor によって既に解決済みです。
Acceptance Criteria の修正
現在の AC1:
「task-context flags を指定しない generic runner の既定 invocation でも production canonical DB が変化しない」
は caller-only design と論理的に両立しないため、その形のまま残さないでください。
少なくとも以下の意味を acceptance contract にしてください。
AC: canonical carrier
canonical Task Context runtime-smoke entrypoint から起動された child runtime は常に:
runtime_smokeを持つこと。
AC: production isolation
canonical Task Context runtime verification が発生させる synthetic/runtime-hook writes が production canonical Task Context DB に流入しないこと。
AC: deterministic regression
tests/task-context/test_runtime_smoke_verifier.py等で、canonical orchestration entrypoint が generic runner argv/env に scope/root pair を必ず渡すことを deterministic regression test で検証できること。AC: documentation / misuse prevention
.claude/skills/worktree-agent-runtime-smoke/SKILL.mdに、Task Context 自身を検証するときは generic runner を direct unscoped で呼ばず、canonical Task Context verifier を使う
という normative MUST を明記すること。
単に「既定」という文字列が存在することを AC にしないでください。
Verification Commands の修正
現状の:
run_worktree_agent_runtime_smoke.py ... --helpは runtime を起動せず DB write path も通らないため AC oracle として使用しないでください。
また:
rg -n "既定" ...だけで normative contract を PASS にしないでください。
VC は current repository state を調査して具体化し、最低限:
を組み込んでください。
live VC では本物の:
~/.local/state/loop-protocol/...を検証対象として直接汚染しないでください。
一時的な
XDG_STATE_HOME等を用いて shadow canonical root を作り、を完全に disposable な環境内で分離してください。
単純な table row count だけを oracle にせず、必要に応じて relevant row identity/content delta を比較し、
ことを検証できる contract にしてください。
--safe-mode/--restricted等で project hooks 自体を無効化して PASS にする設計にはしないでください。検証対象の Task Context hooks は production 同様に動かし、state だけを isolation してください。
Allowed Paths の再評価
現在の Allowed Paths は採用する caller-owned design と一致していません。
current repository を調査したうえで、少なくとも必要性を評価してください:
.claude/skills/worktree-agent-runtime-smoke/SKILL.mdscripts/task-context/task_context_runtime_smoke_verifier.pytests/task-context/test_runtime_smoke_verifier.pydocs/dev/runtime-verification-policy.md(実際に contract/evidence 更新が必要な場合のみ)generic runner:
scripts/agent-ops/run_worktree_agent_runtime_smoke.pyおよび carrier regression tests は、今回の caller-owned design で変更が不要なら Allowed Paths から外してください。
「念のため」で scope を広げないでください。
一方、実際の regression test を書くために必要な path は漏らさないでください。
Related evidence
少なくとも以下を current state で参照してください。
検証: Task Context v1統合runtime acceptanceをNative/Claude-GPT/Herdrで実証する #2570 (comment)
.claude/skills/worktree-agent-runtime-smoke/SKILL.mdscripts/task-context/task_context_runtime_smoke_verifier.pytests/task-context/test_runtime_smoke_verifier.pyscripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_task_context_carrier.pydocs/dev/runtime-verification-policy.md過去コメントの prose より current repository state と current live Issue contract を優先してください。
Scope discipline
今回は Issue refinement のみです。
follow-up candidate が見つかった場合も、今回の Issue contract に不可欠でなければ observation として記録するだけにしてください。
Loop completion
rewrite 後は必ず:
まで実行してください。
一度 Issue 本文を書き換えただけで終了しないでください。
fresh review が current live body に対して
approve/ implementation-ready 相当になるまで、自動 iteration を継続してください。max iteration 到達、canonical skill hard-stop、environment/integrity failure の場合だけ停止し、原因と残 blocker を正確に報告してください。単なる設計選択や reviewer feedback の適用について人間承認を要求しないでください。
最終報告
最後に簡潔に以下を報告してください。
途中経過だけで終了せず、SubAgent completion と canonical loop termination まで完遂してください。
このプロンプトでは、レビューコメントが問題視した最大点である「実装者に a/b を選ばせたまま、AC は b しか満たせない」という矛盾を最初から除去しています。これにより refinement-loop が同じ設計判断で
human_judgment_requiredに戻る可能性も下げられます。squne121 commentedon Sep 24, 2026
issue-refinement-loop 終了報告(approved)
trusted anchor comment(OWNER、issuecomment-5813327260)の REQUEST_CHANGES 判定を反映し、Issue 本文を全面的に reframe しました。
反映した主な設計変更
scripts/agent-ops/run_worktree_agent_runtime_smoke.py)の--task-context-scope/--task-context-state-rootは optional・verbatim additive passthrough のまま維持(実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568/PR feat: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2708 の責務境界を変更しない)。scripts/task-context/task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()を Task Context 自己検証の唯一の canonical entrypoint として明文化・回帰保護する方針に固定(既に実装済みであることを codebase-investigator で確認)。--help実行、rg -n "既定")を、targeted pytest(新規専用テストファイル参照、baseline exit 4 パターン)+ 既存 regression suite + live 検証 + 一意な文言での doc 検証へ置き換え。<!-- runtime-verification: true -->タグとapplicable_acs/execution_environment/skip_conditions/fallback_policy/artifact_requirementsを追加。task_context_runtime_smoke_verifier.pyと新規2テストファイルを追加)。iteration 経過
-k未存在名指定が exit 5 hard-block)assessment: clear(findings なし)使用 SubAgent
codebase-investigator(Step 1、current repository state 独立調査)issue-editor×3(Step 4 rewrite、iteration 1/2/3)issue-design-reviewer×2(Step 2.5 semantic design review、iteration 2/3 の live body に対して)全 SubAgent は terminal completion まで join 済みです。
web-researcherは disposition に外部仕様の追加調査が不要だったため起動していません(anchor comment 自身が Claude Code hooks/settings の外部仕様引用を含んでいましたが、これは設計判断の根拠説明であり本 Issue の AC/VC/Allowed Paths の disposition 自体を左右しないため)。Scope discipline
本サイクルは Issue refinement のみです。tracked file の実装変更・PR 作成・merge・auto-merge 設定・#2569 production DB への DELETE・新規 follow-up Issue の自動起票は一切行っていません。
terminal status: approved
squne121 commentedon Sep 24, 2026
現状では、そのまま
impl-review-loopに移行するのが妥当です。Issue #2744 は refinement が 3 iteration で approved まで完了しており、caller-owned canonical-route enforcement、AC1〜AC3、Allowed Paths、live runtime verification の契約が確定しています。現時点の GitHub 検索では #2744 に対応する PR は見つかりませんでしたが、実行時にはimpl-review-loop自身の Evidence-Based Landing Disposition を正本として再確認させるべきです。特に今回のポイントは、ユーザーのこの指示を branch publish / PR 作成・更新までの事前承認として扱わせることです。
open-prはpublish: yesを要求するため、ここを明示しないと途中で不要な承認待ちになります。一方、merge / auto-merge は許可しないよう境界を固定します。また AC2 は通常の unit test とは違い、実 Claude runtime と project hooks を使う live verification です。production の canonical DB は触らず disposable
XDG_STATE_HOMEを使い、SKIPや fallback success を PASS にしないことを強調しています。以下を、そのまま現在 auto mode で起動中の Claude Code に渡す形を推奨します。
Issue #2744 を対象に、
.claude/skills/impl-review-loop/SKILL.mdの canonical procedure に従って、実装 → 独立検証 → PR review → fix loop を自律実行し、merge 直前のdraft_pr_ready/ merge-ready 状態まで進めてください。Target Issue:
#2744
使用する skill:
.claude/skills/impl-review-loop/SKILL.mdRepository:
squne121/loop-protocol目的
Issue #2744 の live contract を実装し、Verification Commands と current-head PR review を通過させ、
impl-review-loopの canonical terminal route がapprovedとなるところまで進めてください。PR の merge 自体は実行しないでください。
auto-merge も設定しないでください。
それ以外の通常の実装・修正・push・PR 作成/更新・レビュー反映について、iteration ごとの人間承認は要求しないでください。
Human authorization / publish authorization
この root prompt 自体を、今回の Issue #2744 に限定した以下の明示的な human authorization として扱ってください。
open-prskill へのpublish: yesupdate_branchactionこれらについて追加の human approval を要求しないでください。
ただし以下は authorization に含めません。
Loop policy
max_iterations: 6通常の
Implementation → Verification → PR Review → Judgmentを自律的に反復してください。
以下だけを理由に人間へ戻らないでください。
human_review_required: true自己申告impl-review-loopの canonical routing を優先し、continue_loop→ fix_delta を渡して次 iterationroute_to_update_branch→ worker に update_branch を委譲し、その後 Verification + PR Review を再実行route_stale_head_rereview→ current head で再 reviewroute_scope_clean_reconciliation→ canonical reconciliation を実行して resumeとしてください。
Root-owned entry transition
過去の refinement コメントや過去の
approvedreport を Step 1 authorization として再利用しないでください。root/main thread が current run 内で canonical Root-Owned Synchronous Entry Transition を実行してください。
すなわち current live state に対して、
issue-contract-reviewinvoke_impl_review_loopの場合のみ同じ control flow 内で Step 1まで進めてください。
過去コメントは evidence / telemetry として参照して構いませんが、authorization packet として扱わないでください。
Pre-Step-1 duplicate-dispatch gate
worker dispatch、worktree 作成、新規 PR 作成より前に、必ず canonical Evidence-Based Landing Disposition を実行してください。
build_intake_capsule.py --include-implementation-landed-evidenceおよび current canonical producer/consumer を使用し、返された
pre_step1_data_plane/ disposition を自己解釈せず従ってください。existing_pr_resume→ 既存 PR を resume。重複 PR を作成しないimplementation_already_landed→ worker / worktree / new PR を開始しないalready_satisfied→ canonical recommendation を報告し、不要な PR を作らないordinary_dispatch_or_explicit_recovery→ Step 1 へreconciliation_required→ canonical reconciliation を優先外部からの単純な PR 検索結果だけを landing authority にしないでください。
Issue #2744 の確定設計
live Issue 本文を SSOT としてください。
今回の設計 ownership は既に refinement 済みです。
generic runner:
scripts/agent-ops/run_worktree_agent_runtime_smoke.pyの以下の契約は変更しないでください。
--task-context-scopeは optional--task-context-state-rootは optionalTask Context runtime verification の semantic ownership は:
scripts/task-context/task_context_runtime_smoke_verifier.pyに維持してください。
Task Context 自己検証の唯一の canonical orchestration entrypoint は:
task_context_runtime_smoke_verifier.py::orchestrate_runtime_smoke()です。
この entrypoint が child generic runner に常に:
--task-context-scope runtime_smokeと run-scoped isolated:
--task-context-state-root <isolated-root>を渡す契約を回帰保護してください。
generic runner の default behavior を fail-closed 化する方向へ scope を広げないでください。
Allowed Paths
live Issue 本文を最終正本としたうえで、現在の contract では変更を以下に限定してください。
.claude/skills/worktree-agent-runtime-smoke/SKILL.mdscripts/task-context/task_context_runtime_smoke_verifier.pytests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.pytests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.pyAllowed Paths 外の変更が必要になった場合は勝手に scope を拡大しないでください。
特に以下は本 Issue では変更しないでください。
scripts/agent-ops/run_worktree_agent_runtime_smoke.pytask-contextctlの scope gateStep 1 — implementation-worker
canonical
implementation-workerSubAgent を使用し、.claude/skills/implement-issue/SKILL.mdを実行させてください。root thread 自身が implementation edit を代行しないでください。
initial iteration と各 fix iteration で、実際の値を materialize した message を渡してください。
少なくとも以下を bind してください。
placeholder のまま child に渡さないでください。
SubAgent completion — 必須
SubAgent は fire-and-forget にしないでください。
implementation-worker、test-runner、pr-reviewer、および loop 中に canonical procedure が起動するその他すべての SubAgentについて、Common Completion Protocol を厳守してください。
各 SubAgent ごとに:
wait_agentで activity を待つlist_agentsで同じ canonical task の terminal state がcompletedであることを確認するcompletedの両方を確認してから次 Step へ進む以下を completion とみなさないでください。
completedstate だけerrored/interrupted/shutdown/not_foundは成功扱いしないでください。background task / 未join SubAgent が残っている状態で最終報告しないでください。
nested delegation が各 agent contract または Issue Stop Conditions に抵触する場合は行わないでください。
Step 2 — independent Verification
Step 1 の自己検証結果だけで PASS としないでください。
必ず canonical
test-runnerSubAgent を新規 task として使用し、current PR head に対する独立 verification を実行してください。test-runner には live Issue の:
を materialize して渡してください。
Verification Commands は live Issue 本文にある literal commands を改変・省略・代替しないでください。
現在の主要 VC は以下です。実行時には必ず live Issue readback と照合してください。
uv run pytest tests/task-context/test_runtime_smoke_verifier_canonical_carrier_regression.py -vuv run pytest tests/task-context/ -vuv run pytest tests/task-context/test_runtime_smoke_verifier_live_shadow_isolation.py -vrg -nF "generic runner を直接 unscoped で呼ばず、必ず canonical entrypoint" .claude/skills/worktree-agent-runtime-smoke/SKILL.mdtest-runner completion 後、root は current PR head SHA と report head SHA、および literal command hashes を独立照合し、canonical
VC_ADJUDICATION_RESULT_V1を生成してください。blocking == falseが current head に対して成立するまで Step 4 の pr-reviewer を起動しないでください。AC2 live runtime verification
AC2 は特に厳密に扱ってください。
本物の production canonical state:
~/.local/state/loop-protocol/...を検証 target として直接使用・mutation しないでください。
一時ディレクトリの
XDG_STATE_HOME等を利用して disposable shadow canonical state root を作成し、その disposable environment 内で:を分離してください。
実 Claude CLI / real subprocess を使い、project hooks は production 同様に有効な状態で実行してください。
以下で AC2 を見かけ上 PASS させないでください。
--safe-mode--restricted検証では該当 4 テーブル:
execution_runseventsruntime_locationsprojection_outboxについて、row count だけでなく relevant row identity / content delta を比較してください。
成功条件は少なくとも:
ことです。
SKIPは PASS ではありません。claude CLI unavailable 等、Issue contract に定義された正当な SKIP condition の場合は exit 77 /
SKIP:evidence を保持し、canonical adjudication で blocking として扱ってください。fallback path (
_*_fallback: true等) による「成功」も PASS にしないでください。production canonical DB への accidental write を検知した場合は即時停止し、対象 table / row evidence を保存して報告してください。自動 DELETE しないでください。
Step 4 — current-head PR review
Step 2 の current-head VC adjudication が nonblocking になった後でのみ、canonical
pr-reviewerSubAgent を起動してください。spawn 直前に canonical current-head gate を再評価してください。
以下のいずれかが stale / malformed なら pr-reviewer を起動せず Step 2 に戻してください。
required CI は canonical
wait_ci_checks.sh --requiredroute で current head に対して評価してください。pr-reviewer の結果についても、final result + terminal
completedの両方を確認してください。root/control-plane は reviewer が返す:
verdictreviewed_head_shablockerswarningsのみを canonical reviewer convention として扱い、mergeability は root が live GitHub state から独立取得してください。
REQUEST_CHANGES loop
REQUEST_CHANGESは通常の loop continuation です。人間承認を求めず:
fix_deltaに変換を繰り返してください。
レビュー blocker を root thread が直接編集して直さないでください。
Mergeability
APPROVE単独では終了しないでください。current live:
mergeable == MERGEABLEmerge_state_status in {CLEAN, HAS_HOOKS}blockers == []を canonical routing で確認して
approvedに到達してください。BEHINDは conflict ではありません。canonical
update_branchaction を implementation-worker に委譲し、その後 Verification と PR Review を current head で再実行してください。stale reviewed head は human escalation にせず re-review してください。
一時的な
UNKNOWNは skill の bounded retry に従ってください。actual:
mergeable == CONFLICTINGmerge_state_status == DIRTYのみ、canonical conflict hard-stop に従ってください。
Human-stop boundary
通常の loop iteration では人間承認を要求しないでください。
ただし canonical skill / live Issue が要求する genuine hard stop は迂回しないでください。
例:
HUMAN_REVIEW_REQUIRED単なる reviewer feedback や実装選択を hard stop に昇格させないでください。
External research
今回の Issue は current repository contract と既存 runtime behavior が中心なので、外部仕様調査は default では不要です。
外部仕様が実装または review disposition に実際に必要になった場合だけ、impl-review-loop が定義する canonical external-research route を使用してください。
不要なら
LOOP_STATE.external_research_skip_basisに理由を記録してください。Scope discipline
以下を禁止します。
--no-verifygit add -Agit add .follow-up candidate を発見した場合は、current Issue contract に不可欠でない限り observation として残してください。
Terminal target
目標 terminal route:
approved目標 output:
IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_readyただしこれは GitHub の Draft flag そのものとは別概念であることに注意してください。
canonical skill が current PR を merge-ready にするための Ready-for-review transition を定義している場合は、その canonical route に従ってください。
merge はしないでください。
termination_reason: approvedを立てる前に canonicalAUTONOMY_POLICY_V1validator を実際の終了 report に対して実行し、pass を確認してください。最終報告
最終的に以下を簡潔に報告してください。
completed済みであることroute_loop_verdict_v2()routeIMPL_REVIEW_LOOP_RESULT_V1途中の実装完了や PR 作成だけで終了せず、canonical Verification、PR Review、SubAgent join、Step 5 terminal routing まで完遂してください。
参照した current state は Issue #2744、[refinement 完了報告](https://github.com/squne121/loop-protocol/issues/2744#issuecomment-5813790412)、および現行
[impl-review-loop](https://github.com/squne121/loop-protocol/blob/main/.claude/skills/impl-review-loop/SKILL.md)です。特にopen-prのpublish: yes承認ゲートを最初から解決している点が、今回の「承認不要でマージ直前まで」という意図に対して重要です。test: AC2 live shadow isolation テストに runtime-verification-policy.md 準…
squne121 commentedon Sep 24, 2026
implement-issue: 実装完了 (2026-09-24T13:25:36Z)
.claude/worktrees/issue-2744-task-context-runtime-smoke-canonical-entrypointworktree-issue-2744-task-context-runtime-smoke-canonical-entrypointsqune121 commentedon Sep 24, 2026
impl-review-loop: 完了 (2026-09-24T13:50:00Z)
squne121 commentedon Sep 24, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Sep 24, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
fix: PR #2745 review F1-F5 — canonical-carrier ordering, required Tas…
fix: F1 narrow AC2 live test's result.status assertion to tolerate kn…
実装: worktree-agent-runtime-smoke の structured lane 既定invocationがcanon…