cursor-hooks/PARITY.md
This document compares claude-mem's Claude Code hooks with the Cursor hooks implementation to ensure feature parity.
| Claude Code Hook | Cursor Hook | Status | Notes |
|---|---|---|---|
SessionStart → context-hook.js | beforeSubmitPrompt → context-inject.sh | ✅ Partial | Context fetched but not injectable in Cursor |
SessionStart → user-message-hook.js | (Optional) user-message.sh | ⚠️ Optional | No SessionStart equivalent; can run on beforeSubmitPrompt |
UserPromptSubmit → new-hook.js | beforeSubmitPrompt → session-init.sh | ✅ Complete | Session init, privacy checks, slash stripping |
PostToolUse → save-hook.js | afterMCPExecution + afterShellExecution → save-observation.sh | ✅ Complete | Tool observation capture |
PostToolUse → (file edits) | afterFileEdit → save-file-edit.sh | ✅ Complete | File edit observation capture |
Stop → summary-hook.js | stop → session-summary.sh | ⚠️ Partial | Summary generation (no transcript access) |
new-hook.js ↔ session-init.sh)| Feature | Claude Code | Cursor | Status |
|---|---|---|---|
| Worker health check | ✅ 75 retries (15s) | ✅ 75 retries (15s) | ✅ Match |
| Session init API call | ✅ /api/sessions/init | ✅ /api/sessions/init | ✅ Match |
| Privacy check handling | ✅ Checks skipped + reason | ✅ Checks skipped + reason | ✅ Match |
| Slash stripping | ✅ Strips leading / | ✅ Strips leading / | ✅ Match |
| SDK agent init | ✅ /sessions/{id}/init | ❌ Not needed | ✅ N/A (Cursor-specific) |
Status: ✅ Complete parity (SDK agent init not applicable to Cursor)
context-hook.js ↔ context-inject.sh)| Feature | Claude Code | Cursor | Status |
|---|---|---|---|
| Worker health check | ✅ 75 retries | ✅ 75 retries | ✅ Match |
| Context fetch | ✅ /api/context/inject | ✅ /api/context/inject | ✅ Match |
| Output format | ✅ JSON with hookSpecificOutput | ✅ Write to .cursor/rules/ file | ✅ Alternative |
| Project name extraction | ✅ getProjectName(cwd) | ✅ basename(workspace_root) | ✅ Match |
| Auto-refresh | ✅ Each session start | ✅ Each prompt submission | ✅ Enhanced |
Status: ✅ Complete parity via auto-updated rules file
How it works:
.cursor/rules/claude-mem-context.mdcalwaysApply: true frontmatteruser-message-hook.js ↔ user-message.sh)| Feature | Claude Code | Cursor | Status |
|---|---|---|---|
| Context fetch with colors | ✅ /api/context/inject?colors=true | ✅ /api/context/inject?colors=true | ✅ Match |
| Output channel | ✅ stderr | ✅ stderr | ✅ Match |
| Display format | ✅ Formatted with emojis | ✅ Formatted with emojis | ✅ Match |
| Hook trigger | ✅ SessionStart | ⚠️ Optional (no SessionStart) | ⚠️ Cursor limitation |
Status: ⚠️ Optional (no SessionStart equivalent in Cursor)
Note: Can be added to beforeSubmitPrompt if desired, but may be verbose.
save-hook.js ↔ save-observation.sh)| Feature | Claude Code | Cursor | Status |
|---|---|---|---|
| Worker health check | ✅ 75 retries | ✅ 75 retries | ✅ Match |
| Tool name extraction | ✅ From tool_name | ✅ From tool_name or "Bash" | ✅ Match |
| Tool input capture | ✅ Full JSON | ✅ Full JSON | ✅ Match |
| Tool response capture | ✅ Full JSON | ✅ Full JSON or output | ✅ Match |
| Privacy tag stripping | ✅ Worker handles | ✅ Worker handles | ✅ Match |
| Error handling | ✅ Fire-and-forget | ✅ Fire-and-forget | ✅ Match |
| Shell command mapping | ✅ N/A (separate hook) | ✅ Maps to "Bash" tool | ✅ Enhanced |
Status: ✅ Complete parity (enhanced with shell command support)
save-file-edit.sh)| Feature | Claude Code | Cursor | Status |
|---|---|---|---|
| File path extraction | N/A | ✅ From file_path | ✅ New |
| Edit details | N/A | ✅ From edits array | ✅ New |
| Tool name | N/A | ✅ "write_file" | ✅ New |
| Edit summary | N/A | ✅ Generated from edits | ✅ New |
Status: ✅ New feature (Cursor-specific, not in Claude Code)
summary-hook.js ↔ session-summary.sh)| Feature | Claude Code | Cursor | Status |
|---|---|---|---|
| Worker health check | ✅ 75 retries | ✅ 75 retries | ✅ Match |
| Transcript parsing | ✅ Extracts last messages | ❌ No transcript access | ⚠️ Cursor limitation |
| Summary API call | ✅ /api/sessions/summarize | ✅ /api/sessions/summarize | ✅ Match |
| Last message extraction | ✅ From transcript | ❌ Empty strings | ⚠️ Cursor limitation |
| Error handling | ✅ Fire-and-forget | ✅ Fire-and-forget | ✅ Match |
Status: ⚠️ Partial parity (no transcript access in Cursor)
Note: Summary generation still works but may be less accurate without last messages. Worker generates summary from observations stored during session.
skipped flagskipped flag<private> and <claude-mem-context> tagsDirect Context Injection: SOLVED via auto-updated rules file
.cursor/rules/claude-mem-context.mdcalwaysApply: trueTranscript Access: Cursor hooks don't provide transcript paths
SessionStart Hook: Cursor doesn't have session start event
beforeSubmitPrompt if desiredSDK Agent Session: Cursor doesn't use SDK agent pattern
/sessions/{id}/init call neededShell Command Capture: Maps shell commands to "Bash" tool observations
File Edit Capture: Dedicated hook for file edits
MCP Tool Capture: Captures MCP tool usage separately
| Category | Status |
|---|---|
| Core Functionality | ✅ Complete parity |
| Session Management | ✅ Complete parity |
| Observation Capture | ✅ Complete parity (enhanced) |
| Context Injection | ✅ Complete parity (via rules file) |
| Summary Generation | ⚠️ Partial (no transcript) |
| User Experience | ⚠️ Partial (no SessionStart) |
Overall: The Cursor hooks implementation achieves full functional parity with claude-mem's Claude Code hooks:
.cursor/rules/ file)