This document covers the mechanics and usage of @oh-my-pi/omp-stats and @oh-my-pi/swarm-extension.
@oh-my-pi/omp-stats
omp-stats is a Bun-based TypeScript observability service designed to log LLM usage metrics.
Architecture and Mechanics
- Engine: Runs as a Bun-based TypeScript service.
- Observability Store: Uses a SQLite database tracking metrics in
messagesanduser_messagestables. It tracks request tokens, costs, durations, cache rates, and user frustration metrics (e.g., Yelling, Negation, Repetition, Anguish, Blame, Profanity). - Telemetry Hooks: Key metrics are keyed by generation-specific IDs rather than generic agent IDs. This ensures multiple LLM calls from a single agent do not clobber state.
- Non-blocking I/O: SQLite inserts are non-blocking so as not to stall the primary workflow.
- Dashboard: Features a Single Page React Dashboard utilizing Recharts, Lucide icons, and TailwindCSS, running on port
3847by default.
@oh-my-pi/swarm-extension
swarm-extension is designed for complex DAG (Directed Acyclic Graph) orchestration across multiple OMP agents.
Architecture and Mechanics
- Engine: Analyzes dependencies using
waits_forandreports_todirectives defined in YAML configs. - State Tracker: Tracks execution state wave-by-wave inside
.swarm_<name>/state/pipeline.json. - Trace Context Propagation: Explicitly propagates trace contexts (like
traceIdandparentObservationId) across asynchronous boundaries to ensure distributed traces render accurately (e.g., in Langfuse). - Command Entry: Can be invoked natively in the OMP CLI via the
/swarm runcommand.