Skip to content

Comments

Add Cursor agent support on new agent interface#392

Open
squishykid wants to merge 13 commits intomainfrom
robin/cursor-agent
Open

Add Cursor agent support on new agent interface#392
squishykid wants to merge 13 commits intomainfrom
robin/cursor-agent

Conversation

@squishykid
Copy link
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 with conversation_id fallback for session IDs
  • cursor.go — Agent implementation with JSONL transcript storage (ReadSession, WriteSession, ChunkTranscript, ReassembleTranscript)
  • lifecycle.goParseHookEvent mapping 7 Cursor hooks 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 — 15 lifecycle tests covering all hook types, edge cases, and ReadTranscript
  • cursor_test.go — 30 tests covering identity, session storage (ReadSession/WriteSession round-trips), chunking, DetectPresence, and sanitizePathForCursor

Modified

  • setup.go — Uses IsPreview() for preview labels, adds removeAgentHooks for Cursor uninstall
  • hooks_cmd.go — Blank import for cursor package init() registration
  • transcript/types.go — Documented Role field (Cursor uses role, Claude Code uses type)
  • transcript/parse.go — Added shared ExtractModifiedFiles utility for agents with tool_use blocks

Design decisions

  • 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

@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 1 potential issue.

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

Copy link
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
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
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
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
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
Copy link
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 11 out of 11 changed files in this pull request and generated 4 comments.

@squishykid squishykid marked this pull request as ready for review February 19, 2026 13:27
Soph
Soph previously approved these changes Feb 19, 2026
Copy link
Collaborator

@Soph Soph left a comment

Choose a reason for hiding this comment

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

🚢

@squishykid squishykid changed the base branch from main to rwr/streamline-setup February 20, 2026 09:45
squishykid and others added 7 commits February 20, 2026 10:49
- Remove dead code: ParseHookInput, GetHookConfigPath, SupportsHooks (zero callers)
- Remove incorrect extractModifiedFiles/FileModificationTools (Cursor transcript lacks tool_use blocks)
- Fix FormatResumeCommand: return human-readable instruction instead of invalid CLI command
- Document transcript.Line.Role field (Cursor uses "role", Claude Code uses "type")
- Add shared transcript.ExtractModifiedFiles utility to transcript package
- ReadSession no longer populates ModifiedFiles (relies on git status instead)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: cd204de06bd2
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: d5891c95e5a4
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 86d61e18931c
Copy link
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 12 out of 12 changed files in this pull request and generated 3 comments.

Base automatically changed from rwr/streamline-setup to main February 20, 2026 13:42
@squishykid squishykid dismissed Soph’s stale review February 20, 2026 13:42

The base branch was changed.

squishykid and others added 3 commits February 20, 2026 14:47
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Cursor JSONL uses "role" instead of "type" to distinguish user/assistant
messages. Normalize role→type during transcript parsing so all downstream
consumers (summarize, explain) work uniformly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: fac4ff295b71
Copy link
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 15 out of 15 changed files in this pull request and generated 1 comment.

Comment on lines +787 to +794
func TestBuildCondensedTranscriptFromBytes_CursorRoleBasedJSONL(t *testing.T) {
// Cursor transcripts use "role" instead of "type" and wrap user text in <user_query> tags.
// The transcript parser normalizes role→type, so condensation should work.
cursorJSONL := `{"role":"user","message":{"content":[{"type":"text","text":"<user_query>\nhello\n</user_query>"}]}}
{"role":"assistant","message":{"content":[{"type":"text","text":"Hi there!"}]}}
{"role":"user","message":{"content":[{"type":"text","text":"<user_query>\nadd one to a file and commit\n</user_query>"}]}}
{"role":"assistant","message":{"content":[{"type":"text","text":"Created one.txt with one and committed."}]}}
`
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

Cursor user prompts are wrapped in <user_query>...</user_query> (as noted in this test), but the current extraction path (transcript.ExtractUserContenttextutil.StripIDEContextTags) does not strip those tags. This means summarized/condensed user prompts will likely include the wrapper markup, which will leak into intent extraction and summaries. Consider stripping Cursor’s <user_query> wrapper during user-content extraction (either by extending StripIDEContextTags or adding a Cursor-specific cleanup step) and tightening this test to assert the tags are removed (not just that it contains "hello").

Copilot uses AI. Check for mistakes.
Entire-Checkpoint: f15cd73bd481
if raw.ToolResponse.AgentID != "" {
event.SubagentID = raw.ToolResponse.AgentID
}
// TODO "tool_output": "{\"status\":\"success\",\"agentId\":\"3211cc34-8d8f-42de-9dcf-c19625b17566\",\"durationMs\":7901,\"messageCount\":1,\"toolCallCount\":1}",
Copy link
Member Author

Choose a reason for hiding this comment

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

need to fix sub-agent extraction

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.

2 participants