Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
ruvnet avatar

Cost Compact Context

  • 637 installs
  • 67k repo stars
  • Updated August 4, 2026
  • ruvnet/ruflo

cost-compact-context is a Claude Code skill that wraps getTokenOptimizer().getCompactContext() from @claude-flow/integration to return compacted ReasoningBank context and report tokensSaved for developers who need cheape

About

cost-compact-context is a Bash-driven Claude Code skill in ruvnet/ruflo that shells a Node one-liner to call getTokenOptimizer().getCompactContext() from @claude-flow/integration when no MCP tool wraps getTokenOptimizer (noted in ADR-0002). The bridge dynamically imports agentic-flow with graceful fallback: if the package is missing, tokensSaved is 0 and the skill exits cleanly. Developers pass a single query argument and receive compacted ReasoningBank context sized for cost-analysis questions while seeing bridge-reported token savings. Reach for cost-compact-context when tuning Claude-Flow or agentic-flow agent runs where verbose reasoning context inflates billable tokens. It complements token optimizers and ReasoningBank workflows rather than replacing full context dumps or MCP-based inspection tools.

  • cost-compact-context

Cost Compact Context by the numbers

  • 637 all-time installs (skills.sh)
  • +6 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #604 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/ruvnet/ruflo --skill cost-compact-context

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs637
repo stars67k
Last updatedAugust 4, 2026
Repositoryruvnet/ruflo

How do you compact ReasoningBank context for token savings?

Use cost-compact-context for development tasks

Who is it for?

Developers running Claude-Flow or agentic-flow agents who need compact context and visible token savings on cost-analysis queries.

Skip if: Teams that require full uncompressed reasoning traces or already expose getTokenOptimizer through a dedicated MCP server wrapper.

When should I use this skill?

The user asks for compact agent context, ReasoningBank summaries, or token-cost analysis during Claude-Flow or agentic-flow development.

What you get

Compacted ReasoningBank context payload and a tokensSaved count from the optimizer bridge.

  • Compacted ReasoningBank context
  • tokensSaved metric

Files

SKILL.mdMarkdownGitHub ↗

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).

Related skills

How it compares

Pick cost-compact-context when you need compact ReasoningBank context and token savings metrics inside Claude-Flow; use full-context or MCP debug tools when every reasoning step must remain verbatim.

FAQ

What does cost-compact-context return?

cost-compact-context returns compacted ReasoningBank context from getTokenOptimizer().getCompactContext() plus bridge-reported tokensSaved for the supplied cost-analysis query. If agentic-flow is not installed, tokensSaved is 0 and the skill exits cleanly.

Why does cost-compact-context use Bash instead of MCP?

cost-compact-context shells a Node one-liner because ADR-0002 notes no MCP tool wraps getTokenOptimizer yet. Bash allowed-tools execute the integration call directly until an MCP wrapper ships.

Backend & APIsbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.