ln-310-story-validator

Story Validator with Penalty Points - State Diagram

Overview

graph TD Start([Start: Validate Story]) --> Phase1 subgraph Phase1 [Phase 1: Discovery & Loading] P1A[Auto-discover config
Team ID from kanban_board.md] P1A --> P1B[Load Story metadata
ID, title, status, labels] P1B --> P1C[Load Tasks metadata
3-8 implementation tasks expected] end Phase1 --> Phase2 subgraph Phase2 [Phase 2: Research & Audit] P2A[Domain Extraction
Scan Story for patterns] P2A --> P2B{Patterns
detected?} P2B -->|Yes| P2C[Delegate to ln-002
Create guides/manuals/ADRs/research] P2B -->|No| P2D[MCP Ref fallback
Query standards directly] P2C --> P2E[Calculate Penalty Points
17 criteria evaluation] P2D --> P2E P2E --> P2F[Build Fix Plan
List violations + fixes] end Phase2 --> Phase3 subgraph Phase3 [Phase 3: Audit Results & Fix Plan] P3A[Display Penalty Points table
Criterion | Severity | Points] P3A --> P3B{Plan Mode
active?} P3B -->|Yes| P3C[WAIT for user approval
Show fix plan] P3B -->|No| P3D[Proceed immediately] P3C --> P3D end Phase3 --> Phase4 subgraph Phase4 [Phase 4: Auto-Fix 19 Criteria in 7 Groups] P4A[Group 1: Structural #1-#4
Story + Tasks structure] P4A --> P4B[Group 2: Standards #5
RFC/OWASP compliance FIRST] P4B --> P4C[Group 3: Solution #6
Library versions] P4C --> P4D[Group 4: Workflow #7-#13
Test Strategy, Docs, Size
YAGNI, KISS, Task Order] P4D --> P4E[Group 5: Quality #14-#15
Docs complete, No hardcoded] P4E --> P4F[Group 6: Traceability #16-#17
Story-Task align, AC coverage] P4F --> P4G[Penalty Points = 0] end Phase4 --> Phase5 subgraph Phase5 [Phase 5: Agent Review - Parallel Aggregation] P5A[Prepare prompt
story_review.md + Story/Tasks] P5A --> P5B[codex-review
gpt-5.3-codex] P5A --> P5C[gemini-review
gemini-3-flash-preview] P5B --> P5D[Aggregate suggestions
Dedup by area+issue] P5C --> P5D P5D --> P5E{Both
failed?} P5E -->|Yes| P5F[Self-Review fallback
Claude Self-Audit Protocol] P5F --> P5G[Filter: conf>=90%
impact>10%] P5E -->|No| P5G P5G --> P5H{Suggestions?} P5H -->|None| P5I[Proceed unchanged] P5H -->|Yes| P5J[Claude validates each
ACCEPT / REJECT] P5J --> P5K[Apply accepted
to Story/Tasks] P5K --> P5I end Phase5 --> Phase6 subgraph Phase6 [Phase 6: Approve & Notify] P6A[Story + Tasks -> Todo
Update Linear status] P6A --> P6B[Update kanban_board.md
Add APPROVED marker] P6B --> P6C[Add Linear comment
Penalty table + fixes + docs] P6C --> P6D[Display summary table
Before -> 0 After] end Phase6 --> End([End: Story Approved
Penalty Points = 0]) classDef discovery fill:#E3F2FD,stroke:#1976D2,stroke-width:2px classDef research fill:#FFF3E0,stroke:#E65100,stroke-width:2px classDef decision fill:#FFF9C4,stroke:#F57C00,stroke-width:2px classDef cascade fill:#F3E5F5,stroke:#7B1FA2,stroke-width:2px classDef fix fill:#E8F5E9,stroke:#388E3C,stroke-width:2px classDef approve fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px class P1A,P1B,P1C discovery class P2A,P2B,P2C,P2D,P2E,P2F research class P3A,P3B,P3C,P3D decision class P4A,P4B,P4C,P4D,P4E,P4F,P4G fix class P5A,P5B,P5C,P5D,P5E,P5F,P5G,P5H,P5I,P5J,P5K cascade class P6A,P6B,P6C,P6D approve

Penalty Points System

Severity Points Description
CRITICAL 10 RFC/OWASP/Security violations
HIGH 5 Outdated libraries, architecture issues
MEDIUM 3 Best practices violations
LOW 1 Structural/cosmetic issues