You are waiting. The spinner turns, the agent keeps going, and nothing you want is happening. Claude Code is stuck. But there is no single stuck state, there are three, and reaching for the wrong fix wastes the session. The trick is to name which one you are in first, then the fix is obvious and usually instant.
What “stuck” actually means
People say stuck for three different situations. Runaway is the agent grinding through a huge exploration or an endless tool loop, doing work you never asked for. Spinner is the esc to interrupt line that never resolves, usually a hung tool call. Repeat is the agent looping on the same broken fix, sure it is close when it is not. Each has its own cause, so each has its own way out.
/rewind to restore an earlier state.esc to interrupt line hangs. It is a stuck tool call or an MCP server not responding. Press Esc, disable MCP servers you are not using, and check your network./clear and restate the task specifically, so it starts clean.How to unstick it right now
- Press
Esc. This interrupts whatever the agent is doing without losing the conversation. It is the first move for a runaway action or a hung spinner. Nothing is destroyed, you just take back control of the turn. - Use
/rewindto restore a prior state. If the agent has already made a mess of edits during a runaway, rewind takes the working tree back to a known-good point instead of you undoing changes by hand. - Turn off MCP servers you are not using. A hung MCP server is a common cause of a spinner that never ends, and each connected server also eats context. Disable the ones this task does not need, then check your network.
- Run
/clearand restate the task. When the agent loops on the same broken fix, the context is confused. Clear it, then describe the task specifically, one concrete outcome, so it starts from a clean window. - Break the task down. If it keeps getting stuck on one request, that request is too big. Split it into smaller steps the agent can finish and confirm one at a time.

How to stop getting stuck
The fixes above are for after it happens. The better move is an agent that gets stuck far less. Most stuck sessions start the same way: the agent charges into a huge exploration or starts building before it knows what you actually want, and runaway exploration is a documented Claude Code complaint. An ask-first agent plans the work and confirms scope before it touches anything, so it never spirals into a 30-tool-call detour and never quietly bloats its own context to the point of looping.
That ask-first habit is exactly what kitstarter builds in. The kit ships an ask-first clarity hook on `UserPromptSubmit` that makes the agent confirm scope before it builds, a safety-guard `PreToolUse` hook that can deny, allow, or ask before a risky action, and subagent-rules so those rules survive the `Task` boundary into every subagent. That is why a kitstarter-driven agent gets stuck far less: it plans, asks, and stays in scope instead of thrashing. The same discipline is what keeps a session from getting slow, and it is the cure for over-building too.
Common questions
Why does Claude Code get stuck? Usually one of three things: a runaway action where the agent explores or loops far beyond the task, a hung tool call or unresponsive MCP server that leaves the spinner turning, or a bloated context that makes the agent repeat the same broken fix. Each has its own fix, so the first step is telling which one you are in.
How do I stop Claude Code when it is stuck? Press Esc. It interrupts whatever the agent is doing and preserves your context, so you take back control of the turn without losing the conversation. If the agent already made a mess during a runaway, use /rewind to restore an earlier state, and use /clear when a confused context has it looping.
What does “esc to interrupt” mean? It is the line Claude Code shows while it is working, telling you that pressing Esc will stop the current action. If that line hangs and never resolves, the cause is usually a stuck tool call or an MCP server not responding. Press Esc, disable MCP servers you are not using, and check your network.
How do I stop Claude Code going off on its own? Use an ask-first setup that plans and confirms scope before the agent explores or builds, so it never spirals into a long runaway detour. kitstarter ships an ask-first clarity hook and a safety-guard hook that do exactly this, which is why a kitstarter-driven agent stays in scope instead of running away.
Keep the agent on task by default
kitstarter makes your agent ask first and stay in scope, so it plans instead of thrashing, for Claude Code, Codex, and Antigravity.
