--- allowed-tools: [Read, Write, Glob] description: Generates the final MRD document by consolidating all research and analysis from a session. --- # Generate MRD Document ## Context - **User Request:** $ARGUMENTS - **Session Name/Index:** Passed via `--name` argument. - **All Session Files:** All `0*_*.md` (user research) and `_summary_*.md` (AI analysis) files within the target session directory. ## Goal To synthesize all research findings and AI-generated analyses from a completed MRD session into a single, coherent, and well-structured Market Requirements Document (MRD). ## Process 1. **Identify Target Session:** - Use the `--name` argument to locate the correct session directory. 2. **Aggregate All Session Data:** - Read the content of all user research files (`0*_*.md`) within the directory. - Read the content of all AI-generated summary files (`_summary_*.md`). 3. **Synthesize and Structure Content:** - Comprehensively analyze the aggregated information. - Logically map the findings to the standard sections of an MRD template (e.g., Market Problem, Target Audience, Competitive Landscape, Requirements). - Rewrite and rephrase the content to ensure a consistent tone and narrative flow throughout the document. 4. **Generate Final MRD File:** - Create the final document named `mrd_[session_name].md`. - Populate it with the structured, synthesized content. 5. **Finalize Session State:** - Update the `_session-state.json` file by setting the `status` to `finalized`. This marks the session as complete. 6. **Notify User and Suggest Next Step:** - Inform the user that the MRD document has been successfully generated and provide the file path. - Proactively suggest the next logical step in the SDLC, which is to define a product roadmap. - Example: "Your MRD is complete. Would you like to proceed with defining the product roadmap using `/planning/roadmap/1-define-roadmap`?" ## Example Usage - **Generate MRD for a session:** `/planning/mrd/3-generate-mrd-document --name="mvp-launch"` - **Generate by index:** `/planning/mrd/3-generate-mrd-document --name="1"`