feat(plan-phase): --research-phase flag + scrub stale slash-command refs (#3042, #3044) (#3045)

* feat(plan-phase): --research-phase flag absorbs deleted /gsd-research-phase + scrub stale refs (#3042, #3044)

#3042 (orphaned research-phase): /gsd-research-phase had a workflow file
but no slash-command stub. Rather than restore the orphan, the research-
only capability is now a flag on /gsd-plan-phase:

  /gsd-plan-phase --research-phase <N>

When set, the workflow scopes to phase N, runs the research step (Section
5 of the existing plan-phase workflow), then early-exits before the
planner/plan-checker/verifier chain.

Per RCA against the deleted standalone, the flag adds two modifiers to
fully cover the original surface (Option B from the RCA discussion):

- --view : print existing RESEARCH.md to stdout, no spawn. Cheapest mode
  for the correction-without-replanning loop the issue reporter
  explicitly called out. Errors with a clear hint if RESEARCH.md is
  missing.
- --research : reuse the existing "force re-research" semantics. In
  research-only mode this skips the existing-RESEARCH.md prompt and
  re-spawns unconditionally.
- Neither flag, RESEARCH.md exists : prompt update/view/skip. Mirrors
  the deleted standalone's existing-artifact menu (#3042 RCA).

#3044 (stale slash-command refs): scrubbed five deleted commands from
all user-facing surfaces, including English docs, 4 localized doc sets
(ja-JP, ko-KR, zh-CN, pt-BR), workflows, templates, and references.

  /gsd-check-todos          → /gsd-capture --list
  /gsd-new-workspace        → /gsd-workspace --new
  /gsd-status               → /gsd-progress
  /gsd-plan-milestone-gaps  → table rows / orphan sections removed
                              (PR #3038 only scrubbed workflows/agent;
                              missed the docs surfaces this PR covers)
  /gsd-research-phase       → /gsd-plan-phase --research-phase

Includes a fix to docs/issue-driven-orchestration.md (PR #3036)
which itself referenced /gsd-new-workspace 4 times — self-correction.

Removed:
- get-shit-done/workflows/research-phase.md (orphan, capability
  absorbed into --research-phase flag)

Tests:
- tests/bug-3042-3044-research-flag-and-stale-refs.test.cjs — 46
  structural-IR tests across both bugs:
  - argument-hint advertises --research-phase + --view
  - workflow parses --research-phase, sets RESEARCH_ONLY,
    early-exits before planner
  - --view prints RESEARCH.md without spawning
  - --research forces refresh in research-only mode
  - existing-RESEARCH.md prompt path with update/view/skip
  - workflows/research-phase.md is removed
  - 5 deleted slash-commands absent from 17 English user-facing
    surfaces + 16 localized doc surfaces (4 locales × 4 docs each)
  - replacement command tokens present where deleted ones lived

6950/6950 full suite pass. Lints clean.

Closes #3042
Closes #3044

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix: address all 8 CR findings on PR #3045

Major (3):
- get-shit-done/workflows/plan-phase.md:344 — added explicit early-exit
  guard at Section 5.1: "Skip if RESEARCH_ONLY=true". Without it, an LLM
  could fall through "use existing, skip to step 6" → planner spawn,
  violating the research-only contract. The guard makes the early-exit
  unreachable from any non-research-only branch.
- get-shit-done/references/continuation-format.md (3 examples) +
  zh-CN/.../continuation-format.md (3 examples) — pointed to
  `/gsd-plan-phase --research-phase` but docs/COMMANDS.md didn't
  document the flag. Added a full --research-phase + --view + --research
  modifier section to the /gsd-plan-phase flag table in COMMANDS.md so
  the canonical reference matches the continuation examples.

Minor (5):
- docs/FEATURES.md:1632 — `/gsd-plan-phase --research-phase` →
  `/gsd-plan-phase --research-phase <N>` (include required arg).
- get-shit-done/templates/README.md:46 — NN-VALIDATION.md producer
  reverted from `/gsd-plan-phase --research-phase` (Nyquist) to plain
  `/gsd-plan-phase` (Nyquist). VALIDATION.md is created during normal
  Nyquist flow, not research-only mode — the bulk replacement was
  wrong for that line.
- get-shit-done/workflows/help.md:89 — signature line was missing
  `--research`; added it alongside `--research-phase` and `--view`.
- tests/bug-3042-3044-...:197 — promptHasView/promptHasSkip were
  tautological (matched anywhere in 1700-line workflow). Tightened
  to a proximity check anchored on "RESEARCH.md already exists" prompt
  header within a 600-char window. Updated workflow to emit that
  literal phrase.
- tests/feat-2840-...:95 — workspace assertion used `/gsd-workspace`
  but the documented replacement is `/gsd-workspace --new`. Tightened
  to require both tokens (in 3 places: requiredCommands list, regex
  in conceptPairs, error message).

6950/6950 full suite pass. Lint clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-05-02 23:12:50 -04:00
committed by GitHub
parent dca12242b5
commit 1e6737cd8e
39 changed files with 502 additions and 203 deletions

View File

@@ -143,7 +143,7 @@ Would you like to:
1. Continue with current work
2. Add another todo
3. View all todos (/gsd-check-todos)
3. View all todos (/gsd-capture --list)
```
</step>

View File

@@ -37,8 +37,8 @@ Exit.
<step name="parse_filter">
Check for area filter in arguments:
- `/gsd-check-todos` → show all
- `/gsd-check-todos api` → filter to area:api only
- `/gsd-capture --list` → show all
- `/gsd-capture --list api` → filter to area:api only
</step>
<step name="list_todos">
@@ -56,7 +56,7 @@ Pending Todos:
---
Reply with a number to view details, or:
- `/gsd-check-todos [area]` to filter by area
- `/gsd-capture --list [area]` to filter by area
- `q` to exit
```

View File

@@ -36,7 +36,7 @@ fi
**Phase validation (before config gate):**
If `phase_found` is false, report error and exit:
```
Error: Phase ${PHASE_ARG} not found. Run /gsd-status to see available phases.
Error: Phase ${PHASE_ARG} not found. Run /gsd-progress to see available phases.
```
This runs BEFORE config gate check so user errors are surfaced immediately regardless of config state.

View File

@@ -35,7 +35,7 @@ fi
**Phase validation (before config gate):**
If `phase_found` is false, report error and exit:
```
Error: Phase ${PHASE_ARG} not found. Run /gsd-status to see available phases.
Error: Phase ${PHASE_ARG} not found. Run /gsd-progress to see available phases.
```
This runs BEFORE config gate check so user errors are surfaced immediately regardless of config state.

View File

@@ -4,7 +4,7 @@ Produces DISCOVERY.md (for Level 2-3) that informs PLAN.md creation.
Called from plan-phase.md's mandatory_discovery step with a depth parameter.
NOTE: For comprehensive ecosystem research ("how do experts build this"), use /gsd-research-phase instead, which produces RESEARCH.md.
NOTE: For comprehensive ecosystem research ("how do experts build this"), use /gsd-plan-phase --research-phase instead, which produces RESEARCH.md.
</purpose>
<depth_levels>

View File

@@ -80,10 +80,12 @@ Usage: `/gsd-discuss-phase 2`
Usage: `/gsd-discuss-phase 2 --batch`
Usage: `/gsd-discuss-phase 2 --batch=3`
**`/gsd-plan-phase <number> [--skip-research] [--gaps] [--skip-verify] [--tdd] [--mvp]`**
**`/gsd-plan-phase <number> [--research] [--skip-research] [--research-phase <N>] [--view] [--gaps] [--skip-verify] [--tdd] [--mvp]`**
Create detailed execution plan for a specific phase.
- `--skip-research` — bypass the research subagent
- `--research-phase <N>` — research-only mode. Spawns the research agent for phase `<N>`, writes `RESEARCH.md`, then exits before the planner runs. Useful for cross-phase research, doc review before committing to a planning approach, and correction-without-replanning loops. Replaces the deleted `gsd-research-phase` standalone command (#3042).
- Modifiers: `--research` forces refresh (re-spawn researcher, no prompt). `--view` prints existing `RESEARCH.md` to stdout without spawning. With neither, prompts `update / view / skip` if `RESEARCH.md` already exists.
- `--gaps` — focus only on closing gaps from a prior plan-check
- `--skip-verify` — skip the post-plan verifier loop
- `--tdd` — plan in test-driven order (tests before code)
@@ -95,6 +97,9 @@ Create detailed execution plan for a specific phase.
- Multiple plans per phase supported (XX-01, XX-02, etc.)
Usage: `/gsd-plan-phase 1`
Usage: `/gsd-plan-phase --research-phase 2` — research only on phase 2 (prompts if `RESEARCH.md` exists)
Usage: `/gsd-plan-phase --research-phase 2 --view` — print existing `RESEARCH.md`, no spawn
Usage: `/gsd-plan-phase --research-phase 2 --research` — force-refresh, no prompt
Result: Creates `.planning/phases/01-foundation/01-01-PLAN.md`
**PRD Express Path:** Pass `--prd path/to/requirements.md` to skip discuss-phase entirely. Your PRD becomes locked decisions in CONTEXT.md. Useful when you already have clear acceptance criteria.

View File

@@ -25,7 +25,7 @@ Parse JSON for: `workspace_base`, `workspaces`, `workspace_count`.
No workspaces found in ~/gsd-workspaces/
Create one with:
/gsd-new-workspace --name my-workspace --repos repo1,repo2
/gsd-workspace --new --name my-workspace --repos repo1,repo2
```
Done.

View File

@@ -73,7 +73,7 @@ Error:
No git repos found in the current directory and this is not a git repo.
Run this command from a directory containing git repos, or specify repos explicitly:
/gsd-new-workspace --name my-workspace --repos /path/to/repo1,/path/to/repo2
/gsd-workspace --new --name my-workspace --repos /path/to/repo1,/path/to/repo2
```
Exit.
@@ -84,7 +84,7 @@ Error:
Error: --auto requires --repos to specify which repos to include.
Usage:
/gsd-new-workspace --name my-workspace --repos repo1,repo2 --auto
/gsd-workspace --new --name my-workspace --repos repo1,repo2 --auto
```
Exit.

View File

@@ -54,7 +54,26 @@ Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_
## 2. Parse and Normalize Arguments
Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--skip-ui`, `--prd <filepath>`, `--reviews`, `--text`, `--bounce`, `--skip-bounce`, `--chunked`).
Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--research-phase <N>`, `--gaps`, `--skip-verify`, `--skip-ui`, `--prd <filepath>`, `--reviews`, `--text`, `--bounce`, `--skip-bounce`, `--chunked`).
**`--research-phase <N>` — research-only mode (#3042 + #3044).** When this flag is present, parse `<N>` as the phase number (overrides any positional phase argument), set `RESEARCH_ONLY=true`, and treat the rest of this workflow as a research-dispatch only — the planner spawn (step 8), plan-checker, verification, gaps, bounce, and post-planning-gaps blocks all skip on `RESEARCH_ONLY`. Use this for cross-phase research, doc review before committing to a planning approach, and correction-without-replanning loops. Replaces the deleted `/gsd-research-phase` command.
In research-only mode, two modifiers control behavior when `RESEARCH.md` already exists:
- **`--research`** — force-refresh re-research without prompting. Re-spawns the researcher unconditionally and overwrites the existing RESEARCH.md. (This is the existing `--research` flag's standard "force re-research" semantics, reused here.)
- **`--view`** — view-only: print existing `RESEARCH.md` to stdout, do **not** spawn the researcher. Sets `VIEW_ONLY=true`. Cheapest mode for the correction-without-replanning loop. If `RESEARCH.md` does not exist, error with a hint to drop `--view`.
```bash
RESEARCH_ONLY=false
VIEW_ONLY=false
if [[ "$ARGUMENTS" =~ --research-phase[[:space:]]+([0-9]+(\.[0-9]+)?) ]]; then
RESEARCH_ONLY=true
PHASE="${BASH_REMATCH[1]}"
fi
if $RESEARCH_ONLY && [[ "$ARGUMENTS" =~ (^|[[:space:]])--view([[:space:]]|$) ]]; then
VIEW_ONLY=true
fi
```
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 Claude Code remote sessions (`/rc` mode) where TUI menus don't work through the Claude App.
@@ -302,6 +321,27 @@ Pass `ai_spec_path` and `framework_line` to planner in step 7 so it can referenc
**Skip if:** `--gaps` flag or `--skip-research` flag or `--reviews` flag.
### 5.0. Research-Only Modifiers (`--view`, `--research`, prompt)
**Skip if:** `RESEARCH_ONLY` is `false`.
Three branches in research-only mode (`--research-phase <N>`):
1. **`--view`** (or user picks "View" in the prompt below): print `RESEARCH.md` to stdout, no spawn, exit. If `RESEARCH.md` is missing, error with: `--view requires an existing RESEARCH.md; drop --view to spawn the researcher.`
2. **`--research`** (force-refresh): re-spawn researcher unconditionally — fall through to "Spawn gsd-phase-researcher" below.
3. **Neither flag AND `has_research=true`:** emit `RESEARCH.md already exists for Phase ${PHASE}.` and prompt the user with three choices: `1. Update — re-spawn researcher and refresh RESEARCH.md`, `2. View — print existing RESEARCH.md and exit (no spawn)`, `3. Skip — exit without spawning or printing`. Map "Update" → fall through to spawn, "View" → set `VIEW_ONLY=true` and emit RESEARCH.md as in (1), "Skip" → exit cleanly. Mirrors the deleted `/gsd-research-phase` standalone's existing-artifact menu (#3042 parity).
```bash
if [[ "$VIEW_ONLY" == "true" ]]; then
[[ -f "$research_path" ]] || { echo "Error: --view requires an existing RESEARCH.md (Phase ${PHASE}). Drop --view to spawn the researcher."; exit 1; }
cat "$research_path"; exit 0
fi
```
### 5.1. Standard Research Decision
**Skip if** `RESEARCH_ONLY=true` (the research-only mode in 5.0 already determined the path: spawn or exit). Without this guard, an LLM following the workflow could fall through into "use existing, skip to step 6" → planner spawn, violating the research-only contract. **CR #3045 finding: this gate makes the early-exit unreachable from any non-research-only branch.**
**If `has_research` is true (from init) AND no `--research` flag:** Use existing, skip to step 6.
**If RESEARCH.md missing OR `--research` flag:**
@@ -398,6 +438,24 @@ Task(
- **`## RESEARCH COMPLETE`:** Display confirmation, continue to step 6
- **`## RESEARCH BLOCKED`:** Display blocker, offer: 1) Provide context, 2) Skip research, 3) Abort
### Research-Only Early Exit (`--research-phase`)
**Skip if:** `RESEARCH_ONLY` is `false` (the default).
**If `RESEARCH_ONLY=true`:** the user invoked `/gsd-plan-phase --research-phase <N>` for research-only mode. Do **not** continue to Section 5.5+ (validation strategy, planner, plan-checker, verification, gaps, bounce, post-planning-gaps). Print the research-complete summary and exit cleanly:
```text
✓ Research-only mode complete (#3042)
Phase: ${PHASE}
RESEARCH.md: ${research_path}
Re-run /gsd-plan-phase ${PHASE} to plan the phase using this research,
or /gsd-plan-phase ${PHASE} --research to refresh research and plan.
```
This exits the workflow. The planner / plan-checker / verifier blocks below are skipped.
## 5.5. Create Validation Strategy
Skip if `nyquist_validation_enabled` is false OR `research_enabled` is false.

View File

@@ -128,7 +128,7 @@ CONTEXT: [✓ if has_context | - if not]
- [e.g. jq -r '.blockers[].text' from state-snapshot]
## Pending Todos
- [count] pending — /gsd-check-todos to review
- [count] pending — /gsd-capture --list to review
## Active Debug Sessions
- [count] active — /gsd-debug to continue

View File

@@ -1,84 +0,0 @@
<purpose>
Research how to implement a phase. Spawns gsd-phase-researcher with phase context.
Standalone research command. For most workflows, use `/gsd-plan-phase` which integrates research automatically.
</purpose>
<available_agent_types>
Valid GSD subagent types (use exact names — do not fall back to 'general-purpose'):
- gsd-phase-researcher — Researches technical approaches for a phase
</available_agent_types>
<process>
## Step 0: Resolve Model Profile
@~/.claude/get-shit-done/references/model-profile-resolution.md
Resolve model for:
- `gsd-phase-researcher`
## Step 1: Normalize and Validate Phase
@~/.claude/get-shit-done/references/phase-argument-parsing.md
```bash
PHASE_INFO=$(gsd-sdk query roadmap.get-phase "${PHASE}")
```
If `found` is false: Error and exit.
## Step 2: Check Existing Research
```bash
ls .planning/phases/${PHASE}-*/RESEARCH.md 2>/dev/null || true
```
If exists: Offer update/view/skip options.
## Step 3: Gather Phase Context
```bash
INIT=$(gsd-sdk query init.phase-op "${PHASE}")
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
# Extract: phase_dir, padded_phase, phase_number, state_path, requirements_path, context_path
AGENT_SKILLS_RESEARCHER=$(gsd-sdk query agent-skills gsd-phase-researcher)
```
## Step 4: Spawn Researcher
```
Task(
prompt="<objective>
Research implementation approach for Phase {phase}: {name}
</objective>
<files_to_read>
- {context_path} (USER DECISIONS from /gsd-discuss-phase)
- {requirements_path} (Project requirements)
- {state_path} (Project decisions and history)
</files_to_read>
${AGENT_SKILLS_RESEARCHER}
<additional_context>
Phase description: {description}
</additional_context>
<output>
Write to: .planning/phases/${PHASE}-{slug}/${PHASE}-RESEARCH.md
</output>",
subagent_type="gsd-phase-researcher",
model="{researcher_model}"
)
```
> **ORCHESTRATOR RULE — CODEX RUNTIME**: After calling Task() above, stop working on this task immediately. Do not read more files, edit code, or run tests related to this task while the subagent is active. Wait for the subagent to return its result. This prevents duplicate work, conflicting edits, and wasted context. Only resume when the subagent result is available.
## Step 5: Handle Return
- `## RESEARCH COMPLETE` — Display summary, offer: Plan/Dig deeper/Review/Done
- `## CHECKPOINT REACHED` — Present to user, spawn continuation
- `## RESEARCH INCONCLUSIVE` — Show attempts, offer: Add context/Try different mode/Manual
</process>

View File

@@ -140,7 +140,7 @@ Present complete project status to user:
Resume with: Task tool (resume parameter with agent ID)
[If pending todos exist:]
📋 [N] pending todos — /gsd-check-todos to review
📋 [N] pending todos — /gsd-capture --list to review
[If blockers exist:]
⚠️ Carried concerns:
@@ -257,7 +257,7 @@ Based on user selection, route to appropriate workflow:
**Also available:**
- `/gsd-discuss-phase [N] ${GSD_WS}` — gather context first
- `/gsd-research-phase [N] ${GSD_WS}` — investigate unknowns
- `/gsd-plan-phase --research-phase [N] ${GSD_WS}` — investigate unknowns
---
```

View File

@@ -505,7 +505,7 @@ Exit skill and invoke SlashCommand("/gsd-discuss-phase [X+1] --auto ${GSD_WS}")
**Also available:**
- `/gsd-plan-phase [X+1] ${GSD_WS}` — skip discussion, plan directly
- `/gsd-research-phase [X+1] ${GSD_WS}` — investigate unknowns
- `/gsd-plan-phase --research-phase [X+1] ${GSD_WS}` — investigate unknowns
---
```
@@ -530,7 +530,7 @@ Exit skill and invoke SlashCommand("/gsd-discuss-phase [X+1] --auto ${GSD_WS}")
**Also available:**
- `/gsd-discuss-phase [X+1] ${GSD_WS}` — revisit context
- `/gsd-research-phase [X+1] ${GSD_WS}` — investigate unknowns
- `/gsd-plan-phase --research-phase [X+1] ${GSD_WS}` — investigate unknowns
---
```