Feature: Auto-select model and effort level based on task complexity
Problem
Currently, users must manually switch model (/model) and effort level (/effort) depending on task complexity. This creates friction — either you default to a powerful model and waste tokens on simple questions, or default to a lighter model and manually switch for complex tasks.
Proposed Solution
Allow Claude Code to automatically select (or interactively prompt the user to select) the appropriate model and effort level based on the complexity of the user's input.
Possible approaches:
- Auto-select: Use a lightweight classifier (e.g., Haiku) to evaluate the user's prompt and automatically set the model/effort before the main model processes it.
- Interactive prompt: Before each task, briefly prompt the user with a recommended model/effort choice based on the input, allowing them to confirm or override.
- Programmatic API: Expose model/effort switching via hooks or settings so that
UserPromptSubmithooks can dynamically adjust them. For example:
``json``
{
"hooks": {
"UserPromptSubmit": [{
"type": "command",
"command": "classify-and-set-model.sh"
}]
}
}
Use Case
- Simple Q&A, formatting, renaming → Sonnet + low effort
- Daily feature development, bug fixes → Sonnet + medium effort
- Architecture design, complex refactoring → Opus + high effort
Users shouldn't need to remember to switch manually — the tool should help optimize token consumption automatically.
Context
In a Go project with extensive documentation (4,827 lines of standards), session history analysis shows that model selection is one of the highest-leverage optimizations for token cost (20-40% savings). Currently there's no way to automate this via hooks or any other mechanism.
Showing cached comments. Read the full discussion on GitHub ↗
5 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Cowork Scheduled Tasks Use Case
Thanks for this detailed feature request. I'd like to add a complementary use case specific to Cowork scheduled tasks:
Problem
Cowork scheduled tasks that perform lightweight, repetitive monitoring/polling operations (e.g., GitHub issue monitoring, health checks, log analysis) currently consume the same tokens as complex reasoning tasks, since all tasks default to the main model (Sonnet/Opus).
Example: A GitHub issue monitor that runs every 4-6 hours does mostly API polling and simple classification:
This workload doesn't need Sonnet—Haiku would be sufficient and dramatically reduce cost.
Proposed Extension
Add per-task model configuration to
create_scheduled_task/update_scheduled_taskMCP tools:Or as a simpler alternative, expose model selection via task-level settings that can be read from a config file or environment variable.
Benefits
This would complement your "auto-select" approach by allowing explicit per-task control for known lightweight workloads.
there's no way to automate this via hooks" — I tested exactly this and can confirm it empirically. A
UserPromptSubmithook that rewrites.claude/settings.jsondoes not change the running session's model: the model is fixed for the lifetime of a session. The rewrite only takes effect on the next session start. So a live per-prompt classifier for the main thread isn't reachable from hooks today (which also matches why mid-session switching would be undesirable anyway — it invalidates the prompt cache).What is reachable without that: route at the seams Claude Code already has — per-subagent
model(you can pass it per invocation) and the per-projectmodelin settings.json. I built a small plugin around that idea (calibrate): instead of classifying every prompt, it analyzes the repo once and writes a per-project policy (which tier plans / codes / reviews / explores, with escalation rules for risky paths), then routes phase subagents through it. On one verified run it cut cost 46.8% vs all-Opus — modest sample, but the routing is confirmed against the session logs, not self-reported.Sharing mostly for the hooks finding, since it comes up whenever someone tries to build the per-prompt version. Happy to compare notes if anyone's going down this path.
+1 for this. We need a way for Claude Code to handle the switching of models based on task difficulty and intent.
yes this will help huge token saving