rtk-ai/rtk · error

Antigravity is project-scoped. Use: rtk init --agent antigra

Error message

Antigravity is project-scoped. Use: rtk init --agent antigravity

What it means

The Antigravity integration is project-scoped (files inside the workspace), so rtk rejects `--global` to avoid writing to a nonexistent global location. Same validation family as the kilocode bail, opposite direction from windsurf/gemini.

Source

Thrown at src/main.rs:2063

                    hooks::init::PatchMode::Ask
                };
                hooks::init::run_gemini(global, hook_only, patch_mode, ctx)?;
            } else if copilot {
                if global {
                    hooks::init::run_copilot_global(ctx)?;
                } else {
                    hooks::init::run_copilot(ctx)?;
                }
            } else if agent == Some(AgentTarget::Pi) {
                hooks::init::run_pi_mode(global, ctx)?
            } else if agent == Some(AgentTarget::Kilocode) {
                if global {
                    anyhow::bail!("Kilo Code is project-scoped. Use: rtk init --agent kilocode");
                }
                hooks::init::run_kilocode_mode(ctx)?;
            } else if agent == Some(AgentTarget::Antigravity) {
                if global {
                    anyhow::bail!(
                        "Antigravity is project-scoped. Use: rtk init --agent antigravity"
                    );
                }
                hooks::init::run_antigravity_mode(ctx)?;
            } else if agent == Some(AgentTarget::Kimi) {
                if global {
                    anyhow::bail!("Kimi AI is project-scoped. Use: rtk init --agent kimi");
                }
                hooks::init::run_kimi_mode(ctx)?;
            } else if agent == Some(AgentTarget::Hermes) {
                hooks::init::run_hermes_mode(ctx)?;
            } else if agent == Some(AgentTarget::Droid) {
                hooks::init::run_droid_mode(global, ctx)?;
            } else if agent == Some(AgentTarget::Vibe) {
                let patch_mode = if auto_patch {
                    hooks::init::PatchMode::Auto
                } else if no_patch {
                    hooks::init::PatchMode::Skip

View on GitHub (pinned to d977e1c316)

Solutions

  1. Run `rtk init --agent antigravity` from the project root, without -g
  2. If scripting machine setup, iterate over project dirs rather than using -g

Example fix

# before
rtk init -g --agent antigravity   # error: project-scoped

# after
rtk init --agent antigravity
Defensive patterns

Strategy: validation

Validate before calling

# bash: antigravity is project-scoped
rtk init --agent antigravity   # from the project root, no -g

Prevention

When it happens

Trigger: `rtk init -g --agent antigravity` (or --global) — the bail at src/main.rs:2065.

Common situations: Scripts that always pass -g; docs drift mixing up which agents are global vs project scoped.

Related errors


AI-assisted analysis of rtk-ai/rtk@d977e1c316 (2026-08-16). Data as JSON: /api/errors/5cdf7e8f7b5b3f72. Report an issue: GitHub.