cost-compact-context
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
-
Take the query — the single argument.
-
Invoke — run from anywhere under
v3/so@claude-flow/integrationresolves:( cd v3 && node ../plugins/ruflo-cost-tracker/scripts/compact.mjs "<QUERY>" )The script imports
@claude-flow/integration/token-optimizer(canonical export — notdist/token-optimizer.js, which would double the.jsextension via Node's./*exports rule), callsgetCompactContext(query), and prints a markdown summary plus a JSON line viaCOMPACT_QUIET=1. -
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.