Text mode (workflow.text_mode: true in config or --text flag): Set TEXT_MODE=true if --text is present in $ARGUMENTS OR text_mode from init JSON is true. When TEXT_MODE is active, replace every AskUserQuestion call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Gemini CLI, etc.) where AskUserQuestion is not available.
If $ARGUMENTS is empty, ask via AskUserQuestion:
What would you like to do? Describe the task, bug, or idea and I'll route it to the right GSD command.
Wait for response before continuing.
INIT=$(gsd-sdk query state.load 2>/dev/null)
Track whether .planning/ exists — some routes require it, others don't.
Evaluate $ARGUMENTS against these routing rules. Apply the first matching rule:
| If the text describes... |
Route to |
Why |
| Starting a new project, "set up", "initialize" |
/gsd-new-project |
Needs full project initialization |
| Mapping or analyzing an existing codebase |
/gsd-map-codebase |
Codebase discovery |
| A bug, error, crash, failure, or something broken |
/gsd-debug |
Needs systematic investigation |
| Spiking, "test if", "will this work", "experiment", "prove this out", validate feasibility |
/gsd-spike |
Throwaway experiment to validate feasibility |
| Sketching, "mockup", "what would this look like", "prototype the UI", "design this", explore visual direction |
/gsd-sketch |
Throwaway HTML mockups to explore design |
| Wrapping up spikes, "package the spikes", "consolidate spike findings" |
/gsd-spike-wrap-up |
Package spike findings into reusable skill |
| Wrapping up sketches, "package the designs", "consolidate sketch findings" |
/gsd-sketch-wrap-up |
Package sketch findings into reusable skill |
| Exploring, researching, comparing, or "how does X work" |
/gsd-research-phase |
Domain research before planning |
| Discussing vision, "how should X look", brainstorming |
/gsd-discuss-phase |
Needs context gathering |
| A complex task: refactoring, migration, multi-file architecture, system redesign |
/gsd-add-phase |
Needs a full phase with plan/build cycle |
| Planning a specific phase or "plan phase N" |
/gsd-plan-phase |
Direct planning request |
| Executing a phase or "build phase N", "run phase N" |
/gsd-execute-phase |
Direct execution request |
| Running all remaining phases automatically |
/gsd-autonomous |
Full autonomous execution |
| A review or quality concern about existing work |
/gsd-verify-work |
Needs verification |
| Checking progress, status, "where am I" |
/gsd-progress |
Status check |
| Resuming work, "pick up where I left off" |
/gsd-resume-work |
Session restoration |
| A note, idea, or "remember to..." |
/gsd-add-todo |
Capture for later |
| Adding tests, "write tests", "test coverage" |
/gsd-add-tests |
Test generation |
| Completing a milestone, shipping, releasing |
/gsd-complete-milestone |
Milestone lifecycle |
| A specific, actionable, small task (add feature, fix typo, update config) |
/gsd-quick |
Self-contained, single executor |
Requires .planning/ directory: All routes except /gsd-new-project, /gsd-map-codebase, /gsd-spike, /gsd-sketch, /gsd-help, and /gsd-join-discord. If the project doesn't exist and the route requires it, suggest /gsd-new-project first.
Ambiguity handling: If the text could reasonably match multiple routes, ask the user via AskUserQuestion with the top 2-3 options. For example:
"Refactor the authentication system" could be:
1. /gsd-add-phase — Full planning cycle (recommended for multi-file refactors)
2. /gsd-quick — Quick execution (if scope is small and clear)
Which approach fits better?
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GSD ► ROUTING
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
**Input:** {first 80 chars of $ARGUMENTS}
**Routing to:** {chosen command}
**Reason:** {one-line explanation}
Run the selected /gsd-* command, passing $ARGUMENTS as args.
If the chosen command expects a phase number and one wasn't provided in the text, extract it from context or ask via AskUserQuestion.
After invoking the command, stop. The dispatched command handles everything from here.
1---2name: do3description: Routes freeform user requests to the appropriate GSD command based on intent, confirming the routing before dispatching.4---5<purpose>6Analyze freeform text from the user and route to the most appropriate GSD command. This is a dispatcher — it never does the work itself. Match user intent to the best command, confirm the routing, and hand off.7</purpose>89<required_reading>10Read all files referenced by the invoking prompt's execution_context before starting.11</required_reading>1213<process>1415<step name="validate">16**Check for input.**171819**Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Gemini CLI, etc.) where `AskUserQuestion` is not available.20If `$ARGUMENTS` is empty, ask via AskUserQuestion:2122```23What would you like to do? Describe the task, bug, or idea and I'll route it to the right GSD command.24```2526Wait for response before continuing.27</step>2829<step name="check_project">30**Check if project exists.**3132```bash33INIT=$(gsd-sdk query state.load 2>/dev/null)34```3536Track whether `.planning/` exists — some routes require it, others don't.37</step>3839<step name="route">40**Match intent to command.**4142Evaluate `$ARGUMENTS` against these routing rules. Apply the **first matching** rule:4344| If the text describes... | Route to | Why |45|--------------------------|----------|-----|46| Starting a new project, "set up", "initialize" | `/gsd-new-project` | Needs full project initialization |47| Mapping or analyzing an existing codebase | `/gsd-map-codebase` | Codebase discovery |48| A bug, error, crash, failure, or something broken | `/gsd-debug` | Needs systematic investigation |49| Spiking, "test if", "will this work", "experiment", "prove this out", validate feasibility | `/gsd-spike` | Throwaway experiment to validate feasibility |50| Sketching, "mockup", "what would this look like", "prototype the UI", "design this", explore visual direction | `/gsd-sketch` | Throwaway HTML mockups to explore design |51| Wrapping up spikes, "package the spikes", "consolidate spike findings" | `/gsd-spike-wrap-up` | Package spike findings into reusable skill |52| Wrapping up sketches, "package the designs", "consolidate sketch findings" | `/gsd-sketch-wrap-up` | Package sketch findings into reusable skill |53| Exploring, researching, comparing, or "how does X work" | `/gsd-research-phase` | Domain research before planning |54| Discussing vision, "how should X look", brainstorming | `/gsd-discuss-phase` | Needs context gathering |55| A complex task: refactoring, migration, multi-file architecture, system redesign | `/gsd-add-phase` | Needs a full phase with plan/build cycle |56| Planning a specific phase or "plan phase N" | `/gsd-plan-phase` | Direct planning request |57| Executing a phase or "build phase N", "run phase N" | `/gsd-execute-phase` | Direct execution request |58| Running all remaining phases automatically | `/gsd-autonomous` | Full autonomous execution |59| A review or quality concern about existing work | `/gsd-verify-work` | Needs verification |60| Checking progress, status, "where am I" | `/gsd-progress` | Status check |61| Resuming work, "pick up where I left off" | `/gsd-resume-work` | Session restoration |62| A note, idea, or "remember to..." | `/gsd-add-todo` | Capture for later |63| Adding tests, "write tests", "test coverage" | `/gsd-add-tests` | Test generation |64| Completing a milestone, shipping, releasing | `/gsd-complete-milestone` | Milestone lifecycle |65| A specific, actionable, small task (add feature, fix typo, update config) | `/gsd-quick` | Self-contained, single executor |6667**Requires `.planning/` directory:** All routes except `/gsd-new-project`, `/gsd-map-codebase`, `/gsd-spike`, `/gsd-sketch`, `/gsd-help`, and `/gsd-join-discord`. If the project doesn't exist and the route requires it, suggest `/gsd-new-project` first.6869**Ambiguity handling:** If the text could reasonably match multiple routes, ask the user via AskUserQuestion with the top 2-3 options. For example:7071```72"Refactor the authentication system" could be:731. /gsd-add-phase — Full planning cycle (recommended for multi-file refactors)742. /gsd-quick — Quick execution (if scope is small and clear)7576Which approach fits better?77```78</step>7980<step name="display">81**Show the routing decision.**8283```84━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━85 GSD ► ROUTING86━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━8788**Input:** {first 80 chars of $ARGUMENTS}89**Routing to:** {chosen command}90**Reason:** {one-line explanation}91```92</step>9394<step name="dispatch">95**Invoke the chosen command.**9697Run the selected `/gsd-*` command, passing `$ARGUMENTS` as args.9899If the chosen command expects a phase number and one wasn't provided in the text, extract it from context or ask via AskUserQuestion.100101After invoking the command, stop. The dispatched command handles everything from here.102</step>103104</process>105106<success_criteria>107- [ ] Input validated (not empty)108- [ ] Intent matched to exactly one GSD command109- [ ] Ambiguity resolved via user question (if needed)110- [ ] Project existence checked for routes that require it111- [ ] Routing decision displayed before dispatch112- [ ] Command invoked with appropriate arguments113- [ ] No work done directly — dispatcher only114</success_criteria>