Skip to content

実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2562"
goal_ref: "Claude-GPT operatorがNative Claudeと同じTask Context DB・Task/Activity/Binding semantics・cross-session inbound policyを利用し、isolated HOMEやlauncher-owned settingsによってTask stateが分裂しないようにする"
change_kind: code
dedupe_key: "task-context-v1:claude-gpt-runtime-integration"

Parent Issue

#2562

Parent Goal Ref

  • Goal: Herdr上で最大8程度のClaude Code / Claude-GPT operatorを並列利用しても、Tab位置に依存せずcurrent Taskを識別し、ACTIVEな別primary target誤配送はbinding/claimを変更しないadvisoryとして検知しつつClaude処理は継続し、人間はAttention対象だけを把握でき、/clear・/quit・Herdr cold restartを跨いでTask Contextを復元できる状態にする(2026-09-10: 実装: Task ContextのUserPromptSubmit wrong-session guardをadvisory-only化し通常workflowをhard blockしない #2625 contract cascadeによりadvisory-onlyへ更新。旧hard-block契約はhistorical 実装: Native Claude operatorにTask Context hooks・wrong-session guard・statusLine/Herdr projectionを配線する #2564 / merged PR #2615の記録として保持)。
  • Desired Destination(parent scope): Herdr上で最大8程度のNative Claude / Claude-GPT operatorを並列利用しても、Tab位置・worktree・branchをTask identityにせずcurrent Taskを安定識別し、wrong-primary promptをbinding/claimを変更しないadvisoryとして検知しつつClaude処理を継続させ、/clear・/quit・Herdr cold restartを跨いで必要なTask Contextを復元し、人間は既存Herdr/statusLine上のTask・Activity・Attention・runtime healthを見れば運用できる状態にする(v1はlocal SQLiteをlive state SSOTとする薄いcontrol-planeに限定)。

Depends On

Outcome

scripts/claude-gpt/launch.shから起動した通常operatorでも、Native Claudeと同じcanonical Task Context SQLiteを利用し、runtime profileがclaude_gpt_v1として記録される。launcherのHOME/config isolation・Auto/Spark等の既存policyを維持しつつ、Task Context用に--settings等のcaller flagを要求しない。

Claude-GPTの「same conversation」は provider-side continuation ID を意味しない。same Claude Code native session/transcript + same Task/Activity/Binding + same runtime profile を指すものとして定義する。

Current Validated Scope

Remaining Parent Gaps

In Scope

  • Claude-GPT launcherがHOME/XDG isolationを適用する前にTask Context canonical absolute state rootを解決し、childへcarrierとして渡す。
  • carrier contract:
    • LOOP_TASK_CONTEXT_SCOPE
    • LOOP_TASK_CONTEXT_STATE_ROOT
    • LOOP_TASK_CONTEXT_RUNTIME_VARIANT=claude_gpt
  • precedence:
    1. inherited LOOP_TASK_CONTEXT_STATE_ROOTがあればそのabsolute rootを保持する(runtime-smoke overrideを上書きしない)
    2. 未設定の通常operatorだけambient user XDG/HOMEからcanonical rootをHOME isolation前に解決する
  • Task Context DBがClaude-GPT isolated HOME配下へ別生成されないようにする。
  • launcher-owned/generated settingsがproject Task Context hooks/statusLineを落とさず、Native Claudeと同一のcrossSessionInbound native default挙動(project/localでの明示固定なし)とTask Context-aware SendMessage guardをClaude-GPT側でも維持することをtestする。
  • Claude-GPTのsession registry resolutionはLOOP_TASK_CONTEXT_SESSION_REGISTRY_DIR override → 未設定ならCLAUDE_CONFIG_DIR設定時はCLAUDE_CONFIG_DIR/sessions → それもなければ~/.claude/sessionsの順で解決し、CLAUDE_CONFIG_DIR配下の実session registryからsame-Task peerのname→sessionIdを解決する。
  • Task Context integrationのためにcaller-supplied --settings / policy-weakening flagを許可しない。既存launcher policyを維持する。
  • Claude-GPTのTask Context hookとSpark/Latitude/session-manifest等の既存hookが同一eventで並列になっても順序を仮定しない。
  • Task Context mismatch advisoryはSpark custom agent/authorization state machine(#2651で撤去済み)に一切依存せず、既存launcher-owned Auto / UserPromptSubmit retirement hookと互いのsemanticsを横取りしないことをintegration testで固定する。
  • Task Context PreToolUseはsafe operationへexplicit allowを返さず、Claude-GPTのAuto/Agent permission gateを横取りしない。
  • LOOP_TASK_CONTEXT_RUNTIME_VARIANT=claude_gptの場合、ExecutionRunへrun_kind=claude_gpt/runtime_profile=claude_gpt_v1/resume_profile=claude_gpt_v1として記録し、stale/open/latest run lookupはnative_operatorとclaude_gptの両方のrun kindを対象とし、runtime flavorが変わってもBinding/Task/Activity identityは維持されるようにする。後続cold-restore dispatcherがprofile-aware resumeできる情報を持たせる。
  • launcher path/profileはfinite repository-defined profileとして扱い、raw argv/env/credentialをTask Context DBへ複製しない。

Out of Scope

  • Herdr cold restart時のresume dispatcher/shim実装(別child)。
  • worktree-agent-runtime-smoke側のisolated Task Context wiring(別child)。
  • Claude-GPTのproxy/model/Auto/Spark policy自体の再設計。
  • user/global Claude settingsの変更。

Acceptance Criteria

  • AC1: 同一Herdr project内のNative ClaudeとClaude-GPTが同じcanonical Task Context DBを参照し、runtime flavorが変わってもBinding/Task/Activity identityは維持される。
  • AC2: Claude-GPT isolated HOME配下に別Task Context canonical DBが生成されない。
  • AC3: inherited runtime-smoke LOOP_TASK_CONTEXT_STATE_ROOTとLOOP_TASK_CONTEXT_SCOPEはlauncher通過後も上書きされない(LOOP_TASK_CONTEXT_SCOPEもinherited preservationの対象)。
  • AC4: Claude-GPT operator runにruntime_profile/resume_profile=claude_gpt_v1が記録される。加えて、LOOP_TASK_CONTEXT_RUNTIME_VARIANT=claude_gptの場合、ExecutionRunへrun_kind=claude_gpt/runtime_profile=claude_gpt_v1/resume_profile=claude_gpt_v1として記録され、stale/open/latest run lookupはnative_operatorとclaude_gptの両方のrun kindを対象とする。
  • AC5: Claude-GPTのeffective inbound policyがNativeと同じ(project/local明示固定なし、native default挙動 + Task Context-aware SendMessage guard)である。加えて、Claude-GPTのsession registry resolutionはLOOP_TASK_CONTEXT_SESSION_REGISTRY_DIR override → 未設定ならCLAUDE_CONFIG_DIR設定時はCLAUDE_CONFIG_DIR/sessions → それもなければ~/.claude/sessionsの順で解決し、CLAUDE_CONFIG_DIR配下の実session registryからsame-Task peerのname→sessionIdを解決できる。
  • AC6: Task Context project hooks/statusLineとlauncher-owned hooks/settingsが順序依存なしで共存する。
  • AC7: Task Context mismatch advisoryはSpark custom agent/authorization state machine(#2651で撤去済み)に一切依存せず、既存launcher-owned Auto / UserPromptSubmit retirement hookと互いのsemanticsを横取りしない。
  • AC8: Task Contextのsafe PreToolUse pathがexplicit allowを返さず、Claude-GPT Auto/Agent gateのpermission semanticsを変更しない。
  • AC9: Task Context統合のために既存forbidden --settings等を解禁しない。

Verification Commands

# AC1
# AC2
# AC3
# AC4
# AC5
# AC6
# AC7
# AC8
# AC9
# existing Claude-GPT suite + Task Context integration tests
$ uv run --locked pytest tests/task-context -q

実装時はtests/task-contextに加え、scripts/claude-gptの既存canonical test commandをreadbackして実行すること。

Runtime Verification Applicability

decision: immediate
applicable_acs: [AC1, AC2, AC4, AC5, AC6, AC7]
reason: "isolated HOME/settings/hook precedenceはactual launcher → actual Claude runtimeで確認する必要がある"
execution_environment: "Claude-GPT launcher + isolated local runtime; external secret値はevidenceへ出さない"
skip_conditions: "対象runtime(Claude-GPT launcher + Claude native)を用意できない開発環境ではruntime検証をskipし、static/unit testsのみをbaselineとして扱う。skip時はruntime AC PASSを主張しない。"
fallback_policy: "static/unit testsのみをruntime PASSの代替にしない。"
artifact_requirements: "worktree-agent-runtime-smoke等のisolated runtime実行から取得したbounded evidence(実行ログ抜粋、runtime_profile記録、hook実行順evidence等)をIssue commentへpublic-safeな形で添付する。external secret値はevidenceへ出さない。"

Allowed Paths

  • scripts/claude-gpt/**
  • scripts/task-context/**
  • tests/task-context/**

Stop Conditions

  • Task Context統合のためにClaude-GPTの既存HOME/config/Auto/Spark boundaryを弱める必要が生じた場合。
  • caller-supplied --settings等のpolicy-weakening flag解禁が必要な場合。
  • raw argv/environment/credentialをTask Context DBへ永続化する必要が生じた場合。
  • Herdr cold restore orchestrationまで同一PRへ広げる必要が生じた場合(専用childへ分離)。
  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Claude-GPT launcher(scripts/claude-gpt/launch.sh)のHOME/XDG isolation
  • Claude Code hook precedence / settings統合
  • pytest(deterministic unit/integration tests)

Required Design References

Delivery Rule

  • 1 Issue = 1 PR。
  • dependencies merge後のcurrent launcher/settings contractsをreadbackして実装する。

Activity

  1. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    結論

    Issue #2567 は、実装に入る前に contract refinement を1回かけた方がよい状態です。問題は security hardening 不足ではなく、2026-09-21 に merge された PR #2691 と、その後の Claude-GPT launcher の変更に Issue 本文が追随しておらず、そのまま実装すると「動くが実用上 ASK だらけ」「managed run の整合性で詰まる」可能性があることです。

    確認基準は current main 4d4376fffe69f1825f5b9e506f81a68646b96fdc。#2567 自体にはコメントはありませんが、#2562/#2625、PR #2615/#2632/#2691、現行 scripts/task-context/**、scripts/claude-gpt/**、.claude/settings.json、さらに PR #2691 の fix_delta / runtime probe コメントまで追いました。特に PR #2691 の最終 runtime probe では、実際の SendMessage.to が internal UUID ではなく session name であり、~/.claude/sessions/<pid>.json の name と sessionId を対応付ける方式が実証されています。

    敵対的レビュー findings

    1. [P1 / blocker] Claude-GPT の HOME/config isolation と、feat: Task Context に Task-aware cross-session messaging guard と cross-Task Herdr control guard を追加する #2691 の session registry resolver が噛み合っていません。 現行 task_context_session_registry.py は default registry を Path.home() / ".claude" / "sessions" としています。一方 Claude-GPT launcher は child 起動前に CLAUDE_CONFIG_DIR=$CLAUDE_GPT_HOME/claude を設定したうえで、HOME=$CLAUDE_GPT_HOME/claude-home に差し替えます。Claude Code は CLAUDE_CONFIG_DIR 指定時、通常 ~/.claude に置く設定・session data 等をその config directory へ移す仕様です。([Claude]1) さらに local cross-session messaging は on-disk session registration を探索して成立し、互いに同じ registration files を見られない session 同士は peer discovery できません。([Claude]2) したがって最低でも _default_session_registry_dir() は CLAUDE_CONFIG_DIR を first-class に扱うべきです。現状のままだと Claude-GPT では known same-Task peer が unknown → ASK に退化し、今回重視している「人間を挟まず普通に協調する」体験を損ねます。また Native ↔ Claude-GPT の peer discovery 自体を保証したいのか、GPT ↔ GPT のみでよいのかも AC に明記すべきです。前者が必要なら、config 全体を共有せず session registry だけを narrow に共有する設計を別途検証する価値があります。

    2. [P1 / blocker] LOOP_TASK_CONTEXT_RUNTIME_VARIANT=claude_gpt から ExecutionRun へ落とす契約が不足しています。 現行 schema は既に run_kind='claude_gpt' を正式な managed run とし、native_operator と claude_gpt を合わせて「1 Binding あたり open managed run は1件」に物理制約しています。しかし現行 task_context_hook_flows.py の SessionStart/recovery は run_kind="native_operator" をハードコードしています。実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 AC4 は runtime_profile/resume_profile=claude_gpt_v1 だけを要求しており、run_kind をどうするかが抜けています。ここは claude_gpt variant を {run_kind=claude_gpt, runtime_profile=claude_gpt_v1, resume_profile=claude_gpt_v1} へ明示 mapping すべきです。さらに stale-run 終了や「直前の run から Task/Activity を復元」する query を native_operator 固定のまま残すと、Native→GPT切替や crash recovery で既存 open native run と unique index が衝突します。operator lifecycle の lookup は「current kind」ではなく managed run kinds 全体を意識して直す必要があります。

    3. [P1 / blocker] LOOP_TASK_CONTEXT_SCOPE の precedence が未定義で、直後の 実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568 と衝突します。 実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 は carrier として LOOP_TASK_CONTEXT_SCOPE を挙げていますが、通常 operator で何を設定するのか、inherited 値を保持するのかを書いていません。一方 実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568 は明示的に LOOP_TASK_CONTEXT_SCOPE=runtime_smoke を渡し、しかも 実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 の carrier precedence に依存しています。実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 実装が素直に SCOPE=operator を上書きすると 実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568 AC9 が壊れます。少なくとも「inherited STATE_ROOT と SCOPE は preserve、通常起動で scope 未設定なら operator default」といった規則を固定すべきです。また canonical state root の導出を shell に再実装するのは避け、isolation 前に task_context_config.resolve_state_root() の SSOT を呼ぶ方がよいです。

    4. [P1] Issue 本文に obsolete contract が複数残っています。 Depends On は 実装: Task ContextにTask-aware cross-session messaging guardとcross-Task Herdr control guardを追加する #2566 を「project crossSessionInbound=hold policy」と説明していますが、PR feat: Task Context に Task-aware cross-session messaging guard と cross-Task Herdr control guard を追加する #2691 の最終形は project/local では明示固定せず Claude Code native default を維持する契約です。Claude Code 自身も、crossSessionInbound が未設定なら sender/receiver の permission mode class に応じて accept/hold を決める仕様で、固定 hold ではありません。Auto は prompting class とされています。([Claude]2) また AC7 の「Spark grant/deny/consume/defer/carry-over」も現在は死んだ契約です。Issue 実装: GPT-5.3-Codex-Spark delegation を Claude-GPT / Claude Code 経路から退役させる #2651 後の launcher では Spark custom agent/auth state machine は完全撤去済みで、残っているのは active legacy directive を拒否する retirement hook だけです。AC7 をこのまま残すと、存在しない機構の runtime harness を作る無駄が生じます。Task Context hooks do not interfere with launcher-owned Auto / existing UserPromptSubmit retirement hook 程度に縮めるか、Spark 固有部分を削除するのが妥当です。

    5. [P2] AC6 の「hook 共存」は方向性として正しいですが、過剰な順序テストは不要です。 Claude Code の現行仕様では hooks は settings level 間で merge され、同じ event で match した handlers は並列実行されます。([Claude]3) また launcher の --settings は project settings より高 precedence ですが、指定していない key は lower-level 値を維持します。([Claude]1) したがって 実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 は「hook order permutations を大量に試す」のではなく、actual launcher で project Task Context hook と launcher-owned hook が両方発火し、statusLine も生きていることを1本の canary で確認すれば十分です。これは security/harness より通常 workflow を優先する今回の方針にも合います。

    6. [P2 / downstream gap] 実装: Herdr cold restartでTask BindingとNative/Claude-GPT runtime flavorを自動復元する #2569 が要求する Native profile と current main がまだ一致していません。 実装: Herdr cold restartでTask BindingとNative/Claude-GPT runtime flavorを自動復元する #2569 の dispatcher は native_claude_v1 → native resume、claude_gpt_v1 → Claude-GPT launcher を前提にしています。しかし current Native SessionStart は runtime_profile/resume_profile を設定していません。実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 で GPT のみ claude_gpt_v1 を入れると、後続 実装: Herdr cold restartでTask BindingとNative/Claude-GPT runtime flavorを自動復元する #2569 では Native の NULL profile をどう扱うかという別の contract gap が残ります。実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 で operator profile resolver を共通化して Native=native_claude_v1 まで確定するか、実装: Herdr cold restartでTask BindingとNative/Claude-GPT runtime flavorを自動復元する #2569 側で「legacy/null native_operator は native_claude_v1 と扱う」移行規則を明示するべきです。今の Issue 群では所有者が曖昧です。

    7. [P2] Runtime Verification は必要ですが、現在の Verification Commands は空欄が多すぎます。 ここで大きな harness を追加する必要はありません。実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 だけの disposable runtime canary で十分です。temp state root を使った actual Claude-GPT launch で、Native/GPT が同じ DB を見る、isolated HOME に別 DB が生えない、run_kind/profile/resume_profile が期待どおり、inherited runtime_smoke scope/root が保持される、CLAUDE_CONFIG_DIR 下の実 session registry を resolver が読める、project hook と launcher hook が共存する、の6点を観測すればよいです。実装: worktree-agent-runtime-smokeにrun-scoped isolated Task Context検証を追加する #2568 の本格的な runtime-smoke isolation framework を前倒しする必要はありません。

    修正後の中心 contract

    私なら実装前に #2567 を、概ね次の形まで明確化します。

    carrier precedence
    - inherited LOOP_TASK_CONTEXT_STATE_ROOT: preserve
    - inherited LOOP_TASK_CONTEXT_SCOPE: preserve
    - otherwise normal operator scope: operator
    - launcher-owned LOOP_TASK_CONTEXT_RUNTIME_VARIANT: claude_gpt
    
    operator runtime mapping
    - native:
        run_kind=native_operator
        runtime_profile=native_claude_v1
        resume_profile=native_claude_v1
    - claude_gpt:
        run_kind=claude_gpt
        runtime_profile=claude_gpt_v1
        resume_profile=claude_gpt_v1
    
    session registry resolution
    - LOOP_TASK_CONTEXT_SESSION_REGISTRY_DIR override
    - else CLAUDE_CONFIG_DIR/sessions when CLAUDE_CONFIG_DIR is set
    - else ~/.claude/sessions
    
    managed-run recovery
    - stale/open/latest lookupは native_operator と claude_gpt の両方を対象
    - runtime flavor が変わっても Binding/Task/Activity identity は維持
    

    AC 側では、AC3 に SCOPE preservation を追加、AC4 に run_kind=claude_gpt を追加、AC5 に CLAUDE_CONFIG_DIR 下の real name→sessionId resolution を追加、AC7 の Spark authorization 文言を削除/置換するのが優先です。

    特に最優先は session registry path と managed run lifecycle の2点です。前者は正常な same-Task coordination を不要な ASK に変え、後者は SQLite の既存 unique invariant と直接衝突します。逆に、追加の sandbox/security layer や巨大な hook-order harness は #2567 では不要です。

    [Issue #2567](https://github.com/squne121/loop-protocol/issues/2567?utm_source=chatgpt.com)
    [直前依存の PR #2691](https://github.com/squne121/loop-protocol/pull/2691?utm_source=chatgpt.com)

  2. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    確認した範囲では、対象コメントの前提 SHA 4d4376fffe69f1825f5b9e506f81a68646b96fdc は現在の main と一致しています。したがって、レビューを「古い指摘」として再調査からやり直すより、対象コメントを operator-selected human context として canonical issue-refinement-loop に投入し、fact-check → contract update → fresh review まで自律完走させるのが適切です。

    推奨アクションは、① with_human_context lane を明示、② codebase-investigator 等のスキル規定 SubAgent へ事実確認を委譲し完了を待つ、③ P1 の session registry / managed-run lifecycle / scope precedence を最優先で Issue 本文へ反映、④ obsolete な crossSessionInbound=hold と Spark authorization 契約を現行 main に合わせて除去、⑤ #2569 向け Native profile ownership の曖昧さも今回 disposition、⑥巨大な harness を増やさず具体的 VC を追加、です。#2568 は LOOP_TASK_CONTEXT_SCOPE=runtime_smoke の継承を既に要求しており、#2651 は Spark route を退役済みなので、この2点は特に contract drift として明確です。

    そのまま貼れるプロンプトです。

    対象:

    既に ClaudeCode は auto mode で起動している。
    この依頼について通常の人間承認待ちは不要。Issue #2567 の contract refinement を canonical issue-refinement-loop で自律実行し、review-complete / implementation-ready まで到達させること。

    この prompt 自体を、operator が上記 OWNER anchor comment を明示的に選択して refinement を実行させる指示として扱うこと。anchor comment の処理では with_agent_report や unlabeled lane ではなく、skill が定義する with_human_context / operator_asserted_human_context lane を使用すること。

    ただし deterministic gate、schema validation、canonical routing、fail-closed contract を無効化・偽装してはならない。単なる「mutationしてよいか」「レビュー指摘を反映してよいか」という承認確認のために人間へ戻らず、この prompt の authorization を使って進めること。canonical machinery が真に terminal な human_judgment_required / operator_intervention_required を返し、現在の operator context でも決定論的に解消不能な場合だけ停止し、exact blocker を報告すること。

    最初に行うこと

    1. repository root と current branch / HEAD / working tree を確認する。
    2. main の current SHA を readback する。
    3. Issue 実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 本文と anchor comment 5754369141 を GitHub から fresh readback する。
    4. anchor comment が Issue 実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 所属であることを確認する。
    5. .claude/skills/issue-refinement-loop/SKILL.md と、必要になった reference file を current checkout から読み、skill の canonical workflow をそのまま実行する。
    6. anchor comment を raw prose のまま mutation input に直結せず、references/anchor-comment-handling.md の契約に従って snapshot → fact-check → normalized feedback の順で処理する。

    レビュー時点の基準 SHA は
    4d4376fffe69f1825f5b9e506f81a68646b96fdc
    だった。current main が同じでも、必ず自分で fresh readback して確認すること。

    SubAgent の使用

    skill が要求・許可する SubAgent を実際に使うこと。

    特に investigation が required の場合は codebase-investigator を使用し、anchor comment に含まれる repo/current-main に関する主張を独立に fact-check させること。

    必要に応じて skill が定義する reviewer / semantic reviewer / issue editor 系 SubAgent を使うこと。

    重要:

    • SubAgent を fire-and-forget にしない。
    • 起動した各 SubAgent の作業完了を必ず待つこと。
    • 全 SubAgent の structured result / evidence を受領してから次の phase に進むこと。
    • main thread が final classification、routing、mutation decision を保持すること。
    • SubAgent に Issue mutation を直接させない。
    • SubAgent から別 SubAgent を起動する nested delegation は行わない。必要な sequential delegation は main thread が orchestration する。
    • 複数の独立した read-only investigation が並列可能なら並列化してよいが、全件 join してから判定すること。

    anchor comment の主要 findings

    anchor comment を結論として盲目的に採用せず current main で fact-check すること。ただし以下を優先調査対象とする。

    P1-A: Claude-GPT session registry resolution

    現行の task_context_session_registry.py と Claude-GPT launcher の HOME / CLAUDE_CONFIG_DIR isolation を照合する。

    最低限、次の intended contract の妥当性を検証すること:

    • explicit LOOP_TASK_CONTEXT_SESSION_REGISTRY_DIR override があればそれを優先
    • それがなく CLAUDE_CONFIG_DIR が設定されていれば <CLAUDE_CONFIG_DIR>/sessions
    • それもなければ native default の ~/.claude/sessions

    Native ↔ Claude-GPT / Claude-GPT ↔ Claude-GPT の same-Task independent-session resolution をどこまで #2567 の AC とするか、parent #2562 と current implementation を根拠に明文化すること。

    正常な same-Task peer を unnecessary unknown -> ASK に退化させる contract は残さないこと。

    P1-B: runtime variant → managed ExecutionRun mapping

    LOOP_TASK_CONTEXT_RUNTIME_VARIANT=claude_gpt が単なる profile label で終わらず、ExecutionRun lifecycle まで一貫して反映される contract を検証する。

    候補となる mapping:

    • native

      • run_kind=native_operator
      • runtime_profile=native_claude_v1
      • resume_profile=native_claude_v1
    • claude_gpt

      • run_kind=claude_gpt
      • runtime_profile=claude_gpt_v1
      • resume_profile=claude_gpt_v1

    特に stale/open/latest/recovery lookup が native_operator 固定になっていないか調べ、
    managed operator lifecycle として native_operator / claude_gpt を横断して扱う必要性を確認すること。

    Native → Claude-GPT または Claude-GPT → Native の runtime flavor 切替で、
    同一 Binding に対する open managed-run unique invariant と衝突しない contract にすること。

    P1-C: carrier precedence

    #2568 を fresh readback し、少なくとも次を contract として固定すべきか検証する:

    • inherited LOOP_TASK_CONTEXT_STATE_ROOT は preserve
    • inherited LOOP_TASK_CONTEXT_SCOPE は preserve
      -通常 operator で scope 未設定なら operator
    • launcher-owned LOOP_TASK_CONTEXT_RUNTIME_VARIANT=claude_gpt
    • canonical state-root resolution の SSOT を shell に重複実装しない

    特に #2568 の
    LOOP_TASK_CONTEXT_SCOPE=runtime_smoke
    および run-scoped STATE_ROOT を #2567 launcher が上書きしないことを acceptance criteria / verification に明記する。

    P1-D: obsolete contract の除去

    current main / merged dependencies を根拠に以下を disposition する:

    #2651 は Spark delegation retirement の owner Issue として fresh readback すること。

    存在しない Spark authorization state machine のために runtime harness を新設しない。
    必要なら AC7 は current launcher-owned Auto / retirement hook と Task Context hooks が互いの semantics を横取りしない、という current architecture に即した contract へ置換する。

    P2: Native profile ownership / #2569 handoff

    #2569 が native_claude_v1 / claude_gpt_v1 をどのように consume するか確認する。

    Native profile が NULL のまま downstream へ曖昧さを持ち越さないこと。

    以下のどちらを採るか current scope / parent goal / Allowed Paths を根拠に決定し、Issue contract 上で明示すること:

    単に Open Question のまま残さない。
    同じ Outcome の in-place refinement で解消できるなら不要な follow-up Issue を増やさない。
    本当に ownership split が必要な場合のみ canonical follow-up materialization contract に従う。

    P2: Runtime Verification / Verification Commands

    巨大な新 harness や全 permutations テストを要求しない。

    #2567 の通常 workflow を壊さない最小限の deterministic unit/integration tests と disposable actual-runtime canary に絞る。

    少なくとも以下を contract / VC に対応付けること:

    • Native と Claude-GPT が同じ canonical Task Context DB を参照
    • isolated HOME に別 canonical DB が生成されない
    • inherited STATE_ROOT / SCOPE=runtime_smoke が preserve
    • Claude-GPT run が期待する run_kind/runtime_profile/resume_profile
    • runtime flavor 切替時の managed-run recovery invariant
    • CLAUDE_CONFIG_DIR 配下の real session registry から name → sessionId を解決
    • project Task Context hooks と launcher-owned hooks/settings/statusLine が actual launcher で共存
    • Task Context PreToolUse が Auto/Agent permission semantics を横取りしない

    hook execution order 自体を deterministic と仮定した巨大 permutation harness は作らない。

    Refinement workflow

    issue-refinement-loop の planner / preflight / review / rewrite / post-update gate を省略しないこと。

    anchor comment の freeform directive に scope delta が含まれる場合は、operator-selected with_human_context lane と read-only investigation evidence を使用して canonical authority 判定を行う。

    read-only preflight.run.with_human_context が investigation evidence transport manifest を使って
    contract_update_required
    へ進んだ場合、skill contract に従って 同一の transport manifest を直後の
    contract_update.run.with_human_context
    へ渡すこと。独自の bypass mutation を行わない。

    Issue 本文を更新した後は必ず:

    1. fresh GitHub body readback
    2. fresh preflight
    3. fresh root review
    4. applicable なら semantic design review
    5. needs-fix なら再度 canonical rewrite
    6. fresh readiness 判定

    まで実行する。

    一度本文を書き換えただけで「完了」としない。

    review → rewrite → fresh review を bounded loop として継続し、canonical approval / refinement-complete へ収束させること。

    Scope方針

    これは Issue refinement run であり、#2567 の実装コードを今ここで実装する run ではない。

    • implementation PR を作らない
    • production code を実装しない
    • merge しない
    • security hardening や新しい sandbox を目的化しない
    • Task Context v1 の thin control-plane / ordinary workflow を維持する
    • unnecessary ASK、operator friction、巨大 harness を増やさない
    • quality / usefulness / maintainability を優先する
    • existing SSOT と current architecture を再利用する
    • downstream Issue を先取りして大規模実装しない

    ただし Issue contract を implementation-ready にするため必要な acceptance criteria、Allowed Paths、Verification Commands、dependency wording、runtime mapping、handoff contract の修正は行ってよい。

    自律実行方針

    途中で
    「この修正を適用しますか?」
    「Issue本文を書き換えてよいですか?」
    「レビューを続けますか?」
    のような通常承認を求めないこと。

    この prompt により #2567 refinement と、canonical workflow が認める Issue body mutation / review iteration は承認済み。

    判断可能な事項は repository evidence、parent/child contract、merged PR、current code、skill SSOT から自律判断すること。

    canonical route が retry なら bounded retry を行う。
    needs-fix なら修正して再レビューする。
    follow-up が deterministic に必要なら skill の materialization contract に従う。

    canonical fail-closed result を無視して approval を偽装してはならない。

    完了条件

    最終報告までに以下を満たすこと:

    • anchor comment を fact-check 済み
    • SubAgent を必要箇所で使用済み
    • 起動した全 SubAgent の完了を待ち、結果を統合済み
    • Issue 実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 の contract drift を disposition 済み
    • 必要な Issue body mutation を GitHub に反映済み
    • mutation 後の fresh readback 済み
    • fresh review / readiness 済み
    • remaining blocker がなければ implementation-ready と判定可能な状態
    • blocker が残る場合は一般論ではなく exact canonical blocker / route / evidence を提示

    最後に簡潔な handback を出すこと。最低限:

    • current main SHA
    • anchor final classification
    • 使用した SubAgent と各結果
    • Issue本文へ反映した主要変更
    • follow-up issue materialization の有無
    • 実行した validation / review
    • canonical final route
    • implementation-ready: yes/no
    • 未解決事項があれば exact blocker

    を含めること。

    この形なら、単に「コメントの7項目をIssueへ貼る」指示ではなく、現在の issue-refinement-loop が持つ anchor fact-check・scope authority・fresh post-update gate を通して収束させられます。特に with_human_context の明示と、SubAgent完了待ち → main threadで最終判定の2点を外さないのが重要です。

  3. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: approved

    anchor comment(#2567 (comment)、OWNER、with_human_context lane)に基づく contract refinement を完了しました。

    実施内容

    1. anchor comment を canonical preflight.run.with_human_context → contract_update.run.with_human_context(explicit trusted human_review_directive、contract_update_required)で処理し、mechanical contract-patch を適用。
    2. codebase-investigator が anchor comment の repo claims(session registry resolution / run_kind mapping / SCOPE precedence / obsolete crossSessionInbound・Spark 記述 / 実装: Herdr cold restartでTask BindingとNative/Claude-GPT runtime flavorを自動復元する #2569 native profile gap)を current main(4d4376ff〜)で独立に fact-check し、いずれも実コードで確認済み。
    3. web-researcher が anchor comment の外部仕様 claim(CLAUDE_CONFIG_DIR migration、cross-session messaging の on-disk registration、crossSessionInbound の permission-mode依存デフォルト、hooks merge/precedence)を Claude Code 公式ドキュメントで fact-check し、4件中3件完全確認・1件(hook並列実行の明示記述)は非dispositiveな未確認として記録。
    4. Step 2 deterministic review は approve。Step 2.5 semantic design review(issue-design-reviewer)が mechanical patch の低品質な断片混入(AC節の裸テキスト行、Verification Commands節への非実行散文混入)と、anchor P1指摘の未反映(session registry precedence、run_kind=claude_gpt mapping)、および陳旧化記述(Depends On の 実装: Task ContextにTask-aware cross-session messaging guardとcross-Task Herdr control guardを追加する #2566 説明、AC7/In Scope の Spark 文言)を blocker/high findingsとして検出。
    5. issue-editor が semantic findings を反映して本文を rewrite。
    6. fresh readback → fresh preflight → fresh Step 2 review(approve)→ 2回目 Step 2.5 semantic review を実施し、1回目の blocker/high findings が全て解消されていることを確認。新規に medium 1件(SCOPE precedence が In Scope の precedence 記述に伝播していない)・low 1件(Required Design References に 実装: GPT-5.3-Codex-Spark delegation を Claude-GPT / Claude Code 経路から退役させる #2651 未掲載)を検出したが、いずれも non-blocking(route_high_open_to_rewrite policy 対象外)で effective_verdict: approve。
    7. issue-contract-review(Final Gate)で CONTRACT_REVIEW_RESULT_V1.status: go を fresh body(body_sha256: da0012f2...)に対して確認。

    未解決の軽微事項(non-blocking、次回 in-place refinement または実装時に解消可)

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: null
        generated_at: "2026-09-21T02:15:33Z"
        body_sha256: "sha256:da0012f2e2bc54766a77c84de378bb8916623ca59737fa560c29378063d864eb"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "本 refinement cycle では label 操作を行っていない"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-09-21T02:16:00Z"
      checked_body_sha256: "sha256:da0012f2e2bc54766a77c84de378bb8916623ca59737fa560c29378063d864eb"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []

    Note: 本 run は operator prompt により明示的に「Issue refinement run であり実装 run ではない」とスコープされているため、root_entry_router.py による impl-review-loop への実際の起動(invocation)はこの turn では実行していない。上記 marker は audit telemetry として impl_ready 状態を記録するのみであり、Step 1(実装着手)の authority ではない。実装着手は別途の明示的な impl-review-loop 起動判断を要する。

  4. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    推奨は、追加 refinement を先に挟まず、そのまま canonical impl-review-loop に入ることです。Issue #2567 は最新の refinement 終了コメントで impl_ready / blocker なしまで到達しています。依存する #2563 / #2564 / #2566 も completed です。

    ただし、過去の LOOP_HANDOFF_RESULT_V1 は Step 1 の authorization ではありません。impl-review-loop 自身が要求する Root-Owned Synchronous Entry Transition、つまり current-run の fresh contract review → live Issue 再取得 → routing → 同一 invocation 内で Step 1 起動、を必ず通すべきです。現在の live main HEAD は 10bbcf85c0bd7c33fc25f07617488d27b254703d なので、refinement 時の 4d4376ff... を固定基準にしてはいけません。[Issue #2567](#2567) / [refinement approved comment](#2567 (comment))

    そのまま対話中の ClaudeCode に貼るなら、以下を推奨します。

    対象 Issue:
    #2567

    使用する canonical skill:
    .claude/skills/impl-review-loop/SKILL.md

    既に ClaudeCode は auto mode で起動している。

    Issue #2567 を対象に、canonical impl-review-loop を使用して、実装 → 独立検証 → PR review → fix_delta 修正 → 再検証 → 再review を自律的に反復し、skill が定義する merge 直前の終了状態まで進めること。

    通常の途中承認は不要。
    「実装してよいですか」「PRを作ってよいですか」「レビュー指摘を直してよいですか」「次の iteration に進んでよいですか」といった通常の確認のために停止しないこと。

    ただし、canonical skill の hard safety boundary、actual Git conflict、secret/protected-path gate、正式な HUMAN_REVIEW_REQUIRED verdict、max iteration 超過等を無効化・偽装してはならない。

    PR の merge 自体は行わないこと。auto-merge も有効化しないこと。
    impl-review-loop が approved / merge直前相当の canonical termination に到達したところで停止し、人間へ handback すること。

    重要: 過去の impl_ready marker を Step 1 authority にしない

    Issue #2567 には refinement 完了コメントがあり、

    #2567 (comment)

    で LOOP_HANDOFF_RESULT_V1.status: impl_ready が記録されている。

    これは audit telemetry として参照してよいが、それ単独では Step 1 起動 authorization ではない。

    .claude/skills/impl-review-loop/SKILL.md と
    steps/preparation.md の
    Root-Owned Synchronous Entry Transition
    を厳密に守ること。

    root/main thread が同一の継続 invocation の中で、

    1. capability preflight
    2. live Issue 実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 fetch
    3. current-run issue-contract-review
    4. 直後の live Issue 再取得
    5. root entry routing
    6. route が invoke_impl_review_loop の場合のみ、その同じ control flow 内で Step 1 を直接起動

    まで実行すること。

    過去コメントの contract review result、handoff marker、body SHA、artifact、snapshot を再提示可能な authorization token のように扱わないこと。

    current main SHA は必ず remote/live ref から fresh readback すること。
    この prompt 作成時点では main は
    10bbcf85c0bd7c33fc25f07617488d27b254703d
    だったが、これを固定値として信頼せず、実行時に再確認すること。

    fresh contract review が body/base drift を検出した場合は、Root-Owned Entry Transition の canonical routing に従うこと。
    過去の impl_ready を理由に bypass しないこと。

    Skill readback

    最初に少なくとも以下を current checkout から読むこと。

    • .claude/skills/impl-review-loop/SKILL.md
    • .claude/skills/impl-review-loop/steps/preparation.md
    • .claude/skills/impl-review-loop/steps/step-1-implementation.md
    • .claude/skills/impl-review-loop/steps/step-2-verification.md
    • .claude/skills/impl-review-loop/steps/step-4-pr-review.md
    • .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
    • .claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md
    • .claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md
    • docs/dev/workflow.md

    Step 1 では implement-issue、Step 4 では pr-review-judge 等、skill が指定する subordinate skill/reference を必要な時点で読むこと。

    独自の簡易版 implementation loop を作らず、repository の canonical workflow を使うこと。

    Issue #2567 の現在の実装中心

    live Issue 本文を正本とすること。
    以下は technical recommendation であり、Issue 本文と current code を readback して最終判断すること。

    1. Claude-GPT launcher carrier

    scripts/claude-gpt/launch.sh で HOME/XDG isolation を行う前に canonical Task Context state root を解決する。

    既存の Task Context SSOT を再利用し、shell 側へ別の state-root resolution implementation を複製しないこと。

    意図する carrier contract は少なくとも:

    • inherited LOOP_TASK_CONTEXT_STATE_ROOT があれば preserve
    • inherited LOOP_TASK_CONTEXT_SCOPE があれば preserve
    • 通常 operator で scope 未設定時は current Issue contract に従う
    • launcher-owned LOOP_TASK_CONTEXT_RUNTIME_VARIANT=claude_gpt
    • isolated HOME の下に別 canonical Task Context DB を生成しない

    特に downstream #2568 の
    LOOP_TASK_CONTEXT_SCOPE=runtime_smoke
    と run-scoped state root を launcher が上書きしないこと。

    2. session registry resolution

    Claude-GPT の HOME/config isolation 下でも same-Task independent-session resolution が不要な unknown -> ASK に退化しないようにする。

    Issue contract に従い、session registry directory resolution を:

    1. LOOP_TASK_CONTEXT_SESSION_REGISTRY_DIR
    2. CLAUDE_CONFIG_DIR/sessions when CLAUDE_CONFIG_DIR is set
    3. native fallback ~/.claude/sessions

    の precedence で扱う。

    既存 Claude-Code-owned session registry を read-only で使用し、不必要な独自 peer registry を新設しないこと。

    3. runtime variant → ExecutionRun mapping

    LOOP_TASK_CONTEXT_RUNTIME_VARIANT=claude_gpt を単なる presentation label にせず、ExecutionRun lifecycle まで整合させる。

    少なくとも Claude-GPT variant について Issue の AC に従い:

    • run_kind=claude_gpt
    • runtime_profile=claude_gpt_v1
    • resume_profile=claude_gpt_v1

    を一貫して扱うこと。

    stale/open/latest/recovery lookup が native_operator 固定で残っていないか確認し、
    managed operator lifecycle として必要な箇所では

    • native_operator
    • claude_gpt

    の双方を対象にすること。

    Native → Claude-GPT、Claude-GPT → Native の runtime flavor 切替で Binding / Task / Activity identity を失わず、open managed-run unique invariant と衝突しないこと。

    Native profile ownershipについては live Issue の現在の contract を正本とし、#2569 の scope を勝手に先取りしないこと。

    4. launcher settings / hook coexistence

    Task Context 統合を理由に Claude-GPT launcher の既存 policy boundary を弱めないこと。

    特に:

    • caller supplied --settings 等の forbidden / policy-weakening flag を解禁しない
    • project/local crossSessionInbound を固定値へ戻さない
    • Claude Code native default + Task Context-aware SendMessage guard の current contract を維持
    • Task Context hooks と launcher-owned hooks/settings/statusLine の双方が actual launcher で生存すること
    • 同一 event の handler execution order に依存する設計を作らない
    • Task Context PreToolUse safe path が explicit allow を返して Auto/Agent permission gate を横取りしない
    • Spark custom authorization state machine を復活させない
    • current launcher-owned Auto / UserPromptSubmit retirement semantics を横取りしない

    こと。

    Allowed Paths

    必ず live Issue #2567 の Allowed Paths を fresh parse して gate の正本にすること。

    現時点の contract では write-capable scope は概ね:

    • scripts/claude-gpt/**
    • scripts/task-context/**
    • tests/task-context/**

    である。

    live Issue がこれと異なる場合は live body を優先すること。

    Allowed Paths 外へ変更が必要になった場合、勝手に scope expansion しない。
    canonical routing / reviewer verdict に従うこと。

    Herdr cold restore dispatcher/shim、
    worktree-agent-runtime-smoke 本体 wiring、
    user/global Claude settings、
    Task Context v1 の大規模再設計などを本 PR に混入させないこと。

    SubAgent orchestration — 必須

    impl-review-loop が指定する SubAgent を実際に使うこと。

    最低限:

    • Step 1: implementation-worker
    • Step 2: test-runner
    • Step 4: pr-reviewer

    を canonical call shape で起動すること。

    重要:

    • SubAgent を fire-and-forget にしない。
    • 起動したすべての SubAgent の作業完了を必ず待つこと。
    • spawn_agent 後、final structured result を取得するまで次 phase へ進まないこと。
    • 複数の独立 read-only SubAgent を並列化した場合も、全件 join してから routing すること。
    • main/root thread が LOOP_STATE、final routing、iteration、mutation authorization を保持すること。
    • SubAgent の散文 summary で structured result を上書きしないこと。
    • SubAgent からさらに SubAgent を起動する nested delegation は、skill が明示的に許可しない限り行わないこと。
    • 必要な sequential delegation は root/main thread が orchestration すること。

    implementation-worker には actual Issue number / full URL / live Allowed Paths / serialized fix_delta を具体値として渡すこと。
    placeholder のまま渡さないこと。

    各 iteration の Step 完了後に LOOP_STATE を更新すること。

    Step 1 — Implementation

    current live Issue / current main / current worktree を基準に実装する。

    既存の canonical issue worktree がある場合は skill の identity validation に従って使用すること。
    root checkout、detached HEAD、dirty state 等の hard boundary を勝手に修復・破壊しないこと。

    実装前に current code を読み、既存 SSOT / helper / resolver を優先して再利用する。

    「Issue が要求しているから」という理由だけで不要な abstraction、sandbox、registry、巨大 harness を追加しないこと。

    個人趣味開発として quality / usefulness / maintainability と通常 workflow の摩擦の少なさを優先する。

    既存 behavior を満たす最小かつ十分な変更にする。

    1 Issue = 1 PR を守り、PR は #2567 を構造化して close できる形で関連付ける。

    Step 2 — Verification

    test-runner を implementation-worker とは独立して実行し、
    live Issue の Verification Commands と acceptance criteria を current HEAD に対して評価すること。

    Issue 本文にある:

    uv run --locked pytest tests/task-context -q

    だけで終わらせず、Issue の指示どおり scripts/claude-gpt 側の既存 canonical test command を repository から readback して実行すること。

    Verification Command の baseline classification / adjudication は skill の canonical machinery を使うこと。
    独自判定へ置き換えない。

    runtime verification については Issue の Runtime Verification Applicability を守ること。

    対象 runtime が利用可能なら、巨大な新 harness を追加せず、bounded / disposable な actual launcher canary で少なくとも contract が要求する以下を確認する:

    • Native / Claude-GPT が同じ canonical Task Context DB を使用
    • isolated HOME に別 canonical DB が生えない
    • inherited STATE_ROOT / SCOPE の preservation
    • Claude-GPT ExecutionRun の run_kind/runtime_profile/resume_profile
    • managed-run recovery / runtime flavor switch invariant
    • CLAUDE_CONFIG_DIR 配下の actual session registry name → sessionId resolution
    • project Task Context hook / launcher-owned hook / statusLine の共存
    • Task Context PreToolUse が Auto/Agent permission semantics を横取りしない

    Issue の skip condition に該当する環境なら runtime verification は正直に SKIP とし、
    static/unit test を runtime PASS と偽装しないこと。

    secret 値、raw credential、不要な full environment を evidence に残さないこと。

    Step 4 — PR Review

    verification の current-head gate が通った場合のみ、pr-reviewer / pr-review-judge を current PR HEAD に対して起動する。

    reviewer は current Issue contract、Allowed Paths、diff、tests、CI、runtime evidence を確認すること。

    レビューは「通すためのレビュー」ではなく、実装の correctness / regression / contract fidelity を厳密に評価させる。

    ただし、本 Issue の scope を超えた generic security hardening、新規 sandbox、巨大 harness を blocker 化しないこと。

    reviewer の structured result:

    • verdict
    • reviewed_head_sha
    • blockers
    • warnings

    をそのまま Step 5 の canonical router へ渡すこと。

    APPROVE の自己申告だけで完了扱いしない。
    live mergeability と blockers を root/control-plane が別途確認すること。

    Step 5 — 自律 feedback loop

    route_loop_verdict_v2() の result を正本として routing する。

    • approved

      • canonical loop を終了
      • merge はしない
    • continue_loop

      • blockers を serialized fix_delta として次の implementation-worker に渡す
      • 修正後、Step 2 と Step 4 を再実行
    • route_to_update_branch

      • skill の mechanical update_branch action を implementation-worker に委譲
      • 完了を待つ
      • verification と PR review を再実行
    • route_stale_head_rereview

      • current head に対して review をやり直す
    • route_scope_clean_reconciliation

      • canonical evidence rebind 手順を実行し、必要な証跡だけ再取得して Step 5 を resume
    • already_satisfied

      • canonical recommendation を報告
      • PR/Issue を勝手に close しない
    • route_human_escalation

      • canonical blocker を報告して停止
    • actual conflict

      • conflicting PR escalation runbook に従う
    • schema/mergeability の一時的 fail-closed

      • skill の bounded retry / CI evaluator routing に従う
      • 単なる UNKNOWN / BLOCKED / UNSTABLE を即人間承認要求へ変換しない

    human_review_required: true という Step 1-4 SubAgent の boolean 自己申告だけでは止まらないこと。
    skill が定義する formal verdict / live human veto / hard boundary と区別すること。

    Iteration

    canonical default の max_iterations=3 を使用すること。
    この prompt を理由に上限を無限化しないこと。

    iteration の余裕があり REQUEST_CHANGES が修正可能なら、人間へ聞かず次 iteration を実行すること。

    iteration 上限に達した場合は fail-close し、未解決 blocker を具体的に報告すること。

    外部調査

    実装中に Claude Code の current external specification が実装判断を左右する場合のみ、impl-review-loop が規定する external research route を使用すること。

    既に Issue refinement で確定した contract を再調査するだけのために unnecessary な外部調査を増やさない。

    外部調査を skip した場合は LOOP_STATE.external_research_skip_basis に理由を記録すること。

    やってはいけないこと

    完了条件

    通常承認なしで可能な限り反復し、最終的に canonical impl-review-loop が以下相当へ到達した時点で停止すること:

    • implementation completed
    • Issue AC/VC verification completed
    • current-head independent verification completed
    • required CI / runtime evidence が current contract に対して評価済み
    • current PR HEAD に対する pr-reviewer verdict が APPROVE
    • reviewer blockers が空
    • live mergeability が skill の approvable state
    • Allowed Paths gate が満たされている
    • PR が merge 以外に implementation/review loop 起因の修正を必要としない

    merge は実行しない。

    最終 handback

    終了時は簡潔に、ただし routing-critical 情報を落とさず報告すること。

    最低限:

    • current live main SHA
    • Issue 実装: Claude-GPTをcanonical Task Context DBとoperator runtime profileへ統合する #2567 の final body SHA / fresh contract review result
    • root entry route
    • worktree
    • branch
    • PR number / URL
    • final PR HEAD SHA
    • iteration count
    • 使用した SubAgent と各 structured result の要点
    • 実装した主要変更
    • Allowed Paths gate 結果
    • Verification Commands の結果
    • Claude-GPT canonical tests の結果
    • runtime verification の PASS / FAIL / SKIP と evidence
    • CI status
    • final reviewer verdict
    • live mergeability
    • remaining blockers / warnings
    • canonical termination reason
    • merge performed: no

    を含めること。

    blocker が無ければ、人間が残す判断を merge のみ に近づけた状態で handback すること。

    このプロンプトでは、最新の refinement 結果を活用しつつ、それを実装権限としてショートカットしない点を強くしています。特に #2567 は launcher isolation・session registry・managed run lifecycle が絡むため、実装 worker と独立 test-runner、current-head reviewer をきちんと分離して全完了を待つ構成が適しています。

  5. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  6. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-21T03:09:41Z)

  7. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-21T13:10:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2696"
      head_sha: "ad0f258899514aee5faeabdcf894e5939dd044e0"
      issue_number: 2567
      termination_reason: approved
      merge_ready: true
      iteration: 0
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "pr2696-stale-pytest-count-in-body"
          source_url: "https://github.com/squne121/loop-protocol/pull/2696"
          source_note_id: "pr-reviewer-step4-warning-1"
          summary: "PR body self-reported scripts/claude-gpt pytest count (431 passed) is stale vs. independently re-verified live result (435 passed); non-blocking documentation drift only."
        - dedupe_key: "ac-evidence-checks-heading-drift"
          source_url: "https://github.com/squne121/loop-protocol/pull/2696"
          source_note_id: "pr-reviewer-step4-warning-2"
          summary: "references/ac-evidence-checks.md names PR-body heading strings that no longer match .github/pull_request_template.md; documentation-only drift, not a blocker."
  8. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-21T05:15:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2696"
      head_sha: "640a747b8577ff11807cf15ecb78646c8f91e97b"
      issue_number: 2567
      termination_reason: approved
      merge_ready: true
      iteration: 0
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "task-context-v1:mixed-runtime-live-canary"
          source_url: "https://github.com/squne121/loop-protocol/pull/2696"
          source_note_id: "pr-reviewer-warning-2"
          summary: "P1-2の実機二重ランタイムListAgents/SendMessage canaryは本環境未実施。マージ前または後続#2568検証時に実施を推奨。"
    
    ISSUE_SCOPE_ROLLUP_DECISION_V2:
      schema_version: 2
      recorded_at: "2026-09-21T05:15:00Z"
      rollup_plan_ref:
        body_sha256: null
        generated_at: null
      decision: skipped
      executed_actions: []
      skipped_reason: "advisory diagnostic not manually invoked for this iteration"
      candidates_reviewed: []
  9. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-09-21T05:40:00Z)

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: post-merge-cleanup
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "task-context-v1:claude-gpt-native-peer-discovery-live-canary"
          source_url: "https://github.com/squne121/loop-protocol/pull/2696"
          source_note_id: "post-merge-cleanup-worker-follow-up-candidate"
          summary: "候補は#2570のAC6(same-Task point-to-point SendMessage到達性)と重複するため新規Issue化せず、#2570へコメントとして引き継ぎ済み(https://github.com/squne121/loop-protocol/issues/2570#issuecomment-5755910019)。"
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