Skip to content

実装: #1939 Workstream 4 — retrospective candidate を issue-refinement-loop → impl-review-loop へ controlled handoffする #2602

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1939"
goal_ref: >-
  #1939 Workstream 4 を materialize し、人間が採用した retrospective improvement candidate を
  既存 dedupe/materialization 契約で GitHub Issue に変換した後、issue-refinement-loop で ready 化し、
  実装が必要な candidate は impl-review-loop の正式 entrypoint へ handoff する。
  retrospective 自身が ad-hoc に implementation/review workflow を再実装しない。
change_kind: workflow
dedupe_key: "1939:workstream-4:retrospective-candidate-controlled-loop-handoff:v1"

Parent Issue

#1939 — Workstream 4: follow-up Issue candidate materialization handoff

Parent fixed decision:

  • retrospective と follow-up Issue candidate の採否・起票は human-triggered。
  • candidate は既存 dedupe/materialization contract へ渡す。
  • child は 1 Issue = 1 PR。
  • raw transcript / prompt / tool I/O / credential / absolute local path を public artifact に出さない。

Parent Goal Ref

Current Validated Scope

  • retrospective follow-up candidate → controlled GitHub Issue materialization の handoff contract(write-capable、## In Scope 参照)。
  • candidate の dedupe key / overlap readback / human authorization boundary(## Candidate Input Contract に producer 別の具体契約を固定する)。
  • materialized Issue を issue-refinement-loop → impl-review-loop へ渡すための deterministic next-action contract。
  • 詳細な write-capable path 一覧は ## Allowed Paths を正本とする。

2026-09-19 OWNER anchor 反映(current main b1668db5133c6f151bcc8c2ec67bd589f74f7f34 基準の再検証):

  • .claude/skills/create-issue/scripts/create_issue_txn.py 自身は title-based exact match dedupe(OPEN issue のみ)のみを実装している。一方、dedupe_key ベースの検索は既に別の production 経路で確立済みである: .claude/skills/create-issue/scripts/plan_child_materialization.py::_search_dedupe_candidates() が gh issue list --state all --search <dedupe_key> を実行し、docs/dev/agent-skill-boundaries.md(L534-543, FOLLOW_UP_ISSUE_REQUEST_V1 dedupe フロー)が同じ gh issue list --repo <owner>/<repo> --state all --search '"<dedupe_key>"'(OPEN/CLOSED 両方、caller 側で実行)を canonical convention として文書化している。「既存 dedupe/materialization contract を再利用する」は、この確立済みの caller 側(外側)dedupe_key 検索 をそのまま再利用し、create_issue_txn.py は create_issue_txn.py 自身の内部 title-only 検索が outer の key 判定を横取りして別 Issue へ誤って寄せないよう、外側が「create 確定」を渡したときに内部 title dedupe を bypass する最小限の opt-in 拡張のみを追加する、という意味に限定する。
  • retrospective candidate の入力は単一の未定義形式ではなく、実在する2つの producer schema(chatgpt_retrospective_result/v1 の follow_up_issue_candidates[] と、project 版 agent-retrospective の agent_improvement_candidate/v1)のいずれかであり、両者は構造が異なる(## Candidate Input Contract 参照)。

Remaining Parent Gaps

  • Workstream 1(daily workset contract/result schema)— 本 Issue の Dependencies により、実装/closure での parent integration 主張の前提として未成立のまま残る。
  • Workstream 3(repository-level ChatGPT discovery entrypoint)— 同上。

Outcome

採用された retrospective follow-up candidate が、human authorization → dedupe/overlap readback → GitHub
Issue materialization → issue-refinement-loop での ready 化 → impl-review-loop の正式 entrypoint
(root_entry_router.py::run_root_transition() を唯一の起動所有者とする)まで、既存 Skill の
entrypoint のみを経由して決定論的に到達できる状態。到達する終端状態は「Draft PR ready(Closes #N)」
に限定せず、impl-review-loop が正当に返す他の terminal(already_satisfied / status: no_change_required、
正式な blocked / human_escalation を含む)も、本 handoff の意図した決定論的到達状態に含める。
retrospective orchestration 自身が implementation/review workflow を独自複製していないこと、
canonical loop が最終的に返す routing/termination result を handoff layer が独自の completion 判定へ
昇格させていないこと、focused test(AC8)が PASS していることを含む。

Runtime Verification Applicability

decision: immediate
reason: 本 Issue の Allowed Paths が .claude/skills/issue-refinement-loop/** / .claude/skills/impl-review-loop/** の
handoff interface/doc を含み得るため、docs/dev/extension-surface-runtime-policy.yaml の
skill-invocation-procedure-or-contract-change / subagent-lifecycle-start-stop-delegation-fallback
risk-trigger に該当する(docs/dev/runtime-verification-policy.md 準拠)。
applicable_acs: AC2, AC8, AC11
execution_environment: 現在インストール済みの Claude Code CLI、ローカル repository worktree、gh CLI(GitHub API read-only)
skip_conditions: focused test 対象の Skill script が現行 repository に存在しない、または gh auth が利用不能な場合(SKIP exit 77 相当)
fallback_policy: fixture/synthetic-only の PASS は AC8 の focused-test 検証を代替しない。既存 issue-refinement-loop/impl-review-loop の state machine を re-run するのではなく、handoff boundary(materialization → next-action 決定)のみを対象にする
artifact_requirements: focused test の pass/fail ログを PR evidence として添付する。raw transcript / credential / absolute local path は含めない

Required Skills

なし(issue-refinement-loop / impl-review-loop / create-issue 等の既存ワークフロー skill を再利用するのみで、
本 Issue 固有の新規ドメイン知識 skill は不要)。

Background / Problem

2026-09-10 の agent-retrospective 改善・実行セッションでは、調査 SubAgent、実装 SubAgent、敵対的レビュー、full test suite、mutation test、live verification まで行われ、品質面の有効な行動は多かった。

一方、repository の canonical implementation workflow である .claude/skills/issue-refinement-loop / .claude/skills/impl-review-loop の正式 entrypoint を通らず、retrospective orchestration の中で直接 working tree を変更し、その後 main agent が追加修正・test追加・document修正を継続した。

そのため、品質活動は類似していても、以下の canonical contract が構造的に保証されなかった。

  • implementation Issue body を先に ready 化すること。
  • 1 Issue = 1 branch/worktree = 1 Draft PR。
  • impl-review-loop の planner → implementation-worker → mandatory independent gates → fix_delta/re-review の順序。
  • test-runner / doc-researcher / independent pr-reviewer の必須 gate。
  • Closes #N を持つ Draft PR までを child completion とすること。
  • retrospective finding と implementation scope の traceability。

これは「レビューやテストをしていない」という問題ではなく、同等処理を ad-hoc に再構成したため、repo-local Skill の state machine / ownership / completion contract に乗っていないという問題である。

#1939 は Workstream 4 を未起票のまま残しており、この handoff gap を明示的に所有する child が必要である。

Desired Outcome

human-triggered retrospective が follow-up candidate を返した後、採用された candidate は次の既存契約へ決定論的に handoff される。

retrospective candidate
  -> human accepts materialization
  -> dedupe / overlap readback (producer-specific key, ## Candidate Input Contract)
  -> GitHub implementation Issue (create or reuse, create_issue_txn.py)
  -> /issue-refinement-loop <Issue>
  -> ready contract (approved)
  -> run_root_transition() (root_entry_router.py, single launch owner)
  -> /impl-review-loop <Issue>
  -> Draft PR ready (Closes #N) | already_satisfied | blocked/human_escalation
  -> human merge (Draft PR ready の場合)

この Issue は新しい implementation orchestrator を作らない。既存 Skill を authority として再利用し、retrospective 側は candidate/materialization/handoff boundary のみを所有する。ready 判定後の実装起動は issue-refinement-loop の approved 終了時に同一 turn 内で実行される run_root_transition()(root_entry_router.py)に一本化し、本 Issue が追加する handoff layer 自身が impl-review-loop を横から起動しない。LOOP_HANDOFF_RESULT_V1 marker や保存済み comment は audit telemetry であり、implementation authorization token としては扱わない。

Dependencies

Parent #1939 の固定契約上、Workstream 4 は Workstream 1(daily workset contract/result schema)と Workstream 3(repository-level ChatGPT discovery entrypoint)に依存する。

  • 本 Issue の refinement/design は先行してよい。
  • implementation/closure で parent integration を主張するのは Workstream 1・3 の必要契約が materialize された後に限る。
  • dependency 不足を回避するために Workstream 1/3 を本 Issue 内へ取り込まない。
  • 2026-09-19 OWNER anchor による再整理: 上記依存は「Workstream 1・3 が未成立の間は parent 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 全体(daily/repository-wide integration)の integration-complete を主張できない」ことのみを意味する。repo-local な candidate → Issue → canonical issue-refinement-loop/impl-review-loop 接続は、既存の create_issue_txn.py / follow-up-materialization.md / root_entry_router.py を土台に Workstream 1/3 の完了を待たず独立に設計・実装着手してよい(2026-09-10 の旧終了コメントが行った「WS1/WS3 未起票の間は impl-review-loop への handoff 自体を行わない」という拡大解釈は、本 anchor により superseded)。Workstream 1/3 自体の実装を本 Issue に取り込まない制約は維持する。

In Scope

  • retrospective follow-up candidate → controlled GitHub Issue materialization の handoff contract。
  • candidate の dedupe key / overlap readback / source traceability。
  • chatgpt_retrospective_result/v1(follow_up_issue_candidates[])と agent_improvement_candidate/v1(finding_contract.identity を含み得る)の producer 別 thin adapter による、既存 materialization input(FOLLOW_UP_ISSUE_REQUEST_V1 相当)への正規化(## Candidate Input Contract 参照)。
  • 既存の caller 側 dedupe_key 検索 convention(plan_child_materialization.py::_search_dedupe_candidates()、docs/dev/agent-skill-boundaries.md の FOLLOW_UP_ISSUE_REQUEST_V1 dedupe フロー、gh issue list --state all --search '"<dedupe_key>"')の再利用による、materialization 前の OPEN/CLOSED 両対象 key-based dedupe 判定。
  • .claude/skills/create-issue/scripts/create_issue_txn.py への、既存 title-based OPEN-only dedupe の後方互換を壊さない最小限の opt-in 拡張(outer 側が dedupe_key 検索で「create 確定」と判定した場合に、内部 title-only 検索を bypass するフラグの追加のみ。新しい独立 Issue creator は作らない)。
  • human authorization boundary。
  • materialized Issue を issue-refinement-loop へ渡すための deterministic next-action contract。
  • ready 化後、implementation candidate を impl-review-loop の run_root_transition() へ渡すための deterministic next-action contract(実装起動の唯一の owner とする)。
  • current Skill の entrypoint / state-machine / completion contract を再利用する adapter/documentation/validation。
  • handoff result に materialized_issue, refinement_status, implementation_handoff_status 等、既存 vocabulary で表現可能な machine-readable status を持たせることの検討。
  • tests / runtime verification / docs readback。

Candidate Input Contract

retrospective follow-up candidate は単一の未定義形式ではなく、current main 上に実在する2つの producer schema のいずれかとして届く。巨大な共通 schema は新設せず、producer 別の薄い adapter を既存 materialization input(FOLLOW_UP_ISSUE_REQUEST_V1)へ正規化する形に集約する。

producer schema 定義箇所 identity フィールド dedupe key 導出
chatgpt_retrospective_result/v1 の follow_up_issue_candidates[] docs/schemas/chatgpt-retrospective-result.schema.json なし(title/body/blocked_by/public_safe のみ、additionalProperties: false) target.repo + target.type + target.number + 正規化した title から決定論的に導出する(input_marker_digest や生成日時のような run-specific 値は使わない)
agent_improvement_candidate/v1(finding_contract 付き) .claude/skills/agent-retrospective/schemas/agent_improvement_candidate_v1.schema.json finding_contract.identity(FINDING_IDENTITY_V1、compute_finding_identity() で source_run_ref/base_sha/timestamp/evidence fingerprint を除外した typed key から決定論的に導出される cross-run stable identity) finding_contract.identity.value(既存の sha256: 値)をそのまま dedupe key の導出元として利用する
agent_improvement_candidate/v1(finding_contract 不在、legacy) 同上 なし(delta_capability: legacy_unavailable) candidate_id(この candidate 自身の lifecycle identity。cross-run ではなく単一 candidate 内で安定)を dedupe key の導出元として利用する

未知 field を拒否するこれら既存 schema(additionalProperties: false)に、勝手に dedupe_key フィールドを追加して互換性を装うことはしない。dedupe key の導出は producer 側 schema の外側(本 Issue が追加する thin adapter 層)で行う。

導出した dedupe key は、既存の caller 側 dedupe convention(plan_child_materialization.py::_search_dedupe_candidates() と同等の gh issue list --state all --search '"<dedupe_key>"'、docs/dev/agent-skill-boundaries.md L534-543 の FOLLOW_UP_ISSUE_REQUEST_V1 dedupe フロー)へそのまま渡す。この外側(outer)の key 検索が OPEN/CLOSED いずれのマッチも返さなかった場合にのみ create_issue_txn.py を「create 確定(内部 title-only dedupe を bypass)」モードで呼び出す。create_issue_txn.py の内部 title 検索を無条件のまま呼び出すと、outer が「重複なし」と確定した後で inner の title-only 一致により別 Issue へ誤って寄せる二重判定が発生し得るため、これを許容しない。

Out of Scope

  • retrospective から無断で GitHub Issue を自動起票すること。
  • retrospective が直接 branch/worktree を作成し実装する新 orchestration path。
  • issue-refinement-loop / impl-review-loop の内部 state machine を複製すること。
  • automatic merge。
  • Workstream 1 / 3 の実装。
  • raw/private evidence の GitHub 公開。
  • P0: agent-retrospective の --since-last-retrospective で session collector 未配線を false-green にしない #2601 の session coverage correctness 実装。
  • chatgpt_retrospective_result/v1 と agent_improvement_candidate/v1 を統合する巨大な共通 candidate schema の新設。
  • 新しい generic authorization ledger、permission broker、全 workflow を覆う scanner、retrospective 独自の implementation/review state machine。
  • portable plugin 版 retrospective(plugins/agent-retrospective/)へ repo-local issue-refinement-loop/impl-review-loop 一式を mirror すること、または .claude/ 不在 repository に loop-protocol の implementation flow を強制すること(v1 の本 handoff は repo-local contract に限定する)。

Acceptance Criteria

  • AC1: human が candidate materialization を明示的に許可した場合だけ Issue creation path が有効になり、未承認 candidate は proposal のまま維持される。retrospective 完了だけを authorization とみなさない。
  • AC2: materialization 前に、## Candidate Input Contract で確定した producer 別 dedupe key 導出規則から得た exact key を、既存 caller 側 dedupe convention(gh issue list --state all --search "<dedupe_key>" 相当、plan_child_materialization.py::_search_dedupe_candidates() / docs/dev/agent-skill-boundaries.md L534-543 と同等)で OPEN/CLOSED Issue の両方に対し outer 検索として readback し、exact duplicate を新規起票しない。少なくとも次を区別する: (a) same key/different title は duplicate として扱う、(b) different key/same title は title 一致だけでは duplicate と判定しない、(c) same key/OPEN issue は既存 Issue を再利用する、(d) same key/CLOSED issue は reopen せず close reason/disposition を保持して返す、(e) search pagination/result truncation は search_truncated 相当の machine-readable flag を残す、(f) create 後の partial failure からの再実行は同一 key の readback により重複作成しない、(g) outer 検索が「重複なし」と確定した場合、create_issue_txn.py の内部 title-only dedupe が別の Issue へ誤って寄せることを許容しない(inner dedupe bypass フラグで outer の判定を優先する)。隣接 Issue は Related/Dependency として保持する。
  • AC3: materialized implementation Issue は current .claude/skills/issue-refinement-loop/SKILL.md が要求する body contract を満たすか、同 Skill による refinement を必須 next action とする。retrospective orchestration が独自の ready 判定を実装しない。
  • AC4: ready になった implementation Issue の実装開始は current .claude/skills/impl-review-loop/SKILL.md の正式 entrypoint、具体的には issue-refinement-loop の approved 終了時に同一 turn 内で実行される run_root_transition()(root_entry_router.py、ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1)に一本化する。retrospective orchestration が planner/worker/reviewer loop を独自複製せず、また handoff layer 自身が別経路で impl-review-loop を横から起動しない(二重起動 0 件)。
  • AC5: implementation handoff 後の completion contract は impl-review-loop に委譲し、1 Issue = 1 branch/worktree = 1 Draft PR、Closes #N、mandatory independent gates、fix/re-review を保持する。impl-review-loop が正当に返す terminal(already_satisfied / status: no_change_required、正式な blocked/human_escalation、max_iterations を含む)をそのまま伝播し、handoff layer が補助的な warning や worker-local human_review_required を独自に hard stop へ昇格させない。
  • AC6: candidate source(chatgpt_retrospective_result/v1 の target または agent_improvement_candidate/v1 の source_run_ref/finding_contract.identity)→ materialized Issue → refinement → implementation handoff を追跡できる public-safe reference を残す。raw transcript / prompt / tool I/O / credential / absolute local path は含めない。
  • AC7: issue-refinement-loop または impl-review-loop が blocked/stop condition を返した場合、retrospective/handoff layer はそれを迂回せず status として返す。別の ad-hoc implementation path に fallback しない。
  • AC8: 「6ケースの件数維持」自体を目的化せず、少なくとも次の境界を parameterized focused test で固定する: unauthorized→Issue create 0/implementation launch 0、authorized unique candidate→Issue create 1・作成された Issue への exact 参照で refinement へ接続、same-key/different-title と different-key/same-title の取り違え防止、CLOSED duplicate の disposition 保持、Issue create 後の downstream failure からの rerun が同一 Issue を再利用し重複作成しないこと、run_root_transition() 経由の canonical root ownership による implementation double-launch 0、canonical terminal(already_satisfied/blocked 等)のそのままの伝播、source/dependency reference の保持。
  • AC9: 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 Workstream 1/3 dependency が未成立の場合、その不足を machine-readable に残し、parent-level integration complete を主張しない(## Dependencies の 2026-09-19 再整理の通り、この不足は repo-local な candidate→Issue→canonical loop 接続自体の実装着手は妨げない)。
  • AC10: repository docs で agent-retrospective / follow-up materialization / issue-refinement-loop / impl-review-loop の ownership boundary が一意に説明され、相互に矛盾しない。
  • AC11: ## Candidate Input Contract で定義した producer 別 adapter(chatgpt_retrospective_result/v1 の follow_up_issue_candidates[] と agent_improvement_candidate/v1)が、それぞれ既存 materialization input へ変換されることを明示し、両 producer を1つの新設共通 schema へ統合しない。finding_contract.identity を持つ入力ではそれを dedupe identity の導出元として利用し、run SHA・生成日時・evidence fingerprint のような run-specific 値を stable dedupe identity に用いない。

Design Constraints

  • Reuse, do not clone: issue-refinement-loop と impl-review-loop の stage logic を新しい script にコピーしない。
  • Reuse the existing caller-side dedupe convention: dedupe key 検索は plan_child_materialization.py::_search_dedupe_candidates() / docs/dev/agent-skill-boundaries.md の FOLLOW_UP_ISSUE_REQUEST_V1 dedupe フローが既に確立している gh issue list --state all --search "<dedupe_key>" を再利用し、新しい検索実装を作らない。
  • Extend, do not replace, the existing Issue writer: create_issue_txn.py への変更は、outer の dedupe_key 検索が「create 確定」と判定した場合に内部 title-only dedupe を bypass する opt-in フラグの追加のみとし、既存 title-based exact match(OPEN-only)呼び出しの後方互換を保つ。新しい独立 Issue creator は作らない。
  • Single implementation launch owner: ready→implementation の起動は run_root_transition()(root_entry_router.py)に一本化し、本 Issue が追加する handoff layer は candidate normalization → Issue create/reuse → canonical issue-refinement-loop root までを担当し、ready 判定や impl-review-loop 起動を横から複製しない。
  • Human-triggered: Issue materialization は必ず人間の明示依頼に基づく。
  • One issue, one implementation unit: 複数 candidate を1 Issueへ無差別に束ねない。
  • No false completion: Issue作成だけで implementation complete としない。refinement、Draft PR ready、merge、already_satisfied は別状態。
  • No hidden fallback: Skill stop/block を retrospective が自動回避しない。

Verification Commands

# AC1
# AC2
# AC3
# AC4
# AC5
# AC6
# AC7
# AC8
# AC9
# AC11
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_retrospective_candidate_handoff.py -v
# AC2
$ uv run --locked pytest .claude/skills/create-issue/tests/test_create_issue_txn.py .claude/skills/create-issue/tests/test_create_issue_txn_blocking.py -v
# AC10
$ pnpm typecheck
# AC10
$ pnpm lint
# AC10
$ pnpm test
# AC10
$ pnpm build

test_retrospective_candidate_handoff.py は現時点でまだ存在しない parameterized focused test file
(AC8/AC11 で固定した境界: unauthorized / authorized-unique-materialized / same-key-different-title /
different-key-same-title / CLOSED-duplicate-disposition / downstream-failure-rerun-reuses-issue /
double-launch-guard / canonical-terminal-propagation / source-reference-preservation を固定する)で
あり、実装時に .claude/skills/issue-refinement-loop/tests/ 配下へ新規追加する(新規 test directory
は作らない)。ケース数を6に固定することを目的にしない。production の判定関数・adapter を実際に通し、
GitHub API・network・model 呼び出し等の external I/O だけを fake/monkeypatch する(production
decision logic 自体をテストコード側で再実装しない)。baseline(実装前)ではこの VC はファイル不在
により exit code 4 で expected_baseline_fail に分類される(既存 canonical VC preflight 規約、
Issue #1285/#1347 準拠)。既存の .claude/skills/issue-refinement-loop/tests/ /
.claude/skills/impl-review-loop/tests/ 全体を対象とする広範な VC は、本 Issue の scope に無関係な
既存の environment-dependent test failure(test_command_registry.py の real-subprocess-dispatch 系、
current main で pre-existing)を巻き込むため使用しない。

AC1(human authorization gate)/ AC2(producer 別 key-aware dedupe/overlap readback)/ AC4
(run_root_transition() への一本化)/ AC5(completion contract 委譲・terminal 伝播)/ AC7
(blocked status 迂回禁止)/ AC11(candidate input contract の producer 別 adapter)は、上記
focused test file の同一境界群が実質的にカバーする(# AC1〜# AC11 の bare marker はこの
focused test への従属を表す。個別の独立コマンドは追加しない)。AC2 のうち create_issue_txn.py
自身への拡張は、既存 focused test(test_create_issue_txn.py / test_create_issue_txn_blocking.py)
が後方互換 regression guard を兼ねる。

AC3(materialized Issue が issue-refinement-loop の body contract を満たすか、同 Skill による
refinement を必須 next action とすること)・AC6(public-safe reference の traceability)・
AC9(Workstream 1/3 dependency 不足の machine-readable な記録)は、実装コードの静的検証だけでは
完全に確認できない設計判断を含むため、human_judgment(pr-review-judge による PR レビュー時の
確認事項)として明示し、focused test 化を必須にしない。

AC10(repository docs での ownership boundary の一意性・無矛盾性)は pnpm build gate では検証
されない prose の一貫性確認であるため、human_judgment(PR レビュー時に
docs/dev/agent-skill-boundaries.md と関連 SKILL.md の記述が本 Issue の変更後も矛盾しないことを
reviewer が確認する)として明示する。

実装後に「対象 test/script file が存在しない」ことを理由に AC8/AC11 の focused test を成功扱いで
SKIP しない(baseline の expected_baseline_fail は実装前のみに適用される既存 VC preflight 規約であり、
実装後の SKIP を正当化しない)。

Allowed Paths

/issue-refinement-loop で current main を調査して最小化すること。候補:

  • .claude/skills/agent-retrospective/**(candidate/handoff boundary がここに存在する場合のみ)
  • .claude/skills/create-issue/scripts/create_issue_txn.py(既存 title-based OPEN-only dedupe を壊さない、outer dedupe_key 確定時の内部 title-only dedupe bypass フラグ追加のみ。新しい独立 Issue creator は作らない)
  • .claude/skills/create-issue/tests/test_create_issue_txn.py
  • .claude/skills/create-issue/tests/test_create_issue_txn_blocking.py
  • .claude/skills/issue-refinement-loop/references/follow-up-materialization.md
  • .claude/skills/issue-refinement-loop/**(handoff interface/doc clarification が必要な場合のみ。state machine の複製・大幅変更はしない)
  • .claude/skills/impl-review-loop/**(entrypoint/handoff contract clarification が必要な場合のみ)
  • docs/dev/agent-skill-boundaries.md
  • related tests / schemas / fixtures

Workstream 1/3 の asset を実装する必要が判明した場合は scope expansion せず dependency Issue へ戻す。

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • human authorization 無しに Issue creation/action を自動化する必要が生じた場合。
  • existing Skill の state machine を複製しないと実現できない設計になった場合。
  • Workstream 1/3 の実装を本 Issue に取り込む必要が生じた場合。
  • public/private evidence boundary を破る必要が生じた場合。
  • destructive git operation、secret access が必要な場合。

Required Design References

  • 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 parent — Workstream 4 / AC9 / Phase Handoff Contract / Delivery Rule
  • .claude/skills/issue-refinement-loop/SKILL.md
  • .claude/skills/issue-refinement-loop/references/follow-up-materialization.md
  • .claude/skills/issue-refinement-loop/scripts/root_entry_router.py(ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1、run_root_transition())
  • .claude/skills/create-issue/scripts/create_issue_txn.py
  • .claude/skills/create-issue/scripts/plan_child_materialization.py(_search_dedupe_candidates()、既存 caller 側 dedupe_key 検索の precedent。本 Issue はこのファイル自体を変更しない、参照のみ)
  • docs/dev/agent-skill-boundaries.md(L534-543, FOLLOW_UP_ISSUE_REQUEST_V1 dedupe フロー)
  • .claude/skills/impl-review-loop/SKILL.md(already_satisfied terminal semantics、L67/108/144/153-172)
  • docs/schemas/chatgpt-retrospective-result.schema.json
  • .claude/skills/agent-retrospective/schemas/agent_improvement_candidate_v1.schema.json
  • docs/dev/agent-skill-boundaries.md
  • P0: agent-retrospective の --since-last-retrospective で session collector 未配線を false-green にしない #2601(session coverage false-green correctness。別 scope)

Verification Scenarios

A. candidate + no human authorization
   => no Issue created; proposal retained

B. candidate + human authorization + exact duplicate exists (same dedupe key)
   => no duplicate Issue; existing Issue returned

B2. candidate + human authorization + same dedupe key, different title
   => treated as duplicate (key wins over title mismatch); existing Issue returned

B3. candidate + human authorization + different dedupe key, same title
   => NOT treated as duplicate by title alone; new Issue materialized

B4. candidate + human authorization + same dedupe key, matching Issue is CLOSED
   => not reopened; close reason/disposition preserved and returned

C. candidate + human authorization + unique
   => Issue materialized; next action = issue-refinement-loop

C2. Issue create succeeds, downstream step (e.g. label apply) fails, handoff rerun
   => rerun reuses the same materialized Issue via dedupe key readback; no duplicate create

D. refinement ready
   => next action = run_root_transition() invokes impl-review-loop; no ad-hoc implementation fallback; no double-launch even if handoff rerun races with root

E. refinement/implementation skill blocked
   => blocked status propagated; no bypass

E2. impl-review-loop returns already_satisfied (no meaningful PR delta)
   => already_satisfied propagated as a valid terminal; not upgraded to a hard stop by the handoff layer

Delivery Rule

  • まず /issue-refinement-loop <this issue> で parent 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 current body、Workstream 1/3 dependency、existing materialization assets、current Skill contracts を再検証する。
  • implementation readiness が成立した場合のみ /impl-review-loop <this issue> を使用する。
  • 1 Issue = 1 branch/worktree = 1 Draft PR。
  • mandatory independent reviewers/subagents の完了を待ち、HIGH/MEDIUM finding を解消する。
  • merge は人間操作。

Activity

  1. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: 完了 (2026-09-10T05:29:00Z)

    結果: refinement approved だが impl-review-loop へは意図的に handoff しない(dependency stop)。

    実施内容

    1. Step 0f preflight: 初回 STATUS: blocked(.github/ISSUE_TEMPLATE/implementation.yml が要求する 7 セクション欠落、disposition: human_review_required 4件 + auto_apply_safe 3件)。既存 body の内容(Parent Issue 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 の記述、In Scope、Dependencies 等)から機械的に導出可能な内容で全セクションを補完。再実行で STATUS: pass。
    2. Step 1 investigation(codebase-investigator): 親 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 は OPEN、Workstream 2/5 は CLOSED(実装済み)、Workstream 1・Workstream 3 は未起票(未成立) を確認。重複 Issue なし。既存 follow-up-materialization 契約とは「流向が逆」の相互補完関係であり、そのまま流用できる既存 exact 実装は存在しないことを確認。
    3. Step 2 review(run_root_review_pipeline.py produce): 4回実施。
      • 1回目: step_5_operator_intervention_required(VC preflight の regression gate。自作の Verification Commands 挿入時に script bug で ## Current Validated Scope セクション内へ VC block が誤って二重挿入される事故が発生 — str.replace() の非限定置換によるもの。即座に検出・修復し、修復後の body で readback 検証済み)
      • 2回目: 同じく step_5_operator_intervention_required(uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ -v が実際に regression gate で実行され、current main 上の 本 Issue と無関係な既存 pre-existing test failure(test_command_registry.py の RealSubprocessDispatch 系3件)を巻き込んで fail。VC を .claude/skills/issue-refinement-loop/tests/test_retrospective_candidate_handoff.py(未作成の focused test file、expected_baseline_fail として exit code 4 で go 扱いになる既存 canonical パターン)へ絞り込んで解消)
      • 3回目: step_2_5(deterministic APPROVE)
      • 4回目: step_2_5(semantic rewrite 後の再 APPROVE)
    4. Step 2.5 semantic design review(issue-design-reviewer): 2周実施。
      • 1周目: high「AC8 の focused test 5ケースに、この handoff 設計の中核 happy path(unique candidate materialized、Verification Scenario C 相当)が含まれていない」→ AC8 を6ケースへ拡張し VC の AC coverage 注記を追加
      • 2周目: medium「AC2/Parent Goal Ref が指す『既存 dedupe/materialization contract』が、実際には意味の異なる3つの既存メカニズム(create-issue の title-exact dedupe、follow-up-materialization.md の内部 Step 4.5 gate、dependency-materialization.md の別概念)のどれを指すか未確定」→ non-blocking warning として記録(requires_owner_choice: true、実装時に owner 判断が必要)

    残った finding(要 owner 判断、non-blocking)

    • AC2/Parent Goal Ref: 実装時に reuse すべき既存 dedupe/materialization contract を具体的に1つ(または明示的な組み合わせ)に確定すること。.claude/artifacts/issue-refinement-loop/2602/d9e52e57a85b6260/semantic_review_result.json に記録。

    Dependency Stop(human approval 待ちではなく、repository contract 上の停止)

    Issue #2602 自身の ## Dependencies 節・AC9 が明記する通り、Parent #1939 の固定契約上 Workstream 4(本 Issue)は Workstream 1(daily workset contract/result schema)・Workstream 3(repository-level ChatGPT discovery entrypoint)に依存する。Step 1 investigation で独立確認した通り、Workstream 1・Workstream 3 はいずれも未起票(未成立) である。

    本 Issue の ## Dependencies 節が明示する通り「refinement/design は先行してよい」が「implementation/closure で parent integration を主張するのは Workstream 1・3 の必要契約が materialize された後に限る」。今回の指示(ユーザー明示)に従い、この dependency が未成立の間は impl-review-loop への handoff を行わず、迂回もしない。

    LOOP_HANDOFF_RESULT_V1:
      status: blocked
      routing_action: blocked
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: ""
        generated_at: "2026-09-10T05:29:00Z"
        body_sha256: "sha256:446ff42f8058381f35e636d8ad23f53438a26bc07b91c009297e43b5c2175238"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "no label mutation performed this cycle"
      auto_fixes:
        result: auto_fixed
        required:
          - kind: template_hygiene
            executor: implementation-worker
            result: applied
            evidence:
              before: "sha256:7a47878a66043ddd36b2035d8ce1defdd0c09640ccf035b100569609de0862e0"
              after: "sha256:446ff42f8058381f35e636d8ad23f53438a26bc07b91c009297e43b5c2175238"
              comment_url: ""
        skipped: []
      blockers:
        - kind: dependency_unmet
          description: "Parent #1939 Workstream 1 (daily workset contract/result schema) and Workstream 3 (repository-level ChatGPT discovery entrypoint) are both not yet filed. AC9 requires this gap to remain machine-readable rather than claiming parent-level integration complete. Per explicit operator instruction, implementation handoff is withheld (not bypassed) until this dependency is materialized."
      permissions:
        unavailable: []
      generated_at: "2026-09-10T05:29:00Z"
      checked_body_sha256: "sha256:446ff42f8058381f35e636d8ad23f53438a26bc07b91c009297e43b5c2175238"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []

    次アクション: Workstream 1・3 が起票・materialize された後、このリファインメント済みの Issue #2602 に対して /impl-review-loop 2602 を(人間または別セッションが)実行する。それまでは実装を開始しない。

  2. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    判定:REQUEST_CHANGES — 接続契約を修正してから実装へ進めるべきです

    方向性は妥当です。ただし、「既存ワークフローを再利用する」という方針に対して、実際に接続する入力・起票ヘルパー・実装起動の所有者が確定していません。 このままでは、独自実装を防ぐためのIssueが、実装時の追加判断や停止を再び発生させます。

    不足しているのは新しいセキュリティ機構ではありません。候補の変換、重複排除、既存ループへの引き渡しを、小さく具体的に定義することです。

    レビューは、取得時の main 5b2c181b09b22e071a77e60b7977b79f1bb1e2eb を基準に、#2602本文・終了コメント、親#1939と関連コメント、起票処理、両ループ、retrospectiveのproject版/plugin版、関連PR #2626の差分・コメントを照合しました。以下は契約と実装の整合性レビューであり、実機でループを起動して障害を再現した報告ではありません。

    実装前に直すべきP1が4件、同時に整理したいP2が3件あります。


    P1-1:再利用予定の起票ヘルパーでは、AC2の重複排除を満たせない

    該当箇所:AC2、Required Design References、Allowed Paths

    AC2は「exact dedupe_key によるOPEN/CLOSED両方の確認」を要求しています。しかし、現行 create_issue_txn.py の _find_open_issues_by_title() は、次の方式です。

    --state open
    --search 'in:title "<title>"'
    取得後にタイトルを完全一致比較

    CLI引数にも、確認した定義では dedupe_key を指定する入力がありません。つまり、既存ヘルパーを呼ぶだけでは、このIssueが要求するkeyベースの重複排除にはなりません。

    考慮すべき反例は明確です。

    入力・既存Issue | 必要な挙動 -- | -- 同じkey、タイトルだけ変更 | 同じ改善として再利用する 異なるkey、たまたま同じタイトル | タイトルだけで同一Issue扱いしない 同じkeyのCLOSED Issueが存在 | 新規作成せず、既存の終了理由に応じて扱う 検索結果が上限に到達 | 未取得分を「重複なし」と扱わない

    これらはparameterizeすればよく、大規模な新規ハーネスにする必要はありません。

    最終提案

    #2602は廃棄・全面再設計ではなく、実装契約の修正が適切です。

    まず、入力形式と本番呼び出し元を確定し、keyベースの起票経路に必要な最小Allowed Pathsを追加します。次に、実装起動を既存root transitionへ一本化し、Runtime Verificationを「本番ロジックを実行し、外部I/Oだけを置き換える検証」へ整理します。そのうえで、変更不要・CLOSED重複・部分成功を正常に扱えるようにします。

    追加の承認台帳、汎用permission broker、全workflowを覆う新しいscanner、毎回のlive GitHub書き込みテストは推奨しません。

    このIssueの品質は、制約の数ではなく、「採用した候補が重複せず、不要な承認や再起動なしに既存ループへ入り、途中失敗しても同じIssueから続けられるか」で評価すべきです。

    ## 判定:REQUEST_CHANGES — 接続契約を修正してから実装へ進めるべきです

    方向性は妥当です。ただし、「既存ワークフローを再利用する」という方針に対して、実際に接続する入力・起票ヘルパー・実装起動の所有者が確定していません。 このままでは、独自実装を防ぐためのIssueが、実装時の追加判断や停止を再び発生させます。

    不足しているのは新しいセキュリティ機構ではありません。候補の変換、重複排除、既存ループへの引き渡しを、小さく具体的に定義することです。

    レビューは、取得時の main 5b2c181b09b22e071a77e60b7977b79f1bb1e2eb を基準に、#2602本文・終了コメント、親#1939と関連コメント、起票処理、両ループ、retrospectiveのproject版/plugin版、関連PR #2626の差分・コメントを照合しました。以下は契約と実装の整合性レビューであり、実機でループを起動して障害を再現した報告ではありません。

    実装前に直すべきP1が4件、同時に整理したいP2が3件あります。


    P1-1:再利用予定の起票ヘルパーでは、AC2の重複排除を満たせない

    該当箇所:AC2、Required Design References、Allowed Paths

    AC2は「exact dedupe_key によるOPEN/CLOSED両方の確認」を要求しています。しかし、現行 create_issue_txn.py の _find_open_issues_by_title() は、次の方式です。

    --state open
    --search 'in:title "<title>"'
    取得後にタイトルを完全一致比較
    

    CLI引数にも、確認した定義では dedupe_key を指定する入力がありません。つまり、既存ヘルパーを呼ぶだけでは、このIssueが要求するkeyベースの重複排除にはなりません。

    考慮すべき反例は明確です。

    入力・既存Issue 必要な挙動
    同じkey、タイトルだけ変更 同じ改善として再利用する
    異なるkey、たまたま同じタイトル タイトルだけで同一Issue扱いしない
    同じkeyのCLOSED Issueが存在 新規作成せず、既存の終了理由に応じて扱う
    検索結果が上限に到達 未取得分を「重複なし」と扱わない

    GitHub CLIも、gh issue list の既定はOPENのみ・最大30件です。--state all と取得範囲を明示する必要があります。これはセキュリティ強化ではなく、単純な検索漏れ防止です。(GitHub CLI)

    また、follow-up-materialization.md はkeyによる重複排除を規定していますが、refinement承認後のStep 4.5という出口側の契約です。retrospective候補を最初のIssueへ変換する入口として、そのまま呼べると決めつけるべきではありません。#2602の既存終了コメントも、この再利用先の選択を未解決事項として残しています。

    推奨修正

    新しい起票器は作らず、既存writerにkeyベースの経路を最小追加する方針を推奨します。

    既存のタイトルベース呼び出しの互換性を保ちつつ、今回の候補では明示されたkeyを使い、作成前検索と作成後確認で同じ識別規則を使う設計です。外側でkey確認をした後、内側でタイトルだけを理由に別Issueへ寄せる二重判定は避けます。

    そのためには、現状のAllowed Pathsに含まれていない create_issue_txn.py と対応する既存テストの限定的変更を、必要に応じて明記する必要があります。ここを未確定のままにすると、実装者が正しく直そうとした時点でAllowed Paths停止になります。


    P1-2:「retrospective candidate」が、実際には複数の異なる入力形式を指している

    該当箇所:Parent Goal Ref、In Scope、AC1・AC2・AC6

    親#1939が参照しているChatGPT側の既存形式は、chatgpt_retrospective_result/v1 です。その follow_up_issue_candidates[] が要求するフィールドは、現在次の4つです。

    title / body / blocked_by / public_safe
    

    一方、project版 agent-retrospective が扱うのは agent_improvement_candidate/v1 で、candidate_id、candidate_status、source_run_ref、任意の finding_contract などを持ちます。両者は同じ入力ではありません。

    特に重要なのは識別子です。agent_improvement_candidate/v1 は、候補のライフサイクルIDと、複数runをまたいで同じ問題を識別する finding_contract.identity を意図的に分離しています。後者には、runごとに変わるSHA・日時・evidence fingerprint等を入れない契約があります。

    現状の#2602では、次が決まっていません。

    • どのproducerが、どの形式の候補を渡すのか。
    • candidateから既存の起票入力へ、どこで変換するのか。
    • dedupe_key の導出元は何か。
    • finding_contract を持たない候補やChatGPT側候補をどう扱うのか。

    run IDや生成日時をkeyに使うと、同じ問題を翌日再発見しただけで別Issueになり得ます。逆にタイトルだけを使うと、別問題を誤って統合します。

    推奨修正

    新しい巨大な共通スキーマを作るのではなく、入力元ごとの小さな変換処理を、既存の起票入力へ集約する構成にしてください。

    このIssueでは、少なくとも「対応する入力形式」「本番の呼び出し元」「候補→起票入力の対応表」を確定させるべきです。finding_contract.identity がある入力では既存の検証済みidentityを再利用し、ない形式では継続時に同じkeyを再利用できる規則を明記します。両スキーマは未知フィールドを拒否するため、候補へ勝手にdedupe_key等を追加して互換性を装う方法は避けるべきです。


    P1-3:ready→implementationの起動所有者を、新しいhandoff層が重複して持つ恐れがある

    該当箇所:Desired Outcomeのフロー、AC3・AC4、Scenario D

    現行 issue-refinement-loop は、implementation Issueの承認終了時に、root/main threadから run_root_transition() を実行する契約です。そこで最新Issue取得、current-runのcontract review、直後の再取得、routing、実装起動への引き渡しを扱います。

    LOOP_HANDOFF_RESULT_V1 の終了コメントは監査用であり、実装起動の許可情報ではありません。root_entry_router.py 自体も、保存済みのrouteやreview結果を入力として受け取らないことを明記しています。

    このため、#2602の図を新しい層が独立に実行すると、次の二つの失敗が考えられます。

    二重起動: refinement側のrootが既に実装へ進めた後、retrospective側も「readyを受け取った」と判断して再起動する。

    起動したつもり: next_action = impl-review-loop を出力しただけなのに、実装handoff完了として報告する。特にrouterのCLIを起動しただけでは、親の対話セッションのtool呼び出しまで自動実行できるわけではありません。

    推奨修正

    実装起動の所有者は既存のroot transitionに一本化してください。

    新しい層は候補の正規化とIssue作成/再利用までを担当し、その後はrootの既存refinement手順へ渡します。ready判定や実装起動を横から再実装せず、結果には「次に行うこと」と「実際に起動したこと」を区別して残します。

    承認の意味も、この境界で明確にすべきです。AC1は「materializationの許可」を扱う一方、期待フローは実装まで進みます。「起票だけ」と「この候補をPRまで進める」を区別し、後者では一度の明示依頼で既存ループへ継続できる運用が適切です。各段階で承認を取り直す必要はありません。

    なお、現行retrospectiveの human_authorization_receipt/v1 は、operation: publish_retrospective_run、つまり実行結果のコメント公開用です。これを候補起票・実装の許可へ流用するのも、反対にこの10分TTLの仕組みをhandoff全体へ持ち込むのも避けるべきです。


    P1-4:AC8の検証条件が、実用的なテスト設計を妨げている

    該当箇所:Runtime Verification Applicability、AC8、Verification Commands

    現在の要求には、次の組合せがあります。

    unique candidate → Issue materialized の成功を確認
    実行環境はGitHub API read-only
    fixture/synthetic-only PASSは代替不可
    既存ループ全体は再実行しない
    対象Skill script不在時はSKIP可能
    

    実際のGitHub Issue作成まで証明するなら、read-onlyでは足りません。境界の決定と接続を証明するなら、外部I/Oを置き換えたテストが合理的です。 現状は、そのどちらを必須証拠とするかが曖昧です。

    また、「対象scriptがないからSKIP」は、実装後の受け入れ条件としては危険です。実装前のファイル不在をexpected_baseline_failとすること自体は問題ありませんが、実装後も同じ理由で必須検証を抜けてはいけません。pytestのexit 4は利用方法のエラー、exit 5はテスト未収集であり、機能の成功を意味しません。([pytest ]2)

    関連PR #2626でも、production側の判定関数をテスト内に再実装せず、実際のproduction関数を共有する修正が入っています。今回も重要なのは「mockを一切使わないこと」ではなく、mockがテスト対象の判断ロジックそのものを置き換えていないことです。

    推奨修正

    必須検証を、本番adapter/既存判定関数+外部I/Oだけのfakeにします。pytestには関数や環境を差し替え、テスト終了後に復元する仕組みがあります。認証・ネットワーク・モデル呼び出しに依存せず、起票回数、引き渡す引数、次段起動回数、返却状態を検証できます。([pytest ]3)

    CLI起動手順そのものを変更する場合だけ、その変更箇所の実プロセスsmokeを追加する方針で十分です。毎回Claude CodeとGitHub書き込みを必要とする全体テストへ広げる必要はありません。

    さらにAC3・AC6・AC9を丸ごとhuman_judgmentへ寄せず、少なくとも以下は機械検証してください。

    refinementへの必須routing、source→Issueの参照保持、dependency不足フラグの保持。 意味上の妥当性はレビューで確認するとしても、これらのフィールド伝播まで人間確認だけにする理由はありません。


    P2-1:正常終了・再実行・部分成功の扱いが不足している

    該当箇所:Outcome、AC5・AC7・AC8、Scenario B・E

    現在のOutcomeはDraft PR readyへ寄っていますが、既存実装にはそれ以外の正当な終了があります。

    follow-up-materialization.md は、OPEN再利用と、CLOSEDのcompleted/not_planned等によるスキップを区別しています。また、#2607を実装したPR #2626はマージ済みで、現在のimpl loopには already_satisfied/no_change_required が存在します。既に要件が満たされていれば、不要なPRを作らない経路です。

    したがって、次を区別する必要があります。

    状況 handoff層の期待動作
    OPENの同一候補 既存Issueへ接続する
    CLOSEDの同一候補 既存の終了理由を保持し、無条件にreopen・実装しない
    already_satisfied 変更不要として終了し、PRを要求しない
    Issue作成後、後続処理が失敗 作成済みIssue参照を失わず、再作成しない
    既存loopが正式な停止結果を返す 理由を保持し、別経路で実装しない

    特に、**「Issue作成成功→応答や後段処理が失敗→同じ依頼を再実行」**をテストに入れるべきです。趣味開発でも遭遇しやすく、重複Issueや作業のやり直しに直結するケースです。

    ここに新しい永続台帳や分散ロックは不要です。まず逐次再実行時に、既存Issueと既存ヘルパーのreadback/reconcile経路で収束させる範囲へ絞るのが適切です。現行ヘルパーには、既存Issueを対象とするreconcile入口や、作成後の確認処理があります。

    また、AC7の「blockedを伝播」は、既存loopが最終的に返すrouting結果を対象とすべきです。現行impl loopでは、補助artifactの警告やworkerのhuman_review_required: trueだけでは直ちに停止しない方針があるため、handoff側がそれらを勝手にhard stopへ昇格させてはいけません。


    P2-2:WS1/WS3の依存が「何を止めるのか」を揃える必要がある

    該当箇所:Dependencies、Remaining Parent Gaps、終了コメント

    本文は「WS1/WS3の必要契約が成立するまで、implementation/closureでparent integrationを主張しない」としています。一方、9月10日の終了コメントは、以前のoperator指示に従い、WS1/WS3がmaterializeされるまで実装自体を開始しないとしています。

    この停止には明示指示があるので、過去のエージェントが勝手に過剰停止したとは評価しません。ただし、今後の実行では次の区別が必要です。

    repo-localな候補→Issueの接続を実装するための依存と、日次workset/ChatGPT discoveryを含む親全体の完成を宣言するための依存です。

    推奨修正

    個人開発の有用性を優先するなら、前者が既存入力だけで成立する部分は先に実装できる形へ、正式に契約を整理するのを推奨します。daily integrationが未完であることは結果へ残し、親の完了は宣言しません。既存の停止指示を読み替えて黙って進めるのではなく、依存が止める対象を本文とコメントで一致させます。

    また、親#1939の本文では、#2602が存在するにもかかわらずWS4がまだ「未起票」と記載されています。親本文だけから子の有無を判断すると、将来の重複起票や誤った不足判定につながります。これは新しい同期基盤を作らず、既存の親子登録・本文更新手順で修正する事項です。


    P2-3:project版とportable plugin版の適用範囲を明記すべき

    該当箇所:AC10、Allowed Paths、agent-retrospectiveの説明

    現在は同名でも、実装・実行条件が異なります。

    project版はrepository内の既存資産を利用します。一方、plugins/agent-retrospective/skills/run/SKILL.md は、.claude/を持たない任意repositoryでも利用するportable版で、project版のAGY adapter等へ依存しない独立実装です。

    Claude Codeの公式仕様でも、project skillとplugin skillは配置・名前空間が異なります。pluginの導入だけで、対象repositoryに /issue-refinement-loop や /impl-review-loop が存在するとは限りません。(Claude)

    推奨修正

    v1はrepo-localのhandoffを対象とし、portable pluginへのmirrorやloop一式の配布は範囲外と明記するのが適切です。

    plugin単体利用で候補を生成する機能まで、repo-local loopの不在で失敗させるべきではありません。候補生成と、loop-protocolへの実装引き渡しは別の能力として説明します。

    これは機能追加を要求する指摘ではなく、今回のIssueが配布物全体の改修へ膨らむのを防ぐための境界整理です。


    推奨する最小構成

    新たな実装・レビューループを作る必要はありません。今回追加・修正する責務は、次の範囲に絞れます。

    人間が候補と実行範囲を選択
            ↓
    入力元別の薄い候補変換
            ↓
    既存起票入力 + 安定したdedupe key
            ↓
    既存issue-creator / create_issue_txn
            ├─ CLOSED重複 → 既存dispositionで終了
            └─ 作成/OPEN再利用
                      ↓
           rootのissue-refinement-loop
                      ↓
           既存run_root_transition
                      ↓
           既存impl-review-loop
                      ↓
       draft_pr_ready / no_change_required / 正式な停止結果
    

    retrospectiveのobserver/evaluatorに起票や実装ループを持たせないことも明示してください。現行retrospectiveは、rootが単一CLIを起動し、その中でobserver/evaluatorを実行してproposalを返す構成です。候補採用後の作業は、そのleaf agentの中ではなくroot側へ戻すのが整合的です。

    focused testは「6件あること」より、以下の境界を固定する

    テスト群 必須の確認
    未承認 Issue作成・実装起動がともに0回
    承認済みの新規候補 Issue作成1回、正しいIssue参照でrefinementへ接続
    keyとタイトルの関係 同key・別タイトル/別key・同タイトルを取り違えない
    CLOSED重複 終了理由を保持し、再作成・無条件実装をしない
    部分成功後の再実行 作成済みIssueを再利用し、重複を増やさない
    rootへの引き渡し 実装起動が二重にならず、古い終了コメントだけでは起動しない
    既存loopの終端 正式な停止とalready_satisfiedをそのまま扱う
    参照・依存の伝播 source/Issue参照、WS1/WS3不足の記録が失われない

    これらはparameterizeすればよく、大規模な新規ハーネスにする必要はありません。

    最終提案

    #2602は廃棄・全面再設計ではなく、実装契約の修正が適切です。

    まず、入力形式と本番呼び出し元を確定し、keyベースの起票経路に必要な最小Allowed Pathsを追加します。次に、実装起動を既存root transitionへ一本化し、Runtime Verificationを「本番ロジックを実行し、外部I/Oだけを置き換える検証」へ整理します。そのうえで、変更不要・CLOSED重複・部分成功を正常に扱えるようにします。

    追加の承認台帳、汎用permission broker、全workflowを覆う新しいscanner、毎回のlive GitHub書き込みテストは推奨しません。

    このIssueの品質は、制約の数ではなく、「採用した候補が重複せず、不要な承認や再起動なしに既存ループへ入り、途中失敗しても同じIssueから続けられるか」で評価すべきです。

  3. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    推奨は、#5741086345 を今回の authoritative human-context anchor として #2602 を再 refinementすることです。9/10 の終了コメントは当時の判断として保持しつつ、競合する箇所では新しい OWNER コメントを優先させます。特に、旧コメントで未決だった dedupe 実装選択と、WS1/WS3 が止める範囲を今回確定させるべきです。

    現在の main はレビュー基準の 5b2c181... より後の b1668db... まで進んでいます。後者は Claude-GPT の background task 制限を撤去して issue-refinement-loop の completion join を可能にする変更なので、古い SHA に固定せず current main で fresh readbackするのが適切です。また、PR #2626 の already_satisfied terminal route も現行契約として #2602 に反映対象です。親 #1939 は現在も WS4 を「未起票」としているため、#2602 への登録同期も同じ refinement で処理するのがよいです。

    そのまま既存の auto mode Claude Code に貼れる形です。

    対象:

    issue-refinement-loop を canonical procedure に従って実行し、Issue #2602 の契約を refinement してください。

    このセッションは既に auto mode で起動済みです。今回の refinement に必要な Issue body/comment 更新について、人間への追加承認確認は不要です。可能な限り自律的に調査・修正・再レビューを繰り返し、fresh な refinement APPROVE / ready 状態まで進めてください。

    Authority / anchor handling

    今回、次の OWNER comment を operator-selected direct human context の authoritative anchor として扱ってください。

    #2602 (comment)

    anchor comment は preflight.run.with_human_context 相当の canonical human-context lane で処理してください。agent-report lane や unlabeled anchor lane に落とさないでください。

    この prompt 自体も、上記 OWNER review の指摘を #2602 の契約へ反映することへの明示的な operator authorization です。

    2026-09-10 の旧終了コメント
    #2602 (comment)
    は履歴/evidence として参照して構いませんが、今回の anchor と競合する旧判断を current authority として維持しないでください。

    特に以下は新しい anchor に従って再評価してください。

    Freshness

    anchor review は main SHA 5b2c181b09b22e071a77e60b7977b79f1bb1e2eb を基準にしていますが、実行時は必ず current main を取得して fresh readback してください。

    古い SHA を execution authority に固定しないでください。

    Issue #2602、全コメント、parent #1939、関連 PR/Issue、現在の repository assets を current main と突き合わせ、anchor 後の変更で前提が変わっていないか確認してください。

    SubAgent execution — mandatory

    main/root orchestrator が SubAgent を起動してください。

    少なくとも canonical Step 1 の codebase-investigator を fresh に起動し、今回の review finding に必要な repository evidence を再調査してください。

    必要なら canonical policy の範囲で Step 1b の web-researcher 等の sibling SubAgent を使用して構いません。ただし nested SubAgent delegation は行わず、root/main が所有してください。

    起動した全 SubAgent の完了を必ず待ってください。

    completion join barrier を厳守し、SubAgent が未完了のまま Step 2、body mutation、最終判定へ進まないでください。

    Step 1 と Step 1b を並列化する場合も、両方の結果を join してから Step 2 へ進んでください。

    Step 2.5 の semantic design review が適用される場合は issue-design-reviewer を fresh sibling SubAgent として起動し、完了結果を join してから判定してください。

    background execution を利用しても構いませんが、「起動した」ことを「完了した」こととして扱わないでください。

    Investigation targets

    current repository facts から、少なくとも次を独立に確認してください。

    1. Issue creation / materialization

      • create_issue_txn.py 等の production writer
      • title-based dedupe の現在の挙動
      • OPEN/CLOSED issue lookup
      • pagination / result limit
      • reconcile / post-create readback
      • existing follow-up materialization contract
    2. Candidate producers / schemas

      • chatgpt_retrospective_result/v1
      • follow_up_issue_candidates[]
      • project版 agent-retrospective
      • agent_improvement_candidate/v1
      • candidate_id
      • finding_contract.identity
      • source/public-safe references
      • 実際の production caller
    3. Refinement → implementation ownership

    4. Parent/dependency state

    5. Distribution boundary

      • project-local retrospective
      • portable plugin retrospective
      • repo-local issue-refinement-loop / impl-review-loop の availability boundary

    Required contract corrections

    anchor comment の P1-1〜P1-4 を blocking design findings として解消してください。
    P2-1〜P2-3 も current evidence と矛盾しない限り同じ refinement で整理してください。

    期待する方向は以下です。

    A. key-based dedupe を具体化する

    「既存 dedupe/materialization contract を再利用する」という抽象記述だけで終わらせないでください。

    current implementation evidence を踏まえて、既存 writer に対する最小の key-aware path を設計契約として確定してください。

    少なくとも次を区別できること:

    • same dedupe key / different title
    • different dedupe key / same title
    • same key / OPEN issue
    • same key / CLOSED issue
    • search pagination / result truncation
    • create 後の partial failure と再実行

    外側で key 判定した後、内側の title-only dedupe が別 Issue へ誤って寄せる二重判定を許容しない契約にしてください。

    current repository evidence 上必要なら、#2602 の Allowed Paths に既存 create_issue_txn.py とその既存 focused tests の限定変更を明示的に追加してください。

    新しい独立 Issue creator は作らない設計にしてください。

    B. candidate input contract を確定する

    「retrospective candidate」を単一の未定義形式として扱わないでください。

    少なくとも:

    • chatgpt_retrospective_result/v1
    • agent_improvement_candidate/v1

    の producer、production caller、candidate → issue-materialization input の変換責務を明示してください。

    巨大な共通 schema は新設しないでください。

    入力元別の薄い adapter / normalization を既存 materialization input に集約する設計を優先してください。

    finding_contract.identity が存在する入力では、その stable identity を dedupe identity に利用する方向を検討してください。

    run SHA、生成日時、evidence fingerprint のような run-specific 値を stable dedupe identity にしないでください。

    未知 field を拒否する既存 schema に勝手に dedupe_key を追加して互換性を装わないでください。

    C. implementation launch owner を一本化する

    ready → implementation launch の owner は既存 issue-refinement-loop root transition に一本化してください。

    新しい handoff layer は:

    candidate normalization
    → Issue create/reuse
    → canonical issue-refinement-loop root

    までを担当し、ready 判定や impl-review-loop 起動を横から複製しない契約にしてください。

    LOOP_HANDOFF_RESULT_V1 や保存済み comment を implementation authorization token として扱わないでください。

    結果 schema / prose では少なくとも:

    • recommended next action
    • actually launched transition

    を混同しないようにしてください。

    なお、将来この handoff feature を実行するときの authorization semantics として、「materialize only」と「candidate を canonical loop 経由で PR-ready まで進める」を区別し、後者が明示された場合に各段階で不要な再承認を要求しない形を検討してください。

    ただし 今回の作業は refinement-only です。
    この run では impl-review-loop を実際に開始しないでください。

    D. AC8 / verification を実用的にする

    必須 verification は production adapter / production decision function を実際に通し、GitHub/network/model 等の external I/O だけを fake / monkeypatch する focused test を基本にしてください。

    テストコード側で production decision logic 自体を再実装しないでください。

    実 GitHub Issue write を毎回要求しないでください。

    CLI/process boundary 自体を変更する場合だけ、その変更箇所に必要な real subprocess smoke を追加してください。

    実装後に「対象 test/script が存在しない」を成功扱いする SKIP を許容しないよう契約を明確にしてください。

    少なくとも機械検証対象として:

    • canonical refinement routing
    • source candidate → materialized Issue reference preservation
    • dependency-gap flag propagation
    • issue create count
    • implementation launch count / no double-launch
    • partial success retry

    を検討してください。

    E. valid terminal / retry semantics を追加する

    Outcome を Draft PR ready だけに固定しないでください。

    既存 canonical loop の正当な terminal semantics を保持してください。

    少なくとも:

    • OPEN duplicate → existing Issue reuse
    • CLOSED duplicate → close reason/disposition を保持
    • already_satisfied
    • no_change_required
    • canonical blocked/stop
    • Issue creation succeeded but later stage failed
    • retry / reconcile without duplicate creation

    を扱ってください。

    補助 warning や worker-local human_review_required を handoff layer が独自に hard stop へ昇格しないでください。

    canonical loop が最終的に返す routing/termination result を尊重してください。

    F. WS1 / WS3 dependency semantics を整理する

    旧 9/10 comment の
    「WS1 / WS3 materialize まで implementation を開始しない」
    という operator-specific stop を、今回の OWNER review に照らして再整理してください。

    current evidence で repo-local candidate → Issue → canonical loop 接続を独立に実装可能なら、WS1 / WS3 未完了は:

    を示す dependency とし、repo-local handoff implementation 全体を不必要に止めない契約を検討してください。

    ただし WS1 / WS3 自体を #2602 に実装として取り込まないでください。

    Issue body、Dependencies、Remaining Parent Gaps、AC、Stop Conditions、旧 termination semantics の間で矛盾が残らないようにしてください。

    G. parent #1939 の stale WS4 registration を同期する

    current #1939 が #2602 の存在にもかかわらず Workstream 4 を「未起票」としている場合、canonical parent/child bookkeeping procedure に従い、#2602 を WS4 child として同期してください。

    これは新規 child scope の追加ではなく、既存 child の stale metadata 修正として扱ってください。

    この同期のために追加の人間承認を要求しないでください。

    新規 WS1 / WS3 Issue は今回作成しないでください。

    H. project / portable plugin boundary

    v1 の #2602 handoff は repo-local contract として明示してください。

    portable plugin 版へ:

    • repo-local loop一式を mirror する
    • .claude/ 不在 repository に loop-protocol の implementation flow を強制する

    ことは今回の scope に含めないでください。

    portable plugin 単体で candidate generation ができる能力と、loop-protocol repository 内で canonical implementation loop に handoff する能力を分離してください。

    Tests / acceptance scenario refinement

    現行の「6ケース」という件数維持を目的化しないでください。

    parameterized focused tests 等で、少なくとも以下の境界が固定されるよう AC/VC を再設計してください。

    • unauthorized → Issue create 0 / implementation launch 0
    • authorized unique candidate → Issue create 1 / exact created Issue ref で refinement
    • same-key/different-title と different-key/same-title
    • CLOSED duplicate disposition
    • Issue create 後の downstream failure → rerun reuses same Issue
    • canonical root ownership → implementation double-launch 0
    • canonical terminal (already_satisfied, blocked, etc.) propagation
    • source/dependency reference preservation

    大規模な新規 harness、ledger、permission broker、scanner は作らない契約にしてください。

    Scope / product-development priority

    個人趣味開発であり、品質・有用性・workflow continuity を優先します。

    今回の finding 解消のために、次のような重量級 mechanism を追加しないでください。

    • 新しい generic authorization ledger
    • 新しい permission broker
    • 全 workflow を覆う scanner
    • 毎回 live GitHub write を要求する E2E
    • retrospective 独自の implementation/review state machine
    • duplicated issue-refinement-loop / impl-review-loop

    既存 production path の再利用と、小さな adapter / extension を優先してください。

    Autonomous refinement loop

    一回 body を編集して終了せず、canonical refinement loop を完走してください。

    body update
    → fresh readback
    → deterministic review
    → semantic design review
    → finding 修正
    → fresh re-review

    を必要な回数だけ自律的に繰り返してください。

    needs-fix / REQUEST_CHANGES が出た場合、今回の anchor と repository evidence から解決可能なものは自動修正してください。

    「owner choice が必要」という旧 artifact が存在しても、今回の OWNER anchor がその choice を具体化している場合は、古い requires_owner_choice を理由に人間へ再質問しないでください。

    preflight / review が operator-intervention route を返した場合も、今回の human-context anchor が既に明示している事項については canonical contract-update/review route で処理し、同じ質問を人間へ返さないでください。

    本当に anchor の authority 外となる新しい scope、破壊的操作、secret access、解決不能な repository contradiction、必要権限の欠如などが発生した場合だけ stop してください。その場合も可能なところまで refinement を完了し、具体的な blocker と evidence を残してください。

    Completion condition

    今回の成功条件は:

    1. 実装: #1939 Workstream 4 — retrospective candidate を issue-refinement-loop → impl-review-loop へ controlled handoffする #2602 body が current repository facts と anchor comment の P1/P2 finding を反映している
    2. Allowed Paths / AC / VC / Dependencies / Stop Conditions が相互に矛盾しない
    3. 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 の WS4 child metadata が必要なら同期されている
    4. fresh preflight / contract review が current body に対して通っている
    5. required SubAgent / semantic reviewers の完了を全て join 済み
    6. unresolved HIGH/MEDIUM design finding が残っていない、または repository contract 上明確に non-blocking と証明されている
    7. final Issue body を再取得し、実際に保存された内容を readback 検証している

    最終コメントには、今回の authoritative anchor、変更した主要契約、SubAgent completion、fresh review result、remaining dependency、実装に進む場合の next action を public-safe にまとめてください。

    この run では implementation branch / worktree / PR を作らず、impl-review-loop は開始しないでください。
    refinement 完了後、「#2602 が別途 impl-review-loop を開始できる状態か」を最終結果として明示して終了してください。

    この形なら、旧 dependency stop を無視して勝手に実装へ進ませるのではなく、まずその停止条件自体を正式な Issue 契約として修正してから ready 判定を取り直すため、後続の impl-review-loop が同じ owner 判断で再停止する可能性をかなり減らせます。

  4. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: 完了(2026-09-19)

    authoritative anchor: https://github.com/squne121/loop-protocol/issues/2602#issuecomment-5741086345(OWNER、`preflight.run.with_human_context` lane で処理)。2026-09-10 の旧終了コメントは履歴として保持しつつ、今回の anchor が優先。

    Freshness

    current main を fresh 取得し b1668db5133c6f151bcc8c2ec67bd589f74f7f34(review 実行時点の true HEAD、直後に #2668 が1件マージされ 2d0bf62e へ進行。対象3ファイルへの影響なしを確認済み)を基準に再検証した。

    実施内容(SubAgent completion: 全て join 済み)

    1. codebase-investigator(fresh, 1回): Issue creation/materialization、candidate producer schema、refinement→implementation ownership、parent 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 状態、distribution boundary を独立調査。
    2. issue-editor(3回、sibling、非nested): Issue 実装: #1939 Workstream 4 — retrospective candidate を issue-refinement-loop → impl-review-loop へ controlled handoffする #2602 本文を全面書き換え(新設 ## Candidate Input Contract セクション追加、AC2/AC4/AC5/AC8 書き換え、AC11 新設、Allowed Paths 拡張、Verification Scenarios 拡張)。
    3. issue-design-reviewer(fresh, 3回、sibling): semantic design review。1回目で7件(A〜G)検出 → 2回目で6件解消・1件残存(H: dedupe_key 検索実装の過大な不存在主張)→ 3回目で全件(A〜H)解消を確認。
    4. issue-editor(1回): parent 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 の stale WS4 registration を #2602 へ同期(既存 child の metadata 修正、新規 scope 追加ではない)。

    反映した主要契約変更

    • A: key-based dedupe を具体化。既存の caller 側 dedupe_key 検索 convention(plan_child_materialization.py::_search_dedupe_candidates() の gh issue list --state all --search パターン、docs/dev/agent-skill-boundaries.md L536-550 の FOLLOW_UP_ISSUE_REQUEST_V1 dedupe フロー)を再利用する設計に確定。create_issue_txn.py への変更は、outer が「create 確定」と判定した場合に内部 title-only dedupe を bypass する opt-in フラグの追加のみに限定(新しい独立 Issue creator は作らない)。
    • B: candidate input を chatgpt_retrospective_result/v1(follow_up_issue_candidates[]、identity なし)と agent_improvement_candidate/v1(finding_contract.identity あり)の実在する2 producer に明確化し、producer 別 dedupe key 導出規則を新設 ## Candidate Input Contract に固定(巨大な共通 schema は新設しない)。
    • C: 実装起動を run_root_transition()(root_entry_router.py)へ一本化し、二重起動 0 件を AC4/Design Constraints に明記。
    • D: AC8 を6ケース固定から、境界(same-key/different-title、CLOSED disposition、downstream failure retry、double-launch guard、terminal propagation、source reference 保持等)を固定する parameterized test 要求へ再設計。
    • E: ## Outcome/AC5 に already_satisfied(PR 実装: impl-review-loop に already_satisfied terminal route を追加する #2607 由来)等の正当な terminal semantics を追加。
    • F: ## Dependencies に「WS1/WS3 未成立は parent 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 全体の integration-complete を主張できないことのみを意味し、repo-local な実装着手自体は妨げない」という明文を追加(2026-09-10 の旧拡大解釈を今回の anchor により supersede)。
    • G: parent 導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 の ## Child Issues の Workstream 4 行を「未起票」から #2602 へ同期済み(導入: repo URL起点の日次retrospective worksetとagent completion artifact投稿を確立する #1939 側で別途完了)。
    • H: dedupe_key 検索が「実装されていない」という過大な主張を修正し、既存 production 経路を正確に引用。

    fresh review result

    • Step 2 deterministic review: run_root_review_pipeline.py produce で APPROVE(canonical_step2_route: step_2_5)。body_sha256: sha256:bafd489dc9ff2a3e57f2b3880dc84374e54c0a397a9136ea45e162db8f9162c7。
    • 途中1回 step_5_operator_intervention_required(regression gate の一時的な失敗)を検出したが、baseline_vc_preflight.py を直接再実行し全 VC が go であることを確認、直後の再 review で APPROVE に復帰(transient failure、body 起因ではない)。
    • Step 2.5 semantic design review: 3周実施し、全 finding(A〜H)解消を確認(残る LOW nitpick 1件は non-blocking と明示: agent-skill-boundaries.md の行番号引用がわずかに広め)。

    remaining dependency

    Parent #1939 の Workstream 1(daily workset contract/result schema)・Workstream 3(repository-level ChatGPT discovery entrypoint)は現在も未起票。今回の anchor に基づき、この未成立は「parent #1939 全体の integration-complete を主張できないこと」のみを意味し、本 Issue(WS4)の repo-local な実装着手自体を妨げない契約として ## Dependencies に明記済み。GitHub native blockedBy は未設定(closedByPullRequestsReferences: 0、hard block なし)。

    実装に進む場合の next action

    #2602 は fresh preflight / fresh deterministic review / fresh semantic design review をすべて通過し、/impl-review-loop 2602 を別途開始できる状態である。本 run は refinement-only の明示指示(operator authorization)に従い、impl-review-loop の起動・branch/worktree/PR 作成は行っていない。次のアクションとして、人間または別セッションが /impl-review-loop 2602 を実行することで実装フェーズへ進める。

  5. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    調査結果では、#2602 はすでに refinement 済みで、実装フェーズへ進める状態です。2026-09-19 の最新 refinement 完了コメント #5741383160 で /impl-review-loop 2602 開始可能と明記されています。現在確認できる main の先頭は 2d0bf62e で、Closes #2602 の既存PRは見つかっていません。

    推奨は、古い WS1/WS3 dependency stop を再適用せず、fresh な root-owned synchronous entry transition → implementation-worker → test-runner → pr-reviewer → fix_delta 反復で進めることです。過去の refinement 完了コメント自体を authorization token として使わず、run_root_transition() が行う current-run contract review と live Issue readback を入口にするのが現行契約に合っています。

    また実装は、新しい orchestration/state machine を作るのではなく、既存の FOLLOW_UP_ISSUE_REQUEST_V1、caller-side dedupe、create_issue_txn.py、issue-refinement-loop、impl-review-loop を薄く接続する方向が妥当です。特に create_issue_txn.py は outer dedupe が create を確定した場合だけ title-only dedupe を bypass する opt-in 拡張に限定するのが #2602 の契約です。

    そのまま ClaudeCode に投入するプロンプトです。

    Issue #2602 を対象に、repository の canonical skill .claude/skills/impl-review-loop を使って、実装・検証・PRレビュー・修正ループを 人間の途中承認なしで、マージ直前の状態まで自律実行してください。

    Target:

    • Repository: squne121/loop-protocol
    • Issue: https://github.com/squne121/loop-protocol/issues/2602
    • Skill: .claude/skills/impl-review-loop/SKILL.md
    • refinement 完了参照:
      https://github.com/squne121/loop-protocol/issues/2602#issuecomment-5741383160

    すでに auto mode で起動している対話的 ClaudeCode セッションです。
    通常の確認質問や途中承認は不要です。
    ただし repository contract 上の genuine hard stop / human escalation 条件は迂回しないでください。

    Goal

    Issue #2602 の live contract を実装し、

    1. canonical root entry
    2. implementation-worker
    3. independent test-runner
    4. independent pr-reviewer
    5. REQUEST_CHANGES があれば fix_delta を使った再実装
    6. current-head 再検証・再レビュー

    を必要なだけ反復し、最終的に以下のいずれかへ到達してください。

    優先する正常終了:

    canonical loop が正当に返す場合のみ、以下も terminal として受理してください。

    • already_satisfied
    • status: no_change_required
    • canonical blocked
    • canonical human_escalation
    • max_iterations

    worker や advisory artifact が単に human_review_required: true と自己申告しただけでは、現行 impl-review-loop 契約に従い独自に hard stop へ昇格させないでください。


    0. 最初に current state を fresh に確定する

    過去コメントや保存済み artifact を implementation authorization として扱わないでください。

    特に refinement 完了コメント #5741383160 は「過去に ready だった」という context/evidence としてのみ扱い、Step 1 起動の authority にしないでください。

    current main / live Issue / repository identity を fresh に確認し、現行 .claude/skills/impl-review-loop/SKILL.md、steps/preparation.md、その他同 Skill が要求する参照ファイルを読んでください。

    現時点の調査では main の最新確認 SHA は:

    2d0bf62e4e69dad3ae9cb2c6822b45f7c5b4f1b0

    ですが、これを固定値として信用せず、実行時点の live main を再取得してください。

    Issue #2602 に対する既存 branch / worktree / PR が存在するかも fresh に確認してください。

    • canonical な既存 worktree/PR があれば、それを安全に継続する。
    • 存在しない場合だけ新規作成する。
    • 1 Issue = 1 branch/worktree = 1 PR を維持する。
    • duplicate PR を作らない。

    1. canonical Root-Owned Synchronous Entry Transition を使う

    Step 1 を直接勝手に起動しないでください。

    .claude/skills/issue-refinement-loop/scripts/root_entry_router.py::run_root_transition() が定める current canonical root-owned synchronous entry contract に従ってください。

    同一 continuous turn / control flow で少なくとも以下を成立させます。

    1. capability preflight
    2. live Issue fetch
    3. current-run の fresh issue-contract-review
    4. live Issue / base の再取得
    5. body/base drift の評価
    6. canonical routing
    7. route が invoke_impl_review_loop 相当になった場合だけ直ちに Step 1 へ進む

    過去の status: go、LOOP_HANDOFF_RESULT_V1、snapshot、comment、digest 等を replayable authorization token として使用しないでください。

    fresh review で body/base drift が検出された場合は current contract の rerun/review route に従い、stale artifact の存在だけを理由に停止しないでください。

    Issue #2602 の 2026-09-19 OWNER anchor により、Workstream 1 / Workstream 3 未成立は、

    という制約であり、

    という停止条件ではありません。

    2026-09-10 の旧 dependency-stop 解釈を復活させないでください。


    2. impl-review-loop を canonical 手順どおり実行する

    fresh root entry が implementation を許可したら、.claude/skills/impl-review-loop を最後まで実行してください。

    SubAgent は必須

    各主要 step を root 自身で代替せず、Skill が指定する SubAgent を使用してください。

    最低でも:

    • implementation-worker
    • test-runner
    • pr-reviewer

    を起動してください。

    重要: 起動した SubAgent は必ず完了まで待ち、結果を join してから次の routing 判断へ進んでください。

    fire-and-forget、結果未回収のまま次 step へ進むこと、SubAgent completion を推測することは禁止です。

    nested SubAgent delegation が必要になる設計にはしないでください。

    Step 1

    implementation-worker に actual live Issue #2602、actual Allowed Paths、必要な fix_delta を具体値で渡してください。

    worker は implement-issue skill を使わせます。

    placeholder や抽象変数ではなく actual value を渡してください。

    worker 完了後は必ず結果を join し、IMPLEMENT_RESULT_V1 と実際の git/worktree/PR state を照合してください。

    Step 2

    独立した test-runner SubAgent を起動し、implementation-worker 自身のテスト自己申告を検証結果の代用にしないでください。

    current PR head / current Issue contract に対して検証してください。

    完了まで待ち、結果を join してください。

    Step 4

    独立した pr-reviewer SubAgent を起動して current head をレビューしてください。

    レビュー完了まで待って join してください。

    reviewer の verdict と live PR mergeability/current head を control-plane 側で照合してください。

    Step 5

    現行 route_loop_verdict_v2() の semantics に従ってください。

    • APPROVE + clean live mergeability + blocker なし
      → draft_pr_ready
    • BEHIND
      → canonical update_branch route 後、再検証・再レビュー
    • stale reviewed head
      → current head で再レビュー
    • REQUEST_CHANGES
      → blocker を fix_delta として Step 1 へ戻す
    • already_satisfied 条件成立
      → canonical already_satisfied
    • actual Git conflict
      → canonical conflict escalation
    • genuine HUMAN_REVIEW_REQUIRED
      → canonical human escalation

    fix_delta iteration でも、

    implementation-worker → test-runner → pr-reviewer

    の独立性を維持し、各 SubAgent を毎回 completion まで待ってください。


    3. #2602 の実装設計で優先する方向

    実装前に current codebase を調査して最小差分を決めてください。
    Issue 本文の design constraints を authority とします。

    新しい generic orchestration subsystem を作るのではなく、既存資産を再利用してください。

    A. candidate producer は2系統の thin adapter にする

    対象 producer:

    1. chatgpt_retrospective_result/v1

      • follow_up_issue_candidates[]
      • identity field なし
      • target.repo + target.type + target.number + normalized title から deterministic dedupe identity を導出
    2. agent_improvement_candidate/v1

      • finding_contract.identity がある場合:
        その stable identity を dedupe identity の導出元にする
      • legacy で finding_contract がない場合:
        candidate_id を利用する

    両者を1つの巨大な新規共通 candidate schema に統合しないでください。

    既存 schema に勝手に dedupe_key field を追加しないでください。

    B. existing materialization contract を再利用する

    既存 FOLLOW_UP_ISSUE_REQUEST_V1 相当へ producer-specific thin adapter で正規化してください。

    新しい独立 Issue writer / materializer は作らないでください。

    C. dedupe は既存 caller-side convention を再利用する

    既存:

    .claude/skills/create-issue/scripts/plan_child_materialization.py::_search_dedupe_candidates()

    および

    docs/dev/agent-skill-boundaries.md

    にある gh issue list --state all --search <dedupe_key> 系の convention を再利用してください。

    最低限、以下を正しく区別します。

    • same key / different title
      → duplicate
    • different key / same title
      → duplicate ではない
    • same key / OPEN
      → existing Issue reuse
    • same key / CLOSED
      → reopen せず disposition/close state を保持して返す
    • result truncation/pagination
      → machine-readable に残す
    • create 後 downstream partial failure → rerun
      → key readback により同じ Issue を reuse
    • duplicate Issue create
      → 0

    D. create_issue_txn.py は最小 opt-in 拡張のみ

    .claude/skills/create-issue/scripts/create_issue_txn.py は既存の title-based OPEN-only dedupe behavior を維持してください。

    outer dedupe_key readback が「unique、create してよい」と確定した場合に限り、

    内部 title-only dedupe を bypass する opt-in flag

    を追加する方向を優先してください。

    既存 caller の backward compatibility を壊さないでください。

    E. implementation launch owner を増やさない

    handoff layer が impl-review-loop を直接横から起動する実装は禁止です。

    candidate normalization
    → Issue create/reuse
    → canonical issue-refinement-loop

    まで接続し、ready 後の implementation launch は既存 run_root_transition() に一元化してください。

    double launch = 0 をテストしてください。

    F. canonical terminal を加工しない

    handoff layer は downstream の:

    • already_satisfied
    • blocked
    • human_escalation
    • max_iterations
    • draft_pr_ready

    等を独自 vocabulary で上書きせず、その意味を保持して伝播してください。


    4. Scope boundary

    live Issue の ## Allowed Paths を正本として使ってください。

    現在の主な候補は:

    • .claude/skills/agent-retrospective/**

      • candidate/handoff boundary が本当にここにある場合のみ
    • .claude/skills/create-issue/scripts/create_issue_txn.py

    • .claude/skills/create-issue/tests/test_create_issue_txn.py

    • .claude/skills/create-issue/tests/test_create_issue_txn_blocking.py

    • .claude/skills/issue-refinement-loop/references/follow-up-materialization.md

    • .claude/skills/issue-refinement-loop/**

      • handoff interface/doc clarification の必要範囲のみ
    • .claude/skills/impl-review-loop/**

      • entrypoint/handoff contract clarification の必要範囲のみ
    • docs/dev/agent-skill-boundaries.md

    • related tests / schemas / fixtures

    ただし「候補」という記述なので、actual live Issue と current codebase を調査して最小化してください。

    以下は取り込まないでください。

    • Workstream 1 実装
    • Workstream 3 実装
    • portable plugin 版への repo-local loop 一式の mirror
    • 新しい generic authorization ledger
    • 新しい permission broker
    • retrospective 独自の implementation/review state machine
    • issue-refinement-loop / impl-review-loop の複製
    • unrelated refactor

    Allowed Paths 外が本当に必要なら、勝手に scope expansion せず canonical stop condition として扱ってください。


    5. 人間 authorization boundary を弱めない

    今回の operator 指示は Issue #2602 を実装する authorization です。

    これは将来の retrospective candidate を無断で Issue 化してよいという authorization ではありません。

    実装される production behavior では必ず、

    candidate proposed
    ≠
    human authorized materialization

    を維持してください。

    unauthorized candidate では:

    • Issue create = 0
    • implementation launch = 0

    にしてください。


    6. Focused tests

    Issue #2602 が指定する focused test を実装してください。

    新規:

    .claude/skills/issue-refinement-loop/tests/test_retrospective_candidate_handoff.py

    少なくとも以下の parameterized boundary を production decision logic 経由で固定してください。

    • unauthorized
    • authorized unique materialization
    • same key / different title
    • different key / same title
    • CLOSED duplicate disposition
    • downstream partial failure → rerun reuses existing Issue
    • double-launch guard
    • canonical terminal propagation
    • source/dependency reference preservation
    • producer-specific adapters
    • finding_contract.identity stable identity利用
    • run-specific SHA/timestamp/evidence fingerprint を dedupe identity にしない

    production decision logic をテスト側にコピーして fake implementation しないでください。

    fake/monkeypatch は GitHub/network/model 等の external I/O boundary に限定してください。

    実装後に focused test file 不在を SKIP 成功として扱わないでください。


    7. Verification Commands

    live Issue の Verification Commands を正本として実行してください。

    最低限:

    uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_retrospective_candidate_handoff.py -v
    
    uv run --locked pytest \
      .claude/skills/create-issue/tests/test_create_issue_txn.py \
      .claude/skills/create-issue/tests/test_create_issue_txn_blocking.py -v
    
    pnpm typecheck
    pnpm lint
    pnpm test
    pnpm build

    加えて、変更箇所に直接対応する focused regression tests があれば実行してください。

    Issue に明記されている既知の unrelated / environment-dependent failure を理由に、対象 focused verification を省略しないでください。

    runtime verification applicability は immediate です。
    Issue #2602 の current contract が runtime verification を要求している AC は、その契約どおりに検証してください。

    fixture/synthetic-only PASS で live/runtime requirement を代替してはいけない箇所では代替しないでください。


    8. Review 時に特に疑う点

    pr-reviewer には通常レビューに加え、以下を明示的に確認させてください。

    1. title-only dedupe と key-based dedupe の precedence が逆転していないか
    2. CLOSED duplicate を誤って reopen しないか
    3. same-title/different-key を誤 duplicate 扱いしないか
    4. create 成功後の partial failure retry で duplicate Issue を作らないか
    5. handoff layer が impl-review-loop を直接起動して double-launch を作っていないか
    6. producer schema を勝手に拡張していないか
    7. stable identity に timestamp/base SHA/run digest 等を混ぜていないか
    8. downstream terminal semantics を handoff layer が書き換えていないか
    9. raw transcript / prompt / tool I/O / credential / absolute local path が public artifact に漏れていないか
    10. WS1/WS3 未成立を repo-local implementation blocker と誤解していないか
    11. WS1/WS3 の実装をこの PR に取り込んでいないか
    12. docs と actual ownership boundary に矛盾がないか

    REQUEST_CHANGES が出た場合は、その blockers のみを fix_delta として修正し、scope creep しないでください。

    修正後は必ず current head で test-runner と pr-reviewer を再実行してください。


    9. Git / PR policy

    • destructive git operation 禁止
    • force push は repository contract で明示的に許可されない限り禁止
    • unrelated user change を revert しない
    • Issue 実装: #1939 Workstream 4 — retrospective candidate を issue-refinement-loop → impl-review-loop へ controlled handoffする #2602 用 canonical worktree 内で作業する
    • 既存 canonical PR があれば reuse
    • 新規なら Draft PR を canonical skill 経由で作る
    • PR 本文に Closes #2602 を含める
    • verification evidence を public-safe にまとめる
    • raw/private evidence は公開しない
    • required CI が current head に対して完了するまで確認する
    • stale head に対する APPROVE を merge readiness として扱わない
    • PR の merge は絶対に実行しない
    • auto-merge も設定しない

    10. 人間へ途中確認しない

    auto mode のため、以下については確認質問をせず autonomous に処理してください。

    • implementation detail の選択
    • Allowed Paths 内の最小修正
    • テスト追加
    • reviewer の REQUEST_CHANGES 修正
    • current branch update
    • stale-head re-review
    • ordinary CI failure の原因修正
    • documentation consistency 修正

    ただし canonical hard stop を迂回してはいけません。

    以下のような genuine contract boundary に達した場合だけ停止してください。

    • Allowed Paths 外の変更が不可避
    • Issue contract 自体の意味変更が必要
    • 新規 Issue への scope split が必要
    • nested SubAgent delegation が必要
    • external permission escalation が必要
    • secret access が必要
    • destructive git operation が必要
    • WS1/WS3 実装を取り込まないと成立しない
    • existing canonical Skill state machine を複製しないと成立しない
    • live human comment に明示的 stop/veto がある
    • actual Git conflict
    • canonical router が HUMAN_REVIEW_REQUIRED を返す
    • max iteration contract 到達

    単なる advisory warning、stale optional artifact、worker-local boolean、自動生成 artifact の欠落だけでは停止しないでください。


    11. 最終報告

    最後は必ず SubAgent が全て終了・join 済みであることを確認してから報告してください。

    最低限、以下をまとめてください。

    • termination reason / final route
    • Issue 実装: #1939 Workstream 4 — retrospective candidate を issue-refinement-loop → impl-review-loop へ controlled handoffする #2602
    • current main/base SHA
    • PR URL / PR number
    • PR head SHA
    • branch
    • worktree
    • 実装した主要変更
    • producer adapter の実装位置
    • dedupe 実装位置
    • create_issue_txn.py backward compatibility の扱い
    • root launch ownership が run_root_transition() に一本化されている証拠
    • double-launch guard の検証結果
    • focused test 結果
    • create-issue regression test 結果
    • typecheck / lint / test / build
    • runtime verification 結果
    • CI status
    • pr-reviewer verdict
    • unresolved blockers
    • Allowed Paths compliance
    • WS1/WS3 remaining dependency の扱い
    • SubAgent completion: all joined の明示
    • merge readiness

    draft_pr_ready の場合は最後に明確に:

    「マージは実行していない。人間による最終マージ判断待ち」

    と記載して終了してください。

    今から current repository state を fresh に取得し、canonical root-owned entry transition から開始してください。

    この指示なら、#2602 固有の「WS1/3 は親統合の残課題だが実装開始ブロッカーではない」という最新判断と、現行 impl-review-loop の root-owned entry / SubAgent join / already_satisfied semantics を両方維持したまま進められます。

  6. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  7. squne121 commented on Sep 19, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-19T11:49:50Z)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions