token-statslisted
Install: claude install-skill mahmoudimus/simba
# /token-stats - Token Economics Dashboard
Show the token savings achieved by using search-first exploration vs blind file reading.
## Instructions
When the user invokes `/token-stats`, analyze token usage and display savings.
### 1. Gather Activity Data
```bash
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")
ACTIVITY_FILE="$REPO_ROOT/.simba/search/activity.log"
# Count files read this session
if [ -f "$ACTIVITY_FILE" ]; then
echo "=== Session Activity ==="
FILES_READ=$(grep -c "READ:" "$ACTIVITY_FILE" 2>/dev/null || echo "0")
FILES_EDITED=$(grep -c "EDIT:" "$ACTIVITY_FILE" 2>/dev/null || echo "0")
SEARCHES=$(grep -c "SEARCH:" "$ACTIVITY_FILE" 2>/dev/null || echo "0")
echo "Files read: $FILES_READ"
echo "Files edited: $FILES_EDITED"
echo "Searches performed: $SEARCHES"
else
echo "No activity log found for this session"
fi
```
### 2. Calculate Codebase Stats
```bash
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")
# Total files in codebase
TOTAL_FILES=$(rg --files "$REPO_ROOT" 2>/dev/null | wc -l | tr -d ' ')
# Estimate total tokens (rough: ~1.33 tokens per word, ~3 words per line)
TOTAL_LINES=$(rg -c '' "$REPO_ROOT" 2>/dev/null | awk -F: '{s+=$2} END {print s}')
ESTIMATED_TOTAL_TOKENS=$((TOTAL_LINES * 4 / 3))
echo ""
echo "=== Codebase Size ==="
echo "Total indexable files: $TOTAL_FILES"
echo "Total lines: $TOTAL_LINES"
echo "Estimated tokens: $ESTIMATED_TOTAL_TOKENS"
```
### 3. Query Memor