Skip to content

route — GitHub Copilot CLI

Pick the right Copilot model for a task and estimate its cost in AI Credits before running it. Use when the user asks which model to use, what a task will cost, whether a cheaper model would do, or how much of their plan allowance a job will burn.

In practice

What it does

AI Credits are real money on this harness, not a synthetic score — so before dispatching anything non-trivial, this skill prices a few candidates and shows both USD and the credit count, read from the current pricing data rather than a remembered rate.

When to reach for it

  • Before running anything non-trivial, to see a cost estimate and a tier recommendation first.
  • Writing code that dispatches a Copilot model and needs the right tier plus the actual invocation surface.
  • Checking whether a cheaper lane would do just as well before spending on a stronger one.
  • Not a spend report — that's usage; this only estimates what a task is about to cost, before it runs.

Worked example

Map the task to a task_profiles size, then estimate a few candidates:

python3 bin/copilot_pricing.py est <PROFILE> <MODEL_ID>

Run it for two or three candidates in the chosen tier plus one lane cheaper as a sanity check, present USD and AIC per candidate, then give a single action:

Goal Mechanism
one-shot dispatch copilot -p "<task>" --model <model-id>
interactive switch /model
session default COPILOT_MODEL=<model-id> env var
persistent default "model" key in ~/.copilot/settings.json
per-agent pin model: frontmatter in an agent file

Failure modes & fallbacks

  • tasks/lessons.md exists in the working repo. Read it before classifying — a routing-category entry overrides the default tier heuristics below it.
  • Two tiers look equally plausible. Pick the cheaper one and name the failure signal that would justify upgrading, rather than guessing up front.
  • The recommendation names a specific model from memory. Don't — tier words plus engine output only; the roster changes underneath a remembered id.

Cost & safety

Every number is read at run time from the pricing data — the AIC-to-USD rate itself is data (billing_unit.usd_per_credit), never quoted from memory. If a monthly plan is known, runway <PLAN> <PROFILE> <MODEL_ID> shows how much of it one task burns. Routing itself is free; the only spend is the dispatch you actually run afterward.

  • lessons-loop — the routing-lesson file this skill reads before classifying.
  • escalate — the verify-gated ladder for when the picked tier isn't enough.
  • budget — a cheaper dispatch lane for kit work specifically.

The skill card — what the model reads

This is the SKILL.md body the model reads, transformed for this page: the source's own leading title, if it had one, is removed; every remaining heading is demoted one level to nest under this section; and relative links are rewritten to site or GitHub URLs. ${CLAUDE_PLUGIN_ROOT} and {{POLYTROPOS_ROOT}} are install-time path variables, left intact exactly as the model sees them. The unmodified original is copilot/.github/skills/route/SKILL.md.

You route a task to the cheapest Copilot model that will do it well, and you show the cost in USD and AI Credits (AIC) before anything expensive runs. You are a decision aid, not a report.

Get the numbers from data — never from memory

All pricing lives in {{POLYTROPOS_ROOT}}/data/pricing.copilot.json. Do not quote prices, ratios, plan allowances, or the AIC-to-USD rate from memory — the unit itself is data (billing_unit.usd_per_credit). Prefer shelling to the cost engine over reading the raw file:

  • python3 {{POLYTROPOS_ROOT}}/bin/copilot_pricing.py est <PROFILE> <MODEL_ID> — USD + AIC for one candidate
  • python3 {{POLYTROPOS_ROOT}}/bin/copilot_pricing.py models --profile <PROFILE> — the cross-vendor roster with estimates
  • python3 {{POLYTROPOS_ROOT}}/bin/copilot_pricing.py runway <PLAN> <PROFILE> <MODEL_ID> — how much of a plan a task burns

Load routing lessons first

If tasks/lessons.md exists in the working repo, recall it before classifying:

  • python3 {{POLYTROPOS_ROOT}}/bin/lessons_store.py recall --applies-to routing --project <repo-name> --provider copilot [--task-shape <shape>]

Only a RULE for this task's shape overrides the default tier heuristics below, and only within its recorded scope. A CANDIDATE (one observation, or a legacy entry with no provenance) is evidence to weigh and mention, never an override — it becomes a rule when it recurs or when the user promotes it (see the lessons-loop skill).

Classify into a tier

Tiers use the data file's four-value vocabulary:

  • cheap — classification, extraction, formatting, lookups, bulk/boilerplate.
  • mid — the workhorse lane: day-to-day coding, tests, docs, routine refactors.
  • strong — multi-file features, hard debugging, architecture, code review.
  • frontier — long-horizon agentic runs, large migrations, or work a strong-tier model failed on. It is also the most AIC-expensive tier — reach for it deliberately, only when a strong-tier model would genuinely fail, and say what makes the task frontier-worthy. Everything a strong model can do, route to strong.

When between two tiers, pick the cheaper one and name the failure signal that would justify upgrading (e.g. "if it can't hold the whole module in context, go strong"). Within a tier, compare candidates across vendors using models --profile <PROFILE>, not vendor loyalty. Never name a specific model id from memory — tier words and engine output only.

Estimate

  1. Map the task to the closest task_profiles size (XS–XL) by input/output volume.
  2. Run the engine for 2–3 candidate models in the chosen tier (and one lane cheaper as a sanity check).
  3. Present USD and AIC per candidate. AIC are money — each credit costs usd_per_credit.
  4. If the user's plan is known or they ask about allowance, add runway <PLAN> <PROFILE> <MODEL_ID> output (tasks per month, % of monthly allowance per task).

Recommend, then tell the user exactly how to act

Present model ids as listed by /model (the data roster is verified against it). Give the single mechanism that fits, drawn from Copilot CLI's real control surfaces:

goal how
one-shot dispatch copilot -p "<task>" --model <model-id>
interactive switch /model (policy-disabled models prompt to enable)
session default COPILOT_MODEL=<model-id> env var
persistent default "model" key in ~/.copilot/settings.json (or $COPILOT_HOME/settings.json)
per-agent pin model: frontmatter in a .github/agents/*.agent.md / ~/.copilot/agents/*.agent.md file

Output shape

Keep it compact:

  1. A short table — candidate model, USD, AIC, one-line rationale each — with the recommended row in bold.
  2. The single action command to run (usually the one-shot copilot -p ... --model line).

No prose report. If every candidate is trivially cheap, say so and stop.

User model prefs (pins & excludes)

The user can pin which model a tier resolves to, or exclude models from consideration — via the gitignored prefs file (prefs/copilot.json at the optimizer repo root) or the driver's per-run flags. Check what is active before recommending anything:

python3 {{POLYTROPOS_ROOT}}/bin/copilot_pricing.py prefs

Honor it: never recommend an excluded model — if the natural pick is excluded, say so and name the next candidate from the prefs output's tier resolution. When a tier is pinned, the pinned model IS that tier's pick (a cross-tier pin is a deliberate user override, priced at the pinned model's own rates — est it directly). Pins or excludes the user states in the prompt count the same as the file.

Same-named agent

For persona-isolated runs — a separate dispatch that should carry its own model pin instead of this session's model — use the route custom agent: pick it in the /agent picker, or run copilot --agent route -p "<task>". This skill and that agent are the same capability on two surfaces; the agent's frontmatter carries the model pin, this skill runs on whatever model the session already uses.

Installed?

If the literal {{POLYTROPOS_ROOT}} text is still visible above, the bundle is not installed — tell the user to run python3 bin/harness_select.py install --harness copilot (then /skills reload picks the skills up in-session).

Optional context travel

When an explicit repository/kit/assignment and authorized startup config are supplied, use the native context-travel skill and read {{POLYTROPOS_ROOT}}/docs/CONTEXT-TRAVEL-SURFACES.md on demand for a bounded scope brief. Treat missing, stale, partial, or refused context as advisory; retain this workflow's authoritative sources, policy, pricing, permission, and mandatory verification rules. If no authorized context transport is available, continue this workflow and report context unavailable.