Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: research
parent_issue: none
goal_ref: "issue-refinement-loop 実行中などに『再開して』が必要になる途中停止の根本原因を Claude Code transcript / hook event / rate limit event / SubAgent transcript から分類し、対策方針を確定する"
change_kind: research-onlyParent Issue
なし(単独調査)
Parent Goal Ref
- Goal: issue-refinement-loop 等の AI 自律ループが「再開して」指示なしに完走できる状態にするため、まず停止の根本原因を確定する
- Desired Destination: 停止原因が分類され、原因種別ごとの対策(と必要な follow-up Issue)が決まっている
Remaining Parent Gaps
なし
Background
2026-05-22、Issue #146 の issue-refinement-loop 実行中に Step 2(review-issue)が needs-fix を返した後、オーケストレーター AI が Step 4(本文改善)へ自動遷移せず停止し、ユーザーが「再開して」と入力するまで再開しなかった。
当初この Issue は「SKILL.md に Step 間の自律継続文言を追記する」ことを解として固定していたが、issue-refinement-loop による調査の結果その前提は成立しないと判明した:
- (C1, 確認済) 現行
.claude/skills/issue-refinement-loop/SKILL.mdには既に Loop Structure と Step 2 にneeds-fix → Step 4遷移が明示されている。文言不足は停止の主因ではない。 - (人間所感) 「再開して」が必要なケースは当該例以外にも複数あり、最近増えている。rate limit 解消後の再開でも発生する。hook や UI など表面に出ない原因の可能性がある。
- (C3/C4/C8, 確認済) Claude Code 公式仕様上、通常停止は
Stophook、API error(rate limit 等)はStopFailurehook と別 event。StopFailureは decision control を持たず(informational-only)、hook 側から会話継続を強制できない。よって通常停止と rate limit 停止は別系統の問題であり、単一の SKILL.md 文言修正では両方を解決できない。 - (C11, 確認済)
~/.claude/settings.jsonには既にStop/SubagentStophook が定義され~/.claude/hooks/claude_tmux_state.pyが稼働中。ただしこれは tmux 状態追跡用で、LOOP_STATE 未完了検出・継続制御は行わない。StopFailurehook と project 配下.claude/hooks/は未整備。
したがって本 Issue は「文言追記の実装 Issue」ではなく、停止の根本原因をローカルログから分類する調査 Issue として扱う。
Outcome
issue-refinement-loop 等の実行中に「再開して」が必要になった事例について、Claude Code transcript / debug log / hook event / rate limit event / SubAgent transcript を調査し、停止原因を以下の分類で確定する:
normal_stop_without_loop_completion— 通常停止。LOOP_STATE 未完了なのに Stop に達したsubagent_stop_without_orchestrator_resume— SubAgent は正常終了したが main thread が次の tool call を発火しなかったstop_hook_allowed_incomplete_loop— Stop hook が発火したが未完了ループを継続させなかったstopfailure_rate_limit— rate limit 等の API error による StopFailureremote_control_or_ui_disconnect— remote-control / background session / tmux / UI 切断・idlecompaction_or_state_loss— compaction 後に LOOP_STATE / 継続意図が失われたunknown— 上記に分類不能
分類結果に基づき、原因種別ごとに必要な対策(SKILL.md 文言修正 / LOOP_STATE-aware な Stop hook 導入 / StopFailure ログ保存 / resume playbook)を決定し、対策実装は follow-up Issue へ分割する。
In Scope
- 直近の「再開して」事例の Claude Code transcript / debug log / hook event 調査(
~/.claude/projects/**/*.jsonl等) needs-fix後停止ケースと rate limit 後再開ケースの分離・分類.claude/settings.json/.claude/settings.local.json/~/.claude/settings.jsonの hooks 設定棚卸し(既存のStop/SubagentStophook と~/.claude/hooks/claude_tmux_state.pyが LOOP_STATE-aware か否かの確認を含む)issue-refinement-loop実行で LOOP_STATE 未完了のまま停止したかの判定- 原因分類ごとの対策方針決定と follow-up Issue への分割
Out of Scope
- 調査前の SKILL.md 文言修正のみでの完了(旧スコープ)
- Claude Code 本体バグの断定
- rate limit の自動回避・課金/上限変更
- ローカルログ未確認のままの恒久対策実装(対策の実装自体は follow-up Issue)
- AI agent session 記録ツール導入の是非(調査: AI agent session 記録ツール(EntireCLI 等)導入の是非と運用前提を決定する #136 で別途扱う)
Acceptance Criteria
- AC0: 直近7日以内の transcript(
~/.claude/projects/**/*.jsonl)から再開して/needs-fix/rate_limit/StopFailureを含む事例を抽出している - AC1: 各事例について main transcript path / subagent transcript path / session_id / cwd / 発生時刻(UTC)を記録している
- AC2:
review-issueがneeds-fixを返した直後に main thread が Step 4(issue-author)の tool call を発火したか否かを各事例で判定している - AC3: rate limit 事例では
StopFailureevent(error == rate_limit)の有無を確認し、通常停止(Stop)ケースと分離している - AC4:
.claude/settings.json/.claude/settings.local.json/~/.claude/settings.jsonの hooks 設定を棚卸しし、Stop/SubagentStop/StopFailure/TaskCompletedの登録有無と、既存 hook が LOOP_STATE-aware か否かを記録している - AC5: 原因分類(Outcome の7分類)ごとに対策方針を決定し、対策実装が必要なものは follow-up Issue を起票している
- AC6: 調査結果を本 Issue のコメントに
INTERRUPTION_ROOT_CAUSE_REPORT_V1形式(YAML)で記録している
Verification Commands
# AC0: 直近7日の transcript 候補が列挙できる
find ~/.claude/projects -name '*.jsonl' -mtime -7 -print | head -1 && echo "PASS: AC0 transcript enumerable" || echo "FAIL: AC0"
# AC1: 調査ログ出力ファイルに session_id / transcript_path フィールドが含まれるか
# (調査完了後に確認)
test -f /tmp/claude_resume_incidents.txt && rg "session_id|transcript_path" /tmp/claude_resume_incidents.txt && echo "PASS: AC1" || echo "FAIL: AC1 (調査完了後に PASS)"
# AC2: needs-fix 後の Step 4 tool call 発火有無が記録されているか
# (調査完了後に確認)
test -f /tmp/claude_resume_incidents.txt && rg "step4_tool_call_fired" /tmp/claude_resume_incidents.txt && echo "PASS: AC2" || echo "FAIL: AC2 (調査完了後に PASS)"
# AC3: StopFailure event が通常停止と分離されているか
# (調査完了後に確認)
test -f /tmp/claude_resume_incidents.txt && rg "StopFailure|stopfailure_rate_limit" /tmp/claude_resume_incidents.txt && echo "PASS: AC3" || echo "FAIL: AC3 (調査完了後に PASS)"
# AC4: 現行 hooks 設定を機械的に確認できる
test -f ~/.claude/settings.json && echo "PASS: AC4 user settings present" || echo "NOTE: AC4 user settings absent"
# AC5: follow-up Issue が起票されているか(調査完了後に確認)
gh issue list --repo squne121/loop-protocol --label "agent/implementer" --state open --json number,title --jq '.[].title' | rg "停止|hook|StopFailure|resume|LOOP_STATE" && echo "PASS: AC5" || echo "FAIL: AC5 (調査完了後に PASS)"
# AC6: 調査完了後、Issue コメントに報告フォーマットが記録されている(調査完了後に PASS)
gh issue view 204 --repo squne121/loop-protocol --json comments --jq '.comments[].body' | rg "INTERRUPTION_ROOT_CAUSE_REPORT_V1" && echo "PASS: AC6" || echo "FAIL: AC6 (調査完了後に PASS)"Allowed Paths
- なし(調査専用 Issue。成果物は本 Issue へのコメント
INTERRUPTION_ROOT_CAUSE_REPORT_V1と follow-up Issue。repo-tracked file の変更は伴わない) - 調査中に repo-tracked file の変更が必要と判明した場合は Stop Conditions に従い follow-up Issue へ分割する
Stop Conditions
- 調査の結果 repo-tracked file の変更(SKILL.md 修正 / hook スクリプト追加 / settings.json 変更)が必要と判明した場合 → 同一 Issue で実装せず follow-up Issue を起票する
- 原因分類が
unknownに偏り追加調査手段が必要と判明した場合 - Claude Code 本体の不具合が疑われ Anthropic へのエスカレーションが必要と判明した場合
- 外部サービス利用・権限昇格が必要になった場合
- nested SubAgent delegation が必要になった場合
Handoff Contract
Current Objective: 停止原因の分類(Outcome の7分類)ごとの対策方針決定Bounded Current Context: Claude Code transcript / hook event / rate limit event の調査(ローカル read-only)Open Questions: compaction 後の状態消失が原因である可能性。StopFailureの informational-only 制約を回避する手段の有無Next Action: 調査完了後、INTERRUPTION_ROOT_CAUSE_REPORT_V1を Issue コメントに記録し、対策実装の follow-up Issue を起票するArtifact Refs: 本 Issue コメントINTERRUPTION_ROOT_CAUSE_REPORT_V1、follow-up Issue(起票後に link)
Required Skills
- なし(専用 skill 不要。ローカル transcript・log の read-only 調査のみで完結する)
Runtime Verification Applicability
decision: not_applicable
rationale: >
調査専用 Issue。repo-tracked file の変更を伴わず、成果物は Issue コメントの
INTERRUPTION_ROOT_CAUSE_REPORT_V1 と follow-up Issue。動作する機能の追加・変更が
ないため runtime verification の対象外。Reference: 調査コマンド例
実装エージェント向けのローカル調査コマンド例(環境により調整可):
# 1. 直近7日の transcript 候補を列挙
find ~/.claude/projects -name '*.jsonl' -mtime -7 -print | sort > /tmp/claude_recent_transcripts.txt
# 2.「再開して」等を含む transcript を抽出
while read -r f; do
if rg -n '再開して|needs-fix|rate_limit|StopFailure|review-issue|issue-author' "$f" >/dev/null; then
echo "=== $f ==="
rg -n '再開して|needs-fix|rate_limit|StopFailure|review-issue|issue-author' "$f" | head -80
fi
done < /tmp/claude_recent_transcripts.txt > /tmp/claude_resume_incidents.txt
# 3. hook / debug log 候補
find ~/.claude -type f \( -name '*debug*' -o -name '*.log' -o -name '*.jsonl' \) -mtime -7 -print | sort > /tmp/claude_recent_logs.txtReference: INTERRUPTION_ROOT_CAUSE_REPORT_V1
AC6 で本 Issue コメントに記録する報告フォーマット:
INTERRUPTION_ROOT_CAUSE_REPORT_V1:
schema_version: 1
investigated_at: <iso8601>
window: "直近7日"
incidents:
- incident_id: <連番>
session_id: <string>
main_transcript_path: <path>
subagent_transcript_path: <path | null>
cwd: <path>
occurred_at: <iso8601>
trigger: needs-fix_after | rate_limit_after | other
classification: normal_stop_without_loop_completion | subagent_stop_without_orchestrator_resume | stop_hook_allowed_incomplete_loop | stopfailure_rate_limit | remote_control_or_ui_disconnect | compaction_or_state_loss | unknown
step4_tool_call_fired: true | false | n/a
evidence: <transcript 該当箇所の要約>
hooks_inventory:
stop: registered | absent
subagent_stop: registered | absent
stop_failure: registered | absent
task_completed: registered | absent
loop_state_aware: true | false
classification_summary:
normal_stop_without_loop_completion: <count>
stopfailure_rate_limit: <count>
recommended_actions:
- classification: <上記分類>
action: skill_wording_fix | loop_state_aware_stop_hook | stopfailure_logging | resume_playbook | none
follow_up_issue: <#N | none>Related
- 実装: 既存 Issue 群の GitHub Milestone 割当設計と readback を行う (M-A3) #146 — 途中停止が観測された issue-refinement-loop 実行(事象の発端)
- 調査: AI agent session 記録ツール(EntireCLI 等)導入の是非と運用前提を決定する #136 — AI agent session 記録ツール導入の是非(調査インフラ観点で関連)
- 実装・検証・レビュー・PR本文更新をAIエージェントに自律ループさせる際の停止条件が弱かった #131 — AI 自律ループの停止条件が弱い問題(停止判定の隣接論点)
.claude/skills/issue-refinement-loop/SKILL.md— 停止が観測されたオーケストレーター
Source
dedupe_key: claude-code-session-interruption-root-cause-investigation
source_issue: 204
source_note: "2026-05-22 #204 を OWNER の No-Go as-is レビュー(issuecomment-4515803255)に基づき investigation Issue へ in-place reframe。issue-refinement-loop 実行で fact-check 済(C1/C2/C3/C4/C8/C11 supported)"
Activity
squne121 commentedon May 22, 2026
人間所感としては手順に進行が明示されていないから止まった。とは思っていない。
「Step 2(review-issue)が needs-fix を返した後、オーケストレーター AI が Step 4(本文改善)へ自動遷移せずに停止した」このとき以外も「再開して」と入力したときはチョクチョクある。
最近多い印象。
もしかしたらhookなどUIなど表面的に表れない原因なのではないかと思っている。
可能ならローカルのセッションログを調査して、事象発生時の事象を調査してほしい。
再開して、と依頼するケースは上記の例と、rate limitの解消後に依頼したケース。
短絡的な解決策ではなく、根本的な原因調査から解決策を検討してほしい。
squne121 commentedon May 22, 2026
結論
#204 は No-Go as-is です。
現状の Issue は「Step 間の自律継続を SKILL.md に明示する」だけに解を固定していますが、あなたの追記コメントどおり、観測事象は Step 2 → Step 4 だけの仕様文言不足では説明しきれません。#204 本文は「needs-fix 後に即 Step 4 へ進む文言を追記する」ことを Outcome / In Scope / AC にしており、原因調査の余地をほぼ閉じています。
一方、あなたのコメントは「同様の停止は他にもある」「rate limit 解消後の再開でも起きる」「hook や UI など表面化しない原因かもしれない」としており、これは 単一スキルの手順明文化ではなく、Claude Code セッション停止・再開・hook・rate limit・SubAgent 終了の横断調査 Issue として扱うべきです。
敵対的レビュー
Blocker 1: 原因を決め打ちしている
#204 の Background は「AI が結果を出力して待機状態になったと推測」とし、解決策を「SKILL.md に自律継続を明示」としています。
しかし、現在の issue-refinement-loop/SKILL.md には既に Loop Structure として needs-fix → Step 4 が明示されています。Step 2 でも needs-fix → blocking_issues と diff_proposal を LOOP_STATE に記録、Step 4 へ と書かれています。
つまり、単に「次 Step へ進め」と追記しても、根本原因が以下なら再発します。
Claude Code の通常停止判定で、モデルが「レビュー結果を報告した時点で応答完了」と判断した
Stop / SubagentStop / TaskCompleted hook が継続を強制していない、または期待と違う
StopFailure: rate_limit 後は hook で再開制御できない
remote-control / background session / tmux / Android 操作経路で UI 側の入力待ち・切断・idle が混ざっている
compaction 後に LOOP_STATE や「継続中」の意図が薄くなった
SubAgent の last_assistant_message は返ったが main thread が次の tool call を発火せず自然停止した
#204 はこれらを切り分ける AC を持っていません。
Blocker 2: rate limit ケースと通常停止ケースを分けていない
Claude Code の公式 hook 仕様では、Stop は通常の応答完了時に走り、StopFailure は API error 時に走ります。StopFailure は rate limit などで発生し、出力や exit code は無視され、通知・ロギング用途に限られます。
これは重要です。
通常停止なら Stop hook で「まだ LOOP_STATE が未完了なら止まるな」と返せますが、rate limit は StopFailure なので hook 側から会話継続を強制できません。StopFailure は error: rate_limit や error_details を持ちますが、decision control はありません。
したがって、#204 は最低でも次の 2 系統に分けるべきです。
系統 例 対策
通常停止 needs-fix 後に報告だけして止まる Stop / SubagentStop / TaskCompleted hook、LOOP_STATE 未完了検出
API failure rate limit 後に「再開して」が必要 StopFailure ログ、再開 playbook、resume/continue コマンド、状態復元
#204 の「Step 2 末尾に文言追記」は前者の一部にしか効かず、後者には効きません。
Blocker 3: hook 調査が In Scope にない
Claude Code の hook は lifecycle の各地点で発火し、Stop は「Claude が応答を終えた時」、SubagentStop は「SubAgent が完了した時」、TaskCompleted は「タスク完了時」に動きます。Stop / SubagentStop は decision: "block" で停止を防ぎ、続行理由をモデルへ返せます。
また exit code 2 は Stop では「Claude の停止を防ぎ、会話を続ける」動作になりますが、StopFailure では無視されます。
あなたの仮説どおり、hook が表面に出ない原因になっている可能性はあります。にもかかわらず #204 の In Scope は .claude/skills/issue-refinement-loop/SKILL.md のみです。
これは調査 Issue として不十分です。
Blocker 4: ローカルセッションログ調査が AC にない
Claude Code の hook input には transcript_path が含まれます。SubagentStop では main session の transcript と subagent transcript の両方が取れます。
CLI も --debug-file、--debug、claude logs 、claude -c、claude -r、claude respawn などを持ち、ローカル状態・transcript・debug log を前提にした調査が可能です。
#204 は「可能ならローカルログ調査」とコメントにはありますが、Issue 本文の AC / Verification Commands / Allowed Paths に入っていません。
このままだと実装エージェントはログを見ず、文言追記だけで完了できます。
根本原因仮説
現時点で最も妥当なのは、単一原因ではなく 3 系統の混在 です。
仮説 A: main thread の自然停止
review-issue が needs-fix を返した後、main thread が「レビュー結果をユーザーに報告する」ことを完了条件と誤認し、次の issue-author 呼び出しに進まない。
これは #204 の例に近いです。ただし現行 SKILL.md に Step 2 → Step 4 の遷移は既にあるので、文言不足だけではなく、Stop 時に LOOP_STATE 未完了を検出して継続させる機構がない ことが本質です。
仮説 B: SubAgent / hook の終了境界で main thread が復帰しない
SubagentStop は subagent transcript と last assistant message を持ちます。
もし SubAgent 側は正常終了しているが、main thread transcript に次の action がないなら、問題は SubAgent ではなく orchestrator の復帰判断です。
仮説 C: rate limit は別問題
rate limit は StopFailure として扱われ、decision control がありません。
したがって「rate limit 解消後に再開して」は、SKILL.md の Step 明文化では解けません。必要なのは、StopFailure ログに LOOP_STATE / session id / transcript path / next_resume_action を保存し、claude -c または claude -r で再開した時に未完了状態を復元する設計です。
#204 の修正方針
#204 は、以下のどちらかに変更すべきです。
推奨: #204 を「原因調査 + 計測導入 Issue」に変更する
タイトル案:
調査: issue-refinement-loop / Claude Code セッションの途中停止・再開要求の根本原因をログから分類する
Outcome 案:
Outcome
issue-refinement-loop 実行中に「再開して」が必要になった事例について、
Claude Code transcript / debug log / hook event / rate limit event / SubAgent transcript を調査し、
停止原因を以下の分類で確定する。
分類結果に基づき、SKILL.md 文言修正・Stop hook 導入・StopFailure ログ保存・resume playbook のどれが必要かを決定する。
In Scope 案:
In Scope
needs-fix後停止ケースと rate limit 後再開ケースの分類.claude/settings*.json/ hook 設定の確認issue-refinement-loopの LOOP_STATE 未完了時に停止したかの判定Out of Scope 案:
Out of Scope
Acceptance Criteria 案:
Acceptance Criteria
再開して/needs-fix/rate_limit/StopFailureを含む事例を抽出しているreview-issueがneeds-fixを返した直後に main thread が Step 4 tool call を発火したかを判定しているStopFailure.error == rate_limitの有無を確認し、通常停止ケースと分離している.claude/settings.json,.claude/settings.local.json,~/.claude/settings.jsonの hooks 設定を棚卸しし、Stop / SubagentStop / TaskCompleted / StopFailure の有無を記録しているINTERRUPTION_ROOT_CAUSE_REPORT_V1として記録しているローカル調査コマンド案
このチャットからあなたのローカル filesystem は直接読めないため、以下を Claude Code 側で実行させるのが現実的です。
1. 直近の transcript 候補を列挙
find ~/.claude/projects -name '*.jsonl' -mtime -7 -print | sort > /tmp/claude_recent_transcripts.txt
2. 「再開して」「needs-fix」「rate_limit」「StopFailure」を含む transcript を抽出
while read -r f; do
if rg -n '再開して|needs-fix|rate_limit|StopFailure|review-issue|issue-author' "$f" >/dev/null; then
echo "=== $f ==="
rg -n '再開して|needs-fix|rate_limit|StopFailure|review-issue|issue-author' "$f" | head -80
fi
done < /tmp/claude_recent_transcripts.txt > /tmp/claude_resume_incidents.txt
3. hook / debug log 候補を探す
find ~/.claude -type f ( -name 'debug' -o -name '.log' -o -name '.jsonl' ) -mtime -7 -print
| sort > /tmp/claude_recent_logs.txt
4. hook イベントらしき行を抽出
while read -r f; do
rg -n 'hook_event_name|StopFailure|SubagentStop|Stop"|TaskCompleted|TeammateIdle|rate_limit' "$f" || true
done < /tmp/claude_recent_logs.txt > /tmp/claude_hook_events.txt
jq で JSONL を読める場合は、以下も有効です。
transcript 内の user/assistant/tool/hook らしきイベントを粗く時系列化
jq -r '
[
.timestamp // .created_at // "",
.type // .role // .hook_event_name // "",
.message.content // .content // .last_assistant_message // .error // ""
] | @TSV
' < "$TRANSCRIPT" | rg -n '再開して|needs-fix|rate_limit|StopFailure|review-issue|issue-author|Step 4'
実装するなら最小の恒久対策
調査後に原因が「通常停止」側なら、SKILL.md 追記より Stop hook の未完了ループ検出 が本筋です。
設計案:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": ".claude/hooks/prevent-incomplete-refinement-stop.sh"
}
]
}
],
"StopFailure": [
{
"hooks": [
{
"type": "command",
"command": ".claude/hooks/log-stopfailure.sh"
}
]
}
],
"SubagentStop": [
{
"hooks": [
{
"type": "command",
"command": ".claude/hooks/log-subagent-stop.sh"
}
]
}
]
}
}
Stop hook は、最後の assistant message または transcript に以下がある場合だけ decision: block を返す。
issue-refinement-loop 実行中
review-issue の verdict: needs-fix
issue-author / edit-issue の実行証跡がまだない
termination_reason が approved|max_iterations|human_escalation|superseded_by_decision のいずれでもない
注意点として、Stop hook は最大連続 block 回数に上限があるため、無限継続ではなく「未完了状態が明確な場合のみ」使うべきです。
そのまま Issue に貼れるレビューコメント案
敵対的レビュー: No-Go as-is / 要原因調査
#204 は現状「Step 2 needs-fix 後に Step 4 へ自律継続する文言を SKILL.md に追記する」Issue になっていますが、これは原因を決め打ちしています。
人間所感どおり、今回の問題は Step 2 → Step 4 だけではなく、「再開して」が必要になるケースが複数あり、rate limit 解消後の再開ケースも含まれています。したがって、短絡的に SKILL.md 文言追記だけで完了させるべきではありません。
Blocker 1: 現行 SKILL.md には既に
needs-fix → Step 4が書かれているLoop Structure と Step 2 には
needs-fix後に Step 4 へ進む記述があります。よって「進行が明示されていないから止まった」と断定するのは危険です。
Blocker 2: 通常停止と rate limit 停止を分けていない
Claude Code では通常停止は
Stop、API error はStopFailureです。Stopは継続制御できますが、StopFailureは output / exit code が無視され、decision control がありません。rate limit 後の「再開して」は SKILL.md 文言追記では解決できません。
Blocker 3: hook / transcript / debug log 調査が AC にない
本件は以下をローカルログから確認してから対策を決めるべきです。
review-issueがneeds-fixを返した直後に main thread が Step 4 tool call を発火したかSubagentStop後に main thread へ制御が戻っているかStophook が発火していたかStopFailure.error == rate_limitが発生していたか推奨変更
#204 は「SKILL.md 文言追記 Issue」ではなく、以下の調査 Issue に変更してください。
タイトル案
調査: issue-refinement-loop / Claude Code セッションの途中停止・再開要求の根本原因をログから分類する
Outcome
直近の「再開して」事例について、Claude Code transcript / debug log / hook event / SubAgent transcript を調査し、停止原因を以下に分類する。
分類結果に基づき、SKILL.md 文言修正・Stop hook 導入・StopFailure ログ保存・resume playbook のどれが必要かを決定する。
Acceptance Criteria
再開して/needs-fix/rate_limit/StopFailureを含む事例を抽出しているreview-issueがneeds-fixを返した直後に main thread が Step 4 tool call を発火したかを判定しているStopFailure.error == rate_limitの有無を確認し、通常停止ケースと分離している.claude/settings.json,.claude/settings.local.json,~/.claude/settings.jsonの hooks 設定を棚卸ししているINTERRUPTION_ROOT_CAUSE_REPORT_V1として記録している結論: #204 はこのまま実装しない。まずログ調査で原因分類を確定し、その後に Stop hook / StopFailure logging / SKILL.md patch / resume playbook を分割して実装する。
この方向なら、あなたの所感どおり「手順に進行が明示されていないから止まった」という短絡解ではなく、実際の停止境界をログから潰せます。
[-]改善: issue-refinement-loop SKILL.md に Step 間の自律継続を明示し途中停止を防止する[/-][+]調査: issue-refinement-loop / Claude Code セッションの途中停止・再開要求の根本原因をログから分類する[/+]squne121 commentedon May 22, 2026
edit-issue: #204 in-place reframe 完了
変更概要
OWNER の No-Go as-is レビュー(issuecomment-4515753615 / issuecomment-4515803255)および issue-refinement-loop fact-check(C1/C3/C4/C8/C11 supported)に基づき、#204 を investigation Issue へ全面 reframe しました。
変更セクション一覧
改善: issue-refinement-loop SKILL.md に Step 間の自律継続を明示し途中停止を防止する→調査: issue-refinement-loop / Claude Code セッションの途中停止・再開要求の根本原因をログから分類するissue_kind: implementation→research、change_kind: docs→research-only(リポジトリ enum の最近似値へ正規化。investigationは非サポートのため)research.yml必須セクションとして追加(旧本文に欠如していた)phase/implementation→phase/research、agent/implementerを削除変更理由
旧 #204 は停止の原因を「SKILL.md の文言不足」と決め打ちしていたが、fact-check で以下が確認された:
needs-fix → Step 4遷移が明示済み。文言追記は停止の主因ではないStop)と rate limit 停止(StopFailure)は別系統。StopFailureは decision control を持たない~/.claude/settings.jsonの既存 hook は tmux 状態追跡用であり LOOP_STATE-aware ではないOWNER は「#204 は No-Go as-is。investigation Issue へ変更すべき」と明示し、新 Outcome/In Scope/AC を提供。人間承認取得済み。
Guard 結果
issue_kind 正規化メモ
入力要求
issue_kind: investigationはリポジトリの contract schema enum(implementation/research/parent)に存在しないため、最近似値researchへ正規化した。change_kindも同様にinvestigation→research-onlyへ変更。本文 Machine-Readable Contract に NOTE コメントとして明記済み。バックアップ
tmp/issue_204_backup_1779432878.md(rollback 用)squne121 commentedon May 22, 2026
Issue Edit: Required Skills 正規化(C7 fix)
変更理由: issue-refinement-loop の review-issue 決定論チェック C7(Required Skills 意味論)が fail。
## Required Skillsにローカル transcript / log 調査(read-only)という自由記述(/を含む)が残っており、skill 名または「なし」でない表記が document-path 誤検知パターンに該当すると判定された。変更内容(structural-only / 意味は不変):
変更箇所は
## Required Skillsセクションの1行のみ。Goal / Outcome / In Scope / Acceptance Criteria など他の全セクションは無変更。人間承認取得済み・structural-only 修正のため即時適用。
squne121 commentedon May 22, 2026
issue-refinement-loop: 完了 (2026-05-22T07:06:45Z)
reframe_in_place)改善履歴
No-Go as-is敵対的レビューに基づき、本 Issue を「SKILL.md への Step 間自律継続文言追記」から「Claude Code セッション途中停止・再開要求の根本原因をログから分類する調査 Issue」へ in-place reframe。タイトル変更(改善:→調査:)、ラベルphase/implementation→phase/research化、Handoff Contractセクション補完。## Required Skillsが/を含む自由記述)を修正し「なし」表記へ正規化。approve。fact-check サマリ(Step 1 / 1b)
needs-fix → Step 4遷移を Loop Structure / Step 2 に明示済み。旧 調査: issue-refinement-loop / Claude Code セッションの途中停止・再開要求の根本原因をログから分類する #204 の前提「文言追記が必要」は誤り。StopとStopFailureは別 event。StopFailureは decision control を持たず(informational-only)、hook 側から会話継続を強制できない。通常停止と rate limit 停止は別系統。~/.claude/settings.jsonにStop/SubagentStophook が既存・~/.claude/hooks/claude_tmux_state.py稼働中(ただし tmux 状態追跡用で LOOP_STATE-aware ではない)。StopFailurehook・project 配下.claude/hooks/は未整備。次アクション
issue-contract-reviewで着手前 preflight を通したのち、調査(transcript / hook event 分類)を実行する。squne121 commentedon May 22, 2026
#204 調査完了: INTERRUPTION_ROOT_CAUSE_REPORT_V1
issue-refinement-loop(再実行)の Step 0–2 で本 Issue 本文は
approve品質を再確認(C1–C11 全 pass、前回 approve から無変更)。続けて本 Issue の Outcome である停止根本原因のログ調査を実行し、結果を以下に記録する。根本原因サマリ(prose)
直近7日(2026-05-15〜05-22)の
~/.claude/projects/-home-squne-projects-LOOP-PROTOCOL/**/*.jsonlから「再開して」系のユーザー入力を抽出し 15 インシデント を分類した。全件が 2026-05-21〜05-22 に集中しており、人間所感「最近多い」と一致する。支配的原因(12/15 = 80%)は
normal_stop_without_loop_completion。その正確な機構は #204 旧前提(SKILL.md 文言不足)とは異なる:決定的証跡: transcript
0db7315e/ac9e101cではreview-issue完了(verdict がneeds-fixでもapproveでも)の毎回停止し、issue-author(SubAgent)完了後は一度も停止していない。停止はreview-issueという Skill の完了境界に固定して発生する。これは #204 の C1 検証(SKILL.md には既に
needs-fix → Step 4遷移が明示済み)と整合する。文言追記では解決しないことが、実ログで裏付けられた。副次原因(3/15 = 20%)は
stopfailure_rate_limit。session limit 2 件(isApiErrorMessage:true"You've hit your session limit")と529 Overloaded1 件。#204 web 調査(C3/C4/C8 supported)どおりStopFailureは decision control を持たず、hook からの自動継続は不可能。対策はログ保存 + resume playbook。compaction_or_state_lossは 0 件: 全 resume 後、LOOP_STATEは文脈内に保持され継続に成功していた(モデルは resume 直後にLOOP_STATEYAML を再掲)。subagent_stop_without_orchestrator_resume/remote_control_or_ui_disconnectも 0 件。follow-up Issue(AC5 / 次アクション)
Stophook を導入し、未完了ループの途中停止をdecision:blockで構造的に防止StopFailurehook でログ保存 + resume playbook を docs 化(#224 の.claude/hooks/基盤に依存)次アクション: #224 → #225 の順に
issue-contract-reviewで着手前 preflight を通し、impl-review-loopで実装・検証・レビューを進められる。#224 が支配的原因(80%)への対策のため優先。調査ログ全文:
/tmp/claude_resume_incidents.txt(ローカル)。squne121 commentedon May 22, 2026
issue-refinement-loop + 調査完了: #204 クローズ (2026-05-22T07:35:59Z)
refinement loop(再実行)
needs-fix → Step 4遷移は既存)/ project hooks 完全未実装を確認StopとStopFailureは別 event、StopFailureは decision control なし)approve(C1–C11 全 pass、前回 approve から本文無変更)調査本体(#204 Outcome)
normal_stop_without_loop_completion12/15(80%)。機構は nested Skill 完了時のend_turn境界(SkillとAgent(SubAgent) の turn 境界非対称性)。調査: issue-refinement-loop / Claude Code セッションの途中停止・再開要求の根本原因をログから分類する #204 旧前提『SKILL.md 文言不足』は C1 で反証。stopfailure_rate_limit3/15。compaction_or_state_lossは 0 件。follow-up implementation Issue(AC5 / 次アクション)
類似 Issue への追記
次アクション
本 Issue(調査)は Outcome 達成によりクローズ。後続は #224 → #225 の順に
issue-contract-reviewで着手前 preflight を通しimpl-review-loopで実装・検証・レビューを進められる状態。