Skip to content

Feature: per-pane token usage and cost tracking across parallel agents #463

Description

@ilijachrchev

Feature: Per-pane token usage and cost dashboard

Problem

When running multiple agents in parallel, there is no way to see how much each agent has consumed in tokens or cost without clicking into each pane individually and reading Claude Code's status bar. With 5+ agents running, you lose track of which ones are expensive and what the total session cost is.

Pane already tracks CPU and memory per pane in the resource monitor. Token usage and cost are the missing dimension — the one that actually costs money.

Proposed solution

1. Parse agent cost output from terminal

Claude Code prints a cost summary line after each response (e.g. $0.42 cost). Codex prints token counts similarly. The terminal output parser can extract these values using pattern matching on known agent output formats, keyed by the agent type registered in the pane's CLI tool config.

2. Accumulate per-pane in the session database

Add columns to the session/pane data model:

  • total_input_tokens (int)
  • total_output_tokens (int)
  • total_cost_usd (float)
  • last_cost_update (timestamp)

Update these on each detected cost event from the terminal output.

3. Surface in the UI — two locations

Sidebar (per-pane): Show accumulated cost next to each pane name in the left sidebar, similar to how the diff stats (+/- lines) already appear. A small $0.42 label next to "agent-1-opp-lifecycle" tells you at a glance which agent is expensive.

Resource monitor panel (aggregate): Add a "Token Usage" section below CPU/Memory in the existing resource monitor. Show a table:

Pane Input tokens Output tokens Cost
agent-1-opp-lifecycle 12.4k 8.2k $0.42
agent-2-moderation 45.1k 22.3k $1.87
agent-3-student-ux 6.0k 3.1k $0.18
Total 63.5k 33.6k $2.47

4. CLI exposure via runpane

Extend the runpane CLI contract with:
runpane panes cost --pane --json
runpane panes cost --all --json

This lets the orchestrator include cost awareness in its decisions (e.g. deprioritize an agent that has already burned through a budget).

What this does NOT cover

  • Per-model pricing lookups (just parse what the agent already prints)
  • Budget limits or auto-pause (separate feature, could build on this data)
  • Non-CLI agents that don't print cost info

Why this matters

Pane's value proposition is managing multiple agents in parallel. CPU and memory monitoring are already built in. Cost is the third axis — and the one users actually pay for. Competitors like Conductor get flagged in reviews for having no cost visibility. This would be a differentiator.

Happy to implement this if the approach looks right.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions