Skip to content

About

cursor subagent toggle button

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Cursor Subagent Toggle

English

Cursor Subagent Toggle controls whether Cursor can create subagents by managing hooks by default:

  • Local workspace hook config: .cursor/hooks.json
  • Local workspace blocker scripts: .cursor/hooks/block-subagent.sh and .cursor/hooks/block-task-tool.sh
  • Global user hook config: ~/.cursor/hooks.json
  • Global blocker scripts: ~/.cursor/hooks/block-subagent.sh and ~/.cursor/hooks/block-task-tool.sh
  • Optional local workspace managed rule: .cursor/rules/cursor-subagent-toggle.mdc

The extension shows global and workspace states together in a dedicated sidebar and in the status bar, including support for multi-root workspaces.

Main Features

  • Sidebar cards for global and each workspace folder
  • Small toggle switch per scope
  • Live final-status summary in the status bar
  • Language selector (English / ํ•œ๊ตญ์–ด)
  • Safe handling for custom or partial managed hooks (CHECK state)
  • One-click Apply Recommended Config to install the managed preToolUse(Task) and subagentStart hook pair
  • Hooks-only blocking by default, using two managed scripts
  • Optional managed project rule injection inside the workspace More dialog, labeled recommended off
  • A workspace checkbox to add only the generated blocker scripts and optional managed project rule path to .gitignore, labeled recommended on
  • A separate workspace checkbox to add only .cursor/hooks.json to .gitignore, labeled recommended on

Toggle Semantics

  • Toggle ON means subagent creation is allowed in that local scope.
  • Toggle OFF means the managed blocker is enabled in that local scope.
  • Workspace OFF writes both managed deny hooks and two managed hook scripts.
  • Workspace ON removes only the managed hook entries from .cursor/hooks.json.
  • The managed project rule is installed only when the workspace rule checkbox is enabled inside the More dialog.
  • Turning the rule checkbox off in More deletes only .cursor/rules/cursor-subagent-toggle.mdc when it still matches the extension-managed content.
  • Existing user-created .cursor/rules/*.mdc files are not modified, merged, or deleted.
  • The local git ignore checkbox adds only .cursor/hooks/block-subagent.sh, .cursor/hooks/block-task-tool.sh, and the optional managed rule path to the workspace .gitignore.
  • The checkbox is checked only when all generated file paths are already ignored by the workspace .gitignore.
  • The separate hooks.json checkbox adds only .cursor/hooks.json to the workspace .gitignore.
  • The hooks.json checkbox is checked only when .cursor/hooks.json is already ignored by the workspace .gitignore.
  • When the checkbox is turned off, the extension removes only its own managed .gitignore marker block and leaves user-defined ignore rules intact.
  • Global OFF writes the global deny hooks only. It installs workspace managed rules only for folders where the optional rule checkbox is enabled in More.
  • Global ON removes the global deny hooks and removes the managed project rule only from workspace folders that are not locally OFF.
  • Effective final state still follows Cursor scope priority: global blocking can override a local workspace.

Status Model

  • ๐ŸŸข ON: No blocking hook is applied.
  • ๐Ÿ”ด OFF: Managed blocking hook is applied.
  • ๐ŸŸก MIXED: Different effective states across folders in multi-root.
  • โšช CHECK: Custom or partial managed hooks exist, so safe ON/OFF inference is not possible.
  • ๐ŸŸ  ERROR: Invalid hooks.json or missing managed script.

The sidebar also shows the optional managed project rule state:

  • Managed: The extension-managed project rule exists and matches the expected content.
  • Missing: The managed project rule is missing while the optional rule checkbox is enabled in More and the effective state is blocked.
  • Modified - protected: The managed project rule file exists but no longer matches the extension content. The extension does not delete modified rule content.

The workspace card also shows whether generated blocker paths and hooks.json are ignored by git. If the exact ignore entries already exist outside extension-managed blocks, they are shown as Already ignored and are not removed by the extension.

Managed Hook Shape

Workspace blocker command:

{
  "version": 1,
  "hooks": {
    "preToolUse": [
      {
        "command": "bash .cursor/hooks/block-task-tool.sh",
        "matcher": "Task",
        "failClosed": true
      }
    ],
    "subagentStart": [
      {
        "command": "bash .cursor/hooks/block-subagent.sh",
        "failClosed": true
      }
    ]
  }
}

Global blocker command:

{
  "version": 1,
  "hooks": {
    "sessionStart": [
      {
        "command": "bash ./hooks/inject-ask-context.sh"
      }
    ],
    "preToolUse": [
      {
        "command": "bash ./hooks/block-task-tool.sh",
        "matcher": "Task",
        "failClosed": true
      }
    ],
    "subagentStart": [
      {
        "command": "bash ./hooks/block-subagent.sh",
        "failClosed": true
      }
    ]
  }
}

Existing non-managed hooks such as sessionStart are preserved when applying or toggling the managed global blocker.

Optional Managed Project Rule

When a workspace needs prompt-context protection and the rule checkbox is enabled in More, the extension creates only this file:

.cursor/rules/cursor-subagent-toggle.mdc

The rule starts with:

# [DO NOT CALL SUBAGENTS]

It also states that this rule is a higher-priority safety override for the workspace and that conflicting Cursor rules, project rules, user rules, instructions, or prompts must yield to the no-subagent rule.

Managed Git Ignore Entry

When the local git ignore checkbox is enabled, the extension adds only these generated file paths to the workspace .gitignore:

# Cursor Subagent Toggle: managed generated files
.cursor/hooks/block-subagent.sh
.cursor/hooks/block-task-tool.sh
.cursor/rules/cursor-subagent-toggle.mdc
# End Cursor Subagent Toggle

Only this marked block is removed when the checkbox is disabled.

The separate hooks.json checkbox uses its own marker block:

# Cursor Subagent Toggle: hooks config ignore
.cursor/hooks.json
# End Cursor Subagent Toggle

ํ•œ๊ตญ์–ด

Cursor Subagent Toggle์€ ๊ธฐ๋ณธ์ ์œผ๋กœ hooks๋ฅผ ๊ด€๋ฆฌํ•ด์„œ Cursor์˜ subagent ์ƒ์„ฑ ํ—ˆ์šฉ ์—ฌ๋ถ€๋ฅผ ์ œ์–ดํ•ฉ๋‹ˆ๋‹ค.

  • ๋กœ์ปฌ ์›Œํฌ์ŠคํŽ˜์ด์Šค hook ์„ค์ •: .cursor/hooks.json
  • ๋กœ์ปฌ ์›Œํฌ์ŠคํŽ˜์ด์Šค blocker script: .cursor/hooks/block-subagent.sh, .cursor/hooks/block-task-tool.sh
  • ์ „์—ญ ์‚ฌ์šฉ์ž hook ์„ค์ •: ~/.cursor/hooks.json
  • ์ „์—ญ blocker script: ~/.cursor/hooks/block-subagent.sh, ~/.cursor/hooks/block-task-tool.sh
  • ์„ ํƒ ๋กœ์ปฌ ์›Œํฌ์ŠคํŽ˜์ด์Šค ๊ด€๋ฆฌ rule: .cursor/rules/cursor-subagent-toggle.mdc

ํ™•์žฅ์€ ์ „์šฉ ์‚ฌ์ด๋“œ๋ฐ”์™€ status bar์—์„œ ์ „์—ญ/๋กœ์ปฌ ์ƒํƒœ๋ฅผ ํ•จ๊ป˜ ๋ณด์—ฌ์ฃผ๋ฉฐ, ๋ฉ€ํ‹ฐ ๋ฃจํŠธ ์›Œํฌ์ŠคํŽ˜์ด์Šค๋„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

์ฃผ์š” ๊ธฐ๋Šฅ

  • ์ „์—ญ ์นด๋“œ + ์›Œํฌ์ŠคํŽ˜์ด์Šค ํด๋”๋ณ„ ์นด๋“œ ์ œ๊ณต
  • ๋ฒ”์œ„๋ณ„ ์ž‘์€ ํ† ๊ธ€ ์Šค์œ„์น˜ ์ œ๊ณต
  • status bar์— ์ตœ์ข… ์ƒํƒœ ์‹ค์‹œ๊ฐ„ ์š”์•ฝ ํ‘œ์‹œ
  • ์–ธ์–ด ์„ ํƒ๊ธฐ (English / ํ•œ๊ตญ์–ด)
  • ์ปค์Šคํ…€ ๋˜๋Š” ์ผ๋ถ€ managed hook์— ๋Œ€ํ•œ ์•ˆ์ „ ๋ชจ๋“œ(CHECK ์ƒํƒœ)
  • Apply Recommended Config ๋ฒ„ํŠผ์œผ๋กœ ๊ด€๋ฆฌ preToolUse(Task) ๋ฐ subagentStart hook pair ์„ค์น˜
  • ๊ธฐ๋ณธ๊ฐ’์€ ๋‘ managed script๋ฅผ ์‚ฌ์šฉํ•˜๋Š” hooks-only ์ฐจ๋‹จ
  • subagent ๋น„ํ™œ์„ฑํ™” ์‹œ ๋” ๊ฐ•ํ•œ prompt-context ์ง€์‹œ๋ฅผ ์œ„ํ•œ managed project rule์€ workspace ๋”๋ณด๊ธฐ ํŒ์—… ์•ˆ์—์„œ ์ œ๊ณตํ•˜๋ฉฐ ๊ถŒ์žฅ off๋กœ ํ‘œ์‹œ
  • ์ƒ์„ฑ๋œ blocker script๋“ค๊ณผ ์„ ํƒ managed project rule ๊ฒฝ๋กœ๋งŒ .gitignore์— ์ถ”๊ฐ€ํ•˜๋Š” workspace ์ฒดํฌ๋ฐ•์Šค ์ œ๊ณต, ๊ถŒ์žฅ on์œผ๋กœ ํ‘œ์‹œ
  • .cursor/hooks.json ํŒŒ์ผ๋งŒ .gitignore์— ์ถ”๊ฐ€ํ•˜๋Š” ๋ณ„๋„ workspace ์ฒดํฌ๋ฐ•์Šค ์ œ๊ณต, ๊ถŒ์žฅ on์œผ๋กœ ํ‘œ์‹œ

ํ† ๊ธ€ ์˜๋ฏธ

  • ํ† ๊ธ€ ON: ํ•ด๋‹น ๋กœ์ปฌ ๋ฒ”์œ„์—์„œ subagent ์ƒ์„ฑ ํ—ˆ์šฉ
  • ํ† ๊ธ€ OFF: ํ•ด๋‹น ๋กœ์ปฌ ๋ฒ”์œ„์—์„œ managed blocker ํ™œ์„ฑํ™”
  • ์›Œํฌ์ŠคํŽ˜์ด์Šค OFF: managed deny hook ๋‘ ๊ฐœ์™€ managed hook script ๋‘ ๊ฐœ๋ฅผ ์ƒ์„ฑ
  • ์›Œํฌ์ŠคํŽ˜์ด์Šค ON: .cursor/hooks.json์—์„œ managed hook entry๋งŒ ์ œ๊ฑฐ
  • managed project rule์€ ๋”๋ณด๊ธฐ ํŒ์—… ์•ˆ์˜ workspace rule ์ฒดํฌ๋ฐ•์Šค๊ฐ€ ์ผœ์ ธ ์žˆ์„ ๋•Œ๋งŒ ์„ค์น˜
  • ๋”๋ณด๊ธฐ์˜ rule ์ฒดํฌ๋ฐ•์Šค๋ฅผ ๋„๋ฉด .cursor/rules/cursor-subagent-toggle.mdc๊ฐ€ extension ๊ด€๋ฆฌ ๋‚ด์šฉ๊ณผ ์ผ์น˜ํ•  ๋•Œ๋งŒ ์‚ญ์ œ
  • ์‚ฌ์šฉ์ž๊ฐ€ ๋งŒ๋“  ๊ธฐ์กด .cursor/rules/*.mdc ํŒŒ์ผ์€ ์ˆ˜์ •, ๋ณ‘ํ•ฉ, ์‚ญ์ œํ•˜์ง€ ์•Š์Œ
  • ๋กœ์ปฌ git ignore ์ฒดํฌ๋ฐ•์Šค๋Š” workspace .gitignore์— .cursor/hooks/block-subagent.sh, .cursor/hooks/block-task-tool.sh ๋ฐ ์„ ํƒ managed rule ๊ฒฝ๋กœ๋งŒ ์ถ”๊ฐ€
  • ์ฒดํฌ๋ฐ•์Šค๋Š” ์ƒ์„ฑ ํŒŒ์ผ ๊ฒฝ๋กœ๊ฐ€ ๋ชจ๋‘ workspace .gitignore์— ํฌํ•จ๋˜์–ด ์žˆ์„ ๋•Œ๋งŒ ์ฒดํฌ๋จ
  • ๋ณ„๋„ hooks.json ์ฒดํฌ๋ฐ•์Šค๋Š” workspace .gitignore์— .cursor/hooks.json ํŒŒ์ผ๋งŒ ์ถ”๊ฐ€
  • hooks.json ์ฒดํฌ๋ฐ•์Šค๋Š” .cursor/hooks.json์ด workspace .gitignore์— ํฌํ•จ๋˜์–ด ์žˆ์„ ๋•Œ๋งŒ ์ฒดํฌ๋จ
  • ์ฒดํฌ๋ฐ•์Šค๋ฅผ ๋„๋ฉด extension์ด ๋งŒ๋“  .gitignore marker block๋งŒ ์ œ๊ฑฐํ•˜๊ณ , ์‚ฌ์šฉ์ž๊ฐ€ ์ •์˜ํ•œ ignore rule์€ ๊ทธ๋Œ€๋กœ ๋‘ 
  • ์ „์—ญ OFF: ์ „์—ญ deny hooks๋งŒ ์ ์šฉ. workspace managed rule์€ ํ•ด๋‹น ํด๋”์˜ ๋”๋ณด๊ธฐ ์„ ํƒ rule ์ฒดํฌ๋ฐ•์Šค๊ฐ€ ์ผœ์ ธ ์žˆ์„ ๋•Œ๋งŒ ์„ค์น˜
  • ์ „์—ญ ON: ์ „์—ญ deny hooks๋ฅผ ์ œ๊ฑฐํ•˜๊ณ , ๋กœ์ปฌ์ด OFF๊ฐ€ ์•„๋‹Œ workspace folder์—์„œ๋งŒ managed project rule ์‚ญ์ œ
  • ์ตœ์ข… ์ƒํƒœ๋Š” Cursor ๋ฒ”์œ„ ์šฐ์„ ์ˆœ์œ„์˜ ์˜ํ–ฅ์„ ๋ฐ›์œผ๋ฉฐ, ์ „์—ญ ์ฐจ๋‹จ์ด ๋กœ์ปฌ ์ƒํƒœ๋ฅผ overrideํ•  ์ˆ˜ ์žˆ์Œ

์ƒํƒœ ๋ชจ๋ธ

  • ๐ŸŸข ON: ์ฐจ๋‹จ hook ์—†์Œ
  • ๐Ÿ”ด OFF: managed ์ฐจ๋‹จ hook ์ ์šฉ๋จ
  • ๐ŸŸก MIXED: ๋ฉ€ํ‹ฐ ๋ฃจํŠธ์—์„œ ํด๋”๋ณ„ ์ตœ์ข… ์ƒํƒœ๊ฐ€ ๋‹ค๋ฆ„
  • โšช CHECK: ์ปค์Šคํ…€ ๋˜๋Š” ์ผ๋ถ€ managed hook์ด ์žˆ์–ด ON/OFF๋ฅผ ์•ˆ์ „ํ•˜๊ฒŒ ๋‹จ์ •ํ•  ์ˆ˜ ์—†์Œ
  • ๐ŸŸ  ERROR: hooks.json ํŒŒ์‹ฑ ์˜ค๋ฅ˜ ๋˜๋Š” managed ์Šคํฌ๋ฆฝํŠธ ๋ˆ„๋ฝ

์‚ฌ์ด๋“œ๋ฐ”๋Š” ์„ ํƒ managed project rule ์ƒํƒœ๋„ ํ•จ๊ป˜ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

  • ๊ด€๋ฆฌ๋จ: extension์ด ๊ด€๋ฆฌํ•˜๋Š” project rule์ด ์žˆ๊ณ  ์˜ˆ์ƒ ๋‚ด์šฉ๊ณผ ์ผ์น˜ํ•จ
  • ์—†์Œ: ๋”๋ณด๊ธฐ์˜ ์„ ํƒ rule ์ฒดํฌ๋ฐ•์Šค๊ฐ€ ์ผœ์ ธ ์žˆ๊ณ  ์ตœ์ข… ์ƒํƒœ๊ฐ€ ์ฐจ๋‹จ์ธ๋ฐ managed project rule์ด ์—†์Œ
  • ์ˆ˜์ •๋จ - ๋ณดํ˜ธ: managed project rule ํŒŒ์ผ์ด ์žˆ์ง€๋งŒ extension ๋‚ด์šฉ๊ณผ ๋‹ค๋ฆ„. extension์€ ์ˆ˜์ •๋œ rule ๋‚ด์šฉ์„ ์‚ญ์ œํ•˜์ง€ ์•Š์Œ

workspace ์นด๋“œ๋Š” ์ƒ์„ฑ blocker ๊ฒฝ๋กœ๋“ค๊ณผ hooks.json์ด git์—์„œ ๋ฌด์‹œ๋˜๋Š”์ง€๋„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค. extension์ด ๋งŒ๋“  block ๋ฐ–์— ๋™์ผํ•œ ignore entry๋“ค์ด ์ด๋ฏธ ์žˆ์œผ๋ฉด ์ด๋ฏธ ๋ฌด์‹œ๋จ์œผ๋กœ ํ‘œ์‹œํ•˜๊ณ  extension์ด ์‚ญ์ œํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

Managed Hook ํ˜•ํƒœ

์›Œํฌ์ŠคํŽ˜์ด์Šค ์ฐจ๋‹จ command:

{
  "version": 1,
  "hooks": {
    "preToolUse": [
      {
        "command": "bash .cursor/hooks/block-task-tool.sh",
        "matcher": "Task",
        "failClosed": true
      }
    ],
    "subagentStart": [
      {
        "command": "bash .cursor/hooks/block-subagent.sh",
        "failClosed": true
      }
    ]
  }
}

์ „์—ญ ์ฐจ๋‹จ command:

{
  "version": 1,
  "hooks": {
    "sessionStart": [
      {
        "command": "bash ./hooks/inject-ask-context.sh"
      }
    ],
    "preToolUse": [
      {
        "command": "bash ./hooks/block-task-tool.sh",
        "matcher": "Task",
        "failClosed": true
      }
    ],
    "subagentStart": [
      {
        "command": "bash ./hooks/block-subagent.sh",
        "failClosed": true
      }
    ]
  }
}

sessionStart ๊ฐ™์€ ๊ธฐ์กด non-managed hook์€ ์ „์—ญ blocker๋ฅผ ์ ์šฉํ•˜๊ฑฐ๋‚˜ ํ† ๊ธ€ํ•ด๋„ ์œ ์ง€๋ฉ๋‹ˆ๋‹ค.

Optional Managed Project Rule

์›Œํฌ์ŠคํŽ˜์ด์Šค์— prompt-context ๋ณดํ˜ธ๊ฐ€ ํ•„์š”ํ•˜๊ณ  ๋”๋ณด๊ธฐ์˜ rule ์ฒดํฌ๋ฐ•์Šค๊ฐ€ ์ผœ์ ธ ์žˆ์„ ๋•Œ extension์€ ์•„๋ž˜ ํŒŒ์ผ ํ•˜๋‚˜๋งŒ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

.cursor/rules/cursor-subagent-toggle.mdc

rule์€ ์•„๋ž˜ ๋ฌธ๊ตฌ๋กœ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

# [DO NOT CALL SUBAGENTS]

๋˜ํ•œ ์ด rule์ด ์›Œํฌ์ŠคํŽ˜์ด์Šค์˜ higher-priority safety override์ด๋ฉฐ, ์ถฉ๋Œํ•˜๋Š” Cursor rule, project rule, user rule, instruction, prompt๋ณด๋‹ค no-subagent rule์„ ์šฐ์„ ํ•ด์•ผ ํ•œ๋‹ค๊ณ  ๋ช…์‹œํ•ฉ๋‹ˆ๋‹ค.

Managed Git Ignore Entry

๋กœ์ปฌ git ignore ์ฒดํฌ๋ฐ•์Šค๊ฐ€ ํ™œ์„ฑํ™”๋˜์–ด ์žˆ์œผ๋ฉด extension์€ workspace .gitignore์— ์•„๋ž˜ ์ƒ์„ฑ ํŒŒ์ผ ๊ฒฝ๋กœ๋งŒ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

# Cursor Subagent Toggle: managed generated files
.cursor/hooks/block-subagent.sh
.cursor/hooks/block-task-tool.sh
.cursor/rules/cursor-subagent-toggle.mdc
# End Cursor Subagent Toggle

์ฒดํฌ๋ฐ•์Šค๋ฅผ ๋Œ ๋•Œ๋Š” ์ด marker block๋งŒ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.

๋ณ„๋„ hooks.json ์ฒดํฌ๋ฐ•์Šค๋Š” ์ž์ฒด marker block์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

# Cursor Subagent Toggle: hooks config ignore
.cursor/hooks.json
# End Cursor Subagent Toggle

Development

Run the full local verification before packaging or publishing:

npm run check

This runs TypeScript compilation and the Vitest unit test suite for the shared hook/gitignore helpers.

License

This project is UNLICENSED. See LICENSE for the full all-rights-reserved notice.

๊ฐœ๋ฐœ

ํŒจํ‚ค์ง• ๋˜๋Š” ๋ฐฐํฌ ์ „ ์•„๋ž˜ ๋ช…๋ น์œผ๋กœ ์ „์ฒด ๋กœ์ปฌ ๊ฒ€์ฆ์„ ์‹คํ–‰ํ•˜์„ธ์š”.

npm run check

์ด ๋ช…๋ น์€ TypeScript ์ปดํŒŒ์ผ๊ณผ hook/gitignore ๊ณต์šฉ helper์— ๋Œ€ํ•œ Vitest ๋‹จ์œ„ ํ…Œ์ŠคํŠธ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

๋ผ์ด์„ ์Šค

์ด ํ”„๋กœ์ ํŠธ๋Š” UNLICENSED์ž…๋‹ˆ๋‹ค. ์ „์ฒด all-rights-reserved ๊ณ ์ง€๋Š” LICENSE๋ฅผ ํ™•์ธํ•˜์„ธ์š”.

About

cursor subagent toggle button

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages