Skip to content

About

A practical GitHub Copilot CLI workbench for session management, Jira usage reporting, custom agents, and multi-agent development workflows.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

copilot-cli-toolkit

Personal-workflow tooling for the GitHub Copilot CLI: a session manager with automatic per-task usage/cost reporting, and an 8-role multi-agent implementation pipeline (discovery/planner → one of coder / intermediate-coder / senior-coder → reviewer → tester → test-reviewer) with cost-aware, bounded routing — all source/code changes (production source, tests including tester-authored tests, scripts, Storybook stories, and executable or behavior-affecting configuration) receive independent review; discovery, planning, and testing remain conditional.

Both pieces are independent — use the session manager without the agent pipeline, or vice versa.

Why

The Copilot CLI is powerful but, out of the box, gives you no persistent cross-directory session list, no automatic usage/cost accounting tied to your actual task work, and no opinionated structure for multi-step implementation tasks. This toolkit adds all three as a thin, inspectable layer around the stock CLI — it never forks or patches copilot itself.

Copilot Auto mode vs. this toolkit

Copilot's /model auto setting and this toolkit solve different problems. Auto mode lets Copilot dynamically choose a model for the current work. This toolkit adds workflow policy around Copilot: session management, task-level reporting, custom roles, explicit model defaults, bounded loops, and conditional stage routing with mandatory independent review for source/code changes, including tests and behavior-affecting configuration even when they add no executable behavior. Pure prose/documentation and mechanical git-only operations are normally exempt.

The toolkit is not automatically better, smarter, or more reliable than Auto mode. Auto is maintained by GitHub and can adapt as models and routing improve. The toolkit is useful when you prefer more control and repeatability, and accept the maintenance and orchestration overhead that comes with it.

Area Copilot Auto mode This toolkit
Model selection Copilot chooses dynamically based on the current request Each custom role has a visible default model, with personal overrides available through /subagents
Workflow Flexible; Copilot decides whether and how to delegate A documented task-tier policy decides which roles run; all source/code changes, including tests and behavior-affecting configuration, receive independent review
Cost control Relies mainly on Copilot's automatic routing and account limits Uses cheaper routine roles, tiered reviewer routing, conditional stages, and bounded review/test loops
Role separation May handle planning, implementation, review, and testing in one session Separates discovery, planning, production coding, review, and testing into narrowly-scoped roles
Repeatability Routing may change as Auto evolves or as prompts differ Agent files and instructions are inspectable, version-controlled defaults
Session management Uses Copilot CLI's native session commands Adds a global cross-directory session list, bulk deletion, naming, and exit-time keep/rename/delete prompts
Usage reporting /usage reports session usage interactively Creates cumulative per-task Markdown reports with models, tokens, time, effort attribution, and estimated cost
Maintenance Lowest maintenance; GitHub updates the routing You maintain agent prompts, model defaults, pricing data, and compatibility with future CLI changes

Which should you use?

  • Use Auto alone when you want the simplest experience, trust GitHub's model routing, and do not need this toolkit's session/reporting features or explicit development stages.
  • Use the toolkit's agent defaults when repeatable role boundaries, visible model choices, cost budgets, and review/test discipline matter more than fully automatic routing.
  • Use both together (recommended for most users): keep the main Copilot session on Auto, while custom subagents use their role-specific defaults. Auto can handle normal conversation and orchestration; the toolkit supplies the session manager, task reports, and reusable role definitions.

Reliability caveat

The agent pipeline is implemented with Copilot custom-agent profiles and instructions, not a separate deterministic workflow engine. The model can still decide that a stage is unnecessary or handle work in the main session. The orchestrator instructions make behavior more consistent, but cannot guarantee that every prompt follows an identical sequence.

For work that requires strict process enforcement, explicitly invoke the desired agent (for example, /agent reviewer) and verify delegated work with /tasks. For standard, complex, and high-risk work—and any task requiring broad discovery or design planning at any tier—the orchestrator requests approval of the proposed routing before substantive work. Routine small implementation remains on its automatic coder route; simple questions stay direct. When runtime autopilot is active, the orchestrator instead selects the best-supported recommended in-scope route without asking for routing approval, visibly announcing it before acting; other required permissions still apply. This applies only to active autopilot in sessions using the installed global instructions; normal modes are unchanged. Future launches load those instructions; existing sessions may need a reload or restart.

Features

  • Global session manager (copilot-s) — list, resume, rename, and delete Copilot CLI sessions across every directory, not just the one you're in, plus a recoverable cleanup of empty, never-used sessions.
  • Subagent model refresh (copilot-s menu p) — compares each subagent route against the current official GitHub Copilot prices and the current official model capability pages (with a dated, sourced catalog as fallback), plus a short reviewed list of public third-party benchmark comparison pages shown as reference only. Balanced by default: one compact, colour-highlighted numbered draft mapping table of every route (drafted change or keep, price change, short basis — alignment, benchmark, documented advantage at the same price, or savings labelled as price only); the draft is only a proposal — nothing is selected: a accepts all, a 1,3 only those rows, k/r keep or repropose rows, o shows the other alternatives, and local overrides are applied only after a final yes. The full report (all models, rejected candidates, raw rates) is an optional details view. Shipped defaults and your own /subagents values are never overwritten.
  • Automatic per-task usage reports — every session exit appends token counts, model-call time, reasoning-effort intent, and an estimated USD cost to a cumulative Markdown report for the task associated with your current git branch (or a free-form task name/ID you provide).
  • Per-launch session reports — every copilot-s launch gets a metadata-only run record (exact session link or unknown, exit status, wall clock, OTEL calls/tokens, a frozen estimated cost). See Per-launch session reports.
  • 8-role agent pipeline — discovery, planner, coder, intermediate-coder, senior-coder, reviewer, tester, test-reviewer, wired together by an orchestrator with explicit task tiers (the three coders are alternative implementers — exactly one per batch, never a chain); all source/code changes, including tests, scripts, stories, and behavior-affecting configuration, get independent bounded review while discovery, planning, and testing remain conditional to avoid duplicated, token-burning work.
  • Official GitHub per-token pricing, refreshed automatically — the estimated USD cost uses GitHub's published Copilot models and pricing rates (input / cached input / cache write / output, Default and Long-context tiers), fetched from docs.github.com, strictly validated and cached for 24h. Each call is priced at ingestion and recorded with the snapshot that priced it, so later rate changes never reprice the past. Unlisted models or unpriceable usage are reported as partial coverage, never silently as $0.
  • Symlink-based install — the repo is the source of truth; git pull (or scripts/update.sh) updates your live tools immediately, no re-install step required.

Architecture

flowchart LR
    CS["copilot-s"] -->|launches, sets OTEL env| COPILOT["copilot CLI"]
    COPILOT --> OTEL["OTEL span files"]
    COPILOT --> EVENTS["events.jsonl"]
    CS -->|on exit: ingest| HELPER["copilot-task-report.py"]
    OTEL --> HELPER
    EVENTS --> HELPER
    HELPER --> REPORT["Markdown usage report\nper task"]
Loading

See docs/architecture.md for the full breakdown, including the multi-agent pipeline diagram and ingest/idempotency design.

Example report output

# Copilot Task Usage Report — ABC-123

- Report last updated: 2026-09-20T14:03:11Z
- First recorded: 2026-09-18T09:12:45Z
- Copilot sessions contributing: 3

## Summary

| Metric | Value |
|---|---|
| Model calls | 42 |
| Prompt (input) tokens | 186,204 |
| ...of which cache-read tokens | 61,880 |
| Completion (output) tokens | 24,517 |
| Total tokens | 210,721 |
| Model-call time | 18m 32s |
| Estimated USD cost (official GitHub per-token rates recorded at ingestion — estimate, NOT a bill) | $0.41 — **PARTIAL (lower bound)**: 40 of 42 calls priced; excludes 2 unpriced |
| Official rate source | GitHub Copilot models and pricing — cache fresh (3.2h old, snapshot `sha256:…` fetched 2026-09-20T10:51:02Z) |

## Estimated Cost Coverage (official GitHub Copilot per-token rates)

| Model | Calls | Priced calls | Est. USD (official rates) | Unpriced calls | Legacy calls | Official model / tiers used |
|---|---|---|---|---|---|---|
| claude-sonnet-5 | 30 | 30 | $0.36 | 0 | 0 | claude-sonnet-5 (Default×30) |
| gpt-5.4-mini | 10 | 10 | $0.05 | 0 | 0 | gpt-5.4-mini (Default×10) |
| some-unlisted-model | 2 | 0 | not priced | 2 | 0 | — |

- 2 call(s) not priced: model not listed in the official GitHub pricing snapshot used at ingestion

(Illustrative — no real task IDs, tokens, or costs; generated from synthetic data for documentation purposes.)

Requirements

  • macOS or Linux with Bash ≥ 3.2 (the default macOS /bin/bash works; no Bash 4+ features are used).
  • Python 3.7+ (stdlib only — no dependencies to install).
  • GitHub Copilot CLI (copilot) installed and on PATH.
  • git (for task-key-from-branch detection, and for scripts/update.sh).

Quick install

git clone https://github.com/<you>/copilot-cli-toolkit.git ~/copilot-cli-toolkit
cd ~/copilot-cli-toolkit
scripts/install.sh --dry-run   # preview what will change
scripts/install.sh              # symlink executables, agents, and instructions into place

This installs:

What Installed to Method
copilot-s, copilot-task-report.py, copilot-session-cleanup.py, copilot-report-cleanup.py, copilot-model-refresh.py, copilot-session-report.py ~/.local/bin/ symlink by default (or plain file copy with --copy)
Libraries loaded from the tools' own directory: copilot_quarantine_purge.py (cleanup purge engine), copilot_model_benchmarks.py (menu p third-party comparison registry/parser) ~/.local/bin/ symlink (or copy with --copy); not commands
7 agent definitions ~/.copilot/agents/ symlink (or copy with --copy)
Orchestrator instructions ~/.copilot/copilot-instructions.md symlink (or copy with --copy)
Legacy pricing table (inactive) ~/.copilot/task-reports/model-pricing.json copied once, only if absent — your edits are never overwritten; no longer used by the report
Legacy company request-pricing policy (inactive) ~/.copilot/task-reports/request-pricing.json copied once, only if absent — your edits are never overwritten; no longer used by the report
Official pricing cache ~/.copilot/task-reports/official-pricing-cache.json created automatically at runtime (not by the installer) from docs.github.com; refreshed when older than 24h

Make sure ~/.local/bin is on your PATH. Any pre-existing file at an install destination is backed up (never deleted) before being replaced — see scripts/install.sh --help. The installer refuses to run while an unfinished uninstall is pending (see Uninstall / update).

Symlink mode and your checkout are linked. By default every installed file (except the copied pricing configs) is a symlink pointing back into this repo checkout. That's what makes git pull / scripts/update.sh instantly update the live tools — but it also means moving or deleting this checkout breaks the installed commands (copilot-s will fail with a "No such file or directory" style error, since the symlink now points nowhere). If you need to relocate the checkout, either re-run scripts/install.sh from the new location (it will re-link everything in place), or install with --copy up front if you'd rather have self-contained copies that don't depend on the checkout's location at all (at the cost of no longer auto-updating on git pull).

Usage

copilot-s                     # list sessions relevant to the current directory
copilot-s --all               # list sessions across all directories
copilot-s --report ABC-123    # print/regenerate the cumulative usage report for a task
copilot-s --task ABC-123      # alias for --report (kept for convenience; --report is
                               # the canonical/documented flag name for this toolkit)
copilot-s --help               # show usage/features and exit (safe: never launches copilot)
copilot-s --version | -v       # print the copilot-s version and exit (safe: never launches copilot)
copilot-s --session-report ID  # read-only per-launch report for a session (never launches copilot)

From the session list you can resume, rename, or delete sessions (single/range/multi-select). On exiting a copilot session you'll be prompted to keep, rename, or delete it.

Local and all-directory lists hide sessions whose recorded working directory is ~/.copilot or a subdirectory. The filter uses the plain or quoted cwd in workspace.yaml, not the list location set by menu m. It resolves symlink aliases and can recognize paths that no longer exist. An unknown working directory leaves the session visible. The filter does not remove session data or index entries.

New sessions prompt for a name and pass it to Copilot's native --name option, so it applies during the session, not just after exit. Blank input keeps automatic naming; prompted names are trimmed and pipes become spaces in both the launched native name and the wrapper's index. Caller --name/-n or session-selection options skip this prompt. This requires a Copilot CLI version supporting --name (verified with 1.0.109). Exit-menu renaming remains a wrapper index alias. Wrapper options are recognized only before -- and outside known native value operands. The -- marker and everything after it pass through unchanged; enforced model options and any prompted name go before it.

Changing where a session appears

Choose m in the session menu, select one displayed session, and enter an existing destination directory. Use an absolute or relative path, or ~ / ~/… for your home directory. Enter spaces literally, without quotes; pipes and control characters are not supported. Check the old and new list locations, then type exactly yes to apply the change. Enter or any other confirmation cancels.

The session will appear in the destination's copilot-s list when your shell's $PWD matches that path exactly. Symlink spellings are kept, so use the same path to enter the directory. To change it back, use m again from the destination or from copilot-s --all. If the move leaves the local list empty, choose a explicitly to enter the all-sessions view and its wider cleanup scope, or start a new session or quit.

This only updates the copilot-s index. Nothing moves: Copilot's recorded working directory, files, and conversation stay the same. Directory-scoped empty-session cleanup still uses the recorded working directory, not the list location. Deleting the session still removes the actual session and its history, not just its list entry.

Cleaning up empty sessions (recoverable)

Menu option c) Clean up empty sessions (recoverable) previews, then — only after you type exactly yes (anything else, Enter, or EOF cancels) — moves empty sessions into a private quarantine batch, ~/.copilot-s-quarantine/<batch>/sessions/<id>/. Nothing is deleted or copied: each directory is moved with an atomic no-replace rename on the same filesystem (a different filesystem, or a system without macOS renameatx_np/Linux renameat2, is refused), and manifest.json in the batch records every step, including the session-list rows before they are removed.

  • Scope: sessions whose recorded workspace.yaml working directory exactly matches the current directory, or every directory when the list is showing all sessions (--all/a). List locations set by m do not affect cleanup scope.
  • Eligible only if all hold: the directory is an exact UUID and contains only a regular workspace.yaml — alone, or together with the complete, untouched empty scaffold some Copilot CLI versions create for a never-used session: an empty .workspace-fork.lock, empty files/ and research/ directories, and checkpoints/ holding only an index.md that is exactly the empty "Checkpoint History" table header. A partial scaffold, any symlink or hard-linked file, foreign owner, extra entry, non-empty lock, checkpoint row, or any events.jsonl/session.db/other file (even empty) excludes it. The metadata is plain scalars with user_named: false, no native name/summary, and updated_at within 1s of created_at; it was created, and it and every scaffold item last modified on disk, more than 24h ago; it has no custom name in ~/.copilot-sessions; its ID is not in the current environment; and lsof (macOS/Linux) positively reports that neither the directory nor any of its files/directories (including the lock) is open. If any check is unavailable or fails, the session is kept.
  • Recent empty sessions (opt-in, default No): before the preview, menu c asks Also include recent empty sessions (created or changed within the last 24h)? [y/N]. Only y/yes opts in; Enter or anything else keeps the 24h minimum age. Opting in removes only the minimum age: timestamps must still be valid, updated_at within 1s of created_at, and no timestamp may be in the future; every other check above is unchanged. The helper equivalent is --include-recent, which must be passed to both preview and apply (apply refuses the whole request if the previewed candidates were produced with a different choice). A recent empty session may have been created moments ago — by a Copilot that is still starting, or by something else; its origin is not known — and could start being used right after the open-file check. That race is accepted because the session is only moved to quarantine and can be restored; the separate exact yes confirmation is still required.
  • The preview lists each candidate with counts of kept sessions by reason. Before each move the session is re-validated and compared with the preview fingerprint (which covers workspace.yaml and every scaffold item); changed sessions are skipped, a session that changes during the move is moved back, and nothing beyond the preview is ever moved. Only moved IDs are removed from ~/.copilot-sessions.
  • copilot-s and the cleanup share a lock on ~/.copilot-sessions.lock; while another process holds it, the session list is left unchanged (and a delete is cancelled) rather than rewritten without the lock.

Restore a batch (asks for yes; refuses ID collisions and changed quarantined contents; re-adds a recorded session-list row only if missing; moves under the session-list lock; refuses any batch whose permanent purge was started):

copilot-session-cleanup.py list
copilot-session-cleanup.py restore --batch 20261113-184600-1a2b3c4d

Limitations: Copilot's own session history/index (for example session-store.db) is never read or modified, so native history views may still list quarantined sessions; the activity check narrows but cannot eliminate a race with a Copilot process starting at the same moment. Quarantine is never purged automatically — purge a batch explicitly (menu x, see Permanently purging a quarantine batch) once you are sure you do not need it.

Cleaning run reports (menu r, recoverable)

Menu option r) Clean run reports (recoverable) — in the session list and in the "No saved sessions found" menu, so old reports can be managed even without saved sessions — opens a small submenu:

  1. Preview, then quarantine. First asks Also include run reports finalized within the last 24h? [y/N] (default No), then runs the read-only copilot-report-cleanup.py preview. Only after you type exactly yes are the exact previewed runs (run id + fingerprint, same recent-runs choice) passed to apply.
  2. List quarantine batches (read-only).
  3. Restore a quarantine batch: pick a batch, read the read-only restore plan, type exactly yes.
  4. Permanently purge ONE quarantine batch (frees disk space; IRREVERSIBLE) — see Permanently purging a quarantine batch. Listed in the submenu but deliberately not in its short Choose [...] prompt.

Enter/b returns to the session menu. Cancelling, a helper failure or a success always returns to the menu — Copilot is never launched from here. The helper is found next to copilot-s (falling back to ~/.local/bin/copilot-report-cleanup.py); override it with COPILOT_REPORT_CLEANUP_HELPER.

  • Scope — all workspaces: every per-launch run report under ~/.copilot/session-reports/runs/<run-id>/ (run records do not store the working directory, so there is no current-directory filter), each moved as a whole folder: run.json and the private raw/ folder (Copilot's usage file).
  • Never touched: Copilot's session-state, logs and OTEL files (paths recorded inside run.json are never used), any other folder below ~/.copilot, run records of an unsupported mode, and reports under a custom COPILOT_SESSION_REPORTS_DIR (preview/apply refuse to run while it points elsewhere than the default root). Each launch is handled on its own; other launches and resumes of the same session are never touched.
  • Eligible only if all hold (fail closed): a finalized launch — completed, copilot-error or interrupted — whose record has schema copilot-s.session-run with integer schema_version 1, the folder's run id, mode normal, a known launch kind, a state/outcome/state-reason consistent with an integer exit code, and valid, ordered created_at ≤ launched_at ≤ ended_at ≤ finalized_at; finalized and every file last changed more than 24h ago (the opt-in only waives this minimum age; nothing may be in the future); plain private files and folders only (no symlink, hard link, FIFO/socket/device, foreign owner, group/world-writable entry or other filesystem; bounded size and depth); the run id is not in the current environment; and a system lsof (macOS/Linux) positively reports that nothing has the run folder or any file/folder inside it open. Incomplete (active), report-failure, unknown, unsupported-mode or malformed runs are always kept, whatever their age. The preview shows kept runs counted by reason; at most 100 runs per batch.
  • Moves, never deletes: after re-validating each run under its locks (fingerprint must still match the preview), its run folder is moved with an atomic no-replace rename on the same filesystem into ~/.copilot/copilot-s-report-quarantine/<batch>/ (runs/, manifest.json; 0700). The manifest records every step durably, so a crash part-way is recoverable with restore. No disk space is freed by the quarantine — the data stays on disk until you purge that batch explicitly (submenu 4); nothing is ever purged automatically.
  • Coordination with the report producer: cleanup and restore take the quarantine's own transaction lock, then each run's own lock (in that order), so finish and mark-outcome can never write into a moved run folder. Preview and list create no files, folders or locks.
  • Moved launches disappear from reports (copilot-s --session-report, compare) until restored.
  • Batches from earlier versions restore and purge as before when they hold only normal-mode runs (their extra, empty publications/ folder is accepted and purged with the batch). A batch whose manifest records a run of an unsupported mode, or whose extra folder is not empty, is refused as a whole — never partially restored or purged — and left untouched.

Command-line equivalent:

copilot-report-cleanup.py preview [--include-recent]        # read-only
copilot-report-cleanup.py list                              # read-only
copilot-report-cleanup.py restore --batch <batch>           # read-only plan
copilot-report-cleanup.py restore --batch <batch> --yes     # restore

apply reads the preview's CANDIDATE lines on stdin exactly as printed (CANDIDATE<TAB><run-id><TAB><fingerprint>[<TAB>include-recent]; no other format is accepted — the menu forwards them unmodified). Restore never overwrites or merges: it refuses a run whose id already exists at the original place and any quarantined data whose fingerprint changed.

Permanently purging a quarantine batch (menu x and r → 4, irreversible)

Quarantine (menus c and r) never frees disk space. To release it, purge one quarantine batch at a time, explicitly:

  • Quarantined empty sessions: menu x) Permanently purge a quarantined-session batch (irreversible) — in the session list and in the "No saved sessions found" menu (listed there but not in the short prompt).
  • Quarantined run reports: submenu r → 4.

Each lists the batches with their purge status (read-only purge-list), lets you pick one by number (Enter cancels), then runs the helper's interactive purge, which first prints the exact inventory (each session / run report with its file and folder counts and allocated size, plus the batch's own manifest and folders), the total, the estimated reclaimable space and a snapshot id. It deletes only after you type, on the terminal, exactly the phrase it shows:

PURGE sessions 20261113-184600-1a2b3c4d 3f9a1c2b7e4d      # or: PURGE reports ...

Anything else, Enter alone, or no answer within 120 seconds cancels; typed-ahead input is discarded; there is no yes/--force bypass and purge refuses to run without a real terminal. No lock is held while it waits for you. Afterwards it takes the quarantine's existing lock, rebuilds the whole plan and deletes only if the snapshot is identical to the one you confirmed.

  • Eligible batches only (fail closed): no purge was ever started for the batch; its manifest is valid and fully settled — every entry moved or skipped, at least one moved (batches still being applied or restored, partly restored, failed, pending or with an unfinished session-list update are refused); every moved session / run folder is present and still matches the fingerprint recorded when it was quarantined (the same checks restore uses), skipped entries left nothing in the batch, and nothing else is in it; every file and folder is plain, yours, single-link, not group/world-writable, without setuid/setgid/sticky bits or immutable/append-only flags, on the batch's own mount (macOS: fstatfs mount identity; Linux: mnt_id plus no mount point at or inside the batch in /proc/self/mountinfo — bind mounts included), within 20,000 entries and 24 levels; and a system lsof positively reports that nothing has any of it open. Unknown is refused.
  • Estimate, not a promise: the reclaimable space is the sum of every entry's allocated blocks (st_blocks × 512). APFS clones and snapshots (including Time Machine local snapshots), files still open elsewhere, compression and filesystem metadata can make the real figure differ. Deletion is not secure erasure.
  • How it deletes: before the first deletion it durably writes a compact journal <quarantine>/.purge/<batch>.json (started), then removes only the inventoried entries, bottom-up, each relative to its parent folder's descriptor after re-checking (without following symlinks) that the entry and every parent folder are still exactly the confirmed ones: payload first, then the manifest, then the batch folder. It never lists new targets, never changes permissions and never uses a recursive delete. The journal then says complete and is kept.
  • Partial purges: the first discrepancy, I/O error, time limit (5 min) or Ctrl-C stops it; the journal says partial (or stays started after a crash) and the output reports what is left. A batch with any journal can no longer be restored and is never purged or retried automatically — list/purge-list mark it; review what is left yourself.
  • Locks: sessions use the existing session-list lock (~/.copilot-sessions.lock), which restore now also holds while moving; run reports use the quarantine's .transaction.lock, which apply and restore hold for their whole run. A purge never opens or creates anything at the live session or report locations.
  • Limitations: macOS and Linux only; a hostile process running as you that swaps a file between the final check and the unlink cannot be ruled out portably (the copilot-s tools are excluded by the locks, everything else must be quiescent, checked with lsof); Linux chattr +i and ACLs denying deletion are not inspected and would stop the purge part-way.

Command-line equivalents (path options for the session helper go before the subcommand, as for its other commands):

copilot-session-cleanup.py purge-list                      # read-only
copilot-session-cleanup.py purge-preview --batch <batch>   # read-only
copilot-session-cleanup.py purge --batch <batch> [--snapshot <digest>]
copilot-report-cleanup.py  purge-list | purge-preview --batch <batch> | purge --batch <batch>

purge-preview prints PURGE_SNAPSHOT<TAB><kind><TAB><batch><TAB><digest> (or PURGE_INELIGIBLE<TAB><batch>, exit 1); passing that digest to purge --snapshot makes it refuse unless the batch is still exactly what you previewed. purge-list prints one PURGEABLE<TAB><batch> line per candidate. Exit status of purge: 0 purged or cancelled, 1 refused, error or partial, 130 interrupted.

Refreshing subagent models from current prices (menu p)

Menu option p) Refresh subagent models from current prices (also offered when there are no saved sessions — there, Enter still starts a new session and p returns to that menu instead of launching anything) runs copilot-model-refresh.py propose --review --draft in the balanced policy (the default): it fetches the model list, prices and comparisons, then shows ONE numbered draft mapping table of every route — a draft is only a proposal; nothing is selected or applied until you accept rows and then type yes. Why (short) shows the benchmark, model scores (up to four decimal places), reasoning effort and direction (including ties) for counted comparisons with offered, blocked, and other considered candidates, whether the row has a draft or is kept. It also labels exact-effort Terminal-Bench 4.1 leaderboard comparisons as context only, including their source and result dates; they never influence a route's recommendation. For an offered, blocked cheaper, or otherwise considered pair with no counted result, it can also show one bundled comparison with both scores, the measured effort, evaluator, source and original publication date. For example, the Sonnet 5.5 / GPT-6.1 Terra Terminal-Bench 4.0 comparison was evaluated by OpenAI and is vendor-reported via MultiAI: context only, not counted or a test-review benchmark. Bundled citations are never refreshed and do not affect recommendations. d shows full sources and context. If local task reports exist, the draft also shows cumulative recorded estimates and explicitly attributed call coverage by agent. This is not a bill or forecast: reports may overlap, legacy/unknown calls cannot be attributed, and unpriced calls make totals incomplete. It does not influence the recommendation or leave the machine. Only reconciled local reports are included; unreadable, malformed, linked or oversized files are skipped and counted. The directory scan is bounded to its first 1,000 entries in filesystem order (additional entries are not counted); reads are capped at 32 MB per report and 256 MB total. These aggregate records are not deduplicated across tasks. The flow is: fetch → draft table → accept all / some rows, keep rows, or repropose rows (as often as you like, on the same rows) → check only the accepted models in /model → final yes → the subagent models are updated. The legacy cost-led policy (the cheapest eligible saving of at least 10% proposed automatically, then numbered options, still applied only after yes) remains available with COPILOT_MODEL_REFRESH_POLICY=cost-led for p, or --cost-led on the helper.

  1. Current prices. It fetches the official models and pricing page now, through the same fixed-URL HTTPS fetcher, strict parser, validation, and cache as the usage reports (an explicit refresh skips the 24h TTL and the 1h failure backoff; a snapshot fetched under 5 min ago is reused). On failure (offline, parse error) the last valid snapshot is shown, but nothing is proposed unless it is under 24h old.

  2. Current capabilities. In the same run it fetches the official supported models page (model list, 1M-context / configurable-reasoning table, per-client table incl. Copilot CLI) and the model comparison ("Recommended models by task": task area, "Excels at"). Only those two fixed docs.github.com URLs are requested (HTTPS, certificate checks on, redirects refused, size/time bounded, no cookies or credentials; a verified system-curl fallback only after a Python certificate error). A strict, versioned parser turns them into a dated evidence snapshot (~/.copilot/model-refresh/capability-evidence.json, with URL, fetch time, content digest and parser version), reused for 5 min and usable for 3 days (supported models) / 7 days (comparison). A changed page layout, a missing column, conflicting rows or an unknown cell value becomes unknown with a warning — never a guess — and a failed fetch shows the last valid copy with its age; stale or unknown evidence never authorizes a change. Per model and field, fresh official evidence is used first and the dated catalog is the fallback. Disable the fetch with COPILOT_MODEL_REFRESH_DOCS_FETCH=0 (or --offline).

  3. Third-party comparisons (automatic, reference only). In the same run it also GETs a fixed, reviewed list of public comparison pages (registry in bin/copilot_model_benchmarks.py; initially BenchLeader and BenchLM pages for claude-sonnet-5.5 vs gpt-6.1-terra and gpt-6.1-sol vs gpt-6.2-sol, plus BenchLeader's FrontierCode 2.0 and Terminal-Bench 4.1 leaderboards, whose rows state each model's reasoning effort and result date). The Terminal-Bench leaderboard is reference only for every route. See Third-party comparisons below for what is fetched, how it is parsed, which results count for which route and its limits. Counted results can make an option visible (and draft it when it is the only one they favour); they never choose, gate or apply anything.

  4. Draft table first. The output starts with one line per source (official pricing, official docs, third-party pages, your availability record, any blocking warning) and then ONE compact numbered table of all eleven routes — the eight custom agents, coder.small_casual, reviewer.stronger and the built-in task route; the row number is the route's fixed position and never changes. Each row shows the current model + effort (long = long_context tier), the drafted change or keep, the blended $/1M change, a short basis, how many explicit alternatives exist (Opt) and the status (pinned, kept with the reason, draft, ACCEPTED, check /model when the model or level still has to be confirmed after you accept it). A short "why" line per drafted row and a legend follow. On a normal wide terminal (e.g. 140 columns) it is a column table whose price, basis and status cells wrap onto a second line when needed (model cells never wrap or get cut); only a terminal too narrow even for that shows one short block per row. Pinned and blocked routes stay in the table as kept. The draft per route is the first of (only among the route's offered options, so every gate below still applies):

    • Alignment — the same model back at the route's shipped effort/context (when they drifted);
    • Benchmark — the ONLY option that the counted third-party results favour: a benchmark relevant to the route's role, measured at this route's exact reasoning levels (stated by the source), both results dated within 90 days, each underlying run counted once — higher on at least one run and lower on none (reference only, never proof of quality; see which results count);
    • when no counted result separates the two models (true for most routes today: most pages are measured at other or unstated efforts, carry no result date, or measure another role's work, so they are context only): Documented, same price — an official documented differentiator at identical official rates (both tiers on long_context routes; no price is ever imputed; more differentiators first, then model ID), otherwise Savings (price only) — the cheapest option at least 10% cheaper on official rates, a price fact and never a quality claim.

    Options whose counted results favour the current model (adverse) or point both ways (mixed), several favoured options, and documented advantages at a different price are never drafted automatically — you reach them with o (labelled as tradeoffs; nothing is ever called best quality). At the prompt:

    • a accepts all draft changes; a 1,3 accepts only rows 1 and 3 and keeps the other draft rows unchanged (rows you accepted earlier stay accepted);
    • k 1,3 keeps those rows unchanged;
    • r 1,3 reproposes only rows 1 and 3 with their next ranked candidate never shown before and remembers them; r alone reproposes the same rows again. There is no cycling: when a row has no further ranked candidate it is kept and the table says so (o ROW still lists the other options with their tradeoffs);
    • o lists every route's alternatives as ROW.K (price, why offered, third-party summary, what is still to confirm), o 3 one row with its third-party sources, o 3.2 drafts that alternative for row 3 (still only a draft until you accept it);
    • d shows the full details view; q, Enter or Ctrl-D cancels (never an acceptance). A command that is not valid changes nothing and you are asked again.

    The longer per-option view below is what o and the details view show. (In the cost-led policy the overview instead lists the numbered options after the routes.) Each option shows current → option, the blended price change in $ and % (and above the long-context threshold), the exact official rates of both models (input, cached input, cache write, output; long-context tier rates), why it is offered, the third-party evidence for that exact pair (source, page date, fetch age, reasoning effort as stated by the page versus your route's level, each listed metric with both values, and a caution), and what is still to confirm. Then the third-party coverage with every source URL, the caution, and the next step. Colours are semantic (option numbers, savings vs higher prices, warnings, third-party blocks) but every line keeps its words; they appear only on a terminal and never with NO_COLOR set or TERM=dumb. Text wraps to your terminal width without cutting model IDs, prices or warnings. The screen is never cleared.

  5. Options and selection. In the balanced policy a route's options are the models that pass every gate below (except the 10% rule) and are in the route's accepted official task area, and either are at least 10% cheaper (all of them, not only the cheapest) or, if not, have a concrete documented official differentiator versus the current model (e.g. listed as included for Copilot CLI in the official per-client table when the current model is not) or counted third-party results for that exact pair on that route that favour it — a benchmark that measures the route's role, measured at this route's reasoning levels (the source must state both models' effort and it must equal the route's level for the current model and the option), both results dated within 90 days, each underlying run counted once, at least one higher for the option and none lower (the same verdict the draft uses, so offer and draft agree; a cheaper option is never "backed" by a cherry-picked metric). Scores at an unstated or different effort (e.g. BenchLeader's max columns for a low/high route, or BenchLM, which states no effort), without a result date, for another role's work, or from bundled citations are shown as context only and never make an option visible. A higher Category, a newer version or a higher price alone is never a reason; such models are listed as "considered" in the details view. When an unpinned route's current effort/context differs from its shipped baseline (for example after a toolkit update changed the baseline level under an existing override), the overview shows a drift line, and when the current model passes every gate at the baseline values a same-model alignment option corrects it (selected, checked and confirmed like any other option). Nothing is preselected and no quality recommendation is implied (the draft table's ranking above only decides which option is drafted first). In the cost-led policy you type option numbers (at most one per route), d for the details view, or Enter for none. Pinned routes and routes with an unknown current price get no options.

  6. Details view (optional). d at the prompt, copilot-model-refresh.py details [--proposal-id ID] or propose/preview --details prints the full report: for each route the reason and evidence for every keep/change decision, every cheaper candidate that was not eligible and why, every same-task-area model considered, the official rates table, the snapshot id and cache age, every option in full, every parsed third-party metric (including non-comparable ones) with provenance, and All models in view — the union of the official pricing, the official capability pages, the catalog, your verified records and the current routes, including unpriced or undocumented ones as unknown — are listed with price, task area, 1M context, configurable reasoning, Copilot CLI support, where each fact comes from, and your availability (verified / not verified / not in your complete /model list). This is not your account's model list: Copilot CLI documents no programmatic per-account listing, so availability is only what you verified. A model missing from the static catalog (for example GPT-6.2 Sol when the official pages list it) is assessed from the current official pages when they document its task area, Category, capabilities and CLI support; otherwise it is listed as unassessed and never assigned. Models new since your last refresh are flagged. details reads cached copies only: no network request, no lock, nothing written, the pending proposal untouched (with --proposal-id it uses that proposal's sealed policy, answers and selection read-only and says whether its numbers still match).

  7. Check YOUR accepted models in /model. copilot-s runs the helper in review mode: an option blocked only by availability or an exact reasoning level you have not verified is still offered (and may be drafted), marked "check /model" / "still to confirm" (every other gate below still applies) — and you are asked about it only once you accept its row (cost-led: select it). After you accept the table it lists each accepted (or, in the cost-led policy, proposed/selected) model once — its route(s), the exact reasoning level(s) it needs, blended price and why — and asks "Are all these proposed models available in /model? [y/N]". On No you type only the unavailable IDs from that list (spaces/commas; anything else is re-asked; Enter or EOF cancels — availability is never assumed); the others count as available. For a needed level that no saved or source-backed record covers, it asks y/N for that exact model and level (No = that model is not used where the level is needed; never downgraded). The helper then recomputes the mapping from the same frozen prices and evidence (an unavailable model is excluded for the rest of that run, even if an older record lists it). In the draft table, ONLY the rows using a model you ruled out (or a level you said is not offered) are re-drafted with their next ranked candidate (or kept when none is left), marked revised, and the table is shown again so you accept them again before they are checked; every other row — drafted, kept or accepted — and every answer you gave stays as it was. (Cost-led: if an answer removes one of your selections, the renumbered options are offered again, at most three selection rounds.) Your answers live only inside the sealed proposal for that run — never in verified-models.json, user-config.json or any routing file — and a tentative proposal can never be applied. To save a /model record for later runs instead, run copilot-model-refresh.py record-verified (interactive; saved to ~/.copilot/model-refresh/verified-models.json, dated, valid 30 days, only after you type yes).

  8. Confirm. Only an accepted, fully checked table is offered: the final view shows the accepted table and the effective routing IF you type yes. Changes are applied only after you type exactly yes; e returns to the table to edit it (withdraw a row with k, repropose with r, accept again), anything else, Enter, or EOF cancels. The proposal is frozen with digests of everything it read plus an evidence digest (including the policy and the third-party comparison cache and registry) and the sealed draft table (each row's decision, drafted model/effort/context, basis, every candidate already shown, the remembered rows, the phase and the ranking version); apply (and select/review/draft) re-derive every decision from the cached evidence — never re-fetching — and refuse, changing nothing, if settings.json, the refresh state, your user config or verified record, the routing defaults, the catalog, the capability evidence or third-party comparisons (or their freshness), the pricing snapshot or the generated files changed in between (the digests cover the parsed prices and capability values themselves), if the proposal is older than 15 min (measured from its real creation; a future-dated or extended proposal is refused), was altered (proposals are sealed with a private key in ~/.copilot/model-refresh/.proposal-key), was made by an older version, was already applied, or — for a draft — has a row that is not accepted yet, an accepted model still to check, or a draft row that does not match the re-derivation. Every outcome — applied, cancelled, no changes, failed — prints the final effective routing (after a failure via status; if even that cannot read its inputs, an explicit "unavailable" message instead of a guessed table) and waits for Enter before returning to the menu.

Which models can be offered (categorical fit, not a quality score). The facts are the official pricing page's Category (Lightweight / Versatile / Powerful), the model comparison's Task area, the supported-models page's 1M-context and configurable-reasoning support, and its per-client Copilot CLI column — read live as above, with config/model-role-catalog.json (a small, dated registry transcribed from the same pages; reviewed 2026-11-16, expires 2027-02-14) as the fallback when a page is unavailable or stale. A live value that differs from the shipped catalog is shown as a change; one that contradicts your local overlay blocks that model until you re-vet it. The shipped routes stay the baseline. A model can be offered (balanced) or proposed (cost-led) for a route only when the route is not pinned and the model:

  • has the same official task area as the route's shipped baseline model and a Category at least as high, configurable reasoning, 1M-context support if the route uses long_context, and is listed as included for Copilot CLI;
  • when any of its facts come from the catalog: still shows the catalogued Category in the live pricing (otherwise it needs re-review) and the catalog entry has not expired;
  • is in your verified availability list (user-config.json and/or the list recorded with record-verified) or you confirmed it in this p run's review — Copilot CLI documents no programmatic model catalog, so availability under your plan and organization policy is never assumed from the pricing or supported-models pages;
  • has the route's specific reasoning level (e.g. high, xhigh) verified for that model — either a source-backed reasoning_levels entry in the catalog, your own dated record (verified_capabilities or levels recorded with record-verified), or your y/N for that exact level in this p run's review. The official docs only say reasoning is "configurable" and that levels vary per model (Copilot CLI shows them only in the interactive /model picker), so the shipped catalog lists no levels and an unknown level always blocks the replacement; and
  • in the cost-led policy, is at least 10% cheaper under a disclosed blended workload assumption (15% input, 75% cached input, 5% cache write, 5% output of the Default-tier rates — and, for long_context routes, also of the rates billed above the long-context threshold); in the balanced policy that same rule marks a "saving" option, and a not-cheaper option needs an official differentiator or a third-party comparison as above. A current model that is unpriced (shipped default or override alike) is always kept and gets no options: no price impact can be shown.

The effort and context tier stay those of the route baseline. Nothing is inferred from price or release date; unknown, unavailable, unverified, stale, or unpriced always means keep with the reason shown — including for an existing managed override whose evidence can no longer be re-verified (it is kept, never silently reverted; returning to the shipped default is a change that must pass the same availability, reasoning-level and catalog gates; reset returns it unconditionally). All dates you or a catalog enter (reviewed_on, retrieved_on, expires_on, verified_on) are compared with your local calendar date. A catalog (shipped or local) whose review or any source retrieved_on date lies in the future, whose sources postdate its review, or whose expires_on is not after reviewed_on cannot authorize any replacement. The details report states, before the routes, that fit is categorical and not measured quality, and no option or change claims equal quality. When replacements are blocked only by availability or reasoning levels you have not verified (always the case on a first run of the non-review CLI propose), the overview ends with an ACTION REQUIRED block naming the blocked candidates and a ready-to-edit user-config.json example (menu p asks about your selected models instead).

Your user config — ~/.copilot/model-refresh/user-config.json (never written by the tool; all keys optional):

{
  "schema_version": 1,
  "available_models": {"verified_on": "2026-11-16", "models": ["gpt-6.1-terra", "claude-sonnet-5.5"]},
  "verified_capabilities": {"verified_on": "2026-11-16", "models": {"gpt-6.1-terra": {"reasoning_levels": ["low", "medium", "high"]}}},
  "pins": {"reviewer.stronger": {"model": "claude-opus-5.5"}},
  "catalog": {
    "reviewed_on": "2026-11-16", "expires_on": "2027-02-14",
    "sources": {"my-review": {"url": "https://example.com/my-review", "retrieved_on": "2026-11-16"}},
    "routes": {"coder": {"accepted_task_areas": ["Complex coding tasks", "Interactive and agentic coding"]}},
    "models": {}
  }
}

available_models older than 30 days blocks replacements until you re-verify it. verified_capabilities (same 30-day limit) records, per model, only the reasoning levels you have seen offered for it in Copilot CLI's /model picker — the example values above are illustrative, not verified facts. pins (route keys: the agent names plus coder.small_casual, reviewer.stronger, task) hold any of model / reasoning_effort / context_tier. catalog is an optional dated local overlay with the same schema as config/model-role-catalog.json (its model entries and route policies take precedence) — this is how you vet a new model.

What applying writes (and never writes). Shipped defaults — config/agent-routing.yaml, agents/*.agent.md, and the instructions — are never edited, and the copilot launch still forces Auto with the Balance tier for the main session. Effective routing is resolved as shipped defaults → managed overrides → your pins (native /subagents values in ~/.copilot/settings.json that this tool did not write, then pins in the user config). One journaled transaction (backups under ~/.copilot/model-refresh/backups/, rolled back on failure, recovered on the next run after a crash, Ctrl-C deferred while it commits) updates:

  • ~/.copilot/settings.json → subagents.agents.<agent>.{model, effortLevel, contextTier} for agent default routes with a managed override or a user-config.json pin (each field gets the effective value, so a tool-written value never contradicts a later user-config pin). Values you set yourself in /subagents are never overwritten, and values the tool wrote earlier are removed again when no longer needed. Other settings are preserved, but the file is re-serialized as 2-space JSON; a non-JSON or symlinked settings.json is never written.
  • ~/.copilot/instructions/copilot-toolkit-model-routing.instructions.md — a generated personal instruction holding only the effective table (validated model IDs, efforts, tiers, OMIT; no prices or remote text). It exists only while a managed override or a user-config pin exists — native /subagents values alone never create it, and reset removes it when only those remain. A field you set in /subagents is written as OMIT, never as a frozen copy of its value. A symlinked instructions/ directory, or a file there that the tool did not write, is never written through or replaced.
  • ~/.copilot/model-refresh/state.json and effective-routing.json (same lifetime as the generated instruction; /subagents fields are null).

How the orchestrator uses it. The shipped orchestrator instructions tell it to run copilot-model-refresh.py status --instructions before each delegation to a toolkit route. That command is local and read-only (no network, pricing, or catalog) and reads settings.json live, so a /subagents change is honored on the next delegation without running p:

discovery            model=gpt-6-luna reasoning_effort=low context_tier=long_context
coder                model=OMIT reasoning_effort=medium context_tier=default

OMIT means the field is left out of the task call so your live /subagents value applies (the task tool has no inherit value). If the command is unavailable or reports the routing unavailable (for example an unreadable settings.json or a pending interrupted apply), the generated table — same OMIT rule — or else the shipped defaults apply.

Limits. Copilot CLI 1.0.112 documents the per-agent subagents.agents settings but not their precedence over explicit task-tool parameters, and one per-agent value cannot express the small/casual coder or stronger reviewer contexts. Omitting a field is the only way to leave a native value in effect; the routing above is instruction guidance the orchestrator follows, not a hard guarantee. New sessions load the generated instruction (check with copilot instruction list). settings.json can also be rewritten by Copilot itself; the tool re-checks its digest right before replacing it, which narrows but cannot eliminate that race. copilot-model-refresh.py status shows the effective routing without any network or writes (and reports it as unavailable rather than guessing when settings.json cannot be read); copilot-model-refresh.py reset --yes removes every managed override and only the /subagents values the tool wrote (your pins stay). An interrupted apply is rolled back on the next run only when its journal is fully valid (known targets, backups inside the tool's own backups folder that still match); otherwise nothing is restored or deleted and the output explains how to recover by hand.

Evidence limits, privacy. The official pages say whether a model has configurable reasoning, not which levels; which models and levels YOU can use is visible only in Copilot CLI's interactive /model picker (no documented programmatic listing), so availability and levels are never claimed automatically — only from what you record or answer in a p review (that run only). Fit is categorical: no output claims measured, equal or better quality, and the blended price impact is an assumption, not your bill. The capability fetch sends only a plain GET for the two fixed public URLs (no credentials, cookies, model usage or local data); remote text is sanitized, shown only in the terminal, and never written into the generated instruction or settings. Scripted use: copilot-model-refresh.py propose (balanced unless --cost-led; --details appends the full report; --offline uses cached copies only) prints machine lines PROPOSAL<TAB>id, ALTERNATIVE<TAB>n<TAB>route<TAB>model and VERIFY<TAB>needed; propose --review instead adds CHECK<TAB>model<TAB>routes, LEVEL<TAB>model<TAB>effort, REVIEW<TAB>pending|complete and SELECTED<TAB>count, and review --proposal-id ID (--available-all | --unavailable IDS) [--level MODEL:EFFORT=yes|no ...] answers them (a proposal with anything pending is never applicable); propose --review --draft (balanced only) prints the draft table with DRAFT<TAB>choose|verify|final|none<TAB>open<TAB>accepted instead of ALTERNATIVE lines, and draft --proposal-id ID --do 'a 1,3' (also a, k ROWS, r [ROWS], o [ROW[.K]], e) changes it (new id; exit 5 = command not accepted, nothing changed), with review/apply as above; select --proposal-id ID --choose 1,2 chooses options (it replaces any earlier selection of that proposal; new id); details [--proposal-id ID] [--cost-led] is the read-only full report; record-verified is interactive and refuses to run without a terminal. Machine lines are never coloured. Colour is on only when stdout is a terminal, or with COPILOT_MODEL_REFRESH_COLOR=always (what copilot-s sets after checking its own terminal, together with COLUMNS, because it captures the helper's output); NO_COLOR (any value) or TERM=dumb always disables it, and output to a pipe without COLUMNS is not wrapped. A balanced proposal with nothing selected exits 3 (no changes) and still prints a PROPOSAL id so options can be selected.

Third-party comparisons in menu p

  • What is fetched. Only the exact HTTPS URLs listed in bin/copilot_model_benchmarks.py: one reviewed comparison page per provider and model pair (PAIRS; the BenchLeader pages via their published .md alternate, BenchLM via Accept: text/markdown) and two reviewed leaderboard pages (BOARDS: BenchLeader's FrontierCode 2.0 (AA) and Terminal-Bench 4.1 (AA) boards, which state each model's reasoning effort and the date of each result; the Terminal board is always reference only). No URL is built from your input, settings, models or remote content, and no generic URL can be added from the command line. The GET happens automatically whenever p (or propose/preview without --offline) runs; no cookies, credentials, query string, model usage or local data are sent beyond the request itself (a fixed User-Agent and Accept header). Like any web request, the sites (and their CDN) see your IP address and the request time.

  • Transport. The host must be the provider's fixed host; it is resolved once and every resolved address must be a public IP (no loopback/private/link-local/reserved target, even through DNS), the connection is pinned to that address, TLS certificate verification is on (a verified system-curl fallback, pinned with --resolve, only after a Python certificate error), redirects are refused, only HTTP 200 with a text/markdown/text/plain body is accepted, each request has an 8 s timeout, all of them share a 20 s deadline and each body is capped at 1 MB. Standard library only.

  • Parsing. One strict, versioned parser per page layout verifies the page identity (canonical URL, a title naming exactly the two expected models, the column headers) and reads the publisher's "updated" date and only an allowlisted set of metrics (Terminal-Bench variants, FrontierCode 2.0, SWE Atlas v1.1, and each aggregator's own coding/agentic category scores, labelled as the aggregator's own scale) with numeric sanity checks (0–100, expected unit). Missing values (–, "Coming soon"), duplicated rows, unknown values and unknown layouts are unknown, never guessed; a changed layout makes that page unusable with the error shown. A value BenchLeader marks as measured at another effort setting, or a score BenchLM marks as estimated, is shown but not comparable. The BenchLeader comparison allowlist also reads the separate SWE Atlas v1.1: Test Writing row (Scale AI SEAL). The leaderboard parser checks the canonical URL, the exact title and the exact "Published by" line (Artificial Analysis) and reads, for the five registered models only (claude-sonnet-5.5, claude-opus-5.5, gpt-6.1-terra, gpt-6.1-sol, gpt-6.2-sol), each row's model, stated effort (from the row's own link and label), score and result publication date; a registered model's row in any other shape, a repeated model/effort row or an invalid value or date is unknown — a malformed row makes the model/effort it names unknown even when another, well-formed row exists for it (and every result of that model when its effort cannot be identified); rows about other models have no effect. Only the rows the page shows (its top 60) are seen, and an option is shown as compared only when BOTH models have a usable row at the route's exact levels (a missing row is named as missing). Reasoning effort is recorded only where the page states it per column (BenchLeader: e.g. max); BenchLM states none, so it is "unknown". The route's own level is shown next to it, and a mismatch is labelled ("setup differs"). Remote free text is never stored or shown: labels come from the allowlist, names from the registry, values are numbers (all remote and error text is stripped of control, ANSI and bidi characters).

  • Cache and freshness. ~/.copilot/model-refresh/benchmark-evidence.json (0600; URL, fetch time, page date, content SHA-256, parser version and layout per page). A page fetched under 5 min ago is reused; a copy is fresh for 24 h (local policy) — older copies are shown in the details view as reference only and never make an option visible. A failed fetch keeps the last valid copy and shows the error. A cache written for another parser or registry version is ignored. Fresh is about when the copy was retrieved; how old a result is comes only from the result date the source states for it (a page's own "updated" date — which BenchLeader renews daily — is never used as a result date, and a re-fetch never makes an old result look new).

  • Which results count (policy v2). Only counted results can make an option visible (basis "benchmark") or draft it; everything else is shown as context with the reason. A result counts for a route only when all of these hold:

    1. the copy is fresh (retrieved < 24 h ago);

    2. it is a named benchmark that measures the route's role (aggregator composite scores never count — they mix many benchmarks, re-count the same runs and are not role-specific):

      Benchmark family Counts for Measures
      FrontierCode 2.0 coder, coder.small_casual, intermediate-coder, senior-coder agentic code changes in real repositories, graded on whether a maintainer would merge them
      SWE Atlas v1.1 (overall) coder, coder.small_casual, intermediate-coder, senior-coder real-codebase Q&A, test writing and refactoring combined
      SWE Atlas v1.1: Test Writing tester writing tests for existing code — not test-coverage review
      Terminal-Bench (comparison pages only) task agentic terminal tasks across many domains; the Terminal-Bench 4.1 leaderboard is context only for every route

      No reviewed source measures code review (reviewer, reviewer.stronger), test-coverage review (test-reviewer), planning (planner) or read-only discovery (discovery): for those routes every score is context only and the output says so (for test-reviewer explicitly: test-writing and terminal scores are not test-review benchmarks);

    3. both values exist on the same row of the same source (same benchmark version), not estimated, duplicated or measured at another effort, and the source names who ran it;

    4. the source states both models' reasoning effort and it equals the route's levels (current model and option);

    5. both results carry a stated result date that is not in the future and at most 90 days old (a conservative policy: older or undated results are context only — so today only the FrontierCode leaderboard, whose rows carry result dates, can count; the comparison pages state no result date).

    The same underlying run republished by several sources (e.g. Artificial Analysis' FrontierCode 2.0 on the comparison page and on the leaderboard) counts once; if any fresh source — even an undated, context-only row — states a different value for the same run, model and reasoning effort, nothing about that run at that effort counts (disclosed; such a row can only refute, never qualify, a result). The verdict over the counted runs is favours (at least one higher for the option, none lower — the only case that offers/drafts it), adverse, mixed (both shown as tradeoffs) or none. Every option, and every candidate that was considered but not offered (details view), shows the "counted:" line first, then each source with provenance, page date, fetch age, the measured setup (evaluator, harness, attempts, judge where known), each score in the direction current → option with its result dates and whether it counted or why it is context only.

  • Bundled citations (never counted). RESEARCH in the module holds a tiny reviewed list of citations that cannot be fetched safely as structured data. They are shown next to their exact model pair with their publication date and age (never renewed), the date they were reviewed, the evaluator and whether it is independent, and the stated setup — and they never count. Today: MultiAI (27 Oct 2026) quoting OpenAI's launch charts — Terminal-Bench 4.0 at high: Claude Sonnet 5.5 43.0%, GPT-6.1 Terra 41.8% — vendor-reported by OpenAI (which also ran the competitor), secondhand, harness not stated.

  • What this can realistically suggest today. The verified, counted evidence is Artificial Analysis' FrontierCode 2.0 (independent; its Stirrup harness, 3 attempts per task, up to 500 turns, GPT-6 Luna judge; republished with per-row effort and result date by BenchLeader) for the four registered models at matching efforts — e.g. gpt-6.1-sol → gpt-6.2-sol at medium (33.4% → 41.4%) or xhigh (38.5% → 42.8%), as published on 2 Dec 2026 — so on the shipped coder route (gpt-6.1-sol medium) gpt-6.2-sol medium can be offered/drafted on the "benchmark" basis if it passes every official gate (task area, pricing, your /model availability and level answers). It counts only on the implementation routes (coder, coder.small_casual, intermediate-coder, senior-coder; senior-coder's shipped claude-opus-5.5 is not a registered leaderboard model) and only while both results are within 90 days (the gpt-6.1-sol results are dated 2026-09-29, so they stop counting after 2026-12-28 unless republished with a new result date). The tester route (shipped at gpt-6.1-sol xhigh) has no counted evidence: FrontierCode measures code changes, not test writing, and the only test-writing row (SWE Atlas) is at max without a result date. reviewer and test-reviewer have none by design. FrontierCode scores are republished by BenchLeader and not cross-checked against Artificial Analysis' own chart (not machine-readable).

  • Use and limits. A comparison is shown for an option only when it covers exactly the current model and the option, always in that direction (a reversed pair is shown in full again, never as a reference to an earlier option). Each source line states its setup relative to that route; scores at an unstated or different effort are labelled "context only". The short view lists at most three comparable metrics per source, taken in turn from those higher for the option, higher for the current model and equal, so a mixed result always shows both directions, and says how many hidden metrics go each way (all are in the details view). Each metric is compared only with the same metric from the same source; there is no average, overall winner or cross-source blend, and third-party prices are never read (their blended prices use other assumptions — official GitHub prices are the only prices shown). When the listed metrics point in different directions, or the aggregators' own composite scores disagree (for example BenchLeader and BenchLM on agentic scores for Sonnet 5.5 vs Terra), that is disclosed. Aggregators may republish the same underlying runs (e.g. both list the same Terminal-Bench results), so agreement is not independent confirmation and neither is treated as primary. Coverage is limited to the reviewed pairs — not comprehensive — and nothing says anything about your account, plan, organization policy, harness or the level your route uses; it is never proof of quality, availability or of a reasoning level. Official pricing, official docs and your own /model answers remain the only gates.

  • Switches. --offline or COPILOT_MODEL_REFRESH_BENCHMARKS_FETCH=0 (cached copies only), COPILOT_TASK_REPORT_PRICING_FETCH=0 (no fetching at all). If the module is missing or fails, or every page fails, p works exactly on official evidence and says the comparisons are unavailable; nothing changes automatically in any case.

  • Example (abridged; numbers are whatever the pages say at fetch time):

    #1 planner: gpt-6.1-sol · medium · long_context -> gpt-6.2-sol · medium · long_context
       price: blended $1.00 -> $1.00 per 1M (same blended price) — toolkit blend assumption, not your bill
       official $/1M: gpt-6.1-sol in 2.00 · cached 0.1 · cache write 2.50 · out 10.00  ->  gpt-6.2-sol in 2.00 · ...
       offered because: official differentiator: listed as included for Copilot CLI in the official per-client
           table (...); current model: not listed
       third-party: BenchLeader (aggregator; page updated 2026-11-21; fetched 0m ago; compared at gpt-6.1-sol 'max'
           vs gpt-6.2-sol 'max' as stated by BenchLeader; this route uses 'medium' -> 'medium' — setup differs, so
           these scores are context only (not a reason to offer this option) and may not reflect your route)
           https://www.benchleader.com/compare/gpt-6-1-sol-vs-gpt-6-2-sol
         - Terminal-Bench: current gpt-6.1-sol 60.9% · option gpt-6.2-sol 61.5%
         - Terminal-Bench 4.0 (AA) [Artificial Analysis]: current gpt-6.1-sol 56.1% · option gpt-6.2-sol 60.1%
         - SWE Atlas v1.1 [Scale AI SEAL]: current gpt-6.1-sol 65.9% · option gpt-6.2-sol 60.5%
         +4 more metric(s) not shown here (0 higher for the current model, 4 higher for the option, 0 equal,
           0 not comparable) — see the details view
       note: the listed metrics point in different directions (some higher for the current model, some for the
           option) — no overall winner is implied
       caution: third-party data, not official and not your account, plan, harness or effort; not proof of quality
       still to confirm: its availability in /model and reasoning level 'medium' — asked only if you select it
    

    (Lines added by policy v2 before each source: counted: nothing counts for the planner route (...); no reviewed benchmark measures implementation planning; every score here is context only, a measured: line per source, and — context only: <reason> or — COUNTED for this route (...) after each metric.)

    To add a pair, board or citation, a maintainer adds a reviewed entry to PAIRS, BOARDS or RESEARCH (and, for a new provider, a parser and metric allowlist with an evaluation identity in METRIC_EVALS); a change of role relevance goes into FAMILIES/ROLE_NOTES. Any of these changes the registry digest (which also binds the policy version and the 90-day cap), so older caches are ignored and sealed proposals are refused as stale.

Context metrics (new copilot-s sessions only)

For sessions created by copilot-s from this version on (n, or the automatic new session), copilot-s shows two numbers when the session stops (before the keep/rename/delete prompt) and next to it in the session list:

  • Context % last observed before compaction — currentTokens / tokenLimit from the latest valid session.compaction_start event. It is the fill level at the most recent compaction trigger, not the live or at-exit usage (the shutdown event has no verified token limit, so the two are never combined). Values over 100% are shown as recorded. N/A means no valid pre-compaction snapshot has been recorded — either no compaction has started yet, or every compaction start had missing/invalid/out-of-range token fields (those are counted and reported, never guessed).
  • Successful compactions — session.compaction_complete events with success: true only.

Enrollment is conservative: a new session is enrolled only if exactly one new session directory (with this cwd, created after launch) appeared during the run; otherwise a warning is printed and nothing is recorded. A session whose workspace.yaml created_at is missing or unparseable cannot be verified as created after launch and is likewise not enrolled (warning). Existing, imported, or externally created sessions are never enrolled or scanned. Values are cached in copilot-s-context.json inside the session directory (numbers and a read cursor only — no message text), refreshed when an enrolled session is resumed and stopped; the list reads only that file. If events.jsonl is missing/unreadable the count is shown as unknown, and corrupt or truncated lines are reported (>=N, "log incomplete") rather than hidden. No per-task summary is generated.

Per-launch session reports

Every copilot launch made by copilot-s — new or resumed — gets one run record with a fresh random run id and mode normal (the only supported mode). A record of any other mode is never changed: launch, finish and mark-outcome refuse it, and session / compare skip it and report how many were skipped (unsupported_run_records in JSON).

copilot-s --session-report SESSION_ID  # read-only: every copilot-s launch of a session, by mode
copilot-session-report.py launch --run-id RUN_ID [--format json]
copilot-session-report.py session --session-id SESSION_ID [--format json]
copilot-session-report.py compare [--format json]   # all runs grouped by mode
copilot-session-report.py mark-outcome --run-id RUN_ID --outcome completed|abandoned|unknown

What a run record holds (~/.copilot/session-reports/runs/<run-id>/run.json, directories 0700, files 0600, atomic writes): mode, state (incomplete until finalized, then completed / copilot-error / interrupted, or report-failure), exit code, launch/end time and wall clock (1 s resolution), the exact session link or unknown with a reason, versions (copilot-s, Copilot from the session's own start event), model calls/tokens and summed model-call time from the launch's own OTEL file, and an estimated cost. It never contains prompts, commands, arguments, tool output or work file paths. completed only means Copilot exited with 0 — whether the task was done is a separate, explicit task_outcome (unknown until you run mark-outcome). Time-to-first-token is reported as unknown (not captured). A token field the spans did not report (e.g. reasoning or cache tokens) is null with per-field coverage, never a measured 0; pricing keeps the task report's rule that an absent cache/reasoning attribute costs nothing, while a missing input/output count leaves the call unpriced and the usage partial.

Exact session linking, never "the latest". The resumed session, or the single new session directory the existing strict detection found, is cross-checked against the conversation ids in the launch's OTEL file; with no launcher candidate, a single conversation id in the launch's own OTEL file is used. Each launch writes a unique ~/.copilot/otel/copilot-otel-<timestamp>-<run-id>.jsonl (same copilot-otel-* pattern as before), so concurrent launches never share a file. Any conflict or ambiguity leaves the session unknown. Session reports group only exact run ids; earlier launches and launches outside copilot-s are not covered and are never backfilled.

Cost is an estimate. Calls are priced once, at the end of the launch, with the same validated official GitHub per-token snapshot the task report uses (cache only, no network), frozen with its snapshot id and fetch date, and never repriced. Unpriceable calls make the figure partial, never $0. $0.00 appears only for a true zero; tiny positive values show as <$0.01. None of this is a bill or a credit deduction.

Copilot's own end-of-session summary is also requested with --usage-output-file into the run's private folder (only numeric fields are read; it is shown separately and never added to the OTEL figures; invalid values such as NaN, negative or overlong numbers are discarded and listed, making it partial, or unavailable if nothing valid remains). If you pass your own --usage-output-file, copilot-s leaves it alone and records the native summary as unavailable. The private raw/ folder is never deleted automatically; use menu r (recoverable) to clean old runs. If copilot-s itself is killed while Copilot runs, the record stays incomplete (no outcome is invented).

Task usage reporting

Upgrading from a pre-2.0 checkout? This was previously Jira-specific (copilot-jira-report.py, ~/.copilot/jira-reports/, ~/Desktop/CopilotJiraTaskReports). 2.0.0 renames everything to generic "task" terminology with no compatibility shim — but your existing data is migrated automatically and idempotently the first time you run scripts/install.sh or use copilot-s/copilot-task-report.py after upgrading. See the CHANGELOG's 2.0.0 entry for exactly what moves and how conflicts/edits are preserved.

How task attribution works

  1. copilot-s tries to extract a conservative KEY-123-style ID (e.g. an issue-tracker key) from your current git branch name.
  2. If that fails and it's a resumed session, it falls back to the branch stored when that session was created.
  3. If that fails and it's a brand-new session, you're prompted once for a task ID or free-form task name (with input validation and retries); leaving it blank assigns UNASSIGNED. Resumed sessions are never re-prompted.

Configuration

  • COPILOT_TASK_REPORTS_DIR — override where Markdown reports are written (default: ~/Desktop/CopilotTaskReports).
  • Official pricing (automatic, no setup). The estimated USD cost uses GitHub's official per-token rates, read from the docs article-body API (https://docs.github.com/api/article/body?pathname=/en/copilot/reference/copilot-billing/models-and-pricing, public page: Models and pricing for GitHub Copilot) and cached in ~/.copilot/task-reports/official-pricing-cache.json with its fetch time, source URL and content SHA-256. The cache is refreshed at most once per ingest/report command and only when older than 24h (stdlib only, 1 MB size cap). The time limits are best effort, not a hard deadline: each socket operation (connect, each receive) has a 10s timeout and the 20s total deadline is only checked between body reads, so a server that streams headers or body slowly, slow DNS resolution, or a wait for the pricing lock can make an attempt exceed the nominal timeout. If (and only if) Python itself cannot verify the docs.github.com TLS certificate (e.g. a python.org build on macOS whose CA bundle was never installed), the fetch is retried once with the system curl — HTTPS only, certificate verification still on (never --insecure), no redirects, ~/.curlrc ignored, same 1 MB cap and 20s limit — and a note is printed on stderr. Without curl, the warning tells you to repair Python's certificates (Install Certificates.command or SSL_CERT_FILE). A failed fetch or a page whose tables don't parse cleanly never replaces the last valid cache: it is kept (the report labels it stale), a warning is printed, and retries are suppressed for 1h — so while the source keeps failing, a refresh is retried at most hourly (not once per 24h). A stale snapshot keeps pricing new calls only until it is 7 days past its fetch time; after that it is kept for reference only and newly ingested calls are recorded as unpriced with an explicit reason. The cache's fetched_at is when this tool downloaded the page, not a date from which GitHub's rates were effective. With no valid snapshot at all, newly ingested calls are recorded as unpriced (not $0). A corrupted cache is rejected as a whole and re-fetched; a corrupted official-pricing-refresh-state.json (retry metadata only) is reset with a warning without touching the cache or recorded task costs.
  • COPILOT_TASK_REPORT_PRICING_FETCH=0 (or off/false/no) — disable all network fetching (offline use, hermetic test fixtures); an existing cache is still used.
  • Pricing rules. Each call is priced individually at ingestion: the tier (Default / Long context) comes from that call's own input tokens (thresholds like ≤ 272K are read as 272,000; a call landing between the K=1,000 and K=1,024 readings is left unpriced as tier-ambiguous); cache-read and cache-write tokens are subsets of input tokens priced at their own rates (a cache write listed "Not applicable" is ordinary input); reasoning tokens are part of output and priced once. Model ids must match an official model name (lowercased, spaces → -, e.g. GPT-6.1 Sol → gpt-6.1-sol), optionally with dashes for version dots (claude-opus-4-8); nothing else is aliased or guessed. Missing input/output counts, inconsistent usage, cache-write tokens on a model whose table lists no cache-write rate, or reasoning > output make that call unpriced (listed with its reason). Every Gemini/Google-provider call that reports reasoning tokens is also unpriced, conservatively, because its reported output may exclude reasoning (token counts are kept).
  • Recorded, never repriced. Costs are stored in the task JSON under the snapshot id that priced them; a later refresh only affects calls ingested afterwards. Delayed ingestion uses the rates published at ingestion time. Calls recorded before this feature existed for a task are shown as legacy (token counts kept, no price provenance, never backfilled).
  • ~/.copilot/task-reports/model-pricing.json and ~/.copilot/task-reports/request-pricing.json — legacy, inactive. The old approximate per-token table and the company fixed per-request charge (whose rates were partly benchmark-derived) are no longer used by the report. Existing copies are left exactly as you edited them (nothing is migrated or deleted); the installer still copies them only if absent.

Attribution coverage and recorded reviews

  • Attribution coverage. Each report has an Attribution Coverage section with exclusive buckets that add up to the Summary totals: legacy (usage already on the task when attribution tracking started for it — frozen, never re-derived or repriced), unknown (with an explicit reason), and attributed. A call is attributed only through explicit OTEL trace context: its own parentSpanId names an invoke_agent span (same traceId, read in the same ingest) whose gen_ai.agent.name identifies the agent; the session's top-level agent loop appears as its own row. A By Agent table then shows per-agent invocation spans, calls, tokens, model-call time, models used, and the sum of the per-call official USD estimates recorded at ingestion (spend, not effectiveness). Calls are never attributed from timestamps, models, session membership, or agent time windows; a call whose span has no trace parent, whose parent was not exported yet when ingest ran, or whose direct parent is not an agent span stays unknown with that reason and is never re-linked. Unknown does not mean the main session. An Attribution data quality list shows coverage percentages and an actionable hint per unknown reason. Usage recorded before this join existed (attribution schema v1) stays unknown and is labeled as such.

  • Observed invocations. An informational registry lists agent invocations seen as subagent.started/subagent.completed events (keyed by session id + the event's agentId), including started-only or completed-only ones. Being listed does not attribute any call or cost, and the registry is not joined to the OTEL attribution. The self-reported By Custom Agent table is unchanged and separate.

  • Recorded reviews. The orchestrator records each reviewer / test-reviewer round explicitly:

    python3 "$HOME/.local/bin/copilot-task-report.py" record-review --input review.json

    The input is a versioned JSON object (schema copilot-task-report.review-record, schema_version 1) with record_id, task_id, session_id (or "unknown"), cycle_id, stage (reviewer/test-reviewer), round (0 = broad, 1–3 focused), verdict (approved/needs-fixes/escalated/unknown), invocation_id (or "unknown" plus invocation_unknown_reason), and provenance (source: orchestrator-supplied, basis: agent-response|user-supplied, reference). See instructions/copilot-instructions.md for a complete example. Invalid, conflicting, out-of-order, second-broad-in-cycle, or post-escalation records are rejected with a message on stderr and a non-zero exit; an identical replay is a no-op. approved does not close a stage: a later focused round of the same cycle (still in order and at most round 3) may check tests or fixes changed after the approval, and the report treats the latest recorded round as the stage outcome (a later non-approved round supersedes the earlier approval and is shown as not complete). Records are orchestrator-supplied, not telemetry: they are stored in the task JSON (reviews) under the ingest lock, never parsed from agent prose, and never change usage, legacy, or cost data. The command does not ingest, fetch pricing, or regenerate the Markdown report — run copilot-task-report.py report <task> (or wait for the next ingest) to see them. Invocation ids are checked by exact match against the observed registry at render time; an id seen before its session is ingested shows as not (yet) observed.

Feature delivery tracking

Optional, for meaningful multi-agent features only (no overhead for small questions or one-line operations). A report without delivery records or feature links renders exactly as before.

  • Call ledger (automatic). Each ingest also stores every new model call whose OTEL chat span has valid ids once, under the stable key *session id

    • traceId + the span's own spanId*, in the task JSON (feature_usage): model, token counts, usage-presence flags, span duration, parent span id, the agent label only when the existing trace-parent join resolved it, and the official price result frozen at ingestion (snapshot, tier, component USD) or the explicit unpriced reason. No prompts, completions or tool results are stored. invoke_agent spans are stored the same way as observed invocations. Calls without stable ids are counted per reason (no key is invented); a repeated key is never ledgered twice. Usage already on the task when the ledger starts is frozen as an unsplittable pre-ledger baseline — never rescanned or backfilled. Existing totals, cost, attribution and review data are unchanged.
  • Delivery records. record-delivery --input FILE stores one event per call (schema copilot-task-report.delivery-record, schema_version 1): record_id, task_id, feature_id, cycle_id, event (started, completed, cancelled, defect-confirmed, regression-confirmed), occurred_at (UTC, e.g. 2026-11-17T14:05:00Z), and provenance (source: orchestrator-supplied, basis: orchestrator-observed|agent-response|user-supplied, short reference). A cycle starts once and ends at most once (no reopen or review-budget reset), its end cannot precede its start, and a cycle_id belongs to one feature. Finding events add finding_id (unique within the task, so a finding is counted once across rounds), severity (critical/high/medium — optional polish is not recorded), category (correctness/security/safety/data-integrity) and evidence_reference; a regression also needs previous_working_reference (recorded evidence the behavior worked before). Late findings against a completed cycle are allowed. The task must already exist (created by an ingest); the command never creates a task file, so for a not-yet-ingested task record the start after the first ingest with the real start time as occurred_at.

  • Linking usage to a feature. Inspect, preview, then record:

    # 1. Read-only: the session's ledgered calls and invoke_agent groups (JSON)
    python3 "$HOME/.local/bin/copilot-task-report.py" feature-calls --task ABC-123 --session-id SESSION
    # 2. Read-only preview: a ready-to-save payload with the expanded call count and sha256
    python3 "$HOME/.local/bin/copilot-task-report.py" feature-calls --task ABC-123 --session-id SESSION \
      --feature-id abc-123-export --cycle-id abc-123-c1 --invocation TRACE_ID/SPAN_ID > fu.json
    # 3. Record it (re-checks the selection; refuses if it changed since the preview)
    python3 "$HOME/.local/bin/copilot-task-report.py" record-feature-usage --input fu.json

    The payload (schema copilot-task-report.feature-usage-record, schema_version 1) holds record_id, task_id, feature_id, cycle_id, selectors (each {kind: call|direct-invocation, session_id, trace_id, span_id}), expected_call_count, expected_call_set_sha256 (sha256 of the sorted session/trace/span call keys, one per line) and provenance (basis: orchestrator-selected|user-supplied). A direct-invocation selector expands only to ledgered calls of the same session and trace whose own parentSpanId is that invoke_agent span — never ancestors, time windows, whole sessions or calls ingested later. If one invocation served several features, select its calls individually with --call. The cycle must have been started; each call belongs to at most one feature cycle (a conflicting link is refused, never moved), overlapping links to the same cycle are counted once, and late links after completion are allowed as explicit audit records. feature-calls is read-only: no lock, files, directories, pricing fetch or network.

  • Report. When such records exist, a Feature Delivery section shows per cycle and per feature: status, recorded start/end, wall-clock elapsed time (includes idle time), linked calls, the sum of their frozen per-call estimates (priced/unpriced counts; partial is labeled and unpriced is never $0; a feature without links has unknown cost), linked model-call time (separate from elapsed), and recorded confirmed defects/regressions ("none recorded" is not evidence of no defects). A Feature usage ledger coverage table reconciles baseline + linked + unallocated + calls without stable ids + repeated keys with the Summary totals and estimate; feature cost is a subset of the Summary cost, never added to it again. Repeated observations of an already-ledgered call key keep their exact calls, tokens and priced/unpriced cost in their own bucket: they remain in the Summary totals (existing aggregation unchanged), so those totals are not a unique-call count, while the ledger and features count each key once.

All three commands validate strictly (duplicate JSON keys, unknown fields, bad ids/timestamps and conflicts are rejected with a non-zero exit); identical replays are no-ops; the record commands use the same lock and atomic replace as record-review and, like it, never ingest, fetch pricing or regenerate the Markdown report (run report <task> afterwards). Feature ownership is never inferred: unlinked calls simply stay unallocated. Per-call USD values are list-price estimates, not an invoice, and no externally supplied cost is accepted.

Limitations

  • Usage is tracked only from the moment the toolkit is first used on a machine; existing session history is never backfilled.
  • Requires OTEL export to actually work with your installed Copilot CLI version (copilot-s sets COPILOT_OTEL_ENABLED=true and a file exporter path); if your CLI build doesn't honor it, only auxiliary-call/checkpoint data from events.jsonl will be reflected.
  • If a session's telemetry files are deleted before ingestion runs (outside the normal copilot-s exit flow), that increment is permanently lost.
  • No automatic retention/cleanup policy for OTEL span files or other telemetry state under ~/.copilot/otel/ (or events.jsonl/checkpoint state): this toolkit never prunes, rotates, or expires them on its own. They accumulate indefinitely until ingested, and this toolkit does not delete them for you afterward either. Do not manually delete active telemetry files before copilot-s's normal exit-time ingestion has run for that session — doing so causes the same permanent data loss as the point above. Manual, periodic pruning of old/already-ingested files is safe if you want to reclaim disk space, but is left entirely to you; automating that pruning safely (i.e. never touching not-yet-ingested data) is a known, deliberately-unimplemented gap — see docs/architecture.md — rather than something this toolkit currently risks doing automatically.
  • The estimated USD cost applies official list prices to the usage this toolkit observed; it is not an invoice. It does not deduct the GitHub AI Credits allowances included in your plan, it counts only OTEL usage-bearing model spans, and unpriceable calls make it a labeled partial lower bound. Rates are those published when the call was ingested (not necessarily when it ran), and promotional rates noted on the official page (e.g. Gemini Flash until 2026-12-31) are shown as notes. Copilot code review and code completions are not covered.
  • Some providers' telemetry may report output tokens excluding reasoning tokens (observed for some Gemini calls, where reasoning > output). Since that can't be detected when reasoning ≤ output, every Gemini/Google-provider call with reasoning tokens is left unpriced; for other providers only reasoning > output is unpriced, so an undetectable gap there could still underestimate.
  • A usage count that is present but not a valid count (boolean, numeric string, fraction, negative, unsafe huge, NaN/Infinity, non-numeric) makes that call unpriced with an explicit invalid-usage reason and unallocated in the feature ledger. The token totals still use the long-standing lenient conversion (an unreadable value counts as 0), so they may include such normalized values; estimates recorded earlier are never repriced.
  • The official page format is parsed strictly; if GitHub changes the table layout in an unsupported way, refreshes fail (last valid cache kept and labeled stale) until the parser is updated.
  • Legacy Desktop-reports migration only looks in the hardcoded default pre-2.0 location (~/Desktop/CopilotJiraTaskReports). If you had customized the old COPILOT_JIRA_REPORTS_DIR env var to point your legacy reports somewhere else, that custom location is not auto-discovered (the env var itself is gone in 2.0.0 — see the CHANGELOG — so there is nothing left for this toolkit to read it from), and those reports will not be migrated automatically. If this applies to you, move/copy your old reports directory to the default ~/Desktop/CopilotJiraTaskReports path yourself before first running scripts/install.sh or copilot-s after upgrading, so the automatic migration picks them up; otherwise they're simply left where they are (never deleted, but also never merged into the new ~/Desktop/CopilotTaskReports location).
  • Copilot-internal nano-AIU/premium-request figures are opaque accounting units reported by Copilot itself, kept separate from the USD estimate.
  • Model calls are attributed to agents only via the explicit OTEL trace parent described above; calls ingested before that (or without the link) stay legacy/unknown and are never backfilled. Review records are only as accurate as the orchestrator that supplies them, budgets are enforced per cycle_id (a new cycle id cannot be verified as a genuinely new work item), and a task with no records — including all work before this feature — is not evidence of a skipped review.
  • Feature delivery tracking only covers what is explicitly recorded and linked: usage before the call ledger started and calls without stable OTEL ids can never be split by feature, a shared invocation needs manual per-call selection, and defect counts include only confirmed recorded findings. The ledger grows with every ledgered call (one compact entry per call in the task JSON).
  • Crash safety is unchanged: offsets are written before the task file, so a crash between the two can undercount (never double count) usage and registry events; ingestion is not exactly-once. An existing task file that is unreadable or belongs to another task is never replaced: ingest refuses with a non-zero exit before advancing any offsets. (When copilot-s deletes a session, a failed ingest is only warned about and the session directory is still removed, as before.)

See docs/architecture.md for the full list of documented tradeoffs.

Agent pipeline

Upgrading to this release? The retired fixer agent is deleted from this repo, but a plain git pull does not remove it from ~/.copilot/agents/fixer.agent.md if you already had it installed — that removal only happens during an install/update run, the same way the pre-2.0 Jira-helper migration above works. Run scripts/update.sh (or scripts/install.sh again) once after pulling this release so the stale, already-installed fixer path gets cleaned up; a symlink that merely gets updated in place isn't enough to remove a path that no longer exists in this repo.

Role Purpose Example model¹
discovery Read-only mapping of broad/unfamiliar codebase areas before planning or coding starts gpt-6-luna (effort: low)
planner Turns an ambiguous/design-heavy task into an ordered implementation plan, consuming discovery's output instead of re-exploring gpt-6.1-sol (effort: medium)
coder Routine implementation and targeted fixes: CRUD, UI, standard logic gpt-6.1-sol (effort: medium; small/casual route: gpt-6.1-terra, low)
intermediate-coder Bounded, moderately complex implementation and targeted fixes: multi-file changes following established patterns, bounded async/state handling — an alternative to coder/senior-coder, never an extra stage gpt-6.2-sol (effort: high)
senior-coder Complex implementation and targeted fixes: multi-file architecture, async state, schema/data-model changes, deep structural bugs, new services claude-opus-5.5 (effort: high)
reviewer One comprehensive review, then up to 3 bounded focused-verification rounds on prior findings/regressions only; never rewrites claude-sonnet-5.5 (effort: high; Opus for stronger override)
tester Writes and runs tests, only when behavior merits it; bounded test/fix loop (max 3 rounds) gpt-6.1-sol (effort: xhigh)
test-reviewer Complex/high-risk-only quality gate on test coverage/trust, same bounded verification discipline as reviewer claude-sonnet-5.5 (effort: high)

Routine mechanical shell/git operations use a separate built-in route:

Built-in role Purpose Example model
task (Copilot CLI built-in; not a custom agent) Executes a safe, bounded shell/git operation such as a known formatter/build/test command or an explicitly requested commit gpt-6-luna (effort: low)

The built-in task subagent is not a ninth custom agent: it has no agents/task.agent.md and /agent continues to list the eight custom roles above. Delegating to it is a cost-saving operation, even when no coding-agent stage is warranted, when the command work is substantial enough to pay for the handoff (long build/test runs, verbose formatter passes, authorized multi-file commits); tiny lookups, status checks and one-line commands stay in the main session by default. When it is used, the main session remains responsible for defining scope and checking the result. Do not spend a senior-coder/Opus call or route a command-only request through a coding/review agent. discovery is read-only mapping, never the command runner. Commits and pushes still require explicit user authorization. For an authorized commit, stage only the requested changes and leave unrelated dirty edits untouched; do not delegate destructive or unreviewed changes without authorization. If the built-in Task tool is unavailable or a command needs security-sensitive/complex judgment, handle it in the main session and explain why.

Small or casual implementation/edit requests follow a separate default route: use the task tool to invoke the named custom agent coder (not the built-in task shell executor), with model: gpt-6.1-terra, reasoning_effort: low, and context_tier: default. The main session scopes and coordinates the work and retains oversight. coder implements only and does not test or review its own changes; every code batch receives an independent reviewer pass, while tester remains conditional on behavior. Pure prose/docs and mechanical git-only changes are exempt. Genuinely trivial edits (a typo, a one-line doc/comment fix, a single obvious value) may be made directly by the main session when the handoff would cost more than the edit; a source/code edit made that way still gets the independent reviewer pass. Answer simple informational questions directly. Routine shell/mechanical work remains routed to the built-in task when it is worth a handoff.

Efficient orchestration. The instructions treat delegation as a cost tool: the main session answers small questions and follows a single continuous investigation itself; implementers get one complete bounded batch (no per-file or micro handoffs); the tests run before one broad review of the whole source-and-test batch; stages run in parallel only for independent reads or non-overlapping writes; only significant correctness, security, safety, data-integrity and regression findings consume fix rounds (optional polish is deferred unless you ask for it). When a review or test budget is exhausted the orchestrator stops, sends one actionable escalation with explicit choices (accept as-is, authorize a targeted extension for named findings, or stop), waits, and resumes only with the permission you actually gave — no automatic new cycle, budget reset, or reminder loop. Delivery is judged by completion, cost, elapsed time and confirmed material defects/regressions, not by agent count or self-reported quality; see Feature delivery tracking.

Model choices follow a provisional cost/capability tiering (start cheap for routine work, step up for design/routing and higher-scrutiny review): gpt-6-luna is the cheapest/fastest tier for read-only discovery, bounded mechanical task execution; gpt-6.1-sol is the quality-first default for routine implementation at medium effort and remains on planning and testing; gpt-6.1-terra at low effort handles the small/casual coder route; gpt-6.2-sol at high effort (default context) handles bounded, moderately complex intermediate-coder work; claude-sonnet-5.5 handles routine review and the test-reviewer coverage gate; and claude-opus-5.5 is reserved for senior-coder implementation and the stronger reviewer override. Routine coder code changes, and intermediate-coder changes on tasks that are not complex/high-risk, use claude-sonnet-5.5 at high effort and long context for review; senior-coder-authored, complex/high-risk, or unknown-implementation-model changes use Opus at high/long-context (intermediate-coder authorship alone does not). test-reviewer judges test coverage/trust rather than implementation correctness, so it uses Sonnet 5.5 to keep Opus reserved for high-risk implementation and correctness review. These are conservative, quality-first routing recommendations; no local benchmark establishes coding or review quality. Artificial Analysis task cost figures, where cited, are illustrative comparisons—not Copilot bills and not proof of coding or review quality. Actual cost varies with tokens, cache use, and verbosity. The reviewer role links to the dated Artificial Analysis model pages and GitHub's official per-token pricing. discovery uses gpt-6-luna at low effort with long context for mapping broad codebases. Each reasoningEffort is a per-agent frontmatter default (CLI v1.0.66+) — override per-installation via /subagents rather than editing agents/*.agent.md directly.

Hard routing defaults also live in config/agent-routing.yaml and are installed to ~/.copilot/agent-routing.yaml. This YAML file is a toolkit convention — not an official Copilot CLI config file — used to make the orchestrator's task-tool calls explicit for model, reasoning_effort, and context_tier. The same table is mirrored in instructions/copilot-instructions.md, which is the file Copilot actually loads automatically, so the orchestrator can pass those values as hard task-call parameters instead of relying only on Markdown suggestions.

¹ Models listed in each agents/*.agent.md file are this release's shipped, CI-validated defaults — not a recommendation frozen in time, but also not something you need to edit source to change. For a personal override, use /subagents in a session to reassign an agent's model for your own installation; that's a per-installation setting and does not require touching this repo's frontmatter. Only edit the model: frontmatter field directly if you intend to change the shipped default for everyone who installs from your checkout — if you do, update tests/test_agent_pipeline.py's EXPECTED_AGENTS map to match, since CI asserts the repository defaults stay in sync with this table. The pipeline logic in instructions/copilot-instructions.md doesn't depend on which models are assigned either way.

The orchestrator (instructions/copilot-instructions.md, auto-loaded every session) selects stages by task tier (trivial/small/standard/complex/ high-risk) and enforces bounded review/fix and test/fix loops. Discovery, planning, and testing are conditional, but every source/code change batch gets independent review: production source, tests (including tester-authored tests), scripts, Storybook stories, and executable or behavior-affecting configuration. This requirement applies even if a test or configuration change adds no executable behavior. Pure prose/docs and mechanical git-only operations are normally exempt. Small code changes therefore include a reviewer stage. Each batch is implemented by exactly one of coder (routine), intermediate-coder (bounded, moderately complex multi-file or async work) or senior-coder (genuinely complex/high-risk architecture, security or data-integrity work, and escalations); they are alternatives, never sequential stages. Only complex/high-risk work typically pulls in discovery, senior-coder, and test-reviewer. There is no fixer agent: coder/intermediate-coder/senior-coder handle their own targeted fixes at whichever tier originally implemented the code, so there's no hand-off duplication.

The default handoff order is: implement → run the relevant tests (tester writes them when new tests are needed; otherwise the built-in task route runs the existing ones) → one comprehensive reviewer pass over the whole code-and-test batch → test-reviewer for complex/high-risk work. Stages exchange a compact manifest (task/cycle/batch, changed files and authors, test results, unresolved findings); later fix rounds carry only the changed subset and finding numbers. Tests added after a coverage review are re-run and get a focused correctness check inside the same budgets of the same work-item cycle (reviewer and test-reviewer: 1 broad + up to 3 focused; tester: 1 initial + up to 3 retests), and exhausted budgets escalate. After each review response the main session records the round with copilot-task-report.py record-review (reviewers stay read-only); see Attribution coverage and recorded reviews.

For standard, complex, and high-risk tasks, and for broad discovery or design planning at any tier, the orchestrator asks the user to approve routing before substantive work unless runtime autopilot is active. The proposal names configured stages and their agent/model/effort/context, plus every skipped group and reason; the user can approve delegation, choose main-session handling, or give custom routing. Only minimal classification reads are allowed first. Declining or cancelling stops work, and routing approval does not itself approve a plan, implementation, tests, commits, or pushes. Significant route changes need renewed approval outside active autopilot. In active autopilot, routine nonblocking choices and routing adjustments use the best-supported recommended in-scope decision, with route and skips announced. Before taking a recommended action, visibly announce the action, scope, and reason using a bold Markdown label such as Recommended action:, not hidden reasoning or a retrospective announcement. One announcement can cover a coherent batch; if the recommendation materially changes, announce the new recommendation before acting on it. This is informational, not an approval prompt for routine in-scope decisions. Significant ambiguity, scope expansion, destructive actions and separately required permissions still require input or approval. If there is no responsible default, work pauses. Required reviews, tests and budgets still apply. Making best guess on autopilot is a runtime UI label, not a quality guarantee; instructions guide decisions but do not change the label or enable autopilot. For every blocking ask_user call, the first visible line of the same assistant response, immediately before the tool call, starts with 🛑 **NEEDS YOUR APPROVAL**; a blocking non-approval question uses 🛑 **NEEDS YOUR INPUT**. The visible preamble and tool prompt are separate parts of that response; the label cannot be supplied only in the tool form, an earlier turn, or hidden commentary. If ask_user is unavailable, use the same label in a plain-text pause request and wait for a reply if supported. This is an orchestrator convention, not deterministic CLI enforcement.

The orchestrator must communicate those decisions rather than skipping silently. Before substantive work it reports the task tier, which stage will run (or that the main session will handle it directly), and every skipped stage/group with a short reason. A skip decided later is reported at that transition, and the final response includes a compact Stages: record of what ran and what was skipped.

Verify the pipeline is loaded:

/agent          # lists all 8 custom agents
/env            # shows loaded agents/instructions in detail
/subagents       # shows/lets you change each agent's assigned model

Configuration reference

Setting Where Default
Task reports directory COPILOT_TASK_REPORTS_DIR env var ~/Desktop/CopilotTaskReports
Official pricing cache ~/.copilot/task-reports/official-pricing-cache.json (+ official-pricing-refresh-state.json) fetched automatically from docs.github.com; 24h TTL, retried at most hourly while failing; a snapshot more than 7 days past its fetch time is never used to price new calls
Disable pricing network fetch COPILOT_TASK_REPORT_PRICING_FETCH=0 env var fetching enabled
Legacy model pricing (inactive) ~/.copilot/task-reports/model-pricing.json copied from config/model-pricing.json on first install (only if absent); unused
Legacy company fixed per-request policy (inactive) ~/.copilot/task-reports/request-pricing.json copied from config/request-pricing.json on first install (only if absent); unused
Executables install prefix scripts/install.sh --prefix DIR ~/.local/bin
Install method scripts/install.sh --copy symlink
Subagent model refresh (menu p) copilot-model-refresh.py (+ copilot_model_benchmarks.py next to it); state, backups, capability and third-party comparison caches, your user-config.json and verified-models.json (recorded with copilot-model-refresh.py record-verified) in ~/.copilot/model-refresh/ (or $COPILOT_HOME/model-refresh/); curated fallback catalog ~/.copilot/model-role-catalog.json; COPILOT_MODEL_REFRESH_DOCS_FETCH=0 / COPILOT_MODEL_REFRESH_BENCHMARKS_FETCH=0 stop the capability-page / third-party fetch; COPILOT_MODEL_REFRESH_POLICY=cost-led restores the legacy cost-led p; NO_COLOR disables colour balanced: no overrides, a draft table with nothing selected; accepted rows need your verified availability list or your answer for the accepted model
Model refresh helper path COPILOT_MODEL_REFRESH_HELPER env var sibling of copilot-s, else ~/.local/bin/copilot-model-refresh.py
Per-launch session reports COPILOT_SESSION_REPORTS_DIR env var ~/.copilot/session-reports (never pruned automatically)
Session report helper path COPILOT_SESSION_REPORT_HELPER env var sibling of copilot-s, else ~/.local/bin/copilot-session-report.py
Run-report cleanup helper path (menu r) COPILOT_REPORT_CLEANUP_HELPER env var sibling of copilot-s, else ~/.local/bin/copilot-report-cleanup.py; quarantine is fixed at ~/.copilot/copilot-s-report-quarantine (never purged automatically; explicit one-batch purge via submenu 4)
Permanent quarantine purge (menus x, r → 4) copilot_quarantine_purge.py, installed next to the cleanup helpers and loaded from their real directory; journals in <quarantine>/.purge/ never automatic; one batch per run, exact phrase typed on the terminal

Security & privacy

  • Everything runs locally; no telemetry is sent anywhere by this toolkit itself (the Copilot CLI's own telemetry is a separate concern — see GitHub's documentation). The only network request it makes is an anonymous HTTPS GET of the public GitHub pricing page (at most once per 24h, or when you explicitly choose menu p; disable with COPILOT_TASK_REPORT_PRICING_FETCH=0) — no usage, task, or account data is sent.
  • Task IDs, tokens, and cost data are stored only in your own ~/.copilot/task-reports/ directory and your reports directory — nothing is transmitted or shared by these scripts.
  • The pricing cache contains only GitHub's public list prices — no account, billing, or credential data.
  • Per-launch session reports (~/.copilot/session-reports) hold metadata only (ids, versions, states, times, counts, token totals, estimated costs). Each run's private raw/ folder (0700) holds data owned by other tools: Copilot's usage summary file (may list modified file paths). It is never copied into reports, never sent anywhere, and never deleted automatically. Menu r can move finalized run reports with that raw data into a private recoverable quarantine (~/.copilot/copilot-s-report-quarantine, 0700) only after an explicit yes; that never deletes anything and frees no disk space. Only the separate permanent purge (submenu 4, one batch, exact phrase typed on the terminal) deletes a quarantine batch; it is not secure erasure (blocks are unlinked, not overwritten).
  • See SECURITY.md for how to report a vulnerability.

Uninstall / update

scripts/uninstall.sh --dry-run           # preview
scripts/uninstall.sh                     # remove only toolkit-managed files/symlinks
scripts/uninstall.sh --restore-backups   # also restore whatever was backed up at install time

scripts/update.sh                        # git pull --ff-only, then re-run the installer

Uninstalling never touches usage reports, task/session ingest state, your pricing configs/cache, Copilot session state, quarantined sessions (~/.copilot-s-quarantine) or quarantined run reports (~/.copilot/copilot-s-report-quarantine), including their .purge/ journals, or the install-time backups — only what it can positively identify as this toolkit's current install. Uninstalling never purges a quarantine: purge the batches you no longer need (menu x / r → 4) before uninstalling, since the purge engine copilot_quarantine_purge.py is removed with the tools. It also leaves the subagent model-refresh state and anything an applied refresh wrote (/subagents values in ~/.copilot/settings.json, the generated ~/.copilot/instructions/copilot-toolkit-model-routing.instructions.md); run copilot-model-refresh.py reset --yes first to remove the tool's own overrides. Updating keeps all of that state and your pins.

What uninstall removes, and how it recovers (scripts/uninstall.sh runs scripts/toolkit_uninstall.py; python3 is required):

  • It removes a path from the install manifest only if it is one of the toolkit's current managed files (the commands/libraries in their prefix, ~/.copilot/copilot-instructions.md, agent-routing.yaml, model-role-catalog.json, and this checkout's agents in ~/.copilot/agents) and it is still exactly what the installer put there: a symlink to this checkout's file, or a copy identical to it, with the same identity (inode and times) it had when the uninstall started. Paths are opened without following symlinks; each file is renamed to a random name in its folder and checked again before it is deleted — if something else was moved, it is put back (or kept and reported). Everything else the manifest lists — unknown, retired or older-version paths (including files of features that no longer exist), modified copies, symlinks elsewhere, anything behind a symlinked folder — is left in place, reported, and stays listed in the manifest.
  • Before changing anything it writes a journal (~/.copilot-cli-toolkit/uninstall-journal.json). If it is interrupted or a restore fails, run scripts/uninstall.sh again: it resumes, never removes or overwrites anything it already removed or restored, and leaves alone a new file at a removed path even if it is identical (exit 1 while work remains). The journal must still match the install manifest, this checkout and backup-manifest.txt, otherwise nothing is done. Install and uninstall share one lock, re-checked before every change; scripts/install.sh also refuses to run while the journal exists.
  • --restore-backups moves each removed path's most recent install-time backup itself back into place (an atomic rename that never replaces anything; nothing is copied or written), so your original file returns with its content, permissions and times — and the backup is consumed (no longer under backups/; its line in backup-manifest.txt stays as history). It is moved only into an empty destination on the same filesystem: if anything is already there (including a dangling symlink), or the backup is on another filesystem, missing, changed since the uninstall recorded it, a folder or special file, or not where the installer stores backups, nothing is moved, the backup is kept and you restore it by hand. If a restore is interrupted, the next run checks whether the recorded backup already arrived; anything unexpected is moved back or reported, never deleted.
  • --dry-run only reads and prints; it writes nothing (not even the journal).
  • Known limits: another process running as you could, in theory, replace a file in the instant between uninstall's last check and its delete (it would then be deleted), or replace the lock file so that a second install/uninstall runs alongside for one step. Avoid running other tools on these paths while installing or uninstalling.

The installer replaces only its own previous files (never recursively), moves a pre-existing file of yours to its own new folder under ~/.copilot-cli-toolkit/backups/ (an earlier backup is never overwritten), and creates new files without overwriting anything that appears meanwhile (the install stops instead). If an install stops while writing a copy, the next run stops, changes nothing and tells you which path to check (recorded in ~/.copilot-cli-toolkit/install-pending.json): remove the incomplete copy yourself (or the record, if the file there is yours), then re-run.

Roadmap

  • Optional Homebrew formula / package for install.
  • Linux CI coverage expansion beyond current smoke tests (broader shell matrix).
  • Pluggable issue-tracker backends beyond KEY-123-style keys.

Contributing

See CONTRIBUTING.md. Issues and PRs are welcome — please run python3 -m unittest discover -s tests -v (covers both tests.test_copilot_task_report and tests.test_copilot_s) and bash -n bin/copilot-s scripts/*.sh before submitting.

License

MIT

About

A practical GitHub Copilot CLI workbench for session management, Jira usage reporting, custom agents, and multi-agent development workflows.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages