Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "post-merge-cleanup の cross-runtime instruction boundary を確立し、top-level orchestrator と mechanical executor procedure を分離した上で、cleanup-worker 固有の no-child policy と report producer/parser/validator の機械的整合を実現する"
change_kind: workflow
dependencies:
static_dispatch_contract:
owner: "#1838 / PR #1922"
status: completed
relationship: reuse_existing_contract
runtime_harness:
owner: "#1841"
status: completed
relationship: reuse_existing_runner
cleanup_executor_contract:
owner: "#1523"
status: open
relationship: preserve_result_compatibility_and_authorization_boundary
nested_delegation_policy:
cleanup_worker:
policy: no_child
owner: "#1733"
implementation_worker_readonly_child:
implementation_owner: "#1943"
runtime_canary_owner: "#1842"Parent Issue
なし(単独改善)
Parent Goal Ref
- Goal: post-merge-cleanup の cross-runtime(Claude Code / Codex CLI)instruction boundary を明確にし、worker context に main-thread routing instruction を混入させない。cleanup-worker 固有の no-child policy を既存 runtime 制約の防御的回帰検証として扱う。
- Desired Destination: N/A(単独 Issue のため parent scope なし)
Current Validated Scope
.claude/agents/post-merge-cleanup-worker.mdは現在skills:frontmatter を持たず、Procedure 本文を.claude/skills/post-merge-cleanup/SKILL.mdから Read する契約である(tools: [Bash, Read]、disallowedTools: [Agent, Edit, Write, MultiEdit])。skills:frontmatter 自体は.claude/agents/issue-reviewer.md/.claude/agents/review-issue.mdで既に採用されている既存パターンであり、本 Issue はこのパターンを再利用する。.codex/agents/post-merge-cleanup-worker.tomlはrepo_local_skill_surface: .agents/skills/post-merge-cleanup/SKILL.mdを持ち、.agents/skills/post-merge-cleanup/SKILL.mdは canonical body(.claude/skills/post-merge-cleanup/SKILL.md)を読む thin wrapper である。- Claude worker は既に
AgentがdisallowedToolsによって禁止されているが、Bashは使用可能であり、Agent禁止だけでは外部 agent CLI(codex exec/claude -p等)の起動経路が防がれていることを証明しない。 - PR feat(codex): canonical dispatch instructionをNative V2 shapeへ移行 #1922(実装: canonical Skill の dispatch instruction と checker を最小構成へ移行する #1838)により static dispatch は
task_name/agent_type/fork_turns: noneを使う Native Multi-Agent V2 の shape に既に更新済みである。 - 実装: native Multi-Agent V2 の bounded runtime smoke と negative test を追加する #1841 は runtime の spawn/join・child event 不存在・worktree non-mutation を検証する fixture/dry-run runner を既に提供しており、本 Issue はこれを再利用する(新規 runtime harness を作らない)。
- worktree/branch の破壊的操作は既に
scripts/agent-ops/cleanup_exec.py(単一認可境界、PR merged / branch / worktree binding を都度検証)に集約されている。POST_MERGE_CLEANUP_REPORT_V1はスキーマとして文書化されているが、実 parser/validator は存在しない(Markdown 内 YAML テンプレートのみ)。 scripts/check_claude_codex_agent_parity.py(PARITY_AGENTS = {issue-reviewer, issue-author, scope-rollup-runner})は現時点でpost-merge-cleanup-workerを対象としていない。本 Issue はエージェント自体を追加しないためPARITY_AGENTSへの追加は行わない(新規 agent role を追加しない)。scripts/check-codex-agents.mjsのrequiredAgentNamesには既にpost-merge-cleanup-workerが含まれており、新しい agent 名を追加しない限りこのリストへの変更は不要。
Remaining Parent Gaps
- なし(単独 Issue)。ただし
dependencies.cleanup_executor_contract(実装: 明示的人間確認で未公開 commit を one-shot cleanup executor から破棄する #1523)は本 Issue のマージ前後を問わず OPEN のまま並行しうるため、cleanup_exec.pyの外部 result schema・actions_takenフィールドの互換性を壊さないこと(回帰テストで固定する)。
概要
現在の post-merge-cleanup Skill が持つ top-level orchestration と worker(mechanical executor)procedure を分離し、Claude Code / Codex CLI 双方の worker が明確な instruction boundary の下で動作できるようにする。
背景
現在の post-merge-cleanup は、main thread に対して「post-merge-cleanup-worker を起動し、follow-up materialization・parent issue routing・superseded PR routing・最終 routing を行う」という top-level orchestrator の役割を持つ一方、post-merge-cleanup-worker は同じ SKILL.md に書かれた Procedure(git/gh 出力分類、cleanup 実行、report 生成)を worker として実行する契約になっている。
同一の Skill 本文を worker に読ませると、次の instruction hygiene 上の矛盾が worker のコンテキストに混入する。
- 自分は cleanup worker であるという役割
- (同じ文書内に書かれた)
post-merge-cleanup-workerを起動する、follow-up Issue を起票する、parent issue を close する、といった main-thread 向け routing 指示
これは Claude/Codex の Agent 自己再帰を「現在防げていない」という security claim ではなく、worker が main-thread 向け instruction を読み込むことによる role confusion / instruction hygiene の問題である。加えて、Claude worker は Agent を disallowedTools で禁止されているが Bash は使用可能なため、Agent 禁止だけでは外部 agent CLI 起動経路の不存在を証明しない。この経路についても、既存の cleanup_exec 認可境界の再利用や runtime canary(回帰テスト)で扱う。
top-level orchestration(main thread 責務)と mechanical executor procedure(worker 責務)を、Claude Code・Codex CLI の双方について分離し、worker 固有の no-child policy を回帰検証する。
対象
.claude/agents/post-merge-cleanup-worker.md.claude/skills/post-merge-cleanup/SKILL.md- 新規
.claude/skills/post-merge-cleanup-executor/ .codex/agents/post-merge-cleanup-worker.toml.agents/skills/post-merge-cleanup/SKILL.md- 新規
.agents/skills/post-merge-cleanup-executor/ POST_MERGE_CLEANUP_REPORT_V1の producer/parser 整合docs/dev/agent-skill-boundaries.mdの agent/Skill catalog- 関連 tests
Outcome
post-merge-cleanup(top-level orchestrator)と post-merge-cleanup-executor(mechanical executor procedure)が Claude Code・Codex CLI の双方で別 Skill として分離され、post-merge-cleanup-worker(既存の単一 agent、新規 agent role は追加しない)が Claude では skills: frontmatter 経由、Codex では repo_local_skill_surface 経由で executor Skill を参照する状態になっている。
worker 側の no-child policy(Agent 禁止に加え、Bash 経由の外部 agent CLI 起動を拒否または不存在を検証する)と、POST_MERGE_CLEANUP_REPORT_V1 の実 validator、orchestrator/executor の責務境界を検証する semantic checker と回帰テストが追加されている状態。
In Scope
- Claude Code / Codex CLI 双方の post-merge-cleanup-worker 配布面(
.claude、.agents、.codex)における orchestrator と executor の責務分離。 POST_MERGE_CLEANUP_REPORT_V1の最小 validator(closed-key parser。新規 registry/publisher/ledger は追加しない)。- 既存
cleanup_exec.py認可境界の再利用(新規破壊的操作の複製を行わない)。 - worker 固有の no-child policy の回帰検証(
Agent禁止の継続確認 + Bash 経由の agent CLI 起動拒否/不存在の検証)。 docs/dev/agent-skill-boundaries.mdの catalog 更新。
post-merge-cleanup(top-level orchestrator。Claude/Codex 共通の canonical body は .claude/skills/post-merge-cleanup/SKILL.md)
- worker の起動(static dispatch shape。PR feat(codex): canonical dispatch instructionをNative V2 shapeへ移行 #1922 の既存 shape を維持)
- cleanup 対象の確定
- follow-up Issue materialization
- parent Issue routing
- superseded PR routing
- worker terminal result(
POST_MERGE_CLEANUP_REPORT_V1)の受領と検証 - main session への最終 routing
worker が実行する git/gh command の詳細(Procedure の8ステップ)は orchestrator 側の Skill 本文に保持しない。
post-merge-cleanup-executor(mechanical executor procedure。新規 .claude/skills/post-merge-cleanup-executor/SKILL.md および thin wrapper .agents/skills/post-merge-cleanup-executor/SKILL.md)
- deterministic cleanup commands(既存の8ステップ Procedure をそのまま移設。内容変更は最小限に留める)
- git/gh 結果分類
- worktree/branch binding 検証(既存
cleanup_exec.py経由。破壊操作を新規に複製しない) - cleanup failure taxonomy
POST_MERGE_CLEANUP_REPORT_V1の生成- compact output
- main-thread 向け routing instruction(worker 起動、follow-up 起票実行、parent close 実行、superseded PR close 実行)を一切含まない
worker(既存の単一 agent。新規 agent role は追加しない)
Claude Code:
.claude/agents/post-merge-cleanup-worker.mdの frontmatter にskills: [post-merge-cleanup-executor]を追加する(.claude/agents/issue-reviewer.mdと同じパターン)。- 本文の Procedure 参照先を
post-merge-cleanup-executorに切り替える。
Codex CLI:
.codex/agents/post-merge-cleanup-worker.tomlのrepo_local_skill_surfaceを.agents/skills/post-merge-cleanup-executor/SKILL.mdに切り替える。
共通制約(worker から次を禁止する):
post-merge-cleanup-workerの再起動- top-level orchestration(follow-up 起票実行、parent close 実行、superseded PR close 実行、main routing)の実行
- nested delegation(
Agenttool 経由、および Bash 経由の外部 agent CLI 起動の双方) - follow-up Issue の独断作成
- schema 外の自由形式結果
Out of Scope
- cleanup の対象範囲を拡大しない。
- merge や branch deletion の安全条件を緩和しない(
cleanup_exec.pyの既存認可条件を弱めない)。 - main session と worker の責務を再統合しない。
- 新しい agent role(
post-merge-cleanup-executorという名前の agent 等)を追加しない。executor は Skill であり agent ではない。 - graph、ledger、packet、digest、専用 publisher、新規 enforcement hook を追加しない。
scripts/check_claude_codex_agent_parity.pyのPARITY_AGENTSへpost-merge-cleanup-workerを追加しない(別スコープ。エージェント自体は変更しないため)。scripts/check-codex-agents.mjsのrequiredAgentNamesの変更(新規 agent 名を追加しないため不要)。cleanup_exec.py自体の認可ロジック変更(実装: 明示的人間確認で未公開 commit を one-shot cleanup executor から破棄する #1523 のスコープ)。.codex/hooks.json/.claude/settings.jsonの変更。- repository-wide の nested delegation 禁止ポリシー変更(本 Issue は cleanup-worker 固有の no-child policy のみを扱う。
implementation-workerの read-only 委譲は 実装: Claude Code / Codex CLI の implementation-worker に bounded read-only delegation parity を追加する #1943 / 実装: Claude Code / Codex CLI の bounded read-only nested delegation canary を実行する #1842 の scope)。
Acceptance Criteria
- AC1:
.claudeの canonical executor Skill(post-merge-cleanup-executor)が存在し、.agents側に同名の thin wrapper Skill が存在する(Claude/Codex 双方の consumer inventory が揃っている)。 - AC2:
.claude/agents/post-merge-cleanup-worker.mdの frontmatter を YAML parse した結果、skillsがちょうど1件(post-merge-cleanup-executor)である。 - AC3:
.codex/agents/post-merge-cleanup-worker.tomlのrepo_local_skill_surfaceが.agents/skills/post-merge-cleanup-executor/SKILL.mdを指している。 - AC4:
.claude/skills/post-merge-cleanup/SKILL.md(orchestrator)に worker 側の8ステップ Procedure(deterministic cleanup commands の実行手順そのもの)が残っていない。orchestrator には worker 起動・report 受領・follow-up/parent/superseded routing のみが残る。 - AC5:
.claude/skills/post-merge-cleanup-executor/SKILL.md(executor)に、post-merge-cleanup-workerの起動、follow-up Issue の起票実行、parent issue close 実行、superseded PR close 実行のいずれも含まれない。 - AC6:
POST_MERGE_CLEANUP_REPORT_V1に対する実 validator が存在し、必須キー・型・不明キー拒否・壊れた YAML を機械的に判定できる(識別子の grep ではなく構造検証)。 - AC7: no-child policy の回帰テストが存在する。
Agenttool 禁止の継続確認に加え、Bash 経由での外部 agent CLI(codex exec/claude -p等)起動が拒否される、または起動されないことを検証する。 - AC8:
cleanup実行成功・partial failure・binding mismatch・権限不足の test が存在する(cleanup_exec.pyの既存 focused regression test を再利用し、新規に破壊的操作を複製しない)。 - AC9: follow-up Issue routing(起票実行・dedupe)は main session(orchestrator)側だけで実行され、executor 側には実行コードが存在しない。
- AC10:
scripts/check_claude_codex_agent_parity.py --strictと既存cleanup_exec関連 tests(tests/codex/test_cleanup_exec_branch_only.py等)が回帰しない。 - AC11:
docs/dev/agent-skill-boundaries.mdの agent/Skill catalog が新しい Skill 構成(post-merge-cleanup-executorの追加、post-merge-cleanup-workerの preload 先)と整合している。 - AC12: 実 session(Claude Code もしくは Codex CLI のいずれか、環境が利用可能な runtime)で、worker が
post-merge-cleanup-executorを参照し、role confusion(自己再起動・orchestration 混入)が発生しないことを示す smoke evidence がある。環境不足(runtime unavailable 等)は exit 77 とし、fixture や文章検査で PASS に代替しない。
Verification Commands
# AC1
# baseline-expect: fail
$ test -f .claude/skills/post-merge-cleanup-executor/SKILL.md# AC1
# baseline-expect: fail
$ test -f .agents/skills/post-merge-cleanup-executor/SKILL.md# AC2
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py -k worker_skills_frontmatter -q# AC3
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py -k codex_skill_surface -q# AC4
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py -k orchestrator_no_procedure -q# AC5
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py -k executor_no_orchestration -q# AC6
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py -k report_validator -q# AC7
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py -k no_child_policy -q# AC8
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py -k cleanup_result_taxonomy -q# AC9
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py -k followup_routing_ownership -q# AC10
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py -k agent_parity_strict_regression -q# AC10
# baseline-expect: pass
$ uv run --locked pytest tests/codex/test_cleanup_exec_branch_only.py -q# AC11
# baseline-expect: fail
$ uv run --locked pytest tests/test_post_merge_cleanup_boundary.py -k boundary_docs_catalog -q# AC12
# preflight-scope: runtime_only
$ uv run --locked python3 scripts/check_post_merge_cleanup_boundary.py --assert-current-repository --check runtime_smoke_evidenceRuntime Verification Applicability
- decision: immediate
- reason: AC12 は実 runtime session(Claude Code もしくは Codex CLI)上での worker 起動と role confusion 不発生の smoke evidence を要求するため、本 Issue の実装範囲内で動作検証が成立する。
- if immediate: AC12(
<!-- runtime-verification: true -->タグ付与済み)。対応 VC はscripts/check_post_merge_cleanup_boundary.py --check runtime_smoke_evidence(# preflight-scope: runtime_only)。runtime unavailable の場合は SKIP exit 77 とし、fixture や文章検査で PASS に代替しない。
applicable_acs: AC12
execution_environment: Claude Code もしくは Codex CLI のいずれか、実行時に利用可能な native runtime(worktree-agent-runtime-smoke共有 Skill を利用する)
skip_conditions: Claude Code / Codex CLI いずれの runtime も起動不能・認証不能な場合は environment blocker として exit 77 とし、SKIP を証跡に明記する
fallback_policy: runtime evidence を fixture・モック・文章検査で代替しない。SKIP 時は AC12 を PASS 扱いにせず、証跡に unresolved として記録する
artifact_requirements:worktree-agent-runtime-smokeの allowlist-onlysummary.md(worker 起動ログ、参照 Skill 名、child spawn event 数)を PR に添付する
Allowed Paths
.claude/agents/post-merge-cleanup-worker.md.claude/skills/post-merge-cleanup/SKILL.md.claude/skills/post-merge-cleanup-executor/.agents/skills/post-merge-cleanup/SKILL.md.agents/skills/post-merge-cleanup-executor/.codex/agents/post-merge-cleanup-worker.tomlscripts/check_post_merge_cleanup_boundary.pytests/test_post_merge_cleanup_boundary.pydocs/dev/agent-skill-boundaries.md.github/ci/python-test-plan.jsontests/fixtures/codex-agent-config/expected-runtime-contract.jsonscripts/agent-ops/run_worktree_agent_runtime_smoke.pyscripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合(特に
cleanup_exec.py自体の認可ロジック変更が必要と判明した場合は 実装: 明示的人間確認で未公開 commit を one-shot cleanup executor から破棄する #1523 側の Stop Condition として扱う) - In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 新規 agent role の追加が必要と判明した場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
scripts/check_claude_codex_agent_parity.py --strictを pass させるためにPARITY_AGENTSの追加が必要と判明した場合(別スコープとして扱う)
Required Skills
なし
Required Design References
- docs/dev/agent-skill-boundaries.md
Scope Delta(任意)
以下の 2 ファイルは実装時に Allowed Paths へ追加された(PR #1947 fix_delta 対応)。
.github/ci/python-test-plan.json: 新規tests/test_post_merge_cleanup_boundary.py(元の Allowed Paths 内)を CI のpython-testrequired check の coverage gate(generate_ci_test_selection_artifact.py)に登録するための機械的な追記のみ。テストロジック・意味論の変更なし。tests/fixtures/codex-agent-config/expected-runtime-contract.json: AC3 で意図的に変更する.codex/agents/post-merge-cleanup-worker.tomlのrepo_local_skill_surfaceに追従して、既存の regression test(tests/codex/test_codex_permission_profile_config.py等)が参照する期待値フィクスチャのruntime_followup_route/repo_local_skill_surfacesを更新した。新規テストロジックの追加ではない。
いずれも cleanup_exec.py の認可ロジックには触れておらず、Out of Scope の境界は変更していない。
追加 Scope Delta(2026-08-02、オーナー承認): PR #1947 のレビューで、オーナー(squne121)が Blocker 1(AC12 runtime evidence の false positive)の根本解決には scripts/agent-ops/run_worktree_agent_runtime_smoke.py(worktree-agent-runtime-smoke 共有 Skill の実行ハーネス)自体の拡張が必要と判断し、Allowed Paths への追加を明示的に承認した。当初 follow-up Issue #1971 として切り出していたが、本 Issue のスコープ内で対応する。ハーネスに構造化 telemetry フィールド(tested_head / runtime_version / requested_agent_type / effective_agent_type / loaded_skills / spawn_events / child_spawn_event_count / self_restart_event_count / orchestration_action_count / prompt_sha256)を追加し、scripts/check_post_merge_cleanup_boundary.py の AC12 検証を再び必須フィールド検証に戻す。
Delivery Rule
1 Issue = 1 PR。作業は専用 worktree で行い、PR は Draft で作成する。
Activity
squne121 commentedon Jul 25, 2026
Scope Collision (C1): related_issue=#1732, #1601, #1587, #1523, #1363, #1288, #1009, #260, #237, #225, #213, #197, #106, #82, #63, #56, #47, #45; overlapping_paths=.claude/agents/post-merge-cleanup-worker.md, .claude/skills/post-merge-cleanup/SKILL.md, .claude/skills/post-merge-cleanup/scripts/classify-git-state.py, .claude/skills/post-merge-cleanup/tests/test_classify_git_state.py, docs/dev/agent-skill-boundaries.md
non_conflict_reason: 本 Issue は post-merge-cleanup の orchestrator/worker executor 境界そのものを分離する構造変更であり、#45(Test Plan チェックボックス自動検出)・#47(inline python 集約)・#106(premise vs 実測優先の warnings 明示)・#1523(未公開 commit 破棄 executor)はいずれも post-merge-cleanup 配下の個別機能追加・修正であり、本 Issue の Skill 分割自体とは独立して進行可能。docs/dev/agent-skill-boundaries.md への overlap は SSOT 追記のみで衝突しない。
edit_intent: 本 Issue のマージが先行する場合、#45/#47/#106/#1523 は分離後の post-merge-cleanup-executor 側ファイルパスへ追従が必要になる可能性がある(follow-up で対応、本 Issue の Scope には含めない)。
squne121 commentedon Aug 1, 2026
判定
REQUEST_CHANGES。Issue #1733 は方向性こそ妥当ですが、現状の本文のまま実装へ進めるべきではありません。
有効なのは「orchestrator と executor を分離して worker のコンテキスト矛盾を減らす」という保守性・役割明確化のリファクタリング無(Claude)・Claude Code 公式仕様と一致していません。さらに、Codex 配布面、実行時ガード、レポート検証がスコープから漏れています。
重大指摘
重要度 | 指摘 | 問題 -- | -- | -- P0 | 前提となる current-main 認識が古い | Issue は worker の「preload 先を切り替える」としていますが、現 worker に skills: はなく、Read で既存 Skill を読む契約です。また Agent は既に禁止されています。 P0 | Verification Commands が AC を検証していない | 正しい実装を失敗扱いし、不正実装を通すコマンドが複数あります。 P0 | Codex / .agents 配布面が完全に欠落 | 現 workflow は Claude と Codex の双方から利用されますが、Allowed Paths は .claude と文書だけです。 P1 | Agent 禁止だけでは Bash 経由の委譲を防げない | worker は Bash を使用可能なため、外部 CLI を起動する経路が残ります。 P1 | #1838 / #1841 / #1842 と契約所有が競合 | static dispatch、runtime smoke、nested canary の所有者が既に分離されています。 P1 | POST_MERGE_CLEANUP_REPORT_V1 が実質的に文字列契約 | AC5 は validator 実行ではなく、名称の grep にすぎません。結論
#1733 は close / not planned にする必要はありません。ただし、現在の security-oriented な説明のままでは不正確です。
実装前に次の修正が必要です。
目的を「Claude の再帰防止」から「cross-runtime instruction boundary と cleanup-worker 固有 no-child policy」へ変更する。
current main、PR feat(codex): canonical dispatch instructionをNative V2 shapeへ移行 #1922、実装: native Multi-Agent V2 の bounded runtime smoke と negative test を追加する #1841、実装: Claude Code / Codex CLI の bounded read-only nested delegation canary を実行する #1842、実装: 明示的人間確認で未公開 commit を one-shot cleanup executor から破棄する #1523 を dependency/ownership に反映する。
.agentsと.codexを Allowed Paths に追加する。grep ベースの Verification Commands を semantic checker と実 runtime trace に置き換える。
destructive operation は新 Skill に複製せず、既存
cleanup_execの認可境界を再利用する。実体のない「schema」主張をやめるか、最小の機械 validator を追加する。
この修正後であれば、個人開発として過剰な graph/ledger/publisher を増やさず、実効性のある1 PRに収められます。
## 判定REQUEST_CHANGES。Issue #1733 は方向性こそ妥当ですが、現状の本文のまま実装へ進めるべきではありません。
有効なのは「orchestrator と executor を分離して worker のコンテキスト矛盾を減らす」という保守性・役割明確化のリファクタリング無([Claude]1)・Claude Code 公式仕様と一致していません。さらに、Codex 配布面、実行時ガード、レポート検証がスコープから漏れています。
重大指摘
skills:はなく、Readで既存 Skill を読む契約です。またAgentは既に禁止されています。.agents配布面が完全に欠落.claudeと文書だけです。Agent禁止だけでは Bash 経由の委譲を防げないBashを使用可能なため、外部 CLI を起動する経路が残ります。POST_MERGE_CLEANUP_REPORT_V1が実質的に文字列契約P0-1: 「preload の切替」という baseline が存在しない
現行
.claude/agents/post-merge-cleanup-worker.mdは次の状態です。tools:Bash,ReaddisallowedTools:Agent,Edit,Write,MultiEditskills:フィールドなし.claude/skills/post-merge-cleanup/SKILL.mdの Procedure を読むよう指示したがって、Issue の「preload 先を executor に切り替える」は、実際には既存 preload の変更ではなく、新たな preload 導入です。これは context composition を変えるため、単なるファイル移動ではありません。
さらに、現在の Claude Code 公式仕様では、サブエージェントは他のサブエージェントを spawn できません。公式には nested workflow が必要なら main から chain するか Skills を使う設計です。
disallowedToolsの bare tool 名はツール自体をコンテキストから除去します。 (Claude)って Claude 側で現実に解決すべき問題は、というrole confusion / instruction hygieneです。「Agent による自己再帰を現在防げていない」という security claim ではありません。
必須修正
Issue の Goal を次のように狭めるべきです。
P0-2: Verification Commands が逆向き・文字列依存
Issue 本文のコマンドには、明確な欠陥があります。
AC3
rg -c "cleanup failure taxonomy" .claude/skills/post-merge-cleanup/SKILL.mdAC3 は orchestrator から worker procedure を除去する条件です。正しく除去すると
rgは exit 1 になり、一般的な verification runner では FAIL になります。AC4
rg -c "post-merge-cleanup-worker を起動する" \ .claude/skills/post-merge-cleanup-executor/SKILL.mdexecutor から worker 起動処理を除去する条件なのに、禁止対象の文字列を検索しています。正しい実装ほど失敗します。
AC2
rg -c "post-merge-cleanup-executor" .claude/agents/post-merge-cleanup-worker.mdこれはコメントや説明文に一度書くだけでも成功します。YAML frontmatter の
skills:に正しく設定されたことを検証しません。AC5
rg -c "POST_MERGE_CLEANUP_REPORT_V1" ...schema validation ではなく識別子の存在確認です。必須キー、型、列挙値、不明キー、複数レポート、壊れた YAML を一切拒否しません。
AC6
「再起動禁止」と文章に書いたことと、再起動できないことは別です。
AC10
ファイル名が
test_role_confusion_smoke.pyでも、fixture やモックだけなら「実 session evidence」にはなりません。必須修正
grep 群を、単一の semantic checker に置き換えるべきです。
checker は Markdown 本文だけでなく、frontmatter、全 consumer、レポート parser を構造的に検証する必要があります。
P0-3: Claude だけ分割すると Codex が壊れる
現行 orchestrator は明示的に Codex CLI の custom agent
post-merge-cleanup-workerも起動します。PR #1922 により、task_name、agent_type、fork_turns: noneを使う Native Multi-Agent V2 の static dispatch shape に既に更新されています。Codex 側では現在、
.codex/agents/post-merge-cleanup-worker.toml.agents/skills/post-merge-cleanup/SKILL.mdが利用されます。
.agents側は.claude/skills/post-merge-cleanup/SKILL.mdを読む thin wrapper です。しかし #1733 の Allowed Paths には、次がありません。
.agents/skills/post-merge-cleanup-executor/SKILL.md.codex/agents/post-merge-cleanup-worker.tomlこのまま実装すると、
という split-brain になります。
また current Codex 設定では Multi-Agent V2 が有効です。OpenAI の current source では
agents.max_depthは V1 専用で V2 では無視されるため、global depth を nested-delegation guard として使う案も成立しません。 ([GitHub]2) 必須修正Allowed Paths に最低限以下を加える必要があります。
.agentsには procedure を複製せず、現行と同じ thin-wrapper 方式を維持すべきです。P1-1:
disallowedTools: Agentは外部 CLI 起動を防がないClaude worker は
Agentを使えませんが、Bashは使えます。したがって、実行環境にコマンドが存在する場合、codex exec ... claude -p ... herdr ... agy ...のような別プロセスとしての agent 起動は、
Agentツール禁止とは別経路です。これは現在の tool set から導かれる脅威推論です。Issue の AC4・AC6・AC7 は Skill 内の語句や Agent 呼び出ししか想定しておらず、この経路を扱っていません。
全面的な新規 security subsystem は不要ですが、既存 hook / execpolicy で cleanup worker からの agent CLI 起動を拒否するか、worker の Bash を exact executor command に限定する必要があります。
リポジトリには既に、cleanup の destructive authority を
cleanup_execに集約し、実 PreToolUse hook の stdin JSON と process integration test で検証した実績があります。新しい Skill に bare git 操作を再実装するより、この既存境界を再利用すべきです。P1-2: 関連 Issue との「独立」は成立しない
競合コメントは #1523 等を「Skill 分割とは独立」としていますが、これは Git の同一行競合だけを見た判断です。契約上は独立ではありません。
特に以下が直接関係します。
post-merge-cleanup を含む canonical static dispatch shape を既に変更済み。runtime security を主張せず、実装: native Multi-Agent V2 の bounded runtime smoke と negative test を追加する #1841 に明示的に委譲しています。
実 runtime の spawn/join、child event 不存在、worktree non-mutation を所有しています。cleanup worker の実起動は破壊操作の可能性があるため、dry-run または fixture を持つ別契約が必要とも明記されています。
implementation-worker -> codebase-investigatorの read-only nested delegation を意図的に検証します。つまりリポジトリ全体で nested delegation を禁止するのではなく、cleanup worker 固有の no-child policy が必要です。cleanup executor の one-shot confirmation、local-only commit、外部 result schema の additive compatibility を変更します。単なる移動後のパス追従では済みません。
Issue の
Remaining Parent Gaps: なしは削除し、少なくとも次の ownership を明記すべきです。P1-3: レポートを「schema」と呼ぶなら実 validator が必要
POST_MERGE_CLEANUP_REPORT_V1は現在、主として Markdown 内の YAML テンプレートとして存在します。#1733 の AC5 は名称を検索するだけなので、schema compatibility を保証しません。過剰な registry、publisher、ledger は不要です。最小構成は次のいずれかで十分です。
JSON Schema では
properties、required、additionalProperties、合成時のunevaluatedPropertiesにより、不明キーや型を機械的に制御できます。 (JSON Schema)固定すべきフィールドは以下です。producer は strict、consumer の拡張方針は次のどちらかに固定します。
extensionsオブジェクト内だけ additive field を許可推奨する最小アーキテクチャ
新しい大規模ハーネスは不要です。
リポジトリ内には、platform adapter を薄くし、判定本体を
scripts/agent-guardsの shared core に置く先例があります。#1733 も同じ構造に寄せるべきです。改訂すべき Acceptance Criteria
.claude、.agents、.codexの全 consumer inventory が固定されるskills:にちょうど1件設定されるAgentだけでなく Bash 経由の agent CLI 起動も拒否または不存在確認されるcleanup_exectests が回帰しない結論
#1733 は close / not planned にする必要はありません。ただし、現在の security-oriented な説明のままでは不正確です。
実装前に次の修正が必要です。
.agentsと.codexを Allowed Paths に追加する。cleanup_execの認可境界を再利用する。この修正後であれば、個人開発として過剰な graph/ledger/publisher を増やさず、実効性のある1 PRに収められます。
squne121 commentedon Aug 1, 2026
issue-refinement-loop: human_escalation
run_refinement_preflight.pyがSTATUS: blocked/NEXT_ACTION: human_judgment_requiredを返したため、Step 1(investigation)/ Step 2(review)へ進む前に停止しました。Blockers
repair_diagnostics:repair_issue_contract.py(dry-run)が現在の Issue 本文に対して 4 箇所の欠陥を検出しました。いずれも Verification Commands ブロックに# baseline-expect注釈が欠落しているというものです。test -f .claude/skills/post-merge-cleanup-executor/SKILL.md)rg -c "post-merge-cleanup-worker を起動する" ...)rg -c "POST_MERGE_CLEANUP_REPORT_V1" ...)rg -c "post-merge-cleanup-worker の再起動" ...).claude/artifacts/issue-refinement-loop/1733/repair_diagnostics.json付随する背景(anchor comment の内容)
対象 anchor comment(OWNER, REQUEST_CHANGES, 2026-08-01)は、上記の機械的な defect とは別に、本 Issue の実質的なスコープ・AC・VC に対して大規模な修正を要求しています。
skills:frontmatter 不在、Agent既に禁止済み)との整合.agents/.codex(Codex 配布面)を Allowed Paths に追加#1838(PR feat(codex): canonical dispatch instructionをNative V2 shapeへ移行 #1922)/#1841/#1842/#1523との dependency/ownership 明記cleanup_execの認可境界の再利用(新規破壊操作の複製禁止)この anchor comment に基づく本文書き換え(Step 4 rewrite)は、上記の preflight blocker 解消後に改めて実行する必要があります。
Blockers(summary)
# baseline-expect注釈欠落)FOLLOW_UP_MATERIALIZATION_RESULT_V1:squne121 commentedon Aug 2, 2026
推奨アクション
#1733 は維持し、Issue refinement を再開するのが妥当です。
今回の
human_judgment_requiredは、設計判断そのものではなく、既存 VC 4件へのbaseline-expect欠落を検出した機械的ゲートです。ただし、古い VC に注釈を足して終了してはいけません。機械修復を適用して preflight を通した後、anchor comment に従って本文を全面改訂する必要があります。改訂時は次を反映します。
skills:を持たず、Agentは既に禁止済みです。したがって「既存 preload の切替」「Agent 禁止の新設」という現状認識は修正対象です。.agents/skills/post-merge-cleanup/SKILL.mdを正本としているため、.claudeだけを変更すると配布面が split-brain になります。作業プロンプト
リポジトリ
squne121/loop-protocolの Issue #1733 に対し、停止中のissue-refinement-loopを再開し、Issue 本文を実装可能な契約へ改訂してください。対象:
OWNER decision
今回の
human_judgment_requiredについて、次を OWNER 判断として扱ってください。repair_issue_contract_detected_changesは承認する。repair_issue_contract.pyが提示する、Verification Commands への# baseline-expect注釈追加は機械的修復として適用してよい。origin/mainと repair diagnostics の readback に基づいて決定する。issue-refinement-loopを再実行する。実行方針
リポジトリ内の最新版
.claude/skills/issue-refinement-loop/SKILL.mdと関連スクリプトを正本として実行すること。Issue 本文の更新には、リポジトリが定める
edit-issueの transaction/readback 経路を使用すること。場当たり的なgh issue editで transaction guard を迂回しないこと。開始時に次を fresh readback する。
origin/mainの現在 SHA51520576265152073412.claude/artifacts/issue-refinement-loop/1733/repair_diagnostics.json.claude/agents/post-merge-cleanup-worker.md.codex/agents/post-merge-cleanup-worker.toml.claude/skills/post-merge-cleanup/SKILL.md.agents/skills/post-merge-cleanup/SKILL.mdscripts/agent-ops/cleanup_exec.pyscripts/check_claude_codex_agent_parity.pyPhase 1: preflight blocker の解消
repair_issue_contract.pyを dry-run する。run_refinement_preflight.pyを再実行する。Phase 2: anchor comment に基づく Issue refinement
anchor comment の REQUEST_CHANGES を normative input とし、investigation、adversarial review、rewrite、fresh review を反復する。
少なくとも次を本文へ反映すること。
Goal
旧来の「Claude の自己再帰防止」を主目的にしない。
次を主目的とする。
.agents、Codex の配布・実行契約の整合cleanup_execauthorization boundary の再利用保守性・役割明確化のリファクタリングであり、agent instruction や permission profile を security boundary として主張しないこと。
Current-main alignment
以下の current-main facts を本文に正しく反映する。
.claude/agents/post-merge-cleanup-worker.mdに現在skills:frontmatter はない。Agentが既に disallowed である。Bashを使用できるため、Agent禁止だけでは外部 agent CLI 起動経路の不存在を証明できない。.agents/skills/post-merge-cleanup/SKILL.mdを参照している。Dependencies and ownership
Remaining Parent Gaps: なしは削除する。最低限、次の ownership を明記する。
#1943 は #1842 の hard predecessor として記録するが、調査の結果、実装上の直接依存が確認されない限り #1733 の hard predecessor にはしない。
Scope boundaries
新しい executor Skill に destructive command や authorization logic を複製しない。
worktree/branch cleanup、binding validation、destructive execution は既存の
scripts/agent-ops/cleanup_exec.pyとその contract を呼び出す構成にする。.agents配布面では procedure 本体を複製せず、既存の thin-wrapper / canonical-procedure 方式を維持する。graph、ledger、packet、digest、publisher、専用 enforcement hook など、本件に不要な新 subsystem を追加しない。
Allowed Paths
current consumer inventory を調査した上で exact list を作成する。最低限、次を候補へ含める。
.claude/agents/post-merge-cleanup-worker.md.claude/skills/post-merge-cleanup/SKILL.md.claude/skills/post-merge-cleanup-executor/SKILL.md.agents/skills/post-merge-cleanup/SKILL.md.agents/skills/post-merge-cleanup-executor/SKILL.md.codex/agents/post-merge-cleanup-worker.tomlscripts/check_post_merge_cleanup_boundary.pytests/test_post_merge_cleanup_boundary.pyscripts/check_claude_codex_agent_parity.pydocs/dev/agent-skill-boundaries.md実在しないパスは機械的に追加せず、current repository の distribution architecture を調査して exact path に修正する。
cleanup_exec.pyや既存 tests の変更が必要かは調査で判断する。単なる回帰検証だけで済む場合は Allowed Paths に追加しない。Acceptance Criteria
anchor comment の改訂 AC1〜AC12 を基準に、current-main readback と ownership を反映した、検証可能な AC を作成する。
最低限、次を満たすこと。
.claude、.agents、.codexの全 consumer inventory が固定される。skills:frontmatter を採用する場合は、インストール済み Claude Code と repository checker が実際に扱えることを確認する。Agentだけでなく、Bash経由の agent CLI 起動についても拒否または不存在を検証する。cleanup_exectests が回帰しない。AC は実装詳細の文字列存在だけを成功条件にしない。
Verification Commands
古い
rg -c中心の VC を廃止し、AC を意味的に検証するコマンドへ置き換える。中心となる VC は次とする。
加えて、current repository の実パスに基づいて次を用意する。
cleanup_execの既存 focused regression testsgit diff --check各 Verification Commands ブロックには、current baseline を実測した上で以下を明示する。
# baseline-expect: pass# baseline-expect: fail# preflight-scope: runtime_onlybaseline 値をコマンド名や期待実装から推測しない。
runtime unavailable、auth unavailable、effective trace unavailable は exit 77 / environment blocker とし、fixtureや文章検査で PASS に代替しない。
Phase 3: review convergence
改訂候補に対して fresh な issue-contract review を実行する。
以下が解消されるまで refinement iteration を継続する。
通常の needs-fix は人間へ戻さず、自律修正する。
完了条件
次をすべて満たした時点で終了する。
passまたは実装へ進める非blocking状態である。goである。完了コメントには次を含める。
停止条件
次の場合だけ停止する。
新規 Issue が必要な場合は、既存 Issueとの重複を全状態で検索する。#1943 やその他既存 Issue と重複する follow-up を作成しない。
このプロンプトは、escalation 解消と Issue 契約の確定までに範囲を限定しています。実装・テスト・PR作成は、#1733 が fresh
goになった後の別フェーズに分離するのが適切です。squne121 commentedon Aug 2, 2026
ANCHOR_SCOPE_REFRAME_V1
OWNER が本セッションのチャットで直接、
.agents/.codexを Allowed Paths に追加するよう明示指示したため(issue-refinement-loop 再開指示の Phase 2「Allowed Paths」セクション)、この scope delta を trusted anchor として承認します。squne121 commentedon Aug 2, 2026
issue-refinement-loop: 再開・完了報告
OWNER decision(本 Issue の human_escalation コメントへの返信指示)に基づき、issue-refinement-loop を人間承認なしで再開し、以下を完了しました。
Body SHA256(更新前後)
4c8ac571feab5464b31b0e1c7ab23fb3676adbaf7b0b620260f5a9342b75c6f86543979aebee27a7e1077c2ec72d88183c78e89cc1a0c930a7f7a3eb8ffd0ee3675c53d8f8fe79fb7749813b0634098712a182a74273dfbeb5a742b7b89dc731(最終)使用した anchor comment
ANCHOR_SCOPE_REFRAME_V1(.agents/.codexの Allowed Paths 追加を承認)Iteration 数
repair_issue_contract.py --applyの baseline-expect 注釈4件をそのまま適用)## Runtime Verification Applicabilityセクション追加(C9 blocker 対応)uv run python3 <script>直接呼び出しは allowlist 対象外のため)baseline-expectをpass→failに修正(実測 exit code 4 に基づく)issue-reviewerレビュー: 4 回実行。うち2回(1回目・2回目)は SubAgent 側のbody取得経路の破損により REVIEWED_BODY_SHA256 が live body と不一致(誤検知)と判明したため、check_issue_contract.py --issue/--repoによる ground-truth 直接検証で上書き判断。3回目(VC preflight allowlist blocker、genuine)→ 修正 → 4回目(approve, ground-truth 一致確認済み)で収束。repair 結果(Phase 1)
repair_issue_contract.py --apply(dry_run: false)で Verification Commands 4箇所(AC1, AC4, AC5, AC6 相当。全面改訂で AC 番号は再構成済み)に# baseline-expect: failを追加。origin/mainreadback(.claude/skills/post-merge-cleanup-executor/SKILL.md等が実在しないこと)で妥当性を確認済み。preflight 結果(最終)
run_refinement_preflight.py --anchor-comment-url issuecomment-5152057626:STATUS: pass/NEXT_ACTION: proceed。scope_signal_guard.triggered: false(.agents/.codexAllowed Path 追加はANCHOR_SCOPE_REFRAME_V1承認コメント投稿後、直近 snapshot 比較で新規シグナルなしと判定)。review 結果(最終、ground-truth 検証済み)
check_issue_contract.py --issue 1733 --repo squne121/loop-protocol:verdict: approve、blocking_issues: []。C1〜C11 全 pass(C12/C13 は n/a)。run_contract_review_once.py --mode preflight-static:status: go、readiness_status: go、vc_preflight_status: pass(全 AC のclassificationがannotations.baseline_expectと一致)。dependency / ownership 最終形
#1943 を #1733 の hard predecessor にしたか
していません。 #1943 の in-scope はもっぱら
implementation-worker自身の read-only 調査委譲(codebase-investigator/web-researcherへの)であり、post-merge-cleanup-workerや本 Issue のスコープへの直接の実装依存は #1943・#1842 いずれの本文にも記載がありませんでした(#1943 は #1842 の hard predecessor です)。本文のdependencies.nested_delegation_policyには併記のみ行い、parent_issue/ Stop Conditions には依存として組み込んでいません。follow-up Issue の作成・再利用結果
なし。既存 Issue(#1838, #1841, #1842, #1523, #1943)はいずれも独立した既存スコープであり、本 Issue から新規 follow-up は作成していません。
実装状況
未着手です。 worktree・branch・commit・PR はいずれも作成していません。本 Issue は open のままです。
squne121 commentedon Aug 2, 2026
implement-issue: 実装完了 (2026-08-02T01:25:23Z)
.claude/worktrees/issue-1733-post-merge-cleanup-orchestrator-worker-eworktree-issue-1733-post-merge-cleanup-orchestrator-worker-efix: repair post-merge-cleanup-worker runtime_followup_route drift (#…
fix: CI coverage gate registration + Japanese content ratio for post-…
fix: strengthen Japanese ratio of executor SKILL.md headings for per-…
squne121 commentedon Aug 2, 2026
impl-review-loop: 完了 (2026-08-02T02:20:00Z)
fix: address REQUEST_CHANGES on PR #1947 (AC12 false-positive, worker…
fix: repair AC12 regression — literal VC can now genuinely PASS (#1733)
fix_delta(iteration 8): extend worktree-agent-runtime-smoke harness w…
squne121 commentedon Aug 2, 2026
impl-review-loop: 完了 (2026-08-02T05:55:00Z)
fix: post-merge-cleanup-boundary checker の hardcoded issue-author 文字列…
feat(agents): issue-author を issue-creator/issue-editor に分割する (#1974)