Question about Stop hook with type: "prompt" in Cursor

I’m trying to use a Stop hook in Cursor with type: “prompt”, but I’m not sure whether my configuration is incorrect or whether this is currently not supported.

My current hook configuration is:

{

“version”: 1,

“hooks”: {

“stop”: \[

{

“type”: “prompt”,

“prompt”: “除了json,不要输出任何东西,json:{"ok": false, "reason": "还缺少什么"}”,

“timeout”: 60,

“model”: “gpt-5.4-medium”

}

\]

}

}

What I want to confirm is:

  1. What is the correct way to use a Stop hook with type: “prompt” in Cursor?

  2. Is this feature currently supported?

  3. If it is supported, could you share a minimal working example?

Right now, whenever I try this configuration, it always fails with:

  • exit code: 2

  • output: empty

So I’m not sure whether:

  • my hook format is wrong,

  • the stop event does not support prompt,

  • or this is a Cursor limitation / bug.

I’d really appreciate it if you could help clarify this.

Hey, I see two potential issues with your setup.

  1. Known bug: hooks may not load when only a stop hook is defined

There’s a known issue where hooks don’t load if your config only has a stop hook and nothing else. That could explain the empty output and exit code 2. The hook might not even be starting.

As a workaround, try adding a minimal no-op hook for another event alongside your stop hook:

{
  "version": 1,
  "hooks": {
    "afterFileEdit": [
      {
        "command": "cat > /dev/null"
      }
    ],
    "stop": [
      {
        "type": "prompt",
        "prompt": "Review whether the agent completed the task fully. Return ok: true if complete, ok: false with a reason if something is missing.",
        "timeout": 60
      }
    ]
  }
}
  1. Your prompt always forces ok: false

Prompt-type hooks act like a gate. The LLM returns { ok: boolean, reason?: string }. If ok: false, Cursor treats it as a deny (exit code 2). Your prompt tells the model to output {"ok": false, ...}, so even when the hook runs, it’ll always deny.

The prompt should describe a condition for the LLM to check, not hardcode the result. Let the model decide ok: true or ok: false.

Also worth noting, for the stop event the agent is already done. A deny result won’t undo completed work. It’s mainly useful for observation or logging.

Can you share your Cursor version and OS? Also let me know if adding the extra hook changes anything.