← Back to Kontasks
StatusLine Hook Token Capture Implemented
Configured Claude Code StatusLine hook to capture token usage telemetry
Output
✅ StatusLine Token Capture Implemented
1. Settings Configuration
Created ~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "/konnectvol/bin/statusline-token-tracker.sh",
"padding": 0
}
}2. Hook Script (Already Existed)
/konnectvol/bin/statusline-token-tracker.sh
- Reads JSON from stdin with full token data
- Extracts: input/output tokens, cache metrics, cost, duration
- Posts to
/api/statusline(fire-and-forget) - Returns formatted status line display
3. API Endpoint Fixed
Moved /api/statusline before auth check:
- No auth required (local server-to-server)
- Stores data to
statusline-telemetry.jsonl - Captures session ID, model, tokens, costs
⚠️ Restart Required
Konui needs restart to pick up the endpoint changes.
Token data will start flowing after restart + new Claude Code session.
📊 Data Flow
Claude CLI → StatusLine hook (300ms updates)
↓
statusline-token-tracker.sh
↓
POST /api/statusline
↓
statusline-telemetry.jsonlQuick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
vibetools
Tags
telemetrytokensstatusline
Created
4 Jan 2026, 3:25 am
Updated
4 Jan 2026, 3:25 am
Created By
claude
Raw Data
{
"id": "aaf7918a-3363-40d3-ba4d-d0d0f3b7021e",
"type": "general",
"status": "completed",
"title": "StatusLine Hook Token Capture Implemented",
"description": "Configured Claude Code StatusLine hook to capture token usage telemetry",
"context": {
"output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:sans-serif;\"><h2 style=\"color:#fff;margin:0 0 16px 0;\">✅ StatusLine Token Capture Implemented</h2><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#4ade80;margin:0 0 12px 0;\">1. Settings Configuration</h3><p style=\"color:#9ca3af;margin:0 0 8px 0;\">Created <code>~/.claude/settings.json</code>:</p><pre style=\"background:#3d3d3d;padding:12px;border-radius:4px;overflow-x:auto;font-family:monospace;color:#e5c07b;margin:8px 0 0 0;\">{\n \"statusLine\": {\n \"type\": \"command\",\n \"command\": \"/konnectvol/bin/statusline-token-tracker.sh\",\n \"padding\": 0\n }\n}</pre></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#4ade80;margin:0 0 12px 0;\">2. Hook Script (Already Existed)</h3><p style=\"color:#9ca3af;margin:0;\"><code>/konnectvol/bin/statusline-token-tracker.sh</code></p><ul style=\"margin:8px 0 0 0;padding-left:20px;line-height:1.8;color:#9ca3af;\"><li>Reads JSON from stdin with full token data</li><li>Extracts: input/output tokens, cache metrics, cost, duration</li><li>Posts to <code>/api/statusline</code> (fire-and-forget)</li><li>Returns formatted status line display</li></ul></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#4ade80;margin:0 0 12px 0;\">3. API Endpoint Fixed</h3><p style=\"color:#9ca3af;margin:0 0 8px 0;\">Moved <code>/api/statusline</code> before auth check:</p><ul style=\"margin:0;padding-left:20px;line-height:1.8;color:#9ca3af;\"><li>No auth required (local server-to-server)</li><li>Stores data to <code>statusline-telemetry.jsonl</code></li><li>Captures session ID, model, tokens, costs</li></ul></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#f97316;margin:0 0 12px 0;\">⚠️ Restart Required</h3><p style=\"color:#e0e0e0;margin:0;\">Konui needs restart to pick up the endpoint changes.<br>Token data will start flowing after restart + new Claude Code session.</p></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;\"><h3 style=\"color:#60a5fa;margin:0 0 12px 0;\">📊 Data Flow</h3><pre style=\"background:#3d3d3d;padding:12px;border-radius:4px;overflow-x:auto;font-family:monospace;color:#98c379;margin:0;\">Claude CLI → StatusLine hook (300ms updates)\n ↓\nstatusline-token-tracker.sh\n ↓\nPOST /api/statusline\n ↓\nstatusline-telemetry.jsonl</pre></div></div>",
"requestedAt": "2026-01-04T09:10:00Z",
"requestId": "48c54a35-14d6-4239-bf36-215d447d07a9",
"choices": [
{
"label": "Restart konui",
"value": "Restart konui to apply the StatusLine endpoint changes",
"primary": true
},
{
"label": "Test hook manually",
"value": "Test the statusline hook script manually with sample JSON input"
},
{
"label": "Check current turn",
"value": "Check if token data is already being captured for this turn"
}
]
},
"createdBy": "claude",
"createdAt": "2026-01-03T17:25:32.526Z",
"updatedAt": "2026-01-03T17:25:32.686Z",
"requestId": "48c54a35-14d6-4239-bf36-215d447d07a9",
"scope": "vibetools",
"tags": [
"telemetry",
"tokens",
"statusline"
],
"targetUser": "claude"
}