Cursor CLI AskQuestion tool skips preToolUse and postToolUse hooks

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

When the agent invokes the AskQuestion tool, none of the documented hook
events fire for that tool call
. preToolUse and postToolUse are documented
to fire for all tools, but AskQuestion is excluded — in the same session
where Shell calls fire the full event sequence correctly.

This appears to be the same root cause as the already-acknowledged IDE bug
AskQuestion tool does not trigger cursor hooks
(closed for inactivity), but reproduced specifically in the CLI, with a
2026.05.28 build, so it likely needs a separate fix path even when the IDE
fix lands.

Steps to Reproduce

  1. Register a capture.sh hook on every documented event in
    ~/.cursor/hooks.json (full file at the bottom of this report). The script
    appends argv, CURSOR_* env vars, and stdin to a single log file.
  2. Restart cursor-agent so the new hooks.json is loaded.
  3. In the agent, run a single Shell call (e.g. ask for echo hello). Hooks
    fire correctly — preToolUse and postToolUse are logged with
    "tool_name":"Shell".
  4. In the same session, have the agent invoke the AskQuestion tool. Answer
    the question.
  5. Run another Shell call and re-read the log.

Result: AskQuestion produces zero hook invocations between the
surrounding Shell invocations.

Captured event timeline (UTC)

This is from a single live session. The agent (a) ran a Shell call, (b)
invoked AskQuestion and got an answer, (c) ran another Shell call. Only
(a) and (c) show up in hook events:

2026-05-28T19:40:13Z  beforeSubmitPrompt     tool=-
2026-05-28T19:40:24Z  preToolUse             tool=Shell      ← Shell call (a)
2026-05-28T19:40:24Z  beforeShellExecution   tool=-
2026-05-28T19:40:25Z  afterShellExecution    tool=-
2026-05-28T19:40:25Z  postToolUse            tool=Shell
                                                              ← (b) AskQuestion
                                                                fired and was
                                                                answered between
                                                                these two Shell
                                                                calls, but
                                                                produced NO hook
                                                                events at all
2026-05-28T19:40:46Z  preToolUse             tool=Shell      ← Shell call (c)
2026-05-28T19:40:46Z  beforeShellExecution   tool=-
2026-05-28T19:40:46Z  afterShellExecution    tool=-
2026-05-28T19:40:47Z  postToolUse            tool=Shell

Event counts for the session:

3 preToolUse           ← all three are Shell
3 beforeShellExecution
2 postToolUse          ← both are Shell
2 afterShellExecution
1 beforeSubmitPrompt
0 — every other registered event, including any AskQuestion-related one

The only "tool_name" value present anywhere in the captured payloads is
"Shell". AskQuestion, ask_question, AskUserQuestion, etc. appear
nowhere as tool_name (or any other identifying field).

Expected Behavior

Per the hooks documentation:

preToolUse / postToolUse / postToolUseFailure - Generic tool use hooks
(fires for all tools)

The AskQuestion tool should fire at least preToolUse and postToolUse,
with a stable tool_name value, so:

  • third-party observability can audit human-in-the-loop gates,
  • agents can’t bypass approval flows by claiming consent that wasn’t given,
  • notifier integrations can react to “agent is now waiting on the user”.

Operating System

MacOS

Version Information

cursor-agent: 2026.05.28-418efe5
cursor (IDE): 3.4.20
macOS: 26.5 (build 25F71)
uname: Darwin 25.5.0 arm64
tmux: 3.6a
python3: 3.9.6 (system)

Additional Information

Appendix A: ~/.cursor/hooks.json

Capture hook is registered against every event listed at hooks documentation

{
  "version": 1,
  "hooks": {
    "stop": [{ "command": "./hooks/capture.sh stop" }],
    "beforeSubmitPrompt": [{ "command": "./hooks/capture.sh beforeSubmitPrompt" }],
    "beforeShellExecution": [{ "command": "./hooks/capture.sh beforeShellExecution" }],
    "afterShellExecution": [{ "command": "./hooks/capture.sh afterShellExecution" }],
    "sessionStart":       [{ "command": "./hooks/capture.sh sessionStart" }],
    "sessionEnd":         [{ "command": "./hooks/capture.sh sessionEnd" }],
    "preCompact":         [{ "command": "./hooks/capture.sh preCompact" }],
    "preToolUse":         [{ "command": "./hooks/capture.sh preToolUse" }],
    "postToolUse":        [{ "command": "./hooks/capture.sh postToolUse" }],
    "postToolUseFailure": [{ "command": "./hooks/capture.sh postToolUseFailure" }],
    "subagentStart":      [{ "command": "./hooks/capture.sh subagentStart" }],
    "subagentStop":       [{ "command": "./hooks/capture.sh subagentStop" }],
    "beforeMCPExecution": [{ "command": "./hooks/capture.sh beforeMCPExecution" }],
    "afterMCPExecution":  [{ "command": "./hooks/capture.sh afterMCPExecution" }],
    "beforeReadFile":     [{ "command": "./hooks/capture.sh beforeReadFile" }],
    "afterFileEdit":      [{ "command": "./hooks/capture.sh afterFileEdit" }],
    "afterAgentResponse": [{ "command": "./hooks/capture.sh afterAgentResponse" }],
    "afterAgentThought":  [{ "command": "./hooks/capture.sh afterAgentThought" }]
  }
}

Appendix B: capture.sh

#!/bin/bash
# Diagnostic capture hook. Logs every Cursor hook invocation to one file
# so we can see WHICH events actually fire when the agent uses AskQuestion.
set -u
LOG="${TMPDIR:-/tmp}/cursor-hook-capture.log"
ts=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
{
  printf '===== %s =====\n' "$ts"
  printf 'argv: %s\n' "$*"
  env | awk '/^CURSOR_/ {print "env: " $0}'
  echo '--- stdin ---'
  head -c 4096
  printf '\n--- end stdin ---\n\n'
} >> "$LOG" 2>&1
exit 0

Related

  • Forum thread (IDE-acknowledged, closed for inactivity):
  • Cursor staff (deanrie) acknowledged in that thread:

    It looks like this is a bug. The docs say preToolUse and postToolUse
    run for all tools, so AskQuestion should be included too. I’m passing
    this on to the team.

The fix presumably needs to land on both the IDE adapter and the CLI hook
adapter for the AskQuestion tool.

Does this stop you from using Cursor

No - Cursor works, but with this issue

This is a confirmed bug. The AskQuestion tool is not wired to fire preToolUse/postToolUse hooks in either the IDE or the CLI. Your methodology and event timeline are excellent confirmation.

No workaround exists for this specific tool at the moment. Our team is aware and this is tracked internally. I’ll update this thread when there’s progress.