[Docs] Replace the prose pointer in CLAUDE.md with an @AGENTS.md import - #527
Merged
Merged
Conversation
CLAUDE.md told Claude Code in words to read AGENTS.md, which only works if the session decides to open the file, and carried a /self-review bullet that duplicated what AGENTS.md already says. The file is now the single import line the Claude Code docs prescribe for this setup, so AGENTS.md is loaded at session start on every version, including those that cannot read AGENTS.md natively, and is never read twice on those that can. AGENTS.md's opening line now describes the import. Fixes #526 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: WordPress/contributor-toolkit/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
CLAUDE.mdtold Claude Code in words to readAGENTS.md. Claude only seesAGENTS.mdthat way if it decides to open the file, so the repository's instructions were not guaranteed to be in context at session start. The file also carried a "Claude Code specifics only" bullet about/self-reviewthat repeats whatAGENTS.mdsays under "Where things are", which is the duplication the file's own first paragraph forbids. #526 makes the full case.What changes
CLAUDE.mdbecomes the single line@AGENTS.md. Claude Code expands the import at launch, soAGENTS.mdis loaded on every version, including the ones that cannot readAGENTS.mdnatively (before 2.1.277, before 2.1.281 on some backends, with the built-inagents-mdplugin off, or the first session after an upgrade). On versions that can, the docs state an importedAGENTS.mdis never read twice, whichever "Project instructions" setting a contributor has chosen.The
/self-reviewbullet is dropped. Its three claims all survive inAGENTS.mdand in.claude/skills/self-review/SKILL.md, and Claude Code discovers the skill from its directory without a pointer.Line 3 of
AGENTS.mdnow describes the import instead of the prose pointer.Deliberately not done: deleting
CLAUDE.md. See the alternatives block.How to test this
Platforms: any. Current head, no build needed.
There is no user-visible surface. The command that demonstrates it:
Starting state: a fresh Claude Code session started from the repository root on this branch.
/context.CLAUDE.mdis listed, and its token count is in the thousands rather than the ~200 the old seven-line file loaded, because the importedAGENTS.mdis counted with it..github/instructions/code-review.instructions.mdwithout first opening any file.What must not have happened: on Claude Code 2.1.277 or later,
/contextmust not listAGENTS.mda second time on its own line. The import is the only route by which it loads.Risks and limitations
The behaviour depends on the Claude Code version a contributor runs, and the unit suite has no layer that reads either file, so nothing in CI covers it. The
/contextcheck above is the whole verification. The author ran it in a fresh session on this head and confirmed the importedAGENTS.mdis counted under Memory files.Other agents are unaffected: Codex, Copilot, CodeRabbit and the Agent Skills path all reach
AGENTS.mdor the instructions file directly and never readCLAUDE.md.Related
Fixes #526
Design decisions and alternatives considered
Delete
CLAUDE.mdentirely. This is what the Claude Code docs offer as the other option, and it works on 2.1.281 or later. Rejected for now: Homebrew releases lag about a week, so contributors on older versions would silently get no project instructions, and any contributor who adds aCLAUDE.local.mdfor personal notes stops loadingAGENTS.mdfor themselves under the default setting. Revisit once the project can assume a minimum Claude Code version.Symlink
CLAUDE.mdtoAGENTS.md. Rejected because Git checks a committed symlink out as a plain text file on Windows unlesscore.symlinksis enabled, leaving Windows clones with a one-line file containing a path. The docs recommend the import over the symlink for exactly this case, and Windows is a primary target here.Keep a Claude-only section under the import. Nothing currently qualifies. The docs' pattern of an import followed by tool-specific notes is available if something does later.
The
@AGENTS.mdon line 3 ofAGENTS.mdis inside backticks on purpose. Imports are expanded insideAGENTS.mdtoo and import parsing skips code spans, so the backticks are what stop that line from importing the file into itself.Review outcome (required — see AGENTS.md)
0 [fix here] · 0 [follow-up] — no findings across the five dimensions.
Deterministic layer:
npm run lintclean,npm test1646 pass, 0 fail, 2 skipped, run on the working tree before commit.The judgement pass raised one wording note, that "on every version" overreached, since
@pathimports are themselves a Claude Code feature. The sentence inAGENTS.mdwas reworded before commit to say the file loads whether or not Claude can readAGENTS.mdon its own..github/instructions/code-review.instructions.md; reviewed the uncommitted working tree against baseb3da571(origin/trunk); no findingsb664bc9checked; the only change is the wording fix the review itself asked for onAGENTS.mdline 3, verified by reading the diffImplementation notes
The subagent grepped the repository outside
node_modulesforCLAUDE,AGENTS.md,self-reviewandClaude Code. The only remainingCLAUDEreferences are.gitignore(CLAUDE.local.md, unchanged) and the reworded line inAGENTS.md. The instructions file namesAGENTS.mdand the skill as its pointers, neverCLAUDE.md, so it needs no edit..coderabbit.yaml,docs/,.agents/and.claude/carry no reference to either changed file.Docs consulted: https://code.claude.com/docs/en/memory#agents-md, in particular "Remove an earlier AGENTS.md workaround" and "Share one file with other coding tools".
Nothing on screen changed, so the screenshots block is omitted.
🤖 Generated with Claude Code