-
-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
featpriority:shouldShould Have - 중요하지만 필수는 아님Should Have - 중요하지만 필수는 아님tuiTUI Agent MonitorTUI Agent Monitor
Description
Purpose
Display real-time session statistics in the codingbuddy TUI status bar, similar to OMC's status line. Users should see cost, token usage, cache hit rate, and context window utilization at a glance without needing OMC installed.
Reference: OMC Status Line
[OMC#4.2.7] | session:173m | 🔴 | ~$0.6346 | 419.9k | Cache: 99.9% | $0.22/h | ctx:42%
Target Display
[CB] | session:173m | ~$0.63 | 419.9k tokens | Cache: 99.9% | $0.22/h | ctx:42%
Data Points
| Metric | Description | Data Source |
|---|---|---|
session |
Session elapsed time | MCP server start timestamp |
cost |
Estimated cumulative cost | Token count × model pricing |
tokens |
Cumulative token usage | Track from MCP tool call context |
cache |
Prompt cache hit rate | cache_read vs cache_creation tokens |
$/h |
Cost per hour | cost ÷ session hours |
ctx |
Context window usage % | Current tokens ÷ model max context |
Technical Investigation Needed
Data Collection Approaches
- MCP server self-tracking — Count tool calls, estimate tokens from request/response sizes
- Claude Code metadata API — Check if Claude Code exposes session stats via API or env vars
- Anthropic API usage headers —
x-ratelimit-*headers provide rate limit info - Hybrid — Combine MCP tracking with any available Claude Code metadata
TUI Implementation
- Existing TUI:
apps/mcp-server/src/tui/(Ink/React-based) - Add status bar component at the bottom of TUI
- Update interval: every 30 seconds or on each tool call
Changes
apps/mcp-server/src/tui/— New status bar componentapps/mcp-server/src/mcp/— Session statistics tracking serviceapps/mcp-server/src/— Token/cost calculation utilities
Acceptance Criteria
- Session elapsed time displayed
- Estimated cost displayed (based on token counting)
- Token count tracked and displayed
- Cache hit rate calculated and displayed (if data available)
- Context usage percentage displayed (if data available)
- Cost per hour calculated
- Updates in real-time (or near real-time)
- Works without OMC installed
- TUI tests updated
References
- OMC status line implementation (inspiration, not copy)
- codingbuddy TUI:
apps/mcp-server/src/tui/ - Anthropic API pricing: per-model token costs
- Claude Code API: check for session metadata exposure
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featpriority:shouldShould Have - 중요하지만 필수는 아님Should Have - 중요하지만 필수는 아님tuiTUI Agent MonitorTUI Agent Monitor