Skip to content

rtk init --uninstall -g --agent kilocode (and windsurf/cline/antigravity/kimi) runs the Claude uninstaller instead — removing Claude's config and nothing of the named agent #3404

Open

Description

@HetCreep

The uninstall dispatcher handles four agents explicitly and sends everything else to the Claude uninstaller, so five of the ten --agent values do the wrong thing in both directions: they modify Claude's configuration, and they leave the named agent's files untouched.

Provenance: AI-assisted source audit, human-directed, at v0.44.2 (700bdde). Read from source; rtk init --uninstall was not executed (it writes to a real home directory).

The dispatch

src/main.rs:1565-1573:

if agent == Some(AgentTarget::Hermes) {
    uninstall_hermes(ctx)
} else if agent == Some(AgentTarget::Droid) {
    hooks::init::uninstall_droid(global, ctx)
} else {
    let cursor = agent == Some(AgentTarget::Cursor);
    let pi = agent == Some(AgentTarget::Pi);
    uninstall_standard(global, gemini, codex, cursor, pi, ctx)
}

AgentTarget (main.rs:37-58) has ten variants: Claude, Cursor, Windsurf, Cline, Kilocode, Antigravity, Kimi, Pi, Hermes, Droid.

Four are routed (Hermes, Droid, Cursor, Pi). Claude is correctly the default. The remaining five — Windsurf, Cline, Kilocode, Antigravity, Kimi — fall into the else with both cursor and pi false, which is exactly the Claude path: hooks::init::uninstall resolves resolve_claude_dir() (init.rs:694) and proceeds to remove Claude's artifacts.

What the user gets

rtk init --uninstall -g --agent kilocode reports success while having:

  • deleted ~/.claude/RTK.md
  • rewritten ~/.claude/CLAUDE.md
  • stripped the rtk hook from ~/.claude/settings.json
  • removed nothing for Kilo Code

A user who runs rtk with both Claude Code and Kilo Code, and wants to remove only the Kilo Code integration, loses their Claude integration instead.

Compounding: those five agents have no uninstall path at all

The install side writes rtk blocks into project rules files for these agents — .clinerules, .windsurfrules, .kilocode/rules/rtk-rules.md, .agents/rules/*.md (init.rs:1660, :1705, :1760, :1817) — and no function anywhere removes them. So even a correct dispatch would have nothing to call: the block stays in a user-authored, usually-committed rules file with no supported way to remove it.

Suggested fix (untested — no programmer has reviewed this)

Two parts, and the first is worth doing even if the second is deferred:

  1. Fail closed rather than falling through. Give the dispatcher an explicit arm per variant and return an error like uninstall is not supported for --agent kilocode for the ones with no uninstaller. A clear "not supported" is strictly better than silently uninstalling a different agent. A match on AgentTarget instead of an if/else chain would also make the compiler flag the next variant someone adds.
  2. Add the missing uninstallers for windsurf/cline/kilocode/antigravity/kimi, or document that their rules-file blocks must be removed by hand — the codex path already does this honestly (init.rs:872: "manually remove RTK from AGENTS.md").

Testing

Not executed — running it would modify the real ~/.claude. The dispatch is a straight read of main.rs:1565-1573 against the AgentTarget enum, and the absence of uninstall functions for those five agents was confirmed by searching init.rs for their install sites' counterparts.

Activity

  1. added
    bug
    help wanted
    on Aug 4, 2026
  2. pszymkowiak commented on Aug 4, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 92%

    Summary

    Uninstall dispatcher falls through to the Claude uninstaller for 5 of 10 --agent values (windsurf/cline/kilocode/antigravity/kimi), silently deleting the user's Claude config instead of the named agent's; those agents also have no uninstall path at all — fix by making the dispatch exhaustive (match on AgentTarget) and failing closed for unsupported agents.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/main.rs
    • src/hooks/init.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. HetCreep commented on Oct 14, 2026

    @HetCreep
    Author

    Re-checked on v1.0.0 (stable, 2026-10-13): the official release binary plus the v1.0.0 source. Provenance: AI-assisted check, human-directed. "ran" = executed against rtk 1.0.0 with a control; "read" = verified from source only.

    Fixed (read, static): Antigravity (and Trae). uninstall_init_dispatch (src/lib.rs:2277-2291) now routes Hermes, Trae, Antigravity (uninstall_antigravity_mode), Droid and Vibe to their own uninstallers. Thanks.

    Still live at v1.0.0: Windsurf, Cline, Kilocode and Kimi (the AgentTarget enum, lib.rs:42-69) still fall through the else branch to uninstall_with_patch_mode (src/hooks/init/mod.rs:1395), i.e. the Claude uninstaller against ~/.claude; there is no error arm and no fn uninstall_* for their rules blocks (grep 'fn uninstall_' src/hooks/init). The call site at lib.rs:2899 has no agent guard.

    Static read only; I did not run the uninstaller because it writes real agent config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliarea:configbughelp wantedpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions