Skip to content
ruvnet avatar

Cost Federation

Consumer-side wiring that aggregates per-peer federation spend into rolling windows and flags breaker suspensions.

CCM score
65 of 100
skills.sh installs
684
GitHub stars
82.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers per-peer spend count and USD totals across 1h, 24h, and 7d rolling windows, with a suspension-threshold check block
  • Runs node plugins/ruflo-cost-tracker/scripts/federation.mjs, with FED_FORMAT, FED_NAMESPACE, and FED_SUSPEND_THRESHOLD_USD overrides for output and breaker limit
  • Reads federation_spend records under the fed-spend- key prefix in the federation-spend namespace, which upstream Phase 3 has not yet published
  • Designed for establishing a peer's baseline before opening federation traffic, or monitoring spend periodically under ADR-097

Install

$ npx -y skills add ruvnet/ruflo --skill cost-federation -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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.mjs
    

    Optional env:

    • FED_FORMAT=json — JSON instead of markdown
    • FED_NAMESPACE=federation-spend — override target namespace
    • FED_SUSPEND_THRESHOLD_USD=5.0 — breaker threshold (ADR-097 default)

Details

Repository
github.com/ruvnet/ruflo
Categories
Finance & Trading, AI Agents & LLM Apps
First seen
Jun 3, 2026

Questions

What does the cost-federation skill do?

The cost-federation skill is the consumer-side wiring for ADR-097 Phase 3 federation_spend events. It aggregates per-peer rolling windows of 1h, 24h and 7d, and flags peers over the suspension threshold.

How do I install the cost-federation skill?

Run npx -y skills add ruvnet/ruflo --skill cost-federation -y in your project. Once installed, the agent can run the federation script to report per-peer spend across the rolling windows.

Does cost-federation work before ADR-097 Phase 3 is released?

Phase 3 is not landed upstream yet, so the skill reports a no events found notice until upstream publishes events to the federation-spend namespace. It activates once those events exist.

Where does cost-federation rank in the Finance & Trading category?

It is listed in the Finance & Trading category on Claude Marketplaces, alongside wind-mcp-skill, stripe-best-practices and convex-billing. It differs from cost-report by focusing on per-peer federated spend rather than local agent spend.

More from ruvnet/ruflo

All 236

Similar to Cost Federation

More Finance & Trading