cost-federation
What it does
This skill tracks spending per connected peer over one hour, one day and one week. It is for people who share AI work with several other connected systems.
When to use it
- βWhen you open AI work to a new connected peer and want a baseline first.
- βWhen you want to watch per-peer spending on a repeating check.
- βWhen you want to confirm that a spending limit would catch a peer that goes too far.
Skill link
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-federation/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βHow much has each connected peer spent on my tasks in the last day?β
5 new skills a week. 1 minute to read.
How it works
The skill reads spend events from a shared store and totals them per peer across the three windows. It then compares each peer with a dollar threshold and reports any that are over it.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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.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)
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)
FAQ
Does it work right now?
Only once the upstream system starts publishing events. Until then, it reports that no events were found.
What is the default threshold?
The source sets a default of five dollars, and you can change it with a setting.
What happens when a peer is over the limit?
The peer is flagged in the report. Suspending the peer is done by a separate breaker that reads this data, not by this skill.
Details
Original description by the author
Consumer-side wiring for ADR-097 Phase 3 federation_spend events β per-peer rolling windows + suspension-threshold check
repo: ruvnet/ruflo
Popularity
- GitHub stars
- 81k
- Ranking position
- #1601
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
agent-adaptive-coordinator
81kHelps your agent split and rebalance a group of AI agents as the workload changes, choosing a layout that fits the task.
agent-agent
81kTeaches your agent to turn a big goal into an ordered plan of actions, and to replan when conditions change.
agent-agentic-payments
81kHelps your agent manage spending mandates for AI shopping, with spend caps, time windows, merchant rules and signed approvals.
agent-analyze-code-quality
81kHelps your agent review code for quality, finding code smells, technical debt and refactoring ideas without changing the files.
Similar skills
blucli
394kHelps your agent find, play, pause, group, and adjust the volume of Bluesound and NAD speakers through the blu command.
camsnap
394kHelps your agent grab snapshots, short clips, or motion events from network cameras and local webcams that you have set up.
eightctl
394kHelps your agent check and control an Eight Sleep pod, including its temperature, alarms, and sleep schedules.