All Insights
#SundayCoffeeAndCode
October 2026

Sunday Coffee & Code: How Do You Stop Claude Code from Running Away?

One of the interesting challenges I've been dealing with in my Spec-Driven Development (SDD) work is how to give Claude Code enough autonomy to build software while ensuring it knows when to stop and ask for help.

By Steve Harris

โ˜• ๐—ฆ๐˜‚๐—ป๐—ฑ๐—ฎ๐˜† ๐—–๐—ผ๐—ณ๐—ณ๐—ฒ๐—ฒ & ๐—–๐—ผ๐—ฑ๐—ฒ: ๐—›๐—ผ๐˜„ ๐——๐—ผ ๐—ฌ๐—ผ๐˜‚ ๐—ฆ๐˜๐—ผ๐—ฝ ๐—–๐—น๐—ฎ๐˜‚๐—ฑ๐—ฒ ๐—–๐—ผ๐—ฑ๐—ฒ ๐—ณ๐—ฟ๐—ผ๐—บ ๐—ฅ๐˜‚๐—ป๐—ป๐—ถ๐—ป๐—ด ๐—”๐˜„๐—ฎ๐˜†?

One of the interesting challenges Iโ€™ve been dealing with in my Spec-Driven Development (SDD) work is how to give Claude Code enough autonomy to build software while ensuring it knows when to stop and ask for help.

Iโ€™m using Claude Code, GitHub Spec-Kit and a set of custom harnesses to analyse requirements, break them into features, tasks and phases, then progressively build and verify the application - ๐˜ต๐˜ฉ๐˜ช๐˜ด ๐˜ณ๐˜ถ๐˜ฏ๐˜ด ๐˜ญ๐˜ข๐˜ณ๐˜จ๐˜ฆ๐˜ญ๐˜บ ๐˜ถ๐˜ฏ๐˜ข๐˜ต๐˜ต๐˜ฆ๐˜ฏ๐˜ฅ๐˜ฆ๐˜ฅ, ๐˜ช๐˜ฏ๐˜ค๐˜ญ๐˜ถ๐˜ฅ๐˜ช๐˜ฏ๐˜จ ๐˜ฐ๐˜ท๐˜ฆ๐˜ณ๐˜ฏ๐˜ช๐˜จ๐˜ฉ๐˜ต.

The challenge isnโ€™t just getting Claude to do the work. ๐—œ๐˜โ€™๐˜€ ๐—ฝ๐—ฟ๐—ฒ๐˜ƒ๐—ฒ๐—ป๐˜๐—ถ๐—ป๐—ด ๐—ถ๐˜ ๐—ณ๐—ฟ๐—ผ๐—บ ๐—ด๐—ผ๐—ถ๐—ป๐—ด ๐—ฑ๐—ผ๐˜„๐—ป ๐—ฟ๐—ฎ๐—ฏ๐—ฏ๐—ถ๐˜ ๐—ต๐—ผ๐—น๐—ฒ๐˜€, ๐—ฟ๐—ฒ๐—ฝ๐—ฒ๐—ฎ๐˜๐—ฒ๐—ฑ๐—น๐˜† ๐—ฎ๐˜๐˜๐—ฒ๐—บ๐—ฝ๐˜๐—ถ๐—ป๐—ด ๐˜‚๐—ป๐˜€๐˜‚๐—ฐ๐—ฐ๐—ฒ๐˜€๐˜€๐—ณ๐˜‚๐—น ๐—ณ๐—ถ๐˜…๐—ฒ๐˜€ ๐—ผ๐—ฟ ๐—บ๐—ฎ๐—ธ๐—ถ๐—ป๐—ด ๐—ฑ๐—ฒ๐—ฐ๐—ถ๐˜€๐—ถ๐—ผ๐—ป๐˜€ ๐—ถ๐˜ ๐˜€๐—ต๐—ผ๐˜‚๐—น๐—ฑ๐—ปโ€™๐˜.

Iโ€™ve approached this with several layers of control, separating what is enforced deterministically from what requires the agent to exercise judgement.

๐—›๐—ฎ๐—ฟ๐—ฑ ๐—ฐ๐—ผ๐—ป๐˜๐—ฟ๐—ผ๐—น๐˜€: ๐—ง๐—ต๐—ถ๐—ป๐—ด๐˜€ ๐—–๐—น๐—ฎ๐˜‚๐—ฑ๐—ฒ ๐—ฐ๐—ฎ๐—ป๐—ป๐—ผ๐˜ ๐—ป๐—ฒ๐—ด๐—ผ๐˜๐—ถ๐—ฎ๐˜๐—ฒ.

I have a Python session guard integrated into Claude Code through hooks that checks every action, including subagent activity. It enforces limits such as 450 calls per session, 200 calls without meaningful progress and an eight-hour session ceiling. It also blocks prohibited actions.

A PowerShell orchestration script checks the environment before launching each phase, verifies completion and decides whether another iteration is required - including self-tests.

๐—ฆ๐—ผ๐—ณ๐˜ ๐—ฐ๐—ผ๐—ป๐˜๐—ฟ๐—ผ๐—น๐˜€: ๐—ช๐—ต๐—ฒ๐—ฟ๐—ฒ ๐—–๐—น๐—ฎ๐˜‚๐—ฑ๐—ฒ ๐—ป๐—ฒ๐—ฒ๐—ฑ๐˜€ ๐—ท๐˜‚๐—ฑ๐—ด๐—ฒ๐—บ๐—ฒ๐—ป๐˜.

CLAUDE.md, feature-specific notes and Spec-Kit skills define how the work should proceed and, importantly, when Claude should stop and escalate.

For example, Claude can make routine implementation decisions within agreed boundaries. But when it encounters something requiring a business or architectural decision, it needs to stop and ask me.

There are also explicit limits on repeatedly attempting fixes, waiting for CI, and continuing when unexpected failures accumulate.

๐— ๐—ผ๐—ป๐—ถ๐˜๐—ผ๐—ฟ๐—ถ๐—ป๐—ด: ๐—ž๐—ป๐—ผ๐˜„๐—ถ๐—ป๐—ด ๐˜„๐—ต๐—ฎ๐˜โ€™๐˜€ ๐—ต๐—ฎ๐—ฝ๐—ฝ๐—ฒ๐—ป๐—ถ๐—ป๐—ด ๐˜„๐—ถ๐˜๐—ต๐—ผ๐˜‚๐˜ ๐—ถ๐—ป๐˜๐—ฒ๐—ฟ๐—ณ๐—ฒ๐—ฟ๐—ถ๐—ป๐—ด.

A dashboard, run files and notifications let me monitor progress without having to supervise every action.

๐— ๐˜† ๐—ฎ๐—ฝ๐—ฝ๐—ฟ๐—ผ๐—ฎ๐—ฐ๐—ต ๐—ถ๐˜€ ๐—ฑ๐—ฒ๐—น๐—ถ๐—ฏ๐—ฒ๐—ฟ๐—ฎ๐˜๐—ฒ: wherever I can replace a probabilistic control with a deterministic one, I do. Prompt-based controls are for situations that require judgement. The objective isnโ€™t to constrain Claude - allow it to make the decisions itโ€™s qualified and authorized to make, while reliably escalating those that need human judgement.

Designing an engineering environment in which agents can work independently, within clearly defined boundaries, with appropriate controls and accountability is becoming the most interesting part of the SDD work.

Want to Discuss This Topic?

Steve is always happy to have a direct conversation.