Feature Request: Auto-load CLAUDE.md files from submodules
## Description
When working with repositories that contain submodules, Claude Code should automatically load and consider CLAUDE.md files from both the
main repository and its submodules when providing assistance.
## Current Behavior
Currently, Claude Code only loads the CLAUDE.md file from the current working directory at startup. When a repository contains submodules
(like frameworks or libraries) with their own CLAUDE.md files, these aren't loaded automatically, requiring manual loading requests.
## Proposed Behavior
Claude Code should:
- Detect git submodules within the repository
- Automatically load CLAUDE.md files from these submodules at startup
- Intelligently merge or prioritize information based on the files being worked on
- Consider module-specific documentation when working with files from that submodule
## Additional Configuration Capability
Implement a configuration file (e.g., CLAUDE.config.json or .clauderc) at the repository root that would allow:
- Explicitly specifying additional paths to search for CLAUDE.md files
- Excluding certain submodules or directories from auto-loading
- Setting priority/precedence for conflicting instructions
- Controlling how documentation is merged or segmented
Example configuration:
``json``
{
"documentation": {
"include": [
"./core-framework/CLAUDE.md",
"./docs/conventions.md"
],
"exclude": [
"./third-party/**/CLAUDE.md"
],
"priority": [
"./CLAUDE.md",
"./core-framework/CLAUDE.md"
]
}
}
Use Cases
- Working with modular applications built on frameworks
- Repositories with separate but related components, each with specialized documentation
- Projects that integrate multiple libraries, each with specific usage guidelines
Benefits
- More complete contextual understanding of the codebase
- Faster assistance with submodule-specific code
- Reduced need for repetitive loading of documentation
- Better adherence to module-specific conventions and patterns
Implementation Suggestions
- Add a configuration option in claude.json to control this behavior
- Provide a way to specify priority when multiple CLAUDE.md files might conflict
- Consider a hierarchical approach where more specific documentation overrides general documentation
Example
In a typical web application structure:
- Main app code in /src/ with /CLAUDE.md containing app-specific guidelines
- Framework code in /core-framework/ with /core-framework/CLAUDE.md containing framework-specific documentation
Currently, when working with framework files, Claude doesn't automatically know about the framework-specific patterns documented in the
submodule's CLAUDE.md.
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗