Skip to content

rtk init --agent antigravity leaves the rules file written by earlier releases in place, on install and on uninstall #4317

Closed

Description

@KuSh

What happens

Every release up to now answers rtk init --agent antigravity by writing .agents/rules/antigravity-rtk-rules.md: the full awareness text in a new file, or that text appended after a blank line to a file that already existed (run_antigravity_mode_at in src/hooks/init/instructions_agents.rs; a file already mentioning rtk or RTK is skipped). #3711 replaces that mode with a plugin bundle at .agents/plugins/rtk/ whose rules/AGENTS.md carries the awareness text at the configured awareness.level, and it no longer knows about the old file:

$ rtk init --agent antigravity          # earlier release
$ rtk init --agent antigravity          # after #3711
$ find .agents -type f
.agents/plugins/rtk/hooks.json
.agents/plugins/rtk/plugin.json
.agents/plugins/rtk/rules/AGENTS.md
.agents/rules/antigravity-rtk-rules.md   # still there
$ rtk init --agent antigravity --uninstall
$ find .agents -type f
.agents/rules/antigravity-rtk-rules.md   # still there

An upgraded workspace can then carry two awareness texts, the old full one and the plugin's configured level, and uninstall leaves a file RTK wrote. The Antigravity docs bundled with agy 1.2.12 list .agents/rules/*.md among the rule paths; #2916 reports such a file needs trigger: always_on frontmatter to load at startup, so whether the old file is still active depends on the release that wrote it.

What a fix has to do

The sibling agents migrate their own legacy artefacts (remove_legacy_settings_entries in claude.rs, the Cursor and Droid equivalents). For this file:

  • A file whose content is exactly an awareness text an earlier release wrote: remove it, on install and on uninstall, in the workspace the command runs in, including a -g install run from inside that workspace.
  • A file where that text follows the user's own content after a blank line: remove only RTK's suffix and keep the rest byte-identical.
  • Any other file at that path, including one the earlier writer skipped because it already mentioned rtk: leave it alone and say nothing.
  • Dry runs report what would be removed and change nothing.
  • Pin each case with a process-level test.

Found while reviewing #3711, which lands without the migration.

Activity

  1. added
    bug
    help wanted
    on Sep 28, 2026
  2. rtk-wshm-sync-bot commented on Sep 28, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 90%

    Summary

    rtk init --agent antigravity's #3711 plugin migration doesn't clean up or account for the legacy antigravity-rtk-rules.md file on install/uninstall

    📁 Relevant files
    • src/hooks/init/instructions_agents.rs
    • src/hooks/init/claude.rs

    Suggested Actions

    1. Add a legacy-migration step for antigravity mirroring remove_legacy_settings_entries in claude.rs
    2. Detect exact-match legacy awareness text vs. user content + appended suffix, per spec in the issue
    3. Ensure migration runs on install, uninstall, and -g install from within the workspace
    4. Add process-level tests for each case (exact match, suffix removal, untouched file, dry-run)

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

  3. added a commit that references this issue on Oct 23, 2026
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:clibughelp wantedpriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions