Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat: add Cursor CLI as an Agentic IDE option

rubenluetke10-beep508e0db18637
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8791a126d3..4aaff020c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,12 @@ versioning per [SemVer](https://semver.org/).
### Added
+- **Cursor CLI in the Agentic IDE.** Cursor's official terminal agent
+ (`agent` / `cursor-agent`) is a pick in Open beside, the chat's Coding
+ CLIs list, and the install button. Windows runs
+ `irm https://cursor.com/install?win32=true`; macOS, Linux and WSL run
+ `curl https://cursor.com/install`. Sign-in is `agent login` (or
+ `CURSOR_API_KEY`) inside the pane.
- **Agentic IDE chat: every connected coding CLI is a seat.** The chat's
provider picker lists the Agentic IDE's own CLI registry under "Coding
CLIs" — OpenCode, Kimi Code, GLM Coding Plan and DeepSeek Harness join
diff --git a/docs/os-parity.md b/docs/os-parity.md
index 6defa94c36..833a5d61aa 100644
--- a/docs/os-parity.md
+++ b/docs/os-parity.md
@@ -242,6 +242,7 @@ experiences today.
| P-22 | Low | Orb window | The floating orb window (both looks: the Gigi mascot and the procedural **voice orb**) is a Tk window whose transparency comes from a colour key. Windows keys it out natively; macOS uses Aqua-Tk's `-transparent` in the companion host; on Linux the attribute is accepted only under a **compositing** window manager, and not at all on Wayland | `ui/orb/overlay.py::_apply_color_key`, `_build_renderer`, `jarvis/ui/jarvisbar/host.py::_build_surface` | Windows/macOS: full parity, including drag-to-any-monitor and the live mascot↔voice-orb switch. Linux with a compositor (GNOME/KDE/picom): works. Linux without one, and Wayland: the window would be an opaque magenta square, so it is NOT shown — the surface logs one actionable English line and stays hidden; voice, tray and the app window are unaffected. Note the Jarvis Bar degrades DIFFERENTLY on such a session (it keeps drawing and shows its key colour — pre-existing, the `transparentcolor unsupported` branch in `jarvis/ui/jarvisbar/overlay.py::JarvisBarOverlay.start`), so "None (hidden)" is the honest display style on a non-compositing Linux desktop until the bar adopts the same gate |
| P-21 | Low | Coding-CLI panes | OpenCode panes ship single-login for the same class of reason: the only variable that moves its credentials and session database is `XDG_DATA_HOME`, which is a SHARED variable rather than a dedicated override — redirecting it per pane would also redirect any other XDG-aware tool the agent spawns inside that pane | `jarvis/workspace/agents.py` (the `opencode` entry) | All OSes: one OpenCode login. Verified on Windows that `XDG_DATA_HOME` does move `auth.json` and the session database; the blast radius on macOS and Linux has not been measured, which is why it is not wired up |
| P-38 | Low | Coding-CLI panes | Antigravity (`agy`) panes ship single-login. `GEMINI_HOME` would move the login, but it is a shared variable (the Gemini CLI, mission workers and the pane would all follow it), and `agy` has no `login` subcommand to point at an account directory — sign-in lives on the API-Keys page. The installer is OS-split (`install.ps1` on Windows, `install.sh` elsewhere); the binary also lands in `%LOCALAPPDATA%\agy\bin` on Windows, which `path_augment` already probes | `jarvis/workspace/agents.py` (the `antigravity` entry), `jarvis/google_cli/auth_service.py`, `jarvis/core/path_augment.py` | All OSes: one Google login, and the account switcher does not offer the CLI. Unblocked by a dedicated override that does not also redirect the Gemini CLI |
+| P-39 | Low | Coding-CLI panes | Cursor CLI panes ship single-login. Sign-in is `agent login` (browser) or `CURSOR_API_KEY`; the on-disk layout of that store has not been verified against a live install, so a seat switcher would report switches that did not happen. The installer is OS-split (`https://cursor.com/install?win32=true` on native Windows, `https://cursor.com/install` on macOS/Linux/WSL); the binary lands in `~/.local/bin` as `agent`, with `cursor-agent` as the unambiguous Windows alias | `jarvis/workspace/agents.py` (the `cursor` entry) | All OSes: one Cursor login, and the account switcher does not offer the CLI. Unblocked by verifying the login store and a dedicated override |
| P-22 | Low | Coding-CLI panes | Kimi Code uses the bundled Git Bash as its shell environment on Windows, so without Git for Windows installed the binary answers `--version` correctly and the agent then cannot run a single shell command | Kimi vendor docs; `jarvis/workspace/agents.py` (the `kimi` entry) | Windows without Git for Windows: the pane opens, the CLI reports a healthy version, and shell commands fail inside it. macOS/Linux unaffected. `KIMI_SHELL_PATH` points at a non-standard `bash.exe`. An install check that only runs `--version` cannot see this |
| P-23 | Info | Coding-CLI panes | Kimi Code's alternate screen cannot be disabled (an open upstream request notes it is the outlier versus Claude Code, Codex and the Gemini CLI), so it may conflict with the pane's own scrollback the way a Claude Code pane once did | Upstream issue; `jarvis/agentic_ide/screen.py` | All OSes equally — not an OS gap, recorded here because it is the same class of pane defect and is expected to need the same kind of fix |
| P-27 | Low | Mouse-button shortcuts | A shortcut may now be a MOUSE BUTTON (middle, and the two side buttons — `mouse_middle` / `mouse_x1` / `mouse_x2`). All three OSes are implemented in the same change and share one token vocabulary, but the delivery is not uniform: Windows needs nothing extra (the backend polls `GetAsyncKeyState`, which reports mouse buttons); macOS needs pyobjc `Quartz` plus the Accessibility + Input Monitoring grants the hotkey tap already requires; Linux/X11 needs `pynput`, which is the opt-in `[desktop-linux]` extra for the reason recorded in P-24 (`evdev` is source-only). Wayland cannot do it at all — no global button grab exists, the same design reason keyboard shortcuts degrade there. The left and right buttons are deliberately not bindable on any OS: their meaning follows the system "swap mouse buttons" setting, so a shortcut recorded as "left" would fire on the physical right button for a left-handed user | `jarvis/trigger/hotkey.py::mouse_hotkeys_available`, `backends/global_hotkeys.py::_MOUSE_TOKEN_TO_VK`, `backends/pynput.py::_start_mouse_listener`, `backends/quartz.py::_MOUSE_BUTTON_TO_TOKEN` | Every host answers the capability question BEFORE offering the control: `mouse_hotkeys_available()` returns an English sentence naming what is missing and what still works, and a backend that cannot start its mouse hook logs the same thing and keeps the KEYBOARD shortcuts alive rather than failing the whole binding. macOS/Linux desktop with the extras: full parity with Windows. Wayland and headless: key combinations only |
diff --git a/jarvis/agent_chat/catalog.py b/jarvis/agent_chat/catalog.py
index 506cd54a38..7f281a350d 100644
--- a/jarvis/agent_chat/catalog.py
+++ b/jarvis/agent_chat/catalog.py
@@ -1,9 +1,9 @@
"""The provider rows the agent-chat composer can pick from.
Two kinds of row. The **coding CLIs** are the Agentic IDE's own registry
-(``jarvis.workspace.agents`` — Claude Code, Codex, OpenCode, Kimi Code, GLM
-Coding Plan, Grok Build, Antigravity, DeepSeek Harness), one row per entry
-that :mod:`jarvis.agent_chat.runner_cli` drives without a terminal. Each row
+(``jarvis.workspace.agents`` — Claude Code, Codex, Cursor CLI, OpenCode, Kimi
+Code, GLM Coding Plan, Grok Build, Antigravity, DeepSeek Harness), one row
+per entry that :mod:`jarvis.agent_chat.runner_cli` drives without a terminal. Each row
names its registry key in ``agent``, and :func:`rows_for` drops a row whose
entry the IDE no longer has, so the chat's picker and the IDE's pane picker
offer the same CLIs (maintainer, 2026-08-27: the CLIs connected in the
@@ -21,7 +21,7 @@ Two kinds of runner sit behind the rows:
(:mod:`jarvis.agent_chat.runner_api`). Model lists come live from the
provider catalog (``GET /api/providers/{id}/models``).
-``claude-cli`` … ``dsh-cli`` — one runner per coding CLI (``runner_cli._PLANNERS``)
+``claude-cli`` … ``cursor-cli`` — one runner per coding CLI (``runner_cli._PLANNERS``)
A vendor CLI driven non-interactively (:mod:`jarvis.agent_chat.runner_cli`).
The CLI brings its own tools and permissions; the model list is the
CLI's own — read live where the CLI publishes one (``agy models``,
@@ -71,6 +71,7 @@ Runner = Literal[
"kimi-cli",
"glm-cli",
"dsh-cli",
+ "cursor-cli",
]
@@ -212,6 +213,19 @@ PROVIDER_ROWS: Final[tuple[ProviderRow, ...]] = (
native_resume=True,
agent="codex",
),
+ ProviderRow(
+ id="cursor",
+ label="Cursor CLI",
+ family="cursor",
+ runner="cursor-cli",
+ models_source="curated",
+ # Model ids are Cursor's own (Auto, Composer, the vendor models the
+ # account can reach) and the CLI publishes no list this app could
+ # offer — the pick is whatever ``/model`` accepts.
+ default_model="",
+ native_resume=True,
+ agent="cursor",
+ ),
ProviderRow(
id="opencode",
label="OpenCode",
diff --git a/jarvis/agent_chat/effort.py b/jarvis/agent_chat/effort.py
index 5cfa28b4ca..e2873f7c7e 100644
--- a/jarvis/agent_chat/effort.py
+++ b/jarvis/agent_chat/effort.py
@@ -73,6 +73,7 @@ _LADDERS: Final[dict[str, tuple[tuple[str, ...], str]]] = {
"kimi": (("",), ""),
"glm": (("",), ""),
"deepseek-harness": (("",), ""),
+ "cursor": (("",), ""),
"nvidia": (("", "none", "low", "medium", "high"), ""),
"ollama": (("", "none", "low", "medium", "high", "max"), ""),
"local-openai": (("", "none", "low", "medium", "high"), ""),
diff --git a/jarvis/agent_chat/permissions.py b/jarvis/agent_chat/permissions.py
index 7e5ca44534..36f212286c 100644
--- a/jarvis/agent_chat/permissions.py
+++ b/jarvis/agent_chat/permissions.py
@@ -211,6 +211,25 @@ _DSH: Final[tuple[PermissionMode, ...]] = (
),
)
+_CURSOR: Final[tuple[PermissionMode, ...]] = (
+ PermissionMode(
+ "ask",
+ "Ask",
+ "Read-only exploration — Cursor CLI's Ask mode; nothing is changed.",
+ ),
+ PermissionMode(
+ "plan",
+ "Plan",
+ "Design the approach before coding — Cursor CLI's Plan mode.",
+ ),
+ PermissionMode(
+ "auto",
+ "Agent",
+ "Full access to tools for coding tasks. In the chat, print mode "
+ "applies edits without asking (``--force``).",
+ ),
+)
+
_API: Final[tuple[PermissionMode, ...]] = (
PermissionMode(
"ask",
@@ -276,6 +295,7 @@ _LADDERS: Final[dict[str, tuple[tuple[PermissionMode, ...], str]]] = {
# Code's own words.
"glm-cli": (_CLAUDE, "acceptEdits"),
"dsh-cli": (_DSH, "auto"),
+ "cursor-cli": (_CURSOR, "auto"),
"api": (_API, "ask"),
JARVIS_LADDER: (_JARVIS, "ask"),
}
diff --git a/jarvis/agent_chat/runner_cli.py b/jarvis/agent_chat/runner_cli.py
index 7748f67167..3d21b133c6 100644
--- a/jarvis/agent_chat/runner_cli.py
+++ b/jarvis/agent_chat/runner_cli.py
@@ -3,7 +3,7 @@
Every coding CLI the Agentic IDE registers (``jarvis.workspace.agents``)
has a planner here, so the chat's picker offers the same CLIs a pane does
(maintainer, 2026-08-27: the CLIs connected in the Agentic IDE, and each
-one drawn as a chat, never as a terminal). Eight entries, six wire shapes:
+one drawn as a chat, never as a terminal). Nine entries, seven wire shapes:
* **Claude-shaped NDJSON** — ``claude`` (Claude Code), ``grok`` (Grok
Build, whose ``--output-format streaming-messages-json`` is the Anthropic
@@ -29,10 +29,13 @@ one drawn as a chat, never as a terminal). Eight entries, six wire shapes:
(verified against kimi-code 0.29.2).
* **Plain text** — ``dsh --profile headless`` (DeepSeek Harness) prints the
final message and exits: no tool stream, no session, one answer.
+* **Cursor stream-json** — ``agent -p --output-format stream-json`` with
+ ``system`` / ``assistant`` / ``tool_call`` / ``result`` lines (Cursor's
+ documented print-mode wire; session id on every line).
Every CLI that keeps a conversation resumes it natively (``claude --resume``,
``codex exec resume``, ``grok -r``, ``agy --conversation``, ``opencode run
---session``, ``kimi --session``), so the session row keeps the vendor's id
+--session``, ``kimi --session``, ``agent --resume``), so the session row keeps the vendor's id
in ``vendor_session`` and a later turn continues the same conversation — the
tools, skills, MCP servers and permissions are the CLI's own, exactly as in
a terminal. The person's permission mode maps onto the closest stance each
@@ -96,6 +99,16 @@ CLI_BINARIES: Final[dict[str, tuple[str, ...]]] = {
# (``jarvis.workspace.agents``), so its seat stands on Claude Code's.
"glm-cli": ("claude", "claude.cmd", "claude.exe"),
"dsh-cli": ("dsh", "dsh.cmd", "dsh.exe"),
+ # Documented command is ``agent``; the Windows installer also drops
+ # ``cursor-agent`` so the generic name does not collide with another
+ # product. Prefer the unambiguous name when both are present.
+ "cursor-cli": (
+ "cursor-agent",
+ "cursor-agent.exe",
+ "agent",
+ "agent.exe",
+ "agent.cmd",
+ ),
}
@@ -188,6 +201,13 @@ def dsh_argv_prefix() -> list[str]:
return [binary]
+def cursor_argv_prefix() -> list[str]:
+ binary = _which(*CLI_BINARIES["cursor-cli"])
+ if not binary:
+ raise CliUnavailable("Cursor CLI (agent) is not installed or not on PATH.")
+ return [binary]
+
+
def _account_env(platform: str) -> dict[str, str]:
"""The child environment for the active subscription seat of ``platform``."""
try:
@@ -257,7 +277,7 @@ class CliPlan:
argv: list[str]
env: dict[str, str]
stdin_text: str | None
- shape: str # a key of ``_SHAPES``: claude | codex | agy | opencode | kimi | text
+ shape: str # a key of ``_SHAPES``: claude | codex | agy | opencode | kimi | text | cursor
#: Vendor session id we chose up front (claude/grok --session-id), or None
#: when the CLI assigns one (agy, codex) and we read it from the stream.
vendor_session: str | None
@@ -941,6 +961,47 @@ def plan_dsh(
return CliPlan(argv, env, None, "text", None)
+def plan_cursor(
+ *,
+ prompt: str,
+ cwd: Path,
+ model: str,
+ effort: str,
+ permission_mode: str,
+ resume: str | None,
+ identity: jarvis_harness.Identity | None = None,
+) -> CliPlan:
+ """Cursor CLI print mode: one prompt in, stream-json events out.
+
+ ``-p`` / ``--print`` is the non-interactive path (scripts, CI, this chat).
+ ``--force`` is what actually applies edits — without it print mode only
+ proposes. Ask and Plan are ``--mode`` flags and do not take ``--force``,
+ because those stances are supposed to leave the tree alone.
+ """
+ del cwd, effort # cwd is the spawn cwd; Cursor has no effort flag.
+ mode = normalize_permission("cursor-cli", permission_mode)
+ prompt = _with_identity(prompt, identity, resume, compact=True)
+ argv = [
+ *cursor_argv_prefix(),
+ "-p",
+ "--output-format",
+ "stream-json",
+ ]
+ if model:
+ argv += ["--model", model]
+ if mode == "plan":
+ argv += ["--mode", "plan"]
+ elif mode == "ask":
+ argv += ["--mode", "ask"]
+ else:
+ argv += ["--force"]
+ if resume:
+ argv += ["--resume", resume]
+ argv.append(prompt)
+ env = _registry_env("cursor", _account_env("cursor"))
+ return CliPlan(argv, env, None, "cursor", resume)
+
+
def _with_identity(
prompt: str,
identity: jarvis_harness.Identity | None,
@@ -970,6 +1031,7 @@ _PLANNERS: Final[dict[str, Any]] = {
"kimi-cli": plan_kimi,
"glm-cli": plan_glm,
"dsh-cli": plan_dsh,
+ "cursor-cli": plan_cursor,
}
#: Every runner this module drives — the catalog route's "is this a CLI
@@ -1908,6 +1970,196 @@ def translate_kimi_line(obj: dict[str, Any], st: _KimiState) -> list[dict[str, A
return out
+# ---------------------------------------------------------- cursor translation
+
+
+@dataclass(slots=True)
+class _CursorState:
+ """Cursor CLI ``--output-format stream-json`` print-mode stream."""
+
+ turn_id: str
+ vendor_session: str | None = None
+ status: str = "done"
+ error: str | None = None
+ usage: dict[str, int] = field(default_factory=dict)
+ emitted_text: bool = False
+ result_text: str = ""
+ tool_calls: set[str] = field(default_factory=set)
+ started_at: dict[str, float] = field(default_factory=dict)
+
+
+def _cursor_message_text(message: Any) -> str:
+ if not isinstance(message, dict):
+ return ""
+ content = message.get("content")
+ if isinstance(content, str):
+ return content
+ if not isinstance(content, list):
+ return ""
+ parts: list[str] = []
+ for block in content:
+ if isinstance(block, dict) and str(block.get("type") or "") == "text":
+ text = str(block.get("text") or "")
+ if text:
+ parts.append(text)
+ return "".join(parts)
+
+
+def _cursor_tool_payload(tool_call: Any) -> tuple[str, dict[str, Any], Any]:
+ """Name, args, and the inner payload of one Cursor ``tool_call`` object."""
+ if not isinstance(tool_call, dict):
+ return "tool", {}, {}
+ for key, payload in tool_call.items():
+ if not isinstance(payload, dict):
+ continue
+ if key.endswith("ToolCall"):
+ name = key[: -len("ToolCall")] or "tool"
+ args = payload.get("args") if isinstance(payload.get("args"), dict) else {}
+ return name, args, payload
+ if key == "function":
+ raw_args = payload.get("arguments")
+ args: dict[str, Any]
+ if isinstance(raw_args, dict):
+ args = raw_args
+ elif isinstance(raw_args, str):
+ try:
+ parsed = json.loads(raw_args)
+ except ValueError:
+ parsed = {"arguments": raw_args}
+ args = parsed if isinstance(parsed, dict) else {"arguments": parsed}
+ else:
+ args = {}
+ return str(payload.get("name") or "tool"), args, payload
+ return "tool", {}, {}
+
+
+def _cursor_tool_output(payload: dict[str, Any]) -> tuple[str, bool]:
+ result = payload.get("result")
+ if not isinstance(result, dict):
+ return "", False
+ if "success" in result:
+ success = result.get("success")
+ if isinstance(success, dict):
+ for key in ("content", "path"):
+ val = success.get(key)
+ if isinstance(val, str) and val.strip():
+ return val, False
+ return json.dumps(success, ensure_ascii=False)[:4000], False
+ return str(success or "done"), False
+ if "error" in result or "failure" in result:
+ err = result.get("error") or result.get("failure")
+ return str(err or "failed"), True
+ return json.dumps(result, ensure_ascii=False)[:4000], False
+
+
+def translate_cursor_line(obj: dict[str, Any], st: _CursorState) -> list[dict[str, Any]]:
+ """One Cursor print-mode stream-json object -> agent-chat events.
+
+ Shape (Cursor docs, ``--output-format stream-json``): ``system`` init,
+ ``assistant`` messages (complete between tool calls), ``tool_call``
+ started/completed, terminal ``result``. Session id rides on every line.
+ """
+ out: list[dict[str, Any]] = []
+ kind = str(obj.get("type") or "")
+ sid = obj.get("session_id")
+ if sid and not st.vendor_session:
+ st.vendor_session = str(sid)
+
+ if kind in {"system", "user"}:
+ return out
+
+ if kind == "assistant":
+ # Partial-output duplicates: a pre-tool flush carries ``model_call_id``
+ # and a final flush has no ``timestamp_ms``. Complete messages (the
+ # default without ``--stream-partial-output``) have neither extra
+ # field and are the ones we keep.
+ if "model_call_id" in obj:
+ return out
+ if "timestamp_ms" in obj:
+ return out
+ text = _cursor_message_text(obj.get("message"))
+ if not text.strip():
+ return out
+ st.emitted_text = True
+ st.result_text = text
+ st.status, st.error = "done", None
+ mid = str(sid or uuid.uuid4().hex)
+ out.append(
+ make_event(
+ "assistant_text",
+ {"turn_id": st.turn_id, "message_id": mid, "text": text},
+ )
+ )
+ return out
+
+ if kind == "tool_call":
+ call_id = str(obj.get("call_id") or uuid.uuid4().hex)
+ name, args, payload = _cursor_tool_payload(obj.get("tool_call"))
+ subtype = str(obj.get("subtype") or "")
+ if subtype == "started" or (subtype != "completed" and call_id not in st.tool_calls):
+ if call_id not in st.tool_calls:
+ st.tool_calls.add(call_id)
+ st.started_at[call_id] = time.perf_counter()
+ out.append(
+ make_event(
+ "tool_call",
+ {
+ "turn_id": st.turn_id,
+ "call_id": call_id,
+ "name": name,
+ "input": args,
+ "summary": _cli_tool_summary(name, args)
+ or str(args.get("path") or "")[:200],
+ },
+ )
+ )
+ if subtype == "completed":
+ output, is_error = _cursor_tool_output(payload if isinstance(payload, dict) else {})
+ started = st.started_at.get(call_id)
+ duration_ms = int((time.perf_counter() - started) * 1000) if started else None
+ out.append(
+ make_event(
+ "tool_result",
+ {
+ "turn_id": st.turn_id,
+ "call_id": call_id,
+ "output": output or ("failed" if is_error else "done"),
+ "is_error": is_error,
+ "duration_ms": duration_ms,
+ },
+ )
+ )
+ return out
+
+ if kind == "result":
+ if sid:
+ st.vendor_session = str(sid)
+ is_error = bool(obj.get("is_error")) or str(obj.get("subtype") or "") != "success"
+ result = str(obj.get("result") or "")
+ if result.strip():
+ st.result_text = result
+ if not st.emitted_text:
+ st.emitted_text = True
+ out.append(
+ make_event(
+ "assistant_text",
+ {
+ "turn_id": st.turn_id,
+ "message_id": str(sid or uuid.uuid4().hex),
+ "text": result,
+ },
+ )
+ )
+ if is_error:
+ st.status = "error"
+ st.error = result or "Cursor CLI reported an error"
+ else:
+ st.status, st.error = "done", None
+ return out
+
+ return out
+
+
# ---------------------------------------------------------- plain-text shape
@@ -1940,6 +2192,10 @@ _SHAPES: Final[dict[str, tuple[Callable[[str, str | None], Any], Callable[..., A
translate_opencode_line,
),
"kimi": (lambda tid, vs: _KimiState(turn_id=tid, vendor_session=vs), translate_kimi_line),
+ "cursor": (
+ lambda tid, vs: _CursorState(turn_id=tid, vendor_session=vs),
+ translate_cursor_line,
+ ),
"text": (lambda tid, vs: _TextState(turn_id=tid, vendor_session=vs), _translate_nothing),
}
diff --git a/jarvis/agent_chat/typeahead.py b/jarvis/agent_chat/typeahead.py
index 96429bee98..2876f4e4af 100644
--- a/jarvis/agent_chat/typeahead.py
+++ b/jarvis/agent_chat/typeahead.py
@@ -63,6 +63,7 @@ TRIGGERS_BY_RUNNER: Final[dict[str, tuple[str, ...]]] = {
"grok-cli": (MENTION,),
"opencode-cli": (MENTION,),
"kimi-cli": (MENTION,),
+ "cursor-cli": (MENTION,),
# One task in, one answer out — nothing to complete against.
"dsh-cli": (),
"api": (MENTION,),
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index 05f582cdf1..6b60c4c9ef 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -792,6 +792,11 @@ def agent_argv(agent: str) -> tuple[str, ...] | None:
except Exception: # noqa: BLE001, S110 - PATH augmentation is best-effort
pass
exe = shutil.which(binary)
+ if exe is None:
+ for alias in spec.binary_aliases:
+ exe = shutil.which(alias)
+ if exe is not None:
+ break
if exe is None:
return None
if spec.shell_launch:
diff --git a/jarvis/costs/cli_usage_index.py b/jarvis/costs/cli_usage_index.py
index b78bc0fb9e..a06e4b4a26 100644
--- a/jarvis/costs/cli_usage_index.py
+++ b/jarvis/costs/cli_usage_index.py
@@ -198,6 +198,10 @@ HARNESSES_WITHOUT_LOCAL_TRANSCRIPT: dict[str, str] = {
"deepseek-harness": (
"dsh keeps no usage log on disk (checked ~/.dsh, ~/.deepseek, %LOCALAPPDATA%/dsh)"
),
+ "cursor": (
+ "Cursor CLI bills against the Cursor account; no local usage log is "
+ "documented (checked ~/.cursor, ~/.local/share/cursor-agent)"
+ ),
}
#: Filename of the index, relative to the data dir.
@@ -1021,7 +1025,7 @@ def _agy_row(
def _grok_row(
record: Mapping[str, Any], offset: int, cand: _Candidate, cursor: _Cursor
-) -> _Row | None:
+) -> _PricedRow | None:
params = _payload(record, "params")
update = _payload(params, "update")
if update.get("sessionUpdate") != "turn_completed":
@@ -1043,6 +1047,10 @@ def _grok_row(
session_id = str(params.get("sessionId") or cursor.session_id)
prompt_id = str(update.get("prompt_id") or "")
dedup = f"{session_id}:{prompt_id}" if session_id and prompt_id else f"{cand.key}:{offset}"
+ # xAI writes what it billed for the turn, in ticks of 1e-10 USD (verified
+ # against its list price to the cent, 2026-08-25). Grok Build runs on the
+ # user's own key, so this IS the bill, not an estimate.
+ cost_usd = _int(usage.get("costUsdTicks")) / 1e10
return (
cand.agent,
dedup,
@@ -1055,6 +1063,7 @@ def _grok_row(
cached,
cursor.cwd,
cursor.label,
+ cost_usd,
)
@@ -1119,7 +1128,7 @@ def _agy_context(path: Path) -> tuple[str, str, str]:
@dataclass(slots=True)
class _FileScan:
- rows: list[_Row]
+ rows: list[_Row | _PricedRow]
offset: int
cursor: _Cursor
bytes_read: int
@@ -1343,7 +1352,7 @@ def _scan_antigravity(cand: _Candidate, start: int) -> _FileScan:
with a space would stay at $0 forever.
"""
del start
- rows: list[_Row] = []
+ rows: list[_Row | _PricedRow] = []
session_id = cand.path.stem
cwd = ""
model = ""
@@ -1412,7 +1421,7 @@ def _scan_antigravity(cand: _Candidate, start: int) -> _FileScan:
finally:
conn.close()
return _FileScan(
- rows=list(rows), # type: ignore[arg-type]
+ rows=rows,
offset=0 if failed else cand.size,
cursor=_Cursor(
session_id=session_id,
@@ -1431,7 +1440,7 @@ def _scan_opencode(cand: _Candidate, start: int) -> _FileScan:
indexed (the "offset" column holds a timestamp for this agent), so a run
reads only what arrived since. A store that shrank (vacuum) re-reads from
zero and the message-id key keeps every turn counted once."""
- rows: list[_PricedRow] = []
+ rows: list[_Row | _PricedRow] = []
newest = start
failed = False
try:
@@ -1510,7 +1519,7 @@ def _scan(cand: _Candidate, start: int, cursor: _Cursor, deadline: float) -> _Fi
return _scan_opencode(cand, start)
if cand.agent == AGENT_AGY:
return _scan_antigravity(cand, start)
- rows: list[_Row] = []
+ rows: list[_Row | _PricedRow] = []
reader = _LineReader(None, start)
if cand.agent == AGENT_KIMI and not cursor.session_id:
cursor.session_id, cursor.cwd, cursor.label = _agy_context(cand.path)
@@ -1564,7 +1573,7 @@ def _wanted(agent: str, raw: bytes) -> bool:
def _row_for(
agent: str, record: Mapping[str, Any], offset: int, cand: _Candidate, cursor: _Cursor
-) -> _Row | None:
+) -> _Row | _PricedRow | None:
if agent == AGENT_CLAUDE:
return _claude_row(record, cand, cursor)
if agent == AGENT_CODEX:
diff --git a/jarvis/ui/web/frontend/public/agent-logos/cursor.svg b/jarvis/ui/web/frontend/public/agent-logos/cursor.svg
new file mode 100644
index 0000000000..c37b601034
--- /dev/null
+++ b/jarvis/ui/web/frontend/public/agent-logos/cursor.svg
@@ -0,0 +1 @@
+<svg fill="#F4F4F5" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Cursor</title><path d="M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23"/></svg>
\ No newline at end of file
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentMark.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentMark.test.tsx
index e5bcc7026f..e5128eee4f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentMark.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentMark.test.tsx
@@ -50,6 +50,14 @@ describe("AgentMark", () => {
"/provider-logos/antigravity.svg",
);
expect(mark("antigravity").querySelector("img")).toBeNull();
+
+ const cursor = render(<AgentMark agent="cursor" label="Cursor CLI" />);
+ expect(mark("cursor").getAttribute("data-ground")).toBe("ink");
+ expect(mark("cursor").getAttribute("data-logo")).toBe(
+ "/agent-logos/cursor.svg",
+ );
+ expect(mark("cursor").querySelector("img")).toBeNull();
+ cursor.unmount();
});
it("knows the harness whose own interface is not the terminal", () => {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx
index ff21b89da9..ea9e38c054 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentMark.tsx
@@ -36,6 +36,7 @@ const AGENT_LOGOS: Record<string, LogoAsset> = {
antigravity: { url: "/provider-logos/antigravity.svg", ground: "ink" },
claude: { url: "/provider-logos/claude.svg", ground: "ink" },
codex: { url: "/provider-logos/openai.svg", ground: "ink" },
+ cursor: { url: "/agent-logos/cursor.svg", ground: "ink" },
"deepseek-harness": { url: "/agent-logos/deepseek.svg", ground: "ink" },
glm: { url: "/agent-logos/zai.svg", ground: "any" },
"grok-build": { url: "/provider-logos/grok.svg", ground: "ink" },
diff --git a/jarvis/ui/web/frontend/src/lib/agentChatApi.ts b/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
index 7b14253a0c..8a6a52550b 100644
--- a/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
@@ -29,7 +29,8 @@ export interface AgentChatProvider {
/**
* Which runner answers on this machine: "api" / "brain", or a vendor CLI —
* "claude-cli" | "codex-cli" | "agy-cli" | "grok-cli" | "opencode-cli" |
- * "kimi-cli" | "glm-cli" | "dsh-cli" (jarvis/agent_chat/runner_cli.py).
+ * "kimi-cli" | "glm-cli" | "dsh-cli" | "cursor-cli"
+ * (jarvis/agent_chat/runner_cli.py).
*/
runner: string;
models_source: "live" | "curated";
diff --git a/jarvis/workspace/agents.py b/jarvis/workspace/agents.py
index 8c52f253c2..f007e6ba29 100644
--- a/jarvis/workspace/agents.py
+++ b/jarvis/workspace/agents.py
@@ -210,6 +210,10 @@ class WorkspaceAgent:
#: ``shutil.which`` can find, and feeding it one used to fail as "not
#: installed" rather than as the configuration error it is.
binary: str = ""
+ #: Other PATH names this CLI answers to, tried after ``binary`` when that
+ #: one is missing. Cursor's installer also drops ``cursor-agent`` so the
+ #: generic ``agent`` does not collide with another product.
+ binary_aliases: tuple[str, ...] = ()
#: Arguments that always precede the per-pane ones.
launch_args: tuple[str, ...] = ()
win_shim: WinShim | None = None
@@ -481,6 +485,24 @@ def _antigravity_install() -> InstallMethods:
return InstallMethods(script_url=url, recommended="script")
+def _cursor_cli_install() -> InstallMethods:
+ """Official Cursor CLI installer for the OS that will run it.
+
+ Cursor ships two scripts, not one: the native Windows installer is
+ ``https://cursor.com/install?win32=true`` (PowerShell), and macOS, Linux
+ and WSL share ``https://cursor.com/install`` (curl | bash). The shared
+ script installer fetches whichever URL we declare and wraps it in the
+ matching runner, so picking the URL at registration is what makes the
+ command actually work.
+ """
+ url = (
+ "https://cursor.com/install?win32=true"
+ if sys.platform == "win32"
+ else "https://cursor.com/install"
+ )
+ return InstallMethods(script_url=url, recommended="script")
+
+
#: Kimi ships under two generations that both install a binary called ``kimi``.
KIMI_CURRENT = "kimi-code"
KIMI_LEGACY = "kimi-cli"
@@ -704,6 +726,18 @@ _KIMI_PICKS = LaunchPicks(
ladder="api",
)
+#: Cursor CLI takes ``--model`` and ``--mode plan|ask``; Agent mode is the
+#: default (no extra flag). Effort is the model's own, not a CLI flag.
+_CURSOR_PICKS = LaunchPicks(
+ provider="cursor",
+ model_args=("--model", picks_value),
+ permission_args=(
+ ("plan", ("--mode", "plan")),
+ ("ask", ("--mode", "ask")),
+ ),
+)
+_CURSOR_RUNTIME = RuntimePicks(model=f"/model {picks_value}")
+
_AGENTS: dict[str, WorkspaceAgent] = {
"claude": make_cli_agent(
@@ -764,6 +798,33 @@ _AGENTS: dict[str, WorkspaceAgent] = {
resume_start_limit=1,
spoken_aliases=("codex", "kodex", "codecs", "codeks"),
),
+ "cursor": make_cli_agent(
+ "cursor",
+ "Cursor CLI",
+ launch_picks=_CURSOR_PICKS,
+ runtime_picks=_CURSOR_RUNTIME,
+ binary="agent",
+ homepage="https://cursor.com/docs/cli/overview",
+ description="Cursor's terminal coding agent — the same models as the editor.",
+ install=_cursor_cli_install(),
+ # The documented command is ``agent``; the Windows installer also
+ # drops ``cursor-agent`` so the generic name does not collide with
+ # another product on PATH.
+ binary_aliases=("cursor-agent",),
+ # No trust dialog is documented. Sign-in is ``agent login`` (or
+ # ``CURSOR_API_KEY``) inside the pane on first use.
+ needs_trust=False,
+ extra_path_dirs=("~/.local/bin",),
+ file_reference="at",
+ instruction_filename="AGENTS.md",
+ input_markers=("→",),
+ version_regex=_LOOSE_SEMVER_RE,
+ # DELIBERATELY no AccountSpec. Cursor stores the login itself after
+ # ``agent login``; the layout of that store has not been verified
+ # against a live install, so a seat switcher here would report
+ # switches that did not happen. Tracked in docs/os-parity.md.
+ spoken_aliases=("cursor", "cursor cli", "cursor-cli", "cursor agent"),
+ ),
"opencode": make_cli_agent(
"opencode",
"OpenCode",
@@ -1529,11 +1590,18 @@ def _agent_info(
kind=agent.kind,
description=agent.description,
)
+ installed = bool(status and status.installed)
+ # The documented binary may be missing while an alias the installer also
+ # drops is on PATH (Cursor's ``cursor-agent`` next to ``agent``). A probe
+ # that only asked the documented name would list the entry as missing
+ # while a pane of it would start.
+ if not installed and agent.binary_aliases:
+ installed = any(_on_path(name) for name in agent.binary_aliases)
return AgentInfo(
name=agent.name,
display_name=agent.display_name,
- installed=bool(status and status.installed),
- version=status.version if status else None,
+ installed=installed,
+ version=status.version if status and status.installed else None,
install_command=install_command(agent.name),
launch_command=agent.launch_command or "",
kind=agent.kind,
diff --git a/tests/unit/agent_chat/test_ide_cli_seats.py b/tests/unit/agent_chat/test_ide_cli_seats.py
index b621478b60..31630fb88b 100644
--- a/tests/unit/agent_chat/test_ide_cli_seats.py
+++ b/tests/unit/agent_chat/test_ide_cli_seats.py
@@ -86,7 +86,8 @@ def test_resolve_runner_names_each_clis_own_runner() -> None:
assert resolve_runner("kimi") == "kimi-cli"
assert resolve_runner("glm") == "glm-cli"
assert resolve_runner("deepseek-harness") == "dsh-cli"
- for pid in ("opencode", "kimi", "glm", "deepseek-harness"):
+ assert resolve_runner("cursor") == "cursor-cli"
+ for pid in ("opencode", "kimi", "glm", "deepseek-harness", "cursor"):
assert resolve_runner(pid, surface="jarvis") == "unknown"
@@ -121,6 +122,9 @@ def test_every_cli_runner_has_a_permission_ladder_and_a_typeahead_answer() -> No
("kimi-cli", "plan", "plan"),
("dsh-cli", "plan", "auto"),
("glm-cli", "bypass", "bypassPermissions"),
+ ("cursor-cli", "plan", "plan"),
+ ("cursor-cli", "bypassPermissions", "auto"),
+ ("cursor-cli", "acceptEdits", "ask"),
],
)
def test_a_mode_from_another_ladder_folds_onto_the_new_clis(
@@ -130,7 +134,7 @@ def test_a_mode_from_another_ladder_folds_onto_the_new_clis(
def test_the_new_clis_offer_no_effort_knob() -> None:
- for provider in ("opencode", "kimi", "glm", "deepseek-harness"):
+ for provider in ("opencode", "kimi", "glm", "deepseek-harness", "cursor"):
assert effort.effort_levels(provider) == ("",)
assert effort.default_effort(provider) == ""
assert effort.normalize_effort(provider, "high") == ""
@@ -374,6 +378,41 @@ def test_plan_kimi_prints_json_and_finds_its_session_afterwards(stubbed: None) -
assert plan.discover is None and plan.vendor_session == "session_1"
+def test_plan_cursor_prints_stream_json_and_maps_the_stances(
+ stubbed: None, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr(rc, "cursor_argv_prefix", lambda: ["agent"])
+ plan = rc.plan_cursor(
+ prompt="fix it",
+ cwd=Path("."),
+ model="composer-2",
+ effort="high",
+ permission_mode="auto",
+ resume=None,
+ )
+ assert plan.argv[:4] == ["agent", "-p", "--output-format", "stream-json"]
+ assert "--force" in plan.argv
+ assert "--mode" not in plan.argv
+ assert plan.argv[plan.argv.index("--model") + 1] == "composer-2"
+ assert plan.argv[-1] == "fix it"
+ assert plan.shape == "cursor" and plan.env["AGENT"] == "cursor"
+ assert plan.vendor_session is None
+
+ plan = rc.plan_cursor(
+ prompt="p", cwd=Path("."), model="", effort="", permission_mode="plan", resume="chat-9"
+ )
+ assert plan.argv[plan.argv.index("--mode") + 1] == "plan"
+ assert "--force" not in plan.argv
+ assert plan.argv[plan.argv.index("--resume") + 1] == "chat-9"
+ assert plan.vendor_session == "chat-9"
+
+ plan = rc.plan_cursor(
+ prompt="p", cwd=Path("."), model="", effort="", permission_mode="ask", resume=None
+ )
+ assert plan.argv[plan.argv.index("--mode") + 1] == "ask"
+ assert "--force" not in plan.argv
+
+
def test_plan_dsh_is_one_task_in_plain_text(stubbed: None) -> None:
plan = rc.plan_dsh(
prompt="run the tests", cwd=Path("."), model="", effort="", permission_mode="", resume=None
@@ -575,6 +614,88 @@ def test_a_kimi_turn_discovers_its_session_once_the_cli_has_exited(
assert events[-1]["payload"]["status"] == "done"
+# Cursor print-mode stream-json, from the documented example sequence.
+_CURSOR_ASSISTANT = {
+ "type": "assistant",
+ "message": {
+ "role": "assistant",
+ "content": [{"type": "text", "text": "I'll read the README.md file"}],
+ },
+ "session_id": "c6b62c6f-7ead-4fd6-9922-e952131177ff",
+}
+_CURSOR_TOOL_START = {
+ "type": "tool_call",
+ "subtype": "started",
+ "call_id": "toolu_1",
+ "tool_call": {"readToolCall": {"args": {"path": "README.md"}}},
+ "session_id": "c6b62c6f-7ead-4fd6-9922-e952131177ff",
+}
+_CURSOR_TOOL_DONE = {
+ "type": "tool_call",
+ "subtype": "completed",
+ "call_id": "toolu_1",
+ "tool_call": {
+ "readToolCall": {
+ "args": {"path": "README.md"},
+ "result": {"success": {"content": "# Project\n", "totalLines": 54}},
+ }
+ },
+ "session_id": "c6b62c6f-7ead-4fd6-9922-e952131177ff",
+}
+_CURSOR_RESULT = {
+ "type": "result",
+ "subtype": "success",
+ "is_error": False,
+ "duration_ms": 1234,
+ "result": "I'll read the README.md fileDone!",
+ "session_id": "c6b62c6f-7ead-4fd6-9922-e952131177ff",
+}
+
+
+def test_cursor_lines_become_text_and_tool_rows() -> None:
+ st = rc._CursorState(turn_id="t")
+ events = rc.translate_cursor_line(_CURSOR_ASSISTANT, st)
+ assert _kinds(events) == ["assistant_text"]
+ assert events[0]["payload"]["text"] == "I'll read the README.md file"
+ assert st.vendor_session == "c6b62c6f-7ead-4fd6-9922-e952131177ff"
+
+ events = rc.translate_cursor_line(_CURSOR_TOOL_START, st)
+ assert _kinds(events) == ["tool_call"]
+ assert events[0]["payload"]["name"] == "read"
+ assert events[0]["payload"]["summary"] == "README.md"
+
+ events = rc.translate_cursor_line(_CURSOR_TOOL_DONE, st)
+ assert _kinds(events) == ["tool_result"]
+ assert "# Project" in events[0]["payload"]["output"]
+ assert not events[0]["payload"]["is_error"]
+
+ # The result's concatenated text is not a second assistant row — the
+ # earlier message already is the answer.
+ assert rc.translate_cursor_line(_CURSOR_RESULT, st) == []
+ assert st.status == "done" and st.emitted_text
+
+
+def test_a_cursor_turn_runs_through_the_shared_pump(
+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path
+) -> None:
+ plan = rc.CliPlan(
+ _fake_cli([_CURSOR_ASSISTANT, _CURSOR_TOOL_START, _CURSOR_TOOL_DONE, _CURSOR_RESULT]),
+ dict(os.environ),
+ None,
+ "cursor",
+ None,
+ )
+ vendor, events = _turn(monkeypatch, tmp_path, "cursor-cli", plan, "cursor")
+ assert vendor == "c6b62c6f-7ead-4fd6-9922-e952131177ff"
+ assert _kinds(events) == [
+ "assistant_text",
+ "tool_call",
+ "tool_result",
+ "turn_finished",
+ ]
+ assert events[-1]["payload"]["status"] == "done"
+
+
def test_a_cli_that_dies_silently_reports_its_exit_code(
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
diff --git a/tests/unit/workspace/test_agents.py b/tests/unit/workspace/test_agents.py
index 38c881057b..7eecfc29ee 100644
--- a/tests/unit/workspace/test_agents.py
+++ b/tests/unit/workspace/test_agents.py
@@ -36,7 +36,17 @@ from jarvis.workspace.agents import (
# registry is for. What must not break is that a shipped provider silently
# disappears.
REQUIRED_CODING_AGENTS = frozenset(
- {"claude", "codex", "opencode", "kimi", "glm", "grok-build", "antigravity"}
+ {
+ "claude",
+ "codex",
+ "cursor",
+ "opencode",
+ "kimi",
+ "glm",
+ "grok-build",
+ "antigravity",
+ "deepseek-harness",
+ }
)
@@ -119,6 +129,13 @@ def test_install_commands_are_runnable_or_honestly_absent() -> None:
assert "install.ps1" in agy_install
else:
assert "install.sh" in agy_install
+ cursor_install = install_command("cursor")
+ assert cursor_install is not None
+ if sys.platform == "win32":
+ assert "cursor.com/install?win32=true" in cursor_install
+ else:
+ assert "cursor.com/install" in cursor_install
+ assert "win32" not in cursor_install
assert install_command("nope") is None
@@ -146,6 +163,16 @@ def test_launch_command_is_bare_binary() -> None:
assert agy.file_reference == "at"
assert agy.account is None
assert agy.trust is not None and agy.trust.scalar is True
+ cursor = get_agent("cursor")
+ assert cursor is not None
+ assert cursor.display_name == "Cursor CLI"
+ assert cursor.executable == "agent"
+ assert cursor.launch_command == "agent"
+ assert cursor.binary_aliases == ("cursor-agent",)
+ assert cursor.file_reference == "at"
+ assert cursor.needs_trust is False
+ assert cursor.account is None
+ assert cursor.input_markers == ("→",)
def test_build_agent_argv_wraps_command_in_a_shell() -> None: