How ngoclinh93qt/orca-bot-metrics works
Bot Metrics is an Orca plugin for locally analyzing bot token use and workflow. The main path is local Claude Code/Codex transcripts and optional factory run logs → collection and token attribution → summary or Canvas data → worker requests → panel views. Summary analytics cover usage, token categories, savings ideas, PR costs, run replay and dated change markers; the Canvas shows tasks, bot runs and observed workflow. The run-log format is also a documented, versioned capability. Relationships are limited to calls visible in excerpts or explicit README statements; unsampled panel internals are not inferred.
Main entry points: worker.ts Plugin worker · collect.ts Transcript collector · summary.ts Metrics and insights · index.html Metrics panel
Components 14
Local inputs
- Bot transcripts
- Factory run logs
Analysis
- Transcript collector
src/collect.ts - Token attribution
src/attrib.ts - Run-log parser
src/runlog.ts - Metrics and insights
src/summary.ts - Canvas builder
src/canvas.ts
Plugin runtime
- Plugin worker
src/worker.ts - Request contract
src/protocol.ts - Orca storage
- Scan cache
Panel and standard
- Metrics panel
panel/index.html - Run-log standard
spec/bot-run-log/README.md
Other components
- Bot operator
Connections 19
- Bot operator → Metrics panel: views metrics
README.md - Metrics panel → Plugin worker: requests data
README.md - Bot transcripts → Transcript collector: reads transcripts
README.md - Factory run logs → Transcript collector: reads run logs
README.md - Transcript collector → Token attribution: attributes tokens
src/collect.ts - Transcript collector → Run-log parser: parses logs
src/collect.ts - Run-log standard → Run-log parser: defines format
src/runlog.ts - Plugin worker → Transcript collector: scans sessions
src/worker.ts - Plugin worker → Transcript collector: loads run logs
src/worker.ts - Plugin worker → Metrics and insights: builds metrics
src/worker.ts - Plugin worker → Metrics and insights: loads run detail
src/worker.ts - Plugin worker → Canvas builder: builds canvas
src/worker.ts - Metrics and insights → Transcript collector: uses session data
src/summary.ts - Metrics and insights → Token attribution: uses token categories
src/summary.ts - Canvas builder → Transcript collector: uses run data
src/canvas.ts - Plugin worker → Orca storage: reads and writes markers
src/worker.ts - Plugin worker → Scan cache: caches scan results
README.md - Request contract → Metrics panel: types panel requests
src/protocol.ts - Request contract → Plugin worker: types worker requests
src/protocol.ts