Skip to content

導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889

Open
1 of 2 issues completed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: parent
goal_ref: "既存の GitHub 証跡経路を維持しながら、SubAgent 起動時のローカル context 共有と人間向け作業履歴を impl-review-loop / issue-refinement-loop 両方で整理する"
change_kind: workflow
parent_mode: delivery-rollup
closure_mode: child-complete

Summary

impl-review-loop と issue-refinement-loop において、(1) live Issue/PR/CI などの作業判断の正本、(2) GitHub Issue/PR コメントによる人間向け履歴・cross-session 再開面、(3) SubAgent 起動直前のローカル context 共有、の3面を混同せず運用できる状態にする。当初 #1889 は「impl-review-loop Step 5 の投稿先を PR コメントへ統一する」という2ファイル限定の実装 Issue として起票されたが、owner comment により、対象は impl-review-loop Step 5 に留まらず、両 review loop から呼ばれる全カスタム SubAgent とその Skill における「AI エージェント間コンテクスト」と「人間向けコンテクスト」の整理へ拡大した。本 Issue は実装 Issue から delivery-rollup parent へ改訂し、拡大したスコープを 2 つの child issue に分割して追跡する。

Goal

impl-review-loop と issue-refinement-loop の両方で、以下の3面の責務と優先順位を統一する。

  1. live Issue / PR / diff / CI: 作業判断の正本
  2. GitHub Issue / PR コメント: 人間向け履歴および cross-session 再開面
  3. ローカル context bundle: SubAgent 起動直前の限定された作業入力(同一 session 内専用、cross-session では再利用しない)

既存の machine-readable verdict・review comment・evidence comment は撤去しない。新規の永続 state store・event ledger・replay digest・専用 semantic publisher は追加しない。

Desired Destination

  • Child A・Child B が完了した時点で、Claude Code と Codex CLI の両方が dispatch context bundle を consume し、impl-review-loop の phase routing(契約確認前は Issue/PR binding 後は PR)と issue-refinement-loop の人間向け履歴(対象 Issue)が確立している。
  • 既存の GitHub machine-readable 経路(pr-reviewer verdict、issue-reviewer result、TEST_VERDICT、contract review comment 等)は変更なく維持される。

Current Validated Scope

  • 本 Issue 自体は parent tracker であり、write-capable scope を持たない(実装は Child A / Child B が担う)。
  • 当初 導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889(実装 Issue時点)で検証済みだった .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md と .claude/skills/impl-review-loop/tests/test_termination_gate.py の投稿先・fail-closed 手順は、Child B の Current Validated Scope へ引き継ぐ。

Decisions Fixed

  • 2026-08-01: cross-session 共有は GitHub Issue/PR コメントに置く(ローカルを cross-session 正本にしない)。
  • 2026-08-01: ローカル context bundle は同一 session 内の SubAgent dispatch 専用とし、SubAgent 完了後に削除する。resume 時は live GitHub state から再生成する。
  • 2026-08-01: impl-review-loop は実装直前の契約確認までは Issue へ記録し、PR binding 確定後は PR へ記録する。
  • 2026-08-01: issue-refinement-loop の人間向け履歴は対象 Issue へ記録する。
  • 2026-08-01: 人間向けコメントには結果・証拠・推奨アクションに加え、推奨理由と対応しない場合の影響を含める。
  • 2026-08-01: 既存の review verdict/machine-readable comment 経路(pr-reviewer、issue-reviewer、TEST_VERDICT、contract review 等)は撤去しない。
  • 2026-08-01: 新規の永続 state store、event ledger、replay digest、専用 semantic publisher は追加しない(導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 / 実装: review/refinementのreplay・envelope・custom publisherをbounded loopへ置換する #1873 の minimal-harness 方針を維持)。
  • 2026-08-01: live Issue/PR/current head/CI とローカル bundle が食い違う場合は live state を優先する。

Quality Decision Record

  • Status: N/A
  • Decision Date: N/A
  • Does this prove the parent goal complete?: N/A
  • Reason: delivery-rollup parent のため Quality Decision Record は不要
  • Evidence: N/A
  • Next Action: N/A

Parent Closure Rule

  • delivery-rollup: Child A・Child B の両方が close され、以下を live readback できた時点で close する。
    • Claude Code と Codex CLI の両方が dispatch context bundle を consume する(Child A)。
    • 既存 GitHub machine-readable 経路が維持されている(Child A・Child B 共通)。
    • impl-review-loop の phase routing が Issue/PR へ正しく分かれる(Child B)。
    • issue-refinement-loop の人間向け履歴が対象 Issue に残る(Child B)。
    • 人間向けコメントが推奨理由と対応しない場合の影響を含む(Child B)。
    • 新しい永続 control-plane(state store/ledger/専用 publisher)が追加されていない(Child A・Child B 共通)。
  • quality-gate / routing-map / decision-log: 該当なし(本 parent は delivery-rollup 固定)。

Child Issues

Remaining Parent Gaps

Phase Handoff Contract

Child issue 起票時に implementation へ引き継ぐ構造は以下の通り(docs/dev/agent-skill-boundaries.md の Phase Handoff Contract に準拠)。

  • Desired Destination
  • Current Validated Scope
  • Remaining Parent Gaps
  • Current Objective
  • Bounded Current Context
  • Normative References
  • Allowed Paths
  • Required Skills
  • Validation Commands
  • Stop Conditions
  • Open Questions
  • Next Action
  • Artifact Refs
  • Handoff Prompt Draft
  • Linked PR(implementation のみ)

Acceptance Criteria

  • Child A と Child B が起票され、本 Issue の Child Issues セクションへ実際の Issue 番号(実装: SubAgent 発火前に bounded local context bundle を生成し Claude/Codex の両 loop で consume する #1909 / 実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する #1908)で登録されている。
  • GitHub(live authority)、live repository state、ローカル context bundle の責務と優先順位が Child A/B の Design セクションに明記される。
  • 既存 GitHub machine-readable 経路を維持することが Child A・Child B の Out of Scope に明記される。
  • impl-review-loop の実装直前契約確認までは Issue、PR binding 後は PR という境界が Child B の Destination Rules に固定される。
  • issue-refinement-loop の人間向け履歴が対象 Issue に残ることが Child B の In Scope に明記される。
  • ローカル bundle が SubAgent dispatch 専用で cross-session 再利用しないことが Child A の Acceptance Criteria に明記される。
  • 新規永続 state store/ledger/専用 publisher を追加しないことが Child A・Child B の Out of Scope に明記される。

Notes

Sub-issues

Sub-issues

1 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Jul 31, 2026
  2. squne121 commented on Aug 1, 2026

    @squne121
    OwnerAuthor

    人間が作業の履歴を見るためのGitHubコメントと、ローカルでAIエージェントとサブエージェントが作業に必要なコンテクストを共有するための履歴を分けて考えて整理してほしいです。
    impl-review-loop だけでなくエージェントスキルから呼び出されるカスタムサブエージェント及びその作業手順となるエージェントスキルについても、AIエージェント間のコンテクストと人間向けのコンテクストの整理を行ってほしいです。
    impl-review-loop だけでなくissue-refinement-loop についても検討してください。

    impl-review-loop のうち、実装直前の契約確認まではissue コメントになる想定です。

  3. squne121 commented on Aug 1, 2026

    @squne121
    OwnerAuthor

    you asked

    message time: 2026-08-01 11:02:43

    #1889
    #1889 (comment)
    内容について関連Issue、PR、リポジトリ資産、コメントを参照した上で敵対的レビューして。
    取り扱う技術や配布物の実装をWEB検索し高品質化してほしい。


    chatgpt response

    Issue #1889と指定コメントから関連Issue・PR・差分・テスト・契約を追跡し、失敗時挙動や検証漏れを公式資料と照合します。指摘は重大度順に修正案まで整理します。


    chatgpt response

    指定コメントは2ファイル・Step 5限定を越え、Allowed Pathsや受入条件と不整合です。さらに投稿先変更ではなく、会話履歴とGitHub再取得に依存する状態管理自体の再設計を要求しています。


    chatgpt response

    #1873/PR #1875は永続state・専用publisherを撤去済みで、横断的context基盤の新設はminimal-harness方針と逆行します。既存のagent_run_report、context export、agent-logsとの責務重複も精査します。


    chatgpt response

    結論

    判定: REQUEST_CHANGES — P0。現状の #1889 は実装着手不可です。

    最大の問題は、Issue 本文が「impl-review-loop の Step 5、2ファイル限定、投稿先を Issue から PR に変えるだけ」と規定している一方、指定コメントは「人間向け GitHub 履歴と AI 間ローカル履歴の分離」「全カスタム SubAgent/Skill」「issue-refinement-loop も対象」と要求している点です。本文どおりに実装すると owner comment を満たせず、comment どおりに実装すると Allowed Paths と Stop Conditions に違反します。

    また、単純な gh pr comment への置換は、既存リポジトリに実装済みの public-safe validator、stable marker、digest、create/update/noop、duplicate fail-closed、pagination、投稿後 read-back を迂回します。これは品質向上ではなく安全境界の後退です。


    敵対的レビュー結果

    P0-1 — Issue 契約と owner comment が両立していない

    Issue 本文は次を固定しています。

    • impl-review-loop Step 5 の終了処理だけ
    • .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
    • .claude/skills/impl-review-loop/tests/test_termination_gate.py
    • Step 5 以外、GitHub API、review schema、他の Skill/SubAgent は Out of Scope
    • Allowed Paths 外への波及や新規 Issue が必要なら停止

    一方、owner comment は次を求めています。

    • 人間向け GitHub 履歴と AI 間ローカル履歴の分離
    • impl-review-loop だけでなく、Skill から呼ばれる全カスタム SubAgent とその Skill
    • issue-refinement-loop
    • 実装直前の契約確認までは Issue コメント

    これは「追加的な小修正」ではなく、証跡面・AI handoff 面・authority 面の再設計です。

    必要な修正

    #1889 の issue_kind: implementation、Goal、In/Out of Scope、Allowed Paths、AC、Stop Conditions を全面改訂するか、設計 Issue と実装 Issue に分割してください。現在の2ファイル限定契約を維持したまま実装してはいけません。


    P0-2 — 「PR がない場合はどこにも投稿しない」は、人間向け監査履歴を消失させる

    本文は「PR番号またはURLが不正なら PR/Issue の双方へ投稿せず fail-closed」としています。しかし owner comment は「実装直前の契約確認までは Issue コメント」と明示しています。PR作成前の preflight、dependency、permission、contract、worktree、publish などで停止した場合、投稿先となる PR は存在しません。そこで「どこにも投稿しない」とすると、人間には停止理由が見えず、ローカルセッション消失後に復旧できません。

    投稿先は単純な PR 優先ではなく、phase-aware routing にすべきです。

    状態 人間向け投稿先
    Issue refinement Issue
    impl-review-loop の契約確認・実装前 preflight Issue
    PR がまだ作成されていない状態での停止 Issue
    対象 PR の binding 確定後 PR
    PR binding が stale/不正/曖昧 誤った PR には投稿せず、Issue に binding failure を記録
    post-merge retrospective 既存の public-safe run report/retro index

    「Issue は契約面だけ」とする #1889 の Desired Destination は、owner comment と実際の failure observability に対して狭すぎます。


    P0-3 — 既存の安全な publisher を無視して gh pr comment を直書きしようとしている

    リポジトリには、すでに以下が存在します。

    • agent_run_report/v1 と agent_retro_index/v1
    • raw transcript、secret、local absolute path を公開面へ出さない public/private 境界
    • stable ownership marker と digest marker
    • comment 全件 pagination
    • 0件なら create、1件なら update/noop、2件以上なら fail-closed
    • UTF-8 byte size gate
    • marker injection/ownership mismatch 検査
    • 403/404/410/422、GraphQL partial success の明示的な失敗処理
    • dry-run と mutation 後 read-back

    これらは #928、#937、#940 で設計・実装され、現在の scripts/agent-logs/lib/github-comments.mjs に存在します。

    GitHub では一般的な PR 会話コメントも Issues Comments API で管理されるため、既存 helper が PR にも Issues endpoint を使っていること自体は正しい実装です。(GitHub Docs)

    一方、gh pr comment はデフォルトではコメントを新規追加します。--edit-last も「現在のユーザーの最新コメント」を編集するだけで、loop run、Issue、PR、head SHA に対する安定した identity にはなりません。(GitHub CLI)

    必要な修正

    • gh pr comment の散文コマンドを Step 5 に直書きしない。
    • 既存 agent-logs の validator/marker-upsert primitive を再利用する。
    • terminal report が agent_run_report/v1 そのものに適合しない場合でも、汎用部分だけを狭く抽出する別 Issue に分ける。
    • 新しい専用 publisher を増やさない。

    P0-4 — AI 向け context を GitHub から分離するなら、consumer も同時に切り替える必要がある

    現行 impl-review-loop は、すでに GitHub PR コメントを AI 間通信路として利用しています。

    • test-runner の TEST_VERDICT_MACHINE v1 を PR コメントから抽出
    • pr-reviewer の LOOP_VERDICT を PR コメントから抽出
    • orchestrator がそれらを LOOP_STATE に反映

    したがって Step 5 の終了報告だけを PR へ移しても、「人間向け GitHub 履歴」と「AI 向けローカル履歴」は分離されません。むしろ AI routing authority と人間向け表示が同じコメント面に残ったままです。

    ここでは全 producer/consumer の inventory が必要です。

    rg -n \
      'IMPL_REVIEW_LOOP_RESULT_V1|FOLLOW_UP_MATERIALIZATION_RESULT_V1|ISSUE_SCOPE_ROLLUP_DECISION_V2|TEST_VERDICT_MACHINE|LOOP_VERDICT' \
      .
    
    rg -n \
      'gh (issue|pr) comment|post-agent-run-report|upsertAgentRunReportComment|publish_termination_report' \
      .claude .codex scripts docs tests
    
    rg -n \
      'ARTIFACT:|EVIDENCE:|LOOP_STATE|state_file|comment_url|reviewed_head_sha' \
      .claude .codex docs tests

    その上で各データについて、以下を明示しなければなりません。

    • producer
    • runtime consumer
    • resume/cross-session consumer
    • human reader
    • canonical authority
    • persistence期間
    • public-safe 判定
    • stale 判定と target binding
    • 移行前コメントとの互換性

    P0-5 — 「ローカル履歴」の内容・保持・安全境界が未定義

    owner comment はローカルで AI エージェント間に必要な context を共有するよう求めていますが、#1889 には次の定義がありません。

    • 生の会話履歴か、構造化要約か
    • 同一セッションだけか、cross-session か
    • canonical state か、advisory cache か
    • atomic write が必要か
    • file mode、retention、cleanup
    • secret/prompt/tool output/absolute path の扱い
    • Issue、PR、head SHA との binding
    • compaction 後の復元方法
    • Claude Code と Codex CLI の実装差

    一方、既存 issue-reviewer はすでに有効な最小パターンを持っています。

    • 親へ返す stdout は2KB以下の compact envelope
    • raw review、body、diff、log を親 context に返さない
    • full structured data は .claude/artifacts/... に保存
    • 親には artifact ref だけを返す
    • state file を直接操作しない

    これは owner comment の AI context 側に近い既存実装です。

    Claude Code の公式仕様でも、SubAgent は独立 context で作業し、親には要約だけを返す用途が基本です。また、必要に応じて SubAgent の resume や persistent memory を利用できます。したがって、まず native context/resume を利用し、cross-step/cross-session に必要な最小データだけをローカル artifact に落とすべきです。(Claude Platform Docs)

    ただし persistent memory は学習済みの慣例や知識向けであり、PR head や iteration の transactional authority として使うべきではありません。これは公式機能の用途とリポジトリの live-refetch 方針からの設計上の推論です。(Claude Platform Docs)


    P0-6 — 直近の minimal-harness 決定を別名で巻き戻す危険がある

    #1873 とマージ済み PR #1875 は、custom replay arbitration、永続 loop state store、専用 termination publisher を撤去し、bounded loop、minimal handoff、live GitHub state の再取得へ収束させています。#1860 も、実証されていない durable workflow authority、graph、ledger、digest gate を増やさない方針です。

    したがって owner comment を受けて、次のような基盤を新設するのは誤りです。

    • 全 Agent 共通の永続会話 ledger
    • 新しい canonical LOOP_STATE store
    • 全 event の event-sourcing
    • GitHub comment と local state の双方向同期
    • replay digest/parent binding digest の復活
    • Agent ごとの専用 publisher

    必要なのは 履歴基盤ではなく handoff 境界 です。


    P0-7 — PR番号またはURLの存在確認だけでは target binding が弱すぎる

    gh pr comment は PR 番号、URL、branch を受け取り、--repo を省略すると現在の repository context に依存します。したがって「PR番号がある」だけでは、別 repository、別 branch、古い PR、別 Issue の PR、head 更新後の stale PR に投稿する可能性があります。(GitHub CLI)

    永続スキーマを新設する必要はありませんが、mutation 直前に少なくとも次の runtime tuple を live read-back すべきです。

    target_pr_binding:
      repo: squne121/loop-protocol
      issue_number: 1889
      pr_number: <int>
      pr_url: <live URL>
      state: OPEN
      head_ref_name: <expected branch>
      head_ref_oid: <current SHA>
      linked_issue_verified: true

    必要条件は以下です。

    1. --repo squne121/loop-protocol と PR番号を明示する
    2. gh pr view で live URL、state、head branch、head SHA を取得する
    3. linked Issue/closing reference または loop-owned branch binding を確認する
    4. expected head と current head が一致する
    5. mutation 後に comment ID、URL、body digest を read-back する

    branch の暗黙推論を mutation target に使うべきではありません。


    P1 — 重大な品質欠陥

    P1-1 — 現行テストでは投稿処理を検証できない

    test_termination_gate.py は Markdown の文字列存在や近傍テキストを確認するテストが中心です。ファイル先頭の説明も古い Issue #632 を基準にしており、AC見出しだけで具体的テストがない区間もあります。router の一部には実動作テストがありますが、GitHub posting の create/update/noop、duplicate、pagination、read-back、API failure、public-safe 検査は対象外です。

    最低限、以下の behavior test が必要です。

    • pre-PR/post-PR の phase routing
    • PR未作成時の Issue fallback
    • wrong repo/wrong Issue/stale head/closed PR
    • marker 0件/1件/2件以上
    • create/update/noop
    • pagination budget exhaustion
    • marker injection/secret/absolute path/body byte上限
    • 403/404/410/422/rate limit/network failure
    • mutation 後 body mismatch
    • local artifact の atomicity、破損、stale binding
    • Claude/Codex の同一 semantic policy
    • 旧 Issue comment を含む移行期間の fallback

    既存 #937 のテスト資産を再利用すべきであり、rg "gh pr comment" が通ることを Acceptance Criteria にしてはいけません。


    P1-2 — 投稿先を変えても、人間向け内容にはならない

    現行 Step 5 の approved report は、IMPL_REVIEW_LOOP_RESULT_V1、FOLLOW_UP_MATERIALIZATION_RESULT_V1、scope rollup などの大きな YAML を含みます。これを Issue から PR に移しただけでは、人間向けと AI 向けの整理にはなりません。

    人間向け PR コメントは次程度に縮小すべきです。

    • 最終 status
    • iteration
    • reviewed/verified head SHA
    • blockers または停止理由
    • 実行した主要検証
    • 次アクション
    • public-safe report/artifact の opaque ref

    routing 用の詳細構造体は compact local artifact に置き、GitHub上では必要最小限の machine-readable footer に限定します。


    P1-3 — 一般コメントと formal PR review の意味を混同してはいけない

    gh pr comment は一般会話コメントです。Approve、Request Changes、Review Comment は gh pr review の別操作です。したがって terminal report を PR comment に移しても、GitHub の review state は変わりません。(GitHub CLI)

    #1889 は以下を明記すべきです。

    • terminal report は advisory audit comment
    • pr-reviewer verdict/formal review の代替ではない
    • approved termination と GitHub review approval は別概念
    • comment 投稿成功を merge approval の証拠にしない

    P1-4 — 既存 comment consumer の移行計画がない

    現在の Step 5 や関連 Skill が Issue comment 上の marker を検索している可能性があるため、いきなり投稿先を変えると resume、post-merge cleanup、follow-up materialization、retro export が旧証跡を見失います。

    必要なのは bounded migration です。

    1. producer を新経路へ切り替える
    2. consumer は一定期間 Issue/PR の双方を read-only 検索する
    3. 同一 run marker が双方に存在する場合は duplicate として fail-closed または新側優先を明示する
    4. 新規投稿は一方に限定する
    5. 旧 consumer が消えたことを rg と tests で確認する

    P1-5 — Related Issue の「non-conflict」判定が時系列を反映していない

    #1889 は #961、#962、#966 などを一律に non-conflict としていますが、これらには永続 gate、router、ledger を前提とする設計が含まれます。その後の #1860/#1873 はそれらの blocking authority や custom state/publisher を縮小・撤去する方向へ進んでいます。

    関連 Issue は次のように再分類すべきです。

    • 再利用する invariants: idempotency、read-back、partial failure fail-closed、compact output
    • superseded な architecture: durable loop authority、汎用 ledger、replay arbitration、専用 publisher
    • 現在も有効な実装: agent-logs validator/marker-upsert
    • 今回の後続範囲: 両 loop と custom agent の audience/handoff policy

    P1-6 — Claude と Codex の distribution parity が抜けている

    リポジトリは .claude だけでなく、Codex Multi-Agent V2、.codex/config.toml、parity checker、Codex向け agent/skill surface を持っています。PR #1879 では最大 active thread 数や config consumer まで明示的に整合させています。

    Codex も複数 Agent を別 thread/worktree で並列実行するため、共有履歴を1つの巨大コンテキストに戻すより、threadごとの分離と結果の集約を保つ方が製品設計に適合します。(OpenAI)

    したがって SSOT は .claude 固有コマンドではなく、次の semantic policy に置く必要があります。

    • native isolated context を優先
    • 親へは compact result
    • cross-session が必要な場合だけ local artifact
    • public GitHub は human-facing/public-safe
    • live repository/PR/CI を authoritative facts とする
    • Claude/Codex 固有 adapter は別々でも意味論は同一

    推奨する最小アーキテクチャ

    1. Live authority plane

    対象

    • Issue body/owner comment
    • PR head、diff、state、mergeability
    • CI checks
    • repository files

    これは履歴ファイルから再構築せず、resume 時に live read-back します。新しい永続 LOOP_STATE を正本にしません。

    2. Native AI runtime context

    対象

    • Claude Code SubAgent context/resume
    • Codex thread/subagent context
    • 親 Agent の一時 LOOP_STATE

    同一セッション内の主要な context 共有面です。raw exploration を親 context に戻さず、compact summary だけを返します。

    3. Local bounded handoff

    cross-step または cross-session に本当に必要な場合だけ使用します。

    AI_HANDOFF:
      producer: issue-reviewer | implementation-worker | test-runner | pr-reviewer
      phase: issue_refinement | pre_pr | implementation | verification | review | termination
      repo: squne121/loop-protocol
      issue_number: <int>
      pr_number: <int|null>
      head_sha: <sha|null>
      status: ok | blocked | failed
      blockers: []
      next_action: <bounded action>
      evidence_refs: []
      generated_at: <ISO8601>

    制約は以下です。

    • raw transcript、full prompt、full tool output、full diff を保存しない
    • secret、credential、private config を保存しない
    • artifact ref は repo-relative または opaque ID
    • bounded size
    • temporary file → fsync → rename の atomic write
    • local-only permission
    • target Issue/PR/head binding
    • TTL/cleanup
    • advisory handoff であり、live GitHub state より強い authority を持たない

    4. Human/public audit plane

    • PR作成前は Issue
    • PR binding 後は PR
    • existing public-safe validator を通す
    • stable marker upsert
    • mutation 後 read-back
    • concise human summary
    • raw local artifact はリンクも公開もしない
    • formal review stateとは分離

    既存 agent_run_report/github-comments.mjs を基盤として利用します。#1153 も、private observation plane と public retrospective plane を分離し、raw prompt/tool I/O/local path/credential を GitHub に出さない構造を既に定義しています。


    投稿トランザクションの推奨順序

    1. live Issue / PR / head / CI を read-back
    2. compact local AI handoff を atomic write
    3. human-facing public-safe body を render
    4. validator / redaction / byte-size / marker 検査
    5. stable marker で create | update | noop
    6. 投稿された comment を read-back
    7. ownership tuple と digest を照合
    8. publish result を local handoff に追記
    

    GitHub投稿が失敗しても AI handoff は失われません。ただし人間向け監査面が欠落しているため、成功終了にはせず publish_failed として phase-aware fallback に送ります。


    Issue の推奨分割

    親または設計 Issue

    整理: AIローカル handoff と人間向け GitHub 証跡の境界を Agent/Skill/両 review loop で統一する

    対象:

    • docs/dev/agent-skill-boundaries.md
    • docs/dev/agent-run-report.md
    • impl-review-loop
    • issue-refinement-loop
    • custom Agent inventory
    • .claude/.codex parity
    • phase/audience/authority matrix

    Child A

    実装: impl-review-loop を phase-aware human report routing と compact local handoff に接続する

    • pre-PR → Issue
    • post-binding → PR
    • current Step 5/context protocol
    • existing publisher reuse
    • migration/tests

    Child B

    実装: issue-refinement-loop と custom SubAgent の compact artifact/human report 境界を統一する

    • issue-reviewer の既存パターンを他 Agent に適用
    • controlled Issue publisher と local state の責務整理
    • raw result の main context 流入防止

    Conditional Child C

    既存 agent-logs の posting primitive が terminal report に再利用できないことを具体的に証明した場合だけ、共有 publisher の狭い拡張を起票します。最初から新規 publisher を作るべきではありません。


    修正後に必要な Acceptance Criteria

    1. 人間向け、AI runtime、local handoff、live authority の責務表が SSOT に存在する。
    2. pre-PR は Issue、valid PR binding 後は PR という routing が実動作テストされる。
    3. PR番号の存在だけでなく、repo/Issue/branch/head SHA binding が検証される。
    4. 全 custom Agent/Skill の producer/consumer inventory が作成される。
    5. AI routing は native context+compact stdout/local artifactを使用し、GitHubコメントを必須 transport にしない。
    6. raw transcript、prompt、tool output、secret、absolute path が public body に入らない。
    7. existing marker-upsert、digest、pagination、create/update/noop、duplicate fail-closed、read-back を再利用する。
    8. human-facing comment は concise summary と opaque evidence ref に縮小される。
    9. PR comment と formal PR review の意味が分離される。
    10. GitHub failure、local artifact failure、partial success の transaction semantics が定義される。
    11. 旧 Issue comment consumer を含む bounded migration がテストされる。
    12. Claude Code/Codex CLI で同じ semantic policy が検証される。
    13. 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860/実装: review/refinementのreplay・envelope・custom publisherをbounded loopへ置換する #1873 に反する durable loop authority、汎用 ledger、専用 publisher を追加しない。
    14. substring-only の Markdown テストではなく、publisher/routing/failure の behavior test が存在する。

    最終判定

    #1889 は現状のままでは、小さすぎる Issue 契約の中に大きな context architecture 変更を隠した状態です。

    実装方針は次に限定すべきです。

    • 導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889 本文を owner comment に合わせて再 refinement する
    • 両 loop と全 custom Agent/Skill の consumer inventory を先に取る
    • native SubAgent context と compact artifact を AI handoff に使う
    • GitHub には public-safe な人間向け要約だけを出す
    • 投稿は既存 marker-upsert/validator を再利用する
    • PR前は Issue、PR binding 後は PR
    • 新しい永続 state store、汎用 ledger、専用 publisher は作らない

    現在の2ファイル限定・gh pr comment 直書き案は棄却するのが妥当です。


    you asked

    message time: 2026-08-01 13:23:12

    「P0-4 — AI 向け context を GitHub から分離するなら、consumer も同時に切り替える必要がある」完全な分離は意図していないです。既存の経路も残しながら。
    [P0-5 — 「ローカル履歴」の内容・保持・安全境界が未定義]構造化要約,cross-session,[canonical state か、advisory cache か]用語が分かりづらくて判別できない。「atomic write」どういう意味?「file mode、retention、cleanup」どういう意味?「secret/prompt/tool output/absolute path の扱い」どういう意味?
    すでにオーナーコメントの意図に近い実装を持ちながら、CodexCLIがそれを実行しなかったことが問題ということか。
    「人間向け PR コメント」には推奨アクションを裏付ける理由も記載して認知負荷を下げてほしい。
    cross-sessionの共有面はGithubにおいてほしい。
    ローカル共有はサブエージェント発火前にサブエージェントが必要とするコンテクストをローカルファイル出力して共有すればいいのでは?という発想。
    推奨する最小アーキテクチャ を採用。
    Issue の分割、起票、既存Issueとの重複・統合・クローズ案を出して。


    chatgpt response

    意図を反映すると、完全分離ではなく「GitHubをcross-session正本として維持し、ローカルはSubAgent起動時の一時入力束」とする設計が妥当です。まず #1889 と重複候補の最新状態を再照合し、分割・統合・close案を確定します。

    既存資産を確認すると、#939 は「複数の既存レポートからChatGPT向けbundleを作る」用途で完了済みです。今回の「SubAgent発火直前に、そのAgent専用の入力ファイルを作る」用途とは近いものの同一ではなく、再利用するhelperと責務分離が必要です。

    前提の修正

    前回の P0-4 は、完全分離を前提にしすぎていました。撤回して、次のように読み替えるのが適切です。

    GitHub 上の既存の機械可読コメント・レビュー結果・人間向け履歴は残す。
    ローカルファイルは、それらを置き換えるのではなく、SubAgent 起動時に必要情報だけを渡す補助経路として追加する。

    したがって、既存 consumer を一斉に切り替える必要はありません。必要なのは「GitHub とローカルのどちらを何に使うか」「内容が食い違った場合にどちらを優先するか」の明文化です。

    用語を平易にすると

    正本か補助資料か

    • 正本: 食い違った場合に最終的に信じる情報。
    • 補助資料: 作業をしやすくするためのコピー。消えても作り直せる。

    今回の採用案では、GitHub の Issue/PR コメントと live repository state が正本です。SubAgent向けローカルファイルは補助資料です。

    atomic write

    ファイルへ直接書き続けるのではなく、一時ファイルへ最後まで書いてから完成版の名前へ一瞬で置き換える方式です。

    context.tmp に全内容を書く
    → 書き込み完了
    → context.json に名前を変更
    → SubAgentを起動
    

    ClaudeやCodexが、書き込み途中の半端なJSONを読む事故を防ぎます。単一プロセスで「書き終わってから起動」を厳守できるなら事故率は低いですが、実装コストが小さいため採用する価値があります。

    file mode

    Linux上で誰がファイルを読めるかという権限です。0600 は「作成したユーザーだけが読み書き可能」という意味です。

    retention

    ファイルを残しておく期間です。今回はcross-session共有をGitHubに置くため、ローカルファイルを長期間保存する必要はありません。

    推奨値は次です。

    • SubAgent完了後に削除
    • 異常終了時に残ったものは、次回起動時に24時間超なら削除
    • セッションをまたいで再利用しない

    cleanup

    不要になったローカルファイルを削除する処理です。

    secret/prompt/tool output/absolute path の扱い

    種類 ローカルcontextファイルでの扱い
    Secret API key、token、cookieなどの値は入れない
    Prompt 親会話の全文ではなく、そのSubAgentへの具体的な作業指示だけ
    Tool output 生ログ全文ではなく、結果要約・exit code・証拠URL・artifact path
    Absolute path /home/user/... は避け、原則repo-relative pathを使用
    Issue/PR本文 全文コピーよりGitHub URLと必要部分の要約を優先
    diff 全diffではなく対象ファイル、head SHA、確認すべき論点を記載

    Codex CLIが既存実装を使わなかった問題か

    一部はその理解で合っていますが、Codexの単純な遵守違反だけではありません。

    既存実装には、すでに近い要素があります。

    • issue-refinement-loop は親threadがpreflightを実行し、NEXT_ACTION、MUST_READ、ARTIFACTなどの限定された結果をSubAgentへ渡す parent-owned preflight を定義しています。さらに planner_input artifactも生成されています。
    • Codex版 issue-reviewer は親へ2,048バイト以内のcompact resultだけを返し、詳細は .claude/artifacts/issue-refinement-loop/<N>/ に保存する契約です。
    • 一方、Codex版 implementation-worker の入力契約は実質的に issue_number とlive Issueであり、親が生成した context_bundle_path を最初に読む契約はありません。

    つまり、現状は次の状態です。

    既存:
    - SubAgentの出力をcompactにする仕組み: ある
    - 一部preflight入力をartifact化する仕組み: ある
    - GitHubへcross-session履歴を置く仕組み: ある
    
    不足:
    - 全対象SubAgentに共通する「起動前contextファイル」契約
    - Codex/Claude orchestratorが毎回それを生成する配線
    - SubAgentが実際に読んだことを確認するテスト
    

    したがって、問題の中心はCodexが完成済みの共通手順を無視したことというより、既存部品が個別に存在するものの、共通のdispatch契約として接続・強制されていなかったことです。

    採用する最小アーキテクチャ

    GitHub Issue / PR
      ├─ 人間向け作業履歴
      ├─ 既存のmachine-readable verdict・evidence
      └─ cross-session再開情報
              │
              │ SubAgent起動直前に再取得・要約
              ▼
    ローカル dispatch context file
      ├─ 対象Issue/PR/head
      ├─ 今回の目的
      ├─ 読むべきファイル
      ├─ 未解決blocker
      ├─ 必要な証拠参照
      └─ 期待する出力形式
              │
              ▼
    Claude / Codex custom SubAgent
      └─ compact structured resultを親へ返す
    

    重要な原則は以下です。

    • cross-sessionはGitHub。
    • ローカルファイルはSubAgent起動時専用。
    • resume時は古いローカルファイルを使わず、GitHubから再生成する。
    • 既存のGitHub machine-readable経路は残す。
    • ローカルファイルがないことだけで、live GitHub情報を取得可能な作業を永久停止させない。
    • 新しい永続state store、event ledger、専用publisherは作らない。
    • 人間向けコメントには「推奨アクション」だけでなく「なぜそれを推奨するか」「放置時の影響」を含める。

    Issue構成

    推奨構成

    現在の #1889 をcloseせず、実装Issueからdelivery-rollup parentへ改訂します。指定コメントによって実質的なscopeが広がっているため、その履歴を維持する方が新parentを追加するより追跡しやすいです。現状の #1889 はStep 5の2ファイルだけに限定され、PRがない場合はIssueにも投稿しない契約なので、そのままでは今回の決定を収容できません。 指定コメントは両loopとcustom SubAgentまでの整理を求めています。

    分割は2 Childで十分です。

    1. Child A: SubAgent起動前のローカルcontext bundle
    2. Child B: 両loopの人間向けGitHub作業履歴

    これ以上分けると、Claude/Codex parity、両loop、Agent定義が細切れになり、逆に統合作業が増えます。


    既存Issueの処分案

    Issue 提案 理由
    #1889 parentへ改訂 今回の決定とowner commentの履歴を維持
    #1114 Child Aへ統合後、not planned startup capsule、compact fallback、context汚染防止はChild Aの狭い一部。専用startup routerは不要
    #351 Child Bへ要件統合後、not planned 人間向け品質は必要だが、専用finalizer Skill/SubAgentの追加は過剰。理由・推奨アクションをreport templateへ組み込む
    #961 not planned候補 「散文だけの成功を信用しない」は維持するが、専用Evidence Gate、永続LOOP_STATE、追加routerは #1873 後のminimal conventionと逆方向
    #962 #1860整理対象としてnot planned候補 model別deterministic routerとLOOP_STATE保存は今回のcontext整理と別で、minimal harnessに対して過剰
    #966 #1860整理対象としてnot planned候補 新規concurrent-work ledgerは今回の一時context bundleではなく、新たな状態管理層になる
    #1116 維持・別scope no-diff/superseded close transactionであり、contextとhuman reportの整理とは別。Child Bとの同時編集だけ避ける
    #51 維持またはowner判断でclose Draft解除は別のUX機能。今回へ混ぜない。Step 5競合を避けChild B後に実装する
    #937 完了済み資産を再利用 marker、digest、create/update/noop、投稿前guardを持つ。再open不要
    #939 完了済み資産を部分再利用 budget、redaction、injection-safe context生成のhelperを参照。ただし用途はChatGPT retrospectiveであり、そのままSubAgent dispatchには使わない
    #940 完了済み設計を拡張 handoff責務の既存文書。再openせずChild A/Bで追記
    #1873 完了済み制約として参照 永続state、replay、専用publisherを復活させない
    #1860 policy参照のみ 新ledger、digest、checker、graphを追加しない方針。現在のscope上、今回の新Childを直接ぶら下げない

    改訂 #1889 案

    **Document Title: **

    整理: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する

    Machine-Readable Contract

    contract_schema_version: v1
    issue_kind: parent
    parent_issue: none
    goal_ref: "既存のGitHub証跡経路を維持しながら、SubAgent起動時のローカルcontext共有と人間向け作業履歴を両review loopで整理する"
    change_kind: workflow
    parent_mode: delivery-rollup
    closure_mode: child-complete

    Goal

    impl-review-loop と issue-refinement-loop において、次の3面を混同せず運用する。

    1. live Issue/PR/diff/CI: 作業判断の正本
    2. GitHub Issue/PRコメント: 人間向け履歴およびcross-session再開面
    3. ローカルcontext bundle: SubAgent起動直前の限定された作業入力

    既存のmachine-readable verdict、review comment、evidence commentは撤去しない。

    Decisions Fixed

    • cross-session共有はGitHub Issue/PRコメントに置く。
    • ローカルcontext bundleは同一session内のSubAgent dispatch専用とし、cross-session正本にしない。
    • resume時は古いローカルbundleを再利用せず、live GitHub stateから再生成する。
    • impl-review-loopでは実装直前の契約確認まではIssueへ記録する。
    • PR binding確定後の実装・検証・レビュー・終了履歴は対象PRへ記録する。
    • issue-refinement-loopの人間向け履歴は対象Issueへ記録する。
    • 人間向けコメントには、結果、証拠、推奨アクション、推奨理由、放置時の影響を含める。
    • 既存のreview verdict/machine-readable comment経路を残す。
    • 新規の永続state store、event ledger、replay digest、専用semantic publisherは追加しない。
    • live Issue/PR/current head/CIとローカルbundleが食い違う場合、live stateを優先する。

    Child Issues

    • Child A — SubAgent発火前にbounded local context bundleを生成し、Claude/Codexの両loopでconsumeする
    • Child B — impl-review-loop/issue-refinement-loopの人間向けGitHub作業履歴をphase-awareに整理する

    Current Validated Scope

    Child A

    • impl-review-loopの直接SubAgent:
      • implementation-worker
      • test-runner
      • pr-reviewer
    • issue-refinement-loopの直接SubAgent:
      • codebase-investigator
      • web-researcher
      • issue-reviewer
      • issue-author
    • Claude CodeとCodex CLIのAgent定義・Skill導線
    • dispatch直前のローカルcontext bundle生成、読取、破棄

    Child B

    • impl-review-loopのpre-PR/post-PR投稿先
    • issue-refinement-loopのIssueコメント
    • 人間向けコメントの内容と認知負荷削減
    • 既存machine-readableコメントとの共存
    • GitHub mutation前後のtarget readback

    Out of Scope

    • GitHub上の既存review verdict/evidence commentの撤去
    • PR自動マージ
    • GitHubを使わないcross-session state store
    • raw transcriptのGitHub投稿
    • 全tool outputのローカル保存
    • 新規SubAgentの追加
    • model capability router
    • concurrent work ledger
    • replay arbitrationの再導入

    Acceptance Criteria

    • Child AとChild Bが起票され、本IssueのChild Issuesへ登録されている。
    • GitHub、live repository state、ローカルcontext bundleの責務と優先順位が明記されている。
    • 既存GitHub machine-readable経路を維持することが明記されている。
    • impl-review-loopの実装直前契約確認まではIssue、PR binding後はPRという境界が固定されている。
    • issue-refinement-loopの人間向け履歴はIssueに残る。
    • ローカルbundleはSubAgent dispatch専用で、cross-session再利用しない。
    • 新規永続state store、ledger、専用publisherを追加しない。
    • #1114と#351の残存要件がChild A/Bへ統合された後、両Issueのdispositionが記録されている。
    • 実装: SubAgent result evidence gate で証跡なし成功報告を fail-closed にする #961、実装: model capability router で Haiku fallback の編集・成功判定スコープを制限する #962、#966のdispositionが#1860方針との整合を確認した上で記録されている。

    Related Existing Assets

    Parent Closure Rule

    Child AとChild Bがcloseされ、以下をlive readbackできた時点でcloseする。

    • ClaudeとCodexの両方がdispatch context bundleをconsumeする。
    • 既存GitHub経路が維持されている。
    • impl-review-loopのphase routingがIssue/PRへ正しく分かれる。
    • issue-refinement-loopの人間向け履歴がIssueに残る。
    • 人間向けコメントが推奨理由を含む。
    • 新しい永続control-planeが追加されていない。

    Child A 起票案

    **Document Title: **

    実装: SubAgent発火前にbounded local context bundleを生成しClaude/Codexの両loopでconsumeする

    Parent Issue

    #1889

    Machine-Readable Contract

    contract_schema_version: v1
    issue_kind: implementation
    parent_issue: "#1889"
    goal_ref: "SubAgent起動直前に必要情報だけをローカルファイルへ出力し、Claude/Codexのcustom SubAgentへ同じ入力契約で渡す"
    change_kind: workflow

    Outcome

    impl-review-loopとissue-refinement-loopのorchestratorが、各custom SubAgentを起動する直前にboundedなローカルcontext bundleを生成し、そのpathを起動入力へ含める。

    SubAgentはbundleを最初に読み、live Issue/PR/headと照合した上で作業する。bundleはSubAgent完了後に削除され、cross-session再開時にはGitHubから再生成される。

    Design

    Authority

    • live Issue/PR/repository/CI: 正本
    • GitHubコメント: cross-session履歴
    • local context bundle: dispatch用補助資料

    Context Bundle

    SUBAGENT_DISPATCH_CONTEXT:
      bundle_id: "<run-id>:<phase>:<agent>"
      repository: "squne121/loop-protocol"
      issue_number: <int>
      pr_number: <int|null>
      head_sha: "<sha|null>"
      phase: "<phase>"
      agent: "<custom-agent-name>"
      objective: "<今回実行する作業>"
      required_inputs: []
      must_read: []
      unresolved_blockers: []
      previous_result_summary: null
      evidence_refs: []
      expected_output_contract: "<contract name>"
      generated_at: "<RFC3339>"

    これは公開schemaやcatalog entryにせず、parent/SubAgent間の内部plain objectとする。

    File Handling

    • path: .claude/tmp/subagent-context/<run-id>/<agent>.json
    • 一時ファイルへ完全に書き込み後、完成pathへrenameする。
    • permissionは0600とする。
    • raw transcript、credential、cookie、token、環境変数値を含めない。
    • full diff/full command outputを含めない。
    • repository内pathはrepo-relativeで記録する。
    • SubAgent完了後に削除する。
    • 起動時に24時間超のstale bundleを削除する。
    • cross-sessionでは再利用せず、GitHubから再生成する。

    Fallback

    bundle生成が失敗した場合:

    1. stale bundleを再利用しない。
    2. 同じ最小fieldをinline structured payloadとしてSubAgentへ渡す。
    3. fallback使用をwarningとして親resultへ記録する。
    4. live Issue/PRを再取得可能なら、bundle障害だけで作業全体を恒久停止しない。

    Target Agents

    impl-review-loop

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

    issue-refinement-loop

    • codebase-investigator
    • web-researcher
    • issue-reviewer
    • issue-author

    Claude Codeの.claude/agents/*.mdとCodex CLIの.codex/agents/*.tomlで同じsemantic input contractを使用する。

    In Scope

    • context bundle generator
    • atomic write、permission、cleanup
    • impl-review-loop dispatchへの接続
    • issue-refinement-loop dispatchへの接続
    • Claude/Codex Agent input contract
    • bundle ID/digestのresult echo
    • fixture test
    • Claude/Codexのlive smoke

    Out of Scope

    • GitHubコメントの投稿先変更
    • human report template
    • raw transcript保存
    • 永続LOOP_STATE
    • event ledger
    • Agent memoryへの保存
    • 新規SubAgent追加
    • GitHub上の既存machine-readable経路撤去

    Acceptance Criteria

    • orchestratorが各対象SubAgentの起動直前にbundleを生成する。
    • bundle完成前にSubAgentを起動しない。
    • bundleは有効なJSONで、必須fieldとbounded sizeを満たす。
    • permissionが0600である。
    • credential、token、cookie、raw transcript、full tool output、absolute repository pathが含まれない。
    • Claude/Codexの対象Agentがcontext_bundle_pathを入力として受理する。
    • SubAgent resultがbundle_idとcontext_source: local_bundle | inline_fallbackを返す。
    • missing/malformed bundleではstale fileを再利用しない。
    • SubAgent完了後にbundleを削除する。
    • 24時間超のstale bundleをcleanupする。
    • resume時はGitHubからbundleを再生成する。
    • issue-refinement-loopの既存planner_input/ARTIFACTを再利用し、同じ情報を別形式で重複生成しない。
    • 既存machine-readable GitHub comment consumerが回帰しない。
    • Claude CodeとCodex CLIのlive smokeでbundle consumptionを確認する。

    Candidate Allowed Paths

    • scripts/agent-ops/build_subagent_context_bundle.py
    • scripts/agent-ops/tests/test_build_subagent_context_bundle.py
    • docs/dev/agent-skill-boundaries.md
    • .claude/skills/impl-review-loop/SKILL.md
    • .claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md
    • .claude/skills/issue-refinement-loop/SKILL.md
    • .claude/agents/implementation-worker.md
    • .claude/agents/test-runner.md
    • .claude/agents/pr-reviewer.md
    • .claude/agents/codebase-investigator.md
    • .claude/agents/web-researcher.md
    • .claude/agents/issue-reviewer.md
    • .claude/agents/issue-author.md
    • .codex/agents/implementation-worker.toml
    • .codex/agents/test-runner.toml
    • .codex/agents/pr-reviewer.toml
    • .codex/agents/codebase-investigator.toml
    • .codex/agents/web-researcher.toml
    • .codex/agents/issue-reviewer.toml
    • .codex/agents/issue-author.toml
    • 対応するtargeted tests

    Verification Commands

    uv run --locked pytest scripts/agent-ops/tests/test_build_subagent_context_bundle.py -q
    
    rg -n \
      "context_bundle_path|bundle_id|context_source" \
      .claude/agents .codex/agents \
      .claude/skills/impl-review-loop \
      .claude/skills/issue-refinement-loop
    
    git diff --check

    Runtime Verification Applicability

    decision: immediate
    required_runtime:
      - claude_code_custom_subagent_dispatch
      - codex_cli_custom_agent_dispatch
    success_condition:
      - bundle_generated_before_spawn
      - agent_echoes_matching_bundle_id
      - context_source_is_local_bundle
    fallback_success_is_pass: false

    Existing Issue Disposition

    • #1114のbounded startup capsule/compact fallback要件を本Issueへ統合する。
    • 本Issue起票後、#1114へsupersede理由をコメントしnot plannedでcloseする。
    • #939のbudget/redaction/injection-safe helperを参照するが、ChatGPT retrospective bundleとSubAgent dispatch bundleは別用途として維持する。

    Child B 起票案

    **Document Title: **

    実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する

    Parent Issue

    #1889

    Machine-Readable Contract

    contract_schema_version: v1
    issue_kind: implementation
    parent_issue: "#1889"
    goal_ref: "既存machine-readable経路を維持しながら、人間がIssue/PR上で作業経緯と次の判断理由を追跡できる状態にする"
    change_kind: workflow

    Outcome

    impl-review-loopとissue-refinement-loopの人間向け作業履歴が、phaseに応じてIssueまたはPRへ投稿される。

    コメントには結果だけでなく、証拠、推奨アクション、その推奨理由、放置時の影響が含まれ、人間が追加調査をせずに次の判断を行える。

    既存のreview verdict、machine-readable marker、test evidence、Issue契約コメントは維持する。

    Destination Rules

    Flow / Phase Human-facing destination
    issue-refinement-loop 全phase 対象Issue
    impl-review-loop 契約確認前 対象Issue
    impl-review-loop 実装直前の契約確認 対象Issue
    PR未作成状態での停止 対象Issue
    PR binding確定後の実装・検証・レビュー 対象PR
    approved/max_iterations/human_escalation 対象PR。PRが存在しない場合は対象Issue
    conflict_hard_stop 対象PR。誤ったPR bindingの場合は対象Issueへbinding failure
    post-merge retrospective 既存agent_run_report/retro index経路

    PR番号欠落時に「どこにも投稿しない」とはしない。live Issueが特定できる場合はIssueへ診断を残す。

    Existing Routes

    以下は撤去しない。

    • pr-reviewer verdict comment
    • issue-reviewer result/artifact
    • TEST_VERDICT/CI evidence
    • contract review comment
    • owner decision comment
    • agent_run_report/retro index
    • normal gh issue comment --body-file
    • normal gh pr comment --body-file

    人間向けsummaryは既存machine-readable commentを置き換えるのではなく、参照URLを添えて補完する。

    Human Comment Template

    ## <flow>: <result>
    
    ### 対象
    - Issue: #<N>
    - PR: #<N|null>
    - Head: `<sha|null>`
    - Iteration: <N>
    
    ### 何が起きたか
    <2〜5行の要約>
    
    ### 判断を裏付ける証拠
    - <CI/test/review/diff/comment URL>
    - <重要な観測>
    
    ### 推奨アクション
    <人間または次Agentが行う具体的な操作>
    
    ### このアクションを推奨する理由
    <なぜ他の選択肢より妥当か。判断根拠とtrade-off>
    
    ### 対応しない場合の影響
    <停止、stale review、誤merge、未検証など>
    
    ### 次の担当
    <human | implementation-worker | issue-author | reviewer | none>

    機械可読footerが必要な場合も、人間向け本文を圧迫しない最小fieldに限定する。

    Posting Requirements

    • 投稿前にrepository、Issue/PR番号、PR state、head SHAをlive readbackする。
    • PRが対象Issue/branch/headと一致することを確認する。
    • 投稿本文はpublic-safe validationを通す。
    • raw transcript、credential、local absolute path、full tool outputを投稿しない。
    • stable markerによるcreate/update/noopを優先し、同一runのduplicateを増やさない。
    • 投稿後にcomment URLと本文digestをreadbackする。
    • gh pr comment成功をformal PR approvalとして扱わない。
    • pr-reviewer verdictとhuman-facing summaryの役割を明記する。
    • 新規semantic publisherを追加せず、既存generic posting guardまたは通常comment経路を使用する。

    In Scope

    • impl-review-loopのIssue/PR destination routing
    • issue-refinement-loopのIssue human summary
    • approved、max_iterations、human_escalation、conflict_hard_stop
    • pre-PR contract confirmation
    • 推奨アクションと推奨理由
    • missing/invalid PR binding時のIssue fallback
    • target readback
    • public-safe rendering
    • create/update/noop/duplicate test
    • 既存machine-readable経路の回帰テスト

    Out of Scope

    • PR auto-merge
    • PR Draft解除
    • Issue自動close
    • review criteria変更
    • TEST_VERDICT schema変更
    • GitHub commentsの完全廃止
    • ローカルdispatch context bundle
    • 新規human-interface-finalizer SubAgent
    • 新規専用publisher

    Acceptance Criteria

    • impl-review-loopの契約確認まではIssueへ人間向け履歴を投稿する。
    • PR binding後の作業履歴はPRへ投稿する。
    • PR未作成時またはPR binding不正時はIssueへ診断を投稿する。
    • issue-refinement-loopの人間向け履歴は対象Issueへ投稿する。
    • approved、max_iterations、human_escalation、conflict_hard_stopの全経路が対象となる。
    • 各コメントに推奨アクションと推奨理由が含まれる。
    • 各コメントに対応しない場合の影響が含まれる。
    • pr-reviewer verdict commentを変更・撤去しない。
    • existing machine-readable commentsと共存する。
    • PR commentをformal review approvalとして表現しない。
    • target repository/Issue/PR/headを投稿前後にreadbackする。
    • duplicate run commentを増やさずcreate/update/noopを区別する。
    • raw transcript、secret、local absolute path、full tool outputを投稿しない。
    • behavior testがあり、単なるrg "gh pr comment"だけを成功条件にしない。
    • #351の人間向け品質要件を本Issueへ統合し、新規finalizer Agentを追加しない。

    Candidate Allowed Paths

    • .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
    • .claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md
    • .claude/skills/impl-review-loop/tests/
    • .claude/skills/issue-refinement-loop/SKILL.md
    • .claude/skills/issue-refinement-loop/references/termination-policy.md
    • .claude/skills/issue-refinement-loop/tests/
    • docs/dev/agent-skill-boundaries.md
    • docs/dev/agent-run-report.md
    • scripts/agent-logs/lib/github-comments.mjs(既存generic helperの拡張が必要な場合のみ)
    • tests/agent-logs/github-comment-*.test.ts(既存helper変更時のみ)

    Verification Commands

    uv run --locked pytest \
      .claude/skills/impl-review-loop/tests/ \
      .claude/skills/issue-refinement-loop/tests/ -q
    
    pnpm test
    
    rg -n \
      "推奨アクション|推奨する理由|対応しない場合の影響" \
      .claude/skills/impl-review-loop \
      .claude/skills/issue-refinement-loop
    
    git diff --check

    Runtime Verification Applicability

    decision: immediate
    github_api_required: true
    required_cases:
      - impl_pre_pr_issue_comment
      - impl_post_pr_pr_comment
      - impl_missing_pr_issue_fallback
      - refinement_issue_comment
      - duplicate_noop_or_update
    fallback_success_is_pass: false

    Existing Issue Disposition

    • #351の「人間向け面を高品質モデルでfinalizeする」という要求は、専用SubAgentを追加せず本Issueのtemplate/review criteriaへ統合する。
    • 本Issue起票後、#351へ統合理由をコメントしnot plannedでcloseする。
    • #937のgeneric marker upsert/public-safe posting guardを再利用する。
    • #940のhandoff docsを更新するが、Issue自体は再openしない。
    • #1116と#51は別機能として維持し、本Issue完了後に同一ファイルの競合を避けて実施する。

    推奨実行順は、#1889改訂 → Child A起票 → Child B起票 → #1114/#351 close → Child A実装 → Child B実装 → #961/#962/#966の整理です。


    Powered by AI Exporter

  4. squne121 commented on Aug 1, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: human_escalation

    構造レビュー(review-issue): 解消済み

    check_issue_contract.py による決定論的チェックで検出された 5 件の blocker は修正済みです。

    • C5: Acceptance Criteria に AC1〜AC6 番号を付与
    • C9: ## Runtime Verification Applicability(decision: not_applicable)セクションを追加
    • VCP_UNEXPECTED_PASS x3: baseline で既に pass する VC 3 行に # baseline-expect: pass を追加

    再検証結果: check_issue_contract.py --issue 1889 → verdict: approve(blocked_issues: 0)。run_contract_review_once.py --mode execute → status: go。

    停止理由: anchor comment とIssue契約の意味的不整合(scope_signal_guard 未検出)

    anchor comment(https://github.com/squne121/loop-protocol/issues/1889#issuecomment-5149813241)は、owner が外部の敵対的レビュー結果を貼り付けたもので、要旨は次の通りです。

    • 判定: REQUEST_CHANGES — P0。現状の 導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889 は実装着手不可
    • 現在の Issue 契約(impl-review-loop Step 5 限定、対象2ファイルのみ、gh pr comment への投稿先変更のみ)と、owner comment が要求する内容(人間向け GitHub 履歴と AI 間ローカル履歴の分離、impl-review-loop だけでなく全カスタム SubAgent/Skill、issue-refinement-loop も対象、実装直前までは Issue コメント)は両立しない
    • 「そのまま実装すると owner comment を満たせず、comment どおりに実装すると Allowed Paths / Stop Conditions に違反する」との指摘
    • 既存の安全な publisher(agent_run_report/v1、agent-logs の marker-upsert/dedupe/pagination/read-back 等)を無視して gh pr comment を直書きする点への異議
    • 推奨: 導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889 の Outcome / In Scope / Out of Scope / Allowed Paths / AC / Stop Conditions を全面改訂するか、設計 Issue と実装 Issue に分割する

    この意味的スコープ衝突は、plan_refinement_loop.py の scope_signal_guard(triggered: false, reason_code: no_scope_signal)では検出されませんでした。anchor comment 本文は redaction ポリシーにより planner input へ生テキストが渡らず、構造化 extracted_directives のみが渡るため、この種の自由記述の意味的対立は自動検出の対象外です。orchestrator が GitHub 上の comment 本文を直接確認し、人間判断が必要と判断しました。

    次アクション(人間判断が必要)

    以下のいずれかを決めてください。

    1. 現状の狭いスコープ(Step 5 限定・対象2ファイル)を維持し、anchor comment の要求(人間/AI 履歴分離・全 SubAgent/Skill 対応・issue-refinement-loop 対応)は別 Issue(設計 Issue を含む)に切り出す。導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889 は現状の contract のまま issue-contract-review → implement-issue へ進める。
    2. 導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889 を anchor comment の要求に合わせて全面改訂または分割する(推奨: 設計 Issue と実装 Issue に分離)。この場合、本 loop を再実行するか、新規 Issue 起票からやり直す。

    いずれの場合も、構造レビュー自体は pass 済みのため、スコープ方針が確定すれば速やかに次段階へ進められます。

  5. changed the title [-]実装: impl-review-loop の作業別証跡をPRコメントへ統一する[/-] [+]導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する[/+] on Aug 1, 2026
  6. added
    tracking
    state/in-progress
    and removed
    enhancement
    phase/implementation
    agent/implementer
    on Aug 1, 2026
  7. squne121 commented on Aug 1, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: restructured (approved by owner instruction)

    実施内容

    1. 導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889 を実装 Issue(issue_kind: implementation)から parent tracker(issue_kind: parent, parent_mode: delivery-rollup, closure_mode: child-complete)へ全面改訂。title・labels(tracking, state/in-progress)も変更。
    2. Child A(実装: SubAgent 発火前に bounded local context bundle を生成し Claude/Codex の両 loop で consume する #1909): SubAgent 発火前の bounded local context bundle を起票。
    3. Child B(実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する #1908): 両 review loop の人間向け GitHub 作業履歴の phase-aware 整理を起票(元 導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889 の実装スコープ = Step 5 の2ファイルを引き継ぐ)。
    4. 導入: AI間ローカルhandoffと人間向けGitHub証跡をphase別に統一する #1889 の Child Issues セクションへ 実装: SubAgent 発火前に bounded local context bundle を生成し Claude/Codex の両 loop で consume する #1909 / 実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する #1908 を実番号で登録。

    いずれも check_issue_contract.py(review-issue)と validate_issue_body.py(LP ルール、--kind 明示)の両方で構造検証 PASS を独立確認済み。

    実施しなかったこと(人間判断が必要)

    anchor comment の disposition 案(#1114・#351 は Child A/B へ統合後 not planned 候補、#961・#962・#966 は #1860/#1873 整合確認後に disposition、#1116・#51 は維持)は、本 loop では close/comment を実行していません。#1889 の Remaining Parent Gaps に disposition 判断項目として記載済みです。これらの既存 Issue の統合・クローズは、今回のスコープ(「#1889 の全面改訂または分割」)を超える別判断のため、人間の明示的な指示を待ちます。

    次アクション

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

    state/in-progresstracking

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions