Skip to content

Commit 360f8d3

Browse files
committed
feat(coder): add /plan command for agent switching
Wires the new agent-switching slash command feature into the built-in coder agent: - Adds a planner sub-agent with read-only tools (filesystem, fetch, todo, user_prompt) - Adds /plan command on root agent to switch to plan mode - Adds symmetric /back command on planner agent to hand work back - Updates root instruction to mention the /plan command
1 parent f9e53e0 commit 360f8d3

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

pkg/config/builtin-agents/coder.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,30 @@ agents:
6464
- Information about error messages or issues you can't resolve from context alone
6565
Don't delegate for things you already know or can find in the local codebase.
6666
</librarian>
67+
68+
<planner>
69+
For non-trivial tasks where the user wants to design or plan before
70+
implementation, suggest the /plan command. It switches the conversation
71+
to the planner sub-agent, which gathers requirements and produces a
72+
step-by-step plan without writing code.
73+
</planner>
6774
skills: true
6875
add_date: true
6976
add_environment_info: true
7077
add_prompt_files:
7178
- AGENTS.md
7279
sub_agents:
7380
- librarian
81+
- planner
7482
toolsets:
7583
- type: filesystem
7684
- type: shell
7785
- type: todo
7886
- type: fetch
7987
commands:
88+
plan:
89+
description: "Switch to plan mode (planner sub-agent)"
90+
agent: planner
8091
commit:
8192
description: "Commit local changes with an appropriate message"
8293
instruction: |
@@ -127,6 +138,52 @@ agents:
127138
3. If any fail, analyze the failures, fix the code, and re-run
128139
4. Continue until all tests pass
129140
141+
planner:
142+
model: default
143+
description: Planning Agent
144+
instruction: |
145+
You are a planning agent. You gather requirements and produce a
146+
step-by-step plan before any code is written.
147+
148+
<workflow>
149+
1. **Clarify**: Ask the user focused questions to remove ambiguity.
150+
Prefer multiple-choice questions when possible. Don't guess.
151+
2. **Investigate**: Explore the codebase with read-only tools to
152+
understand the relevant code, conventions, and constraints.
153+
3. **Plan**: Produce a numbered, step-by-step plan in markdown.
154+
Identify the files to touch, the dependencies between steps, and
155+
any risks. Save the plan to a markdown file in the working
156+
directory when the user agrees with it.
157+
4. **Hand off**: Once the plan is approved, use /back to return to
158+
the root agent for execution. Mention the plan filename so the
159+
root agent can pick it up.
160+
</workflow>
161+
162+
<principles>
163+
- Do not write or edit code. You plan, the root agent executes.
164+
- Read the existing code before proposing changes — don't invent file
165+
paths or APIs.
166+
- Keep the plan concrete and actionable: each step should be small
167+
enough to verify on its own.
168+
- When you don't know something, delegate to the librarian sub-agent.
169+
</principles>
170+
add_date: true
171+
add_environment_info: true
172+
add_prompt_files:
173+
- AGENTS.md
174+
sub_agents:
175+
- root
176+
- librarian
177+
toolsets:
178+
- type: filesystem
179+
- type: fetch
180+
- type: todo
181+
- type: user_prompt
182+
commands:
183+
back:
184+
description: "Hand off back to the root coding agent"
185+
agent: root
186+
130187
librarian:
131188
model: haiku
132189
description: Web Researcher

0 commit comments

Comments
 (0)