github / github/copilot-cli

Model routing, per-agent model selection, and global hooks support

Đang mở
#1,354 3 bình luận 10 reaction 0 người được giao Xem trên GitHub
area:agents area:models
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

Copilot CLI lacks configurable model routing, per-subagent model selection (agent.md model field is ignored in CLI, see #980), and global hooks (~/.copilot/hooks/) support.

### Proposed solution

1. Configurable Model Routing
Add a model routing configuration (e.g., in ~/.copilot/config or a dedicated ~/.copilot/model-routing.json) that allows users to define rules for automatic model selection:
```json
{
"routing": {
"default": "claude-sonnet-4.5",
"rules": [
{
"when": { "agent": "explore" },
"model": "gpt-5-mini"
},
{
"when": { "agent": "task" },
"model": "gpt-5-mini"
},
{
"when": { "agent": "code-review" },
"model": "claude-opus-4.5"
},
{
"when": { "context": "planning" },
"model": "claude-opus-4.5"
}
]
}
}
```
This is similar to how tools like [oh-my-opencode](https://github.com/nicepkg/oh-my-opencode) and [oh-my-claude-code](https://github.com/nicepkg/oh-my-claude-code) provide model routing for other CLI agents. Users could optimize for cost, speed, and capability per task.

2. Respect model field in subagents
Honor the model frontmatter in custom agent definitions when running as subagents in the CLI, just as VS Code already does:
```markdown
---
name: quick-test
description: Run tests quickly with a fast model
model: gpt-5-mini
tools: ['execute']
---
```

Run the test suite and report results concisely.
When the main agent delegates to quick-test, the CLI should switch to gpt-5-mini for that subagent's execution context, then return to the parent model afterward. This enables cost-effective multi-agent orchestration.

3. Global Hooks
Support loading hooks from a global directory (~/.copilot/hooks/) in addition to the per-repository .github/hooks/. Global hooks should execute alongside (not replace) repository-level hooks, with a defined execution order (global first, then repo-local).
This enables:

Organization-wide security scanning before tool execution
Consistent audit logging across all projects
Shared pre/post-commit validation rules
Custom notification workflows

### Example prompts or workflows

_No response_

### Additional context

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.