close
Skip to content

History accumulation in .claude.json causes performance issues and storage bloat #5024

@ravikalla

Description

@ravikalla

Description

The .claude.json file continuously accumulates conversation history for each project, leading to:

  • File sizes growing to hundreds of MB or more
  • Slower Claude Code startup times
  • Potential system performance degradation
  • No automatic cleanup mechanism

Current Behavior

  • Every conversation in every project is stored indefinitely
  • History entries include full conversation context, pasted contents, and metadata
  • File can grow to 968KB+ (as observed) and continues growing
  • No built-in limits or rotation mechanism

Expected Behavior

  • Automatic history rotation/cleanup after reaching a size limit
  • Configurable history retention (e.g., last N conversations or last X days)
  • Option to disable history storage entirely
  • Better separation of configuration (MCP servers) from history data

Impact

  • Users must manually edit .claude.json to remove old history
  • Risk of losing MCP server configurations during manual cleanup
  • Performance degradation as file size increases
  • Poor user experience for long-term users

Suggested Solutions

  1. Implement automatic history rotation (e.g., keep only last 100 conversations per project)
  2. Add configuration option for history retention limits
  3. Separate history storage from configuration storage
  4. Add claude history prune command with options like --older-than 30d
  5. Show warnings when history file exceeds certain size thresholds

Environment

  • Claude Code version: Latest
  • OS: macOS (but affects all platforms)
  • File size observed: 968KB+ and growing

Reproduction Steps

  1. Use Claude Code regularly across multiple projects
  2. Check ~/.claude.json file size after a few weeks/months
  3. Observe performance degradation and file bloat

Workaround

Currently users must manually edit .claude.json or use claude history clear which removes ALL history across all projects.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions