← スキル一覧に戻る

history-pruner
by Folly-Partners
Syncs my Claude code instances across computers.
⭐ 0🍴 0📅 2026年1月25日
SKILL.md
name: history-pruner description: Prunes old Claude Code conversation history to save disk space. Use when project files get large (>50MB) or periodically for maintenance.
history-pruner - Conversation History Cleanup
Automatically prunes old Claude Code conversation history files to prevent them from growing too large.
When to Use This Skill
Invoke this skill when:
- User mentions disk space issues with Claude Code
- User asks to clean up or prune conversation history
- Project files in
~/claudesync/projects/exceed 50MB - User wants to do maintenance on Claude Code storage
- Before syncing if files are getting too large for GitHub
How It Works
Project files (~/claudesync/projects/**/*.jsonl) store full conversation history including:
- Messages (keep)
- Summaries (keep)
- Tool results with full output (PRUNE - this is the bulk of the data)
- Thinking blocks (prune old ones)
- File history snapshots (prune old ones)
Pruning Strategy
Conservative (default)
- Keep last 7 days of full history
- For older entries: truncate
tool_resultcontent to 500 chars - Keep all summaries and message structure intact
Aggressive
- Keep last 3 days of full history
- For older entries: remove
tool_resultcontent entirely (keep metadata) - Remove thinking blocks older than 7 days
- Remove file-history-snapshots older than 14 days
Commands
Check current sizes
du -sh ~/claudesync/projects/-Users-andrewwilkinson/*.jsonl | sort -hr | head -10
Run pruning script
~/claudesync/skills/history-pruner/prune-history.sh [conservative|aggressive]
Dry run (see what would be pruned)
~/claudesync/skills/history-pruner/prune-history.sh --dry-run
Manual Pruning Steps
If the script isn't available, prune manually:
-
Identify large files:
du -sh ~/claudesync/projects/**/*.jsonl | sort -hr | head -5 -
Backup before pruning:
cp large-file.jsonl large-file.jsonl.bak -
Prune with jq (truncate old tool results):
# Keep entries from last 7 days, truncate older tool_results CUTOFF=$(date -v-7d +%s)000 jq -c 'if .timestamp and .timestamp < '$CUTOFF' and .type == "tool_result" then .content = (.content[:500] + "... [truncated]") else . end' file.jsonl > file.pruned.jsonl -
Verify and replace:
wc -l file.jsonl file.pruned.jsonl # Should have same line count mv file.pruned.jsonl file.jsonl
Automation
To run weekly cleanup, add to your personal crontab if desired:
# Add to crontab for weekly Sunday 3am cleanup
0 3 * * 0 ~/.claude/plugins/marketplaces/Folly/skills/history-pruner/prune-history.sh conservative
Note: Component-sync runs automatically at session start via the SessionStart hook.
Important Notes
- Always backup before aggressive pruning
- Pruning removes ability to see full old tool outputs
- Summaries are preserved so conversation context remains
- This won't break Claude Code - it handles missing/truncated data gracefully
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です