Skip to content

feat: add cursor harness support#208

Open
willwashburn wants to merge 2 commits into
mainfrom
codex/add-cursor-harness
Open

feat: add cursor harness support#208
willwashburn wants to merge 2 commits into
mainfrom
codex/add-cursor-harness

Conversation

@willwashburn

Copy link
Copy Markdown
Member

Summary

  • add cursor to harness values/schema/detection, mapping workforce harness cursor to cursor-agent
  • translate Cursor interactive and one-shot launches with AGENTS.md instructions, --print --output-format text, and bypass-to---force
  • wire Cursor sidecars, skill roots, mount isolation, launch metadata, runtime cloud one-shots, docs, and tests

Tests

  • corepack pnpm --filter @agentworkforce/persona-kit test
  • corepack pnpm --filter @agentworkforce/runtime test
  • corepack pnpm --filter @agentworkforce/cli test
  • corepack pnpm --filter @agentworkforce/cli... build

@codeant-ai

codeant-ai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI.

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 042ee112-5643-41a9-be38-db9aef6c559a

📥 Commits

Reviewing files that changed from the base of the PR and between 575ae0e and e228042.

📒 Files selected for processing (18)
  • packages/cli/README.md
  • packages/cli/src/cli.test.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/launch-metadata.test.ts
  • packages/cli/src/launch-metadata.ts
  • packages/persona-kit/schemas/persona.schema.json
  • packages/persona-kit/src/constants.ts
  • packages/persona-kit/src/detect.ts
  • packages/persona-kit/src/execute.ts
  • packages/persona-kit/src/index.test.ts
  • packages/persona-kit/src/interactive-spec.test.ts
  • packages/persona-kit/src/interactive-spec.ts
  • packages/persona-kit/src/plan.test.ts
  • packages/persona-kit/src/plan.ts
  • packages/persona-kit/src/skills.ts
  • packages/persona-kit/src/types.ts
  • packages/runtime/src/cloud-defaults.ts
  • packages/runtime/src/runner.test.ts

📝 Walkthrough

Walkthrough

This PR adds comprehensive support for the cursor harness to AgentWorkforce, integrating it alongside existing harnesses (claude, codex, opencode, grok) across schema definition, binary detection, interactive/non-interactive execution modes, AGENTS.md sidecar materialization, CLI sandbox mounting, runtime execution, and extensive test coverage.

Changes

Cursor harness integration

Layer / File(s) Summary
Harness schema and constants definition
packages/persona-kit/schemas/persona.schema.json, packages/persona-kit/src/constants.ts, packages/persona-kit/src/types.ts
Harness enum extended to include cursor, HARNESS_VALUES updated, and HARNESS_SKILL_TARGETS adds cursor mapping to cursor-agent binary and .cursor/rules skills directory. Schema descriptions expanded to document cursor's MCP/permission/sidecar behavior.
Binary detection and mapping
packages/persona-kit/src/detect.ts, packages/persona-kit/src/execute.ts
New HARNESS_BINARIES lookup maps cursor to cursor-agent executable; detectHarness updated to resolve and probe the mapped binary by name rather than enum value.
Interactive and non-interactive spec building
packages/persona-kit/src/interactive-spec.ts, packages/persona-kit/src/interactive-spec.test.ts
buildInteractiveSpec implements cursor branch: maps permissions.bypassPermissions to --force, writes systemPrompt to AGENTS.md configFile, emits warnings for unsupported MCP injection/pluginDirs/approval policies. buildNonInteractiveSpec adds cursor one-shot mode with --print --output-format text flags, reusing interactive configFiles.
Spawn plan construction and sidecar resolution
packages/persona-kit/src/plan.ts, packages/persona-kit/src/plan.test.ts
PersonaSpawnPlan.cli changed from Harness type to string; sidecar resolution extends cursor to AGENTS.md path alongside codex/opencode/grok; plan.cli assigned from spec.bin (cursor-agent) instead of persona.harness.
CLI mount pattern handling and sidecar loading
packages/cli/src/cli.ts, packages/cli/src/cli.test.ts
New CURSOR_IGNORED_PATTERNS constant hides CLAUDE.md/CLAUDE.local.md for cursor sessions; buildRelayfileMountPatterns selects cursor patterns; loadSidecarForSelection includes cursor in AGENTS.md harness allowlist; .cursor/rules added to SKILL_INSTALL_IGNORED_PATTERNS.
CLI clean mode and config degradation
packages/cli/src/cli.ts, packages/cli/src/cli.test.ts
decideCleanMode treats cursor like other interactive harnesses (sandbox mount default); when --install-in-repo is unsafe for cursor, CLI warns and passes persona systemPrompt as cursor's initial prompt instead of materializing AGENTS.md to real repo.
Runtime AGENTS.md materialization
packages/runtime/src/cloud-defaults.ts, packages/runtime/src/runner.test.ts
sidecarForPersona extended to include cursor for AGENTS.md materialization; integration test verifies cursor-agent receives materialized AGENTS.md via PATH stub injection.
Launch metadata harness mapping
packages/cli/src/launch-metadata.ts, packages/cli/src/launch-metadata.test.ts
LaunchMetadataIngestHarness type extended to include cursor; launchMetadataSessionDirHint adds explicit cursor case returning undefined.
Skill installation targeting cursor
packages/persona-kit/src/skills.ts, packages/persona-kit/src/index.test.ts
skillShArtifactPaths adds .cursor/rules/<package> cleanup path; materializeSkills error message updated to include cursor in non-claude harness list; test coverage for cursor prpm install and cleanup.
CLI help text and command documentation
packages/cli/src/cli.ts, packages/cli/README.md
Agent command help expanded with cursor skill/install targets; mirrorSkillCacheInto docs mention cursor artifacts; README extensively updated documenting cursor in harness selection, check probing, permissions, MCP/skill install behavior, sandbox mounting, interactive/one-shot examples, and troubleshooting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • AgentWorkforce/workforce#204: Both PRs wire a new harness into core code paths (decideCleanMode, loadSidecarForSelection, interactive/non-interactive spec, mount/skill ignore patterns) within CLI and persona-kit, adding parallel harness support via the same extension points.
  • AgentWorkforce/workforce#46: Both PRs extend the sidecar/loadSidecarForSelection pipeline around AGENTS.md materialization; the retrieved PR introduces CLAUDE/AGENTS sidecars per harness, and the main PR adds cursor to select/write the AGENTS.md sidecar correctly.
  • AgentWorkforce/workforce#74: Both PRs touch packages/persona-kit/src/plan.ts—the retrieved PR introduces spawn-plan builder/executor plumbing, while the main PR updates resolveSidecarWrite/buildPersonaSpawnPlan to add cursor AGENTS.md/cli handling.

Suggested labels

size:L, feature:harness, area:persona-kit, area:cli, area:runtime

Poem

🐰 Hop hop, the cursor joins the crew,
AGENTS.md for you, bypassPermissions too,
--force the sandbox, mount it tight,
Cursor-agent flies through the night!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 43.75% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and concisely summarizes the main change: adding cursor harness support to the codebase.
Description check ✅ Passed The description provides relevant context about the changes, covering the main objectives including cursor harness values, detection, translations, sidecars, skills, and testing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/add-cursor-harness

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the cursor harness (executing the cursor-agent binary) across the CLI, persona-kit, and runtime packages. It configures the necessary sandbox mount rules, mapping of permission bypass modes to the --force flag, and handles sidecar files like AGENTS.md while hiding CLAUDE.md files. Extensive unit tests have been added to verify both interactive and non-interactive behaviors of the new harness. I have no feedback to provide as there are no review comments to address.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b98dd29699

ℹ️ 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".

Comment on lines +599 to +604
configFiles: systemPrompt
? [
{
path: 'AGENTS.md',
contents: systemPrompt.endsWith('\n') ? systemPrompt : `${systemPrompt}\n`
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve Cursor prompts when disabling the mount

When a Cursor persona is launched with --install-in-repo, runInteractive disables the sandbox mount, treats any configFiles as unsafe to write, and only calls stripAgentFlag() before spawning. Since this new Cursor branch carries the entire systemPrompt only via an AGENTS.md config file and sets initialPrompt: null, that non-mount path silently starts cursor-agent --model ... without the persona prompt at all. Either avoid emitting sandbox-only config for Cursor in this mode or provide a non-mount fallback instead of dropping the prompt.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e228042. The non-mount config-file degradation path now has a Cursor-specific branch: it warns that AGENTS.md cannot be safely materialized under --install-in-repo, then appends the persona system prompt as Cursor's initial prompt. I also added a subprocess regression test with a fake cursor-agent to verify the final argv preserves the prompt.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 17 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/persona-kit/src/interactive-spec.ts">

<violation number="1" location="packages/persona-kit/src/interactive-spec.ts:597">
P1: When `--install-in-repo` is used, the sandbox mount is disabled and `configFiles` are not materialized (they are only written into the mount dir via `onBeforeLaunch`). Since the cursor branch sets `initialPrompt: null` and carries the persona's system prompt exclusively via the `AGENTS.md` config file, the non-mount path will silently launch `cursor-agent` without any persona prompt. Either provide a non-mount fallback (e.g., pass the prompt as a positional argument or write AGENTS.md with cleanup), or emit a degradation warning like the opencode path does.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/persona-kit/src/plan.ts
return {
bin: 'cursor-agent',
args,
initialPrompt: null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: When --install-in-repo is used, the sandbox mount is disabled and configFiles are not materialized (they are only written into the mount dir via onBeforeLaunch). Since the cursor branch sets initialPrompt: null and carries the persona's system prompt exclusively via the AGENTS.md config file, the non-mount path will silently launch cursor-agent without any persona prompt. Either provide a non-mount fallback (e.g., pass the prompt as a positional argument or write AGENTS.md with cleanup), or emit a degradation warning like the opencode path does.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/persona-kit/src/interactive-spec.ts, line 597:

<comment>When `--install-in-repo` is used, the sandbox mount is disabled and `configFiles` are not materialized (they are only written into the mount dir via `onBeforeLaunch`). Since the cursor branch sets `initialPrompt: null` and carries the persona's system prompt exclusively via the `AGENTS.md` config file, the non-mount path will silently launch `cursor-agent` without any persona prompt. Either provide a non-mount fallback (e.g., pass the prompt as a positional argument or write AGENTS.md with cleanup), or emit a degradation warning like the opencode path does.</comment>

<file context>
@@ -536,6 +542,71 @@ export function buildInteractiveSpec(input: BuildInteractiveSpecInput): Interact
+      return {
+        bin: 'cursor-agent',
+        args,
+        initialPrompt: null,
+        warnings,
+        configFiles: systemPrompt
</file context>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e228042. The non-mount config-file degradation path now has a Cursor-specific branch: it warns that AGENTS.md cannot be safely materialized under --install-in-repo, then appends the persona system prompt as Cursor's initial prompt. I also added a subprocess regression test with a fake cursor-agent to verify the final argv preserves the prompt.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

@codeant-ai

codeant-ai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI.

@willwashburn

willwashburn commented Jun 6, 2026

Copy link
Copy Markdown
Member Author

Addressed both issues identified by cubic in commit e228042:

  • PersonaSpawnPlan.cli now carries the executable binary from buildInteractiveSpec instead of the harness id, so Cursor plans expose cursor-agent for callers that spawn plan.cli + plan.args. Added/updated plan coverage for this.
  • The non-mount --install-in-repo degradation path is no longer opencode-only. Cursor now warns that it cannot safely write AGENTS.md into the repo and appends the persona system prompt as Cursor's initial prompt, preserving persona behavior without repo pollution. Added a subprocess regression test with a fake cursor-agent to lock the final argv.

Re-ran:

  • corepack pnpm --filter @agentworkforce/persona-kit test
  • corepack pnpm --filter @agentworkforce/cli test
  • corepack pnpm --filter @agentworkforce/cli... build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant