feat: add cursor agent cli integration for session restore#506
Conversation
|
Hi @udirom, thanks for your interest in contributing! New contributors need maintainer approval before opening PRs. This keeps review time focused on accepted work and avoids wasted effort. Herdr is opinionated about how it should look, feel, and work. Feature requests, ideas, questions, contribution proposals, and product-direction checks belong in Discussions, not issues. Next steps:
A discussion, issue, branch, or proposed implementation does not reserve the work and does not mean the PR path is approved. This PR will be closed automatically. See https://github.com/ogulcancelik/herdr/blob/master/CONTRIBUTING.md for more details. |
|
Hi @ogulcancelik — first-time contributor here, pinging for review when you have a moment. I opened Discussion #505 first to propose the Cursor Agent CLI integration (session-only pattern, aligned with Codex/Droid). This PR implements that proposal:
I understand the approval gate for new contributors — if this looks good in principle, could you Happy to iterate on hook install path, docs, or anything else. Thanks for herdr! |
|
@udirom this looks directionally good. a few changes before merge:
|
|
Thanks for the review — addressed in
Manual E2E (partial — local herdr is 0.6.4)Full loop needs herdr built from this branch: my running server (0.6.4) doesn't expose What I verified locally:
Happy to re-run the full install → session report → restart → restore loop once this is merged or if you have a preferred way to test against a branch build without Zig/libghostty-vt locally. |
|
@ogulcancelik — follow-up on the manual E2E ask. Built this branch locally (
One nuance: Added Suggestion — plugin-shaped integrations: each new agent currently needs a core PR (Rust + assets + docs + review cycle). Would you be open to a Discussion on loading integrations from a manifest + hook bundle under the user config dir? Community could ship Cursor-style agents without waiting on first-contributor approval for every tool. Suggestion — contributor skill: I added Let me know if you want me to re-run anything interactively before merge. |
|
Moved the E2E script and contributor skill out of the branch — they were scope creep for this PR. Copies here (gist, not for merge): https://gist.github.com/udirom/15f181bc9366c60ab3642aec94b2ffe8 Contains:
Happy to open a separate PR or Discussion if any of this is worth upstreaming later. |
|
Thanks, the runtime behavior from the earlier review looks mostly addressed: restore now uses Please fix these before merge:
i'm working on something about this stay tuned :) |
|
Addressed all four review items in c035fa7: merged master, fixed sessionStart hook test for bash-quoted commands, added fake cursor-agent shim for happy-path install tests, and added Cursor to agents.mdx session-identity list. Locally |
|
@udirom ill take over this pr and merge soon |
Follow the codex/droid session-only integration pattern: hook script at ~/.cursor/herdr-agent-state.sh, sessionStart entry in hooks.json, and pane.report_agent_session for native restore via `agent --resume`. State stays on screen detection (is_reserved_native_state_source). Co-authored-by: Cursor <cursoragent@cursor.com>
Validate sessionStart in the hook script, avoid treating any generic `agent` binary as the Cursor CLI for integration availability, prefer session_id over conversation_id for resume, and document Cursor in session-state, agents, and cli-reference docs. Co-authored-by: Cursor <cursoragent@cursor.com>
Address review feedback: resume via `cursor-agent --resume <id>` instead of generic `agent`, fail install when cursor-agent is missing from PATH, and update docs accordingly. Session-only + screen-detected state unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
Capture manual test automation and contributor workflow from the Cursor integration work so future agents follow the same install/hook/resume pattern. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the PR focused on the cursor integration itself; auxiliary artifacts live in a PR comment gist instead. Co-authored-by: Cursor <cursoragent@cursor.com>
fb1834a to
64fb6ac
Compare
Summary
Adds Cursor Agent CLI integration so herdr can track and restore Cursor agent sessions from tmux panes.
herdr integration install cursor/uninstall cursor~/.cursor/herdr-agent-state.shand registers asessionStarthook in~/.cursor/hooks.jsonsession_id/conversation_idviapane report-agent-sessionagent --resume <id>; screen-detected state (session-only pattern, aligned with Codex/Droid)Discussion: #505
Test plan
cargo test integration::(install/uninstall/idempotency tests added)herdr integration install cursoron a machine with~/.cursor/hooks.jsonagent --resumeis suggested/appliedContributor note
First-time contributor (
udirom) — per CONTRIBUTING, maintainer/approvemay be required before merge. Happy to address review feedback.Made with Cursor