Skip to content

rtk init: Claude CLAUDE.md status does not follow what Claude Code imports #5344

Backlog

Description

@KuSh

rtk init -g and rtk init --show decide whether ~/.claude/CLAUDE.md already loads RTK.md with content.contains("@RTK.md") (src/hooks/init/claude.rs patch_claude_md, src/hooks/init/mod.rs show_claude_config). Claude Code's own rule is narrower. Measured with Claude Code 2.1.332 against a local Messages API stand-in (isolated CLAUDE_CONFIG_DIR with an RTK.md holding a canary string, checking whether the canary reaches the request):

CLAUDE.md contains Claude Code imports RTK.md rtk says
@RTK.md on its own line (also indented, CRLF, BOM-prefixed) yes configured
Read @RTK.md for details. / @RTK.md is my notes file. / - @RTK.md yes configured
Read @RTK.md. no configured
See @RTK.md, then go. no configured
See (@RTK.md) here. no configured
[email protected] no configured
See `@RTK.md` here. no configured
@RTK.md inside a fenced code block no configured

On the last six rows rtk init -g adds no reference line, so RTK.md is never loaded, and --show prints [ok] Global (~/.claude/CLAUDE.md): @RTK.md reference. Claude Code deduplicates a repeated import, so adding a reference line when in doubt costs nothing.

Two reports nearby have the same shape:

  • rtk init -g always prints CLAUDE.md: @RTK.md reference added (claude.rs, after patch_claude_md), including when the reference was already there and nothing was written. The Codex summary already distinguishes added from already present.
  • rtk init -g --uninstall removes only a whole @RTK.md line, so an import install accepted (- @RTK.md) stays after RTK.md is deleted, and --show still prints [ok] for the uninstalled setup.
  • rtk init --show reports [ok] Local (./CLAUDE.md): rtk enabled for any ./CLAUDE.md containing the letters rtk (mod.rs, content.contains("rtk")), e.g. a file that mentions artkit.

A fix would match an @RTK.md token bounded by whitespace or the line edges, outside inline code and fenced blocks, for both the install check and --show, and report added only when a line was written. Removal on uninstall should stay whole-line only, so a user's sentence is never deleted.

Found while reviewing #5206.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions