Open History to see the last commit
1# Cursor
2
3Cursor V2 runs through the official [`@cursor/sdk`](https://cursor.com/docs/api/sdk/typescript)
4TypeScript package. It does not use Cursor's ACP transport for V2 execution.
5
6## Prerequisites
7
8- Node.js 22.13 or newer. The repository's supported Node version satisfies this requirement.
9- Sign in with Cursor in **Settings > Providers > Cursor**, or provide a Cursor API key in
10 `CURSOR_API_KEY`.
11- A paid Cursor plan on the account used for browser sign-in or `CURSOR_API_KEY`.
12- A model accepted by the Cursor SDK. `auto` is sent to the SDK as its `default` model selection.
13
14The adapter currently uses the SDK's local-agent runtime so runs operate in the selected T3 Code
15workspace. Cursor cloud agents need repository and cloud-environment configuration that T3 Code does
16not expose yet.
17
18Custom Cursor MCP servers and plugins are not configured in T3 Code. They load from the environment
19machine's Cursor config when the agent opens: project `.cursor/mcp.json`, user `~/.cursor/mcp.json`,
20and installed plugins under `~/.cursor/plugins`. A project's own Cursor config, including its
21`.cursor/mcp.json`, loads only in **Full access**; in the other
22[permission modes](./permission-modes.md) a checkout cannot start MCP servers. Plugin tools
23can appear without a login; OAuth MCP servers still need credentials. Run `agent mcp login <server>`
24with the cwd set to the T3 project root (tokens land in
25`~/.cursor/projects/<folder-slug>/mcp-auth.json`). Cursor desktop Connections auth does not write
26that file, and the local SDK cannot complete interactive MCP OAuth itself—auth attempts fail with
27messages such as "MCP authentication is not supported in local SDK runs" or that the auth server
28does not support dynamic client registration. After you add or change skills, plugins, or MCP
29servers, or after a successful CLI login, use **Restart agent session**.
30
31## Sign in
32
33Choose **Sign in**, then open the sign-in page and complete it in your browser. T3 Code
34updates automatically when sign-in finishes. This works when connected to a remote environment too.
35On mobile, use **Settings > Providers** for an already configured Cursor instance.
36
37Each provider instance keeps its own login on the environment that runs it. Your Cursor editor and
38CLI login are separate. A configured `CURSOR_API_KEY` overrides browser sign-in; remove that override
39to use the browser flow.
40
41Use **Change account** or **Sign out** in the same settings section. Both stop that
42instance's running threads and keep their history. Sign-out forgets the saved credential; to revoke
43the generated key before it expires, remove it from your Cursor dashboard's API keys.
44
45## V2 Capability Mapping
46
47The adapter supports:
48
49- creating and resuming local Cursor agent threads;
50- changing the model and model parameters between turns;
51- assistant text, reasoning, tool activity, plans, and todo streaming;
52- thread-scoped T3 Code MCP tools alongside ambient Cursor MCP/plugins from disk;
53- image attachments;
54- interruption, queued app messages, and in-turn steering;
55- provider conversation snapshots through `Agent.messages.list()`;
56- Cursor `task` subagents, projected as read-only child app threads with their tool activity and
57 final result.
58
59The public SDK does not currently expose native agent fork or interactive approval callbacks. A
60text-only steer reaches the current run without restarting it.
61When Cursor cannot deliver the steer, the same message is queued for the next turn after
62this run finishes. If you press Stop, that follow-up stays held until you resume the queue. Steers
63with attachments and provider or runtime changes that must apply immediately interrupt and restart
64the run.
65Same-provider Cursor forks use the orchestrator's portable full-thread context handoff into a fresh
66Cursor agent. **Edit from here** and checkpoint rollback rewind the same Cursor agent to just before
67the selected message, as `cursor-agent`'s `/rewind` does, so it keeps its exact earlier history.
68Rewinding to the thread's first message starts a fresh Cursor agent instead.
69The SDK has in-process custom callback tools, but the V2 adapter intentionally uses the
70authenticated, thread-scoped MCP server instead.
71
72Portable handoffs summarize eligible timeline items and can omit the end of long messages. Read
73[Context in portable handoffs](./portable-handoffs.md) before using a fork for work whose exact
74instructions must carry forward.
75
76Cursor task events include an `agentId`, but the local SDK does not register that identifier as a
77resumable agent: `Agent.resume()` returns `AgentNotFoundError`. The adapter therefore does not attach
78a provider thread to native task projections or advertise subagent thread IDs. A projected child is
79read-only: send messages from the parent thread.
80
81Runtime modes map to the controls the local SDK exposes: full access disables its sandbox, while
82restricted modes normally enable it. On Windows, Auto and Supervised run without filesystem
83isolation when Cursor Auto-review is enabled, because the SDK does not support a filesystem sandbox
84there. Restricted modes without Auto-review, including the default Auto-accept edits mode, still
85request the sandbox and cannot start on Windows. Explicit sandbox policies remain authoritative,
86including restrictive policies that the Windows SDK rejects. Explicit approval policy overrides
87control Auto-review, which is not represented as an interactive T3 Code approval flow.
88
89The existing Cursor binary path and API endpoint settings belong to the CLI/ACP integration. Cursor
90V2 execution does not launch that binary, and the SDK does not expose an API endpoint override.
91
92## Replay And Live Testing
93
94Cursor replay fixtures preserve the SDK boundary: agent open/resume, sends, ordered `onDelta`
95updates, terminal results, cancellation, message snapshots, and close. The real V2 adapter,
96orchestrator, event store, projections, and checkpoint logic still run in tests.
97
98Record a fixture against the real SDK with:
99
100```bash
101pnpm --filter t3 record:cursor-replay --scenario simple
102```
103
104Use `--out <path>` to record a temporary probe without replacing a checked-in fixture. Supported
105scenarios are listed by the recorder when an invalid scenario is supplied.