Let Claude Code work overnight: the prompt, the setup, and the morning check
Claude Code can keep working while you sleep, but only if three things are settled before you go: a plan you both agreed on, permissions that let it run the plan and nothing it can’t undo, and a prompt that says when to stop and what to leave you. In the morning, ask for a short report before you read any code. Both prompts are below, word for word, with the checks that decide whether you wake up to finished work or to a session that stopped at its first question.
- The bedtime prompt
- Before you go to bed
- Where to run it
- What not to leave it
- The morning prompt
- Questions
The prompt I send before I go to bed
Send it after the plan is agreed, in the same session. Change nothing, or change the tone; the structure is what works.
I'm done for today. You're not.
Keep working through the night. Follow the plan step by step, and run the tests after each one.
Stop only if it's critical: something you can't undo, or a change to the plan itself. Then write the question at the top of your notes and wait for me.
Everything else, decide yourself and write down why.
Commit what works. Leave what doesn't on a branch, with a note.
In the morning, show me what you finished, what broke, and where to start, small enough to start with a coffee.
Thanks. See you tomorrow.- “Follow the plan, run the tests after each step” gives it a way to know a step is done without you.
- Two reasons to stop, no more. Something it can’t undo, or a change to the plan. Without a short list, it either stops at every doubt or never stops at all.
- “Write down why” turns a night of silent guesses into a list of decisions you can check in five minutes.
- Working code and experiments stay apart. What works is committed; what doesn’t waits on a branch with a note.
Before you go to bed: five checks
- A plan with a check for every step. Agree on it in plan mode first. “Done when the tests pass” is a check; “make it better” isn’t. A night without a plan is a night of guessing.
- Its own worktree. Start the night’s session with
claude --worktree night-run: a separate checkout on its own branch. Nothing it does at 3 a.m. touches the code you open in the morning, and throwing the night away is one command. - Permissions for the plan, and nothing more. A session that stops at its first permission prompt waits there all night. Auto mode is the simplest fix: a separate model reviews each action before it runs, so routine steps go through without you. Since version 2.1.283 it’s where interactive sessions start; Shift+Tab switches to it otherwise. Anthropic’s own docs say it reduces prompts but doesn’t guarantee safety, so add deny rules for what must never happen (below).
- A Mac that stays awake. A sleeping Mac stops the session. In the Claude desktop app, turn on Keep computer awake (Settings → Desktop app). In a terminal, run
caffeinate -iin a second tab and stop it in the morning. Either way, leave the lid open and the charger in: closing the lid puts the Mac to sleep anyway. - Room in your limits. A night uses your plan’s usage like any other session. On a subscription, an open session that hits the 5-hour limit waits and carries on by itself once the window resets, up to three times. If the Mac slept more than about half an hour past the reset, it waits for you to press Enter (how the limits work).
Deny rules beat every allow rule, in every mode. Put them in the project’s .claude/settings.json:
.claude/settings.json
{
"permissions": {
"allow": [
"Bash(npm test *)",
"Bash(npm run build *)"
],
"deny": [
"Bash(git push *)",
"Bash(npm publish *)",
"Edit(/migrations/**)"
]
}
}
A rule matches the command as it’s written: Bash(git push *) won’t catch git -C . push. So a deny rule is a guardrail, not a lock. And skip --dangerously-skip-permissions on your own Mac: the docs say to use it only in containers or virtual machines.
Last thing before you leave, run /status. Since version 2.1.327 it lists the permission settings Claude Code ignores and hook matchers that never match. A rule it ignores protects nothing, and tonight is the time to find out.
Where to run it
- The session you planned in, left open in the terminal or the desktop app. Your Mac stays on and awake, and if Claude has a question, it waits for you. Best for most nights: the plan and the whole day’s context are already there.
- A cloud scheduled task, made with
/scheduleor at claude.ai/code. It runs on Anthropic’s cloud, so the laptop can be closed, and in auto mode by default. It starts from a prompt and a repository, without today’s conversation, so put the plan in a file and commit it first. claude -pin a script. The Mac stays awake, and nobody answers questions: with--permission-prompts none, anything that would ask is denied. Good for repeatable jobs. Pick it up in the morning withclaude --resume.
If you leave the session open, Remote Control lets you see it and answer it from the Claude app on your phone: type /remote-control in the session before you go. Use it for the one question that would otherwise cost the whole night, not to keep checking. The point of the night is that you sleep through it.
What not to leave it overnight
- Anything it can’t undo: migrations on a shared database, deploys, pushes to your main branch, deleting data, sending email or messages, payments.
- A task without a check. “Clean up the codebase” has no finish line, so it won’t find one.
- A big refactor with no tests. It will finish, and you won’t know what it broke.
- Anything that needs a password or a key you’d have to type. It will sit at the prompt till morning, and approving it in a hurry is how secrets end up saved in settings (why).
The prompt I send in the morning
Before you open a single file, ask for the report. It’s faster to read than the diff, and it tells you where to look first.
Good morning. Before I read the code:
What you finished, one line each.
What broke, and what you tried.
Every important decision you made without me, and why.
The one thing I should look at first.
Keep it short enough to read with a coffee. Don't start anything new until I reply.Then check it the way you’d check a colleague’s work:
- The decisions first. Anything you’d have decided differently is where the bugs are.
- Then the diff, on the night’s branch, and run the tests yourself.
- To undo a step,
/rewindrestores the files Claude edited, but not changes made by shell commands. Git covers those, which is one more reason the night gets its own branch.
Where Meowdoro fits
We built Meowdoro, a focus timer around the MacBook notch for people who work with Claude Code and Codex. In the morning the notch shows each session at a glance: which one finished, which one failed, and which one has been waiting for your answer, with the question it’s waiting on. A click takes you to it. Try it and tell us what’s missing.
Questions
Can Claude Code run overnight?
Yes. Leave the session open on an awake Mac with an agreed plan, auto mode or allow rules for the plan, deny rules for what it must never do, and a prompt that says when to stop. Or use a cloud scheduled task, which runs with your laptop closed.
Does Claude Code keep running when my Mac sleeps?
No. Turn on Keep computer awake in the Claude desktop app, or run caffeinate -i in the terminal, and leave the lid open.
What happens when it hits the usage limit at night?
On a subscription, an open session waits and continues by itself after the 5-hour window resets, up to three times. If the Mac slept long past the reset, press Enter in the morning.
Is it safe to use --dangerously-skip-permissions overnight?
Anthropic recommends it only in containers or virtual machines. On your own Mac, use auto mode with deny rules for anything you can’t undo.
What if Claude has a question at 2 a.m.?
It waits for your answer. The bedtime prompt keeps those questions to the critical ones, at the top of its notes. Answer in the morning, or from your phone with Remote Control.
Related guides
How permission modes and rules, worktrees, the wait at a usage limit, scheduled tasks, Remote Control and checkpoints work: the Claude Code documentation on permission modes, permissions, cloud scheduled tasks, desktop scheduled tasks, Remote Control, interactive mode and checkpointing, read on November 18, 2026. What /status lists: the Claude Code changelog, version 2.1.327, read on November 19. caffeinate is a standard macOS command. The two prompts are the ones from our Instagram reels.