본문으로 건너뛰기
Skillpedia
기타81k · #1601

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-federation/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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

  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)
  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-federation plugin — 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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬