### Display Example: After claudetop Installation Source: https://github.com/liorwn/claudetop/blob/main/README.md Illustrates the enhanced Claude Code interface after claudetop is installed, providing real-time session metrics, cost, and efficiency indicators. ```text 14:32 my-project/src/app Opus 20m 0s +256/-43 #auth-refactor 152.3K in / 45.2K out ████░░░░░░ 38% $3.47 $5.10/hr ~$174/mo cache: 66% efficiency: $0.012/line opus:~$3.20 sonnet:~$0.88 haiku:~$0.23 $5 MARK | TRY /fast | main* | CI ✓ | ♫ Bonobo - Kerala ``` -------------------------------- ### Enable example plugin Source: https://github.com/liorwn/claudetop/blob/main/README.md Copy an example plugin from the examples directory to the active plugins directory to enable it. ```bash cp ~/.claude/claudetop.d/_examples/spotify.sh ~/.claude/claudetop.d/ ``` -------------------------------- ### Install claudetop: Clone and Install Script Source: https://github.com/liorwn/claudetop/blob/main/README.md Use this bash script to clone the claudetop repository and run the installation script for a local setup. ```bash git clone https://github.com/liorwn/claudetop.git cd claudetop && ./install.sh ``` -------------------------------- ### Display Example: Before claudetop Source: https://github.com/liorwn/claudetop/blob/main/README.md Represents the user interface in Claude Code before claudetop is installed, showing a blank prompt with no cost or context visibility. ```text > ``` -------------------------------- ### Install claudetop: One-liner Installation Source: https://github.com/liorwn/claudetop/blob/main/README.md Execute this curl command to download and run the claudetop installation script directly. ```bash curl -fsSL https://raw.githubusercontent.com/liorwn/claudetop/main/install.sh | bash ``` -------------------------------- ### Status Line Output Example Source: https://context7.com/liorwn/claudetop/llms.txt An example of the full status line output format, showing project, model, duration, token counts, cost, and smart alerts. ```text 14:32 my-project/src/app Opus 20m 0s +256/-43 #auth-refactor 152.3K in / 45.2K out ████░░░░░░ 38% $3.47 $5.10/hr ~$174/mo cache: 66% efficiency: $0.012/line opus:~$3.20 sonnet:~$0.88 haiku:~$0.23 in:80% out:20% (fresh:15% cwrite:7% cread:76%) $5 MARK | main* | CI ✓ | ♫ Artist - Song ``` -------------------------------- ### Install claudetop: As a Claude Code Plugin Source: https://github.com/liorwn/claudetop/blob/main/README.md Install claudetop as a plugin for Claude Code to automatically enable SessionEnd hooks and slash commands. ```bash claude plugin marketplace add liorwn/claudetop claude plugin install claudetop ``` -------------------------------- ### Launch Web Dashboard Source: https://context7.com/liorwn/claudetop/llms.txt Start an interactive analytics dashboard with visualizations and session filtering. ```bash claudetop-engine dashboard claudetop-engine dashboard 3000 ``` -------------------------------- ### Display Example: Real-time Claude Code Session Metrics Source: https://github.com/liorwn/claudetop/blob/main/README.md This is an example of the output displayed by claudetop during an active Claude Code session, showing project details, model usage, cost, and efficiency metrics. ```text 14:32 my-project/src/app Opus 20m 0s +256/-43 #auth-refactor 152.3K in / 45.2K out ████░░░░░░ 38% $3.47 $5.10/hr ~$174/mo cache: 66% efficiency: $0.012/line opus:~$3.20 sonnet:~$0.88 haiku:~$0.23 in:80% out:20% (fresh:15% cwrite:7% cread:76%) $5 MARK | main* | ♫ Artist - Song | PROJ-123 | CI ✓ ``` -------------------------------- ### Open Claudetop Dashboard Source: https://github.com/liorwn/claudetop/blob/main/commands/dashboard.md Executes the claudetop-dashboard command to open the web interface. If the command is not found, it suggests installation instructions. ```bash claudetop-dashboard 2>/dev/null || echo "claudetop-dashboard not found. Install: cd ~/claudetop && ./install.sh" ``` -------------------------------- ### Configure Status Line Provider Source: https://context7.com/liorwn/claudetop/llms.txt Example JSON configuration to set claudetop as the status line provider in Claude Code settings. ```json { "statusLine": { "type": "command", "command": "~/.claude/claudetop.sh", "padding": 1 } } ``` -------------------------------- ### Configure Session Recording Hook Source: https://context7.com/liorwn/claudetop/llms.txt Example JSON configuration to register the session recording hook in Claude Code settings. ```json { "hooks": { "SessionEnd": [ { "matcher": "", "hooks": [ { "type": "command", "command": "~/.claude/hooks/claudetop-session-end.sh" } ] } ] } } ``` -------------------------------- ### Show Git Branch with Dirty Status Source: https://context7.com/liorwn/claudetop/llms.txt Displays the current Git branch name with a '*' indicator if the working directory is dirty. Requires `jq` to be installed. ```bash #!/bin/bash # ~/.claude/claudetop.d/git-branch.sh # Included by default - shows: main* (branch + dirty indicator) CWD=$(echo "$(cat)" | jq -r '.cwd // ""') [ -z "$CWD" ] && exit 0 cd "$CWD" 2>/dev/null || exit 0 BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) || exit 0 DIRTY="" if ! git diff --quiet HEAD 2>/dev/null; then DIRTY="\033[33m*\033[0m" fi printf "\033[35m%s\033[0m%b" "$BRANCH" "$DIRTY" ``` -------------------------------- ### Show GitHub CI Status Source: https://context7.com/liorwn/claudetop/llms.txt Displays the CI status for the current branch using the GitHub CLI (`gh`). Shows success (✓), failure (✗), or pending/unknown (…). Requires `jq` and `gh` CLI to be installed. ```bash #!/bin/bash # ~/.claude/claudetop.d/gh-ci-status.sh # Shows: CI ✓ (green) or CI ✗ (red) or CI … (yellow) set -euo pipefail INPUT=$(cat) CWD=$(echo "$INPUT" | jq -r '.cwd // ""') [ -z "$CWD" ] && exit 0 cd "$CWD" 2>/dev/null || exit 0 command -v gh >/dev/null 2>&1 || exit 0 BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) || exit 0 # Fetch latest run status (cached for 60 seconds) RUN_JSON=$(gh run list --branch "$BRANCH" --limit 1 --json status,conclusion 2>/dev/null) || exit 0 CONCLUSION=$(echo "$RUN_JSON" | jq -r '.[0].conclusion // ""') if [ "$CONCLUSION" = "success" ]; then printf "\033[32mCI ✓\033[0m" elif [ "$CONCLUSION" = "failure" ]; then printf "\033[31mCI ✗\033[0m" fi # Enable by copying to plugin directory: # cp ~/.claude/claudetop.d/_examples/gh-ci-status.sh ~/.claude/claudetop.d/ ``` -------------------------------- ### Configure Daily Budget Alert Source: https://github.com/liorwn/claudetop/blob/main/README.md Set the `CLAUDETOP_DAILY_BUDGET` environment variable to receive alerts when your daily spending approaches or exceeds the specified budget. ```bash export CLAUDETOP_DAILY_BUDGET=50 ``` -------------------------------- ### View Today's claudetop Session Summary Source: https://context7.com/liorwn/claudetop/llms.txt Display a spending summary for the current day using the `claudetop-stats today` command. The output includes session count, total cost, average cost per session, daily average, cost breakdown by model, and top projects by cost. ```bash claudetop-stats today ``` -------------------------------- ### View Context Composition Source: https://github.com/liorwn/claudetop/blob/main/README.md This output shows the breakdown of context window usage, differentiating between input and output, and further detailing read operations (e.g., cache reads vs. fresh reads). ```text in:80% out:20% (fresh:15% cwrite:7% cread:76%) ``` -------------------------------- ### Set Daily Budget for claudetop Source: https://context7.com/liorwn/claudetop/llms.txt Configure a daily spending budget using the CLAUDETOP_DAILY_BUDGET environment variable. Alerts are triggered at 80% and 100% of the budget. The status line will indicate the remaining budget or if the budget has been exceeded. ```bash # Set daily budget to $50 export CLAUDETOP_DAILY_BUDGET=50 ``` -------------------------------- ### Customize Claudetop Theme Source: https://github.com/liorwn/claudetop/blob/main/README.md Set the `CLAUDETOP_THEME` environment variable to control the verbosity of the output. Options include 'full', 'minimal', and 'compact'. ```bash export CLAUDETOP_THEME=full # Default: 3-5 lines export CLAUDETOP_THEME=minimal # 2 lines export CLAUDETOP_THEME=compact # 1 line ``` -------------------------------- ### Create custom plugin Source: https://github.com/liorwn/claudetop/blob/main/README.md A template for creating a custom status line plugin using bash and jq to parse JSON input. ```bash #!/bin/bash JSON=$(cat) COST=$(echo "$JSON" | jq -r '.cost.total_cost_usd') printf "\033[32m\$%s\033[0m" "$COST" ``` -------------------------------- ### Create Custom Plugin Source: https://context7.com/liorwn/claudetop/llms.txt Develop shell scripts that process session JSON from stdin to output custom status information. ```bash #!/bin/bash # ~/.claude/claudetop.d/my-plugin.sh # Plugins receive session JSON on stdin and output formatted text # Read the session JSON from stdin JSON=$(cat) # Extract data using jq COST=$(echo "$JSON" | jq -r '.cost.total_cost_usd') CWD=$(echo "$JSON" | jq -r '.cwd // ""') # Do something with the data if [ "$(echo "$COST >= 10" | bc)" -eq 1 ]; then # Output with ANSI colors (green warning icon, cost in red) printf "\033[33m⚠\033[0m \033[31m\$%.2f\033[0m" "$COST" fi ``` -------------------------------- ### View Weekly/Monthly claudetop Statistics Source: https://context7.com/liorwn/claudetop/llms.txt Aggregate and view spending statistics over different time periods using `claudetop-stats week`, `claudetop-stats month`, or `claudetop-stats all` for all-time statistics. These commands provide detailed breakdowns of costs, token usage, and model performance. ```bash # This week's summary claudetop-stats week ``` ```bash # This month's summary claudetop-stats month ``` ```bash # All-time statistics claudetop-stats all ``` -------------------------------- ### Configure claudetop Display Theme Source: https://context7.com/liorwn/claudetop/llms.txt Choose the display density for the claudetop status line based on terminal space and preference. Options include 'full' (default), 'minimal', and 'compact'. ```bash # Full theme (default): 3-5 lines with all details export CLAUDETOP_THEME=full ``` ```bash # Minimal theme: 2 lines with essential info export CLAUDETOP_THEME=minimal ``` ```bash # Compact theme: 1 line for tight spaces export CLAUDETOP_THEME=compact ``` -------------------------------- ### Run Deep Analytics Engine Source: https://github.com/liorwn/claudetop/blob/main/README.md The `claudetop-engine` command scans all Claude session JSONL files for comprehensive analytics. It supports scanning to SQLite, viewing daily or all-time stats, and launching a live web dashboard. ```bash claudetop-engine scan # Scan all JSONL files → SQLite claudetop-engine today # Today (with per-turn tool breakdown) claudetop-engine stats # All-time (subagents, top tools, projects) claudetop-engine dashboard # Live web dashboard at localhost:8080 ``` -------------------------------- ### Scan Session Files Source: https://context7.com/liorwn/claudetop/llms.txt Ingest Claude Code JSONL transcripts into a SQLite database for analytics. ```bash claudetop-engine scan ``` -------------------------------- ### Run Claude Code Spending Analytics Source: https://github.com/liorwn/claudetop/blob/main/commands/stats.md Execute the claudetop-stats command with optional arguments to view spending analytics. Defaults to 'week' if no arguments are provided. ```bash claudetop-stats $ARGUMENTS ``` -------------------------------- ### Show Branch Cost Analysis with claudetop-stats Source: https://github.com/liorwn/claudetop/blob/main/commands/branch.md Run this command to display the full cost analysis for a specific git branch or all branches if no argument is provided. Use it to track feature branch costs. ```bash claudetop-stats branch $ARGUMENTS ``` -------------------------------- ### Integrate Claudetop with iTerm2 Source: https://github.com/liorwn/claudetop/blob/main/README.md Configure `CLAUDETOP_ITERM` environment variables to push Claudetop data into iTerm2's tab titles, status bar, and badge watermark for at-a-glance monitoring. ```bash export CLAUDETOP_ITERM=all # Enable everything export CLAUDETOP_ITERM=title # Tab/window title only export CLAUDETOP_ITERM=badge # Watermark overlay only export CLAUDETOP_ITERM=statusbar # User variables for status bar export CLAUDETOP_ITERM=bgcolor # Background color tint by state export CLAUDETOP_ITERM=title,badge # Combine any options ``` -------------------------------- ### View Deep Statistics Source: https://context7.com/liorwn/claudetop/llms.txt Access detailed per-turn cost breakdowns and all-time usage statistics. ```bash claudetop-engine today claudetop-engine stats ``` -------------------------------- ### Update Model Pricing Source: https://context7.com/liorwn/claudetop/llms.txt Refresh local pricing configuration from Anthropic or community sources. ```bash ~/.claude/update-claudetop-pricing.sh claudetop-engine update-pricing ``` -------------------------------- ### Pricing JSON Format Source: https://context7.com/liorwn/claudetop/llms.txt The schema for the pricing configuration file used by the engine. ```json { "_updated": "2026-03-14", "_source": "https://docs.anthropic.com/en/docs/about-claude/models", "models": { "opus": { "match": "opus", "input": 5.00, "cache_write_5min": 6.25, "cache_write_1hr": 10.00, "cache_read": 0.50, "output": 25.00 }, "sonnet": { "match": "sonnet", "input": 3.00, "cache_write_5min": 3.75, "cache_write_1hr": 6.00, "cache_read": 0.30, "output": 15.00, "long_context_input": 6.00, "long_context_output": 22.50, "long_context_threshold": 200000 }, "haiku": { "match": "haiku", "input": 1.00, "cache_write_5min": 1.25, "cache_write_1hr": 2.00, "cache_read": 0.10, "output": 5.00 } } } ``` -------------------------------- ### Set Session Tag for Cost Tracking Source: https://github.com/liorwn/claudetop/blob/main/README.md Use the `CLAUDETOP_TAG` environment variable to tag sessions for specific features or initiatives. You can then use `claudetop-stats tag ` to view costs associated with that tag. ```bash export CLAUDETOP_TAG=auth-refactor # ... work on auth ... claudetop-stats tag auth-refactor # Total cost: $12.40 across 3 sessions ``` -------------------------------- ### View Session History Summaries Source: https://github.com/liorwn/claudetop/blob/main/README.md Use `claudetop-stats` to view session summaries for different time periods. Supports filtering by tag. ```bash claudetop-stats # Today's summary claudetop-stats week # This week claudetop-stats month # This month claudetop-stats all # All time claudetop-stats tag auth # Filter by tag ``` ```text claudetop-stats This Week ────────────────────────────────────────────────────── Summary Sessions: 12 Total cost: $47.30 Avg / session: $3.94 Daily avg: $9.46 Cost by model claude-opus-4-6: $38.20 claude-sonnet-4-6: $9.10 Top projects by cost rri-os $22.50 (4 sessions) pistol-claw $14.80 (5 sessions) the-table $10.00 (3 sessions) ``` -------------------------------- ### Enable iTerm2 Integration for claudetop Source: https://context7.com/liorwn/claudetop/llms.txt Push claudetop data into iTerm2's chrome elements for enhanced visualization. You can enable all features or specific ones like title, badge, statusbar, or background color tinting. ```bash # Enable all iTerm2 features export CLAUDETOP_ITERM=all ``` ```bash # Or enable specific features export CLAUDETOP_ITERM=title # Tab/window title only export CLAUDETOP_ITERM=badge # Watermark overlay export CLAUDETOP_ITERM=statusbar # User variables for status bar export CLAUDETOP_ITERM=bgcolor # Background color tint by state export CLAUDETOP_ITERM=title,badge # Combine options ``` -------------------------------- ### Export Claude Session History to CSV Source: https://github.com/liorwn/claudetop/blob/main/commands/export.md Use this command to export session history. Redirect output to a file like `~/costs.csv` for storage. Defaults to CSV if no format is specified. ```bash claudetop-stats export $ARGUMENTS ``` ```bash claudetop-stats export csv > ~/costs.csv ``` -------------------------------- ### Update Claude model pricing Source: https://github.com/liorwn/claudetop/blob/main/commands/pricing.md Executes the pricing update script and provides a fallback command if the script fails. ```bash ~/.claude/update-claudetop-pricing.sh 2>&1 || echo "Run: cd ~/claudetop && ./install.sh" ``` -------------------------------- ### Show Spotify Now Playing Track Source: https://context7.com/liorwn/claudetop/llms.txt Displays the currently playing track and artist from Spotify on macOS. Exits if Spotify is not playing or if track/artist information cannot be retrieved. Truncates long display strings. ```bash #!/bin/bash # ~/.claude/claudetop.d/spotify.sh # Shows: ♫ Artist - Song (macOS only) STATE=$(osascript -e 'tell application "Spotify" to player state as string' 2>/dev/null) || exit 0 [ "$STATE" != "playing" ] && exit 0 TRACK=$(osascript -e 'tell application "Spotify" to name of current track as string' 2>/dev/null) || exit 0 ARTIST=$(osascript -e 'tell application "Spotify" to artist of current track as string' 2>/dev/null) || exit 0 [ -z "$TRACK" ] && exit 0 DISPLAY="${ARTIST} - ${TRACK}" [ ${#DISPLAY} -gt 40 ] && DISPLAY="${DISPLAY:0:37}..." printf "\033[32m♫\033[0m \033[90m%s\033[0m" "$DISPLAY" # Enable by copying: # cp ~/.claude/claudetop.d/_examples/spotify.sh ~/.claude/claudetop.d/ ``` -------------------------------- ### Analyze claudetop Branch Costs Source: https://context7.com/liorwn/claudetop/llms.txt View costs attributed to specific git branches for PR cost tracking using `claudetop-stats branch`. You can view all branches sorted by cost or details for a specific branch. ```bash # View all branches sorted by cost claudetop-stats branch ``` ```bash # View specific branch details claudetop-stats branch feature/auth-refactor ``` -------------------------------- ### Smart Alerts Reference Source: https://context7.com/liorwn/claudetop/llms.txt Reference for automated alerts displayed in the status line, primarily focusing on cost milestones. ```bash # Cost milestones - gut check if getting value $5 MARK # Crossed $5 threshold $10 MARK # Crossed $10 threshold $25 MARK # Crossed $25 threshold ``` -------------------------------- ### Log Claude Code Session Data Source: https://context7.com/liorwn/claudetop/llms.txt Appends session data to a JSONL history file upon session end. Detects the Git branch of the project directory if available. Requires `jq`. ```bash #!/bin/bash # ~/.claude/hooks/claudetop-session-end.sh # Registered via install.sh or manually in ~/.claude/settings.json set -euo pipefail HISTORY_FILE="$HOME/.claude/claudetop-history.jsonl" JSON=$(cat) # Detect git branch from project directory PROJECT_DIR=$(echo "$JSON" | jq -r '.workspace.project_dir // .cwd // ""') GIT_BRANCH="" if [ -n "$PROJECT_DIR" ] && [ -d "$PROJECT_DIR/.git" ]; then GIT_BRANCH=$(git -C "$PROJECT_DIR" rev-parse --abbrev-ref HEAD 2>/dev/null) || true fi # Append session record as JSONL jq -c --arg timestamp "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg tag "${CLAUDETOP_TAG:-}" --arg branch "$GIT_BRANCH" '{ timestamp: $timestamp, session_id: (.session_id // ""), project: ((.workspace.project_dir // .cwd // "") | split("/") | last), model: (.model.id // ""), duration_ms: (.cost.total_duration_ms // 0), cost_usd: (.cost.total_cost_usd // 0), input_tokens: (.context_window.total_input_tokens // 0), output_tokens: (.context_window.total_output_tokens // 0), lines_added: (.cost.total_lines_added // 0), lines_removed: (.cost.total_lines_removed // 0), tag: $tag, branch: $branch }' <<< "$JSON" >> "$HISTORY_FILE" ``` -------------------------------- ### Export Session Data Source: https://context7.com/liorwn/claudetop/llms.txt Export session history to CSV or JSON formats with optional filtering by time or tags. ```bash claudetop-stats export csv > ~/claude-costs.csv claudetop-stats export json > ~/claude-costs.json claudetop-stats export csv --week # Last 7 days claudetop-stats export csv --month # Last 30 days claudetop-stats export csv --tag my-feature # Specific tag ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.