Skip to content

Pin Cursor Task subagents to the parent model #686

Closed

Description

@currentbits

Why

Picking Cursor GPT-5.6 Sol (or any Cursor model) still lets the Task tool fan out to Composer / Sonnet. Sol is a model pick, not a crew. The parent session is already on --model gpt-5.6-sol-high-fast; Task then fills an explicit model of composer-2.5 or claude-sonnet-5-thinking-high.

Follow-up to #685 (card titles). That made the fan-out visible. This stops it.

Policy

On every Cursor thread (not Sol-only):

  • generalPurpose Task / Agent workers inherit the parent model (strip Task model so Cursor inherit applies)
  • built-in explore / bash / browser / shell subagents keep their own model (fast search is fine)

Do not write into the user's ~/.cursor or the project .cursor/hooks.json (that would hit Cursor IDE and dirty the repo).

How

cursor-agent has --plugin-dir. Ship a tiny Cursor plugin that Solenta materializes onto a real filesystem path (userDataPath), then pass --plugin-dir on spawn. Package copies only electron/*.js (see scripts/package-app.sh), so do not leave the hook only as a subdirectory inside asar: embed or copy it out at runtime.

Hook: preToolUse matcher Task|Agent. updated_input deletes model when it is not inherit and not the parent (model / model_id on the hook payload). Omitting the field is more reliable on CLI than setting inherit. subagentStart can only deny, not rewrite; prefer rewrite.

Tests

  • unit: hook stdin/stdout for foreign model, matching parent, inherit, explore left alone
  • runner: argv includes --plugin-dir and the prompt stays last; pass userDataPath in that test
  • existing cursor tests stay green

Out of scope

Forcing Cursor's Task tool off entirely. Prompt-only rules.

Activity

  1. currentbits commented on Aug 23, 2026

    @currentbits
    OwnerAuthor

    Landed on worker branch coder/fork-i-think-there-is-something-wrong-wi-733813 (d26cd1c). Not merged.

    What landed

    Solenta now materializes a tiny Cursor plugin at runtime and passes --plugin-dir on every local cursor-agent spawn.

    • Plugin root: <userDataPath>/cursor-pin-parent (tests without userDataPath fall back to tmpdir). Package still copies only electron/*.js, so the plugin is written onto a real filesystem path rather than living under asar.
    • preToolUse matcher Task|Agent. If the call is generalPurpose (or unspecified) and tool_input.model is a non-empty string other than inherit and other than the parent model / model_id, that field is deleted so Cursor inherit applies. Omitting the field, not setting inherit.
    • Built-in explore / bash / browser / shell keep their own model.
    • Fail-open: junk stdin or a hook throw returns { permission: "allow" } and exit 0.
    • Does not write ~/.cursor/hooks.json or the project's .cursor/hooks.json.
    • Prompt stays last. No --worktree. No settings UI; always-on for local Cursor threads. SSH/WSL spawns skip --plugin-dir because the plugin path is on this host.

    Tests: node --test electron/test/cursor.test.js electron/test/cursor-parse.test.js electron/test/cursor-pin-task-parent.test.js (40 pass).

    How to verify

    1. Rebuild Solenta.
    2. Pick GPT-5.6 Sol (or any Cursor model) and send a prompt that would fan out Task.
    3. The Task worker should inherit the parent. It must not run as composer-2.5 or claude-sonnet-5-thinking-high.
    4. If Cursor's stream reports the rewritten args, the Task card drops composer/sonnet. If it still logs the original Task.model Sol asked for, the card can still name that model even though the worker inherited. The spawn is the check.
    5. node must be on PATH; the hook is node <abs script>. Electron's own binary cannot run it.

    Explore/bash/browser/shell Task cards can still show their own model. That is intended.

  2. currentbits commented on Aug 23, 2026

    @currentbits
    OwnerAuthor

    Landed on main (merge of coder/fork-i-think-there-is-something-wrong-wi-733813). Local Cursor Task/Agent workers inherit the parent model; explore/bash/browser/shell keep their own.

  3. added
    plan:done
    and removed
    plan:doing
    on Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions