Data & AI

delete-claude-code-history - Claude MCP Skill

Clear accumulated chat history from Claude Code's .claude.json configuration file to reduce file size and improve performance

SEO Guide: Enhance your AI agent with the delete-claude-code-history tool. This Model Context Protocol (MCP) server allows Claude Desktop and other LLMs to clear accumulated chat history from claude code's .claude.json configuration file to reduce file siz... Download and configure this skill to unlock new capabilities for your AI workflow.

🌟1 stars • 10 forks
šŸ“„0 downloads

Documentation

SKILL.md
# Delete Claude Code History

When this command is used, execute the bash script to clear all project history from Claude Code's configuration file while preserving all other settings.

---

<instruction>
Clear the accumulated chat history from Claude Code's .claude.json configuration file to reduce file size and improve performance. This removes only the "history" arrays from each project while preserving all other configuration and settings.
</instruction>

<context>
Claude Code stores chat history for every project in ~/.claude.json. Over time, this file grows significantly large as it accumulates history for all projects. The file structure contains a "projects" key at root level with project paths as keys, each containing an object with a "history" array that needs to be cleared periodically.
</context>

<script>
```bash
#!/bin/bash

# Clear Claude Code history from .claude.json
CLAUDE_CONFIG="$HOME/.claude.json"

# Check if file exists
if [ ! -f "$CLAUDE_CONFIG" ]; then
    echo "āŒ Claude Code config not found at: $CLAUDE_CONFIG"
    exit 1
fi

# Create backup
BACKUP_FILE="${CLAUDE_CONFIG}.backup.$(date +%Y%m%d_%H%M%S)"
cp "$CLAUDE_CONFIG" "$BACKUP_FILE"
echo "āœ… Created backup: $BACKUP_FILE"

# Clear history for all projects using jq
if command -v jq &> /dev/null; then
    # Use jq to clear history arrays
    jq '.projects |= with_entries(.value.history = [])' "$CLAUDE_CONFIG" > "${CLAUDE_CONFIG}.tmp" && \
    mv "${CLAUDE_CONFIG}.tmp" "$CLAUDE_CONFIG"
    
    # Count cleared projects
    PROJECT_COUNT=$(jq '.projects | keys | length' "$CLAUDE_CONFIG")
    
    # Calculate size reduction
    ORIGINAL_SIZE=$(stat -f%z "$BACKUP_FILE" 2>/dev/null || stat -c%s "$BACKUP_FILE" 2>/dev/null)
    NEW_SIZE=$(stat -f%z "$CLAUDE_CONFIG" 2>/dev/null || stat -c%s "$CLAUDE_CONFIG" 2>/dev/null)
    SIZE_REDUCTION=$((ORIGINAL_SIZE - NEW_SIZE))
    SIZE_REDUCTION_MB=$(echo "scale=2; $SIZE_REDUCTION / 1048576" | bc)
    
    echo "āœ… Cleared history for $PROJECT_COUNT projects"
    echo "šŸ“‰ File size reduced by ${SIZE_REDUCTION_MB}MB ($(echo "scale=1; $SIZE_REDUCTION * 100 / $ORIGINAL_SIZE" | bc)%)"
    echo "šŸ“ Original: $(echo "scale=2; $ORIGINAL_SIZE / 1048576" | bc)MB → New: $(echo "scale=2; $NEW_SIZE / 1048576" | bc)MB"
else
    echo "āŒ jq is required but not installed. Install with: brew install jq (macOS) or apt-get install jq (Linux)"
    exit 1
fi

echo "✨ Claude Code history cleared successfully!"
```
</script>

<constraints>
- Must preserve all non-history configuration data
- Must create a timestamped backup before modification
- Must use atomic file operations to prevent corruption
- Must handle both macOS and Linux file systems
- Requires jq for safe JSON manipulation
</constraints>

<output_format>
Execute the bash script and report:
1. Number of projects processed
2. File size reduction achieved
3. Backup file location
4. Confirmation of successful completion
</output_format>

<usage>
Run this command when:
- Claude Code feels sluggish due to large config file
- Starting fresh conversations while preserving settings
- Regular maintenance (monthly recommended)
- Before sharing or debugging configuration issues
</usage>

<example>
User: /plx:clear-claude-code-history
Assistant: I'll clear the accumulated chat history from your Claude Code configuration.

[Executes script]

āœ… Created backup: /Users/username/.claude.json.backup.20240109_143022
āœ… Cleared history for 48 projects  
šŸ“‰ File size reduced by 15.3MB (87%)
šŸ“ Original: 17.5MB → New: 2.2MB
✨ Claude Code history cleared successfully!

Your Claude Code history has been cleared while preserving all settings. A backup was saved in case you need to restore any conversation history.
</example>

Signals

Avg rating⭐ 0.0
Reviews0
Favorites0

Information

Repository
appboypov/pew-pew-plaza-packs
Author
appboypov
Last Sync
5/10/2026
Repo Updated
4/1/2026
Created
1/16/2026

Reviews (0)

No reviews yet. Be the first to review this skill!

Related Skills

browser-use

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, or extract information from web pages.

⭐ 23280

cloud

Documentation reference for using Browser Use Cloud — the hosted API and SDK for browser automation. Use this skill whenever the user needs help with the Cloud REST API (v2 or v3), browser-use-sdk (Python or TypeScript), X-Browser-Use-API-Key authentication, cloud sessions, browser profiles, profile sync, CDP WebSocket connections, stealth browsers, residential proxies, CAPTCHA handling, webhooks, workspaces, skills marketplace, liveUrl streaming, pricing, or integration patterns (chat UI, subagent, adding browser tools to existing agents). Also trigger for questions about n8n/Make/Zapier integration, Playwright/ Puppeteer/Selenium on cloud infrastructure, or 1Password vault integration. Do NOT use this for the open-source Python library (Agent, Browser, Tools config) — use the open-source skill instead.

⭐ 23280

agent-builder

Design and build AI agents for any domain. Use when users: (1) ask to "create an agent", "build an assistant", or "design an AI system" (2) want to understand agent architecture, agentic patterns, or autonomous AI (3) need help with capabilities, subagents, planning, or skill mechanisms (4) ask about Claude Code, Cursor, or similar agent internals (5) want to build agents for business, research, creative, or operational tasks Keywords: agent, assistant, autonomous, workflow, tool use, multi-step, orchestration

⭐ 14877

writing-plans

Use when you have a spec or requirements for a multi-step task, before touching code

⭐ 13220

Related Guides