Skip to content

Commit a11a041

Browse files
committed
refactor: centralize sonnet model selection into plugin/rules/skill-models.md
1 parent fbef453 commit a11a041

34 files changed

Lines changed: 143 additions & 33 deletions

File tree

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"status": "open"
3-
}
2+
"status" : "closed",
3+
"resolution" : "implemented",
4+
"target_branch" : "v2.1"
5+
}

.cat/issues/v2/v2.1/refactor-sonnet-model-fallback/plan.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,95 @@ Affected skills (currently `model: sonnet`):
5151
- [ ] No SKILL.md file under `plugin/skills/` contains `model: sonnet` in frontmatter
5252
- [ ] `plugin/rules/skill-models.md` exists and lists all 31 previously-Sonnet skills with preference order [sonnet, opus]
5353
- [ ] E2E verification: invoke a skill that previously had `model: sonnet` and confirm the agent selects the correct model based on `plugin/rules/skill-models.md`
54+
55+
## Sub-Agent Waves
56+
57+
### Wave 1
58+
59+
- **Step 1: Create `plugin/rules/skill-models.md`**
60+
61+
Create a new file at `plugin/rules/skill-models.md` with the following exact content:
62+
63+
Line 1: `---`
64+
Line 2: `mainAgent: true`
65+
Line 3: `---`
66+
Line 4: `## Model Selection for Skills`
67+
Line 5: (blank)
68+
Line 6: `When invoking skills via the Skill tool or spawning subagents via the Agent/Task tool, use the following model`
69+
Line 7: `preference:`
70+
Line 8: (blank)
71+
Line 9: `**Sonnet-preferred skills** (use `model: sonnet` by default, fall back to `model: opus` if Sonnet is rate-limited):`
72+
Line 10: (blank)
73+
Then list all 31 skills as markdown bullet items (e.g., `- `+backtick+`cat:add-agent`+backtick)
74+
After the list:
75+
(blank line)
76+
`**Fallback behavior:** If Sonnet returns a rate-limit error, retry the same skill invocation using Opus. Do not`
77+
`ask the user before falling back — rate-limit fallback is automatic.`
78+
(blank line)
79+
`**Skills not listed above** use their SKILL.md `model:` frontmatter (typically `haiku` for lightweight tasks).`
80+
`Do not override their model selection.`
81+
82+
Note: Files in `plugin/rules/` are exempt from license headers per `.claude/rules/license-header.md`.
83+
84+
- **Step 2: Remove `model: sonnet` from all 31 SKILL.md files**
85+
86+
For each of the following 31 SKILL.md files, remove the line `model: sonnet` from the YAML frontmatter. Leave all
87+
other frontmatter fields intact. The files are:
88+
89+
1. `plugin/skills/add-agent/SKILL.md`
90+
2. `plugin/skills/decompose-issue-agent/SKILL.md`
91+
3. `plugin/skills/empirical-test-agent/SKILL.md`
92+
4. `plugin/skills/git-merge-linear-agent/SKILL.md`
93+
5. `plugin/skills/git-rebase-agent/SKILL.md`
94+
6. `plugin/skills/git-rewrite-history-agent/SKILL.md`
95+
7. `plugin/skills/git-squash-agent/SKILL.md`
96+
8. `plugin/skills/init/SKILL.md`
97+
9. `plugin/skills/instruction-builder-agent/SKILL.md`
98+
10. `plugin/skills/instruction-organizer-agent/SKILL.md`
99+
11. `plugin/skills/learn/SKILL.md`
100+
12. `plugin/skills/learn-agent/SKILL.md`
101+
13. `plugin/skills/optimize-execution/SKILL.md`
102+
14. `plugin/skills/optimize-execution-agent/SKILL.md`
103+
15. `plugin/skills/plan-builder-agent/SKILL.md`
104+
16. `plugin/skills/rebase-impact-agent/SKILL.md`
105+
17. `plugin/skills/recover-from-drift-agent/SKILL.md`
106+
18. `plugin/skills/research-agent/SKILL.md`
107+
19. `plugin/skills/retrospective-agent/SKILL.md`
108+
20. `plugin/skills/safe-remove-code-agent/SKILL.md`
109+
21. `plugin/skills/skill-comparison-agent/SKILL.md`
110+
22. `plugin/skills/stakeholder-review-agent/SKILL.md`
111+
23. `plugin/skills/tdd-implementation-agent/SKILL.md`
112+
24. `plugin/skills/verify-implementation-agent/SKILL.md`
113+
25. `plugin/skills/work-agent/SKILL.md`
114+
26. `plugin/skills/work-confirm-agent/SKILL.md`
115+
27. `plugin/skills/work-implement-agent/SKILL.md`
116+
28. `plugin/skills/work-merge-agent/SKILL.md`
117+
29. `plugin/skills/work-prepare-agent/SKILL.md`
118+
30. `plugin/skills/work-review-agent/SKILL.md`
119+
31. `plugin/skills/work-with-issue-agent/SKILL.md`
120+
121+
**How to remove:** For each file, read the file, find the line `model: sonnet`, and remove that entire line.
122+
Do NOT remove `model: haiku` lines (those belong to different skills and are not affected).
123+
Do NOT add any blank lines where the removed line was. Do NOT modify any other frontmatter fields.
124+
125+
- **Step 3: Verify no `model: sonnet` remains**
126+
127+
Run: `grep -rl "model: sonnet" plugin/skills/`
128+
129+
Expected output: no matches. If any matches remain, fix them.
130+
131+
- **Step 4: Run tests**
132+
133+
Run: `mvn -f client/pom.xml test`
134+
135+
All tests must pass.
136+
137+
- **Step 5: Update index.json**
138+
139+
Update the issue's `index.json` to set `status` to `closed`.
140+
141+
- **Step 6: Commit**
142+
143+
Commit all changes with message: `refactor: centralize sonnet model selection into plugin/rules/skill-models.md`
144+
145+
Commit type is `refactor:` because this restructures model selection without changing user-visible behavior.

plugin/rules/skill-models.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
mainAgent: true
3+
---
4+
## Model Selection for Skills
5+
6+
When invoking skills via the Skill tool or spawning subagents via the Agent/Task tool, use the following model
7+
preference:
8+
9+
**Sonnet-preferred skills** (use `model: sonnet` by default, fall back to `model: opus` if Sonnet is rate-limited):
10+
11+
- `cat:add-agent`
12+
- `cat:decompose-issue-agent`
13+
- `cat:empirical-test-agent`
14+
- `cat:git-merge-linear-agent`
15+
- `cat:git-rebase-agent`
16+
- `cat:git-rewrite-history-agent`
17+
- `cat:git-squash-agent`
18+
- `cat:init`
19+
- `cat:instruction-builder-agent`
20+
- `cat:instruction-organizer-agent`
21+
- `cat:learn`
22+
- `cat:learn-agent`
23+
- `cat:optimize-execution`
24+
- `cat:optimize-execution-agent`
25+
- `cat:plan-builder-agent`
26+
- `cat:rebase-impact-agent`
27+
- `cat:recover-from-drift-agent`
28+
- `cat:research-agent`
29+
- `cat:retrospective-agent`
30+
- `cat:safe-remove-code-agent`
31+
- `cat:skill-comparison-agent`
32+
- `cat:stakeholder-review-agent`
33+
- `cat:tdd-implementation-agent`
34+
- `cat:verify-implementation-agent`
35+
- `cat:work-agent`
36+
- `cat:work-confirm-agent`
37+
- `cat:work-implement-agent`
38+
- `cat:work-merge-agent`
39+
- `cat:work-prepare-agent`
40+
- `cat:work-review-agent`
41+
- `cat:work-with-issue-agent`
42+
43+
**Fallback behavior:** If Sonnet returns a rate-limit error, retry the same skill invocation using Opus. Do not
44+
ask the user before falling back — rate-limit fallback is automatic.
45+
46+
**Skills not listed above** use their SKILL.md `model:` frontmatter (typically `haiku` for lightweight tasks).
47+
Do not override their model selection.

plugin/skills/add-agent/SKILL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ description: >
44
Use when user says "add an issue", "add a new issue", "create a new issue", "new issue for", or "I need to track".
55
IMPORTANT: After invoking this skill, forward the AskUserQuestion tool call verbatim — do not respond
66
conversationally.
7-
model: sonnet
87
allowed-tools:
98
- Read
109
- Write

plugin/skills/decompose-issue-agent/SKILL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
description: Use when an issue is too large or needs breaking down - split into smaller, manageable issues
3-
model: sonnet
43
user-invocable: false
54
argument-hint: "<cat_agent_id>"
65
---

plugin/skills/empirical-test-agent/SKILL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ description: >
33
Empirically test agent compliance with controlled experiments.
44
Trigger words: "test compliance", "run empirical test", "verify agent behavior".
55
Use for validating agent adherence to instructions and guidelines.
6-
model: sonnet
76
user-invocable: false
87
argument-hint: "<cat_agent_id>"
98
---

plugin/skills/git-merge-linear-agent/SKILL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
description: Use when merging a branch with linear history - merge, rebase onto main, linear merge
3-
model: sonnet
43
user-invocable: false
54
allowed-tools: Bash, Read
65
argument-hint: "<cat_agent_id>"

plugin/skills/git-rebase-agent/SKILL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
description: "MANDATORY: Use instead of `git rebase` - provides automatic backup and conflict recovery"
3-
model: sonnet
43
user-invocable: false
54
argument-hint: "<cat_agent_id>"
65
---

plugin/skills/git-rewrite-history-agent/SKILL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
description: "MANDATORY: Use instead of git filter-branch - git filter-repo with Python detection and on-demand binary download"
3-
model: sonnet
43
user-invocable: false
54
argument-hint: "<cat_agent_id>"
65
---

plugin/skills/git-squash-agent/SKILL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
description: "MANDATORY: Use instead of `git rebase -i` or `git reset --soft` for squashing - unified commit messages"
3-
model: sonnet
43
user-invocable: false
54
argument-hint: "<cat_agent_id>"
65
---

0 commit comments

Comments
 (0)