Skip to content
ruvnet avatar

Cost Compact Context

Wraps the bridge's compacted ReasoningBank context for cost queries, reporting heuristic tokens saved.

CCM score
71 of 100
skills.sh installs
727
GitHub stars
82.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers one shell-invoked retrieval: getTokenOptimizer().getCompactContext() run through scripts/compact.mjs from under v3/
  • Reports memories retrieved, bridge-reported tokens saved, agentic-flow availability, and cache hit rate in a markdown table
  • Enforces a clean exit with "agentic-flow not installed" when the package is absent, returning zero tokens saved
  • Designed for cost-analysis queries where a heuristic saving, not a baseline-measured one, is acceptable

Install

$ npx -y skills add ruvnet/ruflo --skill cost-compact-context -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

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.

Details

Repository
github.com/ruvnet/ruflo
Category
Memory & Context
First seen
Jun 3, 2026

Questions

What does the cost-compact-context skill do?

It wraps getTokenOptimizer().getCompactContext() from @claude-flow/integration to retrieve compacted ReasoningBank context for a cost-analysis query. It reports the tokensSaved figure the bridge provides, along with memories retrieved and cache hit rate.

How do I install the cost-compact-context skill?

Run npx -y skills add ruvnet/ruflo --skill cost-compact-context -y in a project. The skill then lets the agent query compacted context and report a markdown summary of the results.

Where does cost-compact-context sit in the Memory & Context category?

It is one of the skills in the Memory & Context category on Claude Marketplaces, alongside handoff and the caveman skills. Its distinct focus is reporting bridge-reported token savings for cost-analysis queries, which is a heuristic rather than a measured baseline.

Does cost-compact-context need agentic-flow installed?

Yes, the bridge dynamically imports agentic-flow for real results. When it is missing, tokensSaved is 0, memories are empty, and the skill exits cleanly with a not-available message.

More from ruvnet/ruflo

All 236

Similar to Cost Compact Context

More Memory & Context