feat: :model switches an open agent to any model, with autocomplete
Merged
KI
21d ago+1746+1746+0123456789012345678901234567890123456789-162-162-012345678901234567890123456789
Problem
:model could only change an agent's model within its own engine. Picking a model that another engine runs (Codex's gpt-5.5 on a Claude Code agent, say) only set it for new agents, so moving a conversation to a different model meant starting over or forking. :model also had no Tab completion.
Change
- Tab completion:
:model <partial>+ Tab offers the exact model ids of every engine you're signed in to, newest first and the focused agent's engine first. Each one has its name and version beside it (claude-opus-5-5 Claude Opus 5.5,gpt-5.5 GPT-5.5 Codex), and the inserted text is the exact id.:effortcompletes the levels the agent's engine accepts. - No aliases: you type, or complete, an exact model id. Nothing guesses which version you meant. A name that isn't an exact id behaves as before: it's tried on the agent's current engine.
- Moving an agent to another engine's model, in place: the agent keeps its name, worktree, branch, sidebar slot and transcript.
- The new engine can't resume the old one's session, so the next prompt carries the conversation so far: the most recent ~40,000 characters of prompts, replies and tool calls, with a note when earlier messages were left out.
- After that first prompt, the agent continues on the new engine's own session.
- While a turn is running: the switch waits until the turn ends, and the last pick wins.
- What you see: the message line, the window's title bar and the transcript show the exact id with its name and engine, e.g.
'fix-auth' now runs gpt-5.5 (GPT-5.5 Codex, Codex). - Restart: the switch is saved with the agent, including a handoff that hasn't been sent yet.
- Refusals: an engine that isn't installed or signed in is refused with
:checkhealth's wording, and a race racer keeps its engine so the race stays fair. - Switching within the same engine works exactly as before.
- Coverage: the same behavior and messages in the TypeScript app and the Rust binary. docs/config.md and docs/guide.md describe it.
Verification
Run on this branch merged with current main (a33d12f):
| Suite | Pass | Fail | Skipped |
|---|---|---|---|
npm test | 459 | 0 | 13 |
cargo test (crates/vigent) | 188 | 0 | – |
| full pty suite through the packaged Rust binary | 465 | 0 | 7 |
- Unit tests cover:
- the handoff text a fake new CLI receives;
- the 40k cap;
- waiting for a running turn, and the last pick winning;
- the refusals;
- restart with a pending handoff;
- completion with names and versions;
- same-engine
:modelbeing unchanged.
test/model-handoff.test.mjsdrives a real agent in a pty: type:model gpt-, Tab, Enter, send a prompt, then check the screen and what the new CLI received. It runs against both builds.- Binary size: 2.9 MB (1.3 MB download).
Follow-ups
None.