Classify every comment as tautology, stale, excuse or decision record. Tautology/stale/excuse comments are deleted (excuses filed as issues #196-#236), decisions moved to docs/adr/0001-0034. - scripts/lint-comments.sh + .comment-baseline: per-file comment count may only go down; wired into tests/all.sh - .claude/skills/delete-comment: repeatable audit workflow - cargo fmt applied to touched crates Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
15 lines
1.2 KiB
Markdown
15 lines
1.2 KiB
Markdown
# Model and provider routing respects prompt-cache cost
|
|
|
|
Status: accepted
|
|
|
|
## Context
|
|
A tier or provider switch makes the next request re-read the whole history uncached. Big histories make switches costly; a 1M-context session cannot move to a 200k model; Fable is the most expensive tier.
|
|
|
|
## Decision
|
|
Up-tiers apply immediately; a cheaper tier only after `down_after` light prompts in a row, and the hold grows with history size. Fable is dropped at once. A tier is skipped if the history would not fit the target window. Provider choice prefers the current provider (keeps the cache), then a logged-in one with the exact tier; providers out of quota are avoided when alternatives exist; custom endpoints serve only when nothing else is logged in. Switching providers rebuilds the client even for the same provider so refreshed credentials are picked up. Auto picks and one-turn overrides are not recorded as the user's pinned choice.
|
|
|
|
## Consequences
|
|
Fewer cache-busting switches at the cost of slower step-down. Routing needs the history size and window as inputs.
|
|
|
|
Code: crates/hx-core/src/route.rs:Router::choose, pick_provider; switch.rs:Switcher::set_provider, prepare
|