Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "root mission と completion predicates を run-state に固定し、follow-up/compaction 後の短期 goal 置換と未完了 finalization を防止する"
change_kind: workflowParent Issue
none(単独改善)
Parent Goal Ref
- Goal: 元の人間依頼、完了条件、非ゴール、現在 phase が会話 prose にしか存在しないため、「status」「wait」「continue」等の follow-up が短期 objective として扱われ、root task が未完了でも最終回答を返せる問題を解消する。
- Desired Destination: run-local な
root-run-state.jsonに mission/execution/followups を保持し、AGENTS.mdにはその参照だけを短く追加する。
Current Validated Scope
scripts/agent-ops/root_mission_gate.pyの新規追加。ROOT_RUN_STATE_V1の読み書き・followup classification(operational_steer/mission_revision/cancel)・finalization gate 判定を実装するAGENTS.mdへ root-run-state と finalization gate への短い参照を追加(長い procedure は埋め込まない).claude/skills/issue-refinement-loop/references/termination-policy.md(新規)に finalization gate の判定条件を記載- 対応する
scripts/agent-ops/tests/test_root_mission_gate.pyの追加
Remaining Parent Gaps
- compaction そのものの実装(Claude Code / Codex CLI 側の runtime 機能)は本 Issue の対象外
#2050(SubAgent convergence gate)と本 Issue の finalization gate は判定基準の一部が重なるため、#2050merge 後に required child の terminal state 判定を本 gate から呼び出す統合作業が残る
Outcome
scripts/agent-ops/root_mission_gate.py が tmp/agent-runs/<session-id>/root-run-state.json に mission/execution/followups を保持し、「待機時間変更」「続行」「status」等の follow-up が objective を置換しない operational steer として分類され、explicit cancel/supersede だけが mission revision を増加させ、completion predicates が全て true でない限り finalization を拒否するようになり、対応する pytest が PASS している状態。
In Scope
ROOT_RUN_STATE_V1schema と読み書き helper の実装- followup classification(
operational_steer/mission_revision/cancel)ロジックの実装 - compaction/resume 後の objective・current phase・completed checks・pending work の復元ロジック
- completion predicates が全て true でない限り terminal final response を拒否する finalization gate
- progress report と final report を機械的に区別するマーカー
- required mutation の readback・reviewed SHA・gate result 未確定時の finalization 拒否
AGENTS.mdへの短い参照追加
Out of Scope
- raw prompt・raw transcript・secret の state への保存(明示的に禁止)
- 新しい publisher・GitHub artifact・永続 database の追加
- SubAgent lifecycle 照合そのもの(
#2050の責務) - issue-editor / contract_update route の修正(
#2048の責務)
Acceptance Criteria
- AC1: session 開始時に original human objective と completion predicates を固定する
- AC2: 「待機時間変更」「続行」「status」は operational steer となり、objective を置換しない
- AC3: explicit cancel/supersede だけが mission revision を増加させる
- AC4: compaction/resume 後、objective、current phase、completed checks、pending work を復元できる
- AC5: completion predicates が全て true でない限り terminal final response を拒否する
- AC6: progress report と final report を機械的に区別する
- AC7: required mutation の readback、reviewed SHA、gate result が未確定なら finalization を拒否する
- AC8: raw prompt、raw transcript、secret は state に保存しない
- AC9:
AGENTS.mdには run-state/gate への短い参照だけを追加し、長い procedure を埋め込まない
Verification Commands
$ rg -n "def test_status_query_preserves_objective" scripts/agent-ops/tests/test_root_mission_gate.py # AC1
$ rg -n "operational_steer" scripts/agent-ops/root_mission_gate.py # AC2
$ rg -n "def test_explicit_cancel_increments_revision" scripts/agent-ops/tests/test_root_mission_gate.py # AC3
$ rg -n "def test_compaction_resume_restores_state" scripts/agent-ops/tests/test_root_mission_gate.py # AC4
$ rg -n "def test_finalization_denied_when_predicates_false" scripts/agent-ops/tests/test_root_mission_gate.py # AC5
$ rg -n "progress_report" scripts/agent-ops/root_mission_gate.py # AC6
$ rg -n "def test_finalization_denied_without_readback" scripts/agent-ops/tests/test_root_mission_gate.py # AC7
$ rg -c "secret" scripts/agent-ops/root_mission_gate.py # AC8
$ rg -n "root-run-state" AGENTS.md # AC9Allowed Paths
- AGENTS.md
- .claude/skills/issue-refinement-loop/SKILL.md
- .claude/skills/issue-refinement-loop/references/loop-state.md
- .claude/skills/issue-refinement-loop/references/termination-policy.md
- docs/dev/agent-skill-boundaries.md
- scripts/agent-ops/root_mission_gate.py
- scripts/agent-ops/tests/test_root_mission_gate.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
- docs/dev/agent-skill-boundaries.md
Scope Delta(任意)
N/A
Notes for Reviewer
#2050(SubAgent convergence gate)と本 Issue の finalization gate は判定条件の一部が重複しうるため、実装順序は #2050 を先行させ、本 Issue の finalization gate が #2050 の subagent_convergence_gate.py を呼び出す形で統合することを推奨する(Remaining Parent Gaps に記載)。AGENTS.md は .github/CLAUDE.md 相当の編集ガード対象ではないため通常の Allowed Paths 扱いとする。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Aug 12, 2026
何かこの実装には不信感があります。こういう実装やハーネスを追加し続けてきましたが、CodexCLIの出力は安定してきませんでした。基本的には不採用としたいです。
squne121 commentedon Aug 12, 2026
結論
判定:
REJECT / NOT_PLANNEDを推奨します。#2051 の問題意識――長時間の Codex CLI 実行で root objective が薄れ、
statusやcontinueのような短い follow-up に引っ張られる――自体は妥当です。しかし、提案されているROOT_RUN_STATE_V1/root-run-state.json/root_mission_gate.pyは採用しない方がよいです。指定コメントの「こういうハーネスを追加し続けても CodexCLI の出力が安定しなかったので、基本的には不採用にしたい」という判断は、今回調べた限り技術的にもかなり強く支持できます。
敵対的レビュー
重大度 | Finding | 判定 -- | -- | -- P0 | 直近の repository architecture を逆走している | blocker P0 | Codex native /goal と機能が重複している | blocker P0 | AC5「terminal final response を拒否」を現 Allowed Paths では実装できない | blocker P0 | Current Validated Scope が既に stale | blocker P1 | follow-up の独自 semantic classifier が user intent を誤固定する | major P1 | native state / GitHub / root-run-state / #2050 間で split-brain になる | major P1 | Verification Commands が実 runtime behavior を証明していない | majorP0 — #1860 / PR #1875 の minimal-harness 決定を実質的に revert している
#2051 は
tmp/agent-runs/<session-id>/root-run-state.jsonに mission、execution、followups を保存し、compaction/resume 後にも復元する新しいROOT_RUN_STATE_V1を導入しようとしています。しかし親方針 #1860 は、live Issue/PR、実 diff、実 test、current-head CI、独立 review を authority にして、独自 control-plane を増やさないことを明示しています。
さらに PR #1875 は既に merged で、まさに以下を撤去しました。
reviewer_claim_replay_state_store.py、build_loop_state.py、PreCompact のsave_loop_state_before_compaction.sh、state schema、binding digest、専用 publisher などを削除し、「新しい schema / digest / receipt / publisher / state machine は追加しない」という設計へ移行しています。#1889 でもその後、
という方針が固定されています。
したがって #2051 は小さな補修ではなく、2026年7月末〜8月初頭に撤去した control-plane を別名で再導入する提案です。
P0 — Codex 自身が
/goalを実装済みで、問題領域が upstream に吸収されているここが今回最も重要な追加調査結果です。
2026年8月12日時点の OpenAI 公式 Codex ドキュメントには Follow a goal があり、
として、長時間作業を verifiable stopping condition まで継続する用途に
/goalを使うよう明示されています。(ChatGPT Learn)公式手順は、
/goal <objective>で設定、/goalで現在値/status確認、/goal editで objective 変更、/goal pause/resume/clearで lifecycle を操作する、というものです。Codex はこれを「persistent target」と説明しています。(ChatGPT Learn)これは #2051 の、
original objective、completion predicates、operational_steer、mission_revision、cancel、progress/final 区別という設計領域と非常に大きく重複します。
しかも公式ガイド自身が「1つの objective」「1つの stopping condition」「何を変更してはいけないか」「何で進捗を検証するか」を定義し、方向転換時は goal を pause/edit/clear するよう推奨しています。(ChatGPT Learn)
現在の repository
.codex/config.tomlはhooks = trueと Multi-Agent V2 は有効ですが、features.goals = trueはまだ設定されていません。したがって順番は逆です。
独自 state machine を作る前に native
/goalを有効化して runtime evaluation するべきです。P0 — 「final response を拒否する」は現在の #2051 では実現できない
#2051 AC5 は、
としています。AC7 でも readback / reviewed SHA / gate result 未確定なら finalization 拒否を要求しています。
ところが
root_mission_gate.pyを追加しただけでは、Codex がその判定を呼んでくれる production lifecycle connection がありません。Codex 公式には現在
Stophook が存在します。Stopでを返せば、Codex は turn を終わらせず continuation prompt を生成して処理を続けます。
PreCompact/PostCompacthook も公式 lifecycle にあります。(ChatGPT Learn)しかしこの repository の
.codex/hooks.jsonは現在 SessionEnd と SubagentStop の advisory recorder だけです。Stopは登録されていません。これは偶然ではありません。PR #1849 で Codex project-local enforcing harness を P0 quarantine し、
active hook を SessionEnd / SubagentStop に限定
recorder を advisory のみに縮小
enforcement 再導入には別 Issue が必要
と明示的に決定しています。
しかも #2051 の Allowed Paths には
.codex/hooks.jsonすら入っていません。したがって現仕様では、
「gate 関数が deny を返す unit test」は作れても、「Codex の terminal response を拒否する」は作れません。
AC5/AC7 は production reachability を持たない safety claim です。
P0 —
Current Validated Scopeが fresh main と食い違っている#2051 は
としています。
しかし現在の main には 既にそのファイルがあります。しかも小さな placeholder ではなく、
Final Gate — CONTRACT_REVIEW_RESULT_V1.status == "go" 必須など既存 termination semantics がかなり詳細に定義されています。つまり Issue の
Current Validated Scope自体が fresh repository inventory に基づいていません。finalization control-plane を追加する Issue でこのレベルの inventory drift があるのは blocker と見るべきです。
P1 —
explicit cancel/supersede だけ mission_revisionは危険AC3 は「explicit cancel/supersede だけが mission revision を増加」としています。
これは自然言語の user steer を閉じた classifier に押し込む設計として危険です。
たとえばユーザーが途中で、
「PRは作らなくていい」
「今回は調査だけにして」
「そこは対象外にする」
「CIだけでなく実 runtime smoke までやって」
と指示した場合、どれも
cancelやsupersedeという単語を含む必要はありませんが、root mission / completion predicates は変更されています。classifier がこれを
operational_steerと誤判定すると、古い永続 state が新しい user instruction より事実上強くなるという最悪の failure mode が発生します。native
/goal edit/pause/clearは、この曖昧な NLP classification を作らず明示的な control surface で変更を表現できます。(ChatGPT Learn)独自 classifier は不要です。
P1 — authority が5つに分裂する
#2051 を採用すると、少なくとも
Codex native goal / 最新 user message / live GitHub Issue・PR /
ROOT_RUN_STATE_V1/ #2050 convergence gateが並立します。
既に #1889 は live state と local data が競合した場合は live state を優先すると決めています。
一方 #2051 は #2050 を「merge 後に統合する」としており、最初から finalization authority が二重化することを認識しています。
しかも #2050 自体も現在 open /
triage-requiredで、root mission は Out of Scope です。未確定の gate A を前提に gate B を作り、後から統合するのは、この repository が過去に複雑化した典型的なパターンです。
P1 — Verification が「存在確認」であって behavior verification ではない
#2051 の Verification Commands は大半が、
rgで test function 名が存在する、operational_steerという文字列がある、progress_reportがある、AGENTS.mdにroot-run-stateがあるという確認です。AC8 に至っては
rg -c "secret"です。これでは、問題の本体である
「実 Codex が compaction / status follow-up / resume 後にも root mission を維持し、未完了で停止しないか」
を何も証明しません。
過去にハーネスを追加しても出力安定性が改善しなかった、という指定コメントの懸念に対し、また deterministic helper unit test を足すだけでは同じ失敗を繰り返します。
推奨する置き換え
#2051 は
not plannedで close し、問題報告と再現ケースだけ残すのがよいです。代替は「root mission state machine 実装」ではなく、Codex native Goal の評価・最小導入に縮退させます。
features.goals = trueを有効化し、実 Codex CLI で「長時間 task →/goalstatus → follow-up → compaction → continuation →/goal edit/pause/resume/clear」を runtime smoke します。公式にも、goal は長時間作業の durable objective と stopping condition を持たせるための機能として提供されています。(ChatGPT Learn)その際も Issue/PR/current HEAD/diff/tests/CI は completion evidence の authority のままにし、native goal の内容を別 JSON に mirror しません。
ROOT_RUN_STATE_V1、follow-up NLP classifier、progress/final marker schema は作らない方がよいです。もし runtime evaluation の結果、「native
/goalでも未完了 turn が本当に終了してしまい、実害が再現する」ことが確認された場合だけ、次に Codex nativeStophook を検討します。Codex 自体にはその正式な extension point があります。(ChatGPT Learn) ただしこの repository では PR #1849 が enforcement を意図的に quarantine しているので、それは #2051 に紛れ込ませず、明示的な owner decision を伴う別 Issue にすべきです。要するに、**「Codex を制御する独自 control-plane をまた作る」のではなく、「Codex 自身の goal lifecycle を使い、足りないことを runtime evidence で証明してから最小限だけ補う」**方向へ切り替えるのが、このリポジトリの現在の architecture と今回の不信感の双方に整合します。
指定コメントの「基本的には不採用」は維持してよいと判断します。単なる感覚論ではなく、recent architecture reversal・native upstream duplication・production wiring 不在・stale scope の4つの P0 根拠があります。
## 結論判定:
REJECT / NOT_PLANNEDを推奨します。#2051 の問題意識――長時間の Codex CLI 実行で root objective が薄れ、
statusやcontinueのような短い follow-up に引っ張られる――自体は妥当です。しかし、提案されているROOT_RUN_STATE_V1/root-run-state.json/root_mission_gate.pyは採用しない方がよいです。指定コメントの「こういうハーネスを追加し続けても CodexCLI の出力が安定しなかったので、基本的には不採用にしたい」という判断は、今回調べた限り技術的にもかなり強く支持できます。
敵対的レビュー
/goalと機能が重複しているP0 — #1860 / PR #1875 の minimal-harness 決定を実質的に revert している
#2051 は
tmp/agent-runs/<session-id>/root-run-state.jsonに mission、execution、followups を保存し、compaction/resume 後にも復元する新しいROOT_RUN_STATE_V1を導入しようとしています。しかし親方針 #1860 は、live Issue/PR、実 diff、実 test、current-head CI、独立 review を authority にして、独自 control-plane を増やさないことを明示しています。
さらに PR #1875 は既に merged で、まさに以下を撤去しました。
reviewer_claim_replay_state_store.py、build_loop_state.py、PreCompact のsave_loop_state_before_compaction.sh、state schema、binding digest、専用 publisher などを削除し、「新しい schema / digest / receipt / publisher / state machine は追加しない」という設計へ移行しています。#1889 でもその後、
という方針が固定されています。
したがって #2051 は小さな補修ではなく、2026年7月末〜8月初頭に撤去した control-plane を別名で再導入する提案です。
P0 — Codex 自身が
/goalを実装済みで、問題領域が upstream に吸収されているここが今回最も重要な追加調査結果です。
2026年8月12日時点の OpenAI 公式 Codex ドキュメントには Follow a goal があり、
として、長時間作業を verifiable stopping condition まで継続する用途に
/goalを使うよう明示されています。([ChatGPT Learn]1)公式手順は、
/goal <objective>で設定、/goalで現在値/status確認、/goal editで objective 変更、/goal pause/resume/clearで lifecycle を操作する、というものです。Codex はこれを「persistent target」と説明しています。([ChatGPT Learn]2)これは #2051 の、
original objective、completion predicates、operational_steer、mission_revision、cancel、progress/final 区別という設計領域と非常に大きく重複します。
しかも公式ガイド自身が「1つの objective」「1つの stopping condition」「何を変更してはいけないか」「何で進捗を検証するか」を定義し、方向転換時は goal を pause/edit/clear するよう推奨しています。([ChatGPT Learn]1)
現在の repository
.codex/config.tomlはhooks = trueと Multi-Agent V2 は有効ですが、features.goals = trueはまだ設定されていません。したがって順番は逆です。
独自 state machine を作る前に native
/goalを有効化して runtime evaluation するべきです。P0 — 「final response を拒否する」は現在の #2051 では実現できない
#2051 AC5 は、
としています。AC7 でも readback / reviewed SHA / gate result 未確定なら finalization 拒否を要求しています。
ところが
root_mission_gate.pyを追加しただけでは、Codex がその判定を呼んでくれる production lifecycle connection がありません。Codex 公式には現在
Stophook が存在します。Stopで{"decision":"block","reason":"..."}を返せば、Codex は turn を終わらせず continuation prompt を生成して処理を続けます。
PreCompact/PostCompacthook も公式 lifecycle にあります。([ChatGPT Learn]3)しかしこの repository の
.codex/hooks.jsonは現在 SessionEnd と SubagentStop の advisory recorder だけです。Stopは登録されていません。これは偶然ではありません。PR #1849 で Codex project-local enforcing harness を P0 quarantine し、
と明示的に決定しています。
しかも #2051 の Allowed Paths には
.codex/hooks.jsonすら入っていません。したがって現仕様では、
「gate 関数が deny を返す unit test」は作れても、「Codex の terminal response を拒否する」は作れません。
AC5/AC7 は production reachability を持たない safety claim です。
P0 —
Current Validated Scopeが fresh main と食い違っている#2051 は
としています。
しかし現在の main には 既にそのファイルがあります。しかも小さな placeholder ではなく、
Final Gate — CONTRACT_REVIEW_RESULT_V1.status == "go" 必須など既存 termination semantics がかなり詳細に定義されています。つまり Issue の
Current Validated Scope自体が fresh repository inventory に基づいていません。finalization control-plane を追加する Issue でこのレベルの inventory drift があるのは blocker と見るべきです。
P1 —
explicit cancel/supersede だけ mission_revisionは危険AC3 は「explicit cancel/supersede だけが mission revision を増加」としています。
これは自然言語の user steer を閉じた classifier に押し込む設計として危険です。
たとえばユーザーが途中で、
「PRは作らなくていい」
「今回は調査だけにして」
「そこは対象外にする」
「CIだけでなく実 runtime smoke までやって」
と指示した場合、どれも
cancelやsupersedeという単語を含む必要はありませんが、root mission / completion predicates は変更されています。classifier がこれを
operational_steerと誤判定すると、古い永続 state が新しい user instruction より事実上強くなるという最悪の failure mode が発生します。native
/goal edit/pause/clearは、この曖昧な NLP classification を作らず明示的な control surface で変更を表現できます。([ChatGPT Learn]2)独自 classifier は不要です。
P1 — authority が5つに分裂する
#2051 を採用すると、少なくとも
Codex native goal / 最新 user message / live GitHub Issue・PR /
ROOT_RUN_STATE_V1/ #2050 convergence gateが並立します。
既に #1889 は live state と local data が競合した場合は live state を優先すると決めています。
一方 #2051 は #2050 を「merge 後に統合する」としており、最初から finalization authority が二重化することを認識しています。
しかも #2050 自体も現在 open /
triage-requiredで、root mission は Out of Scope です。未確定の gate A を前提に gate B を作り、後から統合するのは、この repository が過去に複雑化した典型的なパターンです。
P1 — Verification が「存在確認」であって behavior verification ではない
#2051 の Verification Commands は大半が、
rgで test function 名が存在する、operational_steerという文字列がある、progress_reportがある、AGENTS.mdにroot-run-stateがあるという確認です。AC8 に至っては
rg -c "secret"です。これでは、問題の本体である
「実 Codex が compaction / status follow-up / resume 後にも root mission を維持し、未完了で停止しないか」
を何も証明しません。
過去にハーネスを追加しても出力安定性が改善しなかった、という指定コメントの懸念に対し、また deterministic helper unit test を足すだけでは同じ失敗を繰り返します。
推奨する置き換え
#2051 は
not plannedで close し、問題報告と再現ケースだけ残すのがよいです。代替は「root mission state machine 実装」ではなく、Codex native Goal の評価・最小導入に縮退させます。
features.goals = trueを有効化し、実 Codex CLI で「長時間 task →/goalstatus → follow-up → compaction → continuation →/goal edit/pause/resume/clear」を runtime smoke します。公式にも、goal は長時間作業の durable objective と stopping condition を持たせるための機能として提供されています。([ChatGPT Learn]1)その際も Issue/PR/current HEAD/diff/tests/CI は completion evidence の authority のままにし、native goal の内容を別 JSON に mirror しません。
ROOT_RUN_STATE_V1、follow-up NLP classifier、progress/final marker schema は作らない方がよいです。もし runtime evaluation の結果、「native
/goalでも未完了 turn が本当に終了してしまい、実害が再現する」ことが確認された場合だけ、次に Codex nativeStophook を検討します。Codex 自体にはその正式な extension point があります。([ChatGPT Learn]3) ただしこの repository では PR #1849 が enforcement を意図的に quarantine しているので、それは #2051 に紛れ込ませず、明示的な owner decision を伴う別 Issue にすべきです。要するに、**「Codex を制御する独自 control-plane をまた作る」のではなく、「Codex 自身の goal lifecycle を使い、足りないことを runtime evidence で証明してから最小限だけ補う」**方向へ切り替えるのが、このリポジトリの現在の architecture と今回の不信感の双方に整合します。
指定コメントの「基本的には不採用」は維持してよいと判断します。単なる感覚論ではなく、recent architecture reversal・native upstream duplication・production wiring 不在・stale scope の4つの P0 根拠があります。
squne121 commentedon Aug 12, 2026
指定コメントは #2051 の既存
ROOT_RUN_STATE_V1案を REJECT / NOT_PLANNED とし、native/goalの runtime evaluation へ置き換える判断です。 現行issue-refinement-loopには、人間 anchor が前提不採用・置換を明示した場合のsuperseded_by_decision終了経路があり、通常 iteration の承認確認は既定で不要です。 現在の main も #1860 / merged PR #1875 の minimal-harness 方針に沿っています。あなたは
squne121/loop-protocolの root/main CodexCLI agent として作業してください。Mission
以下を対象に、repository の現行
issue-refinement-loopを 最後まで実行してください。squne121/loop-protocol#2051https://github.com/squne121/loop-protocol/issues/2051#issuecomment-5267598739この anchor comment は今回、operator が明示的に選択した human context として扱ってください。
目的は Issue #2051 の既存設計を擁護することではありません。anchor comment が示した、
ROOT_RUN_STATE_V1root-run-state.jsonroot_mission_gate.pyを原則不採用とし、Codex native
/goalを先に runtime evaluation する、という owner intent を正確に fact-check したうえでissue-refinement-loopの正式な disposition に落とすことです。ただし結論を prose で先取りせず、repository の planner / anchor classification / reviewer / termination contract を正本として処理してください。
最重要実行条件
1. SubAgent を使用する
必ず複数の SubAgent を使用してください。
少なくとも以下の独立調査を行ってください。
SubAgent A — current architecture / repository fact-check
codebase-investigator調査対象:
.claude/skills/issue-refinement-loop/SKILL.md.claude/skills/issue-refinement-loop/references/anchor-comment-handling.md.claude/skills/issue-refinement-loop/references/loop-state.md.claude/skills/issue-refinement-loop/references/termination-policy.md.codex/config.toml.codex/hooks.jsondocs/dev/agent-skill-boundaries.md特に次を検証してください。
termination-policy.mdが既に存在するかSubAgent B — historical decision / duplication fact-check
別の
codebase-investigator以下について独立に確認してください。
superseded_by_decisionが適切か既存 Issue がある場合は新規作成せず再利用候補として報告してください。
SubAgent C — upstream Codex fact-check
web-researcherOpenAI 公式一次資料を優先して以下を現在時点で確認してください。
/goal/ Follow a goal の実在/goal,/goal edit, pause/resume/clear 等の lifecycleStophookPreCompact/PostCompacthookanchor comment の記述をそのまま信じず、最新版の公式資料で再検証してください。
2. 全 SubAgent の完了を待つ
SubAgent を launch しただけで先へ進まないでください。
起動した required SubAgent 全員について terminal result を取得し、全員の作業完了を待ってから root/main thread で統合判断してください。
利用可能な native agent status / wait mechanism を使い、requested agents の収束を明示的に確認してください。
issue-refinement-loop の実行
まず repository root / live default branch / live Issue state を再取得してください。
このプロンプト作成時点の main は参考値として
6b93dbc400769bc547d8eee2fc156ec58c6521c0でしたが、これを authority として固定してはいけません。
実行開始時の live
origin/main、Issue body、comments、repository assets を authority としてください。最初に以下を読むこと:
AGENTS.md.claude/skills/issue-refinement-loop/SKILL.mdその後 progressive disclosure に従って必要 reference のみ読むこと。
Anchor は human-context lane で処理する
今回の URL は operator-selected human context です。
canonical privileged preflight profile を使用してください。
uv run --locked python3 scripts/agent-guards/skill_runtime_exec.py \ --command-id preflight.run.with_human_context \ --issue-number 2051 \ --repo squne121/loop-protocol \ --anchor-comment-url 'https://github.com/squne121/loop-protocol/issues/2051#issuecomment-5267598739'手書きの独自 preflight / planner 判定を作らないでください。
run_refinement_preflight.py/plan_refinement_loop.py/ command registry を SSOT としてください。Anchor classification
anchor-comment-handling.mdの契約に従い、anchor の factual claims を SubAgent 調査で fact-check してください。今回、特に検討すべき classification candidate は:
superseded_by_decisionです。
ただし機械的に固定せず、現行契約の条件:
を live evidence で確認してください。
anchor は明示的に
REJECT / NOT_PLANNEDと native Goal evaluation への置換を要求しています。したがって、事実確認が成立しているのに旧
ROOT_RUN_STATE_V1案を小修正して implementation-ready にする方向へ勝手に戻さないでください。一方で upstream や repository の live state が anchor の前提を否定した場合は、その evidence を優先してください。
Mutation ownership
SubAgent は read-only に保ちます。
GitHub Issue の以下の mutation は root/main thread のみが実施してください。
repository の canonical controlled transaction / skill route がある操作ではそれを使用してください。
直接
ghmutation を行う場合も、対象・body SHA・state を mutation 前後で readback してください。No-human-approval policy
この run では、通常の refinement iteration ごとの人間承認を求めないでください。
loop_iteration_approval_gate.default_required: falseに従って、
を
max_iterationsの範囲で自動継続してください。途中で
「続行しますか?」
「Issue を更新してよいですか?」
「close してよいですか?」
のような通常操作の確認質問をユーザーへ返してはいけません。
ただし、これは Codex の permission model を迂回する指示ではありません。
禁止:
--dangerously-skip-permissionssuperseded_by_decisionになった場合formal classification が
superseded_by_decisionになり、必要な close/replacement flow が完了できる場合は、Issue #2051 を implementation-ready にするための rewrite loopへ戻さず、supersede termination flow を完遂してください。期待 disposition:
CLOSEDNOT_PLANNEDsuperseded_by_decisionただし実際の mutation は current repository contract の canonical route に従ってください。
Replacement
まず repository 全体を検索し、
Codex native Goal の runtime evaluation / minimal enablement を既に扱う Issue があるか
を確認してください。
既存 Issue がある場合
新規 Issue を作らず、その Issue を replacement target として使用してください。
既存 Issue がなく、formal supersede flow が replacement materialization を許可する場合
anchor comment の owner decision を根拠として、最小の replacement Issue を materialize してください。
replacement の方向性:
/goalの durable objective と stopping condition を使うstatus/ follow-up / long-running task / compaction or continuation を含む runtime smoke/goal edit/ pause / resume / clear の lifecycle を確認するROOT_RUN_STATE_V1を作らないStophook を検討する.codex/hooks.jsonenforcement 再導入は既存 quarantine decision を踏まえ、Goal 評価 Issue に混載しないこの refinement run 自体では
.codex/config.tomlを編集・実装しないこと。ここでは Issue refinement / disposition だけを行ってください。
formal loop contract が replacement Issue の新規 materialization を認めない場合は、勝手に bypass せず canonical termination に従ってください。
Review loop
supersede せず in-place refinement を継続する formal route になった場合のみ、通常の Step 1 → Step 2 → Step 4 loop を行ってください。
各 semantic iteration で:
2.必要な investigation
3.必要なら web research
issue-reviewerを行います。
reviewer verdict を root prose で独自再判定しないこと。
decide_next_loop_action.pyの判断を再実装しないこと。iteration counter をリセットして budget を迂回してはいけません。
Human escalation / hard stop
「人間承認不要」は repository の hard-stop を無効化するものではありません。
以下になった場合のみ停止してください。
human_judgment_requiredを返したmax_iterationsを正規に消費した停止する場合も追加確認質問はせず、取得済み evidence と hard-stop cause を最終報告してください。
Freshness / race safety
各 remote mutation 前後に live state を再確認してください。
最低限:
origin/mainSHA古い local snapshot と GitHub live state が衝突した場合は live state を優先してください。
最終報告
作業終了時には、通常 prose ではなく以下の形式で簡潔に報告してください。
Completion predicate
この run は以下を満たすまで完了扱いにしないでください。
issue-refinement-looptermination reason が確定この形なら、単に「#2051 を close せよ」と決め打ちせず、指定コメントを human anchor として正式な
superseded_by_decision経路に通しつつ、SubAgent の fact-check と await-all を強制できます。現在の.codex/config.tomlはhooksと Multi-Agent V2 は有効ですが、少なくとも取得した main では Goal feature の明示設定はありません。squne121 commentedon Aug 12, 2026
issue-refinement-loop: human_escalation
required_external_research_unresolvedunauthorized_write_pathbecause the wrapped command wrote.claude/tmp/agy_preflight_result_20260812T134815248670Z_4072635.json, outside the profile's allowed artifact root.web-researcherreturnedagy_web_grounding_no_citations; therefore/goal, lifecycle, feature enablement, and hook semantics are unresolved and cannot support a supersede/close/replacement mutation.No Issue body, label, close-state, or replacement Issue mutation was applied.
squne121 commentedon Aug 12, 2026
調査した限り、今回の修正方針はかなり明確です。現状は Claude 側と Codex 側の両 web-researcher が明示的に AGY-only / direct fallback disabled になっています。 一方 #2059 はすでに、
search_web/read_url_content等の観測や grounding trace を completion gate にしない方針まで進んでいるのに、direct WebSearch/WebFetch fallback だけは依然禁止しています。ここが今回変えるべき契約です。また
run_gemini_headless.pyのweb_tool_call_countは structured trace / hook から観測できた回数を数えているだけで、観測不能なら 0 になります。したがって 0 は「Webを使っていない」の証明ではなく「このテレメトリ経路では観測できなかった」場合を含み得るため、routing / quality gate から外して observability-only にするのが妥当です。 Codex 本体にも現在は独立したweb_searchmode が実装されており、live等を設定できるため、Codex native web を fallback とする設計自体は upstream と整合します。([GitHub]1)推奨する判定は AGY first → usable evidence が得られなければ native Web → 両方失敗したときだけ inconclusive/human escalation です。AGY の tool-call provenance を成功条件から外し、critical claim ごとの citation と一次資料の内容を成功条件にします。新しい receipt、digest、grounding ledger、provider-call proof は追加しません。
CodexCLI 作業プロンプト — web-researcher を AGY-first + native Web fallback に簡素化する
対象リポジトリ:
squne121/loop-protocol背景:
required_external_research_unresolvedでhuman_escalationした。agy_web_grounding_no_citationsで fail-closed し、Codex/goal、lifecycle、hooks 等の upstream claim を採用できなかった。web_tool_call_count: 0になったケースがある。Owner Direction
以下をこの作業の authoritative owner direction として扱う。
web-researcher の外部調査経路を
AGY onlyから
AGY first -> native Web fallbackに変更する。
AGY が正常に一次資料と citation を返せればそのまま使用する。
AGY が以下のいずれかになった場合、停止せず native Web route へ fallback する。
web_tool_call_count == 0web_tool_call_countとsearch_query_countを 成功判定・失敗判定・grounding 判定の入力から完全に除外する。既存 wire compatibility のためフィールドを残す必要がある場合は残してよいが、
ことを明文化する。
Web research の成功条件は provider telemetry ではなく 取得した evidence の品質 とする。
critical external claim について、
が得られていることを基準とする。
一次資料を優先する。
例:
openai/codexupstream「provider が WebSearch を実行したことの機械的証明」と
「claim が外部一次資料で検証できたこと」を混同しない。
後者が目的である。
以下を新設してはならない。
必要なのは「調査ができること」であって、「調査プロセスを証明する巨大な harness」ではない。
Native fallback の runtime 別方針
runtime ごとの native capability 名を無理に統一しないこと。
Codex CLI
current upstream と installed Codex CLI を確認し、Codex が提供する native web-search / browsing route を使用する。
current runtime が top-level
web_searchconfiguration を必要とする場合は、実 runtime/version を確認した上で最小変更を行う。web__run等の内部名は version により変化し得るため、名前を推測して harness に固定しない。Claude Code
Claude-side custom agent では、利用可能なら
WebSearch -> WebFetchを native fallback として許可する。
現在
.claude/agents/web-researcher.mdのdisallowedToolsにWebSearch/WebFetchが入っている場合は、この禁止を撤去する。共通
fallback が成功した場合、
「AGY success」
と偽装してはならない。
overall web research は成功してよいが、route は例えば
verification_route: native_web等として実際の経路を示す。
SubAgent execution
この作業では必ず複数 SubAgent を起動する。
少なくとも以下の独立 role を並列起動する。
SubAgent A — current-contract investigator
確認対象:
.claude/agents/web-researcher.md.codex/agents/web-researcher.toml.claude/skills/issue-refinement-loop/SKILL.md.claude/skills/issue-refinement-loop/references/web-research-routing.md目的:
現在どこで AGY-only / fallback prohibition / grounding quality gate が強制されているかを列挙する。
SubAgent B — AGY evidence-path investigator
確認対象:
run_gemini_headless.pypreflight_agy.pyagy_tool_provenance.py特に以下を追跡する。
AGY result→
grounded_research_evidence→
WEB_RESEARCH_RESULT_V1→ quality gate
→ issue-refinement-loop routing
web_tool_call_count == 0が pass/fail に影響する全経路を特定する。SubAgent C — Codex native Web upstream researcher
OpenAI の一次資料だけを優先して確認する。
確認事項:
config.tomlweb-search configurationこの SubAgent 自身も、AGY が失敗したら native Web を使用してよい。
AGY-only にして調査不能になってはならない。
SubAgent D — Claude parity researcher
確認事項:
WebSearchWebFetchallowedTools/disallowedTools.claude/agents/web-researcher.mdを Codex-side contract とどう parity させるべきかruntime 固有 tool 名まで無理に一致させない。
semantic contract の parity を確認する。
SubAgent E — minimalism / adversarial reviewer
次を敵対的にレビューする。
原則:
削除できる harness は削除し、新規 harness は追加しない。
Await-all requirement
SubAgent を fire-and-forget してはならない。
root agent は起動した全 required SubAgent について terminal state を確認し、
のいずれかまで必ず待つ。
全 SubAgent が terminal state になる前に synthesis、implementation 完了宣言、review 完了宣言をしてはならない。
nested SubAgent delegation は不要。
Related Issue authority
特に以下を確認する。
#2059 は既存契約として、
方向を既に持つ可能性がある一方、
も持つ。
今回の owner direction は後者を緩和するものである。
既存 #2059 がまだこの変更を自然に所有できる状態なら、現在の issue/PR/worktree 状態を確認して scope authority を整理する。
ただし、既存の別実装 PR に無関係な変更を無理に混ぜない。
必要なら narrowly-scoped follow-up Issue とする。
Issue を新設する場合も、巨大な「web grounding platform」Issue にせず、
「web-researcher を AGY-first + native fallback にし、tool-call counters を routing gate から除外する」
だけを Outcome にする。
Required target behavior
最終的に最低限、以下が成立すること。
Case 1 — AGY succeeds with citations
AGY:
Expected:
status: okCase 2 — AGY returns valid URLs but
web_tool_call_count: 0Expected:
status: okCase 3 — AGY fails to materialize citations
Expected:
status: okverification_routeは native route を示すCase 4 — AGY auth/capability failure
Expected:
status: okCase 5 — both routes fail
Expected:
inconclusiveまたはfailedGrounding Quality Gate redesign
以下を quality gate から除外する。
web_tool_call_count > 0search_query_count > 0以下だけを substantive gate とする。
supportedとしていないかprovider telemetry は diagnostics として残してよいが verdict authority を持たせない。
Citation handling
AGY final result に URL が含まれている場合、provider trace が欠落しているという理由だけで捨てない。
ただし model-generated URL を無条件に trusted citation として扱う必要もない。
必要なら native fetch/search でその URL または公式資料を読み、
ことを確認すればよい。
ここにも新しい cryptographic proof / receipt / digest は不要。
Expected code/config areas
少なくとも以下を fresh main で確認する。
.claude/agents/web-researcher.md.codex/agents/web-researcher.toml.claude/skills/issue-refinement-loop/references/web-research-routing.md.claude/skills/issue-refinement-loop/SKILL.md.claude/skills/gemini-cli-headless-delegation/scripts/run_gemini_headless.pytests/fixtures/codex-agent-config/expected-runtime-contract.json.codex/config.tomlただし「関連していそう」という理由だけで全ファイルを変更しない。
必要最小限の changed paths にする。
Tests
少なくとも regression tests で次を証明する。
既存テストに
または同等の assertion がある場合は削除・更新する。
単なる grep による文字列存在確認を主要 verification にしない。
実際の routing/result behavior を pytest 等で検証する。
web_tool_call_countcompatibility ruleできるだけ wire breaking change を避ける。
フィールドを既に external consumer が読むなら削除せず、
も合法な成功結果として扱う。
フィールド説明には
相当を明記する。
新たに
web_tool_observed: true/falseのような別証明フィールドを作って同じ問題を再発させない。Preflight unauthorized_write_path
#2051 の previous run では、canonical human-context preflight が
.claude/tmp/agy_preflight_result_...jsonへの書き込みによって
unauthorized_write_pathになった。これは web evidence semantics とは別問題として扱う。
調査して、単なる ephemeral artifact であるなら、
等の既存の許可済み一時領域を使う方向を優先する。
この問題を直すために filesystem write permission を広げたり、新しい persistent artifact root を作ったりしない。
web-researcher 改修と独立 scope なら、無理に同一 PR に混ぜず follow-up blocker として明示する。
Implementation discipline
mainを取得して authority SHA を記録するReview loop
実装後、新しい independent review SubAgent を最低2つ起動する。
Reviewer 1:
Reviewer 2:
両方を await する。
blocker があれば修正して再レビューする。
ただし iteration budget をリセットして回避してはならない。
Runtime smoke
可能なら実 Codex web-researcher で upstream claim を1つ検証する。
候補:
「current Codex CLI の native web search configuration / semantics」
期待する挙動:
WEB_RESEARCH_RESULT_V1.status: okAGY が正常成功した場合は fallback を強制する必要はないため、native fallback の regression test は hermetic fixture でも別途保証する。
#2051 validation
変更後、mutation-free で #2051 の external fact-check を再試行する。
少なくとも以下を公式 upstream source で検証する。
ここで AGY が失敗した場合、native Web fallback により検証を続けられることを確認する。
ただし web-researcher fix が未mergeの状態で、#2051 を premature に close / supersede しない。
まず infrastructure fix の PR を merge-ready にする。
Completion criteria
完了条件:
web_tool_call_countが routing/grounding/pass-fail gate から除去されているFinal report
最後に以下を簡潔に報告する。
最重要原則:
Web 調査の目的は「外部一次資料を使って claim を確認すること」であり、「特定 provider が何回 Web tool を呼んだかを証明すること」ではない。
正常な evidence を過剰な harness が拒否する設計を追加してはならない。
このプロンプトでは、#2059 が進めている「provider telemetry を completion gate にしない」という方向を維持しつつ、残っている fallback prohibition だけを撤去する形にしています。
.codex/config.tomlには現在明示的なweb_search設定がないため、CodexCLI には installed version と upstream を確認してからweb_search = "live"等が本当に必要か判断させる構成にしています。 ([GitHub]2)squne121 commentedon Sep 5, 2026
結論
#2051 は現仕様のまま実装せず、
NOT_PLANNEDで close を推奨します。ただし、2026年8月12日の既存レビューから結論の根拠を1点更新すべきです。当時の「native Codex CLI
/goalを評価する」という代替案は、現在の repository architecture ではもう正しくありません。native Codex CLI と.codex/**は PR #2409 で全面撤去され、その残存 hook adapter も PR #2428 で削除済みです。代わりに現在は、Claude Code 自身の
/goalが #2051 の capability need をかなり直接的に満たします。したがって推奨は、ROOT_RUN_STATE_V1を作る → 不採用native Codex
/goalを入れる → 既に staleClaude Code
/goalを現行 Claude-native / Claude-GPT runtime で runtime evaluation する → 推奨です。
敵対的レビュー
重大度 | Finding | 判定 -- | -- | -- P0 | ROOT_RUN_STATE_V1 は現在の minimal-harness architecture を逆走する | blocker P0 | #2051 が前提にする #2050 integration は現在 stale / superseded | blocker P0 | Claude Code /goal が root-objective 継続問題を upstream で直接解いている | blocker P0 | AC5/AC7 の「finalization 拒否」は現在の Issue の実装経路では production authority にならない | blocker P1 | follow-up NLP classifier が新しい人間指示より古い mission を強くする危険がある | major P1 | /goal も correctness authority にしてはいけない | major P1 | Verification Commands が runtime behavior ではなく文字列の存在を検証している | majorこれだけで十分です。新schema、ledger、persistent run-state、NLP classifier は不要です。
Verification Commands も作り直すべき
#2051 の現在の VC は
rgでoperational_steerや test function 名が存在することを確認するものが主体です。AC8 は"secret"という文字列数を数えています。これは今回の問題をほぼ検証していません。
問題は、
「長い作業の途中でAIが未完了なのに最終回答してしまうか」
なので、必要なのは実 Claude Code session の causal runtime evidence です。静的 helper の100% branch coverageより、上記7ケースを1回 genuine に通す方が有用です。
推奨 disposition
前回の OWNER comment 自体が「こういうハーネスを追加し続けても CodexCLI の出力が安定しなかったので基本的には不採用」としています。
その後の refinement は、repository-side の不採用根拠を確認したものの、external research が citation を返せなかったため
human_escalationで止まり、Issue mutation を行いませんでした。現在は公式 Claude Code documentation でその外部 capability を確認できています。さらに、その間に repository 自体も Codex CLI retirement、hook adapter retirement、turn-level/session-level completion 分離まで進みました。
したがって現在の推奨は以前より強く、
#2051 →
CLOSED / NOT_PLANNEDです。
代替 Issue を作るなら、内容は「root mission state machine の再設計」ではなく、**「Claude Code
/goalを Claude-native / claude-gpt の auto-mode workflow で runtime evaluation し、root loop の premature turn termination に使えるか確認する」**程度で十分です。そこで genuine failure が再現した場合にだけ、第二段階として session-scoped
## 結論/goalでは足りない deterministicStophook を検討すべきです。最初から persistent state / enforcing control-plane に戻る理由は、現時点ではありません。#2051 は現仕様のまま実装せず、
NOT_PLANNEDで close を推奨します。ただし、2026年8月12日の既存レビューから結論の根拠を1点更新すべきです。当時の「native Codex CLI
/goalを評価する」という代替案は、現在の repository architecture ではもう正しくありません。native Codex CLI と.codex/**は PR #2409 で全面撤去され、その残存 hook adapter も PR #2428 で削除済みです。代わりに現在は、Claude Code 自身の
/goalが #2051 の capability need をかなり直接的に満たします。したがって推奨は、ROOT_RUN_STATE_V1を作る → 不採用native Codex
/goalを入れる → 既に staleClaude Code
/goalを現行 Claude-native / Claude-GPT runtime で runtime evaluation する → 推奨です。
敵対的レビュー
ROOT_RUN_STATE_V1は現在の minimal-harness architecture を逆走する/goalが root-objective 継続問題を upstream で直接解いている/goalも correctness authority にしてはいけないP0 — persistent root state は、既に撤去した control-plane の再導入
#2051 は
root-run-state.jsonに objective、phase、completed checks、pending work、follow-up classification 等を保持し、独自のroot_mission_gate.pyで finalization を制御しようとしています。AC2/3 ではさらに人間の follow-up をoperational_steer / mission_revision / cancelに分類します。これは #1860 の方針と正面衝突します。#1860 は live Issue/PR、diff、tests、current-head CI、review を authority に置き、「新しい graph policy、packet schema、ledger、digest、checker、enforcing hook を追加しない」と固定しています。
さらに merged PR #1875 は persistent loop state、binding digest、専用 publisher 等を実際に削除して minimal harness へ縮退しました。#1889 も cross-session の durable authority は GitHub、local context は same-session 限定、resume 時は live state から再生成する設計です。
したがって #2051 は「便利な state file を1個追加」ではありません。一度除去した第二の control-plane を、root mission という別名で復活させる変更です。
個人趣味開発なら特に割に合いません。state migration、staleness、resume conflict、classifier誤判定、テスト、artifact cleanup の保守対象が増える一方、実際に欲しいのは「AIが途中で勝手に仕事を終えない」という一点だからです。
P0 — #2050 dependency も現状のままでは成立しない
#2051 は #2050 の
subagent_convergence_gate.pyを後で呼ぶ構成を前提にしています。しかし native Codex retirement 後、#2050 には明示的に「
.codex/config.toml、.codex/hooks.json、Codex hook adapter 等は superseded」と追記されています。await-all convergence という capability need が残るなら Claude-native / Claude-GPT 前提で再-refinement するのが OWNER 判断です。実際、現在の main に
scripts/agent-ops/subagent_convergence_gate.pyは存在しません。したがって、
「未実装かつ再-refinement 必須の gate A に、gate B を接続する」
という #2051 の Remaining Parent Gaps は、implementation-ready contract ではありません。
P0 — 現在は Claude Code
/goalがほぼそのまま問題を解くここが8月レビューから最も大きく変わった部分です。
Claude Code 公式は現在
/goalを正式提供しており、completion condition が満たされるまでターンを自動継続します。各ターン終了後に別の小型モデルが条件を判定し、未達ならユーザーへ制御を返さず次ターンへ入ります。auto mode とは補完関係で、auto mode が tool ごとの承認を除去し、/goalが turn ごとの人間の「続けて」を除去する設計です。([code.claude.com]1)さらに #2051 に特に重要な性質として、active goal は
--resume/--continueで session を再開すると復元されます。/goal自体が session-scoped prompt-basedStophook の wrapper なので、repository に新しい hook script や JSON state machine を置く必要もありません。([Claude]2)つまり #2051 の主要ACはかなり upstream に吸収されています。
/goal--resume/--continueで active goal 復元これは #2051 より小さく、upstream-supported で、ユーザーの「ハーネスでワークフローを邪魔しない」という条件にも合っています。
P0 — 現在の hook architecture とも #2051 は噛み合っていない
現在の
.claude/settings.jsonにはStop、StopFailure、SubagentStopが存在しますが、いずれも既存session_manifest_coordinator.shへ接続されています。root_mission_gate.pyへの production wiring はありません。さらに非常に重要なのが merged PR #2496 です。ここでは
Stop/StopFailureを turn-level evidence と位置づけ、hook 経路から root のcompletion_outcome/completion_source、つまり session/run-level completion を設定してはいけないと修正されています。これは正しい設計です。
Stop event happened≠
Issue mission completedだからです。
#2051 を実装すると、この最近修正した境界を再び曖昧にします。
なお Claude Code 公式でも
StopFailureは block できません。出力と exit code は無視され、通知・logging 用です。一方Stop/SubagentStopは block 可能です。(Claude)P1 —
/goalも「真実の判定器」に昇格させないここは
/goal採用時の重要な制約です。Claude Code の
/goalevaluator は tool を実行しません。conversation に Claude が既に出した情報だけを見て判断します。つまり、「CI本当にgreenか」
「PR head SHAは最新か」
「Issue本文がreadback済みか」
を evaluator 自身が GitHub へ読みに行くことはできません。(Claude)
したがって
/goalは、continuation authority
として使うべきで、
correctness / completion evidence authority
にしてはいけません。
後者は現在の architecture 通り、
live GitHub Issue/PR → current HEAD → tests/CI → independent review
のままでよいです。
これなら「ハーネスを削る」と「品質を落とさない」が両立します。
P1 — claude-gpt 経路は実 runtime smoke を1回だけ行う価値がある
現在 repository は native Codex CLI ではなく、Claude Code frontend と
raine/claude-code-proxyを使う claude-gpt lane を持っています。repository で live-tested とされている proxy version は v0.1.34 で、exact pin ではなく observed/tested version とするよう PR #2468 で修正されています。upstream はその後 v0.1.35 を2026年8月19日に公開しています。proxy 自体も Claude Code の small/fast model requests や Claude-style aliases を Codex provider に routing する実装を持つため、
/goalevaluator が claude-gpt lane で動く可能性は高いですが、ここは静的推論ではなく live smoke で確定すべきです。([claude-code-proxy]3)必要な検証は大掛かりな harness ではありません。
/goal/goalStopmanifest hook と併用--continue/--resume/compact中の goalStopFailureを completion と誤認しないこれだけで十分です。新schema、ledger、persistent run-state、NLP classifier は不要です。
Verification Commands も作り直すべき
#2051 の現在の VC は
rgでoperational_steerや test function 名が存在することを確認するものが主体です。AC8 は"secret"という文字列数を数えています。これは今回の問題をほぼ検証していません。
問題は、
「長い作業の途中でAIが未完了なのに最終回答してしまうか」
なので、必要なのは実 Claude Code session の causal runtime evidence です。静的 helper の100% branch coverageより、上記7ケースを1回 genuine に通す方が有用です。
推奨 disposition
前回の OWNER comment 自体が「こういうハーネスを追加し続けても CodexCLI の出力が安定しなかったので基本的には不採用」としています。
その後の refinement は、repository-side の不採用根拠を確認したものの、external research が citation を返せなかったため
human_escalationで止まり、Issue mutation を行いませんでした。現在は公式 Claude Code documentation でその外部 capability を確認できています。さらに、その間に repository 自体も Codex CLI retirement、hook adapter retirement、turn-level/session-level completion 分離まで進みました。
したがって現在の推奨は以前より強く、
#2051 →
CLOSED / NOT_PLANNEDです。
代替 Issue を作るなら、内容は「root mission state machine の再設計」ではなく、**「Claude Code
/goalを Claude-native / claude-gpt の auto-mode workflow で runtime evaluation し、root loop の premature turn termination に使えるか確認する」**程度で十分です。そこで genuine failure が再現した場合にだけ、第二段階として session-scoped
/goalでは足りない deterministicStophook を検討すべきです。最初から persistent state / enforcing control-plane に戻る理由は、現時点ではありません。squne121 commentedon Sep 5, 2026
推奨アクションは、#2051 を現仕様のまま refinement して実装可能化するのではなく、指定 OWNER comment を fact-check したうえで
superseded_by_decisionとしてNOT_PLANNEDclose することです。#2051 本文はいまも
ROOT_RUN_STATE_V1、root_mission_gate.py、#2050 integration を前提にしています。 一方、指定 OWNER comment はそれらを不採用とし、Claude Code/goalの runtime evaluation を代替方向として明示しています。 さらに PR #2409 で native Codex CLI は撤去済み、PR #2428 で残存 hook adapter も削除済みです。 #2050 自身にも、Codex-specific scope は superseded で、必要なら Claude-native / Claude-GPT 前提で再-refinement するという OWNER 指示があります。canonical
issue-refinement-loopは iteration 間の承認を既定で要求せず、needs-fixは上限まで自動継続する設計です。 また anchor handling 上も、人間が close / replace / 前提不採用を明示し、in-place 修正で目的を維持できない場合はsuperseded_by_decisionが想定されています。今回については auto mode +
/goalを併用するのが適しています。現在の Claude Code では auto mode は tool approval を減らし、/goalは各 turn 終了時に独立 evaluator が completion condition を判定して未達なら次 turn を開始します。両者は公式にも補完関係として説明されています。([Claude]1) Auto mode はclaude --permission-mode autoで起動できます。([Claude]2)以下を auto mode の対話セッションでそのまま
/goalとして投入するのを推奨します。/goal Issue #2051 の指定 OWNER comment を anchor として、現在の repository に定義されている canonical
issue-refinement-loopを end-to-end で完了する。Target:
squne121/loop-protocol#2051https://github.com/squne121/loop-protocol/issues/2051#issuecomment-5550820681目的:
指定 OWNER comment の判断を fresh main・関連 Issue/PR・必要な外部一次資料で fact-check し、canonical workflow に従って #2051 の最終 disposition を確定する。
Autonomous execution policy:
needs-fixは canonical policy の範囲で max_iterations まで自動継続する。まず current main 上の
.claude/skills/issue-refinement-loop/SKILL.mdおよび planner が要求する normative references を読み、そこに定義された production route をそのまま使用する。古い派生設計ノートや過去の手順を current SKILL より優先しない。
anchor comment は unlabeled / agent-report lane ではなく、
preflight.run.with_human_context相当の canonical human-context route として処理する。raw anchor prose を独自解釈して mutation せず、planner / canonical contracts の routing を consume する。SubAgent policy:
codebase-investigatorSubAgent を必ず使用する。web-researcherを使用する。run_root_review_pipeline.pyとしている場合、legacyissue-reviewerSubAgent を独自に追加起動しない。current canonical topology を優先する。最低限 fact-check する対象:
.codex/**retirement。codex-hook-adapter.mjs等の retirement。/goalと auto mode の現在の公式仕様。外部仕様を確認する場合は可能な限り Anthropic / Claude Code の一次資料を優先する。Expected semantic direction:
anchor の claim が fresh evidence で確認できた場合、古い
ROOT_RUN_STATE_V1/ persistent root state / follow-up NLP classifier /root_mission_gate.py実装を温存するための rewrite は行わない。#2051 は
superseded_by_decisionとして扱い、canonical mutation route で GitHub Issue をCLOSED / NOT_PLANNEDにする。代替 follow-up:
/goalを Claude-native / Claude-GPT の auto-mode workflow で runtime evaluation し、root task の premature turn termination を十分に抑制できるか確認する」程度に限定する。禁止:
ROOT_RUN_STATE_V1等の新しい state machine / ledger / persistent harness を実装しない。終了条件:
superseded_by_decisionが確定した場合は 実装: root mission と completion predicates を run-state に固定し、follow-up/compaction 後の短期 goal 置換と未完了 finalization を防止する #2051 をnot_plannedで close し、GitHub API/readback で state と state_reason を再確認済み。human_escalationを返した場合だけ終了する。最後に、実行した route、SubAgent の完了状況、fact-check evidence、Issue の最終 state/state_reason、作成または再利用した follow-up Issue、未解決 blocker を簡潔に報告する。
この形なら、**repository 側の「iteration approval 不要」と、Claude Code 側の「tool approval を auto mode で除去」「turn 継続を
/goalで担保」**を分離して使えます。特にサブエージェントについては、Claude Code 2.1.198以降は background が既定になり得るため、「completion notification を受け取るまで finalization しない」を明記する意味があります。公式にも foreground は完了まで main conversation を block し、background の結果は completion notification 後に利用する仕様です。(Claude)squne121 commentedon Sep 5, 2026
issue-refinement-loop 終了報告(superseded_by_decision)
anchor comment(OWNER、
with_human_contextlane、issuecomment-5550820681)を trusted human context として処理した結果、本 Issue をsuperseded_by_decisionとして終了します。final_classification
superseded_by_decision(anchor_reframe: falseの freeform directive、anchor_author_association: OWNER)以下の 3 条件をすべて満たすことを確認しました。
NOT_PLANNEDclose を主張しているroot_mission_gate.py/ROOT_RUN_STATE_V1による persistent root state 管理)を in-place 修正しても目的を維持できない(前提となる architecture 方針自体が撤回されている)/goalの runtime evaluation follow-up)が決定論的に記述可能Fact-check evidence(codebase-investigator / web-researcher、fresh main 基準)
.codex/**全体を撤去済み。現在の main に.codex/は存在しない。scripts/session-recording/codex-hook-adapter.mjsと対応 test 3 件を撤去済み。scripts/agent-ops/root_mission_gate.py/scripts/agent-ops/tests/test_root_mission_gate.pyは現在の main に未実装(存在しない)。.claude/settings.jsonのStop/StopFailure/SubagentStopはsession_manifest_coordinator.shにのみ接続。root_mission_gate.pyへの production wiring は存在しない。Stop/StopFailureを turn-level evidence と位置づけ、completion_outcome/completion_sourceを hook 経由で設定しない方針を確定済み(session/run-level completion と turn-level Stop event の分離)。/goalの自動継続・auto mode との補完関係・--resume/--continueでの goal 復元・evaluator が tool を実行しない制約・StopFailureが block 不能でStop/SubagentStopのみ block 可能、のすべてを確認。anchor comment の技術的主張と齟齬なし。Step 2 (deterministic review) との関係
Step 2 の canonical review は現在の Issue 本文の構造的 readiness 不備(
## Runtime Verification Applicabilityセクション欠落、extension-surface risk-trigger 未申告、VC の baseline-expect 注釈欠落、13 blockers)によりneeds-fix/step_4を返しています。ただし本 Issue はsuperseded_by_decisionで終了するため、これらの readiness 修正(Step 4 rewrite)は実施しません(termination-policy.md の loop end condition:final_classification == superseded_by_decisionは Step 2 の readiness 状態と独立に終了条件として成立します)。Follow-up materialization
canonical planner(
plan_refinement_loop.py)は本 Issue の構造的 fail-closed(missing_required_section)により、投機的な follow-up candidate を生成していません。deterministic な follow-up candidate が存在しないため、本 loop 独自の判断で追加 Issue を起票することはしません(起票が必要な場合は、別途 OWNER の明示的な起票指示、またはcreate-issueskill を通じた新規 Issue 起票を検討してください。想定主題は anchor comment 記載の「Claude Code/goalを Claude-native / Claude-GPT の auto-mode workflow で runtime evaluation し、root loop の premature turn termination を十分に抑制できるか確認する」程度)。Termination
termination_reason: superseded_by_decision— 本 Issue はstate: closed/state_reason: not_plannedとして close します。