{"record":{"id":"0d9fc693bac47359","repo":"rtk-ai/rtk","slug":"vibe-support-is-global-only-use-rtk-init-g-ag","errorCode":null,"errorMessage":"Vibe support is global-only. Use: rtk init -g --agent vibe","messagePattern":"Vibe support is global-only\\. Use: rtk init -g --agent vibe","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/hooks/init.rs","lineNumber":4470,"sourceCode":"fn resolve_vibe_dir() -> Result<PathBuf> {\n    resolve_home_subdir(VIBE_DIR)\n}\n\n/// Entry point for `rtk init -g --agent vibe`.\n///\n/// Installs a `pre_tool` hook into `~/.vibe/hooks.toml` (Vibe CLI's hook\n/// registry, see https://docs.mistral.ai/vibe/code/cli/hooks) that routes\n/// bash tool calls through the native `rtk hook vibe` binary. When not\n/// `hook_only`, also drops an `~/.vibe/prompts/rtk.md` system prompt file\n/// as a belt-and-suspenders fallback if the hook is disabled.\npub fn run_vibe_mode(\n    global: bool,\n    hook_only: bool,\n    patch_mode: PatchMode,\n    ctx: InitContext,\n) -> Result<()> {\n    if !global {\n        anyhow::bail!(\"Vibe support is global-only. Use: rtk init -g --agent vibe\");\n    }\n    let vibe_dir = resolve_vibe_dir()?;\n    run_vibe_mode_at(&vibe_dir, hook_only, patch_mode, ctx)\n}\n\nfn run_vibe_mode_at(\n    vibe_dir: &Path,\n    hook_only: bool,\n    patch_mode: PatchMode,\n    ctx: InitContext,\n) -> Result<()> {\n    let InitContext { dry_run, .. } = ctx;\n    if !dry_run {\n        fs::create_dir_all(vibe_dir)\n            .with_context(|| format!(\"Failed to create Vibe config dir: {}\", vibe_dir.display()))?;\n    }\n\n    let hooks_path = vibe_dir.join(VIBE_HOOKS_FILE);","sourceCodeStart":4452,"sourceCodeEnd":4488,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/hooks/init.rs#L4452-L4488","documentation":"Vibe support installs a pre_tool hook into ~/.vibe/hooks.toml (Vibe CLI's global hook registry) and, unless --hook-only, also drops ~/.vibe/prompts/rtk.md. Both are user-global, so run_vibe_mode bails on a project-scoped invocation before resolving or creating anything.","triggerScenarios":"`rtk init --agent vibe` without `-g` — src/hooks/init.rs:4478.","commonSituations":"New Vibe users copying a generic init command; automation running without a writable HOME.","solutions":["Run `rtk init -g --agent vibe`","Add --hook-only if you only want the hook and not the prompt file: `rtk init -g --agent vibe --hook-only`"],"exampleFix":"# before\nrtk init --agent vibe   # error: global-only\n\n# after\nrtk init -g --agent vibe","handlingStrategy":"validation","validationCode":"# bash: vibe is global-only\nrtk init -g --agent vibe --dry-run   # preview writes to ~/.vibe","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair vibe with -g; add --hook-only when you do not want the prompt file","Back up ~/.vibe/hooks.toml before init if you maintain it by hand"],"tags":["cli","init","vibe","agent-scoping","validation"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}