/mine
Description
one command for everything in your usage data. just ask what you want to know in plain language
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
Repository README
This is the README for anipotts/claude-code-tips, shared by 6 entries
in this directory. It describes the repository, not this entry specifically.
name: mine description: usage stats, costs, search, tools allowed-tools:
- Bash
- Read
- AskUserQuestion
- CronCreate
- CronDelete
- CronList
/mine
one command for everything in your usage data. just ask what you want to know in plain language
examples
/mine → dashboard: today's sessions, weekly cost, top tools
/mine how much have i spent → cost breakdown by project, model, time period
/mine value → full API inference value at published rates, ROI
/mine search "websocket" → full-text search across all conversations
/mine what's my cache hit rate → cache efficiency analysis
/mine wasted sessions → expensive failures with high errors
/mine top projects → project activity ranking
/mine this week → everything from the last 7 days
/mine compare models → model usage and cost comparison
/mine health → project health: codebase size, git activity, tests
/mine backfill → re-mine recent sessions into the database
When the user runs /mine, interpret their intent and query ~/.claude/mine.db accordingly.
## Step 0: Check database exists and is fresh
Run this FIRST as a single Bash call:
```bash
DB=~/.claude/mine.db
if [ ! -f "$DB" ]; then
echo "NO_DB"
exit 0
fi
LATEST=$(sqlite3 -noheader "$DB" "SELECT MAX(start_time) FROM sessions WHERE is_subagent = 0;" 2>/dev/null)
TOTAL=$(sqlite3 -noheader "$DB" "SELECT COUNT(*) FROM sessions WHERE is_subagent = 0;" 2>/dev/null)
FIRST=$(sqlite3 -noheader "$DB" "SELECT MIN(start_time) FROM sessions WHERE is_subagent = 0;" 2>/dev/null)
NEWEST_JSONL=$(find ~/.claude/projects -name "*.jsonl" -newer "$DB" 2>/dev/null | head -1)
if [ -n "$NEWEST_JSONL" ]; then
echo "STALE|$FIRST|$LATEST|$TOTAL"
# try to auto-backfill
for p in ./scripts/mine.py ./plugins/mine/scripts/mine.py \
$(find ~/.claude/plugins -path "*/mine/scripts/mine.py" 2>/dev/null | head -1); do
if [ -f "$p" ]; then python3 "$p" --incremental 2>&1; break; fi
done
# re-read after backfill
LATEST=$(sqlite3 -noheader "$DB" "SELECT MAX(start_time) FROM sessions WHERE is_subagent = 0;" 2>/dev/null)
TOTAL=$(sqlite3 -noheader "$DB" "SELECT COUNT(*) FROM sessions WHERE is_subagent = 0;" 2>/dev/null)
FIRST=$(sqlite3 -noheader "$DB" "SELECT MIN(start_time) FROM sessions WHERE is_subagent = 0;" 2>/dev/null)
echo "REFRESHED|$FIRST|$LATEST|$TOTAL"
else
echo "FRESH|$FIRST|$LATEST|$TOTAL"
fi
```
- If NO_DB: run an interactive first-time setup:
1. Use AskUserQuestion to ask:
title: "no mine.db found — want to create it now?"
Select from:
- "yes, mine my sessions now" → find and run mine.py (search ./scripts/mine.py, ./plugins/mine/scripts/mine.py, then ~/.claude/plugins/*/mine/scripts/mine.py). Run it with --incremental. Show progress. When done, re-run the dashboard query and show
Related Skills
mcp-server-postgres
Read-only PostgreSQL database access.
Data mcp-server-sqlite
SQLite database interaction and querying.
Data mcp-server-google-maps
Google Maps integration for location data.
Data Bitbucket Data Center
---
Data Csv Data Summarizer
Automatically analyze CSV files and generate comprehensive insights with visualizations
Data OpenViking
Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Data