
Thursday night, around 11:40, I kicked off a Claude Code session on a side project before bed. The job was boring in the best way: split a 900-line Express route file into four modules, move the tests along with it, and leave everything green. I typed the prompt, watched it start reading files, and closed the laptop. When I opened it again at seven the next morning, the session had done about twenty minutes of real work and then spent the rest of the night doing nothing. It was sitting on a permission prompt, waiting for me to approve `npm test`.
That is the whole unattended-run problem in one screenshot. It was never about whether the model is good enough to work alone for six hours. It is about the fact that the tool stops and waits for a human at exactly the moment no human is there. Anthropic shipped a fix for that on November 6, in Claude Code v2.1.319, and it is a single setting: `permissions.denyInsteadOfPrompting`. When it is on, a tool call that would normally stop and wait for a permission prompt is denied instead, and the turn carries on. It applies in terminal sessions, subagents, and teammates.
I have been running it for a day, and the honest version is that it solves the stalled-night problem and creates a quieter one. That trade is worth understanding before you turn it on.
Deny is not allow, and that distinction is the whole setting
The first thing I got wrong about this setting is the one most people will get wrong. Deny-instead-of-prompting sounds like a way to let the agent do more. It is the opposite. It lets the agent do *less*, without stopping.
With the setting off, an unapproved tool call pauses the run and asks. With it on, the same call is refused and the agent moves on to the next thing. Nothing gets auto-approved. The run just stops asking. That is a meaningful difference from the other way people run Claude Code unattended, which is `--dangerously-skip-permissions` — a flag that approves everything, including writes to `.git` and `.claude`, and that every permissions guide I have read says belongs only in a disposable container. Deny-instead-of-prompting keeps the guardrails up. It changes what happens when the agent bumps into one.
Here is what that looked like in practice for me. I reran the same route-splitting job on Friday night with the setting on. The agent split the files, moved the tests, and then tried to run the test suite. My project settings did not have `npm test` on the allow list — I had allowed `npm run lint` and `npx tsc --noEmit` months ago and never added the test command, because in a normal session I just click approve. So the test run was denied, the turn continued, and the agent finished the job and reported the refactor complete. The code was fine. The tests had never run. If I had taken the summary at face value and merged on Saturday morning, I would have merged untested code that happened to be correct.
That is the failure mode of this setting, and it is sneaky precisely because it does not look like a failure. A stalled session is obvious: you wake up, you see the prompt, you know nothing happened after 11:58. A session that denied three tool calls and kept going looks finished. The transcript is the only place the denials show up, and nobody reads a six-hour transcript line by line before coffee.
So the setting does not remove the need for a morning review. It changes the review from "why did it stop" to "what did it skip." That is a better question, but it is still a question, and it needs an answer every time.
How I actually set it up
The setting alone is not a setup. It is one line in a permissions configuration that has to be right first, or the deny-instead-of-prompting behavior just papers over a sloppy allow list.
My rule for unattended runs is simple to state and annoying to maintain: every tool call the job can reach should resolve to a firm allow or deny in `settings.json`, and nothing should be left to a prompt. The project file, `.claude/settings.json`, is where the rules for a given repo live, and it is committed, so the same rules apply on any machine that clones the repo. My personal defaults live in `~/.claude/settings.json`. Rules are checked deny first, then ask, then allow, and the first match wins — a deny can never be cancelled by an allow somewhere else.
For the side project, the overnight allow list is narrow on purpose: reads, `npm run lint`, `npx tsc --noEmit`, `npm test`, `git status`, `git diff`, `git log`. The deny list is where the actual safety lives: `Bash(rm -rf *)`, `Bash(git push --force *)`, `Bash(git reset --hard *)`, `Bash(git clean -f *)`, `Bash(curl *)`, and reads of `.env` files. Deny rules are enforced by Claude Code itself, not by the model, so a line in a prompt file saying "never read .env" is a suggestion and a deny rule is a wall. That is the distinction that matters at 2 a.m. when nobody is watching.
Two details from my first night with the setting on. First, put the setting in the project file only for repos where unattended runs are a real pattern, not globally. In an interactive session, a prompt is useful — it is the moment I catch the agent about to do something I did not intend. Turning prompts off everywhere would trade away that checkpoint for the sake of the one night a week I actually run something overnight. Second, keep the job on a scratch branch in a worktree. If the agent does something stupid at 3 a.m., `git checkout` undoes it, and nothing it does can touch the branch I actually ship from.
There is also a headless alternative worth knowing about, for scheduled jobs rather than a terminal session left running overnight. The official docs recommend `--permission-prompts none` for `claude -p` runs where nobody is available to answer, and the headless guides pair it with an explicit permission mode like `dontAsk`, which auto-denies anything that would otherwise prompt. Same philosophy, different surface: the interactive terminal session gets the new setting, the cron job gets the flag. I use the flag for a weekly dependency-chore script and the setting for the overnight terminal sessions. They are not interchangeable — the flag also removes tools that need a person, like `AskUserQuestion` — but they rhyme.
The rest of v2.1.319 is also about unattended work
The setting got the headline, but the same release has four other changes that matter if you run Claude Code while you are not at the keyboard, and they are the reason I think Anthropic is treating unattended runs as a real use case rather than a hack.
The first is MCP tasks in the terminal. When an MCP server runs a tool call as a task, Claude Code now moves it to the background right away and tells Claude the result when it finishes, instead of blocking the turn on it. There is an escape hatch — `CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND` — if you would rather wait. For an overnight run that leans on an MCP server, that is the difference between a long task stalling the session and the session doing other work while it waits.
The second is a change to auto mode that could bite you if you run behind an LLM gateway. With telemetry or feature flags off, calls the server cannot check are now asked about or denied, with no fallback to the built-in classifier. If you are on Bedrock, Vertex, or Foundry, nothing changes. If you are behind a gateway, you set `CLAUDE_CODE_AUTO_MODE_SERVER=0` to keep the old behavior, or `=1` to turn the server-side check on even with experimental betas disabled. I run direct, so this did not touch me, but if your overnight runs go through a gateway and they start behaving differently this week, this is probably why.
The third is small and genuinely useful for scripts: `claude -p` used to exit 0 in auto mode when its actions were refused because no safety check was available. It now exits 1. That means a cron job or a shell script wrapping an unattended run can finally tell the difference between "the run finished" and "the run was refused" by checking the exit code instead of parsing output. If you have a scheduled Claude Code job, this one line in the release notes is worth more than the headline setting.
The fourth is housekeeping that only matters after you have run unattended for a while: `/tasks` now has an "Earlier in this session" row listing finished subagents, so you can reopen one and message it even after it leaves the list or you restart; and `/clear` no longer kills the running commands of background agents, teammates, and workflows that keep running. Both of those are the kind of fix you only appreciate after you have lost a background agent to a careless `/clear` at 8 a.m. I have done that. It is not a fun way to start a morning.
The morning review, rewritten
Here is the part I actually changed in my routine. Before this release, my morning check after an overnight run was: did it finish, and what did it change. Now it is three questions, in this order:
First, what was denied. I search the transcript for the denied calls before I look at the diff. A denied `npm test` means the refactor is unverified no matter how clean the summary sounds. A denied `git push` is the system working as intended. The two look identical in the summary — "task complete" — and completely different in the transcript.
Second, what actually ran. I run the tests myself, on my machine, before I merge anything an unattended session touched. That sounds paranoid, and it is, but it costs ninety seconds and it is the only verification that does not depend on the agent's own report of its work. The agent telling me the tests pass is not evidence. The tests passing when I run them is.
Third, what the diff actually contains. Same as before, but now I read it with the denials in mind: if the agent could not run the linter, the code might have style drift; if it could not run the type checker, a type error might be sitting in a file the summary calls done.
That is the real cost of this setting. It is not the configuration, which takes ten minutes. It is the discipline of a review that assumes something was skipped, every single time, instead of a review that assumes the run either finished or stalled. A stalled run is honest about what it did not do. A denied run is not, unless you go looking.
Where I would and would not use it
I will keep using deny-instead-of-prompting for bounded jobs on a scratch branch: refactors with existing tests, test-writing for code that already exists, documentation updates, dependency chores where the blast radius is a lockfile. Those are jobs where the worst case of a skipped step is a wasted night, not a broken system, and where the morning review catches the skip in minutes.
I would not use it for anything touching production, anything that moves money or credentials, or anything irreversible — deploys, migrations, secret rotation, publishing. For those, a prompt is not an annoyance. It is the last human checkpoint before something that cannot be undone, and no setting should remove it while I am asleep. If a job needs a human decision in the middle, it is not an overnight job. That is not a limitation of the setting. That is the point of it.
The setting is good. It does exactly what the release notes say it does, and the surrounding changes in v2.1.319 — backgrounded MCP tasks, the exit-code fix, the `/tasks` row — make unattended runs feel like a supported workflow for the first time instead of a trick with a flag. But it is a setting for people who will read the transcript in the morning, not for people who want to stop reading it. The night I forgot to check what was denied, I nearly merged untested code. The night I checked, the setting saved me six hours of staring at a prompt. Both nights used the same configuration. The difference was me.
← Back to all posts