Skip to content

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

Closed

Description

@vincentortegajr

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.

Activity

  1. bcherny commented on May 30, 2025

    @bcherny
    Collaborator

    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.

  2. vincentortegajr commented on Jun 3, 2025

    @vincentortegajr
    Author

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

  3. jdanbrown commented on Jun 6, 2025

    @jdanbrown

    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.
  4. expozeur commented on Jun 24, 2025

    @expozeur

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

  5. cosier commented on Jul 9, 2025

    @cosier

    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.

  6. nonrev76 commented on Jul 20, 2025

    @nonrev76

    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.

  7. dimension-zero commented on Jul 27, 2025

    @dimension-zero

    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.

  8. ALeslie743 commented on Aug 1, 2025

    @ALeslie743

    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!

  9. github-actions commented on Aug 11, 2025

    @github-actions

    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.

  10. locked as resolved and limited conversation to collaborators on Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions