Bug: .claude.json automatically stores conversation history when it shouldn't
Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Workaround ✓ Mentioned in thread ↓
Activity 10 comments · opened May 30, 2025 · closed May 30, 2025
💡 Likely answer: A maintainer (bcherny, collaborator)
responded on this thread — see the highlighted reply below.
Bug Description
The .claude.json configuration file is automatically storing conversation history in a "history" array, which appears to be unintended behavior. This creates privacy concerns and file bloat.
Expected Behavior
The .claude.json file should only contain configuration settings like:
- userID
- claudeMaxTier
- project settings (mcpServers, dontCrawlDirectory, etc.)
Actual Behavior
Claude Code automatically adds a "history" array that stores user messages:
"history": [
{
"display": "user message content here",
"pastedContents": {}
}
]
Steps to Reproduce
- Start a Claude Code session in any project
- Send any message
- Check
.claude.jsonfile - it will contain conversation history
Impact
- Privacy concerns: sensitive conversations stored in config files
- File bloat: config files grow with every interaction
- Version control issues: history gets committed to repos
Environment
- Claude Code version: Latest
- Platform: macOS Darwin 24.5.0
- Node version: v20.19.1
This appears to be a regression or unintended feature that should be removed.
10 Comments
Hi! This is expected behavior -- it's what makes it so you can arrow up to see previous prompts, the same way you can do with your bash history. We're in the process of migrating this file to a more standard cache directory, to make its purpose more clear.
@bcherny Thanks for clarifying! I understand the arrow-up functionality is
valuable. However, I'm experiencing some significant operational issues
with the current implementation:
Current Impact:
failures
struggles to parse the file
Suggestion:
Would it be possible to prioritize the cache directory migration? The
current approach is creating a bottleneck where configuration parsing
blocks core functionality. Perhaps implementing a simple split:
~/.claude.json → Keep under 1MB (config only)
~/.claude/history.json → Conversation history (can grow freely)
This would maintain the arrow-up feature while ensuring config parsing
remains performant.
Temporary Workaround Request:
Could you provide guidance on safely trimming the history entries without
breaking functionality? Or perhaps a flag like --max-history-size to
prevent unbounded growth?
I appreciate the work you're doing on Claude Code - it's an amazing tool.
Just hoping we can find a solution that balances feature richness with
operational stability.
Another pain point: Storing chat history in
~/.claude.jsonmakes it annoying to version control the user config in~/.claude.json, because every time you runclaudethe file updates and your git repo is dirty again.I'd like to be able to version control my
~/.claude.jsonfile without machine-generated noise like:"history""cachedChangelog"Agreed — it's pretty bizarre to store chat logs in a config file. Why is this the case?
Seriously this is ridiculous!! WHY is this a thing? ITS A HUGE MESS!!
IT MAKES THE ENTIRE claude.json COMPLETELY UNUSABLE.
Thanks for creating edit hell guys, rendering the claude.json as a pile of stinky vibes.
I'll add that I agree with everyone above me. This is nuts to do this in this manner. The bloat and privacy considerations are a pretty big deal. I'm reduced to using a .bak of the clean file and replacing the json file over and over.
Having issues with bloated
.config.jsonfile, full ofprojectshistory andcachedChangelog. Storing unbounded conversation history in a config file doesn't make sense. Config is static data. Conversation history is stately and should be cached somewhere, per project. Also using one file for all projects centralizes risk on a single point of failure / contention. Risky design.Needs
~/.claude/projects/[project-hash]/- Per-project configs, history & cache.claude/in each project directory - Project-local settingsAsk Claude Code yourself and see its answer. There is already the ~/.claude/projects directory for exactly this purpose so it makes no sense.
Have written a script to back-up .config.json and trim out the fat from it, in the interim. Runs once a day on a timer.
Totally unacceptable to be storing mutable data in a config file like this. Please do something about this...
Just figured out this is happening - unbelievable. Any time I ask claude to add an MCP server, it's throwing it in there, along with everything else I have ever said and done with Claude code. No wonder nothing ever worked!
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.