Long Claude Code tasks: how to step away
Updated
Quick answer
A long Claude Code task stalls for three reasons: the computer goes to sleep, Claude stops at a permission prompt, or it finishes and waits for the next instruction while nobody is looking. Keep the computer awake, allow the routine commands in advance, and send the remaining prompts to your phone so you can answer them where you are.
Why long tasks stall
- The computer sleeps. The
claudeprocess stops with it, and so does the task. - A permission prompt. In Manual mode, Claude stops before most commands and edits. A prompt never resolves on its own, so a task that hits one at minute five waits until you come back.
- The end of a turn. Claude finishes a step, reports, and waits for what’s next. Nothing is wrong, but nothing moves either.
On a Claude plan there is a fourth pause: a usage limit. By default Claude Code waits in the open session and continues on its own after the reset (the autoContinueAtUsageLimit setting). If the computer slept for more than about 30 minutes during that wait, it waits for you to press Enter instead.
Write a task that can finish without you
Most stalls start with a vague request. Before you leave, give Claude what it needs to keep going alone:
- What done looks like, with the command that proves it: “done when
npm testpasses and the build is clean”. - What to do when blocked: skip the item, note it, and carry on with the rest, rather than stop and ask.
- A plan you have read. Start in plan mode (Shift+Tab until
⏸ plan mode on), let Claude propose, approve the plan, then leave. The approval itself is a prompt, so give it before you go.
Allow the routine, keep the risky
The commands a long task runs over and over, tests, lint, builds, commits, should not need you. Put them in allow rules, keep pushes and deploys behind a prompt, and deny what must never happen:
~/.claude/settings.json or the project’s .claude/settings.json
{
"permissions": {
"allow": ["Bash(npm run *)", "Bash(git commit *)"],
"ask": ["Bash(git push *)", "Bash(npm publish *)"],
"deny": ["Read(./.env)"]
}
}
Two modes go further. In auto mode, the starting mode of interactive sessions since version 2.1.283, a classifier reviews each action instead of you, and only your ask rules and a few risky actions still prompt. Anthropic’s own advice is to use it for tasks whose direction you trust, not as a replacement for review. And for a run nobody will watch, permissions.denyInsteadOfPrompting (version 2.1.319 or later) denies whatever would wait on a prompt and lets the turn continue; it also takes away Claude’s questions and its way out of plan mode, so approve your plan before you go.
Keep the computer awake
Swipe the table sideways to see both columns.
| System | Command or setting |
|---|---|
| macOS | caffeinate -i claude keeps the Mac from idle sleep for as long as Claude Code runs. Closing a MacBook’s lid still puts it to sleep, unless it runs on power with an external display. |
| Linux | systemd-inhibit --what=idle:sleep claude blocks idle sleep while Claude Code runs. |
| Windows | PowerToys Awake, or a longer sleep delay in Settings › System › Power & battery. |
| A server over SSH | Run Claude Code inside tmux or screen, so the session survives when the connection drops. |
A desktop that never sleeps, or a small server, is the calmest home for overnight runs.
Send the waits to your phone
Some prompts will remain, and that is the point: they are the decisions you kept for yourself. The question is how fast you hear about them. A Notification hook can post to a push service such as ntfy when a prompt has waited about six seconds; it tells you, and you walk back to answer.
With Monish, the waits come to your iPhone with what you need to answer them. A permission request arrives with the exact command and Allow and Deny. A question arrives with its options. A finished turn arrives with Claude’s last message, and your reply becomes the next instruction, which is often all a long task needs to keep moving. Your iPhone can answer within the answer window set in the app’s Settings, 10 minutes by default; after that, Claude Code asks you in the terminal. Pair with curl -fsSL https://monish.cc/install.sh | sh -s and the code from the app.
Follow it on the lock screen
Between the waits, a session card keeps the run on your lock screen and in the Dynamic Island: the step Claude is on and how long it has been working, updated in place rather than as a stream of notifications. When Claude needs you, the same card shows the request with Allow and Deny, and a notification with sound goes out. iOS keeps a Live Activity for eight hours at most, which covers most runs. Claude Code on your lock screen explains what the card can show.
Questions
- Is auto mode safe for an overnight run?
- It reduces prompts but does not guarantee safety. Anthropic recommends it for tasks where you trust the general direction. Keep ask rules for pushes and deploys, and use a container for anything you would not want run unattended.
- Will Claude continue after a usage limit?
- By default, yes: Claude Code waits in the open session and continues after the reset. If the computer slept for more than about 30 minutes during the wait, it waits for you to press Enter.
- Does closing my laptop stop Claude Code?
- Sleep stops the claude process until the computer wakes. Keep it awake with caffeinate on macOS or systemd-inhibit on Linux, and keep a MacBook’s lid open unless it runs on power with an external display.
- Can I keep a long task going from my phone without Remote Control?
- Yes. Hooks run on your computer: with Monish, you allow or deny requests, answer questions and send the next instruction from your iPhone, with any Claude Code sign-in.
More guides
- Claude Code permission modes, and fewer promptsManual, auto, plan and the rest, and rules that cut the prompts you don’t need.
- Approve Claude Code permissions from your iPhoneHow a hook hands your Allow or Deny back to Claude Code.
- Claude Code on your lock screen and Dynamic IslandOne card per session, with Allow and Deny on it, and what iOS allows.
- Get notified when Claude Code finishesThe Stop hook on macOS, Windows and Linux, then on your phone.
New to Monish? The home page shows what lands on your iPhone, and all guides are listed here.
Get Monish on your iPhone
Free, no account. Your 6-digit code is waiting in the app.