Produce a final selection document for one idea variant.
This command is a selection workflow, not a design-generation workflow. It should:
The command must save the selected variant document first. If refinement is requested, .agents/commands/refine.md then updates that saved file in place.
-
Identify the target change folder
Search changes/ for the folder that best matches the user's feature input.
Prefer:
- An exact folder-name match
- A folder whose name clearly matches the described feature
- A folder that already contains
ideas.md
If multiple folders are plausible, stop and ask the user which one to use.
Do not guess when the match is ambiguous.
If no relevant change folder exists, tell the user that no matching change folder was found.
Do not create a new change folder here.
-
Resolve the target idea
Find an idea folder inside changes/<feature-name>/ that matches the user's idea input.
Match by:
- Exact idea number from folders such as
2-run-work-inside-an-explicit-rls-context
- Or exact / clearly intended idea name from the folder suffix
- If needed, read
changes/<feature-name>/ideas.md to confirm the exact numbered idea title
If multiple idea folders are plausible, stop and ask one focused clarifying question.
Do not guess between similarly named ideas.
The resolved idea path must be:
changes/<feature-name>/<NUMBER-idea-name>
-
Verify required input files
Confirm that changes/<feature-name>/<NUMBER-idea-name>/variants.md exists.
If variants.md is missing, stop and tell the user that the idea does not have variants yet.
Do not create variants.md in this command.
-
Read variants.md and identify the available variants
Read the full changes/<feature-name>/<NUMBER-idea-name>/variants.md.
Identify variants from headings in this form:
## Solution <number>: <solution name>
For each variant, capture:
- Its exact solution number
- Its exact solution name
- Its full section content
Treat the variant body as the content from that ## Solution ... heading until the next ## Solution ... heading, or until the next top-level section that is not part of that solution.
Ignore non-variant sections such as:
# <Idea Title>
## Goal
## Context from existing research
## Comparison
## References
-
Select exactly one variant
If the user provided a variant number or name:
- Match by exact solution number
- Or exact / clearly intended solution name
If the title match is ambiguous, stop and ask one focused clarifying question.
Do not guess between similarly named variants.
If the user did not provide a variant:
- If there is exactly one variant in
variants.md, select it automatically
- If there is more than one variant, stop and ask the user which variant to choose
Record:
- The exact idea title
- The selected solution number
- The selected solution name
- The selected solution body
-
Check whether selected-variant.md can be replaced
Check whether changes/<feature-name>/<NUMBER-idea-name>/selected-variant.md already exists.
If it does not exist, continue.
If it exists, inspect the user input for an explicit replacement decision.
Explicit yes:
replace
overwrite
recreate
- clearly equivalent wording
If selected-variant.md exists and the user did not explicitly choose replacement, stop and ask a short direct question about whether the existing file should be replaced.
If the user says no, stop without changing the file.
-
Write a fresh selected-variant.md
The output path must be:
changes/<feature-name>/<NUMBER-idea-name>/selected-variant.md
Create this file only after:
- the selection is complete
- replacement was explicitly allowed when needed
Build the file from variants.md by preserving only:
## Goal
## Context from existing research
- the selected
## Solution <number>: <solution name> section content
## References
Omit:
- all non-selected
## Solution ... sections
## Comparison
- any other sections that only exist to compare or discuss unselected variants
Use this structure:
# <Selected solution name>
## Goal
<Copied from `variants.md`.>
## Context from existing research
<Copied from `variants.md`.>
## Solution
<Write the original selected solution section content here, including any example subsection(s), but without the original `## Solution ...` heading.>
## References
<Copied from `variants.md`.>
Output guidance:
- Use the exact selected solution name in the
# heading
- Preserve
## Goal, ## Context from existing research, and ## References from variants.md
- Do not include the selected solution number anywhere in the final file unless it naturally appears inside copied prose
- The
## Solution section should contain the original selected solution content, including any example subsection(s), but without the original ## Solution ... heading
- Do not invent extra detail at this step
- Do not include process notes, unresolved questions, comparison material, or metadata about the selection itself
-
Determine whether refinement is required
Inspect the user input for an explicit refinement decision.
Explicit yes:
refine
refined
- clearly equivalent wording
Explicit no:
don't refine
do not refine
skip refine
- clearly equivalent wording
If the user explicitly chose refinement, proceed to the refinement step using the saved selected-variant.md.
If the user explicitly chose not to refine, finish without refinement.
If the user did not make the decision explicit, ask a short direct question about whether the saved selected-variant.md should be refined.
-
Refine the saved selected-variant.md when requested
If refinement is required, follow the workflow in .agents/commands/refine.md using:
changes/<feature-name>/<NUMBER-idea-name>/selected-variant.md
as the input file.
The refine step must update that same file in place.
If refinement is skipped, leave the just-written selected-variant.md unchanged.
-
Quality check