Proposal: Cursor Composer agent adapter (headless repo tasks via @cursor/sdk)
Summary
We have a working Cursor Composer integration for headless repo tasks on a public fork and would like to offer it upstream if it fits your roadmap.
Optio already supports multiple coding agents (Claude Code, Codex, Copilot, Gemini, OpenCode). Composer fits the same “multi-vendor, self-hosted” story described in the README—teams that want Cursor’s models but cannot use hosted background agents in their environment.
There are no existing open issues on this repo for Cursor/Composer support, so we wanted to start the conversation here before opening a large PR.
What we built (reference implementation)
Fork: https://github.com/jtorelli-metalworks/optio (main)
Guide: https://github.com/jtorelli-metalworks/optio/blob/main/docs/guides/cursor-agent.md
High-level shape:
- New agent type
cursorin the agent adapter layer (packages/agent-adapters/src/cursor.ts) - Repo fields:
defaultAgentType: cursor,cursorModel(e.g.composer-2.5) - Headless runner in agent pods:
node /opt/optio/run-cursor-agent.mjsusing@cursor/sdk(Agent.create()+run.stream()) - OpenClaw-compatible NDJSON output, including
session_idfromOPTIO_TASK_IDfor stall detection / session tracking - Secret:
CURSOR_API_KEY(workspace global or per-repo via secret proxy) - DB migration for cursor-related repo columns
- Agent base image includes
@cursor/sdkfor ESM resolution in pods
Review lane: Composer is used for implement tasks only in v1; review tasks still run on another supported agent (e.g. Claude Code), matching how other vendors are split today.
Known limitations (v1):
- Resume / multi-turn is one-shot
agent.send()rather than full multi-turn resume - Requires a cursor-enabled agent image build (
images/base.Dockerfile)
Why upstream?
- Keeps Optio’s “pick your agent vendor per repo” positioning coherent
- Avoids a permanent fork divergence for a feature that is mostly additive (adapter + runner + image dep + migration)
- Lets you set policy on image size, API key handling, and maintenance expectations
Offer
Happy to open a focused upstream PR (adapter, runner, migration, docs, image changes—no unrelated fork-only release-line changes) if you want this. We can also trim or adjust based on your preferences (e.g. feature flag, experimental agent type, docs-only first step).
Questions for maintainers
- Is Cursor/Composer agent support something you want in core Optio?
- Any constraints we should design for upfront (agent image size, GHCR publishing, review-agent split, experimental vs stable)?
- Preferred contribution path: issue discussion → PR, or smaller incremental PRs?
Thanks for building Optio—happy to collaborate on whatever shape works best for the project.
Thanks for the detailed proposal and the working fork — it moved Cursor support to the top of the queue. Answering your three questions up front: (1) yes, we want Cursor in core, and it just landed on main; (2) the main constraint was matching the existing vendor pattern (CLI in the agent image + NDJSON parser, no SDK dependency); (3) focused PRs straight against main are the ideal path for follow-ups.
What shipped (2a69a8a): a native cursor agent type built on the Cursor CLI rather than @cursor/sdk:
- Headless runs via
cursor-agent --print --trust --force --output-format stream-json, with--resume <chatId>wired up for repo-task resume (the multi-turn limitation your v1 noted goes away with the CLI path) CURSOR_API_KEYsecret (workspace-global or per-repo), treated as an identity secret like the other agent keysrepos.cursor_model(free text, e.g.composer-2.5) + a Cursor tab in repo config; works across repo tasks, Jobs, Persistent Agents, and the review lanecursor-agentbaked into the base agent image (relocated to/optfor the non-root agent user)- A stream-json event parser (system:init / assistant / tool_call / result) with session capture for stall detection, plus deterministic e2e coverage via the fake runtime
Where your setup would really help: we don't have a Cursor API key on hand, so the live path (real cursor-agent inside an agent pod) is verified only up to CLI installation. If you can point your workloads at upstream main and report back, the two things to watch are (a) the tool_call event payloads — we normalized the nested { <name>ToolCall: { args, result } } shape from the docs and would like confirmation against real traffic — and (b) PR-open detection on a real repo task. A docs guide PR (your docs/guides/cursor-agent.md looks like a great starting point) would also be very welcome.
Thanks again — this was a model "start the conversation first" proposal.
Closing as shipped — the CLI-based cursor agent type landed in 2a69a8a (see the comment above for the full rundown). Live-verification reports on the tool_call payload shape and PR-open detection are still very welcome here even while closed, and focused follow-up PRs (e.g. the docs guide) can go straight against main.