Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

ai-cost-manager-reducer

БесплатноБез исполняемых скриптовНе проверен

Audit AI-powered features, API calls, agent workflows, prompt chains, tool calls, embeddings, vector search, retries, streaming flows, background jobs, cron…

conectlensот conectlens★ 18 звёзд на GitHub

Об этом скилле

AI Cost Manager & Reducer

Audit as an efficiency engineer, not a summarizer. Every finding must name a concrete waste pattern, its cost risk, and a safe optimization strategy that preserves reasoning quality and chain correctness.

Quick Start

  1. Identify all AI call sites: LLM API calls, embedding generation, vector search, tool dispatch, agent loops.
  2. Trace each call's purpose, frequency, input size, output size, and model selection.
  3. Detect waste patterns (see catalogue below).
  4. Rank findings by severity and estimated cost impact.
  5. Propose safe optimizations with validation steps.

Never recommend removing a reasoning step unless you have verified the step is truly redundant or its output is unused downstream.


Audit Scope

AI Call Sites to Inspect

  • LLM completions: openai, @anthropic-ai/sdk, Supabase Edge Functions calling AI APIs, server actions, background workers, cron jobs
  • Embedding generation: embeddings.create(), embed(), pgvector insert paths, semantic search pipelines
  • Vector search: cosine similarity queries, <=> operator, HNSW/IVFFlat index queries
  • Tool/function calls: agent tool dispatch loops, multi-step orchestration, MCP tool invocations
  • Streaming flows: streamed completions feeding downstream parsers or UI
  • Retry logic: exponential backoff, retry-on-failure wrappers, queue consumers
  • Caching layers: Redis/KV caches keyed on prompts, memoization wrappers, CDN-cached AI responses
  • Classification / extraction calls: sentiment, category, entity extraction, intent detection
  • Summarization pipelines: document chunking, recursive summarization, context compression
  • Model selection logic: environment switches, tier routing, fallback chains

Waste Pattern Catalogue

Token Waste

ID Pattern Signal
TW-1 Oversized system prompt injected on every call System prompt > 500 tokens with mostly static content
TW-2 Full conversation history resent without truncation Context grows unboundedly per session
TW-3 Redundant context injection Same DB rows / user profile fetched and embedded in prompt on every request
TW-4 Verbose output without max_tokens cap Responses regularly exceed task requirements
TW-5 Unstructured output where JSON/schema would halve tokens Free-text response parsed by regex downstream
TW-6 Recursive summarization without memoization Same document re-summarized on every call

Repeated / Duplicate Calls

ID Pattern Signal
RC-1 Identical prompt sent multiple times per request No cache; same user query triggers 2+ completions
RC-2 Duplicate embedding generation Same text embedded on insert and on query with no stored cache
RC-3 Classification called once per item in a loop Per-row intent/sentiment when batch classification is available
RC-4 Agent re-reads same tool output in next iteration Tool result not stored in agent state
RC-5 Background job re-processes unchanged records No updated_at / version gate before AI call

Model Overuse

ID Pattern Signal
MO-1 GPT-4/Claude Opus used for simple classification or formatting Task needs < 200 tokens and has deterministic answer
MO-2 Expensive model used in high-frequency cron Cron calls Opus/GPT-4 every minute on potentially unchanged data
MO-3 No model routing between tiers Same model regardless of task complexity or latency budget
MO-4 Embedding model overqualified for the retrieval task Ada-3 on short single-word lookups where text-embedding-3-small suffices

Retry & Loop Storms

ID Pattern Signal
RL-1 Unbounded agent loop while (true) or recursive agent with no step cap
RL-2 Retry on every error including non-retryable (400s) Retry wrapper doesn't skip validation errors
RL-3 Retry storm on quota hit without jitter Simultaneous retries after 429 with no backoff spread
RL-4 Tool call in loop without early exit Agent calls search tool repeatedly even after finding answer

Caching Gaps

ID Pattern Signal
CG-1 No prompt-level cache Identical prompts hit the API on every call
CG-2 No embedding cache pgvector rows recalculated instead of reused
CG-3 No semantic cache Similar (not identical) prompts bypass cache
CG-4 Short or missing TTL on AI responses Cache evicts results before they can be reused
CG-5 Streaming response not cached Streamed output never stored; replays cost full tokens

Chain Inefficiency

ID Pattern Signal
CI-1 Sequential calls that could be parallelized Step B doesn't need step A's output but waits for it
CI-2 Multi-step chain where one call could replace two Classify then reformat is one structured-output call
CI-3 Intermediate re
Полный SKILL.md на GitHub

Установить ai-cost-manager-reducer в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл ai-cost-manager-reducer?

Audit AI-powered features, API calls, agent workflows, prompt chains, tool calls, embeddings, vector search, retries, streaming flows, background jobs, cron tasks, caching layers, logs, and model selection logic to detect token waste, repeated AI calls, and inefficient prompt chains. Produces severity-ranked findings with safe optimization strategies that preserve reasoning quality and chain reliability. Use before approving or modifying any AI-powered feature, agent workflow, or model-calling code.

Как установить скилл ai-cost-manager-reducer?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ai-cost-manager-reducer запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить ai-cost-manager-reducer с