Model routing and token saving
Which model
- Sonnet (default, ~90% of work): edits, bug fixes, tests, refactors of known code, git, docs, README/TROUBLESHOOTING updates, running
npm run check. - Opus (only when it pays off): a new feature spanning several modules, architecture or data-flow changes, a bug whose cause is unknown after one Sonnet attempt, security review, large migrations. Use it to produce a short written plan (max ~30 lines), then execute the plan on Sonnet.
- Haiku: pure lookups, grep-and-report, summarizing logs, listing files. Delegate with a subagent and
model: haiku. - Do not escalate to Opus for style, naming, or one-file changes. If a Sonnet attempt fails twice, escalate once, then return to Sonnet.
Saving tokens without losing quality
- Read
PLAN.mdfirst. Then read only the files the task touches. Use Grep/Glob before opening files; read line ranges, not whole files. - Never read
node_modules,dist-electron,release,logs,data,package-lock.json, or.env. - Run
npm run checkonce at the end, not after every edit. Run a single test file (npx vitest run tests/<file>) while iterating. - Pipe long command output through
Select-Object -First 40/-Last 40; do not dump full logs. - Do not re-read a file just edited. Do not restate facts already established in the conversation.
- Keep replies short: what changed, what was verified, what the user must do next.
- Offload broad searches or log reading to a subagent so only its conclusion enters the main context.
- One task per session. Start a new session when the topic changes instead of carrying a long history.
- Never skip the check, tests, or the reading of files that affect correctness to save tokens.