[BUG] /init writes CLAUDE.md in an AGENTS.md project, silently disabling the instructions it just read
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
/init always writes CLAUDE.md, even when the project's instructions already live in AGENTS.md.
Since 2.1.277, AGENTS.md is read only where no CLAUDE.md exists. So running /init in an AGENTS.md project disables the very file it just read: the new CLAUDE.md takes over and AGENTS.md stops being loaded, with nothing said about it.
The command a new user runs to set a project up is therefore the command that breaks the new AGENTS.md support.
Both /init prompt variants in the shipped binary target CLAUDE.md ("Please analyze this codebase and create a CLAUDE.md file…" and the newer "Set up a minimal CLAUDE.md…"). AGENTS.md appears in the prompt only as one of the sources to read, alongside .cursorrules and copilot-instructions.md, never as a destination.
Setting instructionFiles to claude-md-and-agents-md does not change what /init writes. It only limits the damage, because both files are then loaded.
What Should Happen?
Any one of these would fix it:
- /init writes AGENTS.md, or offers to, when the project already has one.
- /init follows the instructionFiles option and writes the file that option actually loads.
- At minimum, /init warns that creating CLAUDE.md will stop AGENTS.md from being read.
Error Messages/Logs
No error. That is the problem: the failure is silent. The repo still has its AGENTS.md, sessions simply stop using it.
Output from the reproduction, with an AGENTS.md sitting right there:
**Proposed CLAUDE.md includes:**
1. **Commands** — How to run tests with pytest
2. **Project structure** — Overview of src/ directory and test file conventions
3. **Development notes** — Brief guidance on adding tests when extending the project
Steps to Reproduce
mkdir demo && cd demo && git init
mkdir src
printf '[project]\nname = "demo"\n' > pyproject.toml
printf 'def add(a, b):\n return a + b\n' > src/calc.py
printf '# Instructions\n\nPython project. Run the tests with pytest -q.\n' > AGENTS.md
claude
/init
Before /init, ask the session something covered only by AGENTS.md: it answers from the file. After /init accepts the proposed CLAUDE.md, the same question fails, and nothing reports that the instructions were dropped.
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.281 (also checked on 2.1.278)
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
agents-md@builtin is active here: AGENTS.md loads normally in this project, so this is not the feature being off.
Related open issues, same root cause — the tooling around the feature still assumes CLAUDE.md is the only instructions file:
- #96466 — always load AGENTS.md, even when CLAUDE.md exists
- #96117 — CLAUDE.local.md switches off the AGENTS.md fallback
- #96544 — no report when AGENTS.md was loaded instead of CLAUDE.md
The practical workaround today is documenting "do not run /init", which is an odd thing to have to tell people.