First session in a new folder does not load AGENTS.md (2.1.296)
Status Fixed / completed
Reported on v2.1.296
Maintainer reply None cached
Activity 1 comment · opened Oct 13, 2026 · closed Oct 13, 2026
What happened
In a folder where Claude Code has never run, the first interactive session does not load the repository's root AGENTS.md. /context all lists only ~/.claude/CLAUDE.md under Memory files. Every later session in the same folder loads AGENTS.md.
Environment
- Claude Code 2.1.296, native install, Linux (WSL2 Ubuntu), Claude Max, model
claude-opus-5-5, effort max. - The repository has a root
AGENTS.mdand noCLAUDE.md,.claude/CLAUDE.mdorCLAUDE.local.mdin the folder or above it. The user has a~/.claude/CLAUDE.md. - Each new folder was a git worktree of that repository, created by an IDE that runs
git worktree add. Sessions started in that IDE's terminal withclaude --model claude-opus-5-5 --effort max; the terminal environment was the same for first and later sessions. - User and plugin SessionStart hooks are installed. They add context only, and they ran identically in first and later sessions.
Steps to reproduce
- Create a git worktree of a repository that has a root
AGENTS.mdand noCLAUDE.md, in a new folder where Claude Code never ran. - Start
claudein that folder and run/context all. Memory files lists only~/.claude/CLAUDE.md. - Run
/exit, startclaudeagain in the same folder, and run/context all. Memory files lists~/.claude/CLAUDE.mdandAGENTS.md.
Observed
- 2 of 2 new folders: the first session missed
AGENTS.md(total context 45.5k and 45.6k tokens). - 5 of 5 later sessions in those folders loaded it (
AGENTS.md7.1k tokens, total 52.6k to 52.7k), with and without project settings changes. - The only per-folder state we found written by the first session is a
githubRepoPathsentry in~/.claude.json. Noprojectsentry is created for the worktree path.
Expected
The memory docs say AGENTS.md loads at session start when no CLAUDE.md exists. Their only first-session caveat is the first session after an upgrade from v2.1.276 or earlier, which does not apply here.
Impact
A tool that starts an agent in a fresh worktree per task runs that agent's whole first session without the project's instructions.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗