Skip to content

Add Cursor agent support on new agent interface#392

Merged
squishykid merged 29 commits intomainfrom
robin/cursor-agent
Feb 25, 2026
Merged

Add Cursor agent support on new agent interface#392
squishykid merged 29 commits intomainfrom
robin/cursor-agent

Conversation

@squishykid
Copy link
Copy Markdown
Member

@squishykid squishykid commented Feb 17, 2026

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.goParseHookEvent mapping 7 Cursor hooks (session-start, session-end, before-submit-prompt, stop, pre-compact, subagent-start, subagent-stop) to normalized lifecycle events, plus ReadTranscript
  • hooks.go — Hook install/uninstall for .cursor/hooks.json with unknown field preservation
  • hooks_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 ReadTranscript
  • cursor_test.go — 32 tests covering identity, session storage (ReadSession/WriteSession round-trips), chunking, DetectPresence, and sanitizePathForCursor

Modified

  • registry.go — Adds AgentNameCursor and AgentTypeCursor constants
  • explain.go — Includes AgentTypeCursor in JSONL transcript scoping/offset logic
  • hooks_cmd.go — Blank import for cursor package init() registration
  • summarize/summarize.go + summarize_test.go — Cursor agent support in summarization
  • transcript/types.go — Documented Role field (Cursor uses role, Claude Code uses type)
  • transcript/parse.go + parse_test.go — Added shared ExtractModifiedFiles utility for agents with tool_use blocks

Design decisions

  • Native Cursor hook format: Uses Cursor's own subagent fields (subagent_id, task, subagent_type, etc.) rather than mapping to Claude Code conventions
  • 7 hooks installed: session-start, session-end, before-submit-prompt, stop, pre-compact, subagent-start, subagent-stop
  • No TranscriptAnalyzer: Cursor's transcript format does not contain tool_use blocks, so modified file detection relies on git status instead of transcript parsing
  • No TokenCalculator: Cursor's transcript does not include token usage data
  • FormatResumeCommand: Returns a human-readable instruction ("Open this project in Cursor...") since Cursor is a GUI IDE with no CLI resume command

Test plan

  • Unit tests pass (mise run test)
  • Integration tests pass (mise run test:integration)
  • Lint clean (mise run lint)
  • Builds successfully (go build ./cmd/entire/)
  • Manual: entire enable --agent cursor creates .cursor/hooks.json
  • Manual: entire disable removes hooks from .cursor/hooks.json
  • Manual: entire hooks cursor --help shows all hook verbs

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings February 17, 2026 17:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Soph Soph force-pushed the soph/agent-refactor branch from 905aeb4 to 2abcac1 Compare February 17, 2026 19:53
Base automatically changed from soph/agent-refactor to main February 18, 2026 02:16
@squishykid squishykid self-assigned this Feb 18, 2026
@squishykid squishykid added enhancement New feature or request agent-support adding support for additional AI agents labels Feb 18, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

@squishykid squishykid marked this pull request as ready for review February 18, 2026 16:18
@squishykid squishykid requested a review from a team as a code owner February 18, 2026 16:18
@squishykid squishykid requested a review from Copilot February 19, 2026 09:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

@entireio entireio deleted a comment from cursor bot Feb 19, 2026
@squishykid
Copy link
Copy Markdown
Member Author

@cursor review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

@squishykid
Copy link
Copy Markdown
Member Author

@cursor review

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 24, 2026

@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.

@squishykid squishykid requested a review from Copilot February 25, 2026 08:50
@squishykid
Copy link
Copy Markdown
Member Author

@cursor review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.

@squishykid squishykid requested a review from Soph February 25, 2026 09:02
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@squishykid squishykid merged commit ceea9c8 into main Feb 25, 2026
3 checks passed
@squishykid squishykid deleted the robin/cursor-agent branch February 25, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-support adding support for additional AI agents enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

4 participants