[DOCS] Headless print-mode docs do not explain nested CLAUDE.md and conditional rules loading
Documentation Type
Unclear/confusing documentation
Documentation Location
https://code.claude.com/docs/en/headless
Section/Topic
Instruction-loading behavior in print mode (claude -p), specifically for nested CLAUDE.md and path-scoped .claude/rules/*.md files.
Current Documentation
Headless docs define print mode usage:
To run Claude Code programmatically from the CLI, pass -p with your prompt and any CLI options.
Memory docs explain instruction/rule loading generally:
CLAUDE.md files in subdirectories load on demand when Claude reads files in those directories.
Rules can be scoped to specific files using YAML frontmatter with the paths field.
What's Wrong or Missing?
Changelog v2.1.69 indicates there was a print-mode-specific bug around conditional .claude/rules/*.md and nested CLAUDE.md loading, but headless docs do not describe how these files should load in claude -p mode.
Users automating with print mode need explicit, mode-specific behavior to reason about instruction application.
Suggested Improvement
Add a "Instruction loading in print mode" subsection in headless docs that states:
- Whether nested
CLAUDE.mdis loaded duringclaude -p - Whether
paths:-scoped rules are evaluated in print mode - What triggers lazy loading in non-interactive runs
- A minimal example showing expected behavior
Impact
High - Prevents users from using a feature
Additional Context
Affected Pages:
| Page | Context |
|------|---------|
| https://code.claude.com/docs/en/headless | Print mode behavior should be documented here |
| https://code.claude.com/docs/en/memory | Describes nested CLAUDE.md and paths: rules, but not print-mode-specific behavior |
Total scope: 2 pages affected
Source: Changelog v2.1.69
Exact changelog entry:
Fixed conditional.claude/rules/*.mdfiles (withpaths:frontmatter) and nested CLAUDE.md files not loading in print mode (claude -p)
5 Comments
Still relevant as of 2026-03-28 after re-checking the current docs. This issue is partially resolved, but the remaining documentation gap is still present.
---
Issue #30941 Verification
Title: [DOCS] Headless print-mode docs do not explain nested CLAUDE.md and conditional rules loading
Issue Date: 2026-03-05
Verification Date: 2026-04-01
Status: PARTIALLY RESOLVED
---
Issue Summary
This issue reports that the
claude -pdocumentation still does not explicitly explain how nestedCLAUDE.mdfiles andpaths:-scoped.claude/rules/*.mdfiles load in print mode, what triggers those lazy loads, or show a minimal example.---
Verification Results
Claim 1: Headless docs now give mode-specific guidance about instruction loading in
claude -pStatus: PARTIALLY RESOLVED
At https://code.claude.com/docs/en/headless, line 39: "Without it,
claude -ploads the same context an interactive session would, including anything configured in the working directory or~/.claude."At https://code.claude.com/docs/en/headless, lines 39-41: "Add
--bareto reduce startup time by skipping auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. Without it,claude -ploads the same context ... Bare mode is useful for CI and scripts..."Verdict: The headless page now explicitly states that standard
claude -pruns use the same context as interactive mode, and that--baredisables automatic instruction discovery. That addresses part of the print-mode behavior question.---
Claim 2: Current docs explicitly document nested
CLAUDE.mdloading,paths:rule evaluation, lazy-load triggers, and a print-mode example on the headless pageStatus: UNRESOLVED
At https://code.claude.com/docs/en/memory, lines 123-125: "Claude Code reads CLAUDE.md files by walking up the directory tree ... Claude also discovers CLAUDE.md files in subdirectories under your current working directory. Instead of loading them at launch, they are included when Claude reads files in those subdirectories."
At https://code.claude.com/docs/en/memory, lines 167-182: "Rules can be scoped to specific files using YAML frontmatter with the
pathsfield. These conditional rules only apply when Claude is working with files matching the specified patterns... Path-scoped rules trigger when Claude reads files matching the pattern, not on every tool use."At https://code.claude.com/docs/en/hooks, lines 755-757: "This event fires at session start for eagerly-loaded files and again later when files are lazily loaded, for example when Claude accesses a subdirectory that contains a nested
CLAUDE.mdor when conditional rules withpaths:frontmatter match."At https://code.claude.com/docs/en/changelog, line 690: "Fixed conditional
.claude/rules/*.mdfiles (withpaths:frontmatter) and nested CLAUDE.md files not loading in print mode (claude -p)"At https://code.claude.com/docs/en/headless, lines 65-67: "These examples highlight common CLI patterns. For CI and other scripted calls, add [
--bare](#start-faster-with-bare-mode) so they don't pick up whatever happens to be configured locally."Verdict: The general memory and hooks pages explain nested
CLAUDE.mdloading andpaths:rule triggers, and the changelog confirms that print mode supports them. However, the headless page still does not explicitly connect those behaviors toclaude -p, explain the lazy-load triggers in print mode, or provide the requested print-mode example.---
Current State
| Claim | Status |
|-------|--------|
| Headless docs say standard
claude -puses the same context as interactive mode unless--bareis used | PARTIALLY RESOLVED || Headless docs explicitly explain nested
CLAUDE.mdloading in print mode | UNRESOLVED || Headless docs explicitly explain
paths:-scoped rule loading triggers in print mode | UNRESOLVED || Headless docs include a minimal print-mode instruction-loading example | UNRESOLVED |
---
Suggested Fix
Before: the headless page says that
claude -ploads the same context as interactive mode unless--bareis used, but it does not explicitly describe nestedCLAUDE.mdloading,paths:-scoped rule triggers, or a minimal print-mode example.After: add a short "Instruction loading in print mode" subsection to https://code.claude.com/docs/en/headless that states that standard
claude -pruns use the normal instruction-loading model, nestedCLAUDE.mdfiles load when Claude reads files in those subdirectories,paths:-scoped rules load when matching files enter context, and--baredisables that automatic loading; include a minimal example that demonstrates the behavior.---
References
claude -ploads the same context as interactive mode unless--bareis used.CLAUDE.mdfiles in subdirectories load when Claude reads files in those subdirectories.paths:-scoped rules apply when Claude works with matching files and trigger when Claude reads matching files.CLAUDE.mdtraversal andpaths:frontmatter matches.CLAUDE.mdand conditional.claude/rules/*.mdloading.---
Conclusion & Recommendation
Primary Concern: The headless print-mode docs still do not explicitly document how nested
CLAUDE.mdfiles andpaths:-scoped rules load duringclaude -pruns.Resolution Status: PARTIALLY RESOLVED
Recommendation: KEEP OPEN
The current headless page partially addresses the issue by stating that
claude -puses the same context as interactive mode unless--bareis used. It still lacks explicit print-mode documentation for nestedCLAUDE.md, conditional rule triggers, and a concrete example, so the documentation gap remains open.---
Checked against the latest docs mirror — this issue is still unresolved as of 2026-04-27.
Issue #30941 Verification
Title: [DOCS] Headless print-mode docs do not explain nested CLAUDE.md and conditional rules loading
Issue Date: 2026-03-05
Verification Date: 2026-04-29
Status: RESOLVED
---
Issue Summary
This issue reports that the print-mode documentation did not explain whether
claude -ploads nestedCLAUDE.mdfiles andpaths:-scoped.claude/rules/*.mdfiles, or what triggers those instructions to load in non-interactive runs.---
Verification Results
Claim 1: The docs did not state whether
claude -ploads the normal Claude Code instruction contextStatus: RESOLVED
At https://code.claude.com/docs/en/headless, lines 39-41:
Add --bare to reduce startup time by skipping auto-discovery of hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md. Without it, claude -p loads the same context an interactive session would, including anything configured in the working directory or ~/.claude.Verdict: The headless documentation now explicitly states that non-bare
claude -psessions load the same context as interactive sessions, including working-directory and user-level instruction sources.---
Claim 2: The docs did not explain how nested
CLAUDE.mdfiles load forclaude -pStatus: RESOLVED
At https://code.claude.com/docs/en/memory, lines 137-142:
Claude Code reads CLAUDE.md files by walking up the directory tree from your current working directory...andClaude also discovers CLAUDE.md and CLAUDE.local.md files in subdirectories under your current working directory. Instead of loading them at launch, they are included when Claude reads files in those subdirectories.At https://code.claude.com/docs/en/hooks, lines 907-909:
Fires when a CLAUDE.md or .claude/rules/*.md file is loaded into context. This event fires at session start for eagerly-loaded files and again later when files are lazily loaded, for example when Claude accesses a subdirectory that contains a nested CLAUDE.md...Verdict: The current docs now describe both eager loading for files along the current directory tree and lazy loading for nested
CLAUDE.mdfiles, which covers the expected behavior whenclaude -puses the normal session context.---
Claim 3: The docs did not explain whether
paths:-scoped rules are evaluated in print mode or what triggers their lazy loadingStatus: RESOLVED
At https://code.claude.com/docs/en/memory, lines 185-200:
Rules can be scoped to specific files using YAML frontmatter with the paths field.andRules without a paths field are loaded unconditionally and apply to all files. Path-scoped rules trigger when Claude reads files matching the pattern, not on every tool use.At https://code.claude.com/docs/en/hooks, lines 907-920:
This event fires at session start for eagerly-loaded files and again later when files are lazily loaded... when conditional rules with paths: frontmatter match.The same section definesload_reasonvalues includingsession_start,nested_traversal, andpath_glob_match, and notes thatglobsis present forpath_glob_matchloads.Verdict: The current docs now explain both the evaluation rule for
paths:-scoped files and the lazy-load trigger conditions, including thepath_glob_matchreason used when those rules match.---
Current State
| Claim | Status |
|-------|--------|
| The docs did not state whether
claude -ploads the normal Claude Code instruction context | RESOLVED || The docs did not explain how nested
CLAUDE.mdfiles load forclaude -p| RESOLVED || The docs did not explain whether
paths:-scoped rules are evaluated in print mode or what triggers their lazy loading | RESOLVED |---
Suggested Fix
N/A - issue has been resolved.
---
References
claude -ploads the same context as an interactive session and that--bareskips CLAUDE.md and related auto-discovery.CLAUDE.mdfiles.paths:-scoped rules and says they trigger when Claude reads matching files.CLAUDE.md, conditionalpaths:rules, andpath_glob_match/nested_traversalload reasons.---
Conclusion & Recommendation
Primary Concern: The issue reported that print-mode documentation did not explain whether and when nested
CLAUDE.mdfiles and path-scoped.claude/rules/*.mdfiles load.Resolution Status: RESOLVED
Recommendation: CLOSE
The current documentation now states that non-bare
claude -puses the same context as interactive sessions, and the memory and hooks pages explain the lazy-loading behavior for nestedCLAUDE.mdfiles andpaths:-scoped rules. The reported documentation gap is now covered.---
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.