{"slug": "cliffhanger-a-stop-hook-that-keeps-claude-code-from-quitting-early", "title": "cliffhanger, a Stop hook that keeps Claude Code from quitting early", "summary": "A developer built cliffhanger, an open-source Stop hook and skill for Claude Code that blocks the agent from ending a turn while checklist items remain open, allowing a real stop only for named blockers, background tasks, plan mode, or after three automatic continuations. In a 12-task benchmark on a small app with a restrictive tool allowlist, Claude Sonnet 5.5 skipped running the test suite before its first stop in 6 of 12 baseline runs versus 0 of 12 with cliffhanger active, at roughly 4 percent higher cost. The regex detector behind the early-stop patterns flagged exactly the 6 test-skipping runs and none of the other 42 first final messages across all 48 runs.", "body_md": "I kept running Claude Code on long, multi part tasks overnight, and kept coming back to a summary that ended with an offer: \"Want me to continue with the rest?\" or \"Once you approve it, I will run the tests.\" Nobody was there to answer, so the job stopped with work still owed.\n\nAnthropic's own prompting guide for Opus 5.5 names four ways this happens: announcing the next step instead of taking it, offering to continue, listing decisions for the user that do not actually block the work, and treating a milestone as a good place to stop. I kept seeing all four in headless runs.\n\ncliffhanger is a Stop hook plus a skill for Claude Code. On every Stop and SubagentStop event it reads the agent's own checklist, built from TaskCreate and TaskUpdate calls, the latest TodoWrite list, or a Markdown to do list the agent wrote in that turn. If items are still open, it blocks the stop and names what is left. It lets a real stop through: a line that names a blocker, background tasks still running that will wake the session later, plan mode, or a cap of three automatic continuations per user turn so it cannot loop forever.\n\nI ran a benchmark: 12 multi part tasks (write code, update tests, run the full suite) on a small app, with a restrictive tool allowlist that only permits pytest, not python -m pytest. Under that allowlist, Claude Sonnet 5.5 skipped running the suite before its first stop in 6 of 12 baseline runs, usually right after a refused test command. With cliffhanger active, 0 of 12. The cost went up about 4 percent, mostly the extra turn it takes to run the suite before stopping.\n\nThe regex detector behind the early stop patterns, tested alone against the first final message of all 48 runs in the benchmark, caught exactly the 6 runs that skipped the tests and flagged none of the other 42. That is a small sample from one model on one fixture, and the method and raw tables are in the repo rather than just claimed in the README.\n\nIt only helps with Claude Code's Stop hook today, though an AGENTS.md version ships for agents that read plain instructions instead of hooks. The early stop patterns come from one failure mode on one fixture, so I expect to add more as they show up elsewhere.\n\ncliffhanger is free, MIT licensed, and has no dependency beyond Python's standard library.", "url": "https://wpnews.pro/news/cliffhanger-a-stop-hook-that-keeps-claude-code-from-quitting-early", "canonical_source": "https://dev.to/arthur031221/cliffhanger-a-stop-hook-that-keeps-claude-code-from-quitting-early-42oa", "published_at": "2026-10-01 16:07:02+00:00", "updated_at": "2026-10-01 16:14:29.683248+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "large-language-models"], "entities": ["Claude Code", "Anthropic", "cliffhanger", "Claude Sonnet 5.5", "Opus 5.5", "pytest"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/cliffhanger-a-stop-hook-that-keeps-claude-code-from-quitting-early", "markdown": "https://wpnews.pro/news/cliffhanger-a-stop-hook-that-keeps-claude-code-from-quitting-early.md", "text": "https://wpnews.pro/news/cliffhanger-a-stop-hook-that-keeps-claude-code-from-quitting-early.txt", "jsonld": "https://wpnews.pro/news/cliffhanger-a-stop-hook-that-keeps-claude-code-from-quitting-early.jsonld"}}