Imports or CLAUDE.local.md?
According to the Claude Code memory docs, CLAUDE.local.md is deprecated in favor of imports.
There’s not a good example of how to replicate this behavior, so I came up with something simple and gave it a shot.
Setup
CLAUDE.md:
- Never use abbreviations for methods or variable names
- If a file named @claudelocaltest.md is found, this is local context. Any conflicting information in this file should have highest precedence.
claudelocaltest.md:
Abbreviate all method and variable names as much as possible.
It failed me the first time I tried it, but assured me that I had done everything right. That doesn’t feel good enough. I am trying to create a reliable replacement for CLAUDE.local.md that I can share with my team.
Test Output
> Create a test ruby class with a method that just prints a 50 character string
⏺ I'll create a Ruby file with a class and a method that outputs a 50-character string.
⏺ Write(test_output.rb)
⎿ Wrote 8 lines to test_output.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
class TestOutput
def print_fifty_characters
puts "0123456789" * 5
end
end
> Are you paying attention to memories?
⏺ Read(claudelocaltest.md)
⎿ Read 2 lines (ctrl+r to expand)
⏺ I missed the instruction in claudelocaltest.md to abbreviate names as much as possible. I'll fix that right away.
⏺ Update(test_output.rb)
⎿ Updated test_output.rb with 2 additions and 2 removals
1 #!/usr/bin/env ruby
2 # frozen_string_literal: true
3
4 - class TestOutput
5 - def print_fifty_chars
4 + class TO
5 + def pfc
6 puts "0123456789" * 5
7 end
8 end
9 \ No newline at end of file
Conclusion
This is obviously not as deterministic or reliable as CLAUDE.local.md, but the docs say that file is deprecated.
Am I doing something wrong? Could I do it better?
I’m not sure if this is a bug report or just a question. Just looking for steps forward.
Appendix
> Why did you miss the instruction? Do I not have this tool configured correctly?
⏺ I missed the instruction because I didn't properly check all the context files before implementing the solution. The claudelocaltest.md file was available but I didn't read it initially before creating the file.
Your tool configuration is correct - I can access and read the files. I should have been more thorough in reviewing all context files before writing code.
> How do I ensure that this doesn't happen again? I am trying to create a deterministic mechanism of loading files in local environments. The Claude docs say CLAUDE.local.md is deprecated. It suggests using `@` imports in CLAUDE.md instead.
⏺ Read(CLAUDE.md)
⎿ Read 3 lines (ctrl+r to expand)
⏺ To ensure this doesn't happen again, you should:
1. Your CLAUDE.md file is already correctly set up with @ imports for your key files.
2. The instruction to read claudelocaltest.md is there on line 2.
3. For deterministic loading, ensure that:
- All imported files use the @ prefix consistently
- Add explicit instructions to check specific files first
- Make critical instructions more prominent in CLAUDE.md
The current setup should work if I properly follow instructions. The issue was my failure to thoroughly read all referenced files before coding, not the configuration.
For local environments, using @ imports in CLAUDE.md (as you're already doing) is indeed the recommended approach instead of CLAUDE.local.md.This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗