Logic Validator
The Logic Validator is Phase 3 of the Omni Architect pipeline. It analyzes the coherence and completeness of generated Mermaid diagrams against the original PRD, calculating a weighted quality score across six validation criteria.Purpose
This validation phase ensures that:- All PRD features and stories are represented in diagrams
- Entities and flows are consistent across different diagram types
- Both happy paths and error scenarios are documented
- Every diagram element traces back to a PRD requirement
- Naming conventions are coherent across all artifacts
- Feature dependencies are properly sequenced
Inputs
The structured PRD output from Phase 1 (PRD Parser). Used as the source of truth for validation.
Array of generated diagrams from Phase 2 (Mermaid Generator). Each diagram is validated against the PRD.
Controls how validation results are handled:
interactive- Present each diagram with its score, wait for approve/reject/modify inputbatch- Present all diagrams and consolidated report, wait for approve_all/reject_all/selectauto- Automatically approve if score >= threshold, reject otherwise
Minimum score (0.0 to 1.0) required for automatic approval when
validation_mode=auto. Recommended range: 0.80-0.90.Outputs
Comprehensive validation report with scores, status, and actionable feedback.Structure:
Validation Criteria
The overall score is calculated as a weighted sum of six criteria:1. Coverage (Weight: 0.25)
What it measures: Percentage of PRD features and user stories represented in at least one diagram. Calculation:- Is feature F001 visualized in any flowchart or sequence diagram?
- Is user story US015 traceable to a diagram node?
- Are all acceptance criteria represented visually?
- Missing user stories in sequence diagrams
- Features without visual representation
- Orphaned acceptance criteria
2. Consistency (Weight: 0.25)
What it measures: Consistency of entity definitions, attributes, and relationships across all diagrams. Calculation:- Does the
Userentity have the same attributes in ER and sequence diagrams? - Are relationship cardinalities consistent (e.g., User-Order is 1:N everywhere)?
- Do flow states match state diagram definitions?
- Entity “Payment” has different attributes in ER vs sequence diagram
- Relationship “User has Cart” is 1:1 in ER but 1:N in flowchart
- State names differ between stateDiagram and flowchart nodes
3. Completeness (Weight: 0.20)
What it measures: Presence of both happy paths and error/edge case scenarios in flows. Calculation:- Does the checkout flow include payment failure scenarios?
- Are timeout and network error paths documented?
- Do state diagrams include rollback/cancel transitions?
- Missing “payment failed” branch in checkout flow
- No timeout handling in authentication sequence
- State diagram lacks “cancel order” transition
4. Traceability (Weight: 0.15)
What it measures: Every diagram node and connection traces back to a specific PRD requirement, feature, or story. Calculation:- Can each flowchart node be linked to a PRD section?
- Are sequence diagram actors defined in personas?
- Do state transitions map to acceptance criteria?
- Flowchart node “Verify inventory” has no PRD requirement
- Sequence actor “Notification Service” not mentioned in PRD
- State transition undocumented in feature description
5. Naming Coherence (Weight: 0.10)
What it measures: Consistency of terminology and naming conventions across all artifacts. Calculation:- Is it “User” or “Customer” or “Usuário”?
- Are acronyms used consistently (API vs Api)?
- Do entity names match between code and diagrams?
- Entity called “User” in ER but “Customer” in sequence diagram
- Mixing English/Portuguese terms (“Usuário” vs “User”)
- Inconsistent capitalization (“OrderItem” vs “Order_Item”)
6. Dependency Integrity (Weight: 0.05)
What it measures: Feature dependencies are respected in flow sequences and state transitions. Calculation:- Is feature F002 only shown after F001 (its dependency)?
- Do flows respect prerequisite steps?
- Are dependent features properly linked in Gantt charts?
- Checkout flow appears before authentication (dependency)
- Feature F005 shown in timeline before F004 (its prerequisite)
- State transition assumes previous state not yet defined
Score Calculation Formula
Validation Modes
Interactive Mode
- Present diagram #1 with its individual score
- Wait for user input:
approve|reject|modify - If
modify: collect feedback and return to Phase 2 (Mermaid Gen) - If
approve: proceed to next diagram - If
reject: mark diagram for regeneration - Repeat for all diagrams
- Final decision: proceed to Figma if all approved
Batch Mode
- Present all diagrams together
- Show consolidated validation report
- Wait for user input:
approve_all|reject_all|select - If
select: user chooses which diagrams to approve/reject - Regenerate rejected diagrams with aggregated feedback
- Single decision point for entire batch
Auto Mode
- Calculate overall_score
- If
overall_score >= threshold: status = “approved”, proceed to Phase 4 (Figma) - If
overall_score < threshold: status = “rejected”, generate feedback report - Return to Phase 2 with specific improvement suggestions
- No human intervention required
Example Validation Report
Best Practices
Set Appropriate Thresholds
- First project: Start with
validation_threshold: 0.75and increase as team matures - Production systems: Use
0.85-0.90for critical projects - Prototypes: Can lower to
0.70for speed
Use Interactive Mode Initially
Run ininteractive mode first to understand common issues, then switch to auto once patterns are established.
Address High-Weight Criteria First
Focus on Coverage (25%) and Consistency (25%) before minor naming issues.Review Suggestions
Even if validation passes, review thesuggestions array for improvement opportunities.
Iterate on Feedback
When diagrams are rejected, use the detailed feedback to improve the PRD or diagram generation rules.Error Handling
| Scenario | Behavior |
|---|---|
| Missing parsed_prd | Throws error, cannot validate without source of truth |
| Empty diagrams array | Warning, assumes nothing to validate |
| Invalid validation_mode | Defaults to interactive with warning |
| threshold out of range | Clamps to 0.0-1.0 range with warning |
| Score calculation fails | Individual criterion gets 0.0, logged |