跳到正文
cccskills
免费在 GitHub 公开

cost-federation

Summarize spending events for each connected peer over the past hour, day, and week, and flag peers above a configured suspension threshold. This consumer-side script depends on upstream event publishing that the source describes as not yet implemented.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Consumer-side wiring for ADR-097 Phase 3 federation_spend events — per-peer rolling windows + suspension-threshold check

查看安装方法

适用场景

  • Establish a spending baseline before connecting a new peer
  • Periodically review spending by peer
  • Check which peers exceed a suspension threshold
  • Verify suspension reasoning after event publishing is implemented

包含的文件(1)

  • SKILL.md2.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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)

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

add-model-descriptions

免费有简介AI 评分 80分

对照HuggingFace router的模型列表与chat-ui配置,研究尚未收录的模型,编写简短英文说明,并同步添加到生产和开发配置。

  • 添加路由中新上线的模型
  • 用简短说明概括模型特点
  • 同步更新生产和开发环境的模型信息
ruvnet/ruflo7.8万2026年10月20日 更新

adr-create

免费有简介AI 评分 80分

为技术选型和设计决策创建ADR文档,沿用现有文件的连续编号,生成模板并登记到AgentDB,同时为找到的相关历史决策添加链接和依赖关系。

  • 记录采用某项技术的理由
  • 记录API或数据模型变更
  • 将基础设施决策形成文档
ruvnet/ruflo7.8万2026年10月20日 更新

adr-index

免费

Build a searchable index and relationship graph from ADRs, records of architectural decisions. Import two supported document formats, refresh existing metadata without duplicate relationships, and review summaries of statuses, missing references, and inconsistencies.

中文简介正在准备中。当前显示英语简介。

  • Index ADRs imported from another project
  • Refresh a graph that differs from files on disk
  • Set up ADR tracking in an existing codebase
ruvnet/ruflo7.8万2026年10月20日 更新

adr-reindex

免费有简介AI 评分 70分

删除ADR设计决策记录或关系信息后,清空并重建索引,移除残留的旧条目,再核对当前文件数与索引记录数是否一致;也可预览重建内容而不作更改。

  • 删除ADR文件后重建索引
  • 删除ADR关系后清理残留记录
  • 定期核对并重建ADR索引
ruvnet/ruflo7.8万2026年10月20日 更新

adr-review

免费有简介AI 评分 80分

将代码差异与记录已采纳设计决策的ADR进行核对,整理违反决策、引用过时记录及缺少相关记录的变更,并提出代码修正或决策调整建议。

  • 合并PR前检查设计决策
  • 核对重大变更与设计决策
  • 查找对已被替代ADR的引用
ruvnet/ruflo7.8万2026年10月20日 更新

adr-verify

免费有简介AI 评分 90分

检查已保存的架构决策记录(ADR),报告失效引用、替代关系中的循环和状态不一致问题,适合导入后的校验与发布前的数据检查。

  • 检查ADR导入后的数据一致性
  • 在持续集成中检测不一致问题
  • 发布前检查已保存的ADR数据
ruvnet/ruflo7.8万2026年10月20日 更新

查看 ruvnet 的全部技能

报告此技能的问题