token-breakdownlisted
Install: claude install-skill JacobPEvans/claude-code-plugins
# Token Breakdown
Query Splunk for detailed token usage analytics of the current Claude Code session.
## Prerequisites
The Splunk MCP server must be configured in Claude Code. This is managed by nix-darwin:
- `splunk` MCP server defined in `programs.claude.mcpServers`
- Credentials injected via Doppler (`SPLUNK_MCP_ENDPOINT`, `SPLUNK_MCP_TOKEN`)
- Self-signed TLS handled by `NODE_TLS_REJECT_UNAUTHORIZED=0` in the MCP server env
Verify: `mcp__splunk__splunk_get_info` should return the Splunk version.
## Invocation
```text
/token-breakdown [session-id]
```
- No arguments: analyzes the current active session
- With session-id: analyzes a specific session UUID
## Workflow
### Phase 1: Session Identification
Determine the current session ID and validate it has a useful name.
**Step 1a — Find session ID:**
If no session-id argument was provided, find the current session:
```bash
# Compute encoded project path (slashes become hyphens)
encoded_path=$(echo "$PWD" | sed 's|^/|-|; s|/|-|g')
# Find the most recently modified JSONL session file
session_file=$(ls -t "$HOME/.claude/projects/${encoded_path}/"*.jsonl 2>/dev/null | head -1)
# Validate a session file was found
if [ -z "$session_file" ]; then
echo "No active session found for current project directory: $PWD"
exit 1
fi
# Extract session ID from filename
session_id=$(basename "$session_file" .jsonl)
```
**Step 1b — Read session metadata:**
Read line 1 of the session file to extract the slug and version:
```