Skip to content

[BUG] rtk init -g --gemini clobbers ~/.gemini/GEMINI.md instead of appending #834

Open

Description

@bnaylor

Summary

Running rtk init -g --gemini (and similar init commands) currently performs a full file overwrite of GEMINI.md or RTK.md, destroying any existing user notes or configuration in those files.

Steps to Reproduce

  1. Create a ~/.gemini/GEMINI.md with some custom content.
  2. Run rtk init -g --gemini.
  3. Observe that your custom content has been replaced entirely by the RTK instructions.

Expected Behavior

RTK should manage its own block of instructions (using markers) and append or update only that block, preserving all other content in the file.

Proposed Fix

I have a fix ready that:

  • Implements upsert_write_rtk_block for instruction files.
  • Implements remove_rtk_block_from_file for safer uninstalls.
  • Uses markers <!-- rtk-instructions v2 --> to identify RTK's block.
  • Ensures all updates are atomic to prevent corruption.

PR incoming shortly.

Activity

  1. added
    bug
    effort-medium
    on Mar 26, 2026
  2. pszymkowiak commented on Mar 26, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 95%

    Summary

    rtk init --gemini destructively overwrites GEMINI.md/RTK.md, losing user content; should upsert a marker-delimited block instead — PR incoming from reporter


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

  3. markmcd commented on May 28, 2026

    @markmcd

    Just had this hit me too. Please add backups when editing files so, worst-case, you don't completely destroy someone's setup during your onboarding process.

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:clibugeffort-mediumpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions