cost-federation
Cost Federation
ADR-097 Phase 3 specifies a federation_spend event bus that publishes one event per federation_send completion: {peerId, taskId, tokensUsed, usdSpent, ts}. Cost-tracker is the declared consumer — it aggregates per-peer rolling windows (1h / 24h / 7d) and the federation breaker queries that aggregate to suspend peers exceeding the configured threshold.
Phase 3 isn't landed upstream yet. This skill is the consumer-side wiring; it activates the moment upstream publishes events to the federation-spend namespace. Until then it reports cleanly with a "no events found" notice.
When to use
- Before opening federation traffic to a new peer — establish baseline.
- Periodically (e.g.
/loop 5m) to monitor per-peer spend across windows. - After ADR-097 Phase 2/3 lands — to verify breaker suspension reasoning.
Steps
-
Run the script:
node plugins/ruflo-cost-tracker/scripts/federation.mjs
More from ruvnet/ruflo
agent-swarm
Agent skill for swarm - invoke with $agent-swarm
401agent-workflow
Agent skill for workflow - invoke with $agent-workflow
400workflow-automation
>
389agent-arch-system-design
Agent skill for arch-system-design - invoke with $agent-arch-system-design
384security-audit
>
373agent-architecture
Agent skill for architecture - invoke with $agent-architecture
353