cost-federation
하는 일
이 스킬은 한 시간, 하루, 일주일 단위로 페더레이션에 연결된 피어별 지출을 추적합니다. 여러 연결 시스템과 AI 작업을 나누는 사람에게 맞습니다.
사용하는 경우
- ✓새 연결 피어와 작업을 시작하기 전에 기준값을 먼저 확인하고 싶을 때.
- ✓반복 점검으로 피어별 지출을 계속 지켜보고 싶을 때.
- ✓지출 한도가 과도하게 쓰는 피어를 실제로 잡아내는지 확인하고 싶을 때.
스킬 링크
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-federation/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“지난 하루 동안 연결된 피어 각각이 내 작업에 얼마를 썼는지 알려 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
스킬은 공유 저장소에서 지출 이벤트를 읽고, 세 가지 기간별로 피어마다 합계를 냅니다. 그다음 각 피어를 달러 기준값과 비교해 기준을 넘은 피어를 보고합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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)
자주 묻는 질문
지금 바로 동작하나요?
상위 시스템이 이벤트를 게시하기 시작해야 동작합니다. 그 전까지는 이벤트를 찾지 못했다고 보고합니다.
기본 기준값은 얼마인가요?
소스에서 기본값으로 5달러를 정해 두었으며, 설정으로 바꿀 수 있습니다.
피어가 한도를 넘으면 어떻게 되나요?
보고서에 해당 피어가 표시됩니다. 피어를 중단하는 작업은 이 데이터를 읽는 별도의 차단기가 맡으며, 이 스킬이 하지는 않습니다.
상세 정보
작성자의 원본 설명
Consumer-side wiring for ADR-097 Phase 3 federation_spend events — per-peer rolling windows + suspension-threshold check
repo: ruvnet/ruflo
인기도
- GitHub 스타
- 81k
- 순위
- #1601
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
agent-adaptive-coordinator
81k작업량이 바뀔 때 에이전트 무리를 나누고 재배치해, 작업에 맞는 배치를 고르도록 에이전트를 돕습니다.
agent-agent
81k큰 목표를 순서가 있는 행동 계획으로 나누고, 조건이 바뀌면 다시 계획하도록 에이전트를 가르칩니다.
agent-agentic-payments
81kAI 쇼핑을 위한 지출 위임장을 관리합니다. 지출 상한, 시간 창, 판매자 규칙, 서명된 승인을 포함합니다.
agent-analyze-code-quality
81k에이전트가 파일을 바꾸지 않고, 코드 품질 문제와 코드 냄새, 기술 부채, 리팩터링 아이디어를 찾아 검토하도록 돕습니다.