Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: parent
goal_ref: "issue-refinement-loop / impl-review-loop の既定完了条件を各 skill の goal まで引き上げ、既知の機械的補正を既存 worker SubAgent に委譲して人間の Y 承認連鎖をなくす"
change_kind: workflow
parent_mode: delivery-rollup
closure_mode: child-complete
supersedes_or_extends:
- issue: 564
decision: "fail-only intake gate は引き続き安全境界の既定とする"
override: "issue-refinement-loop が impl_ready まで到達させる既定動作を追加する。impl-review-loop の intake gate 自体は fail-only のまま維持し、ユーザー向け auto-prepare オプションは追加しない"
forbidden:
- implicit issue-contract-review execution as an undocumented side effect
- semantic contract / body rewrite without human judgment
- destructive GitHub operationsSummary
issue-refinement-loop で Issue 本文を修正し issue-contract-review で status: go を取得しても、/impl-review-loop <issue> に進むと metadata_not_ready / template / preflight hygiene で停止し、ユーザーが何度も Y を入力させられる。さらに PR review 段階でも Closes #N 形式不足や mergeStateStatus=BEHIND のような auto-fixable な現在 PR の hygiene が recommendations / follow_up_issue_requests に逃がされ、人間または後続 Issue に押し出されている。
根本原因は「各 skill の完了条件が、その skill 本来の goal まで引き上がっていない」ことと、「main conversation が診断・判断・補正・GitHub 操作を抱えすぎ、既存 worker SubAgent への委譲が enforcement されていない」ことである。--no-human-approval のようなフラグ伝播は対症療法であり、本 Issue では採用しない。
Goal
各 skill の既定完了条件を goal まで引き上げる:
/issue-refinement-loop <N>は、実装可能 Issue について追加の人間Yなしでimpl-review-loopintake ready(impl_ready)まで到達する。/impl-review-loop <N>は、Draft PR を人間が merge 判断できる状態(merge_ready/draft_pr_ready)まで到達する。- 「人間承認不要」は CLI オプションではなく、機械的補正を止めない既定方針(
AUTONOMY_POLICY_V1)として扱う。 - 既知の機械的補正は既存 worker SubAgent(
implementation-worker等)に委譲し、main conversation は machine-readable result marker の routing のみを行う。
Desired Destination
issue-refinement-loop_default_completion:
invocation: "/issue-refinement-loop <N>"
terminal_success_state: impl_ready
required_effect:
- issue body is implementation-ready
- required metadata and labels are normalized
- issue-contract-review has produced a fresh status: go snapshot
- impl-review-loop intake gate can pass without additional human Y confirmation
escalation_only_when:
- scope / goal / AC meaning changes
- destructive GitHub operation is required
- external permission escalation is required
- deterministic fixer returns human_judgment_required
impl-review-loop_default_completion:
invocation: "/impl-review-loop <N>"
terminal_success_state: draft_pr_ready
required_effect:
- implementation is completed in delegated worker context
- verification is completed by delegated test-runner
- PR review loop reaches APPROVE with merge_ready == true
- Draft PR exists and contains contract / evidence / related coordination / residual risk
- human is left with merge / close / request-changes decision only
escalation_only_when:
- design decision cannot be derived from issue contract
- unsafe or destructive action is required
- merge conflict / dependency / permission blocker cannot be resolved mechanically--no-human-approval / --prepare-impl-ready / --auto-prepare という新規ユーザー向けオプションは 追加しない。
Autonomy Policy(自律完了ポリシー)
AUTONOMY_POLICY_V1:
default: goal_completion_until_human_judgment_required
scope: repo_loop_policy / workflow_policy
note: "これは Claude Code の permission mode(permissions.defaultMode / dontAsk / bypassPermissions / --permission-mode)を変更しない。権限は /permissions・permission rules・permission mode・hook で制御され、prompt や自然言語指示では変更されない"no_human_approval_semantics
no_human_approval_semantics:
means:
- do not ask user for known mechanical corrections
- stop with machine-readable reason if a required permission is unavailable
does_not_mean:
- bypassPermissions
- broad GitHub write access
- semantic contract rewrite
- destructive mutationOrchestration / Delegation Contract(オーケストレーション / 委譲契約)
orchestration_contract:
main_conversation_role: control_plane_only
must_not_hold:
- raw issue body
- raw command output
- review reasoning
- fix diff / implementation details
may_hold_in_LOOP_STATE:
- github comment URL
- artifact path
- hash (body_sha256 / head_sha)
- status enum / routing_action
delegation_rule: "作業・成果物・判断は worker SubAgent が完結し、main は machine-readable result marker の status / artifact_ref / hash / next_action だけで route する"
no_new_subagents: true
rationale: "既存 implementation-worker が write-capable repair executor として実装・検証・Draft PR・Issue コメント・update-branch まで担える。新規 pr-hygiene-fixer / branch-syncer は過剰設計のため追加しない"既存 SubAgent への repair mode 追加(新規 SubAgent を作らない)
IMPLEMENTATION_WORKER_REQUEST_V2:
mode:
- implement_issue
- apply_pr_review_fix_delta
- update_pr_body_hygiene
- update_branch
delegation:
implement_body: implement-issue
pr_create_or_body_update: open-pr / open-pr/scripts/update_pr.py
branch_update: implement-issue.update_branch contract(gh api pulls/{pull_number}/update-branch)
verification: test-runner
guard:
- direct `gh pr edit --body-file` は禁止し、必ず open-pr / update_pr.py wrapper + validator pre-write hook を通す
- expected_head_sha を使って stale verdict を防止する
- update 後は head SHA 更新を確認し test-runner → pr-reviewer を再実行するissue_kind SSOT decision(issue_kind の単一 SSOT 決定)
現行コード(fact-check 済み):
plan_refinement_loop.pyのISSUE_KIND_ALLOWLIST = {implementation, parent, research}、未知 kind は fail-closed。check_issue_contract.pyは implementation / research / tracking / parent を検出し、未知値はimplementationに fallback し得る。.github/ISSUE_TEMPLATE/はimplementation.yml/parent.yml/research.ymlのみ。design.yml/tracking.ymlは存在しない。
決定:
issue_kindの allowlist と normalization を単一 SSOT(共有 Python module またはissue_kind_schema.yml)に集約し、template /check_issue_contract.py/plan_refinement_loop.py/ review script が同じ allowlist を読む。designの扱いを first-class kind 追加かdesign -> research等の明示 normalization table のいずれかに決定する(child issue で確定)。- 未知
issue_kindを黙ってimplementationに fallback しない。SSOT に基づき正規化するか明示的に block する。
Result Schemas(結果スキーマ)
LOOP_HANDOFF_RESULT_V1:
schema_version: 1
issue_number: <int>
status: impl_ready | human_judgment_required | blocked
routing_action: run_impl_review_loop | ask_human | stop
contract_review:
status: go | missing | stale | request_changes
comment_url: null
body_sha256: null
metadata:
title_ready: true
phase_label_ready: true
dependencies_ready: true
auto_fixes:
applied: []
skipped: []
blockers:
- code: null
reason: null
permissions:
required: []
unavailable: []
generated_at: "ISO-8601"IMPL_REVIEW_LOOP_RESULT_V1:
schema_version: 1
status: draft_pr_ready | human_judgment_required | blocked
merge_ready: true | false
pr:
number: null
url: null
head_sha: null
reasoning_artifact_ref: null
generated_at: "ISO-8601"LOOP_VERDICT_V2:
verdict: APPROVE | REQUEST_CHANGES | HUMAN_JUDGMENT_REQUIRED | BLOCKED
reviewed_head_sha: ...
merge_ready: false
mergeability:
mergeable: MERGEABLE | CONFLICTING | UNKNOWN
merge_state_status: CLEAN | BEHIND | BLOCKED | DIRTY | UNSTABLE
required_auto_actions:
- kind: ensure_closing_keyword
executor: implementation-worker
skill: open-pr.update_pr
blocking_merge_ready: true
- kind: update_branch
executor: implementation-worker
skill: implement-issue.update_branch
blocking_merge_ready: true
follow_up_issue_requests:
- kind: long_term_process_improvement
blocking_merge_ready: falsemarker は free-text ではなく HTML comment + fenced YAML(<!-- LOOP_HANDOFF_RESULT_V1 --> 等)に固定する。
termination enforcement(終了条件の強制)
if verdict == APPROVE and required_auto_actions is not empty:
route required_auto_actions to implementation-worker
rerun verification if head changed
rerun pr-reviewer
do not terminate
if verdict == APPROVE and merge_ready == true and required_auto_actions == []:
terminate approved
if required_auto_actions exists but executor/skill is unknown:
human_escalation
現行の step-5-feedback-and-termination.md は LOOP_VERDICT.verdict: APPROVE 即終了であり、step-5-mergeability-handling.md の BEHIND -> UPDATE_BRANCH_REQUEST_V1 -> implementation-worker 規定と競合し得る(fact-check C5 vs C6 で確認)。終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一する。
contract blocked routing の再利用
simple_contract_hygiene_fix / contract_refinement_required / human_decision_required の 3 分類は新 taxonomy を作らず、既存定義(.claude/skills/impl-review-loop/steps/preparation.md Step 6, CONTRACT_BLOCKED_ROUTING_V1 相当、lines 393-405)を拡張して再利用する。auto-prepare で許可する class は simple_contract_hygiene_fix / metadata_only_fix / marker_format_fix に限定し、contract_refinement_required / human_decision_required / scope_change / destructive_operation / security_or_permission_boundary_change は禁止する。
SubAgent Security AC(SubAgent セキュリティ AC)
subagent_security_ac:
- runner agent must declare explicit tools (tools / disallowedTools)
- runner must not have Write/Edit unless the child issue explicitly justifies it
- permissionMode is not treated as the sole safety boundary
- parent auto mode が subagent permissionMode を上書きし得る挙動を docs 化する
- output is a marker-only result, not freeform proseVerification Policy(機械検証ベースの検証ポリシー)
verification_ac:
- fixture reproduces the handoff / hygiene failure before fix
- fixture passes after fix
- both plan_refinement_loop and check_issue_contract paths are tested
- pytest command is shown
- CI or machine-readable TEST_VERDICT_MACHINE marker is required
- no approval based only on assistant prose summaryOutcome
本 parent tracker が「完了」と言える状態は、以下を満たす child issue 群が全件マージされていることである:
/issue-refinement-loop <N>が追加YなしでLOOP_HANDOFF_RESULT_V1.status: impl_readyを返せる。/impl-review-loop <N>が追加YなしでIMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_readyかつmerge_ready: trueまで到達できる。Closes #N不足 /mergeStateStatus=BEHIND等の auto-fixable hygiene がfollow_up_issue_requestsではなくrequired_auto_actionsとして既存implementation-workerに委譲される。issue_kind正規化が単一 SSOT で行われ、未知 kind の silent fallback が消える。- main conversation が control-plane に限定され、raw context を保持しない。
parent tracker のため本 Issue 自体は実装差分を持たず、## Acceptance Criteria は child 全体の合算到達条件を表す。
Child Issues
着手推奨順(各 child は独立 PR、delivery-rollup のため child 起票は本 parent マージ前でも即時実施):
- 実装: issue_kind allowlist / normalization を単一 SSOT に集約する(#626 child-1) #629 — child-1:
issue_kindallowlist / normalization を単一 SSOT に集約し、template /check_issue_contract.py/plan_refinement_loop.py/ review script が同じ allowlist を読む。未知 kind の silentimplementationfallback を禁止し、designの正規化方針を確定する。 - 実装: issue-refinement-loop の terminal contract を LOOP_HANDOFF_RESULT_V1.status: impl_ready に固定する #628 — child-2:
issue-refinement-loopの terminal contract をLOOP_HANDOFF_RESULT_V1.status: impl_readyに固定。template / metadata / marker / contract-snapshot hygiene を deterministic fixer SubAgent に委譲し、main は marker のみ保持する。 - 実装: pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加する #630 — child-3:
pr-review-judge/pr-reviewerの出力にmerge_ready/required_auto_actions/auto_fix_appliedを追加(LOOP_VERDICT_V2)。auto-fixable な現在 PR hygiene をfollow_up_issue_requestsに分類できない構造にする。 - 実装: implementation-worker に IMPLEMENTATION_WORKER_REQUEST_V2 mode を追加し PR repair executor として機能させる(#626 child-4) #631 — child-4:
implementation-workerにIMPLEMENTATION_WORKER_REQUEST_V2の mode(apply_pr_review_fix_delta/update_pr_body_hygiene/update_branch)を追加。Closes #N補正はopen-pr/scripts/update_pr.pywrapper 経由、branch update はimplement-issue.update_branchcontract 経由とし、新規 SubAgent を作らない。 - 実装: impl-review-loop の終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一し終了 gate を実装する #632 — child-5:
impl-review-loopの終了条件をAPPROVE && merge_ready && required_auto_actions == []に統一し、required_auto_actionsが残る限りtermination_reason: approvedにしない gate を実装する(C5 vs C6 競合の解消)。 - 実装: AUTONOMY_POLICY_V1 共通 policy SSOT と validator enforcement を追加する(#626 child-6) #633 — child-6:
AUTONOMY_POLICY_V1共通 policy / result schema を追加し、skill を運用設計通り使わないと loop が終了できない validator enforcement を入れる。 - 実装: #626 child-7 — handoff / PR hygiene failure の回帰テストを before-fail / after-pass で fixture 化する #634 — child-7: 回帰テストを追加。(a)
#611相当の handoff failure を before-fail / after-pass で fixture 化しplan_refinement_loopとcheck_issue_contract両経路を検証、(b) PR body に自然文の issue 参照はあるがCloses #Nがないケースでupdate_pr.pyが呼ばれること、(c)mergeStateStatus=BEHIND && mergeable=MERGEABLEでUPDATE_BRANCH_REQUEST_V1がimplementation-workerに渡ること、(d)required_auto_actionsが残る状態でtermination_reason: approvedにならないこと。TEST_VERDICT_MACHINEmarker を必須化する。
Acceptance Criteria
- AC1:
/issue-refinement-loop <N>は追加オプションなしで、成功時にLOOP_HANDOFF_RESULT_V1.status: impl_readyを返す。 - AC2:
impl_readyはimpl-review-loopintake gate が追加の人間Yなしに通過できる状態(title prefix /phase/implementationlabel 不足のみで停止しない)を意味する。 - AC3:
/impl-review-loop <N>は追加オプションなしで、成功時にIMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_readyかつmerge_ready: trueを返す。 - AC4:
draft_pr_readyは Draft PR が起票済みで、PR body に contract snapshot / 検証結果 / 関連 coordination / 残リスクが含まれ、人間が merge / close / request-changes 判断だけを行える状態を意味する。 - AC5:
人間承認不要という自然言語指示はオプション指定として解釈せず、既定の goal-completion policy(AUTONOMY_POLICY_V1)の再確認として扱う。--no-human-approval/--prepare-impl-ready/--auto-prepareを新規追加しない。 - AC6: template hygiene / metadata hygiene / known marker fix / stale state label cleanup / contract snapshot materialization は deterministic fixer SubAgent に委譲され、
auto_fixed | human_judgment_required | blockedの machine-readable result だけを main に返す。 - AC7: PR body に linked issue closing keyword が不足している場合、
implementation-workerがopen-pr/scripts/update_pr.py経由でCloses #Nを自動追記し再判定する。mergeStateStatus=BEHIND && mergeable=MERGEABLEの場合、implementation-workerがupdate_branchcontract を実行し head SHA 更新後に CI を再確認する。これらはfollow_up_issue_requestsに出さない。 - AC8:
pr-review-judgeはrequired_auto_actionsが空でない限りmerge_ready: trueを返さず、impl-review-loopの終了条件はAPPROVE && merge_ready && required_auto_actions == []のみとする。 - AC9:
issue_kind: designまたは allowlist 外 kind を持つ Issue を各 script が読む際、黙ってimplementationに fallback せず、単一 SSOT に基づいて正規化するか明示的に block を返す。 - AC10: scope / goal / AC の意味変更、Issue 分割、破壊的 GitHub 操作、権限昇格、SSOT 不一致は
human_judgment_requiredとして停止し、理由・選択肢・推奨案を提示する。 - AC11: main conversation / orchestrator は raw issue body / raw command output / review reasoning / fix diff を保持せず、GitHub comment URL / artifact path / hash / status enum のみを
LOOP_STATEに保存する。 - AC12: subagent runner は explicit tools / disallowedTools を宣言し、Write/Edit は child issue が明示的に正当化した場合のみ持ち、permissionMode を唯一の安全境界としない。
- AC13: 回帰テストが machine-readable marker(CI または
TEST_VERDICT_MACHINE)で検証され、assistant の散文要約だけでは APPROVE しない。
Verification Commands
# AC1 # AC2 # AC3 # AC4 # AC5 # AC6 # AC7 # AC8 # AC9 # AC10 # AC11 # AC12 # AC13 — parent tracker のため、各 AC は child issue の VC で検証する
# preflight-scope: pr_review_only
$ echo "parent tracker: VC は child issue 各々で検証する"Runtime Verification Applicability
applicability: not_applicablereason: parent tracker のため本 Issue は実装差分を持たない。runtime 検証は各 child issue 側でdocs/dev/runtime-verification-policy.mdの適用判定スキーマに従って判断する。
Allowed Paths
N/A — parent tracker のため、child issue 各々の Allowed Paths で確定する。本 parent が束ねる child scope(合算、write-capable 範囲は各 child の Allowed Paths で確定):
.claude/skills/issue-refinement-loop/.claude/skills/impl-review-loop/(steps/preparation.md,steps/step-5-mergeability-handling.md,steps/step-5-feedback-and-termination.mdを含む).claude/skills/issue-contract-review/.claude/skills/pr-review-judge/.claude/skills/review-issue/scripts/check_issue_contract.py.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py.claude/skills/implement-issue//.claude/skills/open-pr/(scripts/update_pr.pyを含む).claude/agents/implementation-worker.md.github/ISSUE_TEMPLATE/+ 新規issue_kindSSOT(共有 module / schema)
Remaining Parent Gaps
- hook guard の無効化は非対象(
guard-japanese-prose.sh等の保護は維持) - destructive な GitHub 操作の自動承認は非対象
- 人間判断が必要な scope / goal / AC の意味変更の完全自動化は非対象
- subagent への write 権限の無制限付与は非対象
- Claude Code permission model(permission mode / bypassPermissions)の変更は非対象
Phase Handoff Contract
各 child issue に引き継ぐ構造:
Desired Destination: 本 parent の## Desired Destinationを継承Current Validated Scope: child ごとの Allowed Paths で限定Remaining Parent Gaps: 本 parent の## Remaining Parent Gapsを継承Current Objective: child ごとの## Outcomeで定義Bounded Current Context:#611(issue_kind: designallowlist 外 fail-closed → title/label/Handoff Contract/preflight marker 不足の連鎖)、#627(Closes #589不足とmergeStateStatus=BEHINDが follow-up/recommendations へ誤分類)Normative References: 本文の fact-check 済みパス群(plan_refinement_loop.py/check_issue_contract.py/impl-review-loop/steps/*/implementation-worker.md/open-pr/implement-issue/.github/ISSUE_TEMPLATE/)Allowed Paths: child ごとに確定Stop Conditions: Allowed Paths 外変更 / scope 分割発生 / 外部権限昇格 / SSOT 不一致が必要になった場合
Parent Closure Rule
delivery-rollup: child issues が全件マージ済みであることを確認してから parent を close するquality-gate: N/A- 非
quality-gateparent のQuality Decision RecordはN/A扱いで close 判定の必須材料にしない
Quality Decision Record
Status: N/ADecision Date: 未記録Does this prove the parent goal complete?: N/AReason: delivery-rollup parent のため quality-gate 判定は不要Evidence: N/ANext Action: child issue 全件クローズをもって parent をクローズする
Notes
- 2026-06-03: 本 Issue は 導入: issue-refinement-loop → impl-review-loop 遷移の自動化(スキル間 handoff contract 欠落の統合修正) #626 のコメント 3 件(adversarial 契約レビュー / skill goal-completion 再定義 / PR hygiene 誤分類と implementation-worker 再利用)の OWNER decision を反映して reframe した。
- reframe の核心: 「フラグ伝播」ではなく「各 skill の既定 goal-completion contract + worker SubAgent への委譲 enforcement」。
- 新規 SubAgent(pr-hygiene-fixer / branch-syncer)は過剰設計として却下し、既存
implementation-workerの mode 追加で対応する。 - 本文中の repo 事実(allowlist / fail-only gate / BEHIND routing / open-pr Closes-Refs 等)は 2026-06-03 時点の main(commit 5eb3114)に対し codebase-investigator で fact-check 済み。
CONTRACT_BLOCKED_ROUTING_V1は standalone schema ではなくpreparation.mdStep 6 に embedded。 - child issue 起票は本 parent マージ後ではなく即時実施を推奨(
delivery-rollup)。 #611/#627は本 parent の参照ケースであり、本 parent はこれらを close しない。
Activity
squne121 commentedon Jun 3, 2026
元のClaudeCode作業ログ
squne121 commentedon Jun 3, 2026
判定
REQUEST_CHANGES 相当。 #626 は実在するハンドオフ不全を扱っており、親 Issue としての方向性は妥当です。ただし、現状の記述のまま child issue 化すると、既存の fail-only intake gate、
issue_kind判定、Claude Code 権限モデル、検証責任が衝突します。#626 自体は child issues が未起票で、Development に branch/PR も紐付いていないため、これは実装レビューではなく 親 Issue 契約レビュー として扱うべきです。([GitHub]1)Blocker 1: #564 の設計を明示的に上書きしていない
#626 は「status: go 後に title/label だけで止まらない」「
--auto-prepare/--prepare-impl-readyで自動補正する」ことを目標にしています。一方、#564 はimpl-review-loopの intake gate を fail-only にし、title prefix・phase/implementationlabel 不備をmetadata_not_readyとして停止させ、issue-contract-review の自動実行や title/label 自動更新を明確に out-of-scope にしていました。([GitHub]1)これは単なる追加機能ではなく、#564 の安全境界を変更する設計変更です。#626 には次を明記すべきです。
この明記がないと、実装者は「fail-only gate を壊す」のか「明示フラグ時だけ前処理する」のかを判断できません。
Blocker 2:
issue_kindの SSOT が壊れている#626 は #611 のような
issue_kind: design問題を扱うとしていますが、現行コード上の正規化方針が未定義です。#611 は実際にissue_kind: designを持つ設計 Issue です。([GitHub]2)しかし、
plan_refinement_loop.pyの allowlist はimplementation,parent,researchのみで、未知のissue_kindは fail-closed します。([GitHub]3) 一方、check_issue_contract.pyはimplementation,research,tracking,parentを検出対象にし、未知値は fallback でimplementation扱いになり得ます。([GitHub]4) さらに Issue template はimplementation.yml,parent.yml,research.ymlしか見当たらず、design.ymlやtracking.ymlは存在しません。([GitHub]5)これは blocker です。#626 の child issue には、少なくとも次の決定が必要です。
designを first-classissue_kindとして追加する。design -> researchなどの明示的 normalization table を置く。issue_kindをimplementationに fallback しない。推奨は
issue_kind_schema.ymlまたは共有 Python module を作り、全 script と template が同じ allowlist を使う ことです。現状のままでは #611 transcript fixture を追加しても、片方の script だけ通って片方で止まる regression が残ります。Blocker 3:
--no-human-approvalが Claude Code 権限モデルと混同されている#626 の「no human approval」は、人間判断を不要にするワークフロー意図としては妥当です。しかし、Claude Code の permission model では、権限は prompt ではなく settings / permission mode / allow-deny rules で強制されます。
dontAskは prompt される操作を自動拒否し、事前許可済み tool と read-only Bash のみ実行できます。bypassPermissionsは保護を無効化するため、隔離環境以外では使うべきではありません。([Claude Code]6)したがって #626 は、
--no-human-approvalを「権限昇格」と読めないようにする必要があります。また
gh issue edit,gh issue comment,gh apiを使うなら、許可する Bash パターンを具体化する必要があります。Claude Code は compound command を分割して権限評価するため、雑なBash(gh *)設計は避けるべきです。(Claude Code)Blocker 4: SubAgent runner の安全境界が曖昧
#611 は Haiku SubAgent runner へ決定論的 preflight を委譲する設計ですが、Claude Code の subagent は
toolsを省略すると多くの tool を継承し得ます。公式 docs ではtools,disallowedTools,model,permissionMode,skillsなどを frontmatter で制御でき、tools: Read, Grep, Glob, Bashのように明示制限できます。([Claude Code]7)さらに、parent が auto mode の場合は subagent の
permissionModeが無視される挙動があるため、「subagent にpermissionMode: dontAskと書いたから安全」という設計は不十分です。([Claude Code]8)#626 の child issue には次を AC 化してください。
Blocker 5:
simple_contract_hygiene_fixの既存分類を再利用していない#603 / #569 系では、contract blocked routing に
simple_contract_hygiene_fix,contract_refinement_required,human_decision_requiredの分類が導入されています。simple_contract_hygiene_fixは typo / format / section-scoped rewrite / preflight-scope のような限定補正に絞られていました。([GitHub]9)#626 の
auto_fixable/required_fixesはこの分類と重複します。別 taxonomy を作ると、同じ不備が片方では auto-fix、片方では human decision になり得ます。#626 は既存のCONTRACT_BLOCKED_ROUTING_V1相当を拡張する形に寄せるべきです。最小修正案:
Blocker 6: 検証が self-report に寄りすぎる
#626 の子 Issue には #611 transcript fixture が含まれていますが、fixture を「作った」と言うだけでは不十分です。PR #613 では、テスト未実行・CI 未接続・
TEST_VERDICT_MACHINEmarker 不在の自己報告が request changes になっています。([GitHub]10)#626 の AC は、次のように検証を機械判定に寄せるべきです。
Blocker 7:
LOOP_HANDOFF_RESULT_V1の schema が足りない#626 は final output を
impl_ready | human_judgment_required | blockedとしていますが、これだけでは後段が安全に判断できません。必要なのは status だけでなく、何を変えたか、どの snapshot に対して判断したか、次にどの loop を呼ぶべきかです。提案 schema:
また、marker は free-text ではなく HTML comment + fenced YAML に固定すべきです。
総評として、#626 は「人間に毎回 Y を押させない」方向は正しいです。ただし、それを安全に実装するには 自動化範囲の縮小、SSOT 化、権限モデルの明文化、機械検証 marker が不可欠です。
squne121 commentedon Jun 3, 2026
人間からのコメントです。
「/issue-refinement-loop --no-human-approval --prepare-impl-ready」「/impl-review-loop --auto-prepare」とありますが、そもそもそれぞれのエージェントスキルのゴールを目指して人間承認不要で実装してほしいです。
プロンプトでは「人間承認不要で」と書きますが、これはオプションの引数指定という認識ではなく、念のため追記している程度のものです。
「--no-human-approval --prepare-impl-ready」「--auto-prepare」は不要でissue-refinement-loopであれば作業計画として完成した状態=impl-review-loopを開始できる状態にしてほしい。impl-review-loopであればDraftPRを起票して人間がマージを判断できる状態まで作業してほしい。
その中でどうしても設計的判断など、人間が判断しなければならないブロッカーが現れたときのみ、人間へエスカレーションしてほしい。
改善の中で issue-refinement-loop と impl-review-loop に作業・成果物・判断のためのコンテクストを増やさないこと。全てサブエージェントへ委譲し、メイン会話=オーケストラレータはオーケストラレーションの責務に専念すること。究極、オーケストラレータは作業の内容を知らなくてもサブエージェントが作業・出力・判断をするだけで実現できる状態にしたい。
squne121 commentedon Jun 3, 2026
ClaudeCode作業ログ
squne121 commentedon Jun 3, 2026
#626 (comment)
結論: 人間コメントは妥当です。#626 は「追加オプションで自動化を有効化する Issue」ではなく、「各 skill のデフォルト完了条件を、その skill のゴールまで引き上げる Issue」に再定義するべきです。現状の #626 は
/issue-refinement-loop <N> --no-human-approval --prepare-impl-readyと/impl-review-loop <N> --auto-prepareを Desired Destination に置いており、ユーザーの意図を「オプション指定」と誤って固定化しています。([GitHub]1)敵対的レビュー
#626 の根本欠陥は、問題を「handoff contract 欠落」と捉えながら、解決を「フラグ伝播」に寄せている点です。ユーザーの意図は「人間承認不要という自然言語の念押しがなくても、skill は自分のゴールまで完走する」なので、
--no-human-approval/--prepare-impl-ready/--auto-prepareは API として作るべきではありません。issue-refinement-loopの完了状態はimpl-review-loopを開始可能なimpl_ready、impl-review-loopの完了状態は Draft PR 起票済みで人間が merge 判断できるdraft_pr_readyに固定するべきです。現在の
impl-review-loopは、CONTRACT_REVIEW_RESULT_V1 status: goがなければmissing_contract_goで停止し、issue-contract-reviewを自動実行しない fail-only gate と明記されています。これは #626 の「ユーザー追加入力なしに impl-review-loop へ到達」と衝突します。([GitHub]2) さらにissue-contract-reviewも不適合時は自動修復せずissue-refinement-loopを人間に提案する設計なので、既知 hygiene の自動補正という #626 の目的と食い違っています。([GitHub]3)もう一つの欠陥は、メイン会話に文脈・判断・作業を載せすぎている点です。
issue-refinement-loopは thin entrypoint を掲げつつ、final classification は main thread が保持し、SubAgent は mutation しない、としています。([GitHub]4)impl-review-loopも control-plane と言いつつ、preparation ではgh issue list/gh pr list/plan_issue_scope_rollup.py実行結果を main 側で扱い、orchestrator が候補判断まで持っています。([GitHub]5) これは今回の「オーケストレータは作業内容を知らなくてもよい状態にしたい」という要求に反します。Claude Code の subagent は独立 context、独自 system prompt、tool access、permissions を持ち、探索・実装・大量ログ処理を main conversation から隔離する用途に適しています。([Claude Code]6) また、subagent は verbose output や self-contained work を main context に入れないための機構として推奨されています。([Claude Code]6) したがって #626 は「フラグ追加」ではなく「worker subagent が作業・成果物・判断を完結し、main は machine-readable result marker だけで route する」方向へ修正するのが筋です。
修正方針
#626 の
Desired Destinationは次の形に置換するべきです。--no-human-approvalは CLI 引数ではなくAUTONOMY_POLICY_V1.default = goal_completion_until_human_judgment_requiredとして skill contract に持たせるべきです。ただし、これは Claude Code の permission mode を変更するものではありません。Claude Code の権限は prompts では変更できず、/permissions、permission rules、permission mode、hook で制御されるため、「人間承認不要」は repo loop policy / workflow policy に限定して定義すべきです。(Claude Code)impl-review-loopの Draft PR 作成はopen-pr/implementation-worker側の責務として、gh pr create --draftを使う契約にすればよいです。GitHub CLI はgh pr createに--draftを持っており、Draft PR 起票は既存ツールで実装可能です。(GitHub CLI)#626 の AC 差し替え案
Issue 構成の修正
#626 の child issues は現状だと「metadata」「issue_kind」「simple hygiene」「flag propagation」へ分割されていますが、
flag propagationchild は削除または全面改稿すべきです。([GitHub]1) 代わりに以下の 4 本へ再編するのがよいです。issue-refinement-loopの terminal contract をimpl_readyに変更する。impl-review-loopの terminal contract をdraft_pr_readyに変更する。goal-completion-autonomyの共通 policy / result schema を追加する。#611 はかなり近いですが、scope rollup preflight に限定されており、「作業・成果物・判断の全委譲」までは届いていません。#611 の設計は #626 の subagent 化方針の一部として取り込むべきですが、#626 の中心に置くべきなのは
scope-rollup-runner単体ではなく、intake-preparer/contract-materializer/metadata-normalizer/hygiene-fixer/implementation-worker/test-runner/pr-reviewerの result-marker chain です。#611 自体も main conversation への raw output 流入防止を目的に、Haiku SubAgent runner と marker 採用を提案しています。([GitHub]9)GitHub コメント案
このコメントで、#626 は「フラグ伝播」から「skill goal completion contract + subagent delegation contract」へ軌道修正できます。
squne121 commentedon Jun 3, 2026
#626 (comment) について人間からのコメントです。
「PR 本文が Closes #589 形式でないため」はおかしいでしょ。Closes #589 形式にするように運用設計しているエージェントスキルを用意しているんだから、それに則って作業していないことはおかしい。改善が必要です。
「 mergeStateStatus=BEHIND のため、マージ前に Update branch が必要」はおかしいでしょ。Update branch が必要なら、アップデートブランチするように運用設計しているし、エージェントスキルを用意しているんだから、それに則って作業してほしい。改善が必要です。
メイン会話の作業量が多く、サブエージェントへの移譲がうまく行われていないように見える。検討して改善案を出してほしい。
squne121 commentedon Jun 3, 2026
you asked
message time: 2026-06-03 17:07:54
#626 (comment) について人間からのコメントです。
「PR 本文が Closes #589 形式でないため」はおかしいでしょ。Closes #589 形式にするように運用設計しているエージェントスキルを用意しているんだから、それに則って作業していないことはおかしい。改善が必要です。
「 mergeStateStatus=BEHIND のため、マージ前に Update branch が必要」はおかしいでしょ。Update branch が必要なら、アップデートブランチするように運用設計しているし、エージェントスキルを用意しているんだから、それに則って作業してほしい。改善が必要です。
メイン会話の作業量が多く、サブエージェントへの移譲がうまく行われていないように見える。検討して改善案を出してほしい。
chatgpt response
対象コメントと Issue/PR の前後関係を確認し、指摘の論点を「運用設計の欠陥」「エージェントスキルの責務」「メイン会話からの移譲設計」に分けて整理します。
確認できた範囲では、PR #627 の最終 APPROVE で
Closes #589不足が optional follow-up 化され、mergeStateStatus=BEHINDが recommendations に残っています。どちらも事実として検出対象ですが、人間に返す分類が誤っています。結論: 人間コメントの指摘が正しいです。
Closes #589不足とmergeStateStatus=BEHINDは検出すべき事実ですが、「人間への任意改善 / follow-up issue / recommendations」に落としている分類が誤りです。既にそれを処理する運用設計・エージェントスキルを持つ前提なら、これは「人間が後で直すもの」ではなく、当該ループ内で SubAgent に委譲して自動補正し、最終状態まで戻すべき auto-fixable hygieneです。見えている問題
PR #627 の最終 APPROVE では、
mergeStateStatus=BEHINDのままrecommendations: [update_branch]とし、さらに linked issue 参照がCloses #589形式でないことを optional follow-up issue として出しています。つまり、レビュー判定は APPROVE しているが、マージ準備として必要な機械的補正を完了せず、人間または後続 Issue に押し出しています。これはimpl-review-loopのゴール「Draft PR を人間がマージ判断できる状態まで持っていく」と矛盾します。(GitHub)Closes #N形式自体は GitHub の仕様上意味があります。GitHub Docs は、PR description にCloses #10のようなサポート済みキーワードを書くことで Issue と PR がリンクされ、既定ブランチへのマージ時に Issue が自動クローズされると説明しています。したがって検出は正しい。ただし、その扱いは「運用改善 Issue」ではなく、現在の PR body をgh pr edit等で修正する作業です。(GitHub Docs)BEHINDも同様です。GitHub Docs は、PR branch が base branch より古く、conflict がない場合に Update branch できることを説明しており、GitHub CLI にもgh pr update-branchが用意されています。したがってmergeStateStatus=BEHINDは「人間に言うだけ」ではなく、権限と安全条件が満たされるなら自動でgh pr update-branch <PR>を実行し、その後 CI と head SHA を再確認すべきです。(GitHub Docs) (GitHub CLI)根本原因
#626 は「issue-refinement-loop から impl-review-loop への handoff を自動化し、既知の機械的補正で人間の Y 承認を不要にする」ことを goal にしており、
status: go後に metadata / template / preflight hygiene で止まらない状態を求めています。にもかかわらず、現在の PR review 側ではCloses #Nや branch update のような既知 hygiene が「検出結果」として残り、実行責務に接続されていません。(GitHub)さらに #626 の本文にはまだ
--no-human-approval --prepare-impl-readyや--auto-prepareが Desired Destination として残っていますが、今回の人間コメントの意図では、これはオプション機能ではなく 各スキルのデフォルト達成目標 として扱うべきです。issue-refinement-loopは impl-review-loop を開始可能な issue contract まで、impl-review-loopは draft PR を人間が merge 判断できる状態まで進める、という定義に直す必要があります。(GitHub)もう一つの構造問題は、メイン会話が診断・判断・補正・GitHub 操作の多くを抱えすぎている点です。#227 では、orchestrator は control-plane に限定し、worker step は SubAgent の structured output として受け取る方針が既に整理されています。今回の挙動は、まさに
pr-review-judge/ PR hygiene / branch update / CI再確認の data-plane 作業が main thread に滞留している症状です。(GitHub)改善案
1.
pr-review-judgeの出力分類を変える現状の
LOOP_VERDICTはrecommendationsとfollow_up_issue_requestsに逃がせてしまいます。これを次の分類に変えるべきです。重要なのは、
APPROVEとmerge_readyを分離することです。レビュー内容として approve でも、Closes #N不足・BEHIND・required CI 未再確認が残るならmerge_ready=falseです。impl-review-loopはmerge_ready=trueになるまで、SubAgent に補正を委譲して再判定する必要があります。2. PR hygiene fixer SubAgent を追加する
pr-review-judgeがmissing_closing_keywordを検出したら、main conversation が文章で指摘するのではなく、write-capable なpr-hygiene-fixerSubAgent に委譲します。責務は限定します。
Issue #589 をクローズするのような自然文があるなら、これは意味的にCloses #589へ機械変換可能です。人間判断は不要です。3. Branch sync SubAgent を追加する
mergeStateStatus=BEHINDかつmergeable=MERGEABLEなら、branch-syncerSubAgent に委譲します。GitHub CLI の既定は base branch を PR branch に merge commit で取り込む挙動です。履歴方針として rebase を使いたい場合だけ
--rebaseを contract 化すればよいです。(GitHub CLI)4.
follow_up_issue_requestsの用途を制限する今回のような
Closes #N不足は follow-up issue ではありません。現在の PR の merge readiness を満たすための required repair です。follow_up_issue_requestsに出してよいのは、次のようなものに限定すべきです。5. #626 の Issue 本文を更新する
#626 は現在のコメントを反映して、オプション引数中心の記述をやめるべきです。
修正方針はこれです。
Acceptance Criteria も追加すべきです。
GitHub に貼るコメント案
優先度は高いです。#626 の趣旨そのものに関わるため、別の任意改善ではなく #626 の child issue として扱うのが妥当です。
you asked
message time: 2026-06-03 17:15:58
「PR hygiene fixer SubAgent を追加する」?実装+PR作成の責務は.claude/agents/implementation-worker.mdの認識だからimplementation-workerへ修正指示を出せばいいのでは?何故新規サブエージェントを追加する必要があるの?implementation-workerのスコープが大きすぎる?
「Branch sync SubAgent を追加する」?実装+PR作成の責務は.claude/agents/implementation-worker.mdの認識だからimplementation-workerへ修正指示を出せばいいのでは?何故新規サブエージェントを追加する必要があるの?implementation-workerのスコープが大きすぎる?
「follow_up_issue_requests の用途を制限する」そもそも今回のセッションにおいてはエージェントが正しくエージェントスキルを利用できていないのではないか。つまり、やるべきことだという認識がないのではないかと思います。また、正しく行えていないことについてフォローアップにすることを制限するという対処療法的な仕組みのように感じる内容はコンテクストの無駄だと考えています。どのようにすれば運用設計通りAIエージェントを働かせることができるのか検討した方が建設的だと思います。
chatgpt response
指摘は妥当です。新規 SubAgent 追加ありきの提案は過剰設計の可能性があるので、既存
implementation-workerの責務境界を確認した上で、設計を組み直します。既存設計を読む限り、
implementation-workerは既に worktree 作成・実装・検証・Draft PR 作成・Issue コメント返却まで担う SubAgent と定義されています。さらにgh api ... update-branchも明示的に許可例外に入っています。はい。前回の「新規 SubAgent 追加」は撤回した方がよいです。今回のケースでは 新しい SubAgent を増やす必要は薄いです。既存設計上、
implementation-workerが実装・検証・Draft PR 作成・Issue コメント返却まで担う SubAgent であり、implement-issueskill を実行する役割として定義されています。さらに Bash 制約の例外としてgh api ... pulls/{pull_number}/update-branchも既に許可されています。つまり branch update は新規 SubAgent ではなく、既存implementation-workerの責務として扱うべきです。(GitHub)修正後の設計判断
implementation-workerのスコープが大きすぎる、というより、既存スコープの中にある mode / contract が正しく呼ばれていないのが主因です。特に
implement-issueは、push 後の PR 起票をopen-prskill に委譲し、PR 本文テンプレート、publish gate、idempotency、Closes/Refsの使い分けはopen-pr側の責務だと明記しています。(GitHub) そのopen-pr側も、linked issue が OPEN ならCloses #N、CLOSED ならRefs #Nにする自動判定を持っています。(GitHub)したがって
PR 本文が Closes #589 形式でないは、pr-hygiene-fixer SubAgentを新設する話ではなく、implementation-workerがopen-pr/update_pr.py経由で PR body を補正する repair mode を持つべきという話です。同様に
mergeStateStatus=BEHINDも、新規branch-syncerではなく、既存implementation-workerにUPDATE_BRANCH_REQUEST_V1を渡すべきです。実際、impl-review-loopの Step 5 mergeability handling には、APPROVE + MERGEABLE + BEHINDの場合にUPDATE_BRANCH_REQUEST_V1を組み立て、implementation-workerに委譲すると書かれています。(GitHub)本当の欠陥
欠陥は「担当 SubAgent が足りない」ではなく、次の 3 点です。
第一に、
pr-reviewer/pr-review-judgeが auto-fixable な現在 PR の未完了作業をrecommendationsやfollow_up_issue_requestsに落としてしまっていることです。これは「後で改善」ではなく「この loop が閉じる前に実行すべき作業」です。第二に、
impl-review-loopの終了条件が弱いです。現行の feedback/termination step はLOOP_VERDICT.verdict: APPROVEを見たらtermination_reason: approvedにして終了する matrix になっています。(GitHub) しかし別ファイルの mergeability handling ではBEHIND時に update branch へ routing する規定があるため、APPROVE 即終了のルールと BEHIND repair のルールが競合しています。終了条件はAPPROVEではなく、APPROVE && required_auto_actions == [] && merge_ready == trueにすべきです。第三に、既存 skill を「読めば分かる」状態にしているだけで、使わなかった場合に fail する enforcement がないことです。AI エージェントに運用設計通り働かせるには、散文で「使ってほしい」と書くのではなく、構造化出力と validator で「使わないと終了できない」形にする必要があります。
implementation-workerをどう直すべきか新規 SubAgent ではなく、
implementation-workerに mode を明示するのがよいです。これにより
implementation-workerは単なる「実装初回担当」ではなく、impl-review-loop 内の write-capable repair executor になります。ただし責務は増やさず、実処理は既存 skill / script に委譲します。この形なら
implementation-workerのスコープ肥大化ではなく、既存責務の mode 分割です。follow_up_issue_requests制限案は不十分ここも指摘通りです。「follow_up_issue_requests に出すな」という禁止ルールだけだと対症療法です。より建設的なのは、
pr-review-judgeの出力 schema を変え、現在 PR の required repair を follow-up に分類できない構造にすることです。提案はこれです。
そして
impl-review-loop側にこの gate を入れます。この方が「AI がやるべきことを認識していない」問題に直接効きます。
Closes #589やBEHINDを見つけた時点で、AI に任意判断させず、schema が routing を強制します。#626 への改善コメント案
最終判断
implementation-workerのスコープが大きすぎるというより、既に大きめの write-capable worker として設計されているのに、post-PR repair executor として呼ぶ contract が弱いです。したがって、改善は次の一文に集約できます。
これが今回の人間コメントへの最も筋の良い反映です。
squne121 commentedon Jun 3, 2026
issue-refinement-loop 完了報告
対象コメント 3 件(adversarial 契約レビュー / skill goal-completion 再定義 / PR hygiene 誤分類と implementation-worker 再利用)の OWNER decision を反映して本文を reframe しました。
主な反映内容
issue-refinement-loop → impl_ready/impl-review-loop → draft_pr_ready)へ再定義。--no-human-approval/--prepare-impl-ready/--auto-prepareの新規ユーザーオプションは追加しない方針を明記(AUTONOMY_POLICY_V1)。#564の fail-only intake gate をsupersedes_or_extendsで明示的に extend(gate 自体は fail-only 維持)。issue_kindSSOT 集約の決定を追加(未知 kind の silentimplementationfallback 禁止)。implementation-workerの repair mode 追加で対応する委譲契約を明記。LOOP_VERDICT_V2(merge_ready/required_auto_actions)と終了条件APPROVE && merge_ready && required_auto_actions == []を定義。Closes #N不足 /BEHINDはrequired_auto_actions扱いでfollow_up_issue_requestsに出さない。fact-check(2026-06-03 main, commit 5eb3114)
codebase-investigator で本文中の repo 事実 11 件を検証。C1〜C9 / C11 supported。C10 のみ部分否定(
CONTRACT_BLOCKED_ROUTING_V1は standalone schema ではなくimpl-review-loop/steps/preparation.mdStep 6 に embedded、3 分類は実在)→ 本文を実体に合わせて記述。C5 vs C6(APPROVE 即終了 vs BEHIND repair)の競合を確認 → child-5 で解消。child issue materialization(delivery-rollup / child-complete)
issue-refinement-loopterminal contract をLOOP_HANDOFF_RESULT_V1.status: impl_readyに固定pr-review-judge出力にmerge_ready/required_auto_actions追加(LOOP_VERDICT_V2)implementation-workerの repair mode 追加(新規 SubAgent なし)impl-review-loop終了条件統一(C5/C6 競合解消)AUTONOMY_POLICY_V1+ validator enforcement#611/#627相当の回帰テスト(実装: issue_kind allowlist / normalization を単一 SSOT に集約する(#626 child-1) #629/実装: pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加する #630/実装: implementation-worker に IMPLEMENTATION_WORKER_REQUEST_V2 mode を追加し PR repair executor として機能させる(#626 child-4) #631/実装: impl-review-loop の終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一し終了 gate を実装する #632 に blocked-by)終了状態
check_issue_contract.pyblocking 空)feat(#632): impl-review-loop 終了条件を APPROVE && merge_ready && required…
実装: impl-review-loop 終了条件を APPROVE && merge_ready && required_auto_ac…
squne121 commentedon Jun 6, 2026
全 child Issues (#628, #629, #630, #631, #632, #633, #634, #647) がクローズ済み。post-merge-cleanup で close します。