ai newsMi., 25. Nov.
EilmeldungYale’s Sonnenfeld: Nvidia is a ‘detriment’ to U.S. industrial might — not a champion

Claude Code: So erkennt man, wann der Agent auf eine Antwort wartet

Ein PreToolUse-Hook mit dem Matcher AskUserQuestion schlägt sofort an, sobald Claude eine Frage stellt. Für Freigaben eignet sich PermissionRequest, für beendete Durchläufe der Stop-Hook.

dev.toMontag 21:12 · 23.11.DE7 Min. Lesezeit
Bild: dev.to

Veröffentlicht am 23. Nov • Ursprünglich veröffentlicht auf claudictive.com • KI-unterstützt

Ursprünglich veröffentlicht auf claudictive.com.

Um zu erkennen, wann Claude Code auf Ihre Antwort wartet, fügen Sie einen PreToolUse-Hook mit dem Matcher AskUserQuestion hinzu: Er wird in dem Moment ausgelöst, in dem Claude fragt, bevor der Auswahldialog erscheint. Ergänzen Sie PermissionRequest für Genehmigungen und Stop für einen beendeten Zug. Der schwierigere Teil ist ein Alarm, den Sie bemerken und auf den Sie reagieren können, während Sie sich anderswo befinden.

Ich entwickle Claudictive, ein In-Game-Overlay für Claude Code, mit Claude Code selbst. Die erste Hälfte dieses Beitrags ist die Hook-Einrichtung, die jeder nutzen kann. Die zweite Hälfte handelt davon, was bei uns schiefging und was Claude und ich geändert haben.

AskUserQuestion ist das Tool, das Claude aufruft, wenn es möchte, dass Sie aus Optionen auswählen. Die Hook-Dokumentation beschreibt es als das Stellen von „ein bis vier Multiple-Choice-Fragen an den Nutzer“, und es erreicht PreToolUse wie jeder andere Tool-Aufruf.

In mehreren Issues wurde nach diesem Signal gefragt. Issue 13024 und Issue 10168 baten beide um einen Hook, der ausgelöst wird, wenn Claude auf Sie wartet; 13024 trägt den Titel „Add hook for when Claude is waiting for user input“. Am 17.08.2026 schloss ein Claude-Code-Maintainer beide als abgeschlossen, mit dieser Antwort:

Eine minimale Einrichtung in settings.json, aufbauend auf der Struktur aus der Dokumentation:

{ "hooks": { "PreToolUse": [ { "matcher": "AskUserQuestion|ExitPlanMode", "hooks": [ { "type": "command", "command": "your-question-alert" } ] } ], "PermissionRequest": [ { "hooks": [ { "type": "command", "command": "your-approval-alert" } ] } ], "Stop": [ { "hooks": [ { "type": "command", "command": "your-done-alert" } ] } ] } } Vollbildmodus aktivieren Vollbildmodus beenden Zwei Details aus der Dokumentation sind hier relevant:

Weil kein Notification-Typ für ein AskUserQuestion im Vordergrund dokumentiert ist. Die Hook-Referenz listet mehr als ein Dutzend Typen auf. Darunter:

Keiner davon wird beschrieben als für ein AskUserQuestion im Vordergrund ausgelöst. Stop klärt es auch nicht: Dessen Eingabe enthält stop_hook_active, last_assistant_message, background_tasks und session_crons, und nichts sagt aus, ob der Zug mit einer Frage endete. Issue 93872, „No hook signal distinguishes 'turn complete' from 'turn ended awaiting a user answer/selection'", fordert genau dieses Feld. Sie war ohne Antwort eines Maintainers offen, als ich es am 14.11.2026 überprüfte.

Nutzerberichte zu Notification und Fragen widersprechen sich ebenfalls. Issue 74052 meldete Fragen, die Notification als permission_prompt auslösten. Issue 51882 und Issue 59908 meldeten gar kein Notification, und Issue 66704 meldete kein Stop, während eine Frage wartet. Alle vier wurden wegen Inaktivität geschlossen, nicht behoben. Da die Berichte in beide Richtungen gehen, würde ich keinen Fragen-Alarm auf Notification oder Stop aufbauen. PreToolUse ist das dokumentierte Signal, und es ist unmittelbar.

Betrachten Sie sie als zwei verschiedene Ereignisse und erzeugen Sie nur beim ersten Lärm.

Claudictive liest bereits das Transkript jeder Sitzung, um die Sitzung im Overlay anzuzeigen. Daher sucht der Poller dort nach der Frage, als unsere Wahl: Wenn der letzte Zug des Assistenten einen AskUserQuestion-Tool-Aufruf enthält, wartet die Sitzung auf Sie. Die Prüfung im ausgelieferten Code ist kurz:

const hasAskUser = blocks. some ( ( b ) => b. type === 'tool_use' && ( b. name === 'AskUserQuestion' || b. name === 'ask_user' || b. name === 'AskUser' ), ); if ( hasAskUser ) return 'needs-input'; Vollbildmodus aktivieren Vollbildmodus beenden Züge von Subagents landen im selben Transkript, markiert mit isSidechain: true, daher überspringt sie der Poller bei der Suche nach der letzten Zeile. Andernfalls würde ein beendeter Subagent die Sitzung als untätig erscheinen lassen.

Jedes Warten trägt dann einen Grund: question, wenn das Transkript ein AskUserQuestion zeigt, notification, wenn es Claude Codes Leerlauf-Aufforderung „waiting for your input“ ist. Nur question löst den In-Game-Chip und den Klingelton aus. Ein beendeter Zug ist nicht dringend; eine Frage blockiert den gesamten Lauf.

Es gibt noch ein weiteres Tor: Der Alarm spielt nur, während das Spiel läuft und fokussiert ist und das Overlay angezeigt wird, sodass der Overlay-Hotkey ihn stummschaltet. Diese Version wurde im Spiel getestet, bevor sie committet wurde.

Wenn Sie stattdessen auf Hooks aufbauen, funktioniert dieselbe Aufteilung: Setzen Sie Ihren Alarm in PreToolUse für AskUserQuestion und löschen Sie ihn in PostToolUse mit demselben Matcher, der laut Dokumentation nach dem erfolgreichen Tool-Aufruf läuft, also nachdem die Frage beantwortet wurde. Eine abgelehnte oder abgebrochene Frage erreicht PostToolUse nie, geben Sie dem Alarm also auch einen Fallback, etwa das Löschen bei Ihrer nächsten Eingabe (UserPromptSubmit) oder nach einem Timeout.

Hier begann Claudictive. Ich wollte spielen, konkret Total War: Shogun 2, und ich hatte keinen zweiten Bildschirm. Ein Klick aus dem Spiel heraus nahm ihm den Fokus und minimierte es. Damals baute ich ein kleines Feedback-Tool für Vibe Coder, und die Claude-Code-Sitzungen dauerten lange. Ich wollte weggehen und spielen, während sie liefen, aber sie brauchten mich ständig.

Ich probierte zuerst langlebige Setups aus, darunter den get-shit-done (GSD)-Workflow, sogar im YOLO-Modus. Es funktionierte nicht: Berechtigungen, Rückfragen und Fragen waren ein dauerhaftes Problem, mehrere pro Sitzung. Dort entstand die Idee, im letzten Jahr. Ich war sicher, eine generische Lösung zu finden, und es gab keine, die ich finden konnte.

Einmal, bevor Claudictive existierte, kam ich von einem League-of-Lol-Match zurück und stellte fest, dass Claude kaum begonnen hatte. Es hatte etwas Grundlegendes gefragt und gewartet, und ich hatte es völlig verpasst. Ich war vor allem wütend: Ich wollte, dass die Dinge für mich funktionieren, und „jetzt muss ich meinen Agenten babysitten“.

Warum Fragen-Alarme für mich wichtig sind, in einer Zeile: „I just want to dev asap as a vibe coder, I want to make sure everything is going smoothly.“

Später, als Claudictive bereits lief, saß eine meiner Sitzungen 22 Minuten auf einer Frage.

Der Poller hatte die Frage erkannt. Nichts zeigte sie an:

Die Lösung, die Claude und ich auslieferten, leitet eine wartende Frage in denselben Alarm wie eine Berechtigungsanfrage: ein Chip „Claude hat eine Frage“, der das Projekt nennt, denselben Klingelton-Zeitplan und keinen Hinweis auf Allow oder Deny. Er verschwindet, wenn die Frage beantwortet wird, wenn die Sitzung endet oder nach einer Stunde. Die Statuszeile sagt jetzt „Waiting for you“, und der Puls wurde in ein Pseudoelement verschoben, damit der eigene Schatten des Pills ihn nicht verbergen kann.

Die Lektion: Die Erkennung war in Ordnung. Die Anzeige war es nicht. Wenn Sie Ihren eigenen Alarm bauen, prüfen Sie, dass er von dort sichtbar ist, wo Sie sich tatsächlich aufhalten, nicht nur, dass er ausgelöst wird.

Ja, und die Dokumentation beschreibt inzwischen, wie. Ein PreToolUse-Hook kann ein AskUserQuestion selbst beantworten: Er gibt permissionDecision: "allow" zusammen mit einem updatedInput zurück, der das ursprüngliche questions-Array wiedergibt und ein answers-Objekt hinzufügt, das den Text jeder Frage dem gewählten Label zuordnet. Die Dokumentation stellt ausdrücklich klar: „Returning "allow" alone is not sufficient for these tools." PermissionRequest-Hooks benötigen dasselbe updatedInput.

Im Overlay erscheint die Frage als Karte mit ihren Optionen. Sie klicken eine an, tippen ihre Nummer oder tippen eigene Worte in das Chatfeld. Der Chip sagt Ihnen auch, wo Sie antworten sollen: „answer here“, wenn die Sitzung vom Overlay aus gesteuert wird, „answer in your terminal“, wenn nicht. Derselbe Ablauf deckt Berechtigungen ab; die Details stehen auf der Seite zum Genehmigen von Claude-Code-Berechtigungen im Spiel.

Das Overlay ist nicht an ein Spiel gebunden: Es läuft in Spielen, die Overwolf unterstützt, wie World of Warcraft, Valorant oder Fortnite, nicht nur in den beiden, die ich spiele.

Echte Aufnahme aus einer Entwicklungsversion: Claudictive über meiner Total-War-Shogun-2-Kampagne, an einem Demo-Projekt. Ein Dateipfad ist unkenntlich gemacht.

Nachdem jedes Terminal seinen eigenen Tab im Spiel hatte, zeigte sich eine neue Lücke. Ich fand sie in einem In-Game-Test in Total War: Shogun 2, und meine Notiz aus diesem Test lautete: „tab A1 has a permission/question request, but I am in tab B, have a UI component that should grab my attention as well as the chime“.

Es gab zwei Kandidaten: eine Zeile über den Tabs oder den wartenden Tab selbst. Ich hielt die Zeile für schlechtes UX und wählte den Tab. Wenn nun ein Tab mit einer Frage oder Genehmigung nicht der ist, den Sie gerade betrachten, wird er bernsteinfarben und pulsiert (er bleibt statisch, wenn Ihr System reduzierte Bewegung verlangt). Sein Klingelton läuft weiter, bis Sie den Tab öffnen, ihn beantworten oder er abläuft.

Claude ist Co-Autor der Commits hinter dem Fragen-Chip, der Fragen-Karte, dem Beantworten aus dem Overlay und dem bernsteinfarbenen Tab. Die In-Game-Tests waren meine, ebenso die Entscheidung für den bernsteinfarbenen Tab. Mehr zu den Alarmtypen steht auf der Claude-Code-Benachrichtigungsseite.

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

Posted on Nov 23 • Originally published at claudictive.com • AI-assisted

Originally published on claudictive.com.

To know when Claude Code is waiting on your answer, add a PreToolUse hook with the matcher AskUserQuestion: it fires the moment Claude asks, before the picker appears. Add PermissionRequest for approvals and Stop for a finished turn. The harder part is an alert you notice and can act on while you are somewhere else.

I build Claudictive, an in-game overlay for Claude Code, with Claude Code itself. The first half of this post is the hook setup anyone can use. The second half is what went wrong for us, and what Claude and I changed.

AskUserQuestion is the tool Claude calls when it wants you to pick from options. The hooks reference describes it as asking "the user one to four multiple-choice questions", and it reaches PreToolUse like any other tool call.

People asked for this signal in several issues. Issue 13024 and issue 10168 both asked for a hook that fires when Claude is waiting on you; 13024 is titled "Add hook for when Claude is waiting for user input". On 2026-08-17 a Claude Code maintainer closed both as completed, with this answer:

A minimal setup in settings.json, built from the shape in the docs:

{ "hooks": { "PreToolUse": [ { "matcher": "AskUserQuestion|ExitPlanMode", "hooks": [ { "type": "command", "command": "your-question-alert" } ] } ], "PermissionRequest": [ { "hooks": [ { "type": "command", "command": "your-approval-alert" } ] } ], "Stop": [ { "hooks": [ { "type": "command", "command": "your-done-alert" } ] } ] } } Enter fullscreen mode Exit fullscreen mode Two details from the docs that matter here:

Because no Notification type is documented for a foreground AskUserQuestion. The hooks reference lists more than a dozen types. Among them:

None of these is described as firing for a foreground AskUserQuestion. Stop does not settle it either: its input carries stop_hook_active, last_assistant_message, background_tasks and session_crons, and nothing says whether the turn ended on a question. Issue 93872, "No hook signal distinguishes 'turn complete' from 'turn ended awaiting a user answer/selection'", asks for exactly that field. It was open with no maintainer reply when I checked on 2026-11-14.

User reports about Notification and questions also disagree with each other. Issue 74052 reported questions firing Notification as permission_prompt. Issue 51882 and issue 59908 reported no Notification at all, and issue 66704 reported no Stop while a question waits. All four were closed for inactivity, not fixed. With reports going both ways, I would not build a question alert on Notification or Stop. PreToolUse is the documented signal, and it is immediate.

Treat them as two different events, and only make noise for the first.

Claudictive already reads each session's transcript to show the session in the overlay, so its poller looks for the question there, as our choice: when the last assistant turn holds an AskUserQuestion tool call, the session is waiting on you. The check in the shipped code is short:

const hasAskUser = blocks. some ( ( b ) => b. type === 'tool_use' && ( b. name === 'AskUserQuestion' || b. name === 'ask_user' || b. name === 'AskUser' ), ); if ( hasAskUser ) return 'needs-input'; Enter fullscreen mode Exit fullscreen mode Subagent turns land in the same transcript, marked isSidechain: true, so the poller skips them when it looks for the last line. Otherwise a subagent finishing would make the session look idle.

Each wait then carries a reason: question when the transcript shows an AskUserQuestion, notification when it is Claude Code's idle "waiting for your input" prompt. Only question raises the in-game chip and the chime. A finished turn is not urgent; a question blocks the whole run.

There is one more gate: the alert only plays while the game is running and focused and the overlay is shown, so the overlay hotkey silences it. That version was verified in game before it was committed.

If you build on hooks instead, the same split works: set your alert in PreToolUse for AskUserQuestion, and clear it in PostToolUse with the same matcher, which the docs say runs after the tool succeeds, so after the question is answered. A declined or escaped question never reaches PostToolUse, so give the alert a fallback too, such as clearing it on your next prompt ( UserPromptSubmit ) or after a timeout.

This is where Claudictive started. I wanted to play, specifically Total War: Shogun 2, and I had no second screen. Clicking off the game made it lose focus and minimize. At the time I was building a small feedback tool for vibe coders, and the Claude Code sessions took a long time. I wanted to step away and play while they ran, but they kept needing me.

I tried long-running setups first, including the get-shit-done (GSD) workflow, even in YOLO mode. It did not work: permissions, asks and questions were a constant issue, several every session. That is where the idea came up, last year. I was sure I would find a generic solution, and there was none I could find.

Once, before Claudictive existed, I came back from a League of Legends match and found Claude had barely started. It had asked something basic and waited, and I had missed it completely. Mostly I got angry: I wanted things to work for me, and "now I need to keep babysitting my agent".

Why question alerts matter to me, in one line: "I just want to dev asap as a vibe coder, I want to make sure everything is going smoothly."

Later, with Claudictive already running, one of my sessions sat on a question for 22 minutes.

The poller had detected the question. Nothing showed it:

The fix Claude and I shipped routes a waiting question into the same alert as a permission request: a "Claude has a question" chip that names the project, the same chime schedule, and no Allow or Deny hint. It clears when the question is answered, when the session exits, or after an hour. The status line now says "Waiting for you", and the pulse moved to a pseudo-element so the pill's own shadow cannot hide it.

The lesson: detection was fine. The display was not. If you build your own alert, check that it is visible from where you actually are, not just that it fires.

Yes, and the docs now say how. A PreToolUse hook can answer an AskUserQuestion itself: it returns permissionDecision: "allow" together with an updatedInput that echoes the original questions array and adds an answers object mapping each question's text to the chosen label. The docs are explicit that "Returning "allow" alone is not sufficient for these tools." PermissionRequest hooks need the same updatedInput.

In the overlay the question shows as a card with its options. You click one, type its number, or type your own words in the chat box. The chip also tells you where to answer: "answer here" when the session is driven from the overlay, "answer in your terminal" when it is not. The same flow covers permissions; the details are on the page for approving Claude Code permissions in game.

The overlay is not tied to one game: it runs in games Overwolf supports, like World of Warcraft, Valorant or Fortnite, not only the two I play.

Real capture from a development build: Claudictive over my Total War: Shogun 2 campaign, on a demo project. A file path is blurred.

Once every terminal had its own tab in the game, a new gap showed up. I found it in an in-game test in Total War: Shogun 2, and my note from that test was: "tab A1 has a permission/question request, but I am in tab B, have a UI component that should grab my attention as well as the chime".

There were two candidates: a line above the tabs, or the waiting tab itself. I judged the line poor UX and picked the tab. Now, when a tab with a question or an approval is not the one you are looking at, it turns amber and pulses (it stays static if your system asks for reduced motion). Its chime keeps going until you open that tab, answer it, or it expires.

Claude is a co-author on the commits behind the question chip, the question card, answering from the overlay and the amber tab. The in-game tests were mine, and so was the call on the amber tab. More on the alert types is on the Claude Code notifications page.

Originaltitel: How to tell when Claude Code is waiting on your answerQuelle: dev.to (dev.to). Original öffnen