mirror of
https://github.com/alleneubank/claude-code.git
synced 2026-09-14 14:06:56 +08:00
8ec333eddb
Plugin caches ship shared docs as relative symlinks pointing outside the skill dir; a verbatim copy dangles in the codex tree and GNU diff reports the broken pair as perpetual --check drift on Linux.
Claude Code Usage Tracking System
Track and analyze your Claude Code usage across all projects.
Quick Setup
-
Install the tracking hooks:
python3 ~/.claude/scripts/setup-usage-tracking.pyThis writes hook overrides to
~/.claude/settings.local.jsonand regenerates~/.claude/settings.jsonviaclaude-settings-merge. -
Restart Claude Code for hooks to take effect
-
View your usage:
# Summary statistics python3 ~/.claude/scripts/analyze-usage.py --summary # Last 30 days python3 ~/.claude/scripts/analyze-usage.py --summary --days 30 # Command history python3 ~/.claude/scripts/analyze-usage.py --commands # Session details python3 ~/.claude/scripts/analyze-usage.py --sessions # Live dashboard python3 ~/.claude/scripts/usage-dashboard.py
What Gets Tracked
- Session Data: Start/end times, duration, project paths
- Tool Usage: Every tool invocation with timestamps
- Commands: All Bash commands with descriptions
- Projects: Time spent per project
- Events: Notifications, stops, subagent activity
Data Storage
- SQLite Database:
~/.claude/usage-tracking.db - JSON Logs:
~/.claude/usage-logs/YYYY-MM-DD.jsonl
Export Data
python3 ~/.claude/scripts/analyze-usage.py --export my-usage-data.json
Privacy
All data is stored locally on your machine. Nothing is sent externally.
Customization
Edit ~/.claude/scripts/usage-tracker.py to:
- Add custom tracking logic
- Filter sensitive data
- Change storage locations
- Add new metrics
Troubleshooting
-
Hooks not working?
- Check that
~/.claude/settings.jsoncontains the hook entries (rerunsetup-usage-tracking.pyif not) - Restart Claude Code so it re-reads settings
- Run with
--debugflag
- Check that
-
No data showing?
- Ensure hooks are installed
- Check if database exists:
ls ~/.claude/usage-tracking.db - Verify script permissions
-
Reset tracking:
rm ~/.claude/usage-tracking.db rm -rf ~/.claude/usage-logs/