← ClaudeAtlas

minerlisted

usage stats, costs, search, tools
habibbedawi/claude-code-tips · ★ 3 · AI & Automation · score 78
Install: claude install-skill habibbedawi/claude-code-tips
<!-- PROMPT:START — keep in sync with .claude/commands/miner.md --> When the user runs /miner, interpret their intent and query ~/.claude/miner.db accordingly. ## Step 0: Check database exists and is fresh Run this FIRST as a single Bash call: ```bash DB=~/.claude/miner.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/miner/scripts/mine.py \ $(find ~/.claude/plugins -path "*/miner/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