cost-export
Export cost-tracking telemetry in Prometheus textfile or webhook JSON formats — for external observability (Grafana, Datadog, custom dashboards)
What this skill does
# Cost Export
Pulls every `session-*` and `budget-config-*` record from `cost-tracking` and emits in formats consumable by external observability systems. Without this, cost data lives only inside the AgentDB namespace; with it, the same data lights up dashboards.
## When to use
- After any cost-track run, to refresh metrics for Grafana / Datadog / Prometheus.
- Cron-friendly via `/loop 5m` to keep external dashboards near-real-time.
- One-shot to a webhook for ad-hoc reporting (Slack, custom endpoint).
## Steps
1. **Pick a format** — textfile collector for Prometheus / Grafana, or webhook POST for everything else:
```bash
# Prometheus node_exporter textfile collector
node plugins/ruflo-cost-tracker/scripts/export.mjs --prometheus /var/lib/node_exporter/textfile_collector/cost_tracker.prom
# Webhook (POSTs JSON; add auth via env)
EXPORT_WEBHOOK_HEADER='Authorization: Bearer $TOKEN' \
node plugins/ruflo-cost-tracker/scripts/export.mjs --webhook https://hooks.example.com/cost-tracker
# Stdout JSON (default if no flag)
node plugins/ruflo-cost-tracker/scripts/export.mjs
```
2. **Inspect what's emitted** — Prometheus output includes:
```
cost_tracker_total_usd <gauge>
cost_tracker_tier_total_usd{tier="opus|sonnet|haiku"} <gauge>
cost_tracker_session_total_usd{session="<8-char>"} <gauge>
cost_tracker_session_messages{session="<8-char>"} <counter>
cost_tracker_budget_usd <gauge> (if budget configured)
cost_tracker_budget_utilization <gauge> (spent / budget)
```
3. **Webhook payload shape** — the JSON the webhook receives matches the stdout JSON: `{ exportedAt, sessions: [...], budget, totalUsd, byTier }`. Headers may be added via `EXPORT_WEBHOOK_HEADER='K1: V1, K2: V2'` (comma-separated).
## Env overrides
| Env | Default | Purpose |
|---|---|---|
| `EXPORT_NAMESPACE` | `cost-tracking` | Override target namespace |
| `EXPORT_WEBHOOK_HEADER` | unset | Comma-separated `K: V` pairs for webhook auth |
| `EXPORT_QUIET=1` | unset | Suppress non-error confirmation output |
## Cross-references
- `cost-track` — produces the data this skill exports
- `cost-budget-check` — the same `cost_tracker_budget_*` metrics are alertable in Prometheus
- node_exporter textfile collector docs (Prometheus convention) — drop the `.prom` file in the collector directory and Prometheus picks it up
Related in Data & Analytics
clawarr-suite
IncludedComprehensive management for self-hosted media stacks (Sonarr, Radarr, Lidarr, Readarr, Prowlarr, Bazarr, Overseerr, Plex, Tautulli, SABnzbd, Recyclarr, Unpackerr, Notifiarr, Maintainerr, Kometa, FlareSolverr). Deep library exploration, analytics, dashboard generation, content management, request handling, subtitle management, indexer control, download monitoring, quality profile sync, library cleanup automation, notification routing, collection/overlay management, and media tracker integration (Trakt, Letterboxd, Simkl).
querying-soql
IncludedSOQL query generation, optimization, and analysis with 100-point scoring. Use this skill when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan analysis, and performance or safety improvements for Salesforce queries. TRIGGER when: user writes, optimizes, or debugs SOQL/SOSL queries, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER when: bulk data operations (use handling-sf-data), Apex DML logic (use generating-apex), or report/dashboard queries.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
habit-flow
IncludedAI-powered atomic habit tracker with natural language logging, streak tracking, smart reminders, and coaching. Use for creating habits, logging completions naturally ("I meditated today"), viewing progress, and getting personalized coaching.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
visualizing-data
IncludedBuilds dashboards, reports, and data-driven interfaces requiring charts, graphs, or visual analytics. Provides systematic framework for selecting appropriate visualizations based on data characteristics and analytical purpose. Includes 24+ visualization types organized by purpose (trends, comparisons, distributions, relationships, flows, hierarchies, geospatial), accessibility patterns (WCAG 2.1 AA compliance), colorblind-safe palettes, and performance optimization strategies. Use when creating visualizations, choosing chart types, displaying data graphically, or designing data interfaces.