Summary
Add a /stats slash command that displays local token usage statistics for LLM API calls, similar to Claude Code's /stats feature.
Demo Video

▶️ YouTube에서 보기
Problem
Users have no way to track their actual token consumption across different models, providers, and sessions. Current UI shows per-task token counts but doesn't provide aggregate statistics over time.
Proposed Solution
A /stats command that opens a dedicated statistics panel showing:
Core Features
- Time ranges: Today, 7 days, 30 days, All time
- Token breakdown: Input, Output, Cache Read, Cache Write, Reasoning tokens
- Grouping: By model, provider, Zoo Code mode, status (completed/failed/cancelled)
- Time-axis aggregation: Daily, weekly, monthly views
- Daily heatmap: Visual representation of usage over time
- Export: JSON and CSV formats
- Reset: With confirmation dialog
Technical Design
- Append-only event log: Each API call records a
UsageEvent as NDJSON
- Local storage only: Data stored in
globalStorage/usage-stats/
- No sensitive data: API keys, prompts, and responses are never stored
- Single instrumentation point:
Task.ts terminal finalize (not per-chunk)
- Idempotent recording: Prevents duplicate events from retries
Safety
- Data is local-only (VS Code globalStorage)
- API keys, prompts, responses are never stored
- Storage failures don't affect LLM task execution
- Corrupt data is quarantined, not deleted
- Clear requires nonce-based confirmation
Alternatives Considered
- Mutable cumulative summary — Simpler but no audit trail, can't reaggregate
- Scan existing task history on demand — Slow, incomplete data, privacy concerns
Additional Context
- Implementation follows the existing Zoo Code architecture patterns
- No new runtime dependencies (uses existing Zod, proper-lockfile, safeWriteJson)
- Compatible with all 30+ providers through the common
ApiStreamUsageChunk type
Summary
Add a
/statsslash command that displays local token usage statistics for LLM API calls, similar to Claude Code's/statsfeature.Demo Video
Problem
Users have no way to track their actual token consumption across different models, providers, and sessions. Current UI shows per-task token counts but doesn't provide aggregate statistics over time.
Proposed Solution
A
/statscommand that opens a dedicated statistics panel showing:Core Features
Technical Design
UsageEventas NDJSONglobalStorage/usage-stats/Task.tsterminal finalize (not per-chunk)Safety
Alternatives Considered
Additional Context
ApiStreamUsageChunktype