Skip to content

実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "canonical review-issue Skill と write-capable review-issue SubAgent が review procedure / mutation ownership を重複所有している状態を解消し、review-issue Agent を public runtime inventory から削除して main/root → review-issue Skill → main/root → edit-issue controlled transaction の一本経路に統一する"
change_kind: refactor

Parent Issue

なし(単独改善)

Parent Goal Ref

なし(単独 Issue のため対象外)

Current Validated Scope

control-plane 直接検証(2026-09-04 実施、HEAD 7ebdf158、codebase-investigator SubAgent による read-only 調査を含む):

  • .claude/agents/review-issue.md: permissionMode: acceptEdits、mutation_class: issue-mutation。standalone human-in-the-loop review で gh issue edit --body-file を自ら実行する write-capable SubAgent。tools: Bash, Read, Grep, Glob, Write(disallowedTools: Edit, MultiEdit)。skills: review-issue を preload する。
  • .claude/agents/issue-reviewer.md: permissionMode: dontAsk、mutation_class: readonly。disallowedTools に Edit/Write/MultiEdit/Agent/Skill を含む read-only SubAgent。実装: fix: root-owned review routing から issue-reviewer の byte relay を除去する #2380(PR fix: root-owned review routing から issue-reviewer の byte relay を除去する #2386 でマージ済み)により issue-refinement-loop canonical Step 2 の loop worker から外れ、legacy CLI/診断/回帰テスト専用の compatibility asset として明記済み。本 Issue のスコープでは変更しない(現行定義に defect なし)。
  • .claude/skills/issue-refinement-loop/SKILL.md: canonical Step 2 は run_root_review_pipeline.py produce を直接 consume し、issue-reviewer SubAgent を起動しない(実装: fix: root-owned review routing から issue-reviewer の byte relay を除去する #2380)。この記述は既に正しく、変更不要。
  • .claude/skills/review-issue/SKILL.md: script-first checker(check_issue_contract.py)による決定論的レビュー手順。standalone needs-fix(invoked_as_loop: false)時の Procedure Step 5 は、ユーザー承認後に edit-issue Skill 呼び出しと直接 gh issue edit 実行の両方を選択肢として記述しており、review-issue Agent(直接 gh issue edit)と mutation 経路が重複している。
  • review-issue という文字列を参照する repo 全体の実 consumer を rg で確認した結果、.claude/agents/review-issue.md を機能的に必要とする production skill / SubAgent 定義は存在しない。参照は以下の bookkeeping 目的の 3 箇所のみ:
    • tests/fixtures/agent-config/expected-runtime-contract.json: required_agents.review-issue(claude_agent_path: .claude/agents/review-issue.md)と asset_classification[".claude/agents/review-issue.md"]: "shared_claude_runtime"(同ファイルの .agents/skills/review-issue/SKILL.md への review-issue Skill 参照は削除対象外)
    • tests/fixtures/agent-config/agent_permission_baseline.json: "review-issue.md" エントリ
    • scripts/agent_ops_inventory.py: PLAN_REGISTRY["issue-refinement"].must_read 内の .claude/agents/review-issue.md
  • docs/dev/agent-skill-boundaries.md は review-issue(standalone SubAgent)を write SubAgent として記載する行(49行目付近)、review-issue / issue-reviewer 使い分け表(87-93行目付近)、および orchestrator → issue-reviewer SubAgent → review-issue skill という 実装: fix: root-owned review routing から issue-reviewer の byte relay を除去する #2380 以前の古い呼び出し関係を記述する行(852行目付近)を含み、現行 root-owned pipeline architecture と不整合。
  • docs/dev/dor.md(231行目付近)は「スコープ妥当性・体験判断」の担当を review-issue とだけ表記しており、Skill と Agent のどちらを指すか曖昧。
  • docs/dev/extension-surface-runtime-policy.yaml の risk-trigger policy(現行 main で review-issue Skill 経由の deterministic gate に配線済みであることを本 Issue の Step 2 review 実行で確認)は、.claude/agents/** と .claude/skills/**/SKILL.md を対象とする変更に対して default_decision: immediate を要求する rule(agent-lifecycle-frontmatter-or-body-change / skill-invocation-procedure-or-contract-change / subagent-lifecycle-start-stop-delegation-fallback)を持つ。これらの rule の例外(proven_not_runtime_loaded 等)は approval_authority: owner の human evidence を要求するため、本 Issue は Runtime Verification Applicability: immediate を宣言する。

Remaining Parent Gaps

なし(単独 Issue)

Outcome

.claude/agents/review-issue.md(write-capable standalone SubAgent)を public runtime inventory から削除し、canonical な public review UX を .claude/skills/review-issue/SKILL.md(Skill)へ一意化する。あわせて tests/fixtures/agent-config/expected-runtime-contract.json、tests/fixtures/agent-config/agent_permission_baseline.json、scripts/agent_ops_inventory.py の該当エントリを削除し、docs/dev/agent-skill-boundaries.md と docs/dev/dor.md の stale な記述を現行 root-owned architecture(main/root → review-issue Skill → main/root → edit-issue controlled transaction)に合わせて更新する。review-issue Skill の standalone needs-fix 分岐は edit-issue Skill の controlled executor 経由のみに一本化し、直接 gh issue edit を実行する記述を除去する。.claude/agents/issue-reviewer.md は現行定義のまま維持する(legacy advisory / diagnostic compatibility asset としての位置づけは既に正しい)。変更完了をもって、上記ファイル群の修正を含む単一 PR が作成された状態を完了とする。

Runtime Verification Applicability

.claude/agents/review-issue.md の削除と .claude/skills/review-issue/SKILL.md の Procedure Step 5 変更は、docs/dev/extension-surface-runtime-policy.yaml の agent-lifecycle-frontmatter-or-body-change / skill-invocation-procedure-or-contract-change / subagent-lifecycle-start-stop-delegation-fallback rule(既定判定は immediate)に該当する。これらの例外(proven_not_runtime_loaded 等)は approval_authority: owner の human evidence を要求し、本 Issue の時点でその evidence は提出されていないため immediate を宣言する。

decision: immediate
reason: "extension-surface-runtime-policy.yaml の agent-lifecycle-frontmatter-or-body-change / skill-invocation-procedure-or-contract-change / subagent-lifecycle-start-stop-delegation-fallback rule に該当し、owner exception evidence が未提出のため"
applicable_acs:
  - AC7
execution_environment:
  cli_tools:
    - claude
    - python3
    - uv
  runner: scripts/agent-ops/run_worktree_agent_runtime_smoke.py
  mode: structured
  auth_required: true
  network_required: false
skip_conditions:
  - "claude バイナリが利用不可の場合は SKIP(exit 77)とし Stop Condition を発火させる"
  - "実装用 worktree が利用不可の場合は SKIP(exit 77)とし Stop Condition を発火させる"
fallback_policy:
  fallback_success_is_pass: false
  notes: "_*_fallback: true 等の fallback 経由でのみ成功した場合は FAIL として扱い、PASS と判定しない"
artifact_requirements:
  - "run_worktree_agent_runtime_smoke.py の stream-json / evidence-json 出力"
  - "docs/dev/runtime-verification-policy.md 所定フォーマットの実行ログ"
  - "PR 本文 ## Runtime Verification Evidence セクションへの inline 引用"

In Scope

  • .claude/agents/review-issue.md を削除する。
  • tests/fixtures/agent-config/expected-runtime-contract.json から required_agents.review-issue エントリと asset_classification[".claude/agents/review-issue.md"] エントリを削除する(.agents/skills/review-issue/SKILL.md への Skill 参照は維持する)。
  • tests/fixtures/agent-config/agent_permission_baseline.json から "review-issue.md" エントリを削除する。
  • scripts/agent_ops_inventory.py の PLAN_REGISTRY["issue-refinement"].must_read から .claude/agents/review-issue.md を削除する。
  • .claude/skills/review-issue/SKILL.md の Procedure Step 5(standalone needs-fix 分岐)を、edit-issue Skill の controlled executor 経由の本文更新のみに一本化する(直接 gh issue edit 実行の選択肢を除去する)。
  • docs/dev/agent-skill-boundaries.md の review-issue(standalone SubAgent)記述、review-issue / issue-reviewer 使い分け表、および orchestrator → issue-reviewer SubAgent → review-issue skill という 実装: fix: root-owned review routing から issue-reviewer の byte relay を除去する #2380 以前の呼び出し関係記述を、現行 root-owned architecture に合わせて更新する。
  • docs/dev/dor.md の review-issue 参照を Skill であることが明確になるよう更新する。

Out of Scope

  • issue-refinement-loop skill 全体のオーケストレーションロジックの再設計。
  • .claude/agents/issue-reviewer.md の変更(現行定義に defect がないため対象外)。
  • review-issue / issue-reviewer 以外の SubAgent 定義の変更。
  • 新しい ledger / broker / receipt / hook / schema / security harness の導入。
  • docs/dev/extension-surface-runtime-policy.yaml の rule 自体の変更(本 Issue は既存 rule に従うのみで、rule 定義は対象外)。

Acceptance Criteria

  • AC1: .claude/agents/review-issue.md が削除されており、standalone write-capable review-issue SubAgent が存在しない。canonical な public review UX は .claude/skills/review-issue/SKILL.md(Skill)のみである。
  • AC2: tests/fixtures/agent-config/expected-runtime-contract.json から required_agents.review-issue エントリと asset_classification[".claude/agents/review-issue.md"] エントリが削除され、tests/fixtures/agent-config/agent_permission_baseline.json から "review-issue.md" エントリが削除され、scripts/agent_ops_inventory.py の PLAN_REGISTRY["issue-refinement"].must_read から .claude/agents/review-issue.md が削除されている。
  • AC3: .claude/skills/review-issue/SKILL.md の standalone needs-fix(invoked_as_loop: false)分岐が、ユーザー承認後に edit-issue Skill の controlled executor 経由でのみ本文を更新し、直接 gh issue edit を実行するコマンド例を本文中に含まない。
  • AC4: canonical issue-refinement-loop Step 2 が issue-reviewer Agent を起動しないという既存契約(実装: fix: root-owned review routing から issue-reviewer の byte relay を除去する #2380)に変更がなく、.claude/agents/issue-reviewer.md は本 Issue で変更されていない。
  • AC5: tests/fixtures/agent-config/expected-runtime-contract.json、scripts/agent_ops_inventory.py、docs/dev/agent-skill-boundaries.md が同一の topology(review-issue は Skill のみとして存在し Agent は存在しない。issue-reviewer は legacy advisory)を表しており、docs/dev/agent-skill-boundaries.md に review-issue(standalone SubAgent)を write SubAgent として記載する行、および orchestrator → issue-reviewer SubAgent → review-issue skill という 実装: fix: root-owned review routing から issue-reviewer の byte relay を除去する #2380 以前の呼び出し関係を記述する行が残っていない。
  • AC6: 既存の focused tests(tests/test_agent_portability_contract.py、tests/test_agent_ops_inventory.py)と pnpm typecheck / pnpm lint / pnpm test / pnpm build がすべて PASS する。
  • AC7: worktree-agent-runtime-smoke(skill-invocation-runtime-smoke profile、Issue 実装: run_worktree_agent_runtime_smoke.py に skill-invocation-runtime-smoke profile を実装し causal-evidence 既定強制を opt-out 可能にする #2498 / PR feat: run_worktree_agent_runtime_smoke.py に skill-invocation-runtime-smoke profile を実装 (#2498) #2500 で追加された --expect-marker-source main / --expect-skill-command / --expect-ordered-marker / --output-schema-path の現行 CLI contract)を用いて review-issue Skill を SubAgent 委譲なしの direct Skill invocation として実際に起動し、native UserPromptExpansion.command_name evidence(--expect-skill-command review-issue)で direct invocation を確認し、Procedure の手順が宣言順に実行されたこと(procedure_steps_executed_in_declared_order、ordered marker evidence)と、canonical output schema(.claude/skills/review-issue/schemas/review_issue_result_v1.json)を満たすことを実機で確認する。削除済み review-issue Agent への automatic delegation は発生しない(native evidence で SubAgent spawn が観測されないことを確認する)。fallback 経由でのみ成功する場合や SKIP(exit 77)は PASS として扱わない。

Verification Commands

# AC1
$ test ! -e .claude/agents/review-issue.md
# expect: exit 0 (agent file removed)
# baseline-expect: pass
$ test -f .claude/skills/review-issue/SKILL.md
# expect: exit 0 (skill file present)

# AC2
$ uv run pytest tests/test_agent_portability_contract.py::TestPermissionBaselineUnchanged::test_all_agents_tools_and_disallowed_tools_match_checked_in_baseline -v
$ uv run pytest tests/test_agent_portability_contract.py::TestAssetInventoryClassification -v
$ uv run pytest tests/test_agent_ops_inventory.py::TestPlanRegistry -v
# baseline-expect: pass
$ grep -c "\.claude/agents/review-issue\.md" scripts/agent_ops_inventory.py
# expect: 0 (currently 1; must become 0 after this Issue's PR)
# baseline-expect: pass
$ grep -c "\.claude/agents/review-issue\.md" tests/fixtures/agent-config/expected-runtime-contract.json
# expect: 0 (currently 1; must become 0 after this Issue's PR)

# AC3
# baseline-expect: pass
$ grep -c "gh issue edit" .claude/skills/review-issue/SKILL.md
# expect: 0 (currently non-zero; must become 0 after this Issue's PR)
# baseline-expect: pass
$ grep -n "edit-issue" .claude/skills/review-issue/SKILL.md
# expect: at least one match near the standalone needs-fix / Step 5 handoff description

# AC4
# baseline-expect: pass
$ grep -c "起動されない" .claude/skills/issue-refinement-loop/SKILL.md
# expect: at least 1 (existing #2380 contract unchanged)
# baseline-expect: pass
$ git diff --quiet HEAD -- .claude/agents/issue-reviewer.md
# expect: exit 0 (file not modified by this Issue's PR)

# AC5
# baseline-expect: pass
$ grep -c "review-issue.*standalone SubAgent" docs/dev/agent-skill-boundaries.md
# expect: 0 (currently non-zero; must become 0 after this Issue's PR)
# baseline-expect: pass
$ grep -c "issue-reviewer SubAgent.*review-issue skill" docs/dev/agent-skill-boundaries.md
# expect: 0 (currently non-zero; must become 0 after this Issue's PR)

# AC6
$ uv run pytest tests/test_agent_portability_contract.py tests/test_agent_ops_inventory.py -v
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build

# AC7
# runtime-verification: true — 実装完了後 test-runner が実装用 worktree・prompt-file を渡して実行し、証跡は PR 本文に引用する
# baseline-expect: deferred
$ uv run python3 scripts/agent-ops/run_worktree_agent_runtime_smoke.py --runtime claude --mode structured --worktree WORKTREE_PATH --prompt-file PROMPT_FILE_PATH --output-dir artifacts/ --expect-marker-source main --expect-skill-command review-issue --expect-ordered-marker REVIEW_ISSUE_SKILL_PROCEDURE_COMPLETE --output-schema-path .claude/skills/review-issue/schemas/review_issue_result_v1.json
# expect: exit 0 (--expect-marker-source main は --expect-skill-command との必須ペア。native UserPromptExpansion.command_name == "review-issue" evidence で direct Skill invocation を確認し、SubAgent 委譲は発生しないことを示す)
# 実行環境(claude バイナリ / worktree)が利用不可の場合は SKIP(exit 77)とし Stop Condition を発火させる

Allowed Paths

  • .claude/agents/review-issue.md
  • .claude/skills/review-issue/SKILL.md
  • tests/fixtures/agent-config/expected-runtime-contract.json
  • tests/fixtures/agent-config/agent_permission_baseline.json
  • scripts/agent_ops_inventory.py
  • docs/dev/agent-skill-boundaries.md
  • docs/dev/dor.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • credential/OAuth/secret 開示が必要になった場合
  • destructive operation が必要になった場合
  • issue-refinement-loop 全体のオーケストレーション再設計が必要と判明した場合(その場合は follow-up issue へ分離する)
  • 動作検証 AC(AC7)の VC が SKIP(exit 77)を返した場合(実行環境不可のためエスカレーション)
  • fallback 経由でのみ「成功」する場合(FAIL として扱い、実行環境を確認)

Required Skills

なし

Required Design References

  • .claude/skills/edit-issue/SKILL.md(controlled executor 経由の mutation lane、正規パターンとして参照)
  • .claude/skills/issue-refinement-loop/SKILL.md(issue-reviewer の読み専用契約と canonical Step 2 routing の正本)
  • docs/dev/extension-surface-runtime-policy.yaml(本 Issue の Runtime Verification Applicability: immediate の判定根拠)
  • docs/dev/runtime-verification-policy.md(動作検証 AC の SKIP 規約・証跡保存・Stop Condition 連動)
  • .claude/skills/worktree-agent-runtime-smoke/SKILL.md(AC7 の実機確認手順)
  • git log -- .claude/agents/review-issue.md / .claude/agents/issue-reviewer.md(更新頻度の実測根拠)

Related

#2192(本 Issue の根拠となった retrospective research issue)
#2380 / PR #2386(issue-reviewer を canonical Step 2 loop worker から外した先行変更)
#2498 / PR #2500(run_worktree_agent_runtime_smoke.py に --expect-marker-source / --expect-skill-command / --expect-ordered-marker / --output-schema-path を追加し、本 AC7 の runtime contract 非両立を解消した先行変更)

Activity

  1. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES — 現状の #2194 はそのまま実装しない方がよい

    狙い自体は妥当ですが、2026-08-16 に書かれた Issue の前提が現在の main に追い越されています。特に #2380 / PR #2386 のマージ後は、issue-reviewer は canonical issue-refinement-loop の Step 2 worker ではありません。現在の root-owned pipeline は issue-reviewer を起動せず、検証済み結果を直接 routing します。 PR #2386 もこの変更を明示してマージ済みです。

    したがって、#2194 が現在も前提にしている「review-issue.md と issue-reviewer.md という2つの現役 reviewer の責務重複を整理する」という問題設定は stale です。#2194 の Required Design References も issue-refinement-loop を「issue-reviewer の呼び出し元」としていますが、これは現在の実装と一致しません。

    敵対的レビュー findings

    1. P0: 本当の重複相手は issue-reviewer ではなく、review-issue Agent と review-issue Skill です。 現在の Skill は standalone 実行の needs-fix で、ユーザー承認後にすでに edit-issue Skill を呼ぶ設計です。loop 実行では mutation を caller に返します。 一方 .claude/agents/review-issue.md は同じ Skill を preload しながら、自前で tmp/ 作成、gh issue edit --body-file、gh issue comment まで再定義しています。 ここが現在の実際の二重 ownership です。

    2. P0: 推奨されている「review-issue → issue-editor」という write-capable SubAgent の二段 delegation は、リポジトリ自身の最新方針と逆です。 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 は root/main thread が routing・最終判断・Issue/PR mutation を所有し、write-capable → write-capable の nested delegation を禁止しています。 したがって review-issue Agent から issue-editor を呼ばせるより、main → review-issue Skill → main → edit-issue と直列にするのが自然です。

    3. P0: issue-reviewer.md はこの Issue では極力触らない方がよいです。 fix: root-owned review routing から issue-reviewer の byte relay を除去する #2386 により legacy advisory / diagnostic 用へ後退済みです。そこを 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 でさらに編集すると、「既に canonical path から外れた compatibility surface」のために変更範囲と parity work を増やすだけです。PR fix: root-owned review routing から issue-reviewer の byte relay を除去する #2386 は Claude 定義だけでなく .codex/agents/issue-reviewer.toml も同時更新しているため、もし issue-reviewer の契約を変更するなら Codex 側も無視できません。

    4. P1: Allowed Paths が不足しています。 review-issue.md の runtime 契約は tests/fixtures/agent-config/expected-runtime-contract.json に入り、permission baseline にも登録されています。 また docs/dev/agent-skill-boundaries.md は今も issue-reviewer を loop worker と記述しており、すでに current main と split-brain です。 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 の Allowed Paths ではこの正本候補を修正できません。

    5. P1: AC1 の grep -rn "review-issue" は「SubAgent caller inventory」を証明しません。 Claude Code は SubAgent の description とユーザー要求・context から自動 delegation を決めるため、静的な明示 caller が存在しないことがあります。(Claude) Skill も description を使って自動選択され、/review-issue で直接実行できます。(Claude) 同名の Skill と Agent が並存していること自体が routing ambiguity です。

    6. P1: AC2 の「gh issue edit が grep で 0 件」は品質証明として弱すぎます。 リポジトリ自身の 実装: Issue VC 設計改善: 「削除確認 VC は削除対象 literal を列挙する」原則を body-authoring.md に追記し review-issue の non-blocking warning check に反映する #46 が、negative grep 型 VC は「削除したい記述」と「保持すべき記述」を区別できず過広になる、と既に指摘しています。 さらに 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 は body edit の文字列だけ消せば PASS できますが、現行 Agent は gh issue comment も直接 mutation しています。 「mutation 一本化」という Outcome と AC が一致していません。

    7. P1: permissionMode: acceptEdits を reviewer の実行性の根拠にするのも現在の Claude Code では脆弱です。 親が Auto mode の場合、SubAgent frontmatter の permissionMode は無視され、親と同じ classifier で判定されます。(Claude) 実際、このリポジトリでは 実装: Claude-GPT Auto の issue-editor canonical transaction の false-deny を解消する #2433 / PR fix: allow canonical issue editor transaction in Auto mode #2438 で issue-editor の canonical transaction が Auto mode で false-deny される問題を修正したばかりです。PR はマージ済みですが、actual Auto canary は runtime unavailable で未証明です。 ここにさらに reviewer → editor の agent hop を増やす利益はありません。

    8. P2: Agent に Skill 本文相当の手順をもう一度持たせること自体がコストです。 Claude Code は skills: に指定した Skill の全文を SubAgent 起動時に context へ注入します。(Claude) 公式ドキュメントも Skill 本文を簡潔にすることを推奨しています。(Claude) 実装: Agent/Skill の重複を削減し progressive disclosure へ移行する #1732 の repository 方針も「Agent は role / ID / prohibition 程度、argv・routing・schema body は Skill が owner」としています。 review-issue.md はこの原則に対してかなり fat です。

    推奨する再設計

    私なら #2194 を 「2 reviewer の役割を区別する」Issue から、「standalone write reviewer を public path から除去する」Issueへ reframe します。

    Surface | 推奨状態 -- | -- .claude/skills/review-issue/SKILL.md | 唯一の user-facing review UX として維持 .claude/agents/review-issue.md | 削除または legacy thin wrapper 化。mutation 手順を持たせない .claude/agents/issue-reviewer.md | #2380 compatibility asset として原則変更しない review 結果の最終判断 | main thread standalone の body mutation | main thread → edit-issue Skill / edit_issue_txn.py を直接実行 loop rewrite | 現行 root-owned orchestration のまま issue-editor | 実際に専用 rewrite worker が必要な経路だけで維持

    重要なのは、canonical mutation implementation と canonical agent を混同しないことです。一本化すべきなのは「最終的にどの helper が Issue を更新するか」であり、わざわざすべてを issue-editor SubAgent に通す必要はありません。main thread が edit_issue_txn.py を直接呼べば、LLM hop を1つ減らしたまま transaction semantics は共用できます。

    また、趣味開発の使い勝手をさらに優先するなら、raw gh issue edit --body-file 自体を危険物扱いする必要もありません。これは GitHub CLI の正式な操作で、現在は --parent、--add-sub-issue、blocked-by まで標準 CLI で扱えます。(GitHub CLI) controlled helper は「競合 write、relation synchronization、自動ループ」のために価値がありますが、human-confirmed standalone edit に複雑な permission/harness を強制すること自体を目的化しない方がよいです。

    #2194 の改訂後ゴール案

    タイトルは例えば、

    refactor: standalone review-issue SubAgent を廃止し review UX と mutation ownership を Skill/main に集約する

    くらいが現在の reality に合います。

    Outcome は「/review-issue Skill を canonical user-facing surface とし、standalone write-capable review-issue SubAgent に存在する重複 review/mutation procedure を除去する。main session が review verdict とユーザー確認を所有し、承認された Issue mutation は既存 edit-issue transaction helper を直接利用する。legacy issue-reviewer は #2380 の compatibility/diagnostic asset として変更しない」とするのが最も単純です。

    Verification も grep 3本ではなく、既存 runtime-contract fixture/parity testに「review-issue write agent が public runtime inventory から消えた、または read-only thin wrapper になった」「review-issue Skill standalone needs-fix → edit-issue handoff が残る」「canonical Step 2 が issue-reviewer を起動しない」という3つの invariant を追加する程度で十分です。新しい ledger、hook、broker、receipt は不要です。

    結論として、#2194 は close/not-planned にするほど目的が消えたわけではありませんが、現本文のまま implementation-ready とは判定しません。 issue-reviewer を整理対象から外し、review-issue Agent vs Skill の重複削減に焦点を移すのが、現在の main、#1860 minimal-harness 方針、Claude Code 現行仕様、そして完走率優先という条件のすべてに最も整合します。#2194 自体には現在コメントがなく、元の根拠である #2192 の Owner review も #2194 を「Issue mutation 経路だけの局所 remediation」に限定するよう明示しています。

    必要なら次に、このレビューをそのまま反映した **#2194 の改訂本文(Outcome / Scope / AC / VC / Allowed Paths / Stop Conditions まで完成形)**を作れます。

    ## 判定: **REQUEST_CHANGES — 現状の #2194 はそのまま実装しない方がよい**

    狙い自体は妥当ですが、2026-08-16 に書かれた Issue の前提が現在の main に追い越されています。特に #2380 / PR #2386 のマージ後は、issue-reviewer は canonical issue-refinement-loop の Step 2 worker ではありません。現在の root-owned pipeline は issue-reviewer を起動せず、検証済み結果を直接 routing します。 PR #2386 もこの変更を明示してマージ済みです。

    したがって、#2194 が現在も前提にしている「review-issue.md と issue-reviewer.md という2つの現役 reviewer の責務重複を整理する」という問題設定は stale です。#2194 の Required Design References も issue-refinement-loop を「issue-reviewer の呼び出し元」としていますが、これは現在の実装と一致しません。

    敵対的レビュー findings

    1. P0: 本当の重複相手は issue-reviewer ではなく、review-issue Agent と review-issue Skill です。 現在の Skill は standalone 実行の needs-fix で、ユーザー承認後にすでに edit-issue Skill を呼ぶ設計です。loop 実行では mutation を caller に返します。 一方 .claude/agents/review-issue.md は同じ Skill を preload しながら、自前で tmp/ 作成、gh issue edit --body-file、gh issue comment まで再定義しています。 ここが現在の実際の二重 ownership です。

    2. P0: 推奨されている「review-issue → issue-editor」という write-capable SubAgent の二段 delegation は、リポジトリ自身の最新方針と逆です。 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 は root/main thread が routing・最終判断・Issue/PR mutation を所有し、write-capable → write-capable の nested delegation を禁止しています。 したがって review-issue Agent から issue-editor を呼ばせるより、main → review-issue Skill → main → edit-issue と直列にするのが自然です。

    3. P0: issue-reviewer.md はこの Issue では極力触らない方がよいです。 fix: root-owned review routing から issue-reviewer の byte relay を除去する #2386 により legacy advisory / diagnostic 用へ後退済みです。そこを 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 でさらに編集すると、「既に canonical path から外れた compatibility surface」のために変更範囲と parity work を増やすだけです。PR fix: root-owned review routing から issue-reviewer の byte relay を除去する #2386 は Claude 定義だけでなく .codex/agents/issue-reviewer.toml も同時更新しているため、もし issue-reviewer の契約を変更するなら Codex 側も無視できません。

    4. P1: Allowed Paths が不足しています。 review-issue.md の runtime 契約は tests/fixtures/agent-config/expected-runtime-contract.json に入り、permission baseline にも登録されています。 また docs/dev/agent-skill-boundaries.md は今も issue-reviewer を loop worker と記述しており、すでに current main と split-brain です。 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 の Allowed Paths ではこの正本候補を修正できません。

    5. P1: AC1 の grep -rn "review-issue" は「SubAgent caller inventory」を証明しません。 Claude Code は SubAgent の description とユーザー要求・context から自動 delegation を決めるため、静的な明示 caller が存在しないことがあります。([Claude]1) Skill も description を使って自動選択され、/review-issue で直接実行できます。(Claude) 同名の Skill と Agent が並存していること自体が routing ambiguity です。

    6. P1: AC2 の「gh issue edit が grep で 0 件」は品質証明として弱すぎます。 リポジトリ自身の 実装: Issue VC 設計改善: 「削除確認 VC は削除対象 literal を列挙する」原則を body-authoring.md に追記し review-issue の non-blocking warning check に反映する #46 が、negative grep 型 VC は「削除したい記述」と「保持すべき記述」を区別できず過広になる、と既に指摘しています。 さらに 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 は body edit の文字列だけ消せば PASS できますが、現行 Agent は gh issue comment も直接 mutation しています。 「mutation 一本化」という Outcome と AC が一致していません。

    7. P1: permissionMode: acceptEdits を reviewer の実行性の根拠にするのも現在の Claude Code では脆弱です。 親が Auto mode の場合、SubAgent frontmatter の permissionMode は無視され、親と同じ classifier で判定されます。(Claude) 実際、このリポジトリでは 実装: Claude-GPT Auto の issue-editor canonical transaction の false-deny を解消する #2433 / PR fix: allow canonical issue editor transaction in Auto mode #2438 で issue-editor の canonical transaction が Auto mode で false-deny される問題を修正したばかりです。PR はマージ済みですが、actual Auto canary は runtime unavailable で未証明です。 ここにさらに reviewer → editor の agent hop を増やす利益はありません。

    8. P2: Agent に Skill 本文相当の手順をもう一度持たせること自体がコストです。 Claude Code は skills: に指定した Skill の全文を SubAgent 起動時に context へ注入します。([Claude]1) 公式ドキュメントも Skill 本文を簡潔にすることを推奨しています。(Claude) 実装: Agent/Skill の重複を削減し progressive disclosure へ移行する #1732 の repository 方針も「Agent は role / ID / prohibition 程度、argv・routing・schema body は Skill が owner」としています。 review-issue.md はこの原則に対してかなり fat です。

    推奨する再設計

    私なら #2194 を 「2 reviewer の役割を区別する」Issue から、「standalone write reviewer を public path から除去する」Issueへ reframe します。

    Surface 推奨状態
    .claude/skills/review-issue/SKILL.md 唯一の user-facing review UX として維持
    .claude/agents/review-issue.md 削除または legacy thin wrapper 化。mutation 手順を持たせない
    .claude/agents/issue-reviewer.md #2380 compatibility asset として原則変更しない
    review 結果の最終判断 main thread
    standalone の body mutation main thread → edit-issue Skill / edit_issue_txn.py を直接実行
    loop rewrite 現行 root-owned orchestration のまま
    issue-editor 実際に専用 rewrite worker が必要な経路だけで維持

    重要なのは、canonical mutation implementation と canonical agent を混同しないことです。一本化すべきなのは「最終的にどの helper が Issue を更新するか」であり、わざわざすべてを issue-editor SubAgent に通す必要はありません。main thread が edit_issue_txn.py を直接呼べば、LLM hop を1つ減らしたまま transaction semantics は共用できます。

    また、趣味開発の使い勝手をさらに優先するなら、raw gh issue edit --body-file 自体を危険物扱いする必要もありません。これは GitHub CLI の正式な操作で、現在は --parent、--add-sub-issue、blocked-by まで標準 CLI で扱えます。(GitHub CLI) controlled helper は「競合 write、relation synchronization、自動ループ」のために価値がありますが、human-confirmed standalone edit に複雑な permission/harness を強制すること自体を目的化しない方がよいです。

    #2194 の改訂後ゴール案

    タイトルは例えば、

    refactor: standalone review-issue SubAgent を廃止し review UX と mutation ownership を Skill/main に集約する

    くらいが現在の reality に合います。

    Outcome は「/review-issue Skill を canonical user-facing surface とし、standalone write-capable review-issue SubAgent に存在する重複 review/mutation procedure を除去する。main session が review verdict とユーザー確認を所有し、承認された Issue mutation は既存 edit-issue transaction helper を直接利用する。legacy issue-reviewer は #2380 の compatibility/diagnostic asset として変更しない」とするのが最も単純です。

    Verification も grep 3本ではなく、既存 runtime-contract fixture/parity testに「review-issue write agent が public runtime inventory から消えた、または read-only thin wrapper になった」「review-issue Skill standalone needs-fix → edit-issue handoff が残る」「canonical Step 2 が issue-reviewer を起動しない」という3つの invariant を追加する程度で十分です。新しい ledger、hook、broker、receipt は不要です。

    結論として、#2194 は close/not-planned にするほど目的が消えたわけではありませんが、現本文のまま implementation-ready とは判定しません。 issue-reviewer を整理対象から外し、review-issue Agent vs Skill の重複削減に焦点を移すのが、現在の main、#1860 minimal-harness 方針、Claude Code 現行仕様、そして完走率優先という条件のすべてに最も整合します。#2194 自体には現在コメントがなく、元の根拠である #2192 の Owner review も #2194 を「Issue mutation 経路だけの局所 remediation」に限定するよう明示しています。

    必要なら次に、このレビューをそのまま反映した **#2194 の改訂本文(Outcome / Scope / AC / VC / Allowed Paths / Stop Conditions まで完成形)**を作れます。

  2. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    推奨は #2194 を close せず、anchor comment を trusted human context として in-place reframe することです。現行 main では canonical Step 2 は issue-reviewer を起動せず root-owned pipeline を直接 consume するため、元の「review-issue と issue-reviewer の二重 reviewer 整理」という前提は stale です。 PR #2386 でもこの変更は実装・マージ済みです。

    推奨アクションは次です。

    • 本当の整理対象を review-issue Skill vs write-capable review-issue SubAgent に変更する。現行 Agent は Skill を preload しつつ gh issue edit / gh issue comment まで再定義しており、明確な二重 ownership です。 一方 Skill 側は standalone needs-fix で既に edit-issue への handoff を所有しています。
    • 第一選択は .claude/agents/review-issue.md の public runtime からの削除。current main を調査して実 runtime consumer が存在する場合だけ read-only legacy thin wrapper を代替案とし、refinement 中にどちらかへ確定させます。issue-reviewer.md 自体は既に legacy advisory と正しく記述されているので原則変更しません。
    • 削除する場合は Agent ファイルだけで終わりません。runtime contract fixture に review-issue が required agent / shared runtime として登録され、agent_ops_inventory.py の refinement MUST_READ にも入っています。これらと stale な docs/dev/agent-skill-boundaries.md を scope に含める必要があります。 現行 boundary doc はまだ issue-reviewer を loop worker として記述しており、実装と食い違っています。
    • review-issue → issue-editor という write-capable nested agent chain は採用しません。repo の minimal-harness 方針では root/main が routing・最終判断・Issue/PR mutation を所有し、write-capable → write-capable nested delegation は禁止されています。 main → review-issue Skill → main → edit-issue transaction helper に寄せるのが妥当です。
    • Auto mode では SubAgent frontmatter の permissionMode に依存させない方がよいです。現行 Claude Code では親が Auto mode の場合、child は Auto mode を継承し、child の permissionMode は無視されます。(Claude) また Agent と Skill はそれぞれ description をもとに自動選択されるため、同じ review-issue 用途を二つ公開するメリットも小さいです。([Claude]1)

    以下を Auto mode の対話的 Claude Code にそのまま投入する構成を推奨します。

    squne121/loop-protocol の Issue #2194 に対して issue-refinement-loop を実行してください。

    対象:
    #2194

    今回ユーザーが明示的に選択した trusted anchor comment:
    #2194 (comment)

    実行目的

    Issue #2194 を現在の main と上記 OWNER anchor comment に合わせて in-place refinement し、implementation-ready な Issue contract にしてください。

    この refinement loop は人間承認なしで最後まで進めてください。

    • iteration 間の承認を求めない
    • Issue 本文を書き換える前にもユーザーへ yes/no を求めない
    • anchor comment の採用可否を再確認しない
    • deterministic に解決可能な事項について AskUserQuestion を使わない
    • bounded loop の範囲内で review → rewrite → final review を自動継続する

    issue-refinement-loop 自身の loop_iteration_approval_gate.default_required: false を尊重してください。

    ただし Claude Code の permission/security mechanism を無効化するという意味ではありません。
    bypassPermissions、--dangerously-skip-permissions、wildcard permission allow 等へ逃げないでください。

    今回の downstream scope

    今回は Issue refinement の完了までです。

    Issue が implementation-ready / approved になっても、

    • root_entry_router.py による implementation entry
    • impl-review-loop
    • implementation-worker
    • branch/worktree 作成
    • コード実装
    • commit / push
    • PR 作成

    には進まないでください。

    refined Issue の最終 review と必要な termination/report の処理まで完了したところで停止してください。

    実装は別の依頼で開始します。

    Anchor の扱い

    上記 comment URL は、今回ユーザー自身が指定した operator-selected human context です。

    URL 単独の unlabeled lane として扱わず、issue-refinement-loop が規定する trusted human-context lane を使ってください。

    必要なら canonical profile:

    preflight.run.with_human_context

    および、その結果に従う

    contract_update.run.with_human_context

    を使用してください。

    anchor に示された reframe を scope change として検出した場合も、ユーザーに再承認を要求しないでください。

    current repository evidence から exact Allowed Paths を導出できる場合は、自動的に調査して refinement を続行してください。

    必須 SubAgent 調査

    mutation を始める前に read-only SubAgent を使用してください。

    1. codebase-investigator

    current main を調査させ、少なくとも以下を確認してください。

    特に .claude/agents/review-issue.md を削除した場合に修正が必要になる exact repository-relative paths と focused tests を列挙させてください。

    2. web-researcher

    Claude Code の current official documentation のみを優先して確認させてください。

    確認対象:

    • SubAgent automatic delegation と description
    • Skill automatic invocation と description
    • SubAgent の skills: preload semantics
    • Auto mode 下での SubAgent permissionMode inheritance
    • PermissionRequest hook の current semantics

    ブログや古い二次資料より公式 docs を authority にしてください。

    SubAgent 実行規則

    • 上記 read-only 調査は並列実行して構いません。
    • SubAgent からさらに write-capable SubAgent を起動させないでください。
    • nested delegation はさせないでください。
    • 必ず全 SubAgent の完了を待ってください。
    • 全結果を main/root thread に戻してから evidence を join し、Issue rewrite を開始してください。
    • SubAgent がまだ running の状態で Issue mutation や最終判断へ進まないでください。

    #2194 の推奨 reframe

    anchor comment をそのままコピーするのではなく、current main の実測結果と照合して最終 contract を作ってください。

    基本方向は以下です。

    Problem statement

    旧:
    review-issue.md と issue-reviewer.md という2つの現役 reviewer の責務重複

    新:
    canonical review-issue Skill と standalone write-capable review-issue SubAgent が review procedure / mutation ownership を重複所有していること、および関連 runtime inventory / documentation が現在の root-owned architecture と不整合であること

    Canonical ownership

    最終形は原則として:

    main/root → review-issue Skill → main/root → edit-issue controlled transaction

    としてください。

    以下にはしないでください。

    review-issue write SubAgent → issue-editor write SubAgent

    write-capable → write-capable nested delegation を新設しないでください。

    issue-reviewer

    .claude/agents/issue-reviewer.md は #2380 / PR #2386 後の legacy advisory / diagnostic compatibility asset として原則維持してください。

    canonical issue-refinement-loop Step 2 worker へ戻さないでください。

    現在の agent definition が既に正しい場合、#2194 の implementation scope から外してください。

    ただし stale documentation の修正は scope に含めて構いません。

    review-issue SubAgent

    current main の参照調査結果から concrete disposition を一つに確定してください。

    優先順位:

    1. 実 runtime consumer が存在しないなら .claude/agents/review-issue.md を public runtime inventory から削除する
    2. current compatibility consumer が実在して削除できない場合のみ、read-only / legacy thin wrapper へ縮退する

    「削除または thin wrapper のどちらでもよい」という未確定 AC のまま implementation-ready にしないでください。

    削除を選んだ場合は少なくとも以下への波及を検証してください。

    • tests/fixtures/agent-config/expected-runtime-contract.json
    • scripts/agent_ops_inventory.py
    • docs/dev/agent-skill-boundaries.md
    • current focused agent/runtime/inventory tests

    実測で追加参照が見つかれば Allowed Paths に追加してください。

    Skill

    .claude/skills/review-issue/SKILL.md を canonical user-facing review surface としてください。

    standalone needs-fix 時の mutation は既存 edit-issue controlled transaction semantics を利用する構成を維持してください。

    raw gh issue edit の文字列を消すこと自体をゴールにせず、ownership と runtime route をゴールにしてください。

    Acceptance Criteria の改善要求

    旧 AC の broad negative grep だけを completion proof にしないでください。

    refined AC / VC は、少なくとも次の positive invariant を証明できる形にしてください。

    1. canonical public review UX が review-issue Skill に一意化されている
    2. standalone write-capable review-issue Agent が public runtime inventory から削除された、または実 consumer の存在を根拠として明確な read-only legacy wrapper に縮退している
    3. review-issue Skill の standalone needs-fix → canonical edit transaction handoff が維持される
    4. canonical issue-refinement-loop Step 2 は引き続き issue-reviewer Agent を起動しない
    5. runtime contract fixture / agent inventory / human-facing boundary documentation が同じ topology を表す
    6. current focused tests が PASS する
    7. 新しい ledger / broker / receipt / hook / schema / security harness を導入しない

    rg / grep は inventory や diagnostic evidence として使って構いませんが、
    単なる「文字列が 0 件」を主要な品質証明にはしないでください。

    存在する current test を調査して VC に採用してください。
    存在しない test 名を推測で作らないでください。

    Allowed Paths

    旧 #2194 の Allowed Paths を authority として固定しないでください。
    anchor comment と current main の調査による controlled scope reframe を反映してください。

    必要な paths は evidence から exact に確定してください。

    想定候補:

    • .claude/agents/review-issue.md
    • .claude/skills/review-issue/SKILL.md
    • tests/fixtures/agent-config/expected-runtime-contract.json
    • scripts/agent_ops_inventory.py
    • docs/dev/agent-skill-boundaries.md
    • 上記変更に直接対応する既存 focused tests

    .claude/agents/issue-reviewer.md は current definition に実際の defect がない限り変更対象へ入れないでください。

    Auto mode / permission failure の扱い

    親 session は Auto mode の前提です。

    SubAgent frontmatter の permissionMode が Auto mode を上書きすると仮定しないでください。

    Issue rewrite では repository に既に存在する canonical controlled executor / PermissionRequest policy を使用してください。

    canonical transaction が Auto classifier または permission hook で一度拒否された場合:

    1. command/profile が canonical shape か確認する
    2. repo 内に既存の supported retry / controlled route があればそれだけを使う
    3. permission を広く緩める workaround は行わない
    4. ユーザーへ「許可してください」と対話要求しない

    supported canonical path を使っても permission/environment blocker が残る場合だけ、
    environment_failure / human_escalation 相当として evidence を残して停止してください。

    これは「人間承認待ち」ではなく、実行環境 blocker として扱ってください。

    自動継続

    max_iterations は repository default の bounded value を使ってください。

    needs-fix が返り、iteration budget が残っている限り:

    investigation
    → review
    → rewrite
    → readback
    → final review

    を人間確認なしで継続してください。

    途中で blocker が発生しても、

    • current main の read-only investigation
    • related Issue/PR の確認
    • official docs の確認
    • exact path derivation
    • deterministic contract rewrite

    で解消可能なら、ユーザーへ質問せず自分で解消してください。

    本当に停止してよい条件

    以下だけを hard stop としてください。

    • credential / token / secret の表示・変更が必要
    • privilege escalation が必要
    • destructive operation が必要
    • canonical controlled mutation path が実行環境上どうしても利用不能
    • current repository evidence と trusted anchor が真正に矛盾し、deterministic に disposition を選べない
    • refinement scope を超える実コード implementation が必要
    • write-capable nested delegation が必要になる
    • bounded iteration 上限まで到達しても contract が approve にならない

    停止時も追加承認を質問せず、取得済み evidence、未解決 blocker、推奨 next action を最終報告してください。

    最終完了条件

    以下をすべて満たしてから完了してください。

    • mandatory SubAgent が全員完了している
    • current main と anchor comment が照合済み
    • 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 本文が in-place で current reality に reframe 済み
    • title / Outcome / Scope / AC / VC / Allowed Paths / Stop Conditions / Required Design References が相互整合している
    • final review が approve
    • Issue 本文 readback が成功
    • 必要な termination/report comment が canonical publisher 経由で投稿済み
    • implementation handoff は実行していない

    最後に簡潔に以下を報告してください。

    • refinement verdict
    • Issue 本文で変更した主要 contract
    • 採用した review-issue Agent disposition(delete / legacy thin wrapper)と根拠
    • SubAgent の完了結果
    • 実行した verification
    • final Issue URL
    • unresolved blocker があればその内容

    途中経過の承認確認は不要です。最後まで自律的に進めてください。

    特に重要なのは、「承認不要」だけを指示するのではなく、trusted anchor の scope reframe・SubAgent join・Auto permission failure の扱い・実装 handoff の抑止まで明示することです。これで Claude Code が途中で「Allowed Paths が変わるので確認」「Issueを書き換えてよいか確認」に戻る可能性をかなり減らせます。

  3. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 完了報告

    主な reframe 内容

    • Problem statement を「review-issue.md と issue-reviewer.md の責務重複」から「canonical review-issue Skill と write-capable review-issue SubAgent の mutation ownership 重複、および runtime inventory / documentation の不整合」へ更新。
    • review-issue Agent(.claude/agents/review-issue.md)の disposition を 削除(public runtime inventory から除去)に確定。根拠: current main の read-only 調査(codebase-investigator SubAgent)で、機能的な production consumer が存在せず、参照は tests/fixtures/agent-config/expected-runtime-contract.json / agent_permission_baseline.json / scripts/agent_ops_inventory.py の bookkeeping エントリのみと確認。
    • .claude/agents/issue-reviewer.md はスコープ外(現行定義に defect なし、実装: fix: root-owned review routing から issue-reviewer の byte relay を除去する #2380 後の legacy advisory 位置づけのまま維持)。
    • Allowed Paths を旧来の broad .claude/skills/**/SKILL.md から、調査で確定した exact 7 パスへ narrow 化。
    • AC を「文字列 0 件」の broad negative grep から、6つの positive invariant + runtime-verification AC(AC7)へ再構成。
    • docs/dev/extension-surface-runtime-policy.yaml の risk-trigger policy(agent-lifecycle-frontmatter-or-body-change 等、default_decision: immediate)に該当することを検出し、Runtime Verification Applicability を deferred から immediate へ更新(owner exception evidence 未提出のため)。

    SubAgent 実行結果

    • codebase-investigator(read-only): .claude/agents/review-issue.md 削除時の影響範囲(6ファイル)と focused tests を特定。完了。
    • web-researcher(read-only): Claude Code 公式ドキュメントで Auto mode 下の SubAgent permissionMode 継承(推定、二次情報経由)、description ベースの automatic delegation、skills: preload semantics、PermissionRequest hook semantics を確認。完了。

    実行した verification

    • contract_readiness_check.py --mode preflight-static: status: go(エラー0件)
    • run_root_review_pipeline.py produce(canonical Step 2): verdict: approve / next_action: proceed / canonical_step2_route: step_2_5 → semantic_review_trigger.py: semantic_review_applicable: false
    • Issue 本文の live readback(gh issue view)による SHA256 独立検証(control-plane が3回、issue-editor SubAgent の自己申告とは独立に実施)

    Downstream scope(明示的に未実行)

    ユーザー指示により、以下は本セッションでは実行していません。

    • root_entry_router.py による implementation entry
    • impl-review-loop / implementation-worker の起動
    • branch / worktree 作成
    • コード実装・commit・push
    • PR 作成
    • LOOP_HANDOFF_RESULT_V1 marker の投稿(implementation handoff トリガーのため意図的に省略)

    実装は別の依頼で開始してください。

    unresolved blocker

    なし。

  4. self-assigned this
    on Sep 4, 2026
  5. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    推奨は、#2194 を refinement に戻さず、そのまま root-owned entry → impl-review-loop に入れることです。最新の refinement は approved / proceed、unresolved blocker なしで終了しており、implementation handoff だけ意図的に未実行です。 現在の main HEAD も Issue の validated HEAD 7ebdf158... と一致しています。

    実運用上は2点を追加した方がよいです。open-pr は publish: yes がなければ人間承認を要求して止まり、PR はデフォルト draft: true です。今回はこの依頼自体を branch publish / PR 作成の事前承認として扱わせ、publish: yes と draft: false を明示するのが「マージ直前まで無人」に最も合います。どちらも open-pr の正式な入力です。 また Step 2 は test-runner の terminal completion と final result の両方を確認してから Step 4 に進むのが現行契約です。

    Auto mode では child SubAgent 側の permissionMode による抜け道を期待せず、親の Auto mode の判定をそのまま使わせるべきです。また現在の Claude Code は SubAgent をバックグラウンド実行する場合があるので、結果が必要な phase では明示的な join/wait が重要です。([Claude]1)

    以下をそのまま Auto mode の対話的 Claude Code に投入する構成を推奨します。

    squne121/loop-protocol の Issue #2194 を、current live Issue contract に従って impl-review-loop で実装してください。

    対象:
    #2194

    目的

    Issue #2194 について、

    implementation
    → independent verification
    → current-head PR review
    → review blocker 修正
    → 再 verification
    → 再 review

    を bounded loop で自律的に繰り返し、人間が merge を実行する直前の状態まで進めてください。

    今回の最終到達点は、repository contract 上の

    IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready

    相当です。

    ただし今回の「merge 直前」は GitHub 上でも Ready な open PR を意図します。
    新規 PR 作成時は open-pr に

    • publish: yes
    • draft: false

    を明示してください。

    merge 自体は実行しないでください。
    gh pr merge、auto-merge 有効化、merge queue への投入、post-merge-cleanup、Issue の merge 起因 close 後処理には進まないでください。


    Operator authorization

    このプロンプトを、今回の #2194 に限定した以下の操作への事前承認として扱ってください。

    人間への追加の yes/no 確認なしで実行してよいもの:

    • root-owned implementation entry
    • canonical worktree / branch の作成
    • Issue 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 の Allowed Paths 内での実装
    • test / lint / typecheck / build
    • Issue に定義された Verification Commands
    • runtime verification
    • commit
    • canonical branch publish / push
    • open-pr の publish: yes
    • draft: false での PR 作成
    • PR body の更新
    • canonical review comment の投稿
    • review blocker に対する修正 commit / push
    • current head に対する再 verification / 再 review
    • BEHIND 時の repository-defined update_branch mechanical action
    • failed CI の原因が Issue scope 内で修正可能な場合の修正
    • bounded retry

    これらについて途中で AskUserQuestion や「続けてよいですか」を挟まないでください。

    一方、以下は事前承認していません。

    • merge
    • auto-merge の有効化
    • force push / history rewrite
    • destructive Git operation
    • Allowed Paths 外の変更
    • secret / credential / token の表示・変更
    • privilege escalation
    • bypassPermissions
    • --dangerously-skip-permissions
    • wildcard permission allow
    • repository の permission/security mechanism の緩和

    Auto mode の permission classifier / hook が canonical command を拒否した場合も、権限を広げる workaround やユーザーへの許可要求には逃げないでください。

    まず canonical command shape と repository-supported retry/recovery route を確認し、それでも実行不能な場合だけ environment/permission blocker として停止してください。


    Entry — root/main thread が control-plane を所有する

    過去の refinement 完了コメントだけを implementation authorization として再利用しないでください。

    current repository の impl-review-loop / root-owned synchronous entry contract を正本として、root/main thread で一続きに次を実行してください。

    1. capability preflight
    2. live Issue 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 の取得
    3. current-run issue-contract-review
    4. review 直後の live Issue 再取得
    5. root entry routing
    6. route が implementation を許可する場合のみ、その同じ continuous control flow 内で Step 1 を開始

    current live contract が implementation-ready である限り、issue-refinement-loop に戻らないでください。

    過去の refinement は既に完了しています。

    current-run review で genuinely implementation authorization が失われていると判明した場合だけ、実装を開始せず、その evidence を報告して停止してください。
    この実装セッションから Issue refinement を勝手に再開しないでください。


    Live Issue contract を絶対優先する

    実装開始直前に Issue #2194 の本文を再取得し、以下を live body から materialize してください。

    • Outcome
    • Acceptance Criteria
    • Verification Commands
    • Runtime Verification Applicability
    • Allowed Paths
    • Stop Conditions
    • Required Design References

    以下は現時点で期待されるスコープですが、実行時には必ず live Issue を正本として再確認してください。

    期待される変更対象:

    • .claude/agents/review-issue.md
    • .claude/skills/review-issue/SKILL.md
    • tests/fixtures/agent-config/expected-runtime-contract.json
    • tests/fixtures/agent-config/agent_permission_baseline.json
    • scripts/agent_ops_inventory.py
    • docs/dev/agent-skill-boundaries.md
    • docs/dev/dor.md

    重要:

    • .claude/agents/review-issue.md は削除する
    • canonical public review UX は review-issue Skill に一本化する
    • .claude/agents/issue-reviewer.md は変更しない
    • canonical topology は main/root → review-issue Skill → main/root → edit-issue controlled transaction
    • write-capable reviewer → write-capable editor の nested delegation を作らない
    • 新しい ledger / broker / receipt / hook / schema / security harness を追加しない
    • Allowed Paths 外に新しい test file を作らない
    • generic な TDD 規則より 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 の exact Allowed Paths と live contract を優先する

    SubAgent lifecycle — 必ず completion を待つ

    root/main thread は routing と join を所有してください。

    SubAgent からさらに SubAgent を起動する nested delegation は禁止です。

    各 SubAgent は root/main から直接起動してください。

    共通 join rule

    すべての mandatory SubAgent について以下を厳守してください。

    1. 実行結果が次 phase に必要なので、可能なら foreground で起動する
    2. runtime が background task として起動した場合も、running のまま次 phase へ進まない
    3. task が terminal completed になるまで待つ
    4. terminal state だけでなく、その SubAgent の final structured result を取得する
    5. terminal completed と final result の 両方が揃って初めて completion とみなす
    6. final result が expected Issue / PR / head SHA に bind されていることを確認する
    7. task failure、not_found、runtime error、result parse failure を成功扱いしない
    8. repository-defined recovery がある場合のみ bounded retry する
    9. 同じ canonical task name を別 iteration で再利用しない
    10. SubAgent の completion を待たずに mutation、verification、review、最終判定へ先行しない

    「SubAgent を起動した」ことは完了ではありません。
    必ず作業完了を待って結果を join してください。


    Step 1 — implementation-worker

    root/main から implementation-worker SubAgent を起動してください。

    実際の値を materialize して渡してください。

    少なくとも:

    • Issue number: 2194
    • full Issue URL
    • current live Allowed Paths
    • current contract body SHA
    • iteration number
    • fix_delta がある場合はその具体的 blocker
    • canonical worktree / branch 情報

    placeholder のまま child に渡さないでください。

    implementation-worker に implement-issue の canonical procedure を実行させ、

    • worktree 作成
    • implementation
    • local verification
    • explicit-file staging
    • commit
    • push
    • PR 作成

    まで実行させてください。

    PR publication は今回すでに operator authorization 済みです。

    open-pr 呼び出し時:

    publish: yes
    draft: false

    を明示してください。

    E_APPROVAL_MISSING を発生させるために途中で人間へ publish approval を聞き直さないでください。

    1 Issue = 1 PR を維持し、Issue が OPEN なら PR body に canonical Closes #2194 を含めてください。

    implementation-worker の completion と final IMPLEMENT_RESULT_V1 を必ず待ってください。

    その結果を取得するまでは Step 2 に進まないでください。


    Step 2 — test-runner

    Step 1 が完了し PR が存在することを確認した後でのみ、root/main から test-runner SubAgent を起動してください。

    test-runner には live Issue #2194 から取得した:

    • Acceptance Criteria 全文
    • Verification Commands の literal command 全文
    • Issue body SHA
    • PR number
    • PR current head SHA

    を具体値で渡してください。

    Verification Commands は言い換えたり、似たコマンドへ置換したり、省略したりしないでください。

    test-runner の作業完了を必ず待ってください。

    list_agents 等の canonical lifecycle observation を使い、

    • task terminal status == completed
    • final read-only report を取得済み

    の両方を確認してください。

    片方だけでは Step 2 完了とみなさないでください。

    その後 root/main が独立して:

    • report head SHA == live PR current head SHA
    • literal Verification Command hash == current Issue contract
    • AC ごとの PASS / FAIL / SKIP
    • exit code
    • fallback flag
    • stop-condition flag

    を adjudicate してください。

    VC_ADJUDICATION_RESULT_V1.blocking == false の場合だけ Step 4 に進んでください。


    #2194 の Runtime Verification — AC7 は必須

    Issue #2194 の Runtime Verification Applicability は live body を再確認してください。

    decision: immediate のままであれば、AC7 は post-implementation の actual runtime verification として実行してください。

    Issue に記載された literal runtime VC の意味を変更しないでください。

    現行 contract では概ね:

    run_worktree_agent_runtime_smoke.py
    --runtime claude
    --mode structured
    --expect-marker REVIEW_ISSUE_SKILL_PROCEDURE_COMPLETE
    --require-subagent-causal-evidence

    によって、candidate worktree 上の review-issue Skill の実 invocation を検証する契約です。

    WORKTREE_PATH と PROMPT_FILE_PATH は実際の candidate worktree / test prompt file に materialize してください。

    確認対象:

    • review-issue Skill Procedure が declared order で実行されたこと
    • 削除した review-issue Agent への automatic delegation が起きていないこと
    • causal evidence が contract を満たすこと
    • fallback ではないこと

    runtime evidence は repository policy に従って artifact/log として保存し、PR body の

    ## Runtime Verification Evidence

    へ current-head evidence を引用してください。

    以下は PASS ではありません。

    • SKIP
    • exit 77
    • fallback-only success
    • stale head evidence
    • causal evidence 不足

    Issue #2194 の Stop Conditions に従い、AC7 が exit 77 になった場合は勝手に PASS 化せず、Stop Condition として停止・報告してください。


    AC6 / repository verification

    Issue に記載された focused tests を literal contract として実行してください。

    少なくとも live Issue が現在も要求している場合:

    • uv run pytest tests/test_agent_portability_contract.py tests/test_agent_ops_inventory.py -v
    • pnpm typecheck
    • pnpm lint
    • pnpm test
    • pnpm build

    を current candidate head で PASS させてください。

    さらに PR current head の repository-required CI を canonical evaluator で確認してください。

    required CI が pending なら bounded wait を行ってください。

    fail した場合:


    Step 4 — pr-reviewer

    以下をすべて満たした場合だけ root/main から pr-reviewer SubAgent を起動してください。

    • test-runner completed
    • final test-runner result received
    • VC_ADJUDICATION_RESULT_V1.blocking == false
    • PR head SHA が current
    • Issue body SHA が current
    • Verification Command hashes が current
    • runtime verification が required なら current head で PASS
    • required CI の current-head evidence が review に利用可能

    spawn 直前に current-head gate を再評価してください。

    stale / malformed / blocking の場合は pr-reviewer を起動せず Step 2 へ戻してください。

    pr-reviewer の作業完了を必ず待ってください。

    terminal completed と final canonical verdict の両方を取得してから Step 5 に進んでください。

    review result は少なくとも:

    • verdict
    • reviewed_head_sha
    • blockers
    • warnings

    を canonical contract として扱ってください。

    self-authored PR について formal GitHub APPROVE event を作る必要はありません。
    repository の canonical normal-comment review transport に従ってください。


    Step 5 — 自律ルーティング

    reviewer_verdict と root/main が直接取得した live mergeability を、current route_loop_verdict_v2() の契約どおり評価してください。

    REQUEST_CHANGES

    continue_loop の場合:

    • 人間へ確認しない
    • blockers を fix_delta として次の implementation-worker に渡す
    • implementation-worker の完了を待つ
    • head が変わったら Step 2 を再実行
    • test-runner の完了を待つ
    • current-head gate を通す
    • pr-reviewer を再起動
    • pr-reviewer の完了を待つ

    これを iteration budget 内で自動継続してください。

    BEHIND

    live mergeability が BEHIND で canonical route が route_to_update_branch の場合:

    • root/main から implementation-worker に mechanical update_branch action を委譲
    • worker の完了を必ず待つ
    • head SHA の変更を readback
    • verification を再実行
    • test-runner の完了を待つ
    • PR review を再実行
    • pr-reviewer の完了を待つ

    人間へ update-branch の許可を求めないでください。

    stale review

    reviewed_head_sha != current PR head なら human escalation にせず current head で再 review してください。

    SubAgent の human_review_required: true

    Step 1〜4 の worker が boolean の自己申告として human_review_required: true を返しただけでは、自動停止しないでください。

    current repository の impl-review-loop routing contract に従い、formal HUMAN_REVIEW_REQUIRED verdict や actual hard gate と区別してください。


    人間確認なしで継続する範囲

    deterministic に解消できる以下は自分で処理してください。

    • review blocker
    • PR body hygiene
    • Closes #2194 不備
    • current-head stale evidence
    • required CI failure の Issue scope 内修正
    • BEHIND
    • supported discovery reload/retry
    • supported branch publish retry
    • existing PR idempotency
    • reviewer rerun
    • test rerun

    「変更してよいですか」
    「push してよいですか」
    「PR を作ってよいですか」
    「レビュー指摘を直しますか」
    「もう一度テストしますか」

    とは質問しないでください。

    今回すべて事前承認済みです。


    Hard stop

    current live Issue #2194 の Stop Conditions を正本としてください。

    少なくとも以下の場合だけ停止してください。

    • Allowed Paths 外の変更が本当に必要

    • fixed contract / schema / type の scope 外変更が必要

    • 新規 Issue への scope split が必要

    • issue-refinement-loop 全体の redesign が必要

    • credential / OAuth / secret が必要

    • privilege escalation が必要

    • destructive operation / force rewrite が必要

    • actual Git conflict

      • mergeable == CONFLICTING
      • または merge_state_status == DIRTY
    • formal HUMAN_REVIEW_REQUIRED が canonical routing から返る

    • AC7 が SKIP / exit 77

    • runtime verification が fallback 経由でしか成功しない

    • canonical permission / publish route が supported retry 後も環境上実行不能

    • bounded max_iterations 到達

    • live Issue / PR 上で owner が明示的に停止を指示している

    停止する場合も追加承認を質問せず、

    • blocker
    • evidence
    • current Issue / PR / head SHA
    • どこまで完了したか
    • 推奨 next action

    を報告して終了してください。


    完了条件

    次のすべてが成立するまで「完了」と報告しないでください。

    • mandatory SubAgent が全員 terminal completed
    • 各 mandatory SubAgent の final result を root/main が取得済み
    • 実装: review-issue.md と issue-reviewer.md の責務重複を解消し mutation経路を一本化する #2194 の live Outcome / AC を満たす
    • Allowed Paths compliance == true
    • literal Verification Commands が current head で PASS
    • AC7 runtime verification が current head で実際に PASS
    • SKIP == 0
    • fallback-only success == 0
    • required current-head CI が PASS
    • pr-reviewer の current-head verdict == APPROVE
    • blockers == []
    • live mergeability が current route_loop_verdict_v2() の approved termination 条件を満たす
    • PR が GitHub 上で merge 前の Ready 状態
    • IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready
    • merge は未実行

    最後の人間操作が merge の判断・実行だけになる状態を目標にしてください。

    最終報告

    最後に簡潔に以下を報告してください。

    • Issue URL
    • PR URL
    • worktree
    • branch
    • current PR head SHA
    • changed paths
    • Allowed Paths compliance
    • iteration 数
    • implementation-worker 各回の completion
    • test-runner 各回の completion と verification 結果
    • AC7 runtime verification evidence
    • required CI
    • pr-reviewer 各回の completion と最終 verdict
    • live mergeability
    • IMPL_REVIEW_LOOP_RESULT_V1
    • merge を実行していないこと
    • unresolved blocker があればその内容

    途中の承認確認は不要です。
    SubAgent の作業完了を必ず待ちながら、merge の直前まで自律的に進めてください。

    この形なら、単に「承認不要」とするだけでなく、open-pr の publish gate、GitHub Draft の回避、SubAgent join、current-head VC gate、AC7、CI、REQUEST_CHANGES の再実装まで無人化対象を明示できます。現行 impl-review-loop の終端も、review が APPROVE かつ live 条件を満たした draft_pr_ready で、merge 自体は人間判断に残す設計です。

  6. squne121 commented on Sep 4, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-04T15:18:31Z)

    • PR: refactor: review-issue Skill へ mutation 経路を一本化し standalone Agent を削除 (#2194) #2497
    • Worktree: .claude/worktrees/issue-2194-review-issue-md-issue-reviewer-md-mutati
    • Branch: worktree-issue-2194-review-issue-md-issue-reviewer-md-mutati
    • Verification: pytest (7+87 tests) PASS / pnpm typecheck PASS / pnpm lint PASS / pnpm test (1874 tests) PASS / pnpm build PASS
    • AC7(動作検証)は本実装の対象外。test-runner が post-implementation で別途実機実行し証跡を PR 本文に添付予定
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

phase/implementation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions