Skip to content

feat(harness): Add Cursor CLI as a verified launch row - #762

Merged
omesser merged 4 commits into
mainfrom
feat/636-cursor-agent-harness
Sep 16, 2026
Merged

omesser merged 4 commits into
mainfrom
feat/636-cursor-agent-harness

Conversation

@omesser

@omesser omesser commented Sep 16, 2026 •

Copy link
Copy Markdown
Owner

Why

Cursor CLI speaks ACP on its own, so cursor-agent acp already reaches ai-buddy through the catch-all row. What the catch-all cannot do is answer the one question a user asks at the moment of the pick: how do I sign in. Unnamed, ai-buddy falls back to whatever the handshake calls its auth method, and Cursor's is a sentence:

attach
  harness not authenticated: run `Authenticate using existing Cursor login credentials. Run 'agent login' first if not logged in.`

That is not a command, and the binary it names is not the one on PATH. The installer puts cursor-agent there, while the CLI calls itself agent in its own help. A user who runs that line verbatim gets a command not found.

What changed

cursor-agent is a named launch row (cursor-agent acp) with cursor-agent login as its documented sign-in line, and a smoked fresh-session turn. Everything else follows the registration points the repo already has for a named Harness, which tests/connect-buttons.test.js and every_named_harness_documents_a_login_for_the_users_own_terminal pin.

  • src-tauri/src/harness.rs — the launch arm and the named_login arm, plus both test loops over named rows.
  • src-tauri/src/settings/form.rs — HARNESS_PRESETS, which is the one list Settings draws from.
  • src-tauri/src/main.rs — select_harness now validates against form::HARNESS_PRESETS instead of a second hand-kept copy of the same seven names.
  • src-tauri/src/settings.rs — a byo_registration arm. Cursor has no mcp add; cursor-agent mcp offers login, list, list-tools, enable and disable only, so the snippet is a ~/.cursor/mcp.json fragment in Pi's shape. mcp enable is not optional: a new entry sits at not loaded (needs approval) until it runs.
  • src/chat.html, src/chat-ui.css, src/chat.js — the Connect button, its accent, and the display name. Simple Icons gives Cursor #000000, which is the Chat ground rather than an accent, so it is lifted the way --hermes-accent already is.
  • README.md, docs/DEVELOPMENT.md, and the two Settings fixtures.

d1897e5c records the smoked turn. The README Standing cell now says fresh sessions work. The session table Fresh-session column is yes. The unsmoked-row lede is gone, because no named row is unsmoked.

No new field, trait or config layer. The registry took Cursor as it stands.

How to verify

cursor-agent 2026.01.23-916f423, installed at ~/.local/bin/cursor-agent, signed in on this machine.

Before the named row (AI_BUDDY_HARNESS="cursor-agent acp" scripts/probe-harness.sh), exit code 2:

attach
  harness not authenticated: run `Authenticate using existing Cursor login credentials. Run 'agent login' first if not logged in.`

After the named row, still unsigned-in, exit code 2:

attach
  harness not authenticated: run `cursor-agent login`

After sign-in (AI_BUDDY_HARNESS=cursor-agent scripts/probe-harness.sh), exit code 0:

probe-harness
  harness      cursor-agent
  command      cursor-agent acp
  dir          /Users/…/Library/Application Support/ai-buddy/probe
  timeout      turn 120s, attach 120s

attach
  agent        unnamed
  loadSession  false
  mcp http     false
  mcp          …/ai-buddy --mcp-stdio
  authMethods  Cursor Login
  session      03ec2fde-50bb-476d-8bbd-85d3efc5e583

turn
  prompt       Reply with exactly this one line and nothing else: Wave | Hello from the probe.
  stop         end_turn
  reply        Wave | Hello from the probe.
  proposal     Wave | Hello from the probe.

The full transcript is on #636. No credential appears in either run.

What initialize advertised:

{"protocolVersion":1,
 "agentCapabilities":{"loadSession":false,"promptCapabilities":{"image":true}},
 "authMethods":[{"id":"cursor_login","name":"Cursor Login",
   "description":"Authenticate using existing Cursor login credentials. Run 'agent login' first if not logged in."}]}

loadSession false, so every attach opens a fresh session. Resumed session stays no. No mcpCapabilities.http, so it takes the stdio MCP server (ADR-0026). One auth method.

The MCP fragment, against the installed CLI. Written to a throwaway .cursor/mcp.json with the same URL and a dummy token:

$ cursor-agent mcp list
ai-buddy: not loaded (needs approval)
$ cursor-agent mcp enable ai-buddy
✓ Enabled and approved MCP server: ai-buddy
$ cursor-agent mcp list
ai-buddy: error: connection failed

connection failed is the last honest step available without the app bound to that port. Cursor read the entry, approved it, and dialled it.

Install path, confirmed against https://cursor.com/install: it unpacks under ~/.local/share/cursor-agent/versions/ and symlinks cursor-agent into ~/.local/bin.

Suites, all on this branch:

  • cargo test --workspace — 477 + 487 + 23 + 10 + 9 passed, 0 failed.
  • cargo clippy --workspace --all-targets -- -D warnings — clean.
  • node --test tests/*.test.js — 203 passed, 0 failed.
  • pre-commit run --files README.md — all hooks pass on the standing commit.

Notes

  • Resumed session is no because the handshake advertises no loadSession. That is observed, not a gap in the probe. ADR-0022 asks for a smoked fresh turn and a smoked resume. Cursor cannot resume, so the resume column stays no.
  • ADR-0022 says the launch table names five harnesses. It named six before this PR and seven after: pi landed without the ADR being reconciled. This PR does not rewrite a decision record to fix someone else's drift. Worth a follow-up issue that reconciles ADR-0022's count with harness::launch, or drops the count from the ADR so it stops going stale.
  • docs/design/connect.html is untouched. It is a Dated page under ADR-0011, frozen at 2026-09-08, and it does not carry the hermes or pi buttons either.
  • docs/adr/0017 is untouched: it is superseded by ADR-0022, and its table is history.

Closes #636

— Cursor agent (Grok), on @omesser's behalf.

`cursor-agent acp` answers ACP but advertises its login as prose naming a
binary that is not on PATH. A named row replaces it with `cursor-agent
login`. The turn is unsmoked: the CLI here is not signed in. #636.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review on #762: the AI source disclosure and the raw-token test each kept
their own copy of the preset list, and both had already drifted off `pi`.
The Cursor and Pi registration snippets were byte-identical; one arm now
serves both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@omesser

omesser commented Sep 16, 2026

Copy link
Copy Markdown
Owner Author

A review pass over this diff raised twelve points. bea5785 lands the ones that hold; the rest are dismissed below with the reason, not quietly dropped.

Fixed in bea5785:

  • The AI source disclosure the user actually reads still said "A Harness (claude, codex, grok, hermes, opencode, or Custom)". It is now built from HARNESS_PRESETS, which also fixes pi — missing from that sentence since it was added.
  • hermes_returns_separate_token_others_do_not looped a hand-kept ["claude", "codex", "grok", "opencode", "pi"], so nothing asserted the new row returns an empty raw token. It loops the registry now, minus hermes.
  • The Cursor and Pi snippets were byte-identical JSON. One "cursor-agent" | "pi" arm serves both; only the file path and the reload differ. Thirteen duplicated lines gone.
  • Two more "five templates" in byo_registration's docs that the seven-template bump missed.
  • The README's second table said one: Cursor Login, a display name. The evidence is the method id, and the pi row prints its id verbatim, so it now reads one: `cursor_login`.
  • The new README lede claimed an unsmoked row carries "its command line and its login command alone", which undersold the row it was written for — that row fills in loadSession, MCP transport and auth methods from a real handshake. It now says only the session columns wait on the probe.
  • The launch arm comment repeated the grok arm four lines below it. Trimmed to the half that is load-bearing, pointing at grok instead of restating it.
  • The doc comment above launch named Copilot twice, three lines apart, and my rewrap had left a line running past the block's column. Rewrapped, duplicate sentence dropped.

Dismissed, with the reason:

  • "docs/research/alternatives.md becomes false the moment this lands." It does not, by this repository's own rule. docs/agents/docs.md says a docs/research/ document is anchored — "Re-pointing its citations at today's code would make the prose describe code it never saw, so an anchored document does not track main. The number that looks stale is the record." That file declares its anchor in the Sources section, September 11 2026. Editing it to match today's tree is the thing that rule exists to prevent.

Escalated rather than decided:

  • Naming a row whose turn is unsmoked. The review reads this as a blocker on the grounds that the README keeps Copilot CLI out of a named row for exactly that reason (Name the remaining major Harnesses, one smoked turn at a time #457). That tension is real and it predates this PR: ADR-0022 separates the two — "Harnesses earn verified standing once a turn has been smoked against them" — while the README's catch-all row conflates them, saying Copilot "earns a named row once smoked".

    I have not resolved it in either direction here, because both resolutions are yours to take. Smoking the turn needs a Cursor login on this machine, and ai-buddy naming the login instead of running it is the whole of what fix(harness): Auth started by a Harness subprocess does not finish the handshake #654 settled. Amending ADR-0022 to say a verified handshake earns a name would be a decision record rewritten by an agent, and it would owe Copilot a row in the same breath.

    What this PR does instead is refuse to claim the standing: the Standing cell says the turn is not smoked, the session columns say unsmoked, and the lede says what an unsmoked row is worth. If you would rather the row wait for a login, say so and I will cut it back to the named_login arm alone — which is worth having on its own, since it reaches the catch-all path too. launch's escape hatch sets the name from argv[0], so cursor-agent acp typed as a custom command already resolves login_hint("cursor-agent"), and the broken line in the Why section above is fixed either way.

— Claude Code agent, on @omesser's behalf.

@omesser omesser added the windows Run the Windows compile job on this pull request label Sep 16, 2026
@omesser

omesser commented Sep 16, 2026

Copy link
Copy Markdown
Owner Author

The windows label is on, and the Windows leg has now actually run cargo test. It had not before.

My original read of the brief was the path list (platform.rs, platform/windows/**, secrets.rs, sensing.rs), and by that list this PR did not qualify. The path list is not the whole rule. This PR changes settings/form.rs, main.rs and both tests/fixtures/settings-snapshot-*.json, and both_ai_sources_serialize_to_the_committed_fixtures byte-compares those fixtures against form::describe_with. On Windows UNPINNED_TABS is empty, so the whole snapshot is compared there. A Windows-side difference in how it serializes would have gone unseen. That is #729's scenario.

Before (run 35041547982, the green check on bea5785):

windows: success
  Clippy the workspace for Windows = success
  Rust tests = skipped

After (run 35043157435, job 104627210813), gate and step:

run tests: True
Compiling ai-buddy v0.1.0 (D:\a\ai-buddy\ai-buddy\src-tauri)
running 485 tests
test result: ok. 484 passed; 0 failed; 1 ignored
test result: ok. 485 passed; 0 failed; 0 ignored
test result: ok. 23 passed; 0 failed; 0 ignored
test result: ok. 10 passed; 0 failed; 0 ignored
test result: ok. 9 passed; 0 failed; 0 ignored
Doc-tests ai_buddy_core / ai_buddy_mcp_server / ai_buddy_verify

Rust tests step conclusion success, zero test result: FAILED, zero compile errors. The four tests this PR's diff actually turns on, named so they are not taken on trust:

test settings::form::tests::both_ai_sources_serialize_to_the_committed_fixtures ... ok
test settings::form::tests::the_completer_source_offers_off_the_presets_and_custom ... ok
test harness::tests::every_named_harness_documents_a_login_for_the_users_own_terminal ... ok
test settings::tests::every_byo_snippet_carries_the_url_and_the_raw_token ... ok

So the regenerated fixtures serialize byte-identically on Windows, and the label should stay on this PR.

— Claude Code agent, on @omesser's behalf.

@omesser omesser changed the title feat(harness): Name Cursor CLI as a launch row feat(harness): Add Cursor CLI as a verified launch row Sep 16, 2026
@omesser

omesser commented Sep 16, 2026

Copy link
Copy Markdown
Owner Author

The earlier gap was a missing login on the probing machine, not a missing row. cursor-agent is signed in here now. AI_BUDDY_HARNESS=cursor-agent scripts/probe-harness.sh reached end_turn with exit 0 and the exact probe line as both reply and proposal.

d1897e5c records that. Fresh session is yes. Resume stays no because initialize advertises loadSession: false. The unsmoked-row lede is gone. The full transcript is on #636.

— Cursor agent (Grok), on @omesser's behalf.

Comment thread README.md Resolved
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

windows Run the Windows compile job on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add official verified support for Cursor Agent harness

1 participant