[FEATURE] Logs to include CLAUDE.md files?
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
i'm working on iteratively improving my claude code guidelines and skills by analyzing conversation logs after sessions. the jsonl files in ~/.claude/projects/ contain most of what i need, but some context that claude receives is not recorded.
specifically, subdirectory CLAUDE.md files (like tests/CLAUDE.md) are loaded when claude accesses files in that directory, but the content is not saved to the conversation log. claude can quote from these files accurately, proving it received the content, but i can't see what guidance was provided when analyzing the session afterward.
is there a way to get the full context window logged? or an api to retrieve what was actually sent to the model? this would help with understanding why claude behaved unexpectedly & iterating on skills and instructions
Proposed Solution
From Claude Code debugging a specific instance of this:
<details>
<summary>Detailed report from Claude Code</summary>
Experiment: Subdirectory CLAUDE.md Loading
Goal
Test whether subdirectory CLAUDE.md files are loaded for the main agent and how
they appear in the JSONL conversation log.
Setup
- Started Claude in
~/workspace/worktrunk(which hastests/CLAUDE.md) - Asked Claude to read a file in
tests/directory - Asked Claude to list CLAUDE.md files in its context
- Examined the JSONL conversation log
Observations
1. CLI Output Shows Loading
When Claude read tests/common/mod.rs, the CLI displayed:
⏺ Read(tests/common/mod.rs)
⎿ Read 150 lines
⎿ Loaded tests/CLAUDE.md
The CLI explicitly shows "Loaded tests/CLAUDE.md".
2. Claude Confirms Context
When asked what CLAUDE.md files are in context, Claude responded:
1. /Users/maximilian/.claude/CLAUDE.md — user's private global instructions
2. /Users/maximilian/workspace/worktrunk/CLAUDE.md — project instructions
3. /Users/maximilian/workspace/worktrunk/.claude/rules/caching-strategy.md — project rules
4. /Users/maximilian/workspace/worktrunk/.claude/rules/cli-output-formatting.md — project rules
5. /Users/maximilian/workspace/worktrunk/.claude/rules/output-system-architecture.md — project rules
6. /Users/maximilian/workspace/worktrunk/tests/CLAUDE.md — testing guidelines (loaded via system-reminder)
Claude confirms tests/CLAUDE.md is in context, says it was "loaded via system-reminder".
3. JSONL Analysis
Examined conversation log at:~/.claude/projects/-Users-maximilian-workspace-worktrunk/5788fd52-746f-4322-9891-3afb152fab2a.jsonl
Searched for:
| Search | Result |
|--------|--------|
| "tests/CLAUDE" | Only in assistant's text response listing files |
| "# Testing Guidelines" (first line of tests/CLAUDE.md) | NOT FOUND |
| "nested_memory" | NOT FOUND in any progress message |
| "Running .wt. Commands" (content from tests/CLAUDE.md) | NOT FOUND |
The actual CONTENT of tests/CLAUDE.md does NOT appear in the JSONL.
4. Progress Messages
The conversation has 6 progress messages, but they're all about hooks:
{"type":"progress","data":{"type":"hook_progress","hookEvent":"Stop",...}}
None contain nested_memory or CLAUDE.md content.
5. Read Tool Result
The Read tool result for tests/common/mod.rs contains:
- The file content (lines 1-150)
- A
<system-reminder>about malware analysis
The tests/CLAUDE.md content is NOT attached to the Read tool result.
Conclusion
Subdirectory CLAUDE.md files ARE loaded for the main agent (confirmed by CLI
output and Claude's context awareness), but the loading is NOT recorded in the
JSONL conversation log.
This means:
- The CLI shows "Loaded tests/CLAUDE.md" — this is a runtime event
- Claude has the content in its context — it can reference it
- The JSONL does not contain the content — we cannot extract it from logs
Verification: Claude Has the Actual Content
To prove Claude actually has the content (not just awareness of the file), a
second experiment was run:
Experiment 2: Quote Test
Prompt: "Without reading any files, quote the first heading and first bullet
point from tests/CLAUDE.md that you have in context"
Claude's response:
From the context I received:
First heading: # Testing Guidelines
First bullet point: - **Directive leakage**: Test commands writing to the
user's shell directive file
Verification of actual tests/CLAUDE.md content:
# Testing Guidelines
## Running `wt` Commands in Tests
**Use the correct helper to ensure test isolation.** Tests that spawn `wt` must
be isolated from the host environment to prevent:
- **Directive leakage**: Test commands writing to the user's shell directive file
Claude quoted correctly from memory. This proves Claude has the actual
file content, not just metadata about it.
JSONL Analysis of Verification Session
Examined: ~/.claude/projects/-Users-maximilian-workspace-worktrunk/ffea0579-1a08-463c-adba-cb7ebd908854.jsonl
Key findings:
- Claude's thinking reveals the source:
````
"The user is asking me to quote from the tests/CLAUDE.md file that was
included in the system context (as a system-reminder after the file read)"
- Searched for unique content from tests/CLAUDE.md:
| Search | In JSONL? |
|--------|-----------|
| repo.wt_command() (code example) | NOT FOUND |
| Missing isolation (comment text) | NOT FOUND |
| CARGO_BIN_EXE_wt (Rust macro) | NOT FOUND |
- "Testing Guidelines" only appears in:
- Claude's thinking (where it references what it received)
- Claude's final response (where it quotes back to the user)
The original tests/CLAUDE.md content is NOT in the JSONL file. Claude
received it at runtime, but the injection is not logged.
Final Conclusion
Subdirectory CLAUDE.md files ARE loaded for the main agent (confirmed by:
CLI output, Claude's context awareness, AND Claude's ability to quote actual
content), but the loading is NOT recorded in the JSONL conversation log.
This means:
- The CLI shows "Loaded tests/CLAUDE.md" — this is a runtime event
- Claude has the content in its context — it can quote from it accurately
- The JSONL does not contain the content — we cannot extract it from logs
- Claude's thinking mentions receiving it "as a system-reminder after the file
read" — but this system-reminder is not in the JSONL
Implications for analyzing sessions
When analyzing a session where the main agent accessed subdirectory files:
- Cannot determine from JSONL alone which subdirectory CLAUDE.md files were
loaded
- Must infer from file access patterns — if Claude read files in
tests/,
assume tests/CLAUDE.md was loaded (if it exists)
- Read the CLAUDE.md from disk to see what guidance was provided
Conversation Log Locations
Experiment 1:
~/.claude/projects/-Users-maximilian-workspace-worktrunk/5788fd52-746f-4322-9891-3afb152fab2a.jsonl
Experiment 2 (verification):
~/.claude/projects/-Users-maximilian-workspace-worktrunk/ffea0579-1a08-463c-adba-cb7ebd908854.jsonl
</details>
Priority
Medium - Would be very helpful
Feature Category
Other
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗