Where does the bug appear (feature/product)?
- Cursor IDE
Describe the Bug
When using Cursor agent with Claude Code hooks enabled (.claude/settings.json), Claude Stop hooks are triggered even when I’m not using Claude CLI and using cursor.
This results in duplicate side effects (e.g., notifications, sounds, logging), even though:
- no Claude CLI session is running
- no hooks are configured in
.cursor/hooks.json
Investigation shows that Cursor triggers additional internal background model sessions, which also fire Claude hooks.
Steps to Reproduce
- Add a
Stophook in.claude/settings.jsonwith a visible side effect (e.g., log, sound, or notification) - Add logging inside the hook to record:
modelsession_idoutput_tokens
- Ensure:
- no
claudeCLI session is running - no
.cursor/hooks.jsonnotification hooks exist
- Send a single message using the Cursor agent
- Wait for completion
- Inspect logs
Expected Behavior
- Only one corresponding side effect (notification, sound, log, etc.) should be produced per prompt.
- Only one Claude
Stophook invocation should occur per user-triggered agent completion
Actual Behavior
- Two separate
Stophook invocations occur:- one for the user-facing model (expected)
- one for an internal Cursor model (unexpected)
Evidence
First invocation (user-facing)
{
"model": "claude-4.6-sonnet-medium-thinking",
"session_id": "abc",
"output_tokens": 2244,
"cursor_version": "3.0.16",
"env": {
"VSCODE_PID": "72199"
}
}
Second invocation (internal background session ~30s later)
{
"model": "composer-2-fast",
"session_id": "abc",
"output_tokens": 56,
"cursor_version": "3.0.16",
"env": {
"VSCODE_PID": "72199"
}
}
Key observations
- Same
VSCODE_PID→ same Cursor process - Different
session_id→ separate session, not duplicate event - Low
output_tokens→ internal utility call - No
CLAUDE_CODE_ENTRYPOINT→ not a CLI session - Occurs consistently after each Cursor agent turn
Screenshots / Screen Recordings
(Not included — logs provided above)
Operating System
- macOS (Apple M1)
Version Information
Version: 3.0.16 (Universal)
VSCode Version: 1.105.1
Commit: 475871d112608994deb2e3065dfb7c6b0baa0c50
Date: 2026-04-09T05:33:51.767Z (1 wk ago)
Layout: editor
Build Type: Stable
Release Track: Nightly
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Darwin arm64 25.3.0
For AI issues: which model did you use?
- Primary:
claude-4.6-sonnet-medium-thinking - Internal observed:
composer-2-fast
Additional Information
This appears to be caused by Cursor running internal background model sessions that also trigger .claude/settings.json hooks.
Impact:
- All Claude hooks with side effects (notifications, sounds, logging, webhooks) execute multiple times per user action
- Current workaround requires filtering by model name (e.g., ignoring
composer-*), which is fragile
Suggested solutions:
- Do not trigger Claude hooks for internal/background sessions, or
- Add a field in the hook payload, e.g.:
{ “is_background”: true }
or
{ “hook_source”: “cursor_internal” }
Does this stop you from using Cursor?
- No