Claude code hooks not setup correctly
Sometimes the π€/π¬ markers report incorrect status.
This is mostly Claude's own analysis, slightly edited:
The plugin (hooks/hooks.json) drives the π€/π¬ markers in wt list entirely from three Claude Code events:
β Claude Code event β Action β Fires when β β UserPromptSubmit β set π€ (working) β you submit a new prompt β β Notification β set π¬ (waiting) β a permission prompt shows, or the session is idle 60s β β SessionEnd β clear β session ends β
Root cause of the stuck π¬
Nothing ever flips the marker back to π€ except a brand-new user prompt. The state machine is one-way:
- Notification fires mid-work β most commonly a tool-permission prompt ("Claude needs permission to use Bash"), but also the 60s idle ping.
- That sets π¬.
- You approve, the agent resumes and keeps working through a long tool sequenceβ¦
- β¦but no event resets π€. UserPromptSubmit only fires on a new human prompt, not on permission approval or continued tool use.
So any session that hit a permission/notification prompt and then kept working shows π¬ ("waiting") while actually working β exactly your two sessions. It's a missing transition, not unreliable hooks.
The fix
Add two hooks
β Event β Action β Why β β PostToolUse β set π€ β re-asserts "working" after every tool β corrects a stale π¬ the moment work resumes (e.g. after a permission grant) β β Stop β set π¬ β the accurate "waiting for input" signal β fires exactly when the turn ends β
Net behavior: π¬ correctly shows only while genuinely blocked (permission prompt wait, or turn finished). The instant a tool runs again, it returns to π€. I'd deliberately not hook SubagentStop (subagent finishing doesn't mean the main agent is idle).
Thanks for reporting this β your analysis matches what I found in plugins/worktrunk/hooks/hooks.json. I've opened #2917 with the two-hook fix you proposed (PostToolUse β π€, Stop β π¬). A maintainer will review.
Notification fires mid-work β most commonly a tool-permission prompt ("Claude needs permission to use Bash"), but also the 60s idle ping.
That sets π¬.
The problem I observe is when I get asked for permission, claude does not set to π¬, it still shows π€
@Ismael it would be most helpful to have a specific case of what you see? Is there a case where you get an incorrectly showing π¬; i.e. it's working but says it needs your attention?
IIRC there were bug reports about this a few months ago when I last checked; @worktrunk-bot maybe you can search the claude code repo to find these
Searched anthropics/claude-code β this is a well-documented bug, specifically scoped to the VS Code extension and Windows CLI:
- #55875 (open, May 2026) β canonical "Notification hook doesn't fire on permission_prompt in VS Code extension"; #51931, #56936, #59718 all auto-closed as duplicates of it
- #8985 (open since Oct 2025) β earliest report, VS Code "Native UI" mode; CLI worked at the time
- #60870 (open, May 2026) β VS Code extension
Notificationdoesn't fire on permission orAskUserQuestion/elicitation dialogs - #56936 β original report reproduced on Windows 11 PowerShell with both VS Code extension and CLI, so the Windows CLI is affected too
This comment on #8985 has the clearest matrix β a user analyzed the VS Code extension source and confirmed that every hook except Notification and PermissionRequest fires in the extension. PostToolUse and Stop both fire reliably there.
Implication for #2917: the PR is still beneficial on every platform, because Stop β π¬ fires reliably across all of them. The split is just which problem it fixes:
- macOS/Linux CLI (
Notificationworks): fixes Ismael's reported stuck-π¬ after a permission grant - VS Code extension / Windows CLI (
Notificationbroken upstream): π¬ never appears on permission prompts today and won't after the PR either β marker stays at π€ throughout, then flips to π¬ at turn end viaStop. Strictly better than today (which has no turn-end signal at all)
The framing in the original issue assumes the working-CLI behavior, which is why the symptom you observe (permission prompt, marker stays π€) doesn't match β it's the upstream bug, not the wt plugin.
ok, though I don't use VSCode FYI
Is the Notification hook designed to fire on AskQuestion?
No β built-in AskUserQuestion doesn't fire any hook today, including Notification. The open feature request anthropics/claude-code#13024 is exactly this gap; the reporter explicitly notes that Notification:permission_prompt only covers permission dialogs, not the AskUserQuestion picker, and asks for a new WaitingForInput/Yield hook.
The Notification event's elicitation_dialog matcher is for MCP-server elicitation dialogs (paired with the dedicated Elicitation/ElicitationResult events) β not the built-in AskUserQuestion tool. So I conflated those in my prior comment on #60870 when I cited that report; the VS Code reporter there assumes Notification should cover AskUserQuestion, but per #13024 it doesn't on any platform.
For your stuck-π€ symptom on the macOS/Linux CLI β given Notification is documented to fire on permission_prompt there β one candidate is the recent regression in anthropics/claude-code#58909 (closed): in 2.1.141, Notification:permission_prompt stopped firing when the prompt appeared during the assistant's active thinking phase, because the trigger was gated by a 6s user-idle check. If you're seeing π€ stay on through a permission ask in the CLI, the version you're on (and whether the prompt appears mid-thinking vs after a quiet pause) would narrow it down.
I'm on linux, using CLI, latest CC (2.1.150, at least yesterday).
After a permission prompt and after and ask user question were answered, it stayed on the π¬ symbol.
I'd argue that adding the 2 hooks (PostToolUse and Stop) should be beneficial (and AFAIK the runtime cost is minimal). Stop fires when the agent has finished its work so that's a clear signal to switch to π¬.
PostToolUse seems hackier, but if it's fired, the agent is definitely doing work so setting π€ seems reasonable.
OK! @Ismael would you be up for testing for a while with those hooks in your personal config?
I obv believe what you're seeing, but I don't see the same thing, and there's some cost to churn in the hooks, so we should be moderately confident that it's helping
@worktrunk-bot can you write instructions for how someone would add these into their personal config?
@Ismael β to test, add this to ~/.claude/settings.json (create the file if it doesn't exist). It merges with the existing worktrunk plugin hooks rather than replacing them, so the current behavior stays intact and you get the two extra transitions on top.
{
"hooks": {
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "wt config state marker set π€ || true"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "wt config state marker set π¬ || true"
}
]
}
]
}
}
Claude Code watches settings.json and reloads on change, so no restart is needed. The || true keeps a failure (e.g. wt not on PATH in some shell) from blocking the turn.
To revert, delete those two entries from the file (or delete the file if it was empty before). The marker can be cleared manually any time with wt config state marker clear.
Worth watching for during the trial: any case where π¬ still sticks while work is happening, or π€ stays after the turn actually ended β both would point at a hook not firing as documented.
So far I haven't noticed an issue with these changes. They seem to improve the accuracy of the reporting on the statuses.
ok. I admittedly was hoping for something like "in [this specific circumstance], I used to get the wrong result, but now i get the right result"...
I haven't seen it say it was working when it wasn't, and after ask user prompts it says it's working. I haven't seen it say it was working when it wasn't. Previously it would say it was waiting for input while it was working (usually after asking user), and I had noticed it say it was working when it wasn't. Sorry for the lack of specifics, but I'm not staring at the list all the time, I only use it when I have 3 or more simultaneous worktrees in progress. It's hard to come up with an automated test to verify with certainty.
yes, I empathize @Ismael , and appreciate you both raising and trying to test; sorry to put you in the critical path here
I looked over https://code.claude.com/docs/en/hooks again. @worktrunk-bot let's create a PR with some partial progress. Add hooks with the relevant markers for:
- match
AskUserQuestioninPreToolUse(described at that link) StopPermissionRequest
Opened #3023 with the three hooks you named, all setting π¬:
PreToolUse(AskUserQuestion) β the question picker fires noNotificationon any platform (claude-code#13024)PermissionRequestβ covers permission prompts whereNotificationdoesn't fireStopβ turn-end signal, which doesn't exist today
Deliberately left out the PostToolUse β π€ transition, so this is strictly additive: it adds π¬ signals but keeps the existing one-way limitation (nothing flips back to π€ until the next prompt). I flagged in the PR that the per-event firing can't be verified from CI β it rests on the docs plus Ismael's trial, not a reproduction.