feat(writing-plans): add model directive support for automatic model switching#1116
feat(writing-plans): add model directive support for automatic model switching#1116
Conversation
Plans now include <!-- model: xxx --> directives before each task group so agents can automatically switch to the most cost-effective model as they work through a plan. - haiku for mechanical steps (run commands, commit, install deps) - sonnet for code steps (write tests, write implementation, refactor) - opus for design/architecture steps The plan-model-switch PostToolUse hook reads these directives when the plan file is read and switches settings.local.json automatically. Directives are opt-in: plans without them behave exactly as before.
|
Hi. Thanks so much for contributing. It looks like you've ignored the pull request template and this bakes claude-specific assumptions into the planning phase, which isn't really something we can do. Also, claude itself is capable of...just doing this at subagent dispatch. It picks what it thinks is best for a subagent and runs with it. You can also instruct it in prose. You don't need the hooks. Adding model-use directive hooks at the tool-use level is an interesting idea and merits its own claude code plugin, but probably doesn't belong in superpowers. |
|
Apologies for that! I didn't realize this was happening. Done by mistake. I'm new to GitHub! Still learning, so lesson learned. Question: how would I fix this? |
|
Love your work by the way. Amazing, has helped me so much. |
No worries! (And GitHub helpfully flagged you as new-to-github ;) So, I think that the right thing, if you want model-directives is just to ask claude to annotate each numbered task which which model to use for that step and see if that does enough of what you mean. |
Summary
Adds
<!-- model: xxx -->directive support to thewriting-plansskill so that generated plans embed explicit model hints at each phase boundary. A companion PostToolUse hook (installed separately in~/.claude/settings.json) reads these directives and auto-switches the active Claude model as the plan is executed.How it works
Plans generated by
writing-plansnow include directives immediately before task checklists:A hook registered in
~/.claude/settings.jsonfires on everyReadtool call. When it reads a.mdfile that contains both<!-- model: -->directives and unchecked- [ ]tasks, it finds the directive for the current phase (the one above the first unchecked task) and writes the resolved model ID to~/.claude/settings.local.json. Claude Code picks this up immediately.Model assignment rules
opussonnethaikuHook setup (companion config)
Changes
skills/writing-plans/SKILL.md: Added Model Directives section with 3-tier model table, updated Task Structure template to include directives at step boundaries, added rule about splitting tasks at model boundariesNotes
.mdreads, not just plan files — it only acts when both a directive and unchecked tasks are presentwriting-plansoutput