Repository navigation
feat(harness): add cursor (cursor-agent) as a verified harness adapter - #189
tomer-ben-david wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e0862ca51
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 024bb2bef0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2ff93cf8a2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
thanks for this. quick note on process - i require PRs to come through no-mistakes, which is why the "PR must be raised via no-mistakes" check is red here (this was opened directly). the reason i ask for it: no-mistakes runs review, tests, lint, and docs on your branch before the PR is opened, so contributions arrive already validated. that keeps the quality bar high and keeps me from having to hand-review every change - i maintain this solo, so it's the only way i keep up. can you re-raise it through no-mistakes? running the pipeline on your branch opens/updates the PR through the gate and turns that check green. the change looks useful, it just needs to come through that path. ping me if the setup gives you trouble. |
Wire cursor-agent into firstmate as a 6th verified harness adapter, mirroring the existing adapters DRY (one thin entry per touch point): - bin/fm-harness.sh: detect CURSOR_AGENT=1 env marker + cursor-agent process name - bin/fm-lock.sh: add cursor to HARNESS_RE (fixes 'cannot locate harness process in ancestry' for sessions run under cursor-agent) - bin/fm-spawn.sh: launch_template cursor-agent --yolo (positional prompt, no --prompt), --model flag, no separate effort flag (effort folded into model id), and a turn-end hook that jq-merges a firstmate stop entry into the SHARED ~/.cursor/hooks.json idempotently (preserving cmux's entries) with a grok-style per-task token-pointer guard so it never fires for non-firstmate cursor sessions - bin/fm-teardown.sh: remove the per-task pointer + auth entry (leaves the shared hooks.json entry, which is idempotent and gated) - bin/fm-watch.sh + bin/fm-tmux-lib.sh: add 'ctrl+c to stop' to the busy regex - bin/fm-bootstrap.sh: accept cursor in the crew-dispatch verified/effort_ok jq - AGENTS.md section 4: verified adapter list + launch-profile axes - .agents/skills/harness-adapters/SKILL.md: cursor section with verified facts - tests/fm-cursor-harness.test.sh: detection, launch_template, and idempotent cmux-preserving hooks.json merge Verified facts sourced from the scout report at data/verify-cursor-yo/report.md (cursor-agent 2026.07.01-41b2de7). Co-Authored-By: Claude <noreply@anthropic.com>
- README quickstart and requirements - docs/configuration.md and architecture.md - harness-adapters skill header - spawn.sh comment for bare adapter names (cursor support is now fully documented for crew dispatch and primary use.)
…entries
Cursor's documented hooks schema (and the actual runtime) expects
"stop": [ { "command": "..." } ]
not the nested {"hooks": [{"type":"command", ...}]} wrapper we were
emitting (and that the test was asserting).
This was flagged as P1 on the PR. The stop hook would never fire for
firstmate cursor sessions, falling back to stale/heartbeat detection.
- Updated fm_cursor_merge_hooks jq logic and comment.
- Updated test seed data and all jq assertions to match the flat schema.
- All cursor harness tests pass.
Addresses Codex review comment on PR kunchenguid#189.
Address P2 review feedback on PR kunchenguid#189: - bootstrap now reports MISSING: jq when config/crew-harness=cursor or config/secondmate-harness=cursor (similar to X-mode/dispatch). - fm-spawn hard-fails early with clear error if HARNESS=cursor and jq is missing (before creating window or launching the agent). Previously the merge would just warn and skip the hook, falling back to stale detection. Now cursor harnesses get the turn-end hook or don't launch. jq is still not a universal requirement (only needed for cursor hook merge + dispatch + X). Tests still pass.
…oft warning path) The internal function still had a 'warning + return 0' that would allow launch to succeed without the hook. Now: - Early guard at HARNESS resolution (before any tmux/agent start) exits hard. - The merge function itself now does hard 'error + MISSING + exit 1' instead of warning+success (defensive, and removes the exact code the P2 review quoted). This, plus the bootstrap MISSING report when cursor is configured, fully addresses the 'require jq before spawning cursor tasks' feedback. Tests unchanged (jq present in env).
…x P2) Previously a malformed ~/.cursor/hooks.json would only warn and continue the spawn (no turn-end hook installed). Now the merge failure path does 'error' + exit 1, consistent with the missing-jq and early-guard paths. This addresses the latest Codex P2 on commit 2ff93cf.
e07b2da to
49b3d12
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49b3d12b4c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| # jq is required for cursor harness (to jq-merge the stop hook into the shared | ||
| # ~/.cursor/hooks.json). Already required for X-mode and crew-dispatch (above). | ||
| if [ "$crew" = "cursor" ]; then |
There was a problem hiding this comment.
Detect cursor defaults before jq check
Captain, this check only examines the literal config/crew-harness contents; if that file is absent or set to default while firstmate itself is running under cursor-agent, fm-harness.sh crew resolves to cursor but bootstrap will not emit MISSING: jq. This is a fresh gap beyond the earlier jq fix: cursor is selected implicitly via harness detection, so the first spawn fails in fm-spawn.sh instead of the session-start consent/install flow surfacing the prerequisite.
Useful? React with 👍 / 👎.
| fi | ||
| fi | ||
| sm= | ||
| [ -f "$CONFIG/secondmate-harness" ] && sm=$(head -1 "$CONFIG/secondmate-harness" 2>/dev/null | tr -d '[:space:]' | cut -d' ' -f1 || true) |
There was a problem hiding this comment.
Parse secondmate harness before jq check
Captain, this secondmate jq probe removes all whitespace before taking the first field, so documented config/secondmate-harness lines like cursor auto high are parsed as cursorautohigh and skip MISSING: jq on machines without jq. This is fresh evidence beyond the prior jq thread: the added parser disagrees with fm-harness.sh's whitespace-token parser for pinned secondmate model/effort, so a cursor secondmate can pass bootstrap and then fail at spawn.
Useful? React with 👍 / 👎.
…entries
Cursor's documented hooks schema (and the actual runtime) expects
"stop": [ { "command": "..." } ]
not the nested {"hooks": [{"type":"command", ...}]} wrapper we were
emitting (and that the test was asserting).
This was flagged as P1 on the PR. The stop hook would never fire for
firstmate cursor sessions, falling back to stale/heartbeat detection.
- Updated fm_cursor_merge_hooks jq logic and comment.
- Updated test seed data and all jq assertions to match the flat schema.
- All cursor harness tests pass.
Addresses Codex review comment on PR kunchenguid#189.
Address P2 review feedback on PR kunchenguid#189: - bootstrap now reports MISSING: jq when config/crew-harness=cursor or config/secondmate-harness=cursor (similar to X-mode/dispatch). - fm-spawn hard-fails early with clear error if HARNESS=cursor and jq is missing (before creating window or launching the agent). Previously the merge would just warn and skip the hook, falling back to stale detection. Now cursor harnesses get the turn-end hook or don't launch. jq is still not a universal requirement (only needed for cursor hook merge + dispatch + X). Tests still pass.
Acta de G7 — observacion post-cutover con cobertura completa · EJECUTADOCutover W1: 2026-09-02T00:57Z. Cierre de la observacion: 2026-09-02T14:59Z. Autorizacion del capitan, 2026-09-02: crear la cuenta de prueba Contadores de #189 — todos en cero
El prefijo Ciclo de escaneo posterior al cutover
Cobertura — completa
Tres cosas declaradas y no maquilladas, con su justificacion:
Metricas frente a la linea base W0
Los tres rollbacks estan atribuidos: un ingreso con la credencial temporal ya consumida, una Quiescencia de cierre — cuatro diferencias, las cuatro atribuidas
Los seis eslabones, uno a uno: Lo que este acta NO autorizaNo autoriza el retiro del login historico, ni Retiro-1/2, ni P1-P5, ni el GO. El GO existe |
Adds
cursor(cursor-agent) as a fully verified harness adapter.This completes the work to let you run firstmate (primary + crew) on Cursor instead of Claude.
Summary of changes
fm-harness.sh,fm-lock.sh):CURSOR_AGENT=1+cursor-agentprocess name.fm-spawn.sh):cursor-agent --yolo ...(the autonomy flag),--modelsupport. Effort is not a separate flag — it is encoded in the model id (e.g. suffix-highor bracket formid[effort=high]). Requested effort is still recorded in meta.stophook every turn boundary. We jq-merge a guarded firstmate command into the shared~/.cursor/hooks.json(additively and idempotently so cmux entries are untouched). Guard uses the same per-task token pointer pattern as grok (.fm-cursor-turnendin the worktree + registry under~/.cursor/fm-turn-end.d/).fm-watch.sh,fm-tmux-lib.sh): matchesctrl+c to stopon the composer line.fm-teardown.sh): cleans per-task pointers and registry tokens. Deliberately leaves the shared hooks.json entry in place (it becomes a safe no-op without the pointer).tests/fm-cursor-harness.test.sh(env marker, process name via lock, launch template, safe hooks merge).Verified against cursor-agent 2026.07.01-41b2de7.
How to use after merge
bin/fm-harness.shwill reportcursor.config/crew-harness(or leave as default) controls what crewmates use.fm-spawn ... cursoror--harness cursor --model "..."./no-mistakesand other skills work via/(cursor discovers.agents/skills/).See the harness-adapters skill and updated AGENTS.md for details.
Closes the cursor adapter request.