token-cost-optimizer

Use before a large Copilot task when model choice, context size, or parallelism could drive up billed usage — estimate cost pressure early and apply Copilot-specific reduction tactics before you run

8 stars

Best use case

token-cost-optimizer is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use before a large Copilot task when model choice, context size, or parallelism could drive up billed usage — estimate cost pressure early and apply Copilot-specific reduction tactics before you run

Teams using token-cost-optimizer should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/token-cost-optimizer/SKILL.md --create-dirs "https://raw.githubusercontent.com/drvoss/everything-copilot-cli/main/skills/copilot-exclusive/token-cost-optimizer/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/token-cost-optimizer/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How token-cost-optimizer Compares

Feature / Agenttoken-cost-optimizerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use before a large Copilot task when model choice, context size, or parallelism could drive up billed usage — estimate cost pressure early and apply Copilot-specific reduction tactics before you run

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Token Cost Optimizer

Token Cost Optimizer is a proactive cost-control skill for GitHub Copilot. It helps you reduce
metered usage before and during a task by choosing the right model path, cutting unnecessary
context, and avoiding parallel work that burns credits without enough payoff.

## Why This is Copilot-Exclusive

GitHub Copilot now exposes cost-sensitive control surfaces that matter directly in the CLI:

- **Model pricing** for token-based usage across Copilot models
- **Premium request multipliers** that vary by model and feature surface

This skill focuses on Copilot-native levers such as `/model`, Auto model selection, `/compact`,
`/context`, autopilot, and `/fleet` rather than generic LLM budgeting advice.

## When to Use

- Before launching a large Copilot CLI task that may scan many files or run for a long time
- Before using `/fleet` or autonomous modes where model and context choices can multiply spend
- When you need to stay inside a budget or monthly AI credit allowance
- When you want to trade a small quality reduction for a large cost reduction on routine work

## When NOT to Use

| Instead of token-cost-optimizer | Use |
|---------------------------------|-----|
| You are auditing historical spend after the fact | `workflow/cost-audit` |
| The task is tiny and the model choice is obvious | do the task directly |
| You need to choose execution mode before cost strategy | `task-intake-router` |

## Cost Drivers

The main Copilot cost drivers are:

1. **Model selection** — more capable models generally cost more
2. **Context size** — wider scans and larger prompts increase token use
3. **Parallel agent count** — `/fleet` can multiply model interactions
4. **Autonomous depth** — long autopilot runs can continue consuming usage while you are not intervening

## Workflow

### 1. Estimate the task shape first

Ask:

- how many files must be read?
- does the work need a premium model?
- is the task truly parallelizable?
- can the context be narrowed before starting?

If the answer is unclear, reduce uncertainty first instead of paying for a large blind run.

### 2. Right-size the model

Use the cheapest path that still meets the task's quality bar.

| Task type | Preferred path |
|-----------|----------------|
| Search, routing, simple summaries | Fast / low-cost model |
| Normal implementation and planning | Standard model |
| Security, architecture, high-risk review | Premium model only when justified |
| Mixed or uncertain workload | Auto model selection |

**Auto** can still be useful here because it routes to a supported model without forcing you to
hand-pick one up front.

### 3. Cut context before you run

Use Copilot-native context controls to avoid paying for irrelevant history:

```text
/context
/compact
```

Good reduction moves:

- compact stale conversation history before a large new task
- narrow the repo surface before asking for implementation
- prefer targeted file reads over broad codebase scans
- split unrelated requests instead of bundling them into one giant prompt

### 4. Be selective with autopilot and fleet

`/fleet` and autopilot are powerful, but they can increase usage quickly when used on the wrong
task shape.

Use them when:

- the work is large enough that automation or parallelism clearly pays off
- subtasks are mostly independent
- the context is already constrained

Avoid them when:

- the task is mostly sequential
- you still need exploratory back-and-forth
- every subagent would need the same giant context

### 5. Set a cost-aware execution plan

Before a large run, write a short plan:

```text
Model path: Auto
Context strategy: compact first, then limit to docs/ and src/auth/
Execution mode: sequential until scope is clear, fleet only for independent test files
Stop rule: switch to manual review if the task expands beyond the approved surface
```

### 6. Review after the first expensive pass

After one substantial run, ask:

- did the chosen model clearly outperform a cheaper option?
- did the task need fleet, or would sequential execution have been enough?
- did context include too much unrelated history?

Use that answer to tune the next run instead of repeating the same expensive pattern.

## Common Rationalizations

| Rationalization | Reality |
|----------------|---------|
| "Use the strongest model for everything." | Premium models should be reserved for tasks that truly need them. |
| "Fleet is always faster, so it is always better." | Parallelism can raise cost sharply when tasks are not independent. |
| "The full chat history might help." | Old context often adds cost faster than it adds quality. |

## Red Flags

- A premium model is being used for routing, search, or boilerplate generation
- `/fleet` is planned before the work is decomposed into mostly independent subtasks
- The current session contains a long, stale conversation and no `/compact` step
- The task brief does not explain why a premium model is necessary

## Verification

- [ ] The selected model tier matches the risk and complexity of the task
- [ ] Context was narrowed before large autonomous or parallel runs
- [ ] `/fleet` is only used where parallelism has a clear payoff
- [ ] Auto model selection is considered when the task mix is broad or uncertain

## See Also

- [`multi-model-strategy`](../multi-model-strategy/SKILL.md) — choose the right model path
- [`task-intake-router`](../task-intake-router/SKILL.md) — route to the right execution mode first
- [`fleet-parallel`](../fleet-parallel/SKILL.md) — parallelize only when dependency shape supports it
- [`cost-audit`](../../workflow/cost-audit/SKILL.md) — analyze spend after the workflow exists

Related Skills

prompt-optimizer

8
from drvoss/everything-copilot-cli

Use when a rough prompt, vague idea, or task description needs to become a finished copy-pasteable prompt for a chat-based LLM - rewrite it into one ready-to-send prompt with no blanks, no placeholders, and a clear output shape.

cost-audit

8
from drvoss/everything-copilot-cli

Use when AI inference costs are growing unexpectedly, when comparing model choices by cost/quality ratio, or when optimizing token usage across a multi-model pipeline — produces an actionable cost reduction plan

verification-before-completion

8
from drvoss/everything-copilot-cli

Use before claiming any task is done — run the exact command that proves the fix works, read the output, and only then report success.

using-git-worktrees

8
from drvoss/everything-copilot-cli

Use when you need multiple branches checked out at once — create isolated working directories for parallel development without cloning the repository repeatedly

triage

8
from drvoss/everything-copilot-cli

Use when a single issue needs structured triage — classify it, reproduce if needed, request missing information, and leave a durable brief or close-out note in the tracker.

to-issues

8
from drvoss/everything-copilot-cli

Use when a plan, spec, or PRD must become an actionable backlog — break it into thin dependency-aware issues that each deliver a verifiable vertical slice

sprint-workflow

8
from drvoss/everything-copilot-cli

Use when starting a new feature, refactor, or multi-step dev task — runs the full sprint cycle (Think → Plan → Build → Review → Test → Ship → Monitor) using Copilot CLI's plan/autopilot modes.

sprint-retro

8
from drvoss/everything-copilot-cli

Use at the end of a sprint to run a data-driven retrospective — analyzes session history and git metrics to surface what shipped, what slowed you down, and concrete improvements.

security-audit

8
from drvoss/everything-copilot-cli

Use when a codebase needs a formal security audit beyond a quick scan — applies OWASP Top 10 and STRIDE threat modeling from a CSO perspective to surface systemic vulnerabilities.

release

8
from drvoss/everything-copilot-cli

Use when a sprint or feature is complete and ready to ship — tags the version, generates GitHub Release notes, runs rollout or smoke verification, and publishes to npm/PyPI/Docker registries.

outside-voice

8
from drvoss/everything-copilot-cli

Use when you need an independent second opinion before, during, or after implementation — run challenge, consult, or review mode in a direct builder-to-builder voice

llm-wiki

8
from drvoss/everything-copilot-cli

Use when research or domain knowledge keeps getting rediscovered across sessions — build a supplementary markdown wiki that compounds synthesized knowledge without replacing GitHub or committed project guidance