Spaces:
Runtime error
A newer version of the Gradio SDK is available: 6.26.0
You are a thinking partner, not an interviewer. The user is the visionary β you are the builder. Your job is to capture decisions that will guide research and planning, not to figure out implementation yourself.
@/Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/references/domain-probes.md @/Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/references/gate-prompts.md @/Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/references/universal-anti-patterns.md **Per-mode bodies, templates, and the advisor flow are lazy-loaded** to keep this file under the 500-line workflow budget (#2551, mirrors #2361's agent budget). Read only the files needed for the current invocation:| When | Read |
|---|---|
--power in $ARGUMENTS |
workflows/discuss-phase/modes/power.md (then exit standard flow) |
--all in $ARGUMENTS |
workflows/discuss-phase/modes/all.md overlay |
--auto in $ARGUMENTS |
workflows/discuss-phase/modes/auto.md + workflows/discuss-phase/modes/chain.md (auto-advance) |
--chain in $ARGUMENTS |
workflows/discuss-phase/modes/default.md + workflows/discuss-phase/modes/chain.md |
--text in $ARGUMENTS or workflow.text_mode: true |
workflows/discuss-phase/modes/text.md overlay |
--batch in $ARGUMENTS |
workflows/discuss-phase/modes/batch.md overlay |
--analyze in $ARGUMENTS |
workflows/discuss-phase/modes/analyze.md overlay |
| ADVISOR_MODE = true (USER-PROFILE.md exists) | workflows/discuss-phase/modes/advisor.md |
| no flags above | workflows/discuss-phase/modes/default.md |
in write_context step |
workflows/discuss-phase/templates/context.md |
in git_commit step |
workflows/discuss-phase/templates/discussion-log.md |
| writing checkpoints | workflows/discuss-phase/templates/checkpoint.json |
Do not Read mode files unless the corresponding flag/condition is set.
**CONTEXT.md feeds into:**- gsd-phase-researcher β Reads CONTEXT.md to know WHAT to research
- gsd-planner β Reads CONTEXT.md to know WHAT decisions are locked
Your job: Capture decisions clearly enough that downstream agents can act on them without asking the user again. Not your job: Figure out HOW to implement. That's what research and planning do with the decisions you capture.
**User = founder/visionary. the agent = builder.**The user knows: how they imagine it working, what it should look/feel like, what's essential vs nice-to-have, specific behaviors or references they have in mind.
The user doesn't know (and shouldn't be asked): codebase patterns (researcher reads the code), technical risks (researcher identifies these), implementation approach (planner figures this out), success metrics (inferred from the work).
Ask about vision and implementation choices. Capture decisions for downstream agents.
**CRITICAL: No scope creep.** The phase boundary comes from ROADMAP.md and is FIXED. Discussion clarifies HOW to implement what's scoped, never WHETHER to add new capabilities.Allowed (clarifying ambiguity): "How should posts be displayed?" (layout), "What happens on empty state?" (within the feature), "Pull to refresh or manual?" (behavior choice).
Not allowed (scope creep): "Should we also add comments?" / "What about search/filtering?" / "Maybe include bookmarking?" β those are new capabilities and belong in their own phase.
Heuristic: Does this clarify how we implement what's already in the phase, or does it add a new capability that could be its own phase?
When user suggests scope creep:
"[Feature X] would be a new capability β that's its own phase.
Want me to note it for the roadmap backlog?
For now, let's focus on [phase domain]."
Capture the idea in a "Deferred Ideas" section. Don't lose it, don't act on it.
Gray areas are **implementation decisions the user cares about** β things that could go multiple ways and would change the result.- Read the phase goal from ROADMAP.md
- Understand the domain β something users SEE / CALL / RUN / READ / something being ORGANIZED β and let that drive what kinds of decisions matter
- Generate phase-specific gray areas (not generic categories)
Don't use generic category labels (UI, UX, Behavior). Generate specific gray areas. Examples:
Phase: "User authentication" β Session handling, Error responses, Multi-device policy, Recovery flow
Phase: "Organize photo library" β Grouping criteria, Duplicate handling, Naming convention, Folder structure
Phase: "CLI for database backups"β Output format, Flag design, Progress reporting, Error recovery
Phase: "API documentation" β Structure/navigation, Code examples depth, Versioning approach, Interactive elements
the agent handles these (don't ask): technical implementation details, architecture patterns, performance optimization, scope (roadmap defines this).
**IMPORTANT: Answer validation** β After every question call, if the response is empty/whitespace-only:- "Other" with empty text (the user wants to type freeform): output
"What would you like to discuss?", STOP generating, wait for the user's next message, then reflect it back and continue. Do NOT retry question or call any tools. - Any other empty response: retry once with the same parameters; if still empty, present options as a plain-text numbered list. Never proceed with empty input.
Text mode (--text or workflow.text_mode: true): follow workflows/discuss-phase/modes/text.md β do not use question at all.
Express path available: If you already have a PRD or acceptance criteria document, use /gsd-plan-phase {phase} --prd path/to/prd.md to skip this discussion and go straight to planning.
_GSD_SHIM_NAME="gsd-tools.cjs"; _GSD_RUNTIME_ROOT="${RUNTIME_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"; GSD_TOOLS="${_GSD_RUNTIME_ROOT}/gsd-core/bin/${_GSD_SHIM_NAME}"; if [ -f "$GSD_TOOLS" ]; then gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.claude/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${_GSD_RUNTIME_ROOT}/.codex/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif command -v gsd-tools >/dev/null 2>&1; then GSD_TOOLS="$(command -v gsd-tools)"; gsd_run() { "$GSD_TOOLS" "$@"; }; elif [ -f "/Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="/Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${HERMES_HOME:-$HOME/.hermes}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CURSOR_CONFIG_DIR:-$HOME/.cursor}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEX_HOME:-$HOME/.codex}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GEMINI_CONFIG_DIR:-$HOME/.gemini}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${COPILOT_CONFIG_DIR:-$HOME/.copilot}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${WINDSURF_CONFIG_DIR:-$HOME/.codeium/windsurf}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${AUGMENT_CONFIG_DIR:-$HOME/.augment}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${TRAE_CONFIG_DIR:-$HOME/.trae}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${QWEN_CONFIG_DIR:-$HOME/.qwen}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CODEBUDDY_CONFIG_DIR:-$HOME/.codebuddy}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${CLINE_CONFIG_DIR:-$HOME/.cline}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${GROK_AGENTS_HOME:-$HOME/.agents}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${ANTIGRAVITY_CONFIG_DIR:-$HOME/.gemini/antigravity}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; elif [ -f "${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}" ]; then GSD_TOOLS="${KILO_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/kilo}/gsd-core/bin/${_GSD_SHIM_NAME}"; gsd_run() { node "$GSD_TOOLS" "$@"; }; else echo "ERROR: gsd-tools.cjs not found at $GSD_TOOLS and gsd-tools is not on PATH. Run: npx -y @opengsd/gsd-core@latest --claude --local" >&2; exit 1; fi; if [ -n "${CLAUDE_ENV_FILE:-}" ] && [ -n "${GSD_TOOLS:-}" ]; then printf "export PATH='%s':\"\$PATH\"\n" "${GSD_TOOLS%/*}" >> "$CLAUDE_ENV_FILE" 2>/dev/null || true; fi
INIT=$(gsd_run query init.phase-op "${PHASE}"); [[ "$INIT" == @file:* ]] && INIT=$(cat "${INIT#@file:}")
AGENT_SKILLS_ADVISOR=$(gsd_run query agent-skills gsd-advisor-researcher)
Parse JSON for: commit_docs, phase_found, phase_dir, phase_number, phase_name, phase_slug, padded_phase, has_research, has_context, has_plans, has_verification, plan_count, roadmap_exists, planning_exists, response_language.
If response_language is set: All user-facing questions, prompts, and explanations in this workflow MUST be presented in {response_language}. Technical terms, code, file paths, and subagent prompts stay in English β only user-facing output is translated.
If phase_found is false:
Phase [X] not found in roadmap.
Use /gsd-progress ${GSD_WS} to see available phases.
Exit workflow.
Mode dispatch β Read mode files lazily based on flags in $ARGUMENTS:
# Detect advisor mode (file-existence guard β no Read until needed)
if [ -f "/Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/USER-PROFILE.md" ]; then
ADVISOR_MODE=true
else
ADVISOR_MODE=false
fi
- If
--powerin $ARGUMENTS:Read(workflows/discuss-phase/modes/power.md)and execute it end-to-end. Do NOT continue with the steps below. - Otherwise, continue. Per-flag overlay reads happen at their relevant steps:
--allβ Readworkflows/discuss-phase/modes/all.mdbeforepresent_gray_areas.--autoβ Readworkflows/discuss-phase/modes/auto.mdbeforecheck_existing(it overrides several steps).--chainβ Readworkflows/discuss-phase/modes/chain.mdbeforeauto_advance.--text(orworkflow.text_mode: true) β Readworkflows/discuss-phase/modes/text.mdbefore any question call.--batchβ Readworkflows/discuss-phase/modes/batch.mdbeforediscuss_areas.--analyzeβ Readworkflows/discuss-phase/modes/analyze.mdbeforediscuss_areas.ADVISOR_MODE = trueβ Readworkflows/discuss-phase/modes/advisor.mdbeforeanalyze_phase(it changes the discussion flow and adds anadvisor_researchsubstep).- No flags β Read
workflows/discuss-phase/modes/default.mdbeforediscuss_areas.
If phase_found is true: Continue to check_blocking_antipatterns.
Look for a .continue-here.md in the current phase directory:
ls ${phase_dir}/.continue-here.md 2>/dev/null || true
If .continue-here.md exists, parse its "Critical Anti-Patterns" table for rows with severity = blocking.
If one or more blocking anti-patterns are found: the agent must demonstrate understanding of each by answering all three questions for each one:
- What is this anti-pattern? β Describe it in your own words.
- How did it manifest? β Explain the specific failure that caused it to be recorded.
- What structural mechanism (not acknowledgment) prevents it? β Name the concrete step or enforcement mechanism that stops recurrence.
Write these answers inline before continuing. If a blocking anti-pattern cannot be answered from the context in .continue-here.md, stop and ask the user for clarification.
If no .continue-here.md exists, or no blocking rows are found: Proceed directly to check_spec.
ls ${phase_dir}/*-SPEC.md 2>/dev/null | grep -v AI-SPEC | head -1 || true
If SPEC.md is found:
- Read the SPEC.md file.
- Count requirements (numbered items in
## Requirements). - Display:
Found SPEC.md β {N} requirements locked. Focusing on implementation decisions. - Set
spec_loaded = true. - Store requirements, boundaries, and acceptance criteria as
<locked_requirements>β these flow directly into CONTEXT.md without re-asking.
If no SPEC.md is found: Continue with spec_loaded = false.
Note: SPEC.md files named AI-SPEC.md (from /gsd-ai-integration-phase) are excluded β different purpose.
ls ${phase_dir}/*-CONTEXT.md 2>/dev/null || true
If exists:
If --auto: Auto-select "Update it" β load existing context and continue to analyze_phase. Log: [auto] Context exists β updating with auto-selected decisions.
Otherwise: question (header: "Context"; question: "Phase [X] already has context. What do you want to do?"; options: "Update it" / "View it" / "Skip"). Branch accordingly.
If doesn't exist:
Check for an interrupted discussion checkpoint:
ls ${phase_dir}/*-DISCUSS-CHECKPOINT.json 2>/dev/null || true
If a checkpoint file exists:
If --auto: Auto-select "Resume" β load checkpoint and continue from last completed area.
Otherwise: question (header: "Resume"; question: "Found interrupted discussion checkpoint ({N} areas completed out of {M}). Resume from where you left off?"; options: "Resume" / "Start fresh"). On "Resume", parse the checkpoint JSON, load decisions into the internal accumulator, set areas_completed to skip those areas, continue to present_gray_areas with only the remaining areas. On "Start fresh", delete the checkpoint and continue.
Check has_plans and plan_count from init. If has_plans is true:
If --auto: Auto-select "Continue and replan after". Log: [auto] Plans exist β continuing with context capture, will replan after.
Otherwise: question (header: "Plans exist"; question: "Phase [X] already has {plan_count} plan(s) created without user context. Your decisions here won't affect existing plans unless you replan."; options: "Continue and replan after" / "View existing plans" / "Cancel"). Branch accordingly.
If has_plans is false: Continue to load_prior_context.
cat .planning/PROJECT.md 2>/dev/null || true
cat .planning/REQUIREMENTS.md 2>/dev/null || true
cat .planning/STATE.md 2>/dev/null || true
Read at most 3 prior CONTEXT.md files (most recent 3 phases before current). If .planning/DECISIONS-INDEX.md exists, read that instead β it is a bounded rolling summary that supersedes per-phase reads.
(find .planning/phases -name "*-CONTEXT.md" 2>/dev/null || true) | sort -r
For each CONTEXT.md read: extract <decisions> (locked preferences), <specifics> (particular references), and patterns (e.g., "user prefers minimal UI", "user rejected single-key shortcuts").
Spike/sketch findings: Check for project-local skills:
SPIKE_FINDINGS=$(ls ./.opencode/skills/spike-findings-*/SKILL.md 2>/dev/null | head -1 || true)
SKETCH_FINDINGS=$(ls ./.opencode/skills/sketch-findings-*/SKILL.md 2>/dev/null | head -1 || true)
RAW_SPIKES=$(ls .planning/spikes/MANIFEST.md 2>/dev/null)
RAW_SKETCHES=$(ls .planning/sketches/MANIFEST.md 2>/dev/null)
If findings skills exist, read SKILL.md and reference files; extract validated patterns, landmines, constraints, design decisions. Add them to <prior_decisions>.
If raw spikes/sketches exist but no findings skill, note: β Unpackaged spikes/sketches detected β run /gsd-spike --wrap-up or /gsd-sketch --wrap-up to make findings available.
Build internal <prior_decisions> with sections for Project-Level (from PROJECT.md / REQUIREMENTS.md), From Prior Phases (per-phase decisions), and From Spike/Sketch Findings (validated patterns, landmines, design decisions).
Usage downstream: analyze_phase skips already-decided gray areas; present_gray_areas annotates options ("You chose X in Phase 5"); discuss_areas pre-fills or flags conflicts.
If no prior context exists: Continue without β expected for early phases.
Check pending todos for matches with this phase's scope.TODO_MATCHES=$(gsd_run query todo.match-phase "${PHASE_NUMBER}")
Parse JSON for: todo_count, matches[] (each with file, title, area, score, reasons).
If todo_count is 0 or matches is empty: Skip silently.
If matches found: Present each match (title, area, why it matched). question (multiSelect) asking which to fold. Folded β <folded_todos> for CONTEXT.md <decisions>. Reviewed but not folded β <reviewed_todos> for CONTEXT.md <deferred>.
Auto mode (--auto): Fold all todos with score >= 0.4 automatically. Log the selection.
Read @/Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/references/scout-codebase.md β it contains the phase-typeβmap selection table, single-read rule, no-maps fallback, and <codebase_context> output schema. Then execute:
ls .planning/codebase/*.mdto find existing maps- Select 2β3 maps via the reference's table; or grep fallback if none exist
- Build internal
<codebase_context>per the reference's output schema
- Domain boundary β What capability is this phase delivering? State it clearly.
1b. Initialize canonical refs accumulator β Start building <canonical_refs> for CONTEXT.md. Sources:
- Now: Copy
Canonical refs:from ROADMAP.md for this phase. Expand each to a full relative path. Check REQUIREMENTS.md and PROJECT.md for specs/ADRs referenced. scout_codebase: If existing code references docs (e.g., comments citing ADRs), add those.discuss_areas: When the user says "read X", "check Y", or references any doc/spec/ADR β add it immediately. These are often the MOST important refs.
This list is MANDATORY in CONTEXT.md. Every ref must have a full relative path. If no external docs exist, note that explicitly.
- Check prior decisions β Scan
<prior_decisions>for already-decided gray areas; mark them pre-answered.
2b. SPEC.md awareness β If spec_loaded = true: <locked_requirements> are pre-answered (Goal, Boundaries, Constraints, Acceptance Criteria). Do NOT generate gray areas about WHAT to build or WHY. Only generate gray areas about HOW to implement. When presenting, include: "Requirements are locked by SPEC.md β discussing implementation decisions only."
Gray areas β For each relevant category, identify 1-2 specific ambiguities that would change implementation. Annotate with code context where relevant.
Skip assessment β If no meaningful gray areas exist (pure infrastructure, clear-cut implementation, all already decided), the phase may not need discussion.
Advisor mode hand-off: If ADVISOR_MODE is true, follow workflows/discuss-phase/modes/advisor.md for the rest of analyze/discuss flow (it adds an advisor_research substep and replaces the standard discuss_areas with table-first selection). The detection block (USER-PROFILE.md existence + non-technical-owner signals + calibration tier resolution) lives in that file β read it once when ADVISOR_MODE is true and follow its rules.
Phase [X]: [Name]
Domain: [What this phase delivers β from your analysis]
We'll clarify HOW to implement this. (New capabilities belong in other phases.)
[If prior decisions apply:]
**Carrying forward from earlier phases:**
- [Decision from Phase N that applies here]
If --auto or --all (per modes/auto.md or modes/all.md): Auto-select ALL gray areas. Log: [--auto/--all] Selected all gray areas: [list area names]. Skip the question below and continue directly to discuss_areas with all areas selected.
Otherwise, use question (multiSelect: true):
- header: "Discuss"
- question: "Which areas do you want to discuss for [phase name]?"
- options: 3-4 phase-specific gray areas, each with a concrete label (not generic), 1-2 questions in description, and code-context / prior-decision annotations:
β Layout style β Cards vs list vs timeline? (You already have a Card component with shadow/rounded variants. Reusing it keeps the app consistent.) β Loading behavior β Infinite scroll or pagination? (You chose infinite scroll in Phase 4. useInfiniteQuery hook already set up.)
Do NOT include a "skip" or "you decide" option. User ran this command to discuss β give real choices.
Continue to discuss_areas with selected areas (or to advisor_research per modes/advisor.md if ADVISOR_MODE is true).
- Advisor mode (ADVISOR_MODE = true): follow
workflows/discuss-phase/modes/advisor.mdβ research-backed comparison tables, table-first selection. - --auto: follow
workflows/discuss-phase/modes/auto.mdβ the agent picks recommended option for every question; no question. Single-pass cap enforced. - Default (no flags): follow
workflows/discuss-phase/modes/default.mdβ 4 single-question turns per area, then check whether to continue.
Overlays (combine with the active mode):
--textβworkflows/discuss-phase/modes/text.md(replace question with plain-text numbered lists)--batchβworkflows/discuss-phase/modes/batch.md(group 2β5 questions per turn)--analyzeβworkflows/discuss-phase/modes/analyze.md(trade-off table before each question)
Overlay stacking: overlays combine and apply outerβinner in fixed order --analyze β --batch β --text (e.g., --batch --analyze = trade-off table per question group; add --text for plain-text rendering). Mode-specific precedence (e.g., --auto --power) is documented in each overlay file's "Combination rules" section.
All modes preserve the universal rules below.
Universal rules (apply to every mode):
- Canonical ref accumulation β when the user references a doc/spec/ADR during any answer, immediately Read it (or confirm it exists) and add it to the canonical refs accumulator with full relative path. Use what you learned to inform subsequent questions. These docs are often MORE important than ROADMAP.md refs because the user specifically wants downstream agents to follow them.
- Scope creep β if user mentions something outside the phase domain, capture as deferred idea and redirect.
- Incremental checkpoint β after each area completes, write
${phase_dir}/${padded_phase}-DISCUSS-CHECKPOINT.json. Readworkflows/discuss-phase/templates/checkpoint.jsonfor the schema. The checkpoint is structured state, not the canonical CONTEXT.md (write_contextproduces the canonical output). On session resume, the parent'scheck_existingstep detects the checkpoint and offers to resume. - Discussion log accumulation β for each question asked, accumulate area name, options presented, user's selection, follow-up notes. Used by
git_committo write DISCUSSION-LOG.md.
DISCUSSION-LOG.md is for human reference only (audits, retrospectives) and is NOT consumed by downstream agents (researcher, planner, executor).
Find or create phase directory:
Use values from init: phase_dir, expected_phase_dir, phase_slug, padded_phase. If phase_dir is null:
mkdir -p "${expected_phase_dir}"
Set phase_dir="${expected_phase_dir}" after creation.
File location: ${phase_dir}/${padded_phase}-CONTEXT.md
Read the CONTEXT.md template now (lazy-loaded):
Read(workflows/discuss-phase/templates/context.md)
The template documents variable substitutions and conditional sections. Substitute live values for [X], [Name], [date], ${padded_phase}, {N}. Include <spec_lock> only when spec_loaded = true. Include "Folded Todos" / "Reviewed Todos" subsections only when the cross_reference_todos step folded or reviewed todos.
SPEC.md integration β If spec_loaded = true:
- Add the
<spec_lock>section immediately after<domain>. - Add the SPEC.md file to
<canonical_refs>with note "Locked requirements β MUST read before planning". - Do NOT duplicate requirements text from SPEC.md into
<decisions>β agents read SPEC.md directly. - The
<decisions>section contains only implementation decisions from this discussion.
Write the file.
```bash DISCUSS_POST_HOOKS_JSON=$(gsd_run loop render-hooks discuss:post --raw) ``` Apply each entry in `activeHooks` per @/Users/theogengineer/Projects/Multilingual-Absa/.opencode/gsd-core/references/loop-hook-dispatch.md. Empty list β continue to `confirm_creation`. Present summary and next steps:Created: .planning/phases/${PADDED_PHASE}-${SLUG}/${PADDED_PHASE}-CONTEXT.md
## Decisions Captured
### [Category]
- [Key decision]
[If deferred ideas exist:]
## Noted for Later
- [Deferred idea] β future phase
---
## βΆ Next Up β [${PROJECT_CODE}] ${PROJECT_TITLE}
**Phase ${PHASE}: [Name]** β [Goal from ROADMAP.md]
`/clear` then:
`/gsd-plan-phase ${PHASE} ${GSD_WS}`
---
**Also available:** `--chain` for auto plan+execute after; `/gsd-plan-phase ${PHASE} --skip-research ${GSD_WS}` to plan without research; `/gsd-ui-phase ${PHASE} ${GSD_WS}` for UI design contracts; review/edit CONTEXT.md before continuing.
**Write DISCUSSION-LOG.md before committing.**
File location: ${phase_dir}/${padded_phase}-DISCUSSION-LOG.md
Read the DISCUSSION-LOG.md template now (lazy-loaded):
Read(workflows/discuss-phase/templates/discussion-log.md)
Substitute live values from the discussion log accumulator (area names, options presented, user selections, notes, deferred ideas, the agent's discretion items). Write the file.
Clean up checkpoint file β CONTEXT.md is now the canonical record:
rm -f "${phase_dir}/${padded_phase}-DISCUSS-CHECKPOINT.json"
Commit phase context and discussion log:
gsd_run query commit "docs(${padded_phase}): capture phase context" --files "${phase_dir}/${padded_phase}-CONTEXT.md" "${phase_dir}/${padded_phase}-DISCUSSION-LOG.md"
Confirm: "Committed: docs(${padded_phase}): capture phase context"
Update STATE.md with session info:gsd_run query state.record-session \
--stopped-at "Phase ${PHASE} context gathered" \
--resume-file "${phase_dir}/${padded_phase}-CONTEXT.md"
gsd_run query commit "docs(state): record phase ${PHASE} context session" --files .planning/STATE.md
Auto-advance behavior is defined in `workflows/discuss-phase/modes/chain.md`.
If --auto, --chain, or workflow.auto_advance is enabled, Read that file now and execute its auto_advance step (which handles flag-syncing, banner display, plan-phase Skill dispatch, and return-status branching).
Otherwise, route to confirm_creation (manual next steps).