Cursor Harness Guide
Audience: Users — Operators configuring or troubleshooting the Cursor harness adapter.
The Cursor adapter uses the cursor-sdk Python package. hpilot runs the synchronous SDK in-process on a worker thread rather than launching a Cursor CLI session. hpilot's Cursor adapter does not support model-effort selection. Any explicit global or per-stage effort resolved for Cursor is rejected before the harness starts with does not support model effort selection; omit effort to retain normal Cursor behavior. This structural rejection is independent of the effort string.
Prerequisites
cursor-sdk>=1.0.24must be installed in hpilot's Python environment.- The platform wheel bundles its own bridge launcher under
cursor_sdk/_vendor/bridge/, so nocursor-sdk-bridgebinary needs to be onPATH.
- The platform wheel bundles its own bridge launcher under
harnesses.cursor.api_keymust be set in the active hpilot config.- Cursor uses the SDK's
composer-2.5model unless astage_overridesentry suppliesmodel.
The SDK package is a hpilot dependency, so a normal hpilot install provides it. Verify the setup with:
hpilot doctorConfiguration
Select Cursor and store its API key in ~/.hpilot/config.yaml:
harness: cursor
harnesses:
cursor:
api_key: your-cursor-api-keyVerifier settings required by non-contract Cursor stages are configured separately under llm in the same config file. See the Configuration Reference for details.
A workspace-local .hpilot/config.yaml, when present, replaces the home config completely. Put harnesses.cursor.api_key in that file instead for a workspace-local setup.
The adapter reads only harnesses.cursor.api_key. Environment variables, Cursor CLI login state, and separate Cursor configuration files are not authentication sources for this adapter.
Execution Behavior
- The synchronous SDK runs on a worker thread so the pipeline can continue to stream events and respond to cancellation.
- SDK messages are translated defensively because message shapes can vary. Unknown or partial fields are handled without assuming a fixed transport payload.
- Tool names and arguments are mapped into hpilot's canonical
tool call:output while retaining the Cursor-visible tool name. - Read, search, edit, and shell-execute tool calls use consistent summary labels such as
file_path,pattern, orcommandin live stderr and in.hpilot/logs/stages/JSONL. The recorded arguments retain the names supplied by the Cursor SDK; alias lookup does not add fields to them. - Replies are evaluated after each SDK turn. If the verifier blocks completion, hpilot sends a continuation prompt through the same SDK agent.
Subagent task output
When the main agent delegates work through a completed task tool call, the SDK returns the subagent's reported conversation inside the task result. hpilot extracts nested conversationSteps from that result and renders assistant text, thinking, and nested tool calls in source order using the same canonical labels as top-level Cursor output. The outer task call and its result still appear once after the nested conversation. Subagent metadata such as transcript paths is not printed as conversation content.
Empty, malformed, missing, or failed task results degrade safely — no content is fabricated and the stage continues normally.
Continuation and Sessions
- When the verifier blocks a reply, hpilot sends a continuation prompt through the same live SDK agent session.
- Each completed turn, including a verifier-driven continuation, consumes one stage
max_retriesslot. The session stops when that budget is exhausted. - Pipeline retry continuation and
--resumeare not supported for Cursor. Retries and resumed invocations start a fresh SDK agent even though hpilot may record a session id in stage metadata.
Completion and Usage
- The final completion event includes the last token-usage snapshot reported by the SDK run. hpilot does not sum repeated cumulative usage updates.
- Inspect
.hpilot/logs/stages/when live stderr does not show usage details.
Read-Only Paths
Cursor enforces read_only_paths only through Git-backed change detection:
- hpilot captures Git status and hashes for protected dirty paths before the first stage attempt.
- After the turn, it detects protected files that were created, modified, or deleted.
- It leaves detected changes in place and fails the stage attempt.
This is detect-only enforcement, not a pre-write sandbox. A protected file can be changed during the turn and remains changed after detection. Use a read-only mount or disposable checkout when writes must be impossible at the filesystem boundary.
hpilot does not create or modify .cursor/cli.json; no Cursor permission file is written.
Troubleshooting
Run ends with status error
Cursor can return a terminal error without exposing the server reason through the SDK. hpilot includes the run, agent, and model identifiers when the SDK provides them. Check Cursor account usage and model access first, then provide the run identifier to Cursor support if the failure remains opaque. Explicitly selected models may be unavailable after included usage is exhausted even when the automatic model remains available.
Cursor's usage-limit message may recommend the product label Auto even when the SDK catalog does not expose auto as a valid model ID. Use an exact ID from the error's available-model list or from Cursor.models.list().
cursor-sdk is not installed
Install hpilot with its locked dependencies, or install the minimum supported SDK version in the same Python environment:
pip install "cursor-sdk>=1.0.24"Then rerun hpilot doctor.
Bridge fails to launch
The bridge ships inside the cursor-sdk platform wheel, so a normal install provides it automatically. If launching the SDK fails to find the bridge, confirm the wheel staged its bundled launcher:
"$(uv tool dir)/hpilot/bin/python" -c \
"from cursor_sdk._vendor import resolve_bridge_path; print(resolve_bridge_path())"The path should point inside cursor_sdk/_vendor/bridge/. If it does not, reinstall cursor-sdk so the platform wheel (with its bundled bridge) is used rather than a source distribution.
Cursor API key is not configured
Add harnesses.cursor.api_key to the active home or workspace-local hpilot config. Do not rely on an environment variable or Cursor CLI login.
CURSOR_API_KEY and other ambient environment variables are ignored when the config key is absent. Preflight fails before stage work begins.
Tool output is incomplete
Check .hpilot/logs/stages/ for the structured SDK events. The translator handles missing fields defensively, so an SDK event without arguments can legitimately produce a tool title without an argument summary.
Cancellation takes time
Cancellation is cooperative. hpilot signals the SDK worker, requests SDK run cancellation when available, and waits up to five seconds for the worker to finish. An SDK operation already in progress may take a short time to return. Interrupted runs exit with status code 130 and do not advance to the next stage.
The bundled bridge subprocess may briefly outlive the SDK worker because the SDK does not expose its PID for hpilot cleanup. Terminate only PIDs you can verify belong to your run.
Native session discovery limitation
hpilot records the identifier returned by the Cursor SDK and leaves the transcript under Cursor's normal project agent-transcripts storage. An authenticated smoke stage confirmed cursor-agent --resume <session-id> accepts that SDK identifier, but cursor-agent ls omitted the same session. hpilot therefore promises direct native resume but not native list discovery for Cursor. Follow-up scope is to compare SDK-created agent metadata and indexing with the CLI listing and add a regression test across current versions before promising list discovery; until that is resolved, use the exact identifier from .hpilot/latest-session.json rather than searching the list.