{"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":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":2058,"sourceCode":"                let patch_mode = if auto_patch {\n                    hooks::init::PatchMode::Auto\n                } else if no_patch {\n                    hooks::init::PatchMode::Skip\n                } else {\n                    hooks::init::PatchMode::Ask\n                };\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(global, 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":2040,"sourceCodeEnd":2076,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/main.rs#L2040-L2076","documentation":"The Kilo Code integration is written into project files (.kilocode workspace rules), so there is no global install; rtk rejects `--global` to avoid writing to a nonexistent global location. Mirror image of the windsurf/gemini-style global-only errors — same validation family, opposite direction.","triggerScenarios":"`rtk init -g --agent kilocode` (or --global) — the bail at src/main.rs:2060.","commonSituations":"Wrapper scripts that always pass -g for 'machine setup'; copy-pasting another agent's -g invocation.","solutions":["Run `rtk init --agent kilocode` from the project root, without -g","For per-machine provisioning, loop over project directories instead of relying on -g"],"exampleFix":"# before\nrtk init -g --agent kilocode   # error: project-scoped\n\n# after\nrtk init --agent kilocode","handlingStrategy":"validation","validationCode":"# bash: project-scoped agents must not receive -g\ncase \"$AGENT\" in kilocode|antigravity|kimi) GLOBAL_FLAG='';; *) GLOBAL_FLAG='-g';; esac\nrtk init $GLOBAL_FLAG --agent \"$AGENT\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize the agent→scope mapping in one setup script instead of copy-pasting per-agent commands","For machine provisioning, loop over project directories for kilocode rather than using -g"],"tags":["cli","init","kilocode","agent-scoping","validation"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}