Blog · Claude Code

Can Claude Code run 24/7? How to run it overnight and unattended

Yes, with limits. Claude Code has no clock of its own that stops it, but four things do: the session ends or the computer sleeps, it stops at a permission prompt, it hits your plan's usage limit, or it finishes and has nothing to do next. Each has a fix. This guide covers the ways to keep Claude Code working while you sleep, what each one can't do, and how to give it a standing night shift.

Ways to keep Claude Code running

Some keep one conversation going, so Claude remembers what it did; others start a fresh session each time with the same prompt.

OptionComputer can be offSame conversationWhere it stopsBest for
Cloud session (claude --cloud, claude.ai/code)YesYesStops after a period of inactivity; the VM is reclaimedOne long task you hand off before bed
Cloud scheduled tasks (/schedule)YesNo, a new session each runAt most hourly; Pro, Max, Ultra, Team or EnterpriseRepeating jobs that only need a repository
Desktop scheduled tasksNo: app open, computer awakeNo, a new session each runOnly while the machine is awakeNightly jobs on local files
/loopNo: session openYesEnds with the session; recurring loops expire after 7 daysWatching CI or a deploy for a few hours
cron + claude -p --resumeNoYesYour cron rhythm; you wire it up yourselfOne agent working through a TODO file
Crewmark heartbeatNoYesWorking hours you set, even past midnightA standing job taken from a board, issue by issue

How to run Claude Code overnight

  1. Pick a permission mode that won't stop for every prompt

    A session waiting at a permission prompt at 2am does nothing until morning. Auto mode runs actions with background safety checks instead of asking. Keep bypassPermissions, which skips every check, for isolated containers and VMs.

    # Keep a Mac awake while Claude Code works (it can sleep again once claude exits)
    caffeinate -i claude --permission-mode auto
    
    # Or hand the task to a cloud session, which keeps running with your laptop closed
    claude --cloud "Execute the migration plan in docs/migration-plan.md"
    
    # Queue the next step into that cloud session from any machine
    claude -p "When that's done, update the changelog" --cloud <session-id>
  2. Give it a finish line

    /goal takes a condition, such as a test suite passing; after each turn Claude checks it and starts another turn by itself until it's met. For a longer night, leave a TODO file or a written plan in the repository and tell it to work through it in order.

  3. Keep the machine awake, or move the work to the cloud

    A local session needs the computer on and the claude process running. On a Mac, caffeinate -i keeps it awake while Claude Code runs; on a server, run claude inside tmux or screen so it survives a closed terminal. A cloud session keeps running after you close your laptop.

  4. Plan for usage limits

    Claude plans use a rolling 5-hour window plus a weekly limit, shared with chat. Max gets 5 times Pro's usage; Ultra gets 10 times Pro per week and, for verified accounts, no 5-hour limit. If the limit hits mid-task, Claude Code may finish the current step (once a week on Pro, every time on Max). Usage credits or an API key let it keep going. See how to reduce Claude Code token usage.

  5. Check in from your phone

    Remote Control lets you look at a local session from the Claude app or a browser, and cloud sessions show up in the app's Code tab. If Claude asked a question overnight, answer when you wake up and it carries on. See Claude Code Remote Control.

Source: Anthropic's Claude Code docs on cloud sessions

What stops Claude Code overnight

  • The terminal closes or the computer sleeps. A Remote Control session reconnects once the machine is awake, but no work happens while it's asleep.
  • A permission prompt nobody answers. Auto mode avoids most of them.
  • The usage limit. The session waits until the window resets unless you add credits or an API key.
  • Inactivity in the cloud. Cloud sessions stop after a while without activity, including while they wait for you to approve an MCP tool call. Reopening restores the conversation, but not shell commands, subagents or a /loop that were still running.
  • Running out of work. Once the goal is met or the TODO list is empty, it stops, which is what you want.
  • A very long session. Claude Code compacts the context automatically, so early details survive only as a summary. Keep the plan in a file, not just in the chat.
With Crewmark

Give Claude Code a night shift

Running all night is easy to start and hard to keep up: someone has to queue the next task each morning. Crewmark turns a Claude Code conversation into an AI employee with working hours and a heartbeat, so it keeps taking work from a board on its own.

  1. Set the working hours

    Working hours can run past midnight, so a night shift such as 22:00 to 07:00 works, weekdays only or every day. Outside its hours the employee sleeps and doesn't touch your plan.

  2. Pick the heartbeat

    During its shift, the crewmark CLI wakes the same conversation every 15, 30, 60, 120 or 240 minutes to take the next issue. If the conversation was closed, Crewmark resumes it with claude -p --resume in auto mode. Your computer has to stay on.

  3. Read the board in the morning

    Each issue has its comments and activity log, and anything that needs you arrives as a message the employee waits on. See how to make Claude Code proactive and what an AI employee is; for Codex, read Codex long-running tasks.

FAQ

Can Claude Code run 24/7?

Yes, as long as something keeps it going: a cloud session or cloud scheduled task with your computer off, or a local session on a machine that stays awake, with a permission mode that doesn't stop for prompts. Usage limits still apply, so around-the-clock work needs a plan with room, or credits.

Can I leave Claude Code running overnight?

Yes. Start it in auto mode with a clear goal or a TODO file, keep the machine awake (or use claude --cloud), and check the result in the morning. Anything that needs you will be waiting as a question.

Does Claude Code keep running when I close my laptop?

A local session doesn't: it needs the computer on and the claude process running, and a Remote Control session ends when its terminal closes. A cloud session does keep running, and you can check on it from the Claude app.

Is there an unattended mode in Claude Code?

Not under that name. Unattended runs combine a permission mode that doesn't ask (auto mode, or bypassPermissions in an isolated container) with headless mode, claude -p, or a cloud session.

Will running Claude Code all night hit my usage limit?

It can. All Claude plans share a 5-hour window and a weekly limit between chat and Claude Code; Ultra drops the 5-hour limit for verified accounts. Spread work across windows with a heartbeat or a schedule instead of one long burst.

Is it safe to let Claude Code run unattended?

Use auto mode rather than bypassPermissions on your own machine, work in a repository where every change goes through review, and keep production credentials out of reach. Cloud sessions run in isolated VMs with limited network access by default.

Checked against the Claude Code docs (cloud sessions, scheduled tasks, Remote Control) on November 8, 2026.

Give Claude Code a night shift.

Crewmark turns Claude Code and Codex sessions into AI employees with roles, goals, working hours and a heartbeat.