<critical>You MUST have already loaded and processed: {installed_path}/workflow.yaml</critical>
<critical>This workflow uses ADAPTIVE FACILITATION - adjust your communication style based on {user_skill_level}</critical>
<critical>The goal is ARCHITECTURAL DECISIONS that prevent AI agent conflicts, not detailed implementation specs</critical>
<critical>Communicate all responses in {communication_language} and tailor to {user_skill_level}</critical>
<critical>Generate all documents in {document_output_language}</critical>
<critical>This workflow replaces architecture with a conversation-driven approach</critical>
<critical>Input documents specified in workflow.yaml input_file_patterns - workflow engine handles fuzzy matching, whole vs sharded document discovery automatically</critical>
<critical>ELICITATION POINTS: After completing each major architectural decision area (identified by template-output tags for decision_record, project_structure, novel_pattern_designs, implementation_patterns, and architecture_document), invoke advanced elicitation to refine decisions before proceeding</critical>
<ask>Re-running will overwrite the existing architecture. Continue? (y/n)</ask>
<checkif="n">
<output>Exiting. Use workflow-status to see your next step.</output>
<action>Exit workflow</action>
</check>
</check>
<checkif="create-architecture is not the next expected workflow">
<output>⚠️ Next expected workflow: {{next_workflow}}. Architecture is out of sequence.</output>
<ask>Continue with Architecture anyway? (y/n)</ask>
<checkif="n">
<output>Exiting. Run {{next_workflow}} instead.</output>
<action>Exit workflow</action>
</check>
</check>
<action>Set standalone_mode = false</action>
</check>
<action>Check for existing PRD and epics files using fuzzy matching</action>
<action>Fuzzy match PRD file: {prd_file}</action>
<checkif="PRD_not_found">
<output>**PRD Not Found**
Decision Architecture works from your Product Requirements Document (PRD).
Looking for: _PRD_, PRD.md, or prd/index.md + files in {output_folder}
Please run the PRD workflow first to define your requirements.
Architect: `create-prd`
</output>
<action>Exit workflow - PRD required</action>
</check>
</step>
<stepn="1"goal="Load and understand project context">
<action>Load the PRD using fuzzy matching: {prd_file}, if the PRD is mulitple files in a folder, load the index file and all files associated with the PRD</action>
<action>Load epics file using fuzzy matching: {epics_file}</action>
<action>Check for UX specification using fuzzy matching:
<action>Attempt to locate: {ux_spec_file}</action>
<action>Extract and understand from PRD: - Functional Requirements (what it must do) - Non-Functional Requirements (performance, security, compliance, etc.) - Epic structure and user stories - Acceptance criteria - Any technical constraints mentioned
</action>
<action>Count and assess project scale: - Number of epics: {{epic_count}} - Number of stories: {{story_count}} - Complexity indicators (real-time, multi-tenant, regulated, etc.) - UX complexity level (if UX spec exists) - Novel features
</action>
<action>Reflect understanding back to {user_name}:
"I'm reviewing your project documentation for {{project_name}}.
I see {{epic_count}} epics with {{story_count}} total stories.
{{if_ux_spec}}I also found your UX specification which defines the user experience requirements.{{/if_ux_spec}}
Key aspects I notice:
- [Summarize core functionality]
- [Note critical NFRs]
{{if_ux_spec}}- [Note UX complexity and requirements]{{/if_ux_spec}}
- [Identify unique challenges]
This will help me guide you through the architectural decisions needed
to ensure AI agents implement this consistently."
</action>
<ask>Does this match your understanding of the project?</ask>
<action>Analyze PRD against patterns to identify needed decisions: - Match functional requirements to known patterns - Identify which categories of decisions are needed - Flag any novel/unique aspects requiring special attention - Consider which decisions the starter template already made (if applicable)
<critical>Some projects require INVENTING new patterns, not just choosing existing ones</critical>
<action>Scan PRD for concepts that don't have standard solutions: - Novel interaction patterns (e.g., "swipe to match" before Tinder existed) - Unique multi-component workflows (e.g., "viral invitation system") - New data relationships (e.g., "social graph" before Facebook) - Unprecedented user experiences (e.g., "ephemeral messages" before Snapchat) - Complex state machines crossing multiple epics
</action>
<checkif="novel_patterns_detected">
<action>For each novel pattern identified:</action>
<action>Engage user in design collaboration:
<checkif="{user_skill_level} == 'expert'">
"The {{pattern_name}} concept requires architectural innovation.
Core challenge: {{challenge_description}}
Let's design the component interaction model:"
</check>
<checkif="{user_skill_level} == 'beginner'">
"Your idea about {{pattern_name}} is unique - there isn't a standard way to build this yet!
This is exciting - we get to invent the architecture together.
Let me help you think through how this should work:"
</check>
</action>
<action>Facilitate pattern design:
1. Identify core components involved
2. Map data flow between components
3. Design state management approach
4. Create sequence diagrams for complex flows
5. Define API contracts for the pattern
6. Consider edge cases and failure modes
</action>
<action>Use advanced elicitation for innovation:
"What if we approached this differently?
- What would the ideal user experience look like?
- Are there analogies from other domains we could apply?
- What constraints can we challenge?"
</action>
<action>Document the novel pattern:
Pattern Name: {{pattern_name}}
Purpose: {{what_problem_it_solves}}
Components:
{{component_list_with_responsibilities}}
Data Flow:
{{sequence_description_or_diagram}}
Implementation Guide:
{{how_agents_should_build_this}}
Affects Epics:
{{epics_that_use_this_pattern}}
</action>
<action>Validate pattern completeness:
"Does this {{pattern_name}} design cover all the use cases in your epics?
- {{use_case_1}}: ✓ Handled by {{component}}
- {{use_case_2}}: ✓ Handled by {{component}}
..."
</action>
</check>
<checkif="no_novel_patterns">
<action>Note: All patterns in this project have established solutions.
Proceeding with standard architectural patterns.</action>
<action>Check decision compatibility: - Do all decisions work together? - Are there any conflicting choices? - Do the versions align properly?
</action>
<action>Verify epic coverage: - Does every epic have architectural support? - Are all user stories implementable with these decisions? - Are there any gaps?
</action>
<action>Validate pattern completeness: - Are there any patterns we missed that agents would need? - Do novel patterns integrate with standard architecture? - Are implementation patterns comprehensive enough?
</action>
<checkif="issues_found">
<action>Address issues with {user_name}:
"I notice {{issue_description}}.
We should {{suggested_resolution}}."
</action>
<ask>How would you like to resolve this?</ask>
<action>Update decisions based on resolution</action>