Claude Code 2.1.319 kann Anfragen ablehnen statt nachzufragen
Claude Code 2.1.319 kann Berechtigungsanfragen statt zu stellen direkt ablehnen. Nutzer können aus den Ablehnungen eine Allowlist ableiten.

Veröffentlicht am 28. Nov. · Bearbeitet am 28. Nov. · KI-unterstützt
Claude Code 2.1.319, veröffentlicht am 6. November 2026, ändert, was eine Session tut, wenn sie auf eine Berechtigungsanfrage stößt und Sie nicht an der Tastatur sind: Sie kann den Aufruf ablehnen und weiterarbeiten. Der Changelog-Eintrag lautet: "Added permissions.denyInsteadOfPrompting setting: a tool call that would wait on a permission prompt is denied and the turn continues, in terminal sessions, subagents and teammates."
Bis jetzt blieb eine unbeaufsichtigte Aufgabe bei der ersten Anfrage, auf die sie traf, stehen und wartete dort, bis Sie zurückkamen.
Eine Ablehnung ist auch eine Dokumentation. Jeder abgelehnte Aufruf ist etwas, das der Agent tun wollte und das Ihre Regeln nicht abgedeckt haben. Führen Sie also eine Aufgabe mit aktivierter Einstellung aus, lesen Sie die Ablehnungen und verwandeln Sie die sicheren in allow-Regeln. Der Rest bleibt abgelehnt.
Sie ändert nur, was in dem Moment passiert, in dem eine Anfrage erscheinen würde. Ihre allow-, ask- und deny-Regeln entscheiden weiterhin zuerst, ebenso wie Ihr Permission-Modus. Ein Befehl, den Ihre Regeln bereits erlauben, läuft weiterhin, und alles, was Ihr Modus ohnehin genehmigt (etwa Dateibearbeitungen im acceptEdits-Modus), geht wie bisher durch. Die Einstellung erlaubt für sich genommen nichts.
Das ist der Unterschied zum Permission-Modus dontAsk. Die Permissions-Dokumentation beschreibt dontAsk als einen Modus, der "auto-denies every call that would otherwise prompt", und ein Modus ersetzt den, in dem Sie sich befanden. Die neue Einstellung liegt über dem Modus, den Sie gewählt haben, wie der Bericht von Developers Digest es ausdrückt.
Für claude -p-Aufrufe gab es bereits einen Weg: Die Headless-Dokumentation behandelt --permission-prompts none (v2.1.259 oder später), und mit --output-format stream-json listet die finale Ergebnisnachricht abgelehnte Aufrufe in permission_denials auf. Die neue Einstellung bringt dieses Verhalten in interaktive Terminal-Sessions, und genau dort sitzt und wartet ein Agent, den Sie allein gelassen haben.
Zwei Vorbehalte, bevor Sie sie konfigurieren. Zum Zeitpunkt der Erstellung listen die offiziellen Settings-Seiten den Schlüssel noch nicht auf, der Changelog ist also die primäre Quelle. Und die Schema-Beschreibung der Einstellung, wie von Developers Digest zitiert, besagt, dass der Schlüssel aus User-Settings, --settings und Managed-Settings gelesen wird und dass Projekt- und lokale Einstellungen ignoriert werden, sodass die.claude/settings.json eines Repositorys sie nicht aktivieren kann. Ich habe das nicht selbst überprüft, daher setzt dieser Leitfaden den Schlüssel dort, wo das Schema sagt, dass er gelesen wird: eine --settings-Datei für einen Lauf oder Ihre User-Settings.
Ein abgelehnter Aufruf stoppt den Zug nicht. Er landet im Tray, und der Agent macht weiter.
Halten Sie den Test klein: eine Aufgabe, auf einem Branch, den Sie wegwerfen können. Ein git worktree gibt ihr einen eigenen Ordner, sodass alles, was der Agent tut, von Ihrem Haupt-Checkout fernbleibt.
Speichern Sie die Einstellung in einer Datei außerhalb des Repositorys, zum Beispiel ~/.claude/unattended.json:
{ "permissions": { "denyInsteadOfPrompting": true } } Vollbildmodus öffnen Vollbildmodus verlassen Starten Sie dann die Aufgabe mit dieser Datei. Die Settings-Dokumentation sagt, dass --settings Inline-JSON oder einen Pfad entgegennimmt, nur für diese Session gilt und über Ihren User- und Projektdateien steht:
git worktree add -b try/deny-run../app-deny-run cd../app-deny-run claude --settings ~/.claude/unattended.json \ --permission-mode acceptEdits \ "Add input validation to the signup handler, with tests" Vollbildmodus öffnen Vollbildmodus verlassen acceptEdits lässt Dateibearbeitungen durch, sodass die Ablehnungen, die Sie sammeln, die Shell-Befehle, Fetches und anderen Aufrufe sind, die Ihre Regeln noch nicht abdecken. Genau das ist die Liste, die Sie wollen.
Fügen Sie dem Aufgabenprompt einen Absatz hinzu. Laut dem Release-Hinweis läuft der Zug nach einer Ablehnung weiter, und Developers Digest berichtet, dass Claude darüber informiert wird. Sagen Sie ihm, was es als Nächstes tun soll:
If a tool call is denied, don't try another way to do the same thing. Note it and move on. Finish with a list of every call that was denied and what it was for. Vollbildmodus öffnen Vollbildmodus verlassen Ein Agent, der npm test nicht ausführen kann, greift vielleicht zu npx jest, und eine deny-Regel, die für eine Schreibweise eines Befehls geschrieben wurde, deckt eine andere nicht ab. Die Permissions-Dokumentation gibt das Beispiel: eine Regel Bash(git push *) passt nicht auf git -C. push. Der Prompt kann nichts erzwingen, da die Dokumentation sagt, dass Regeln von Claude Code durchgesetzt werden, nicht vom Modell. Er macht die eigene Zusammenfassung des Agents aber zu etwas, das Sie mit dem Transkript abgleichen können.
Die Sessions-Dokumentation sagt, dass jede Session als JSONL unter ~/.claude/projects/<project>/<session-id>.jsonl gespeichert wird, wobei <project> das Arbeitsverzeichnis ist, in dem jedes nicht-alphanumerische Zeichen durch - ersetzt wird (Pfade über 200 Zeichen werden gekürzt plus ein Hash).
Dieselbe Seite warnt: "the entry format is internal to Claude Code and changes between versions." Betrachten Sie das also als ein Skript für heutige Dateien, nicht als stabile API. In aktuellen Transkripten erscheinen Tool-Aufrufe als tool_use-Blöcke in Assistant-Nachrichten und Ergebnisse als tool_result-Blöcke mit einem is_error-Flag, dieselben Blockformen, die die Messages-API dokumentiert. Speichern Sie dies als ~/.claude/deny-report.jq, außerhalb des Worktrees:
# deny-report.jq: every tool call whose result was an error ([.[] | select(.type == "assistant") |.message.content[]? | objects | select(.type == "tool_use") | {key:.id, value: {name, input}}] | from_entries) as $calls |.[] | select(.type == "user") |.message.content[]? | objects | select(.type == "tool_result" and.is_error == true) | $calls[.tool_use_id] as $c | select($c!= null) | [$c.name, ($c.input.command // $c.input.file_path // $c.input.url // ($c.input | tostring)), (.content | tostring |.[0:60])] | @tsv Vollbildmodus öffnen Vollbildmodus verlassen Führen Sie es aus dem Worktree-Ordner der Aufgabe mit jq aus, gegen das neueste Transkript für diesen Ordner:
dir = $( pwd | sed 's/[^[:alnum:]]/-/g' ) t = $( ls -t ~/.claude/projects/ "$dir" /*.jsonl | head -1 ) jq -rs -f ~/.claude/deny-report.jq "$t" | sort | uniq -c | sort -rn Vollbildmodus öffnen Vollbildmodus verlassen Jede Zeile ist eine Anzahl, der Tool-Name, der Befehl oder Pfad und der Anfang des Fehlertexts. Das Skript erfasst jeden fehlgeschlagenen Aufruf, nicht nur Ablehnungen: ein scheiternder Testlauf erscheint ebenfalls. Der Wortlaut der Ablehnungsnachricht ist nicht dokumentiert, lesen Sie also die dritte Spalte, statt nach einer Phrase zu greifen. Vergleichen Sie dann die Liste mit der eigenen Zusammenfassung des Agents aus Schritt 1.
Erlauben Sie, wozu Sie ohne Nachlesen Ja gesagt hätten: die Test- und Lint-Skripte, schreibgeschützte git-Befehle, den Build. Lehnen Sie ab, was Sie nie unbeaufsichtigt wollen: Pushes, Deploys, curl zu beliebigen Hosts, Lesezugriffe auf Secrets. Alles, worüber Sie unsicher sind, bleibt aus beiden Listen heraus, damit es bei unbeaufsichtigten Läufen weiter abgelehnt wird und weiter nachfragt, wenn Sie an der Tastatur sitzen.
Schreiben Sie dann die Regeln, mit der Syntax aus der Permissions-Dokumentation:
{ "permissions": { "allow": [ "Bash(npm run test *)", "Bash(npm run lint)", "Bash(git diff *)" ], "deny": [ "Bash(git push *)", "Bash(curl *)", "Read(./.env)" ] } } Vollbildmodus öffnen Vollbildmodus verlassen Vier Regeln aus der Dokumentation entscheiden, ob sich das so verhält, wie Sie es erwarten:
Für Team-Regeln committen Sie sie in.claude/settings.json auf dem Task-Branch, damit sie wie jede andere Änderung über ein Review ankommen. Für persönliche verwenden Sie.claude/settings.local.json. Die Settings-Dokumentation merkt an, dass Claude Code in einem Worktree diese lokale Datei von der Wurzel des Haupt-Checkouts liest, sodass eine Datei jeden Worktree des Repositorys abdeckt.
Führen Sie dann dieselbe Art von Aufgabe erneut aus. Der Bericht sollte kürzer werden. Was übrig bleibt, ist entweder etwas, das Sie bewusst abgelehnt lassen wollten, oder eine neue Lücke.
Jede Ablehnung wandert in einen von zwei Stapeln. Die unsicheren bleiben abgelehnt.
Ich entwickle die Hermes IDE, gewichten Sie diesen Abschnitt also mit dem im Hinterkopf. Hermes steht in keiner Verbindung zu Anthropic oder einem anderen Agent-Anbieter. Sie führt jeden Agenten in einem echten Terminal aus, und ⌘N (Ctrl+Shift+N auf Windows und Linux) startet eine Aufgabe auf ihrem eigenen hermes/-Branch in ihrem eigenen Worktree, mit der Aufgabe als erstem Prompt des Agents. Das deckt das git worktree add aus Schritt 1 ab.
Das ⌘N-New-task-Fenster: Claude Code, das Projekt orders-api, ein neuer hermes/-Worktree, Accept edits, Modell und Effort sowie die "Hermes will run"-Vorschau des claude-Befehls.
Wählen Sie Accept edits im Genehmigungs-Chip. Hermes baut den claude-Befehl selbst und das Fenster zeigt ihn, daher würde ich für den Test den Schlüssel in ~/.claude/settings.json setzen, statt mich auf ein --settings-Flag zu verlassen. Diese Datei gilt für jede Claude-Code-Session auf der Maschine, und die Settings-Dokumentation sagt, dass Permission-Änderungen laufende Sessions ohne Neustart erreichen. Schalten Sie sie aus, wenn der Test abgeschlossen ist. Wenn Sie sie aktiviert lassen, lehnt jede Claude-Code-Session auf der Maschine ab, statt zu fragen, einschließlich derjenigen, vor denen Sie sitzen.
Hermes vergibt jeder Session genau einen Status: working, needs approval, asked you, done, error oder idle. Ohne die Einstellung bleibt eine blockierte Aufgabe im Zustand needs approval und erscheint im Attention-Inbox, bis Sie sie im eigenen Terminal von Claude beantworten. Hermes beantwortet niemals eine Berechtigungsanfrage für Sie.
Ist die Einstellung aktiviert, zeigt Claude Code keine Berechtigungsanfrage mehr an, sodass die Aufgabe nichts zu genehmigen hat, worauf sie warten müsste. Ich würde erwarten, dass sie weiterarbeitet und am Ende den Status done erreicht, statt in needs approval zu verharren, es sei denn, der Agent hält an, um Ihnen eine Frage zu stellen, was Hermes als asked you anzeigt. Ich habe diese exakte Kombination selbst noch nicht ausprobiert, und falls der Status etwas anderes tut, würde ich gerne davon hören.
Ist die Aufgabe fertig, öffnet ⌘G (Ctrl+Shift+G) den Review Desk mit den Änderungen der Aufgabe, aufgeschlüsselt nach Runden. Lesen Sie nach, was der Agent mit den ihm erlaubten Aufrufen getan hat, bevor Sie irgendetwas übernehmen. Führen Sie anschließend den Bericht aus Schritt 2 über eine Shell im Worktree der Aufgabe aus.
Die Ablehnungen sind nur die eine Hälfte. Die andere Hälfte ist der Absatz in Ihrem Aufgaben-Prompt, der dem Agenten mitteilt, was er tun soll, wenn ihm etwas verweigert wird, damit er nicht stillschweigend eine Regel umgeht. Anweisungen zu schreiben, denen ein Agent folgt, wenn niemand hinschaut, ist genau die Art von Thema, die mein Prompt Engineering Pocket Guide behandelt.
Wenn Sie den Weg über Hermes ausprobieren möchten: Hermes IDE ist kostenlos herunterladbar, der Quellcode ist unter BSL 1.1 verfügbar, und es läuft auf macOS, Windows und Linux. Version 2.3.7 erschien am 7. November 2026. Wenn es Ihnen einen Vormittag erspart, geben Sie ihm einen Stern auf GitHub.
Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.
Original (Englisch) anzeigen
Posted on Nov 28 • Edited on Nov 28 • AI-assisted
Claude Code 2.1.319, released on November 6, 2026, changes what a session does when it reaches a permission prompt and you're away from the keyboard: it can refuse the call and keep working. The changelog entry reads: "Added permissions.denyInsteadOfPrompting setting: a tool call that would wait on a permission prompt is denied and the turn continues, in terminal sessions, subagents and teammates."
Until now, an unattended task stopped at the first prompt it hit and stayed there until you came back.
A denial is also a record. Every call that got denied is something the agent wanted to do and your rules didn't cover. So run one task with the setting on, read the denials, and turn the safe ones into allow rules. The rest stay denied.
It only changes what happens at the moment a prompt would appear. Your allow, ask and deny rules still decide first, and so does your permission mode. A command your rules already allow still runs, and anything your mode already approves (file edits in acceptEdits, say) goes through as before. The setting allows nothing on its own.
That is the difference from the dontAsk permission mode. The permissions docs describe dontAsk as a mode that "auto-denies every call that would otherwise prompt", and a mode replaces the one you were in. The new setting sits on top of whichever mode you picked, as the Developers Digest write-up puts it.
For claude -p runs there was already a route: the headless docs cover --permission-prompts none (v2.1.259 or later), and with --output-format stream-json the final result message lists denied calls in permission_denials. The new setting brings that behavior to interactive terminal sessions, which is where an agent you left alone actually sits and waits.
Two caveats before you configure it. At the time of writing, the official settings pages don't list the key yet, so the changelog is the primary source. And the setting's schema description, as quoted by Developers Digest, says the key is read from user settings, --settings and managed settings, and that project and local settings are ignored, so a repository's.claude/settings.json can't turn it on. I haven't checked that myself, so this guide sets the key where the schema says it's read: a --settings file for one run, or your user settings.
A denied call doesn't stop the turn. It lands in the tray, and the agent keeps going.
Keep the trial small: one task, on a branch you can throw away. A git worktree gives it its own folder, so whatever the agent does stays off your main checkout.
Put the setting in a file outside the repo, for example ~/.claude/unattended.json:
{ "permissions": { "denyInsteadOfPrompting": true } } Enter fullscreen mode Exit fullscreen mode Then start the task with that file. The settings docs say --settings takes inline JSON or a path, applies for that session only, and sits above your user and project files:
git worktree add -b try/deny-run../app-deny-run cd../app-deny-run claude --settings ~/.claude/unattended.json \ --permission-mode acceptEdits \ "Add input validation to the signup handler, with tests" Enter fullscreen mode Exit fullscreen mode acceptEdits lets file edits through, so the denials you collect are the shell commands, fetches and other calls your rules don't cover yet. That is the list you want.
Add one paragraph to the task prompt. Per the release note, the turn carries on after a denial, and Developers Digest reports Claude is told about it. Tell it what to do next:
If a tool call is denied, don't try another way to do the same thing. Note it and move on. Finish with a list of every call that was denied and what it was for. Enter fullscreen mode Exit fullscreen mode An agent that can't run npm test might reach for npx jest, and a deny rule written for one spelling of a command doesn't cover another. The permissions docs give the example: a Bash(git push *) rule doesn't match git -C. push. The prompt can't enforce anything, since the docs say rules are enforced by Claude Code, not by the model. It does make the agent's own summary something you can check against the transcript.
The sessions docs say each session is stored as JSONL at ~/.claude/projects/<project>/<session-id>.jsonl, where <project> is the working directory with every non-alphanumeric character replaced by - (paths over 200 characters get truncated plus a hash).
The same page warns that "the entry format is internal to Claude Code and changes between versions." So treat this as a script for today's files, not a stable API. In current transcripts, tool calls show up as tool_use blocks in assistant messages, and results as tool_result blocks with an is_error flag, the same block shapes the Messages API documents. Save this as ~/.claude/deny-report.jq, outside the worktree:
# deny-report.jq: every tool call whose result was an error ([.[] | select(.type == "assistant") |.message.content[]? | objects | select(.type == "tool_use") | {key:.id, value: {name, input}}] | from_entries) as $calls |.[] | select(.type == "user") |.message.content[]? | objects | select(.type == "tool_result" and.is_error == true) | $calls[.tool_use_id] as $c | select($c!= null) | [$c.name, ($c.input.command // $c.input.file_path // $c.input.url // ($c.input | tostring)), (.content | tostring |.[0:60])] | @tsv Enter fullscreen mode Exit fullscreen mode Run it from the task's worktree folder with jq, against the newest transcript for that folder:
dir = $( pwd | sed 's/[^[:alnum:]]/-/g' ) t = $( ls -t ~/.claude/projects/ "$dir" /*.jsonl | head -1 ) jq -rs -f ~/.claude/deny-report.jq "$t" | sort | uniq -c | sort -rn Enter fullscreen mode Exit fullscreen mode Each line is a count, the tool name, the command or path, and the start of the error text. The script catches every errored call, not only denials: a failing test run shows up too. The wording of the denial message isn't documented, so read the third column rather than grepping for a phrase. Then compare the list with the agent's own summary from Step 1.
Allow what you would have said yes to without reading it: the test and lint scripts, read-only git commands, the build. Deny what you would never want unattended: pushes, deploys, curl to arbitrary hosts, reads of secrets. Anything you're unsure about stays out of both lists, so it keeps being denied on unattended runs and keeps prompting when you're at the keyboard.
Then write the rules, using the syntax from the permissions docs:
{ "permissions": { "allow": [ "Bash(npm run test *)", "Bash(npm run lint)", "Bash(git diff *)" ], "deny": [ "Bash(git push *)", "Bash(curl *)", "Read(./.env)" ] } } Enter fullscreen mode Exit fullscreen mode Four rules from the docs decide whether these behave the way you expect:
For team rules, commit them to.claude/settings.json on the task branch, so they arrive through review like any other change. For personal ones, use.claude/settings.local.json. The settings docs note that in a worktree, Claude Code reads that local file from the main checkout's root, so one file covers every worktree of the repo.
Then run the same kind of task again. The report should get shorter. What's left is either something you meant to keep denied, or a new gap.
Each denial goes into one of two piles. The unsure ones stay denied.
I build Hermes IDE, so weigh this section with that in mind. Hermes is not affiliated with Anthropic or any other agent vendor. It runs each agent in a real terminal, and ⌘N (Ctrl+Shift+N on Windows and Linux) starts a task on its own hermes/ branch in its own worktree, with the task as the agent's first prompt. That covers the git worktree add from Step 1.
The ⌘N New task sheet: Claude Code, the orders-api project, a new hermes/ worktree, Accept edits, model and effort, and the "Hermes will run" preview of the claude command.
Pick Accept edits in the approval chip. Hermes builds the claude command itself, and the sheet shows it, so I'd set the key in ~/.claude/settings.json for the trial rather than rely on a --settings flag. That file applies to every Claude Code session on the machine, and the settings docs say permission edits reach running sessions without a restart. Turn it off when the trial is done. If you keep it on, every Claude Code session on the machine denies instead of asking, including the ones you're sitting in front of.
Hermes gives every session one status: working, needs approval, asked you, done, error or idle. Without the setting, a blocked task sits in needs approval and shows up in the attention inbox until you answer it in Claude's own terminal. Hermes never answers a permission prompt for you. With the setting on, Claude Code never shows a permission prompt, so the task should have no approval to wait on. I'd expect it to keep working and end up done rather than sit in needs approval, unless the agent stops to ask you a question, which Hermes shows as asked you. I haven't run this exact combination myself yet, so if the status does something else, I'd like to hear about it.
When it's done, ⌘G (Ctrl+Shift+G) opens the Review Desk, with the task's changes by turn. Read what the agent did with the calls it could make before you promote anything. Then run the Step 2 report from a shell in the task's worktree.
The denials are half of this. The other half is the paragraph in your task prompt that tells the agent what to do when it's refused, so it doesn't quietly route around a rule. Writing instructions an agent follows when nobody is watching is the kind of thing my Prompt Engineering Pocket Guide covers.
If you want to try the Hermes route, Hermes IDE is free to download, source-available under BSL 1.1, and runs on macOS, Windows and Linux. Version 2.3.7 shipped on November 7, 2026. If it saves you a morning, star it on GitHub.