Add Cursor agent support on new agent interface#392
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Cursor as a first-class agent implementation in the refactored agent/hook architecture, enabling lifecycle event dispatch, hook installation into .cursor/hooks.json, and reuse of the existing JSONL transcript + incremental checkpoint flow.
Changes:
- Introduces
cmd/entire/cli/agent/cursor/implementing Cursor agent identity, transcript handling, lifecycle event mapping, and hook management. - Wires Cursor into hook command registration/dispatch (including PostTodo incremental checkpoints) and agent registry constants.
- Updates summarization to treat Cursor transcripts as JSONL (shared path with Claude Code).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/summarize/summarize.go | Routes Cursor to the JSONL condensed-transcript path. |
| cmd/entire/cli/setup.go | Adds Cursor to “Preview” messaging and to global hook removal. |
| cmd/entire/cli/hooks_cursor_posttodo.go | Adds Cursor PostTodo handler delegating to Claude’s incremental checkpoint logic. |
| cmd/entire/cli/hooks_cmd.go | Ensures Cursor agent package is registered via blank import. |
| cmd/entire/cli/hook_registry.go | Adds Cursor PostTodo dispatch path alongside Claude’s. |
| cmd/entire/cli/agent/registry.go | Adds AgentNameCursor / AgentTypeCursor constants. |
| cmd/entire/cli/agent/cursor/types.go | Defines Cursor hooks.json structures + hook input raw types with conversation_id fallback. |
| cmd/entire/cli/agent/cursor/lifecycle.go | Implements ParseHookEvent mapping Cursor hooks to normalized lifecycle events + transcript analyzer methods. |
| cmd/entire/cli/agent/cursor/lifecycle_test.go | Adds unit tests for lifecycle mapping and conversation_id fallback behavior. |
| cmd/entire/cli/agent/cursor/hooks.go | Implements install/uninstall/detection for .cursor/hooks.json with matcher-based tool hooks. |
| cmd/entire/cli/agent/cursor/hooks_test.go | Adds unit tests for hook install/uninstall/idempotency/preservation behavior. |
| cmd/entire/cli/agent/cursor/cursor.go | Implements Cursor agent identity, legacy hook parsing, session I/O, transcript chunking, and modified-file extraction. |
905aeb4 to
2abcac1
Compare
dd067cd to
c072c01
Compare
950ba73 to
4ae0a70
Compare
|
@cursor review |
|
@cursor review |
|
@squishykid I've opened a new pull request, #483, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Summary
Adds Cursor as a supported agent with full hook lifecycle, transcript storage, and checkpoint integration.
New: Cursor agent package (
agent/cursor/)types.go— Cursor-specific types: session info, prompt input, pre-compact, subagent start/stop with native Cursor fields (conversation_id,subagent_id,task, etc.)cursor.go— Agent implementation with JSONL transcript storage (ReadSession, WriteSession, ChunkTranscript, ReassembleTranscript)lifecycle.go—ParseHookEventmapping 7 Cursor hooks (session-start,session-end,before-submit-prompt,stop,pre-compact,subagent-start,subagent-stop) to normalized lifecycle events, plusReadTranscripthooks.go— Hook install/uninstall for.cursor/hooks.jsonwith unknown field preservationhooks_test.go— 11 hook tests (install, idempotent, force, preserve existing/unknown fields, uninstall)lifecycle_test.go— 14 lifecycle tests covering all hook types, edge cases, conversation_id fallback, and ReadTranscriptcursor_test.go— 32 tests covering identity, session storage (ReadSession/WriteSession round-trips), chunking, DetectPresence, and sanitizePathForCursorModified
registry.go— AddsAgentNameCursorandAgentTypeCursorconstantsexplain.go— IncludesAgentTypeCursorin JSONL transcript scoping/offset logichooks_cmd.go— Blank import for cursor packageinit()registrationsummarize/summarize.go+summarize_test.go— Cursor agent support in summarizationtranscript/types.go— DocumentedRolefield (Cursor usesrole, Claude Code usestype)transcript/parse.go+parse_test.go— Added sharedExtractModifiedFilesutility for agents with tool_use blocksDesign decisions
subagent_id,task,subagent_type, etc.) rather than mapping to Claude Code conventionssession-start,session-end,before-submit-prompt,stop,pre-compact,subagent-start,subagent-stoptool_useblocks, so modified file detection relies on git status instead of transcript parsingTest plan
mise run test)mise run test:integration)mise run lint)go build ./cmd/entire/)entire enable --agent cursorcreates.cursor/hooks.jsonentire disableremoves hooks from.cursor/hooks.jsonentire hooks cursor --helpshows all hook verbs🤖 Generated with Claude Code