mine

April 7, 2026 · View on GitHub

if this helped you, star it. it helps others find it.

mines every claude code session into a local sqlite database. total recall for your dev work.

install

claude plugin add anipotts/mine

requires python3 (stdlib only, no pip) and sqlite3 (ships with macOS/linux).

usage

just type /mine followed by what you want to know. plain language works.

daily dashboard

> /mine
📊 last 7 days

  date        sessions  api value
  2026-03-28  1         \$49.05
  2026-03-27  5         \$82.55
  2026-03-26  3         \$15.64
  2026-03-25  8         \$67.87

  top projects: fullstack (50 sessions), quantercise.com (36), rudy (28)
  top tools: Bash (10.4K), Read (9.3K), Edit (5.1K)
  cache hit rate: 95%

search past sessions

> /mine search "websocket"
  3 sessions matched "websocket"

  1. imessage-mcp (2026-03-12) — "implement websocket transport for real-time sync"
     38 tool calls, 22 min active, \$4.12
  2. rudy (2026-03-08) — "add websocket reconnection with exponential backoff"
     67 tool calls, 34 min active, \$8.91
  3. fullstack (2026-02-28) — "debug websocket auth handshake failure"
     12 tool calls, 8 min active, \$1.44

find where sessions went wrong

> /mine mistakes
  session health across all projects

  signal                                    sessions   what it means
  burned (high cost, no commits)            23         effort spent, nothing shipped
  looped (same file edited 5+ times)        130        claude was stuck iterating
  compacted (context overflowed)            103        task was too big for one session
  abandoned (20+ tool calls, no commit)     41         work started but never landed

  worst offenders:
  1. fullstack (2026-03-14) — 143 tool calls, 2 compactions, 0 commits, \$28.41
  2. antileak (2026-03-09) — 98 tool calls, 3 compactions, 0 commits, \$19.22

  mine remembers these. next time you start a session on these projects,
  the SessionStart hook surfaces what went wrong so claude adjusts its approach.

more intents

commandwhat it does
/mine cost this monthcost breakdown by project and model
/mine top projectsall projects ranked by sessions and API value
/mine top toolstool usage breakdown
/mine cache hit ratecache efficiency analysis
/mine hotspotsfiles you keep editing across sessions
/mine loopswhere you got stuck (same file edited 5+ times)
/mine story myappnarrative history of a project
/mine compare this week vs lastside-by-side period comparison
/mine backfillre-parse recent session logs into the database
/mine helpfull list of intents and examples

how it works

mine runs 5 hooks across the claude code session lifecycle via a single python dispatcher (hooks/hook.py):

eventwhat it does
SessionEndparses session + subagent transcripts into mine.db (async)
SubagentStopparses a single subagent transcript on completion
PreCompactincrements compaction_count + cost anomaly warning if >2x average
SessionStartproject move detection, solution recall, auto-backfill
PostToolUseFailurerecords errors, surfaces past similar failures to prevent repeats

one file, zero bash scripts, zero jq dependency. all JSON parsing via stdlib, all SQL via parameterized queries.

config

create ~/.claude/mine.json to toggle individual features:

{
  "ingest": true,
  "search": true,
  "mistakes": true,
  "burn": true,
  "move_detect": true,
  "compact": true,
  "auto_backfill": true
}

all features default to enabled. set any to false to disable.

database

everything lives at ~/.claude/mine.db. schema: scripts/schema.sql.

key views:

viewwhat it shows
user_session_costsper-session cost, duration, tools (main sessions only)
user_tool_callstool calls with project context
project_costsper-project cost, session count, date range
daily_costsper-day cost and token totals
# quick stats
python3 scripts/mine.py --stats

# backfill all history
python3 scripts/mine.py --workers 8

part of claude-code-tips

more from me

license

MIT