
Cost Federation
- 595 installs
- 67k repo stars
- Updated August 4, 2026
- ruvnet/ruflo
cost-federation is a ruflo agent skill that wires the ADR-097 Phase 3 federation_spend consumer to aggregate per-peer token and USD spend across 1h, 24h, and 7d windows for developers operating federated agent cost contr
About
cost-federation is a ruflo skill that implements consumer-side wiring for ADR-097 Phase 3 federation_spend events in multi-agent federation setups. Each completed federation_send publishes an event carrying peerId, taskId, tokensUsed, usdSpent, and timestamp; cost-tracker aggregates those events into per-peer rolling windows at one hour, twenty-four hours, and seven days. A federation breaker then queries the aggregate to suspend peers exceeding configured spend thresholds before additional federation tasks dispatch. The skill uses Bash tooling and activates when upstream publishers land, even though Phase 3 is not yet merged upstream. Developers reach for cost-federation when operating ruflo multi-agent federation networks that need automated spend caps instead of manual invoice review. It complements cost-tracker as the declared federation_spend event consumer and encodes the suspension-threshold integration contract defined in ADR-097 for production multi-agent federation operations.
- cost-federation
Cost Federation by the numbers
- 595 all-time installs (skills.sh)
- +6 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #664 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/ruvnet/ruflo --skill cost-federationAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 595 |
|---|---|
| repo stars | ★ 67k |
| Last updated | August 4, 2026 |
| Repository | ruvnet/ruflo ↗ |
How do you cap federated agent peer spend?
Use cost-federation for development tasks
Who is it for?
Platform engineers running ruflo federation networks who need automated peer spend aggregation and breaker suspension before Phase 3 lands upstream.
Skip if: Single-agent apps without federation_send events, or teams not using ruflo ADR-097 cost federation architecture.
When should I use this skill?
User implements federation_spend consumer wiring, per-peer cost windows, or federation breaker suspension thresholds in ruflo.
What you get
Consumer-side federation_spend handler, per-peer rolling spend aggregates, and federation breaker suspension threshold integration.
- federation_spend consumer wiring
- Per-peer rolling spend aggregates
By the numbers
- Aggregates spend across three rolling windows: 1h, 24h, and 7d
- federation_spend events include peerId, taskId, tokensUsed, usdSpent, and ts fields
Files
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
1. Run the script:
node plugins/ruflo-cost-tracker/scripts/federation.mjsOptional env:
FED_FORMAT=json— JSON instead of markdownFED_NAMESPACE=federation-spend— override target namespaceFED_SUSPEND_THRESHOLD_USD=5.0— breaker threshold (ADR-097 default)
2. Inspect — per-peer 1h/24h/7d windows of count + USD spent, plus a "Suspension threshold check" block flagging peers over the breaker line.
Storage contract (consumer side)
When Phase 3 lands, events should be persisted to namespace federation-spend with key prefix fed-spend- and JSON value matching:
{
"peerId": "<peer-uuid>",
"taskId": "<task-uuid>",
"tokensUsed": 12345,
"usdSpent": 0.0287,
"ts": "2026-05-05T..."
}The script reads any record matching that prefix, regardless of how upstream produces them. Multiple events per peer accumulate cleanly into the rolling-window sums.
Cross-references
- ADR-097: Federation budget circuit breaker — the complete spec
cost-report— same data, different lens (cost-report focuses on local agent spend; this skill on per-peer federated spend)ruflo-federationplugin — the producer side (when Phase 3 lands)
Related skills
How it compares
Use cost-federation for federated peer spend breakers; use generic billing dashboards when agents do not emit federation_spend events.
FAQ
What events does cost-federation consume?
cost-federation consumes federation_spend events emitted after each federation_send completion under ADR-097 Phase 3. Each event includes peerId, taskId, tokensUsed, usdSpent, and ts so cost-tracker can update rolling spend aggregates.
Which rolling windows does cost-federation aggregate?
cost-federation aggregates per-peer spend across one-hour, twenty-four-hour, and seven-day rolling windows. The federation breaker reads those aggregates to suspend peers that exceed the configured USD or token threshold.
Is ADR-097 Phase 3 available upstream?
cost-federation documents that ADR-097 Phase 3 is not yet landed upstream. The skill provides consumer-side wiring so teams can activate federation_spend handling immediately once publishers emit the specified event schema.