You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cursor): use verified env vars, remove broken sessionStart hook
Based on source-verified audit against Cursor forum, GitButler deep dive,
and macos-notify-mcp:
- Detection: replace fabricated CURSOR_CWD/CURSOR_SESSION_ID with verified
CURSOR_TRACE_ID (MCP context) and CURSOR_CLI (terminal context)
- sessionStart: set capabilities.sessionStart=false (Cursor rejects it
with "Unknown hook type" per forum.cursor.com/t/149566). Routing
instructions now delivered via server.ts startup (same as Codex CLI)
- hooks.json: remove undocumented type/loop_limit/failClosed fields,
remove sessionStart entry
- hooks.ts: remove sessionStart from REQUIRED_HOOKS
- README + docs/platform-support.md: update Cursor sections to reflect
verified capabilities
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Note: the `preToolUse` hook matcher is optional. If you don't provide it, the hook will fire on all tools.
224
216
225
-
**Step 4 — Restart Cursor or open a new agent session.**
217
+
**Step 4 — Restart Cursor or open a new agent session.** On first MCP server startup, routing instructions are auto-written to your project (same mechanism as Codex CLI).
226
218
227
-
> **Native Cursor scope:**v1 ships `preToolUse`, `postToolUse`, and `sessionStart`. `preCompact` is intentionally not enabled until real Cursor fixtures confirm compatible compaction semantics.
219
+
> **Native Cursor scope:**`preToolUse` and `postToolUse` are supported. `sessionStart` is documented by Cursor but currently rejected by their validator ([forum report](https://forum.cursor.com/t/unknown-hook-type-sessionstart/149566)), so routing instructions are delivered via MCP server startup instead.
228
220
>
229
-
> **Config precedence:** project `.cursor/hooks.json` overrides `~/.cursor/hooks.json`. Cursor may also load enterprise config at `/Library/Application Support/Cursor/hooks.json`; context-mode treats that layer as read-only informational.
> **Note:** Full session continuity (capture + snapshot + restore) works on **Claude Code**, **Gemini CLI**, and **VS Code Copilot**, and **OpenCode**. **Cursor**v1 restores from persisted session events via `sessionStart`, but intentionally does not advertise `preCompact` until real native fixtures confirm compaction compatibility. **OpenCode** uses the `experimental.session.compacting` plugin hook for compaction recovery, but SessionStart is not yet available ([#14808](https://github.com/sst/opencode/issues/14808)), so startup/resume is not supported. Codex CLI has no hook support, so session tracking is not available.
362
+
> **Note:** Full session continuity (capture + snapshot + restore) works on **Claude Code**, **Gemini CLI**, **VS Code Copilot**, and **OpenCode**. **Cursor**captures tool events via `preToolUse`/`postToolUse`, but `sessionStart` is currently rejected by Cursor's validator ([forum report](https://forum.cursor.com/t/unknown-hook-type-sessionstart/149566)), so session restore after compaction is not available yet. **OpenCode** uses the `experimental.session.compacting` plugin hook for compaction recovery, but SessionStart is not yet available ([#14808](https://github.com/sst/opencode/issues/14808)), so startup/resume is not supported. Codex CLI has no hook support, so session tracking is not available.
@@ -442,7 +434,7 @@ Detailed event data is also indexed into FTS5 for on-demand retrieval via `searc
442
434
443
435
**VS Code Copilot** — High coverage. Same as Gemini CLI — PostToolUse, PreCompact, and SessionStart all fire. User decisions aren't captured but all tool-level events are.
444
436
445
-
**Cursor** — Medium coverage. Native `preToolUse`, `postToolUse`, and `sessionStart`hooks are supported. Session restore works from the persisted event database, but `preCompact`is intentionally disabled in v1 until real Cursor fixtures prove compatible semantics.
437
+
**Cursor** — Partial coverage. Native `preToolUse` and `postToolUse` hooks capture tool events. `sessionStart`is documented by Cursor but currently rejected by their validator, so session restore is not available. Routing instructions are delivered via MCP server startup instead.
446
438
447
439
**OpenCode** — Partial. The TypeScript plugin captures PostToolUse events via `tool.execute.after`, but SessionStart is not yet available ([#14808](https://github.com/sst/opencode/issues/14808)). Events are stored but not automatically restored after compaction. The `AGENTS.md` routing instructions file compensates by re-teaching tool preferences at each session start.
448
440
@@ -457,7 +449,7 @@ Detailed event data is also indexed into FTS5 for on-demand retrieval via `searc
|**Config location**|`~/.claude/settings.json`|`~/.gemini/settings.json`|`.github/hooks/*.json`|`.cursor/hooks.json` or `~/.cursor/hooks.json`|`opencode.json`|`~/.codex/config.toml`|
47
47
|**Session ID field**|`session_id`|`session_id`|`sessionId` (camelCase) |`conversation_id`|`sessionID` (camelCase) | N/A |
48
-
|**Project dir env**|`CLAUDE_PROJECT_DIR`|`GEMINI_PROJECT_DIR`|`CLAUDE_PROJECT_DIR`|`CURSOR_CWD`|`ctx.directory` (plugin init) | N/A |
48
+
|**Project dir env**|`CLAUDE_PROJECT_DIR`|`GEMINI_PROJECT_DIR`|`CLAUDE_PROJECT_DIR`|stdin `workspace_roots`|`ctx.directory` (plugin init) | N/A |
49
49
|**MCP tool naming**|`mcp__server__tool`|`mcp__server__tool`|`f1e_` prefix |`MCP:<tool>` in hook payloads |`mcp__server__tool`|`mcp__server__tool`|
@@ -277,26 +277,29 @@ Cursor uses native lower-camel hook names and flat hook entries in `.cursor/hook
277
277
**Hook Names:**
278
278
-`preToolUse` -- fires before a tool is executed
279
279
-`postToolUse` -- fires after a tool completes
280
-
-`sessionStart` -- fires on startup, resume, and compact
280
+
-`sessionStart` -- documented but currently rejected by Cursor's validator ([forum report](https://forum.cursor.com/t/unknown-hook-type-sessionstart/149566))
0 commit comments