Bug: .claude.json automatically stores conversation history when it shouldn't

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
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

  1. Start a Claude Code session in any project
  2. Send any message
  3. Check .claude.json file - 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.

View original on GitHub ↗

10 Comments

bcherny collaborator · 1 year ago

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.

vincentortegajr · 1 year ago

@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:

  • My .claude.json has grown to 65MB, causing MCP server initialization

failures

  • This results in 72 duplicate MCP processes spawning as the system

struggles to parse the file

  • Only 1 of 6 configured MCP servers successfully connects

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.

jdanbrown · 1 year ago

Another pain point: Storing chat history in ~/.claude.json makes it annoying to version control the user config in ~/.claude.json, because every time you run claude the file updates and your git repo is dirty again.

I'd like to be able to version control my ~/.claude.json file without machine-generated noise like:

  • project "history"
  • "cachedChangelog"
  • etc.
expozeur · 1 year ago

Agreed — it's pretty bizarre to store chat logs in a config file. Why is this the case?

cosier · 1 year ago

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.

nonrev76 · 1 year ago

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.

dimension-zero · 1 year ago

Having issues with bloated .config.json file, full of projects history and cachedChangelog. 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 settings
  • Separate cache directory for changelogs

Ask 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.

rebuyengine · 1 year ago

Totally unacceptable to be storing mutable data in a config file like this. Please do something about this...

ALeslie743 · 1 year ago

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!

github-actions[bot] · 1 year ago

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.