/loop exit doesn't terminate loop — Stop hook condition persists across exit invocation
Resolved 💬 3 comments Opened May 14, 2026 by KCW89 Closed May 17, 2026
Summary
Two overlapping issues prevent users from cleanly stopping a /loop or /goal directive once it's been set:
/goal(or the goal embedded in a/loopprompt) is locked to its original phrasing. When the user changes their mind mid-flight and cancels some of the work, the assistant correctly marks those tasksstatus=deleted. But the Stop hook keeps evaluating against the original goal wording and treatsdeleted ≠ completedliterally, so the condition can never be satisfied./loop exitdoesn't terminate the loop. The Stop hook condition installed by the original/loop <prompt>invocation persists across/loop exit. There is no documented escape hatch.
Reproduction
- Start
/loop <multi-task goal>(or set a/goalwith multiple sub-tasks) — Stop hook is installed evaluating against that goal - Mid-session, redirect work so one or more sub-tasks are explicitly cancelled by the user (legitimate reason — e.g. discovered cost, deprioritised, blocker can't be resolved). Assistant marks them
status=deletedrather than falsely flipping tocompleted - Try to end the loop with
/loop exit - Expected: Stop hook condition clears, no further hook firings
- Actual: Stop hook continues firing the same
[<original goal>]: …condition on every turn, citing the deleted tasks as proof the condition isn't met. Loop is unrecoverable without closing the session
Impact
- No way to amend a goal once set — if user redirects mid-flight, the hook stays anchored to the original phrasing forever
- No working escape hatch —
/loop exitis documented as the way out but doesn't unregister the Stop hook - Hundreds of identical Stop hook firings per session burn tokens against an impossible condition (deleted ≠ completed, work explicitly cancelled by user)
- Assistant is reduced to replying with literal
.messages for dozens of hook firings before user can force-quit - The failure mode is symmetric: any user who runs
/loopor/goaland then changes their mind hits this
Suggested fixes (pick one or combine)
/loop exitshould explicitly unregister the Stop hook condition it installed. Currently the exit subcommand is a no-op for the hook side of the loop./goalshould support mid-flight amendment. When the user redirects, allow the assistant (or user) to update the goal text so the hook re-evaluates against the new scope.- Stop hook should treat
status=deletedas terminal (equivalent tocompleted) when evaluating "all tasks finished" — deletion-by-user-redirect is a legitimate stop signal, not an unmet condition. - Surface a clearer force-exit — e.g.
/loop force-exitor a setting that drops any active Stop hook conditions.
Environment
- Claude Code (Opus 4.7, fullscreen TUI)
- Skill:
/loop(dynamic mode, rule 3 — no fixed interval) and/or/goal - Stop hook configured by the skill at invocation time
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗