Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#733"
goal_ref: "M3: Loop MVP Gate — sortie の terminal result から debrief / preparation へ遷移する headless loop phase state machine と reward-claim handoff を固定する"
change_kind: codeParent Issue
Parent Goal Ref
- Goal: M3: Loop MVP Gate (v0.3.x) として sortie 結果から報酬を獲得し localStorage へ進行を永続化して reload 後に復元する
- Desired Destination:
src/state/GameState.tsとsrc/systems/SortieSystem.tsにpreparation / running / debrief_pending_reward / debrief_reward_claimedの headless loop phase state machine と reward claim handoff を追加し、src/main.tsの bootstrap 即時 sortie 開始を preparation 経由へ置き換える
Current Validated Scope
src/state/GameState.tsにはSortieStatus = 'idle' | 'running' | 'victory' | 'defeat' | 'timeout' | 'ended'と terminalSortieResultが実装済みsrc/systems/SortieSystem.tsは defeat > victory > timeout の優先順位で terminal result を latch し、running以外では simulation step を進めないsrc/main.tsは bootstrap 時と reset 後の両方でstartSortie()を即時実行しており、明示的な preparation phase は未実装docs/product/features/sortie.mdはtimeoutを terminal outcome として定義しているdocs/product/features/quick-save.mdは Quick Save を progression-only snapshot と定義し、sortie / enemies / projectiles / active result を保存対象外としている#737は CLOSED、関連 PR feat(reward): add RewardSystem exactly-once claims #769 は 2026-06-08 に MERGED 済みで、RewardSystem.claim(state, applicationId, result)契約は upstream dependency として利用可能src/ui/HudController.tsの action surface はQuick save/Reset sortieのみであり、Start / Claim / Next / Quick Load の UI 操作面は本 issue の Allowed Paths 外にある
Remaining Parent Gaps
- Quick Save / Quick Load の phase-aware policy 実装と UI wiring(既存 feat(#483): Quick Save を準備フェーズ限定に制限し Quick Load を実装する #619 / feat(#483): Quick Save ボタンの有効/無効表示と最小限のフィードバックを実装する #620 で扱う。
debrief_pending_rewardとdebrief_reward_claimedの差分を domain policy に反映する) - reward claim 後の progression snapshot 保存と reload 後復元(別 child issue: 実装: 報酬確定時に progression snapshot を localStorage へ保存する #739)
- sortie→reward→reload 復元の browser runtime E2E / playtest 証跡(別 child issue: 実装: M3 loop の sortie→reward→reload 復元を E2E / playtest で検証する #740)
- preparation / debrief phase の最小 HUD 操作面(Start sortie / Claim reward / Next sortie / Quick Load)の導入(follow-up issue で扱う)
Outcome
src/state/GameState.ts と src/systems/SortieSystem.ts に preparation / running / debrief_pending_reward / debrief_reward_claimed の headless loop phase state machine が導入され、victory / defeat / timeout の全 terminal outcome で pendingRewardApplicationId を伴う debrief handoff が一意に定義され、報酬 claim 後は次 sortie 開始まで simulation が進行せず、src/main.ts の bootstrap 即時 sortie 開始が preparation 経由に置き換わる。tests/sortie-system.test.ts に timeout / bootstrap preparation / same-token no-op / terminal halt / next sortie reset を含む regression test が追加され、pnpm typecheck / pnpm lint / pnpm test / pnpm build が通る状態にする。
In Scope
src/state/GameState.tsにLoopPhase = 'preparation' | 'running' | 'debrief_pending_reward' | 'debrief_reward_claimed'を追加するSortieStatusは combat result FSM として維持し、loop phase と責務分離するsrc/systems/SortieSystem.tsにvictory / defeat / timeout -> debrief_pending_rewardの terminal handoff を追加する- terminal handoff 時に一度だけ
pendingRewardApplicationIdを生成・保持し、RewardSystem.claim(...)成功でdebrief_reward_claimedへ遷移する contract を固定する same-tokenの reward claim を no-op / already-claimed として扱う state transition を追加するsrc/main.tsの bootstrap 即時 sortie 開始をやめ、preparation からの明示開始に切り替える- reward claim 後から次 sortie 開始まで combat simulation、spawn、projectile、AI、collision、tick、elapsedMs が進行しないことを固定する
tests/sortie-system.test.tsに timeout transition、bootstrap preparation、same-token no-op、terminal halt、next sortie reset の regression test を追加する
Out of Scope
src/ui/HudController.tsを含む HUD / button / overlay の UI 実装- Start sortie / Claim reward / Next sortie / Quick Load の具体的な操作面導入
- Quick Save / Quick Load の UI feedback や enabled/disabled 表示
- reward 計算ロジック本体の変更
- progression snapshot の localStorage 保存 wiring
- reload 後の再 claim 不可の end-to-end 証明
- weapon upgrade / resource 消費ロジック(M4 スコープ)
Runtime Verification Applicability
applicability: deferred
decision: deferred
reason: phase state machine と same-token no-op は unit test で決定論的に検証できるが、reward claim 後の reload 復元・Quick Save/Load UI の可視挙動・timeout debrief の browser runtime 証跡は #739 と #740 がそろって初めて確認できるため
deferred_destination: "#740"
deferred_verification_condition: #739 で reward claim 後の progression snapshot 保存と reload 復元が接続された後、#740 の browser runtime E2E / playtest で (1) bootstrap 後 preparation 表示、(2) timeout を含む terminal outcome から debrief に入ること、(3) reward claim 後 reload 復元が成立することを確認できること
Acceptance Criteria
- AC1:
victory/defeat/timeoutの全 terminal outcome がdebrief_pending_rewardへ遷移する - AC2:
LoopPhase = preparation | running | debrief_pending_reward | debrief_reward_claimedがSortieStatusと別責務で一意に定義される - AC3:
debrief_pending_rewardへ入る瞬間に一度だけpendingRewardApplicationIdが生成され、RewardSystem.claim(state, pendingRewardApplicationId, state.sortie.result)成功でdebrief_reward_claimedへ遷移する - AC4: 同一
pendingRewardApplicationIdに対する再 claim はprogress.resourcesを増やさない no-op / already-claimed になる - AC5: bootstrap 直後の初期状態は
loopPhase='preparation'であり、明示開始までは sortie simulation が進行しない - AC6: reward claim 後から次 sortie 開始まで combat simulation、spawn、projectile、AI、collision、tick、elapsedMs が進行しない
- AC7: 次 sortie 開始時に combat runtime state は reset されるが、progression state は保持される
- AC8:
tests/sortie-system.test.tsが timeout transition、bootstrap preparation、same-token no-op、terminal halt、next sortie reset を検証する - AC9:
pnpm typecheck/pnpm lint/pnpm test/pnpm buildが通る
Verification Commands
# AC1
$ rg -n "debrief_pending_reward" src/systems/SortieSystem.ts tests/sortie-system.test.ts
# AC2
$ rg -n "LoopPhase.*preparation|LoopPhase.*running|LoopPhase.*debrief_pending_reward|LoopPhase.*debrief_reward_claimed" src/state/GameState.ts
# AC3
$ rg -n "pendingRewardApplicationId|RewardSystem\.claim" src/state/GameState.ts src/systems/SortieSystem.ts tests/sortie-system.test.ts
# AC4
$ rg -n "same-token|already-claimed|no-op" tests/sortie-system.test.ts
# AC5
$ rg -n "bootstrap preparation|loopPhase='preparation'|preparation before start" tests/sortie-system.test.ts
# AC6
$ rg -n "terminal halt|does not advance after claim|does not advance outside running" tests/sortie-system.test.ts
# AC7
$ rg -n "next sortie reset|resets combat runtime|preserves progression" tests/sortie-system.test.ts
# AC8
$ rg -n "timeout transition|bootstrap preparation|same-token no-op|terminal halt|next sortie reset" tests/sortie-system.test.ts
# AC9
# preflight-scope: pr_review_only
$ pnpm typecheck
# preflight-scope: pr_review_only
$ pnpm lint
# preflight-scope: pr_review_only
$ pnpm test
# preflight-scope: pr_review_only
$ pnpm buildAllowed Paths
src/state/GameState.tssrc/systems/SortieSystem.tssrc/main.tstests/sortie-system.test.ts
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- HUD / button / overlay の UI 操作面を同一 PR に含めないと acceptance を満たせないと判明した場合
- pending reward を snapshot 永続化しないと contract を成立できないと判明した場合
Required Skills
- TypeScript / TSC strict
- ECS(state / systems 分離)/ state machine
- deterministic state transition 設計
- Vitest BDD
Notes
- 2026-06-09 owner comment
#issuecomment-4658868235のうち、timeoutterminal、bootstrap 即時startSortie()、progression-only snapshot、HUD action surface不足の指摘は repo fact と整合するため本文へ反映した - 同コメント内の「実装: SortieResult から報酬を算出する RewardSystem を追加する #737 / PR feat(reward): add RewardSystem exactly-once claims #769 は未確定・Draft・merge readiness 未成立」は 2026-06-09 時点では stale であり、
#737CLOSED /PR #769MERGED 済みへ正規化した - 本 issue は headless domain state machine と reward-claim handoff に絞る。UI surface は follow-up issue と feat(#483): Quick Save ボタンの有効/無効表示と最小限のフィードバックを実装する #620 側で扱う
Activity
squne121 commentedon Jun 9, 2026
1. 総合判定
種別: Issue
判定: BLOCKED
判定理由: Issue 実装: sortie 後の debrief / preparation フェーズを導入する #738 は実装 Issue として読めますが、現状のまま実装に進むには設計契約が不足しています。最大の問題は、既存仕様・既存コード・依存 Issue が
timeoutを terminal outcome として扱っているのに、実装: sortie 後の debrief / preparation フェーズを導入する #738 の受け入れ条件はvictory / defeatのみを debrief 対象にしている点です。docs/product/features/sortie.mdはvictory / defeat / timeoutを result-latched state と定義し、timeout -> endedの遷移も規定しています。([GitHub]1) 一方 実装: sortie 後の debrief / preparation フェーズを導入する #738 の AC1 はvictory / defeatのみを対象にしています。([GitHub]2)マージまたは実装に進むための必須条件:
timeoutを debrief / reward / preparation 遷移の対象に含める。preparation / running / debrief_pending_reward / debrief_reward_claimedの phase state machine を 実装: sortie 後の debrief / preparation フェーズを導入する #738 に明記する。([GitHub]3)applicationIdと exactly-once claim の契約を確定・マージしてから 実装: sortie 後の debrief / preparation フェーズを導入する #738 の実装に進む。feat(reward): add RewardSystem exactly-once claims #769 は Draft で、レビューコメント上も required checks pending により merge readiness が確立していません。([GitHub]4)debrief_pending_rewardとdebrief_reward_claimedで別扱いする。src/ui/HudController.tsなど UI 層を含めるか、実装: sortie 後の debrief / preparation フェーズを導入する #738 は headless domain state のみに絞る。現 HUD は Quick save / Reset sortie しか持たず、claim reward / start sortie / next sortie 操作面がありません。([GitHub]5)2. 確認できた情報
タイトル:
実装: sortie 後の debrief / preparation フェーズを導入する #738。Issue は Open です。([GitHub]2)目的: M3 Loop MVP Gate の一部として、sortie 終了後に simulation を止め、debrief / preparation で報酬確定・保存・次 sortie 開始を扱える状態遷移を導入することです。([GitHub]2)
背景:
resourcesに反映し、localStorage snapshot へ保存し、reload 後に復元する M3 delivery-rollup です。([GitHub]3)src/main.tsは現在、初期化後にstartSortie()を直接呼び出しています。([GitHub]7)変更範囲:
GameState.tsへの loop phase 表現、SortieSystem.tsへの debrief / preparation 遷移、main.tsの起動直後startSortie()見直し、報酬確定後の simulation 停止、Quick Save / Quick Load 境界定義、tests/sortie-system.test.tsの regression test 追加。([GitHub]2)src/state/GameState.ts,src/systems/SortieSystem.ts,src/main.ts,tests/sortie-system.test.ts。([GitHub]2)関連情報:
#737 RewardSystem,#619/#620 Quick Save phase / HUD policy,#738 debrief / preparation state machine,#739 autosave / reload wiringの順を指定しています。([GitHub]3)RewardSystem.claim(state, applicationId, result)を定義し、terminal transition token の生成・wiring は 実装: sortie 後の debrief / preparation フェーズを導入する #738 側の責務として残しています。([GitHub]8)resources / weaponPower / playerMaxHpのみです。sortie / enemies / projectiles / cooldown / result / runtime は復元されません。([GitHub]9)ラベル:
agent/implementer,enhancement,phase/implementation。([GitHub]2)Milestone:
M3: Loop MVP Gate (v0.3.x)。([GitHub]2)Assignee: なし。([GitHub]2)
関連 PR:
CI / テスト状況:
pnpm typecheck,pnpm lint,pnpm test,pnpm buildが列挙されていますが、実行済み証跡ではありません。([GitHub]2)確認できなかった情報:
3. 成功条件・失敗条件
明示要件
SortieStatus活用またはloopPhase追加のどちらかに固定する。([GitHub]2)tests/sortie-system.test.tsに debrief / preparation regression test を追加し、pnpm typecheck && pnpm lint && pnpm test && pnpm buildを通す。([GitHub]2)暗黙要件
timeoutterminal も debrief / reward / preparation の対象に含める必要があります。既存 Sortie FSM はtimeoutを result-latched state とし、timeout -> endedを規定しています。([GitHub]1)applicationId生成・保持・消費が必要です。実装: SortieResult から報酬を算出する RewardSystem を追加する #737 はその wiring を 実装: sortie 後の debrief / preparation フェーズを導入する #738 側に残しています。([GitHub]8)canQuickSave(phase)/canQuickLoad(phase)相当の phase 由来 policy を要求しています。([GitHub]3)src/systemsは DOM / Canvas API に直接依存してはいけません。ADR 0001 はsystemsを 60Hz 更新ロジックに限定し、uiは DOM、renderは Canvas、storageは snapshot 境界として分離する方針を定めています。([GitHub]10)成功条件
preparationであり、明示操作までrunSortieSimulationStep()が combat systems を進めない。preparation -> running -> debrief_pending_reward -> debrief_reward_claimed -> preparationの状態遷移が一意に定義されている。victory,defeat,timeoutの全 terminal outcome で debrief に入り、結果は一度だけ latch される。debrief_pending_rewardで生成されたapplicationIdが RewardSystem に渡され、同一 sortie lifecycle に対する reward は最大 1 回だけ適用される。runningとdebrief_pending_rewardでは安全に拒否される。sortie-system.test.tsが phase transition、timeout、double claim、Quick Save / Load policy、next sortie reset を検証する。失敗条件
timeoutで debrief に入れない。runningへ入る。debrief_pending_rewardで Quick Save して reload した結果、reward が消失または再 claim 可能になる。4. 最重要リスク Top 5
1.
timeoutが debrief / reward 対象から落ちている重大度: Critical
種別: 仕様 / 設計 / テスト
内容: 実装: sortie 後の debrief / preparation フェーズを導入する #738 の AC1 は
victory / defeat到達後の debrief のみを要求していますが、既存 Sortie FSM と SortieResult はtimeoutを terminal outcome として持ちます。docs/product/features/sortie.mdはvictory / defeat / timeoutを result-latched state とし、timeout -> endedも規定しています。([GitHub]1)なぜ問題か: 30 秒タイムアウト時だけ報酬確定・保存・次 sortie 開始の loop から漏れます。M3 parent は sortie→reward→resources→localStorage→reload 復元を end-to-end で確認することを要求しているため、timeout 漏れは M3 loop の仕様不備です。([GitHub]3)
該当箇所: 実装: sortie 後の debrief / preparation フェーズを導入する #738 AC1。([GitHub]2) 既存
GameState.tsのSortieStatus/SortieResultにはtimeoutが含まれています。([GitHub]11)修正案:
victory / defeat / timeoutに到達した後」に変更する。running -> timeout -> debrief_pending_rewardの遷移を明示する。確認テスト:
elapsedTicks = targetTicks - 1, live enemy remaining,runSortieSystem()後にtimeoutresult が latch され、その直後にdebrief_pending_rewardへ遷移する。resourcesが timeout formula どおり増え、phase がdebrief_reward_claimedになる。tick,elapsedMs, enemies, projectiles が変化しない。2. exactly-once reward の handoff が #738 側で未定義
重大度: Critical
種別: 設計 / 実装 / セキュリティ / テスト
内容: 親 導入: M3 Loop MVP Gate を報酬→resource→localStorage 永続化まで接続する #733 は reward を同一 sortie result に exactly once 適用することを求めています。([GitHub]3) 実装: SortieResult から報酬を算出する RewardSystem を追加する #737 は RewardSystem 側で
claim(state, applicationId, result)を実装する前提ですが、terminal transition token の生成・消費 wiring は 実装: sortie 後の debrief / preparation フェーズを導入する #738 に残されています。([GitHub]8) 実装: sortie 後の debrief / preparation フェーズを導入する #738 本文にはapplicationId,pendingReward,claimed,lastClaimedSortieIdなどの具体契約がありません。なぜ問題か: debrief 実装時に result object の identity、outcome payload、UI click 回数、reload 後復元状態のどれを claim 単位にするかが曖昧になります。結果として double claim、reward 消失、同一 payload の別 sortie を誤って拒否する実装が入り得ます。
該当箇所: 実装: sortie 後の debrief / preparation フェーズを導入する #738 In Scope / AC には reward 確定後の停止はあるが、terminal transition token は明記されていません。([GitHub]2)
修正案:
SortieTerminalEventまたはRewardApplicationIdの生成規則を 実装: sortie 後の debrief / preparation フェーズを導入する #738 に追加する。state.loopPhase = 'debrief_pending_reward'に入る瞬間に一度だけpendingRewardApplicationIdを生成する。RewardSystem.claim(state, pendingRewardApplicationId, state.sortie.result)成功後にdebrief_reward_claimedへ遷移する。claimがalready-claimedの場合も state を破壊しない。確認テスト:
pendingRewardApplicationIdで 2 回 claim しても resources は 1 回分だけ増える。SortieResultpayload でも次 sortie の別applicationIdなら別 claim として加算される。3. phase model が親契約より弱く、状態名・遷移表が不足している
重大度: High
種別: 仕様 / 設計 / 保守性
内容: 実装: sortie 後の debrief / preparation フェーズを導入する #738 は
SortieStatus活用またはloopPhase追加のどちらでもよいとしていますが、親 導入: M3 Loop MVP Gate を報酬→resource→localStorage 永続化まで接続する #733 はpreparation / running / debrief_pending_reward / debrief_reward_claimedを phase state machine として固定すると記載しています。([GitHub]3)なぜ問題か:
SortieStatusは combat result の latch 状態、loopPhaseは product loop の操作可能状態です。これを混同すると、victoryという combat outcome とdebrief_pending_rewardという UI/domain phase が同一 enum に混ざり、Quick Save / Load policy、reward claim、next sortie reset の責務が不明確になります。該当箇所: 実装: sortie 後の debrief / preparation フェーズを導入する #738 AC4。([GitHub]2) 既存
GameState.tsではSortieStatusがidle | running | victory | defeat | timeout | endedで、M2 の terminal outcome を表しています。([GitHub]11)修正案:
SortieStatusは既存の combat result FSM として維持する。LoopPhase = 'preparation' | 'running' | 'debrief_pending_reward' | 'debrief_reward_claimed'を追加する。SortieStatusとLoopPhaseの対応を明記する。例:loopPhase='running'のときだけsortie.status='running'を許す。sortie.status in ['victory','defeat','timeout']になった tick でloopPhase='debrief_pending_reward'に遷移する。確認テスト:
loopPhase='preparation',sortie.status='idle'。loopPhase='running',sortie.status='running'。loopPhase='debrief_pending_reward',sortie.result != null。loopPhase='debrief_reward_claimed'。loopPhase='preparation',sortie.status='idle'。4. Quick Save / Quick Load の許可境界が「debrief」で粗すぎる
重大度: High
種別: セキュリティ / 仕様 / 運用 / テスト
内容: 実装: sortie 後の debrief / preparation フェーズを導入する #738 AC5 は Quick Save / Quick Load を preparation / debrief 限定で許可としています。([GitHub]2) しかし Quick Save は progression-only snapshot であり、sortie result / runtime は保存されません。([GitHub]9) そのため
debrief_pending_rewardとdebrief_reward_claimedを区別しないと、pending reward の保存・読込で reward 消失または二重 claim の設計穴ができます。なぜ問題か: pending reward 中に save すると snapshot には未 claim の result が残らないため、reload 後に reward を失う可能性があります。逆に result や pending token をどこかに残す実装を入れると、親の「SortieResult は永続化しない」方針と衝突します。親 導入: M3 Loop MVP Gate を報酬→resource→localStorage 永続化まで接続する #733 は M3 snapshot を progression のみにし、combat runtime state や active SortieResult を保存しないと決めています。([GitHub]3)
該当箇所: 実装: sortie 後の debrief / preparation フェーズを導入する #738 AC5、Quick Save docs の保存対象・非保存対象。([GitHub]2)
修正案:
canQuickSave(phase)はpreparationとdebrief_reward_claimedのみ true にする。debrief_pending_rewardでは Quick Save / Quick Load を拒否するか、Quick Save 前に atomic claim を強制する。ただし atomic claim を選ぶなら storage failure 時の挙動を 実装: 報酬確定時に progression snapshot を localStorage へ保存する #739/実装(M3): LocalGameStorage の例外境界と Result 契約を実装する #621 と整合させる。canQuickLoad(phase)は少なくともrunningとdebrief_pending_rewardで false にする。確認テスト:
debrief_pending_rewardでcanQuickSaveとcanQuickLoadが false。debrief_reward_claimedで Quick Save 可能。runningでは Quick Save / Load が false。5. Allowed Paths と実際に必要な UI / HUD 変更が噛み合っていない
重大度: High
種別: スコープ / 設計 / 保守性 / テスト
内容: 実装: sortie 後の debrief / preparation フェーズを導入する #738 は debrief / preparation 操作を可能にするとしていますが、Allowed Paths は
src/ui/HudController.tsを含みません。([GitHub]2) 現 HUD の actions はonQuickSave()とonReset()のみで、表示ボタンも Quick save / Reset sortie のみです。([GitHub]5)なぜ問題か: preparation から sortie を開始する、debrief で reward を claim する、next sortie に進む、Quick Save / Load を phase に応じて disable する、といった「操作」を実装するには UI 層または action surface の変更が必要です。Allowed Paths 内だけで対応すると、domain state はできてもユーザー操作不能、または
main.tsに UI 分岐を押し込む責務違反になりやすいです。該当箇所: 実装: sortie 後の debrief / preparation フェーズを導入する #738 Outcome / Allowed Paths、現 HUD implementation。([GitHub]2)
修正案:
src/ui/HudController.tsと UI tests を追加し、最低限のStart sortie,Claim reward,Next sortie,Quick load操作面まで含める。main.tsは orchestration に限定し、HUD は phase と policy を表示・操作する薄い adapter にする。確認テスト:
5. 技術的適切さの評価
現在の設計・実装方針の妥当性:
runSortieSimulationStep()はstate.sortie.status !== 'running'なら return するため、terminal 後に combat systems を止める基本構造はあります。([GitHub]12)SortieStatusを拡張して全部を表すより、LoopPhaseを別に持つ方が安全です。代替案:
推奨案:
SortieStatusは既存どおり combat lifecycle に限定し、GameStateにloopPhaseとpendingRewardApplicationIdを追加する。関数例:
canStartSortie(state): booleanstartSortieFromPreparation(state, fixedDeltaMs): StartSortieResultadvanceLoopAfterTerminal(state): voidclaimPendingReward(state): RewardClaimResultprepareNextSortie(state): voidcanQuickSave(state): booleancanQuickLoad(state): boolean代替案を採るべき条件:
SortieStatusを変更するとHudController, tests, E2E snapshot, render overlay など既存 consumer に広範囲影響が出る場合。debrief_pending_reward / debrief_reward_claimed契約に合わせる場合。([GitHub]3)既存アーキテクチャとの整合性:
systemsは state transition のみ、uiは DOM、storageは snapshot 境界という ADR に合わせるべきです。([GitHub]10)将来の保守性:
loopPhaseを明示すれば M4 の Upgrade Loop、future campaign、manual checkpoint へ拡張しやすいです。SortieStatusに preparation/debrief を詰め込むと、combat outcome と product loop phase が同じ union に混在し、将来の分岐が壊れやすくなります。6. 仕様・要件との不一致
SortieStatus = 'idle' | 'running' | 'victory' | 'defeat' | 'ended'と書いていますが、現行GameState.tsにはtimeoutも含まれています。([GitHub]2)victory / defeatだけですが、既存 sortie spec はtimeoutを result-latched state として定義しています。([GitHub]2)SortieStatus活用またはloopPhase追加の二択に留めていますが、親 導入: M3 Loop MVP Gate を報酬→resource→localStorage 永続化まで接続する #733 は具体的な phase state machine を固定しています。([GitHub]3)7. 反例・境界条件・異常系
ケース: 30 秒 timeout で sortie 終了。
victory / defeatだけを debrief 対象にした実装では timeout が報酬・保存・次 sortie loop に入らない。victory / defeatのみ。([GitHub]2)timeout -> debrief_pending_reward -> debrief_reward_claimedを追加し、timeout reward test を入れる。ケース: reward claim button を連打する。
applicationIdを一度だけ生成し、claim 後は phase をdebrief_reward_claimedに固定する。ケース:
debrief_pending_reward中に Quick Save して reload。ケース: boot 直後。
startSortie()が即時実行され、preparation が存在しない。startSortie()を呼びます。([GitHub]7)loopPhase='preparation',sortie.status='idle'に留め、明示 start 操作まで simulation step を進めない。ケース: terminal 後に requestAnimationFrame は継続する。
runSortieSimulationStep()はsortie.status !== 'running'で return します。([GitHub]12) ただし 実装: sortie 後の debrief / preparation フェーズを導入する #738 の phase 追加後も同じ不変条件を守る必要があります。loopPhase !== 'running'のときも combat systems、tick、elapsedMs が進まない test を追加する。ケース: next sortie 開始。
ケース: UI disabled を迂回して handler を直接呼ぶ。
canQuickSave(state)/canQuickLoad(state)を action handler 側でも必ずチェックする。8. セキュリティ・プライバシー観点
resourcesを将来サーバー同期・ランキング・実績などに使う場合、localStorage 値を信用してはいけません。debrief_pending_rewardでは Quick Save / Load を拒否するのが最も単純で安全です。innerHTMLではなくtextContentを使う方針を明記すべきです。9. テスト不足
不足しているテスト: timeout debrief transition
timeoutが M3 loop から漏れないことを保証する。elapsedTicks = targetTicks - 1、次 tick で timeout。sortie.result.outcome='timeout',loopPhase='debrief_pending_reward', reward claim 可能。不足しているテスト: boot preparation
createInitialGameState()後、明示 start 前に simulation step を複数回呼ぶ。loopPhase='preparation',sortie.status='idle',tick/elapsedMs/enemies/projectilesが進まない。不足しているテスト: exactly-once claim
debrief_pending_rewardで同じpendingRewardApplicationIdを 2 回 claim。不足しているテスト: same payload different sortie
SortieResultpayload だが異なるapplicationId。不足しているテスト: Quick Save / Load policy
preparation,running,debrief_pending_reward,debrief_reward_claimedの各 phase。runningとdebrief_pending_rewardは false。preparationとdebrief_reward_claimedは true、または仕様に沿った結果。不足しているテスト: next sortie reset
不足しているテスト: terminal 後 simulation halt
runSortieSimulationStep()を複数回呼ぶ。tick,elapsedMs, enemies, projectiles, player HP, reward state が変化しない。10. レビューコメント案
該当箇所: Acceptance Criteria AC1
victory / defeatのみが debrief 対象になっていますが、既存 Sortie FSM とSortieResultはtimeoutを terminal outcome として扱っています。30 秒 timeout だけ reward / debrief / next sortie loop から漏れるため、AC1 と状態遷移表にtimeoutを含めてください。victory / defeat / timeout -> debrief_pending_rewardを明記し、timeout debrief regression test をtests/sortie-system.test.tsに追加してください。該当箇所: AC4 / loop phase 表現
SortieStatus活用またはloopPhase追加の二択だけでは、親 導入: M3 Loop MVP Gate を報酬→resource→localStorage 永続化まで接続する #733 の固定契約であるpreparation / running / debrief_pending_reward / debrief_reward_claimedが担保されません。combat outcome と product loop phase が混ざると Quick Save / reward claim の境界が壊れます。SortieStatusは combat FSM として維持し、別にLoopPhaseunion を追加する方針を Issue 本文に固定してください。該当箇所: RewardSystem dependency / 実装: SortieResult から報酬を算出する RewardSystem を追加する #737 handoff
RewardSystem.claim(state, applicationId, result)を定義し、terminal transition token の生成・wiring を 実装: sortie 後の debrief / preparation フェーズを導入する #738 に委譲しています。実装: sortie 後の debrief / preparation フェーズを導入する #738 側にapplicationIdの生成時点、保持場所、claim 後の phase、二重 claim 時の挙動を明記してください。running -> debrief_pending_reward遷移時にpendingRewardApplicationIdを一度だけ生成し、claim 成功でdebrief_reward_claimedに遷移する AC と test を追加してください。該当箇所: AC5 Quick Save / Quick Load
debrief_pending_rewardで save/load を許可すると reward 消失または再 claim の穴になります。debrief_pending_rewardとdebrief_reward_claimedを分け、Quick Save / Load の許可を domain policycanQuickSave(phase)/canQuickLoad(phase)として定義してください。該当箇所: Allowed Paths
src/ui/HudController.tsがありません。該当箇所: Verification Commands
rg -n "debrief"のような grep は実装存在の確認にしかならず、状態遷移の正しさ・二重 claim 防止・simulation halt を保証できません。tests/sortie-system.test.tsに phase transition table ベースの unit tests を追加し、grep は補助確認に格下げしてください。11. 人間が判断すべき点(推奨案)
LoopPhaseを追加するか、SortieStatusを拡張するか。推奨はLoopPhase追加です。debrief_pending_reward中の Quick Save / Load を完全拒否するか、Quick Save 前に claim を強制するか。推奨は完全拒否です。timeoutreward をdefeatと同等に扱うか、独立 outcome として debrief 表示・報酬を分けるか。既存仕様上は独立 outcome として扱うべきです。12. 次に取るべきアクション
timeoutを追加する。LoopPhase = 'preparation' | 'running' | 'debrief_pending_reward' | 'debrief_reward_claimed'を明記する。applicationId/pendingRewardApplicationId/ claim 後 phase の contract を 実装: sortie 後の debrief / preparation フェーズを導入する #738 に追加する。canQuickSave(phase)/canQuickLoad(phase)として明文化し、debrief_pending_rewardを拒否する。timeout, double claim, pending save/load, boot preparation, terminal halt, next sortie reset の test cases をtests/sortie-system.test.tsに追加する。squne121 commentedon Jun 9, 2026
issue-author update: #738 contract rewrite applied
#issuecomment-4658868235を primary source として反映しつつ、2026-06-09 live state に合わせて#737 CLOSED / PR #769 MERGEDへ正規化しました。src/state/GameState.ts/src/systems/SortieSystem.ts/src/main.ts/tests/sortie-system.test.tsに閉じる headless domain state machine issue へ絞り、HUD action surface は out-of-scope として切り出しました。timeoutterminal、LoopPhase固定、pendingRewardApplicationId/RewardSystem.claim(...)handoff、bootstrap preparation、terminal halt、next sortie reset を AC / VC に反映しました。Guard summary:
squne121 commentedon Jun 9, 2026
issue-refinement-loop を owner comment 起点で実施し、本文を headless domain state machine 契約へ更新しました。
PR #769 is Draft / pending checksは current GitHub state と不一致だったため除去しました。#769は 2026-06-08 にMERGEDですtimeoutを debrief 対象へ含め、LoopPhase/applicationId/ phase-based quick-save policy / headless scope を issue 契約へ追加しました#770に分離しましたcheck_issue_contract.pyverdict=approvecontract_readiness_check.py --mode staticstatus=gocheck_blockers.sh 738 squne121/loop-protocol= blocker closedbaseline_vc_preflight.py --body-file /tmp/issue_738_new.md=status: passsqune121 commentedon Jun 9, 2026
› 作業ごとにサブエージェントを使って。
#738 (comment)
を対象に issue-refinement-loop を人間承認不要で行って。
作業の中で作業手順、AIエージェントの運用、サブエージェントへの委任設定、エージェントスキ
ル、issueやPRに改善点があれば類似のIssueへの追記や新規Issue起票して。
web-researcherSubAgent とcodebase-investigatorSubAgent はどちらも gemini-cli-headless-delegation を活用して。
類似スコープ、文脈のIssueは gemini-cli-headless-delegation で調査して統合して。
Issueの起票は issue-author に委譲して。
• 対象コメントを一次ソースにして issue-refinement-loop を自律で回し、必要な類似Issue調査や追
記・新規起票まで進めます。まず CLAUDE.md と関連 skill を確認し、サブエージェント委任の使い
方と rtk 境界を揃えます。
• Ran rtk --help
└ A high-performance CLI proxy designed to filter and summarize system outputs before they
reach your LLM context.
… +83 lines (ctrl + t to view transcript)
-V, --version
Print version
• Explored
└ Read SKILL.md (gemini-cli-headless-delegation skill), SKILL.md (issue-refinement-loop
skill), SKILL.md (create-issue skill)
List rg --files -g CLAUDE.md -g AGENTS.md -g RTK.md
Search issue-refinement-loop|gemini-cli-headless-delegation|issue-author|subagent|
delegat in
MEMORY.md
────────────────────────────────────────────────────────────────────────────────────────────
• skill は issue-refinement-loop と gemini-cli-headless-delegation を主軸に使います。次に
repo の実行ルールと、この loop の planner / 終了条件、それからサブエージェント呼び出し手段
を確認します。
• Explored
└ Read RTK.md, CLAUDE.md, refinement-loop-plan-output.md, SKILL.md (ssot-discovery skill)
Search web-researcher|codebase-investigator|issue-author|issue-reviewer|subagent in
skills
Read follow-up-materialization.md, termination-policy.md
────────────────────────────────────────────────────────────────────────────────────────────
• 並列化できる部分を切り出します。メインでは対象 Issue と planner/validator を回し、並行で
web-researcher・codebase-investigator・類似Issue調査をサブエージェントに流します。
• Ran rtk find .claude/agents -maxdepth 2 -type f
└ 11F 1D:
• Explored
└ Read SKILL.md (edit-issue skill), workflow.md, project-constitution.md,
SKILL.md (review-
issue skill)
────────────────────────────────────────────────────────────────────────────────────────────
• 文脈取得に入ります。対象 comment と Issue 本文、関連 SSOT を揃えてから planner を回し、そ
こで必要判定が出た部分だけ委任します。
• Ran rtk gh issue view 738 --json number,title,body,labels,url
└ {"body":"## Machine-Readable Contract\n\n```yaml\ncontract_schema_version:
v1\nissue_kind: implementation\nparent_issue: "#733"\ngoal_ref: "M3: Loop MVP Gate —
… +61 lines (ctrl + t to view transcript)
preparation フェーズを導入する","url":"https://github.com/squne121/loop-protocol/
issues/738"}
• Ran KW=$(rtk gh issue view 738 --json title,body --jq '.title + " " + .body' | tr -s
│ '[:punct:][:space:]' ',' | head -c 240); .claude/skills/ssot-discovery/scripts/
│ match-ssot.sh --keywords "$KW"
└ SSOT_DISCOVERY_RESULT_V1:
status: partial
… +228 lines (ctrl + t to view transcript)
\ ^"
errors: []
• Ran rtk gh issue view 738 --comments
└ author: squne121
association: owner
… +405 lines (ctrl + t to view transcript)
"loop-protocol/src/systems/SortieSystem.ts at main · squne121/loop-protocol · GitHub"
--
────────────────────────────────────────────────────────────────────────────────────────────
• 対象コメントの要求はかなり具体的で、既存 SSOT とのズレも多いです。ここからは planner を正
本にして、ローカルの rewrite 路線と、並列の read-only 調査を切り分けます。
• Explored
└ Read web-researcher.md, codebase-investigator.md, plan_refinement_loop.py, issue-
author.md,
agent-skill-boundaries.md
• Ran rtk gh api repos/squne121/loop-protocol/issues/comments/4658868235
└ {"url":"https://api.github.com/repos/squne121/loop-protocol/issues/comments/4658868235",
"html_url":"#738 (comment)
… +478 lines (ctrl + t to view transcript)
/comments/4658868235/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"conf
used":0,"heart":0,"rocket":0,"eyes":0},"performed_via_github_app":null,"pin":null}
────────────────────────────────────────────────────────────────────────────────────────────
• ここで役割を固定します。
メインスレッド: planner 実行、Issue 本文の rewrite 方針確定、最終統合
codebase-investigator: repo facts と類似 Issue / PR の read-only 調査
web-researcher: 外部仕様 claim の有無確認。今回は GitHub 公開面の current state 検証が
中心
issue-reviewer: rewrite 前後の deterministic review
issue-author: 本文更新と、必要なら follow-up Issue 起票
まずは調査系を並列起動し、その間にメインで planner と validator を回します。
• Spawned 019eabf1-918c-7383-8113-1094f3a869c5 (gpt-5.4 low)
└ [skill:$codebase-investigator](/home/squne/projects/LOOP_PROTOCOL/.claude/agents/
codebase-investigator.md)
[skill:$gemini-cli-headless-delegation](/home/squn...
• Spawned 019eabf1-af12-7701-87f3-87d31435e4b4 (gpt-5.4 low)
└ [skill:$web-researcher](/home/squne/projects/LOOP_PROTOCOL/.claude/agents/web-
researcher.md)
[skill:$gemini-cli-headless-delegation](/home/squne/projects/LOO...
• Spawned 019eabf1-c7b4-7c31-9cfb-39dad187dfda (gpt-5.4 low)
└ [skill:$issue-reviewer](/home/squne/projects/LOOP_PROTOCOL/.claude/agents/issue-
reviewer.md)
[skill:$review-issue](/home/squne/projects/LOOP_PROTOCOL/.claude...
• Ran cat > /tmp/issue738-planner-input.json <<'EOF'
│ {
│ "schema_version": "refinement_loop_planner_input/v1",
│ … +24 lines
└ {
"schema_version": "refinement_loop_plan/v1",
… +44 lines (ctrl + t to view transcript)
}
}
• Ran rtk gh issue view 733 --json number,title,body,url
└ {"body":"## Machine-Readable Contract\n\n```yaml\ncontract_schema_version:
v1\nissue_kind: parent\ngoal_ref: "M3: Loop MVP Gate (v0.3.x) として sortie 結果から報
… +253 lines (ctrl + t to view transcript)
酬→resource→localStorage 永続化まで接続する","url":"https://github.com/squne121/
loop-protocol/issues/733"}
• Ran rtk gh issue view 737 --json number,title,body,url
└ {"body":"## Machine-Readable Contract\n\n```yaml\ncontract_schema_version:
v1\nissue_kind: implementation\nparent_issue: "#733"\ngoal_ref: "M3: Loop MVP Gate —
… +103 lines (ctrl + t to view transcript)
設計\n- Vitest BDD\n\n","number":737,"title":"実装: SortieResult から報酬を算出する
RewardSystem を追加する","url":"https://github.com/squne121/loop-protocol/issues/737"}
• Ran rtk gh pr view 769 --json
│ number,title,state,isDraft,mergeStateStatus,reviewDecision,statusCheckRollup,url
└ {"isDraft":false,"mergeStateStatus":"UNKNOWN","number":769,"reviewDecision":"","state":"
MERGED","statusCheckRollup":
… +75 lines (ctrl + t to view transcript)
TED","workflowName":"ci"}],"title":"feat(reward): add RewardSystem exactly-once
claims","url":"https://github.com/squne121/loop-protocol/pull/769"}
────────────────────────────────────────────────────────────────────────────────────────────
• owner comment の一部はもう drift しています。特に PR #769 は 2026-06-08 に MERGED で、コメ
ント内の「Draft / pending checks」は stale です。この前提で、コメントの有効部分だけを残す
reframe にします。
• Ran python3 - <<'PY'
│ import json, subprocess, pathlib
│ from shlex import quote
│ … +21 lines
└ /tmp/issue738-planner-input.json
{
… +75 lines (ctrl + t to view transcript)
}
}
────────────────────────────────────────────────────────────────────────────────────────────
• planner を再実行しています。ここで fail_closed なら structured repair、通れば owner
comment の stale/valid を切り分けた rewrite payload に進みます。
• Explored
└ Read sortie.md, quick-save.md
• Ran rtk gh issue view 619 --json number,title,body,url
└ {"body":"> 2026-06-07 update: This issue is reused under #733 / M3 Loop MVP Gate.
Original parent #483 is closed; current delivery parent is #733.\n\n## 概要 /
… +10 lines (ctrl + t to view transcript)
#483\n\n","number":619,"title":"feat(#483): Quick Save を準備フェーズ限定に制限し Quick
Load を実装する","url":"https://github.com/squne121/loop-protocol/issues/619"}
• Ran rtk gh issue view 620 --json number,title,body,url
└ {"body":"> 2026-06-07 update: This issue is reused under #733 / M3 Loop MVP Gate.
Original parent #483 is closed; current delivery parent is #733.\n\n## 概要 /
… +8 lines (ctrl + t to view transcript)
#483\n\n","number":620,"title":"feat(#483): Quick Save ボタンの有効/無効表示と最小限の
フィードバックを実装する","url":"https://github.com/squne121/loop-protocol/issues/620"}
• Ran rtk gh issue view 739 --json number,title,body,url
└ {"body":"## Machine-Readable Contract\n\n```yaml\ncontract_schema_version:
v1\nissue_kind: implementation\nparent_issue: "#733"\ngoal_ref: "M3: Loop MVP Gate —
… +46 lines (ctrl + t to view transcript)
装: 報酬確定時に progression snapshot を localStorage へ保存する","url":"https://
github.com//issues/739"}
• Ran rtk gh issue view 740 --json number,title,body,url
└ {"body":"## Machine-Readable Contract\n\n```yaml\ncontract_schema_version:
v1\nissue_kind: implementation\nparent_issue: "#733"\ngoal_ref: "M3: Loop MVP Gate —
… +41 lines (ctrl + t to view transcript)
の sortie→reward→reload 復元を E2E / playtest で検証する","url":"https://github.com/
/issues/740"}
────────────────────────────────────────────────────────────────────────────────────────────
• 再設計の軸は見えています。#738 は headless domain state machine に絞り、UI 操作面は既存
#620 に無理やり押し込まず、重複調査のうえ narrow follow-up に分離するのが一番きれいです。
• Ran rtk gh issue list --state open --limit 200 --json number,title,labels,url
└ [{"labels":[{"id":"LA_kwDOSfQcDc8AAAACjdhptQ","name":"enhancement","description":"New
feature or request","color":"a2eeef"},{"id":"LA_kwDOSfQcDc8AAAACj2eMtQ","name":"phase/
… +1200 lines (ctrl + t to view transcript)
loop-protocol/issues/9"},{"labels":[],"number":5,"title":"Claude Code ガードレール
を .claude に実装する","url":"https://github.com//issues/5"}]
• Waiting for 3 agents
└ 019eabf1-918c-7383-8113-1094f3a869c5
019eabf1-af12-7701-87f3-87d31435e4b4
019eabf1-c7b4-7c31-9cfb-39dad187dfda
• Finished waiting
└ 019eabf1-c7b4-7c31-9cfb-39dad187dfda: Completed -
review-issue手順どおりの read-onlydeterministic review 結果です。本文更新や Issue 起票はしていません。 ```yaml
REVIEW_ISSUE_RESULT_V1: status: ok generated_at: 2026-06-09T10:34:23Z generated_by:
review-issue issue_url: https://github.com/squne121/loop-protoco...
────────────────────────────────────────────────────────────────────────────────────────────
• reviewer 結果も、owner comment で指摘された本質と一致しました。これで rewrite の筋は固まっ
たので、残りは類似Issue統合と follow-up materialization の判断です。
• Waiting for 2 agents
└ 019eabf1-918c-7383-8113-1094f3a869c5
019eabf1-af12-7701-87f3-87d31435e4b4
• Finished waiting
└ 019eabf1-918c-7383-8113-1094f3a869c5: Completed - 以下は read-only で止めた
issue- refinement-loop調査結果です。rewrite / issue追記 / 新規起票は、直近の指示どおり mutation禁止のため未実施です。
web-researcherとcodebase-investigator相当はどちらもgemini- cli-headless-delegationを使って実行し、その結果を main thread で一次証跡と照合しました。**CODEBA...
• Waiting for 019eabf1-af12-7701-87f3-87d31435e4b4
• Finished waiting
└ No agents completed yet
────────────────────────────────────────────────────────────────────────────────────────────
• 本文更新に入る前に、新しい contract をローカルで validator に通します。ここで通した内容だ
けを issue-author に渡し、GitHub 側 mutation はサブエージェントに委譲します。
• Ran cat > /tmp/issue738-draft.md <<'EOF'
│ ## Machine-Readable Contract
│
│ … +207 lines
└ all_passed: true
guards:
… +18 lines (ctrl + t to view transcript)
passed: true
violations: []
• Ran uv run python3 .claude/skills/issue-contract-review/scripts/
│ contract_readiness_check.py --body-file /tmp/issue738-draft.md --mode static
└ {
"schema": "ISSUE_CONTRACT_READINESS_RESULT_V1",
… +13 lines (ctrl + t to view transcript)
"fix_hint": null
}
────────────────────────────────────────────────────────────────────────────────────────────
• 新しい #738 本文案は local validator で status: go まで通りました。次は issue-author に 1)
#738 更新 2) HUD follow-up の重複確認つき起票、の順で委譲します。
• Ran rtk gh issue list --search "HudController debrief claim reward next sortie is:open"
│ --state open --json number,title,url
└ [{"number":738,"title":"実装: sortie 後の debrief / preparation フェーズを導入す
る","url":"https://github.com//issues/738"}]
• Ran rtk gh issue list --search "Claim reward Quick Load preparation sortie is:open"
│ --state open --json number,title,url
└ [{"number":738,"title":"実装: sortie 後の debrief / preparation フェーズを導入す
る","url":"https://github.com//issues/738"},
{"number":733,"title":"導入: M3 Loop MVP Gate を報酬→resource→localStorage 永続化まで接
続する","url":"https://github.com//issues/733"}]
• Ran rtk gh issue list --search "debrief phase HUD is:open" --state open --json
│ number,title,url
└ [{"number":738,"title":"実装: sortie 後の debrief / preparation フェーズを導入す
る","url":"https://github.com//issues/738"},
{"number":733,"title":"導入: M3 Loop MVP Gate を報酬→resource→localStorage 永続化まで接
続する","url":"https://github.com//issues/733"}]
• Spawned 019eabf9-5642-79a1-9329-a466714b2a72 (gpt-5.4 low)
└ skill:$issue-author
[skill:$edit-issue](/home/squne/projects/LOOP_PROTOCOL/.claude/skill...
────────────────────────────────────────────────────────────────────────────────────────────
• issue-author に GitHub mutation を渡しました。並行で、必要なら終了コメント用の handoff 文
面も整えます。
• Waiting for 019eabf9-5642-79a1-9329-a466714b2a72
• Finished waiting
└ No agents completed yet
• Waiting for 019eabf9-5642-79a1-9329-a466714b2a72
• Finished waiting
└ 019eabf9-5642-79a1-9329-a466714b2a72: Completed - #738 は指定本文で全面置換し、guard /
readiness を通したうえで更新しました。変更経緯コメントも投稿済みです。 更新先:
#738 変更コメント:
#738 (comment) follow-up は
duplicate ではないと判...
────────────────────────────────────────────────────────────────────────────────────────────
• subagent から follow-up issue 番号に差分が出ているので、live GitHub state を最後に突き合わ
せます。最終報告は現物確認ベースに揃えます。
• Ran rtk gh issue view 738 --json number,title,body,url
└ {"body":"## Machine-Readable Contract\n\n```yaml\ncontract_schema_version:
v1\nissue_kind: implementation\nparent_issue: "#733"\ngoal_ref: "M3: Loop MVP Gate —
… +103 lines (ctrl + t to view transcript)
扱う\n","number":738,"title":"実装: sortie 後の debrief / preparation フェーズを導入す
る","url":"https://github.com/squne121/loop-protocol/issues/738"}
• Ran rtk gh issue view 771 --json number,title,body,url,state
└ {"body":"## Machine-Readable Contract\n\n```yaml\ncontract_schema_version:
v1\nissue_kind: implementation\nparent_issue: "#733"\ngoal_ref: "M3: Loop MVP Gate —
… +73 lines (ctrl + t to view transcript)
の HUD action surface を最小導入する","url":"https://github.com/squne121/loop-protocol/
issues/771"}
• Ran rtk gh issue view 770 --json number,title,body,url,state
└ {"body":"## Machine-Readable Contract\n\n```yaml\ncontract_schema_version:
v1\nissue_kind: implementation\nparent_issue: "#733"\ngoal_ref: "M3: Loop MVP Gate —
… +56 lines (ctrl + t to view transcript)
\n","number":770,"state":"OPEN","title":"実装: preparation / debrief の HUD 操作面を追加
する","url":"https://github.com/squne121/loop-protocol/issues/770"}
• Ran rtk gh issue view 14 --comments
└ author: squne121
association: owner
… +1114 lines (ctrl + t to view transcript)
────────────────────────────────────────────────────────────────────────────────────────────
• follow-up が 2 本できてしまったので、最後に重複整理します。内容を見る限り #770 と #771 は
同系統で、#771 のほうが #738 consumer 境界を明確に切っているため、こちらを canonical に寄
せます。
• Closed 019eabf1-918c-7383-8113-1094f3a869c5
• Closed 019eabf1-af12-7701-87f3-87d31435e4b4
• Closed 019eabf1-c7b4-7c31-9cfb-39dad187dfda
• Closed 019eabf9-5642-79a1-9329-a466714b2a72
────────────────────────────────────────────────────────────────────────────────────────────
• issue-refinement-loop は完了しています。対象の #738
(#738) は owner comment
を一次ソースにして更新し、timeout を debrief 対象へ追加、LoopPhase と
pendingRewardApplicationId の契約固定、Quick Save/Load 境界の headless 化、UI を
out-of-scope へ切り出す形に正規化しました。変更経緯コメントは #738 のコメント
(#738 (comment))
に残っています。なお stale だった「PR #769 は Draft / pending checks」という前提は、live
state に合わせて PR #769 は 2026-06-08 に MERGED として反映済みです。
follow-up は #771 (#771) を issue-author
委譲で起票し、HUD action surface を #738 の consumer として切り出しました。並列の
web-researcher 側でも別案として #770
(#770) が起票され、現在は #770 / #771
が重複状態です。#771 を canonical に寄せて #770 を close しようとしましたが、rtk gh issue
close がこの実行ポリシーで拒否され、自動整理まではできませんでした。加えて、Gemini
delegation 改善観測は #14 のコメント
(#14 (comment))
に追記されています。
検証は issue gate ベースで実施し、新しい #738 本文案は guard-issue-body.py と
contract_readiness_check.py --mode static で通過しています。アプリ本体の pnpm typecheck /
lint / test / build は今回は実行していません。
─ Worked for 15m 39s ───────────────────────────────────────────────────────────────────────
╭─────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.137.0) │
│ │
│ model: gpt-5.4 low /model to change │
│ directory: ~/projects/LOOP_PROTOCOL │
│ permissions: YOLO mode │
╰─────────────────────────────────────────────╯
Tip: New Use /fast to enable our fastest inference with increased plan usage.
Token usage: total=214,773 input=197,249 (+ 3,998,464 cached) output=17,524 (reasoning
4,514)
To continue this session, run codex resume 019ea97c-b1dc-7ef0-9ae4-fdd189d68591
squne121 commentedon Jun 9, 2026
Contract Snapshot (2026-06-09T11:02:40Z)
src/state/GameState.tsとsrc/systems/SortieSystem.tsに headless loop phase state machine と reward-claim handoff を導入し、src/main.tsの bootstrap 即時 sortie 開始を preparation 経由へ置き換えるpr_review_only4 件、想定外 pass 0 件、実行不可 0 件src/state/GameState.tssrc/systems/SortieSystem.tssrc/main.tstests/sortie-system.test.ts.claude/worktrees/issue-738-sortie-debrief-preparationworktree-issue-738-sortie-debrief-preparationsqune121 commentedon Jun 9, 2026
impl-review-loop status: blocked at repo-state drift (2026-06-09T11:05:00Z)
issue-contract-reviewはstatus: goまで通過し、contract snapshot は#issuecomment-4659089577に materialize 済みです。ただし実装着手で worktree を切った時点で、issue contract の前提と repo reality に次の drift があることを確認しました。
#738本文は#737CLOSED / PR#769MERGED 済みとしてRewardSystem.claim(state, applicationId, result)を upstream dependency として参照しているmainとorigin/mainの実体にはsrc/systems/RewardSystem.tsが存在せず、src/systems/index.tsにも RewardSystem export がないgh pr view 769 --json files,mergeCommitではsrc/systems/RewardSystem.ts/tests/reward-system.test.ts/src/state/GameState.ts/src/systems/index.tsが PR feat(reward): add RewardSystem exactly-once claims #769 の差分として見えるため、issue contract と current checked-out main の間にrepo-state driftがあるこのため #738 を contract どおり完了するには、reward-claim handoff をつなぐ段階で
src/systems/RewardSystem.ts参照が必要になり、現在の Allowed Paths(src/state/GameState.ts,src/systems/SortieSystem.ts,src/main.ts,tests/sortie-system.test.ts)だけでは完了できません。現時点では、以下の stop condition に該当するため fail-close します。
RewardSystem.claim(...)成功でdebrief_reward_claimedへ遷移)を current repo reality のままでは成立できない場合補足:
#738の Verification Commands は修正済みで、issue-contract-review自体は nowgo.claude/worktrees/issue-738-sortie-debrief-preparationは作成済みですが、main thread では partial code edit を取り込まず停止しています次に進めるには、少なくとも次のいずれかの人間判断が必要です。
main/origin/mainに PR feat(reward): add RewardSystem exactly-once claims #769 相当の RewardSystem 実装を正しく反映してから 実装: sortie 後の debrief / preparation フェーズを導入する #738 を再開する#737実装実体の取り込み経路を別 issue / fix として切り出すfeat: add sortie debrief loop phases (#773)