# Daily Usage Percentage Tracker Claude Code daily usage quota tracker showing percentage of daily limit consumed with visual progress bar, time remaining, and budget pacing indicators. --- ## Metadata **Title:** Daily Usage Percentage Tracker **Category:** statuslines **Author:** JSONbored **Added:** October 2025 **Tags:** daily-limit, quota-tracking, usage-percentage, budget-pacing, limit-monitoring **URL:** https://claudepro.directory/statuslines/daily-usage-percentage-tracker ## Overview Claude Code daily usage quota tracker showing percentage of daily limit consumed with visual progress bar, time remaining, and budget pacing indicators. ## Content #!/usr/bin/env bash DAILY USAGE PERCENTAGE TRACKER FOR CLAUDE CODE TRACKS PROGRESS TOWARD DAILY USAGE LIMITS READ JSON FROM STDIN read -r input EXTRACT SESSION COST sessioncost=$(echo "$input" | jq -r '.cost.totalcost_usd // 0') DAILY USAGE TRACKING FILE (RESETS AT MIDNIGHT) USAGE_DIR="${HOME}/.claude-code-usage" mkdir -p "$USAGE_DIR" GET CURRENT DATE FOR DAILY RESET current_date=$(date +%Y-%m-%d) USAGEFILE="${USAGEDIR}/daily-${current_date}.usage" INITIALIZE USAGE FILE IF DOESN'T EXIST if [ ! -f "$USAGE_FILE" ]; then echo "0" > "$USAGE_FILE" fi READ CUMULATIVE DAILY USAGE dailyusage=$(cat "$USAGEFILE") UPDATE WITH CURRENT SESSION COST (SIMPLE ADDITION) NOTE: THIS IS PER-SESSION TRACKING, MAY NEED DEDUPLICATION FOR ACCURACY updatedusage=$(echo "$dailyusage + $session_cost" | bc) echo "$updatedusage" > "$USAGEFILE" CONFIGURABLE: SET YOUR DAILY BUDGET LIMIT (DEFAULT $10/DAY) DAILY_LIMIT= CALCULATE PERCENTAGE OF DAILY LIMIT USED if (( $(echo "$DAILY_LIMIT > 0" | bc -l) )); then usagepercentage=$(echo "scale=1; ($updatedusage * ) / $DAILY_LIMIT" | bc) else usage_percentage=0 fi CONVERT TO INTEGER FOR COMPARISONS usagepercentageint=$(echo "$usage_percentage / 1" | bc) CAP PERCENTAGE AT FOR DISPLAY (CAN EXCEED IN PRACTICE) if [ $usagepercentageint -gt ]; then display_percentage= OVERFLOW=true else displaypercentage=$usagepercentage_int OVERFLOW=false fi CALCULATE REMAINING BUDGET remaining=$(echo "$DAILYLIMIT - $updatedusage" | bc) COLOR CODING BASED ON USAGE PERCENTAGE if [ $usagepercentageint -lt 50 ]; then USAGE_COLOR="\[38;5;46m" # Green: % used (over budget) USAGE_ICON="✗" USAGE_STATUS="OVER BUDGET" fi BUILD PROGRESS BAR (20 CHARACTERS WIDE) barfilled=$(( displaypercentage / 5 )) # Each char = 5% barempty=$(( 20 - barfilled )) if [ $bar_filled -gt 0 ]; then bar=$(printf "█%.0s" $(seq 1 $barfilled))$(printf "░%.0s" $(seq 1 $barempty)) else bar="░░░░░░░░░░░░░░░░░░░░" fi CALCULATE HOURS REMAINING IN DAY FOR PACING current_hour=$(date +%H) hoursremaining=$((24 - currenthour)) PACING INDICATOR (ARE WE ON TRACK FOR 24-HOUR PERIOD?) expectedpercentage=$(( (24 - hoursremaining) * / 24 )) if [ $usagepercentageint -gt $expectedpercentage ] && [ $hoursremaining -gt 0 ]; then PACING="📈 ahead of pace" elif [ $usagepercentageint -lt $expectedpercentage ] && [ $hoursremaining -gt 0 ]; then PACING="📉 below pace" else PACING="" fi FORMAT REMAINING BUDGET if (( $(echo "$remaining > 0" | bc -l) )); then remaining_display="\$${remaining} left" else remaining_display="\$ left" fi RESET="\[0m" OUTPUT STATUSLINE if [ "$OVERFLOW" = true ]; then echo -e "${USAGEICON} Daily: ${USAGECOLOR}${bar}${RESET} ${usagepercentage}% | ${USAGESTATUS} | ${remaining_display}" else echo -e "${USAGEICON} Daily: ${USAGECOLOR}${bar}${RESET} ${usagepercentage}% | ${remainingdisplay} ${PACING}" fi KEY FEATURES ? Daily usage quota tracking against configurable budget limit (default $10/day) ? Percentage of daily limit consumed with visual 20-char progress bar ? Remaining budget calculation updated in real-time ? Budget pacing indicator comparing actual vs expected usage by hour ? Automatic daily reset at midnight (date-based tracking files) ? Color-coded status (green %) ? Overflow detection and warnings when exceeding daily budget ? Persistent usage storage per day in ~/.claude-code-usage CONFIGURATION Format: bash Refresh Interval: 2000ms Position: left USE CASES ? Budget management for daily Claude Code spending limits ? Preventing unexpected overspending with real-time alerts ? Tracking usage pacing throughout the day ? Setting and monitoring daily cost budgets ? Team cost allocation per developer per day ? Identifying days with abnormally high usage for analysis TROUBLESHOOTING 1) Usage percentage not updating or stuck at 0% Solution: Verify cost.totalcostusd field exists: echo '$input' | jq .cost.totalcostusd. Check usage file exists: cat ~/.claude-code-usage/daily-$(date +%Y-%m-%d).usage. Ensure bc is installed: which bc. Script uses simple addition - may need session deduplication for accuracy across multiple statusline updates. 2) Daily limit showing OVER BUDGET when under actual budget Solution: Default DAILYLIMIT is $. Configure your actual limit in script: DAILYLIMIT= (for $25/day budget). Verify limit calculation: usagepercentage = (updatedusage * ) / DAILY_LIMIT. Check usage file value matches expected spending. 3) Usage not resetting at midnight Solution: Script uses date-based filenames: daily-YYYY-MM-DD.usage. Each new day creates new file automatically. Old files remain for history. Check current file: ls ~/.claude-code-usage/daily-*.usage. If date command timezone incorrect, reset may occur at wrong time. Verify: date +%Y-%m-%d. 4) Pacing indicator showing incorrect ahead/below pace status Solution: Pacing compares actual usage % vs expected % based on hours elapsed. Formula: expected = (24 - hours_remaining) * / 24. At noon (12 hours), expected is 50%. If actual usage is 40%, shows 'below pace'. Adjust logic if you have non-24-hour daily windows. 5) Remaining budget showing negative or incorrect values Solution: Remaining = DAILYLIMIT - updatedusage. If negative, script displays '$ left' and OVER BUDGET status. Verify DAILYLIMIT setting matches your actual budget. Check updatedusage calculation: cat usage file. bc arithmetic: echo '$DAILYLIMIT - $updatedusage' | bc. 6) Multiple sessions causing duplicate cost additions Solution: Script adds sessioncost every update - can over-count if same session updates multiple times. For accuracy, track by unique sessionid and update (don't add) session totals. Alternative: integrate with official usage API if available. Current implementation optimized for real-time awareness, not perfect accounting. TECHNICAL DETAILS Documentation: https://docs.claude.com/en/docs/claude-code/statusline PREVIEW ✓ Daily: ████████░░░░░░░░░░░░ 40% | $ left 📉 below pace --- Source: Claude Pro Directory Website: https://claudepro.directory URL: https://claudepro.directory/statuslines/daily-usage-percentage-tracker This content is optimized for Large Language Models (LLMs). For full formatting and interactive features, visit the website.