{"record":{"id":"1964c14bdd5a8ddf","repo":"rtk-ai/rtk","slug":"uninstall-only-works-with-global-flag-for-local","errorCode":null,"errorMessage":"Uninstall only works with --global flag. For local projects, manually remove RTK from CLAUDE.md","messagePattern":"Uninstall only works with --global flag\\. For local projects, manually remove RTK from CLAUDE\\.md","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/hooks/init.rs","lineNumber":692,"sourceCode":"            if !dry_run {\n                println!(\"\\nRestart Cursor to apply changes.\");\n            }\n        } else {\n            println!(\"RTK Cursor support was not installed (nothing to remove)\");\n        }\n        if dry_run {\n            print_dry_run_footer();\n        }\n        return Ok(());\n    }\n\n    if pi {\n        uninstall_pi(global, ctx)?;\n        return Ok(());\n    }\n\n    if !global {\n        anyhow::bail!(\"Uninstall only works with --global flag. For local projects, manually remove RTK from CLAUDE.md\");\n    }\n\n    let claude_dir = resolve_claude_dir()?;\n    let mut removed = Vec::new();\n\n    // Also uninstall Gemini artifacts if --gemini or always (clean everything)\n    if gemini {\n        let gemini_removed = uninstall_gemini(ctx)?;\n        removed.extend(gemini_removed);\n        if !removed.is_empty() {\n            let header = if dry_run {\n                \"[dry-run] would uninstall RTK (Gemini):\"\n            } else {\n                \"RTK uninstalled (Gemini):\"\n            };\n            println!(\"{}\", header);\n            for item in &removed {\n                println!(\"  - {}\", item);","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/hooks/init.rs#L674-L710","documentation":"Global uninstall removes RTK hooks from ~/.claude and the global CLAUDE.md; RTK intentionally ships no uninstaller for per-project CLAUDE.md edits because that file is user-owned. Run without --global (and after the codex/cursor/pi special cases return early), it bails and points at the manual path.","triggerScenarios":"`rtk uninstall` with no `--global` flag — src/hooks/init.rs:694.","commonSituations":"Trying to undo a local `rtk init` in a repo after abandoning RTK; expecting uninstall to be symmetric with every install mode.","solutions":["Remove the RTK block (between the rtk-instructions markers) and the '@RTK.md' reference from ./CLAUDE.md by hand, plus any local .claude/settings.json hooks rtk added","Run `rtk uninstall --global` if the goal was cleaning the machine-wide install","Commit the CLAUDE.md removal so teammates' copies are cleaned too"],"exampleFix":"# error path\nrtk uninstall                 # bails: global-only\n\n# what a project cleanup actually needs\nedit ./CLAUDE.md               # delete the rtk-instructions block and '@RTK.md' line\nrtk uninstall --global        # only if you also meant the global install","handlingStrategy":"validation","validationCode":"# bash: decide intent before running uninstall\n# project cleanup → manual edit; machine cleanup → --global\n[ \"$SCOPE\" = project ] && { echo 'edit ./CLAUDE.md manually'; exit 0; }\nrtk uninstall --global","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep RTK blocks in CLAUDE.md inside reviewable commits so manual removal is a git revert","Document in the team README that project uninstall is manual by design","Note which local artifacts a local init creates (CLAUDE.md block, @RTK.md ref, .claude/settings.json hooks) so the manual cleanup is complete"],"tags":["cli","uninstall","claude-md","project-scope"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}