Preskoči na sadržaj

Cost Dashboard

index

The Cost Dashboard is the presentation surface for the hive-wide cost data flowing into mother’s task_costs table. It serves two audiences: operators (human gallery) and agents (JSON query).

One HTML page, two views. The same data feeds both a human-browseable card grid (with lightbox screenshot proofs) and an agent-queryable JSON panel. No server-side rendering — static HTML with a JSON data file refreshed every 60s by cron.

┌──────────────────────────────────────────────────────────────────────────────┐
│ HIVE COST DASHBOARD [4 nodes] [24h] [$2.37] │
├──────────────────────────────────────────────────────────────────────────────┤
│ │
│ debby ● online 12 tasks $1.87 ▲ $0.15 avg 89% success │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ ████░░░░ │ │ ████████ │ │ ██████░░ │ │ ████████ │ ← cost cards │
│ │ deepseek │ │ deepseek │ │ claude │ │ gemini │ │
│ │ $0.0042 │ │ $0.0031 │ │ $0.89 ▸ │ │ $0.02 ▸ │ ▸ = screenshot │
│ │ ✓ │ │ ✓ │ │ ✗ │ │ ✓ │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
└──────────────────────────────────────────────────────────────────────────────┘

Each cost card shows:

  • Cache-hit bar: green (cache) vs grey (fresh) — visual cache efficiency
  • Provider: deepseek / claude / gemini / ollama / local
  • Cost: with ▸ screenshot badge if visual proof exists, ▸ text for glasspane evidence
  • Success: ✓ (green) or ✗ (red)

Click a card with → lightbox opens the terminal screenshot at task completion time.

SourceWhatRefresh
task_costs (PostgreSQL)Per-task cost rows pushed by daemon heartbeatReal-time (SSH push on completion)
hive_nodes (PostgreSQL)Node metadata, capabilities, LLM tierNode heartbeat
task_costs JSON fileDenormalized JSON for the dashboard pageEvery 60s (cron)
proof_text (inline JSON)glasspane state snapshotOn task completion (daemon heartbeat)
daemon heartbeat
├─ push_cost_to_mother() ──SSH──→ colibri-mcp-ssh "report-task-cost"
│ │
│ └─ INSERT INTO task_costs
│ (node_hostname → node_id lookup)
└─ proof_text (inline) → glasspane state snapshot (agent, state, tokens, cost JSON)
cron (every 60s)
└─ export-costs.sh
└─ psql → task_costs JSON file (dashboard data file)
browser
└─ GET /dashboard/ → index.html
└─ fetch task_costs JSON file → render cards, lightbox, JSON panel
Terminal window
# On mother (osa):
cd /usr/local/src/colibri/packaging/mother/dashboard
./deploy.sh

This places:

  • /usr/local/www/clawdie/dashboard/index.html — the dashboard page
  • export-costs.sh — JSON export script (in mother webroot)
  • /usr/local/etc/cron.d/clawdie-dashboard — cron job (every 60s)

Nginx serves it as a static location under the existing mother vhost.

The dashboard has a JSON toggle button that shows the filtered data as structured JSON. This is the same data agents get via colibri_list_task_costs MCP tool, but with screenshot UUIDs and node groupings:

{
"updated_at": "2026-06-27T14:00:00Z",
"summary": {
"total_tasks": 23,
"total_cost": 2.37,
"avg_cost": 0.103,
"success_rate": 87.0,
"cache_hit_ratio": 64.3
},
"nodes": {
"debby": [
{
"task_id": "abc-123",
"provider": "deepseek",
"cost": 0.0042,
"success": true,
"proof_text": "{\"agent\":\"zot\",\"state\":\"Done\",\"tokens_in\":150}",
"tokens": {"in": 45000, "out": 2800, "cache_read": 12000}
}
]
}
}

Agents use this for cost-aware routing: “debby averages $0.004/task with 89% cache-hit on DeepSeek — route non-urgent tasks there.”

The ▸ screenshot badge on cost cards opens a lightbox with the terminal PNG. The ▸ text badge shows the glasspane state snapshot inline. screenshot UUID is stored alongside the cost row. Clicking opens the lightbox with:

  • The full terminal PNG at task completion time
  • Task ID, provider, and cost in the overlay
  • The screenshot metadata (pane title, command, path, timestamp)
  • Signature detection results (failures, warnings, healthy signals)

This is the “verify, don’t guess” layer — every cost number has visual proof behind it.

  • task-board — local task board (data source for cost capture)
  • hive-pane — hive board (companion surface, node status)
  • hive-routing — cost-aware routing engine (consumes this data)
  • screenshot module — auto-capture on task completion