Feature hasn't been suggested before.
Describe the enhancement you want to request
In Claude Code, CLAUDE.md files located in subdirectories are auto-injected into context when a read tool is called anywhere along that path. Specifically, additional read tool calls are injected for each CLAUDE.md found in the path hierarchy.
Example Directory Structure
CLAUDE.md
dir_1/
├── CLAUDE.md
├── src/
│ ├── CLAUDE.md
│ └── project2/
│ └── other_file.txt
└── other_dir/
└── example_file.txt
dir_2/
├── CLAUDE.md
└── path/
└── to/
└── deeply/
├── CLAUDE.md
└── nested/
└── dir/
Current Behavior (Claude Code)
By default, the root CLAUDE.md is injected into the system prompt.
When a read tool call is made, Claude Code walks up from that file's directory and injects additional read tool calls for any CLAUDE.md files found along the path.
Example 1: Reading a file in dir_1/other_dir/
read(dir_1/other_dir/example_file.txt) # original call
read(dir_1/CLAUDE.md) # injected
Example 2: Subsequently reading a file in dir_1/src/project2/
read(dir_1/src/project2/other_file.txt) # original call
read(dir_1/src/CLAUDE.md) # injected
# dir_1/CLAUDE.md is NOT injected (already read this session)
Example 3: Reading a deeply nested file in dir_2/
read(dir_2/path/to/deeply/nested/dir/somefile.txt) # original call
read(dir_2/path/to/deeply/CLAUDE.md) # injected
read(dir_2/CLAUDE.md) # injected
Additional Note
I believe you also traverse backwards up the filesystem outside the working directory. Claude Code does not do this.
For example, if the above structure lived at /home/allison/git/repo_1/example/, and repo_1/ (the git root) contained a CLAUDE.md, Claude Code would not inject a read for /home/allison/git/repo_1/CLAUDE.md—but I think your implementation would.
I don't personally need that behavior, but I'd really like subdirectory CLAUDE.md injection support.
Reference Implementation
I emulated the full complexity of this CLAUDE.md injection behavior here, which you can optionally use as a reference:
https://github.com/allisoneer/agentic_auxilary/blob/e8a053d09fca0f0d8e1106baf734c73d3771e003/gpt5_reasoner/src/engine/memory.rs#L27-L154
Does that make the tool-call injection clearer? I can also add explicit comments like # injected tool call if you want to hammer it home even more.
Feature hasn't been suggested before.
Describe the enhancement you want to request
In Claude Code,
CLAUDE.mdfiles located in subdirectories are auto-injected into context when areadtool is called anywhere along that path. Specifically, additionalreadtool calls are injected for eachCLAUDE.mdfound in the path hierarchy.Example Directory Structure
Current Behavior (Claude Code)
By default, the root
CLAUDE.mdis injected into the system prompt.When a
readtool call is made, Claude Code walks up from that file's directory and injects additionalreadtool calls for anyCLAUDE.mdfiles found along the path.Example 1: Reading a file in
dir_1/other_dir/Example 2: Subsequently reading a file in
dir_1/src/project2/Example 3: Reading a deeply nested file in
dir_2/Additional Note
I believe you also traverse backwards up the filesystem outside the working directory. Claude Code does not do this.
For example, if the above structure lived at
/home/allison/git/repo_1/example/, andrepo_1/(the git root) contained aCLAUDE.md, Claude Code would not inject a read for/home/allison/git/repo_1/CLAUDE.md—but I think your implementation would.I don't personally need that behavior, but I'd really like subdirectory
CLAUDE.mdinjection support.Reference Implementation
I emulated the full complexity of this
CLAUDE.mdinjection behavior here, which you can optionally use as a reference:https://github.com/allisoneer/agentic_auxilary/blob/e8a053d09fca0f0d8e1106baf734c73d3771e003/gpt5_reasoner/src/engine/memory.rs#L27-L154
Does that make the tool-call injection clearer? I can also add explicit comments like
# injected tool callif you want to hammer it home even more.