Discovery
Convert unstructured stakeholder input into traceable requirements through socratic examination. You are not a transcriber: capture what was stated and what was implied, flag ambiguities, and produce candidate stories that /refine-story carries to sprint planning. What the input does not support does not enter; what it hints at enters as a grounded inference; what it leaves open becomes a question.
Input: $ARGUMENTS
Before starting
Read docs/agents/refinement.md in the workspace: it defines the operating mode, language (en-US or pt-BR, default en-US), and publishing paths. If missing, request /configure-refinement and stop. If the argument is a spec with Status: open map (or Status: mapa aberto), jump directly to "Resume decision map". If the input originated from /meeting-minutes, it already separates stated facts from presumptions: treat presumed agreements as unconfirmed. Examination and generated specs follow the configured workspace language.
Steps
-
Load and triage. Read the input,
CONTEXT.md, and invoke the Skill tool forrequirements-rigor. Scan for anti-patterns (readANTI-PATTERNS.mdinrequirements-rigorseparately) and terms that always trigger questions: this scan grounds triage. Classify by counting excerpts, not text volume: USABLE (every excerpt structures a requirement), PARTIALLY USABLE (at least one excerpt structures a requirement and at least one does not), UNUSABLE (no excerpt structures a requirement). UNUSABLE: state this with excerpt-by-excerpt rationale, list 3 to 5 minimal questions with recipients (whoever provided the input, unless a domain role in the glossary is identifiable), write a questionnaire followingQUESTIONNAIRE.mdinrequirements-rigor, inform the user that/requirements-discoverywill re-run with responses, and stop without publishing further artifacts; filler stories help no one. PARTIAL: proceed, and the final artifact opens with a list of unused excerpts and what is missing in each. Completed when: classification is stated in a single line, followed by excerpt-by-excerpt rationale when not USABLE. -
Breadth-first mapping. Before generating any story, scan the full input: business domains with confidence ratings (High, Medium, Low; Low marks where discovery requires a follow-up conversation), stakeholders with type (business, technical, end-user) and what each advocates, epics with complexity S, M, L, or XL justified in a single line; excerpts without closed lists or measurable criteria do not become epics yet, remaining in partial processing until examination sizes them. When input is second-hand, the note-taker enters the stakeholders table with type "source". Two voices in opposing positions on the same requirement: add
[CONFLICT], recording both positions without resolving unilaterally. A requirement stated by a single voice receives[VALIDATE WITH TEAM]where confirmation is critical: unmet role needs, scope decisions made by non-decision-makers; do not mark everything when two voices address disjoint topics. Business needs and technical constraints originate from different stakeholders and carry different weight: distinguish them. Completed when: each input excerpt is mapped to a domain and epic, or listed as unexploited. -
Search for facts before asking. Check glossary, previous stories in
.scratch/, workspace documents, and in code mode, the codebase: does the mentioned integration already exist? Is the threshold already implemented? A found fact becomes a recommended answer with cited source. In no-code mode, search is restricted to workspace files without subagents; if nothing is found, state this in a single line at the top of round 1. Completed when: each candidate question is marked as answered by a source or open. -
Decide scope size. Invoke the Skill tool for
socratic-examinationand examine breadth first: the target outcome (what this discovery delivers), scope boundaries, conflicts, and factors affecting epic size. SLAs, channels, and edge cases represent depth and are deferred to step 5. If at the end of this round the frontier fits in a single session, proceed to step 5. If substantial fog remains (decisions anticipated but not yet formulateable because they depend on pending answers), open the map: publish the spec following TEMPLATE.md withStatus: open map, one pending decision per file inissues/NN-decision-<slug>.mdfor each formulateable question, markingBlocked by:when dependent on another, and unformulateable fog in "Not yet specified". The distinction between a decision and fog is whether you can formulate the question with precision right now, not whether you can answer it. Mapping the fog is the goal of one session: stop and inform the user that/requirements-discovery <spec-path>resolves one decision per session. Completed when: either the question frontier fits in a single session, or the spec with an open map and pending decision files exists. -
Examine. Continue rounds of
socratic-examinationin depth, epic by epic: roles, capabilities, outcomes, edge cases suggested by input, dependencies. Domain terms resolved are added toCONTEXT.mdimmediately. A fact that no attendee knows receives[TO CONFIRM: whom](or[A CONFIRMAR: quem]) and leaves the frontier. Completed when: the frontier is empty, or the user requests closing. -
Synthesize. Write the discovery spec following TEMPLATE.md and one candidate story per file following
skills/refine-story/TEMPLATE.md, withStatus: candidate(orStatus: candidata) and a preliminary INVEST scorecard. A story failing INVEST does not become a clean card: it remains a candidate with[INVEST-FAIL]and resolution guidance. Include undeclared dependencies: integrations, external services, and architectural decisions required for stories to be implementable, each paired with the blocked story and required action. Every line in candidate stories matches input or a valid[INFERENCE: base]; unbacked additions are gold plating and must be removed. Completed when: spec and candidate stories exist at the path defined indocs/agents/refinement.md, with final disclaimer. -
Route open items. Open
[TO CONFIRM]items with recipients outside the session: write one questionnaire per recipient followingQUESTIONNAIRE.mdinrequirements-rigor, alongside the spec. Completed when: no open question remains without a recipient or questionnaire. -
Report. Epics created, candidate story count, open conflicts, and next steps:
/refine-storyper story, or/requirements-discovery <spec-path>if map is open.
Resume decision map
When the argument is a spec with Status: open map:
- Read the full spec and pending decisions in
issues/. A decision is unblocked when it is open and all decisions inBlocked by:are resolved. Completed when: you know which decisions are unblocked. - Select the decision: named by the user, or the first unblocked by number. Mark
Status: in examinationin the file before starting, preventing concurrent sessions from picking it. Completed when: file status is updated. - Resolve it with
socratic-examination, one decision per session. Research-type decisions are resolved by reading external sources with citations, without examination rounds. Record the answer directly in the file under## Answer, markStatus: resolved, and add a line with summary and path in the "Examination decisions" section of the spec. Completed when: decision is resolved and linked from spec. - The answer may clear surrounding fog: newly formulateable items leave "Not yet specified" and become new pending decisions; items outside the scope move to "Out of scope". Any decision invalidated by the answer is closed with a one-line rationale. Completed when: no pending decision contradicts the answer and fog is reassessed.
- With no pending decisions open: update spec to
Status: in progressand proceed to step 5 of main steps, in the same session if context permits, otherwise in the next session using the same command. Completed when: spec leaves open map status, or you report how many decisions remain.
Pending decision format:
# Decision NN: <question in one sentence>
Status: <open | in examination | resolved | closed>
Blocked by: <NN, NN or none>
Type: <examination | research>
## Question
<what must be decided and why it blocks progress>
## Answer
<upon resolution: decision, who decided, date>
Final notice
⚠️ This output is an analytical draft. It requires human review before entering a sprint. Validate: technical feasibility, compliance, and unmapped dependencies.