Skip to content

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

Description

@Dokkabei97

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:
{
  "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 and oh-my-claude-code provide model routing for other CLI agents. Users could optimize for cost, speed, and capability per task.

  1. 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:
---
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.

  1. 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

Activity

  1. aaron-manning commented on Mar 7, 2026

    @aaron-manning

    It would be ideal to have feature parity and standardisation with how vscode handles this.

  2. added
    area:models
    on Apr 6, 2026
  3. added
    area:agents
    on Apr 6, 2026
  4. mrhoga commented on Apr 10, 2026

    @mrhoga

    Just found out that copilot cli is burning through my premium requests because it spawns Opus agents all the time though the frontmatter is requesting a different model for sub-agents 😱

  5. spencerbk commented on May 3, 2026

    @spencerbk

    +1 — still observable on Copilot CLI v1.0.40 (2026-05-01).

    Custom agent's .agent.md frontmatter model: claude-opus-4.7-xhigh and an explicit model="claude-opus-4.7-xhigh" argument on the task tool are both ignored when launching a sub-agent; the child runs on the parent session's model (observed gpt-5.5, also seen as claude-haiku-4.5 / claude-sonnet-4.5 under different parent sessions). #2939 was closed as "partially supported" but our reproduction shows the task dispatch path still routes inference to the parent's model. Full repro: https://github.com/spencerbk/copilot-config/blob/dev/docs/incidents/2026-05-02-copilot-cli-subagent-model-ignored.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentsarea:models

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions