You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rtk init treats any mention of @RTK.md as the reference line: install adds none, Codex rewrites user prose, --show reports ok #4650
On install, rtk init treats any mention of @RTK.md in the user's instruction file as the RTK reference line. Uninstall now matches the exact trimmed line (#4405), but the install side and init --show still match a substring.
Reproduced in an isolated HOME on develop e542dca and on #4405's head:
Claude, rtk init -g --auto-patch with ~/.claude/CLAUDE.md:
# Mine
@RTK.md is my notes file.
The file is left unchanged and no @RTK.md line is added, so RTK.md is never loaded, yet the summary prints CLAUDE.md: @RTK.md reference added. Source: src/hooks/init/claude.rs:108 (content.contains(RTK_MD_REF)).
Codex, rtk init -g --codex with ~/.codex/AGENTS.md:
# Agents
Read @RTK.md for details.
The user's sentence becomes Read @/home/<user>/.codex/RTK.md for details., no reference line is added, and the summary prints AGENTS.md: @…/RTK.md reference added. Source: src/hooks/init/agents_md.rs:171-178 (contains + content.replace(RTK_MD_REF, rtk_md_ref) over the whole file).
rtk init --show on the CLAUDE.md from case 1 reports [ok] Global (~/.claude/CLAUDE.md): @RTK.md reference. Source: src/hooks/init/mod.rs:2107.
BOM-prefixed reference, rtk init -g --uninstall with ~/.claude/CLAUDE.md = \xEF\xBB\[email protected]\n, as a Windows editor may save it: RTK.md is deleted and the @RTK.md line stays, so it now points at a missing file. str::trim does not strip U+FEFF, so the exact-line predicate below misses it too. The same happens on develop.
The correct predicate already exists: has_rtk_reference (agents_md.rs:235) compares whole trimmed lines, and the uninstall paths use it. The relative-to-absolute migration in case 2 would need to replace only the matching line, not every occurrence.
rtk init's install/--show/uninstall paths use substring matching for the @RTK.md reference instead of the existing whole-trimmed-line predicate, causing false-positive success reports, corrupted user prose (Codex), and BOM-unaware uninstall.
📁 Relevant files
src/hooks/init/claude.rs
src/hooks/init/agents_md.rs
src/hooks/init/mod.rs
Suggested Actions
Reuse has_rtk_reference (agents_md.rs:235) in claude.rs:108 and mod.rs:2107 instead of content.contains(RTK_MD_REF)
Fix agents_md.rs:171-178 to replace only the matching line via has_rtk_reference, not content.replace over the whole fi…
Normalize/strip U+FEFF BOM before the trimmed-line comparison so uninstall matches BOM-prefixed reference lines
Correction to cases 1 and 3 above, after measuring Claude Code itself (2.1.332, isolated config dir, local Messages API stand-in): Claude Code imports @RTK.md written inside a sentence or a list item, so @RTK.md is my notes file. does load RTK.md and --show was right to report it. The Claude half of this issue was wrong for those inputs. What Claude Code really skips (Read @RTK.md., (@RTK.md), inline code, fenced blocks) is now #5344.
Cases 2 (Codex rewriting user prose) and 4 (BOM-prefixed reference left behind on uninstall) are real and fixed by #5206.
Activity
rtk-wshm-sync-bot commentedon Oct 18, 2026
🔍 Automated Triage
bughighSummary
rtk init's install/--show/uninstall paths use substring matching for the @RTK.md reference instead of the existing whole-trimmed-line predicate, causing false-positive success reports, corrupted user prose (Codex), and BOM-unaware uninstall.
📁 Relevant files
src/hooks/init/claude.rssrc/hooks/init/agents_md.rssrc/hooks/init/mod.rsSuggested Actions
Triaged automatically by wshm · This is an automated analysis, not a human review.
KuSh commentedon Nov 29, 2026
Correction to cases 1 and 3 above, after measuring Claude Code itself (2.1.332, isolated config dir, local Messages API stand-in): Claude Code imports
@RTK.mdwritten inside a sentence or a list item, so@RTK.md is my notes file.does load RTK.md and--showwas right to report it. The Claude half of this issue was wrong for those inputs. What Claude Code really skips (Read @RTK.md.,(@RTK.md), inline code, fenced blocks) is now #5344.Cases 2 (Codex rewriting user prose) and 4 (BOM-prefixed reference left behind on uninstall) are real and fixed by #5206.
fix(init): treat @RTK.md reference as a whole line