Add native Cursor support to SkillOpt-Sleep#159
Conversation
…t/cursor-skillopt-sleep # Conflicts: # plugins/devin/README.md # plugins/devin/mcp_server.py # tests/test_devin_plugin.py
@microsoft-github-policy-service agree |
|
Thanks for the thorough Cursor integration and the new core SkillOpt target support. We reviewed the latest head and re-ran it locally: the focused suite reports The remaining blocker is in the earlier SkillOpt-Sleep tool-replay path, which the latest commit does not change. Agent-mode replay runs with Could you please take one of these paths?
For the Sleep tool replay, please provide a small live adversarial matrix against a stated Cursor Agent version showing:
Sanitized commands and results are sufficient; this does not need to run in public CI. For the core backend, the explicit We appreciate the scope and care in this contribution and want to retain it under your authorship. A split would let the already-useful core backend move forward without weakening the review of the separate Sleep execution boundary. |
Thank you for the detailed review and for verifying the current Cursor Agent CLI behavior. I agree that the Agent-mode Sleep replay is enforcing a host-safety boundary that should not rely solely on generated configuration and mocked process tests. I’ll take the preferred split:
For the core PR, I’ll also add a guard preventing file-edit rollouts from combining I’ll treat re-enabling Sleep tool-aware replay as a separate follow-up requiring the live adversarial matrix described above against a stated Cursor Agent version. Thanks again for identifying a path that allows the independently useful core support to move forward without weakening the Sleep security review. |
81d4d05 to
8b1d75e
Compare
|
Implemented the requested split and fail-closed path.
Validation after the split:
The live adversarial matrix is intentionally deferred. It will be required in a separate future PR before Cursor Sleep tool-aware replay can be restored. |
There was a problem hiding this comment.
Pull request overview
Adds opt-in native Cursor support to the SkillOpt-Sleep “shared engine” by introducing a Cursor transcript source, a Cursor Agent CLI backend, and a Cursor plugin packaging/install flow, along with supporting docs and tests.
Changes:
- Add
--source cursortranscript harvesting from local Cursor Agent JSONL transcripts, including scoping, mtime filtering, replay-session filtering, and redaction. - Add a
cursorbackend that drives authenticatedcursor-agentin isolated Ask-mode workspaces, with explicit failure behavior for tool-aware replay. - Add
plugins/cursor/(manifest, command, skill, installers, docs) plus documentation updates and parity tests.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_sleep_engine.py | Adds unit tests for Cursor harvesting behavior and Cursor backend behavior (including retries, redaction, and disabled tool-aware replay). |
| tests/test_plugin_sync.py | Extends parity tests to cover the new Cursor plugin assets and docs expectations. |
| skillopt_sleep/types.py | Updates SessionDigest docstring to include Cursor as a transcript source. |
| skillopt_sleep/replay.py | Clarifies documentation around tool-aware replay expectations and failure behavior. |
| skillopt_sleep/mine.py | Ensures CursorBackendError from LLM mining isn’t swallowed by the generic exception handler. |
| skillopt_sleep/harvest_sources.py | Wires --source cursor into harvest_for_config. |
| skillopt_sleep/harvest_cursor.py | Implements Cursor transcript parsing/digesting and workspace/session discovery logic. |
| skillopt_sleep/cycle.py | Passes cursor_path through to backend selection. |
| skillopt_sleep/config.py | Adds cursor_home and cursor_path defaults/config plumbing. |
| skillopt_sleep/backend.py | Adds Cursor CLI path resolution, CursorBackendError, and CursorCliBackend implementation + backend routing updates. |
| skillopt_sleep/main.py | Adds CLI flags for Cursor home/path, enables cursor in backend/source choices, and surfaces Cursor backend failures cleanly. |
| plugins/README.md | Documents Cursor as an additional shared-engine integration and describes Cursor-specific boundaries/behavior. |
| plugins/openclaw/run_sleep.py | Updates OpenClaw wrapper to pass through new backend parameters (cursor_path/project_dir). |
| plugins/cursor/skills/skillopt-sleep/SKILL.md | Adds Cursor skill guidance, including target path conventions and safety boundaries. |
| plugins/cursor/README.md | Adds Cursor integration documentation, install instructions, and workflow guidance. |
| plugins/cursor/LICENSE | Adds per-plugin license file (mirrors repo license). |
| plugins/cursor/install.sh | Adds macOS/Linux installer for local Cursor plugin installation. |
| plugins/cursor/install.ps1 | Adds Windows installer for local Cursor plugin installation. |
| plugins/cursor/commands/skillopt-sleep.md | Adds native /skillopt-sleep command definition and safety defaults. |
| plugins/cursor/.cursor-plugin/plugin.json | Adds Cursor plugin manifest for local install. |
| docs/sleep/README.md | Documents Cursor source/backend boundaries and usage guidance. |
| docs/reference/cli.md | Adds Cursor flags and Cursor-specific source/backend documentation. |
| docs/guideline.html | Updates rendered guideline to reflect Cursor options and constraints. |
| docs/guide/installation.md | Documents Cursor backend prerequisites and environment/config controls. |
| CHANGELOG.md | Adds an unreleased changelog entry for Cursor SkillOpt-Sleep support. |
| .cursor-plugin/marketplace.json | Adds repository marketplace registration metadata for the Cursor plugin. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def get_backend(name, model="", codex_path="", cursor_path="", project_dir=""): | ||
| if name == "openclaw-deepseek": | ||
| return OpenClawDeepSeekBackend(model=model or "deepseek-v4-pro") | ||
| return _orig_get_backend(name, model=model, codex_path=codex_path) | ||
| return _orig_get_backend( | ||
| name, |
Summary
Adds native Cursor support to SkillOpt-Sleep:
--source cursor--backend cursorCursor remains opt-in.
--source autokeeps its existing Codex-then-Claude precedence.The separate core
cursor_execbenchmark target has been split into #160.Changes
Transcript harvesting
Adds Cursor transcript harvesting from
~/.cursor/projects/<workspace>/agent-transcripts/with:Tool arguments, tool outputs, and unrelated records are excluded.
Cursor Agent backend
Ordinary mining, replay, judging, and reflection calls:
The target skill is inserted into prompts as text. It is not invoked as a native Cursor skill, and ordinary calls cannot inspect the target repository or run its tools.
Cursor Agent-mode tool-aware replay is temporarily disabled pending live permission-boundary validation. A task containing a
tool_calledcheck fails nonzero before Agent mode starts. The failed replay does not add a cache entry, stage, adopt, persist state, or advance the harvest checkpoint. Users must select another backend for those tasks.Restoring tool-aware Cursor replay requires a separate future PR with the requested real-CLI adversarial matrix covering allowlisted shims, command chaining, external reads/writes, WebFetch, MCP, and user-configuration isolation.
Cursor plugin
Adds
plugins/cursor/with:/skillopt-sleepcommandskillopt-sleepskillThe learned skill target is
.cursor/skills/skillopt-sleep-learned/SKILL.md.The plugin installs no session-end hook and does not run Sleep automatically. Runs remain user-triggered or explicitly scheduled, and adoption remains separate unless deliberately enabled.
CLI and configuration
Adds:
--source cursor--backend cursor--cursor-home PATH--cursor-path PATHcursor_homecursor_pathSKILLOPT_SLEEP_CURSOR_PATHSKILLOPT_SLEEP_CURSOR_MODELNo existing defaults or
autosource behavior change.Operational notes
runanddry-runmake provider calls with--backend cursor; dry-run prevents staging and state persistence, not provider spend.Validation
python -m mkdocs build --strict: passedgit diff --check: passedLive Cursor Agent Ask-mode execution was previously exercised on macOS. Windows packaging and transcript behavior remain covered by offline tests.