cost-optimize

Analyze token usage patterns and recommend model and caching optimizations with estimated savings.

70.1k|8.4k|Updated Jun 2, 2025
One-click install
npx skills add https://github.com/ruvnet/claude-flow --skill cost-optimize
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cost-optimize
Source: https://github.com/ruvnet/claude-flow/tree/main/plugins/ruflo-cost-tracker/skills/cost-optimize
Command: npx skills add https://github.com/ruvnet/claude-flow --skill cost-optimize

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

AI agent workloads can accumulate unnecessary costs from oversized model selection, poor prompt cache utilization, and redundant agents. This Skill analyzes recent token usage and produces ranked, dollar-quantified recommendations to reduce spending.

Core Features & Use Cases

  • Model Fit Analysis: Evaluates whether each agent's model tier matches task complexity, flagging simple tasks on expensive models and quality risks on cheap ones.
  • Cache Rate Auditing: Computes per-agent cache hit rates and recommends prompt caching improvements when below 60%.
  • Redundancy Detection: Identifies overlapping agents and batching opportunities, then stores optimization patterns for future routing decisions.
  • Use Case: Your monthly agent bill doubled unexpectedly. Run this Skill to get a ranked table of downgrade recommendations, projected savings per change, and quick-win priorities.

Quick Start

Analyze my last 7 days of agent token usage and recommend cost optimizations with estimated dollar savings.

Frequently Asked Questions about cost-optimize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce AI agent token costs?

Analyze recent usage to find agents running simple tasks on expensive models, then downgrade them to cheaper tiers like Haiku. Also check cache hit rates per agent, since enabling prompt caching can cut costs significantly on repeated context.

How to analyze token usage across multiple agents?

Query the cost-tracking memory namespace for the last 7 days of usage data, then break down consumption per agent and model. Compare each agent's task complexity against its model tier to find mismatches.

What cache hit rate should AI agents target?

This Skill flags agents below a 60% cache hit rate and recommends enabling or improving prompt caching. Cache reads can reduce costs by up to 90% compared to uncached input tokens.

When should I not downgrade an agent's model?

Avoid downgrading agents handling complex tasks like architecture decisions or security analysis, since cheaper models create quality risk there. The Skill flags these cases instead of recommending a downgrade.

How does the router learn from cost optimization recommendations?

Each downgrade recommendation emits a model-outcome event via the outcome script, reporting success or escalation. Without this feedback signal, the routing layer cannot learn and the booster bypass rate does not improve.