{"record":{"id":"07bbfb90669b29e5","repo":"rtk-ai/rtk","slug":"cursor-hooks-are-global-only-use-rtk-init-g-a","errorCode":null,"errorMessage":"Cursor hooks are global-only. Use: rtk init -g --agent cursor","messagePattern":"Cursor hooks are global-only\\. Use: rtk init -g --agent cursor","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/init.rs","lineNumber":420,"sourceCode":"        }\n        if hook_only {\n            anyhow::bail!(\"--codex cannot be combined with --hook-only\");\n        }\n        if matches!(patch_mode, PatchMode::Auto) {\n            anyhow::bail!(\"--codex cannot be combined with --auto-patch\");\n        }\n        if matches!(patch_mode, PatchMode::Skip) {\n            anyhow::bail!(\"--codex cannot be combined with --no-patch\");\n        }\n        run_codex_mode(global, ctx)?;\n    } else {\n        // Validation: Global-only features\n        if install_opencode && !global {\n            anyhow::bail!(\"OpenCode plugin is global-only. Use: rtk init -g --opencode\");\n        }\n\n        if install_cursor && !global {\n            anyhow::bail!(\"Cursor hooks are global-only. Use: rtk init -g --agent cursor\");\n        }\n\n        if install_windsurf && !global {\n            anyhow::bail!(\"Windsurf support is global-only. Use: rtk init -g --agent windsurf\");\n        }\n\n        if install_windsurf {\n            run_windsurf_mode(ctx)?;\n        } else if install_cline {\n            run_cline_mode(ctx)?;\n        } else {\n            // Mode selection (Claude Code / OpenCode)\n            match (install_claude, install_opencode, claude_md, hook_only) {\n                (false, true, _, _) => run_opencode_only_mode(ctx)?,\n                (true, opencode, true, _) => run_claude_md_mode(global, opencode, ctx)?,\n                (true, opencode, false, true) => {\n                    run_hook_only_mode(global, patch_mode, opencode, ctx)?\n                }","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/hooks/init.rs#L402-L438","documentation":"rtk's `init` command throws this when `--agent cursor` (or equivalent install_cursor flag) is passed without the `-g/--global` flag. Cursor hook integration writes to the user-level global Cursor configuration only, so a project-local install is unsupported by design. The error tells you the exact remediation command.","triggerScenarios":"Calling `rtk init --agent cursor` (install_cursor=true, global=false). The bail fires in run() at the global-only validation block in src/hooks/init.rs:419-421, before any mode dispatch.","commonSituations":"Running `rtk init --agent cursor` inside a repo intending project-scoped hooks; forgetting `-g` after upgrading rtk where Cursor support was added as global-only; scripting rtk setup for multiple editors and reusing the non-global invocation pattern used for claude/opencode.","solutions":["Re-run with the global flag: `rtk init -g --agent cursor`.","If you truly want project-local Cursor integration, remove `--agent cursor` and integrate RTK into the project's Cursor config manually.","Check `rtk init --help` to confirm which agents are global-only (cursor, windsurf, opencode) vs project-local."],"exampleFix":"// before (shell)\nrtk init --agent cursor\n// after (shell)\nrtk init -g --agent cursor","handlingStrategy":"validation","validationCode":"// shell check before invoking rtk init with cursor\nif [[ \"$*\" == *\"--agent cursor\"* && \"$*\" != *\"-g\"* && \"$*\" != *\"--global\"* ]]; then\n  echo \"refusing: cursor install requires -g\"; exit 1;\nfi\nrtk init -g --agent cursor","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember cursor/windsurf/opencode installs are global-only; always pair them with -g.","Wrap team setup scripts to include `-g` for global-only agents.","Check `rtk init --help` when scripting new agent installs."],"tags":["cli","configuration","cursor","global-only"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"0924356b4caba4989607227b7c8824d3d8098719","analyzedAt":"2026-09-19T19:25:29.612Z","contentChangedAt":"2026-09-19T19:25:29.612Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}