Skip to content

fix(init): refresh Cline, Windsurf and Kilo Code rules instead of skipping any file mentioning rtk - #5234

Open
boss477 wants to merge 1 commit into
rtk-ai:developfrom
boss477:fix/init-rules-file-rtk-detection
Open

boss477 wants to merge 1 commit into
rtk-ai:developfrom
boss477:fix/init-rules-file-rtk-detection

Conversation

@boss477

@boss477 boss477 commented Nov 23, 2026

Copy link
Copy Markdown

Fixes #3406

Summary

  • rtk init --agent cline|windsurf|kilocode no longer treats any rules file containing "rtk" as already configured. A .clinerules that says "prefer RTK Query" now gets RTK's rules added after the user's text.
  • These three installers now write RTK's rules as the same marker block Kimi and Codex already use (write_rtk_block): added when missing, replaced in place when stale, left alone when current. This covers the second half KuSh found on Nov 3: a rules file RTK wrote itself now picks up new rtk-awareness-full.md wording on re-run.
  • Existing installs written without markers are migrated once. The unmarked section is recognised only when it opens with one of RTK's shipped headings (# RTK, # RTK - Rust Token Killer …) and the file ends with the last line of a shipped RTK text (checked against every version in git history). Anything the user wrote after RTK's text means the file is left as it is and the block is appended.

write_rtk_block gains a sibling, write_rtk_block_into, that takes already-read content, so the migration can hand over the file without its legacy section. write_rtk_block itself behaves as before.

Test plan

  • cargo fmt --all --check, cargo clippy --all-targets (no warnings)
  • cargo test: 4866 passed, 1 failed. The failure is core::stream::tests::test_read_lines_lossy_preserves_lines_after_invalid_utf8, which also fails on unmodified develop on Windows, so it isn't related to this change.
  • New tests: unrelated RTK mention gets the block, current block unchanged, stale block refreshed in place with surrounding text kept, legacy unmarked rules migrated (old Cline heading and current text), user text after legacy rules kept, dry run writes nothing. Existing Kilo Code tests updated to expect the marker block.
  • Manual: rtk init --agent cline in a project whose .clinerules says "Prefer RTK Query for data fetching." adds the block after the user's rules; a second run reports "already up to date".

🤖 Generated with Claude Code

…pping any file mentioning rtk

`rtk init --agent cline|windsurf|kilocode` treated any rules file containing
the letters "rtk" as already configured, so a project rule such as "prefer RTK
Query" blocked the install, and a rules file RTK wrote itself was never
refreshed when its wording changed.

These installers now write RTK's rules as the same marker block Kimi and Codex
use: added when missing, replaced in place when stale, left alone when current,
with the user's own text kept. Rules appended without markers by earlier
versions are migrated to the block when they end the file.

Fixes rtk-ai#3406

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cline/Windsurf/Kilo/Antigravity install skips silently if the project's rules file contains the substring "rtk" — e.g. "RTK Query" in a Redux project

1 participant