{"record":{"id":"e1d47b1fb8c54da1","repo":"rtk-ai/rtk","slug":"kilo-code-is-project-scoped-use-rtk-init-agent","errorCode":null,"errorMessage":"Kilo Code is project-scoped. Use: rtk init --agent kilocode","messagePattern":"Kilo Code is project-scoped\\. Use: rtk init --agent kilocode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":2446,"sourceCode":"                    hooks::init::uninstall_with_patch_mode,\n                )?;\n            } else if gemini {\n                hooks::init::run_gemini(global, hook_only, patch_mode, ctx)?;\n            } else if copilot {\n                if global {\n                    hooks::init::run_copilot_global(ctx)?;\n                } else {\n                    hooks::init::run_copilot(ctx)?;\n                }\n            } else if agent == Some(AgentTarget::Pi) {\n                hooks::init::run_pi_mode_with_patch_mode(global, patch_mode, ctx)?\n            } else if agent == Some(AgentTarget::Trae) {\n                hooks::init::run_trae_mode(global, ctx)?\n            } else if agent == Some(AgentTarget::Omp) {\n                hooks::init::run_omp_mode_with_patch_mode(global, patch_mode, ctx)?\n            } else if agent == Some(AgentTarget::Kilocode) {\n                if global {\n                    anyhow::bail!(\"Kilo Code is project-scoped. Use: rtk init --agent kilocode\");\n                }\n                hooks::init::run_kilocode_mode(ctx)?;\n            } else if agent == Some(AgentTarget::Antigravity) {\n                if global {\n                    anyhow::bail!(\n                        \"Antigravity is project-scoped. Use: rtk init --agent antigravity\"\n                    );\n                }\n                hooks::init::run_antigravity_mode(ctx)?;\n            } else if agent == Some(AgentTarget::Kimi) {\n                if global {\n                    anyhow::bail!(\"Kimi AI is project-scoped. Use: rtk init --agent kimi\");\n                }\n                hooks::init::run_kimi_mode(ctx)?;\n            } else if agent == Some(AgentTarget::Hermes) {\n                hooks::init::run_hermes_mode(ctx)?;\n            } else if agent == Some(AgentTarget::Droid) {\n                hooks::init::run_droid_mode(global, ctx)?;","sourceCodeStart":2428,"sourceCodeEnd":2464,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/main.rs#L2428-L2464","documentation":"rtk's `rtk init --agent kilocode` configures Kilo Code hooks only at the project level (writing project-local config in the current repo). The library intentionally refuses the `--global` variant because Kilo Code has no supported global installation mode, and `anyhow::bail!` aborts the init command with this message instead of half-configuring a global setup.","triggerScenarios":"Running `rtk init --agent kilocode --global` (or an equivalent global flag) reaches src/main.rs:2446 where `agent == Some(AgentTarget::Kilocode)` and `global == true`.","commonSituations":"A developer wants Kilo Code hooks available across all repos and adds `--global` out of habit from other agents (Claude, Trae, Omp, Droid) that do support global mode; scripts migrated from another agent's init line.","solutions":["Drop the `--global` flag: run `rtk init --agent kilocode` inside the project root you want configured","If you need Kilo Code in many repos, script the project-scoped init in each repo (e.g. a bootstrap script that cd's into each repo and runs the init)","Use a different agent that supports global mode if a machine-wide setup is a hard requirement"],"exampleFix":"// before\nrtk init --agent kilocode --global\n// after\nrtk init --agent kilocode","handlingStrategy":"validation","validationCode":"// shell guard before invoking rtk\nif [[ \"$RTK_INIT_FLAGS\" == *--global* ]]; then echo \"kilocode is project-scoped; drop --global\"; exit 1; fi","typeGuard":null,"tryCatchPattern":"// Rust caller\nmatch rtk_init_kilocode(global) {\n    Err(e) if e.to_string().contains(\"project-scoped\") => retry_project_scoped(),\n    Err(e) => return Err(e.context(\"rtk init failed\")),\n    Ok(v) => Ok(v),\n}","preventionTips":["Remember Kilocode/Antigravity/Kimi are project-scoped; only pass --global for agents that support it","Verify scope support with `rtk init --help` before scripting","Run init from the repository root so the project-scoped config lands in the right place"],"tags":["cli","init","kilocode","project-scope"],"backgroundTag":"unsupported-operation","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"}