Per-Mode Model Configuration via `Shift+Tab`
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
### Describe the feature or problem you'd like to solve
Allow users to assign different AI models to different interaction modes (Plan, Implement, Autopilot) so that toggling modes with `Shift+Tab` also switches the active model automatically. Currently, `~/.copilot/config.json` only supports a single global `model` field, forcing users to manually run `/model ` every time they switch modes. This adds friction and interrupts workflow — especially for users who prefer a higher-capability model for planning (e.g., `claude-opus-4.6`) and a faster model for implementation (e.g., `claude-sonnet-4.5`).
### Proposed solution
Extend the `config.json` schema to support per-mode model overrides. When a user toggles modes with `Shift+Tab`, the CLI would automatically switch to the model configured for that mode. The existing top-level `model` field would continue to serve as the default fallback when no per-mode override is set.
Below are three possible `config.json` schema approaches, in order of preference:
### Option A — `mode_models` object (recommended)
A dedicated object keyed by mode name. Clear, flat, and easy to validate.
```json
{
"model": "claude-sonnet-4.5",
"mode_models": {
"plan": "claude-opus-4.6",
"implement": "claude-sonnet-4.5",
"autopilot": "claude-sonnet-4.5"
}
}
```
- `model` remains the session default and fallback.
- Any mode not listed in `mode_models` inherits the top-level `model`.
### Option B — Flat per-mode keys
Simpler for users who only override one or two modes, at the cost of a slightly flatter namespace.
```json
{
"model": "claude-sonnet-4.5",
"model_plan": "claude-opus-4.6",
"model_implement": "claude-sonnet-4.5",
"model_autopilot": "claude-sonnet-4.5"
}
```
### Option C — Extended `model` as object
Replace the `model` string with an object that supports both a default and per-mode overrides. Backwards-compatible if the CLI accepts either a string or an object.
```json
{
"model": {
"default": "claude-sonnet-4.5",
"plan": "claude-opus-4.6",
"implement": "claude-sonnet-4.5",
"autopilot": "claude-sonnet-4.5"
}
}
```
All three options are backward-compatible — users who don't set per-mode overrides get the same behavior as today.
### Example prompts or workflows
1. **Planning with Opus, implementing with Sonnet** — A user configures `plan → claude-opus-4.6` and `implement → claude-sonnet-4.5`. They type a prompt in Plan mode and get a thorough, high-quality implementation plan from Opus. They press `Shift+Tab` to switch to Implement mode, and the CLI automatically activates Sonnet 4.5 — no `/model` command needed. They say "go ahead" and Sonnet executes the plan quickly.
2. **Rapid iteration loop** — A developer is debugging. They toggle to Plan mode (`Shift+Tab`) to get Opus to reason about a complex bug, then toggle back to Implement mode for Sonnet to apply the fix. Each toggle automatically switches the model, eliminating the two `/model` commands per cycle that are currently required.
3. **Autopilot with a cost-efficient model** — A user sets `autopilot → gpt-4.1` to conserve premium request quota on long-running autonomous tasks, while keeping `plan → claude-opus-4.6` for high-stakes architectural decisions.
4. **Team standardization** — A team shares a repository-level `.github/copilot-instructions.md` or config convention recommending specific models per mode. New team members get optimized defaults without having to learn which model works best for which task.
5. **Default-only users unaffected** — A user who never sets `mode_models` continues to use the single `model` value for all modes, exactly as today. Zero behavioral change for existing configurations.
### Additional context
- **Related issue:** #1355 — *"Improvements in model management"* requests a keyboard shortcut to switch models mid-prompt, shorter model names, and the ability to hide models from `/models`. "Improvements in model management" is complementary, and addresses ad-hoc model switching, while this proposal addresses *systematic* per-mode defaults that eliminate the need to switch at all.
- **Current config reference:** The `~/.copilot/config.json` file today supports `model` (string), `reasoning_effort`, `theme`, `banner`, `render_markdown`, `screen_reader`, and `trusted_folders`. Adding `mode_models` fits naturally alongside the existing schema.
- **CLI version:** 0.0.406 (macOS).
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.