Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix(plugin): add waiting-for-input marker transitions for Claude hooks (#3023)

Worktrunk Bota35dd7f5984f
diff --git a/plugins/worktrunk/CLAUDE.md b/plugins/worktrunk/CLAUDE.md
index d4776a71b..19fee203f 100644
--- a/plugins/worktrunk/CLAUDE.md
+++ b/plugins/worktrunk/CLAUDE.md
@@ -56,9 +56,11 @@ that every repo-root skill is listed); Codex and Gemini pick up the whole
The Claude hooks track activity via git config (`worktrunk.status.{branch}`):
- `UserPromptSubmit` β†’ πŸ€– (working)
-- `Notification` β†’ πŸ’¬ (waiting for input)
+- `Notification`, `PreToolUse`(`AskUserQuestion`), `PermissionRequest`, `Stop` β†’ πŸ’¬ (waiting for input)
- `SessionEnd` β†’ clears status
+The πŸ’¬ transitions overlap deliberately: `Notification` covers the documented permission/idle path, but on platforms where it doesn't fire (VS Code extension, Windows CLI) `PermissionRequest` and `Stop` still mark the wait; `PreToolUse`(`AskUserQuestion`) catches the built-in question picker, which fires no `Notification` on any platform ([claude-code#13024](https://github.com/anthropics/claude-code/issues/13024)). There is currently no transition back to πŸ€– once a turn-end/permission marker is set except a fresh `UserPromptSubmit`, so πŸ’¬ can persist into resumed work after a permission grant (the original symptom in [#2916](https://github.com/max-sixty/worktrunk/issues/2916)).
+
**Problem**: If the user interrupts Claude Code (Escape/Ctrl+C), the πŸ€– status persists because there's no `UserInterrupt` hook. The `Stop` hook explicitly does not fire on user interrupt.
**Tracking**: [claude-code#9516](https://github.com/anthropics/claude-code/issues/9516)
diff --git a/plugins/worktrunk/hooks/hooks.json b/plugins/worktrunk/hooks/hooks.json
index 00fa85da7..79f27839a 100644
--- a/plugins/worktrunk/hooks/hooks.json
+++ b/plugins/worktrunk/hooks/hooks.json
@@ -21,6 +21,38 @@
]
}
],
+ "PreToolUse": [
+ {
+ "matcher": "AskUserQuestion",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash \"$CLAUDE_PLUGIN_ROOT/hooks/wt.sh\" config state marker set πŸ’¬ || true"
+ }
+ ]
+ }
+ ],
+ "PermissionRequest": [
+ {
+ "matcher": "",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash \"$CLAUDE_PLUGIN_ROOT/hooks/wt.sh\" config state marker set πŸ’¬ || true"
+ }
+ ]
+ }
+ ],
+ "Stop": [
+ {
+ "hooks": [
+ {
+ "type": "command",
+ "command": "bash \"$CLAUDE_PLUGIN_ROOT/hooks/wt.sh\" config state marker set πŸ’¬ || true"
+ }
+ ]
+ }
+ ],
"SessionEnd": [
{
"matcher": "",