跳到正文
Skillpedia
其他81k · #1596

cost-compact-context

它能做什么

这项技能为关于 AI 成本的问题获取一组精简后的记忆上下文。适合希望 AI 在回答时阅读更少文字的人。

适用场景

  • ✓当你提出的成本问题依赖于过去的笔记时。
  • ✓当你想减少 AI 为查询所读取的文字量时。
  • ✓当你想查看上下文工具报告的节省量时。

技能链接

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-compact-context/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-cost-tracker/skills/cost-compact-context/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请简要概括一下我们关于 AI 成本上限所做的决定。”

每周 5 个新技能,1 分钟读完。

工作原理

这项技能调用一个辅助程序,从已存储的记忆库中检索与你的问题相关的精简笔记。如果没有安装可选的辅助包,它会返回空结果并正常退出。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Cost Compact Context

Wraps getTokenOptimizer().getCompactContext() from @claude-flow/integration for cost-analysis queries. The bridge dynamically imports agentic-flow with graceful fallback: when the package isn't installed, tokensSaved is 0 and the skill exits cleanly. No MCP tool wraps getTokenOptimizer today (ADR-0002 §"Riskiest assumption"); we shell a Node one-liner instead.

Steps

  1. Take the query — the single argument.

  2. Invoke — run from anywhere under v3/ so @claude-flow/integration resolves:

    ( cd v3 && node ../plugins/ruflo-cost-tracker/scripts/compact.mjs "<QUERY>" )
    

    The script imports @claude-flow/integration/token-optimizer (canonical export — not dist/token-optimizer.js, which would double the .js extension via Node's ./* exports rule), calls getCompactContext(query), and prints a markdown summary plus a JSON line via COMPACT_QUIET=1.

  3. Report — markdown table with: memories retrieved, tokens saved (bridge-reported), agentic-flow availability, cache hit rate. The script also emits a "bridge-reported, not measured against a no-RAG baseline" disclaimer. On bridge-unavailable: prints "agentic-flow not installed — bridge returns inert results." and exits cleanly.

Caveats — claimed upstream, not yet verified

CLAUDE.md root claims ReasoningBank retrieval: -32% tokens. The bridge's tokensSaved is query_tokens − compact_prompt_tokens (token-optimizer.ts:141–143) — a heuristic, not a baseline-measured saving. token-optimizer.ts:9–10 itself says: "No fabricated metrics are reported — all stats reflect real measurements". This skill carries that disclaimer forward.

Booster-specific availability is not exposed as a getter — observable only through optimizedEdit() returning method: 'agent-booster'. The canonical Tier 1 signal is [AGENT_BOOSTER_AVAILABLE] (see cost-booster-route).

Fallback

agentic-flow not installed → getCompactContext returns {tokensSaved: 0, memories: []} (line 116–124), optimizedEdit returns {method: 'traditional'}, getOptimalConfig falls back to anti-drift defaults. Skill exits cleanly with the "not available" message.

Cross-references

ADR-0002 Decision #2 + §"Riskiest assumption" · token-optimizer.ts:308 (singleton export) · docs/benchmarks/0002-baseline.md (verification findings).

常见问题

如果辅助包缺失会怎样?

这项技能说明,此时会提示该包未安装,并返回空结果,而不会失败。

节省量经过验证了吗?

还没有。节省量由辅助程序报告,尚未与不使用上下文时的基准进行对比衡量。

上下文从哪里来?

它来自辅助程序所检索的已存储记忆库。

详情

作者的原始描述

Wrap getTokenOptimizer().getCompactContext() to retrieve compacted ReasoningBank context for cost-analysis queries; report bridge-reported tokensSaved

repo: ruvnet/ruflo

热度

GitHub 星标
81k
排名
#1596
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能