STRIDE Threat Modeling System Architecture Analysis
Version: 3.0.1 Date: 2026-02-03 Purpose: Comprehensive system architecture analysis with diagrams, module relationships, and formal workflow specification
Note (v3.0.1): Architecture refactored for clarity and determinism:
- SKILL.md: "WHAT & WHY" (静态契约) - ~4K tokens target
- WORKFLOW.md: "HOW & WHEN" (动态协议) - ~4K tokens target
- FSM formalization for 8-phase workflow
- 4-Gate Protocol per phase (ENTRY → THINKING → PLANNING → EXECUTING → REFLECTING → EXIT)
0. File Responsibility Matrix (v3.0.1)
SKILL.md - "WHAT & WHY" (Static Contract)
Responsibilities:
- Version management and compatibility
- Core concept definitions (STRIDE, Dual Knowledge System)
- Global constraints and invariants
- Data model specifications (YAML Schema type definitions)
- Output conventions and format standards
- Quick Start guide
- First principles declaration
Should NOT contain:
- Specific execution steps
- Phase-to-phase data flow details
- Validation gate logic
- Error recovery procedures
Token Budget: ~4,000 (reduced from ~7,000)
WORKFLOW.md - "HOW & WHEN" (Dynamic Protocol)
Responsibilities:
- Session lifecycle management
- Phase execution protocol (FSM definition)
- Phase-to-phase data contracts (I/O Schema)
- Validation gate rules and Hook integration
- STRIDE matrix mapping
- Error recovery and rollback strategies
- Final report output specifications
Should NOT contain:
- Version information (reference SKILL.md)
- Repeated global concept definitions
- Data model type definitions (reference only)
Token Budget: ~4,000 (reduced from ~5,000)
Cross-Reference Convention
# In WORKFLOW.md (referencing SKILL.md):
"See SKILL.md §1.2 for directory structure"
"Data model defined in SKILL.md §3"
# In SKILL.md (referencing WORKFLOW.md):
"Execution protocol details in WORKFLOW.md §2"
"Validation gates specified in WORKFLOW.md §4"
0.1 Workflow State Machine (FSM) Specification
8-Phase Workflow as Finite State Machine
┌─────────────────────────────────────────────────────────────────┐
│ STRIDE Threat Modeling FSM │
├─────────────────────────────────────────────────────────────────┤
│ │
│ States: {INIT, P1, P2, P3, P4, P5, P6, P7, P8, DONE, ERROR} │
│ │
│ Alphabet (Transitions): │
│ σ = {start, p1_complete, p2_complete, ..., p8_complete, │
│ validation_fail, recovery_success, abort} │
│ │
│ Transition Function δ: │
│ δ(INIT, start) → P1 │
│ δ(Pn, pn_complete) → P(n+1) where n ∈ {1..7} │
│ δ(P8, p8_complete) → DONE │
│ δ(Pn, validation_fail) → ERROR │
│ δ(ERROR, recovery_success) → Pn (rollback to last valid) │
│ δ(ERROR, abort) → DONE (with partial results) │
│ │
│ Accepting States: {DONE} │
│ │
└─────────────────────────────────────────────────────────────────┘
State Transition Diagram
start
┌──────┴──────┐
│ INIT │
└──────┬──────┘
│ start
▼
┌──────────────┐ p1_complete ┌─────────────────┐
│ P1 │ ─────────────────►│ P2 │
│ Project │ │ DFD Analysis │
│ Understanding│ │ │
└──────┬───────┘ └────────┬────────┘
│ │ p2_complete
│ validation_fail ▼
│ ┌─────────────────┐
│ ┌──────────────────│ P3 │
│ │ │ Trust Boundary │
▼ ▼ └────────┬────────┘
┌──────────────┐ │
│ ERROR │◄───────────────────────────┤ validation_fail
└──────┬───────┘ │
│ ▼
│ recovery_success ... P4 → P5 → P6 → P7 → P8 ...
│ │
└──────────► (rollback) │ p8_complete
▼
┌─────────────────┐
│ DONE │
│ (Final Report) │
└─────────────────┘
Phase Internal 4-Gate Sub-FSM
Each Phase Pn internally follows this sub-state machine:
┌───────────────────────────────────────────────────────┐
│ Phase Pn SubFSM │
├───────────────────────────────────────────────────────┤
│ │
│ SubStates: {ENTRY, THINKING, PLANNING, EXECUTING, │
│ REFLECTING, EXIT} │
│ │
│ ┌───────┐ entry_check ┌──────────┐ │
│ │ ENTRY │ ─────────────► │ THINKING │ │
│ └───────┘ [YES] └────┬─────┘ │
│ │ │ think_complete │
│ │ [NO] ▼ │
│ │ ┌──────────┐ │
│ │ │ PLANNING │ │
│ │ └────┬─────┘ │
│ │ │ plan_approved │
│ │ ▼ │
│ │ ┌───────────┐ │
│ │ │ EXECUTING │◄─────┐ │
│ │ └─────┬─────┘ │ │
│ │ │ │ loop │
│ │ │ iter_done │ │
│ │ ▼ │ │
│ │ ┌────────────┐ │ │
│ │ │ REFLECTING │─────┘ │
│ │ └─────┬──────┘ │
│ │ │ all_complete │
│ │ ▼ │
│ │ ┌──────┐ │
│ └─────────────────► │ EXIT │ (emit pn_complete)│
│ (abort) └──────┘ │
│ │
└───────────────────────────────────────────────────────┘
0.2 Formal Verification Properties
Safety Properties (□ = always)
Property S1: Phase Order Invariant
□ (current_phase = Pn ∧ next_phase = Pm) → m = n+1 ∨ m = ERROR
Property S2: Data Contract Completeness
□ (phase_complete(Pn)) → exists(output_yaml(Pn))
Property S3: Count Conservation (P5→P6)
□ count(P5.threats) = count(P6.verified) + count(P6.theoretical)
+ count(P6.pending) + count(P6.excluded)
Property S4: No Deadlock
□ (current_state ≠ DONE ∧ current_state ≠ ERROR) → ◇ (next_transition)
Liveness Properties (◇ = eventually)
Property L1: Eventual Completion
◇ (current_state = DONE ∨ current_state = ERROR)
Property L2: Error Recoverability
□ (current_state = ERROR) → ◇ (recovery_attempted)
Temporal Logic Notation
| Symbol | Meaning |
|---|---|
| □ | Always (in all future states) |
| ◇ | Eventually (in some future state) |
| → | Implies |
| ∧ | And |
| ∨ | Or |
1. System Architecture Overview
1.1 High-Level Architecture Diagram
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ Code-First Deep Risk Analysis System v2.1.0 │
├─────────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ PRESENTATION LAYER (Layer 4) │ │
│ ├───────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Claude Skill Interface │ │ │
│ │ │ SKILL.md ──► YAML Front Matter (name, description, triggers) │ │ │
│ │ │ │ ├── 8-Phase Workflow Definition │ │ │
│ │ │ │ ├── Report Output Convention │ │ │
│ │ │ │ ├── Language Adaptation Rules │ │ │
│ │ │ │ └── Core Data Model (Entity Definitions) │ │ │
│ │ │ │ │ │ │
│ │ │ └──► Templates (9 files) │ │ │
│ │ │ ├── RISK-ASSESSMENT-REPORT.template.md (Main Report) │ │ │
│ │ │ ├── RISK-INVENTORY.template.md │ │ │
│ │ │ ├── MITIGATION-MEASURES.template.md │ │ │
│ │ │ ├── PENETRATION-TEST-PLAN.template.md │ │ │
│ │ │ └── 5 additional templates │ │ │
│ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ WORKFLOW LAYER (Layer 3) │ │
│ ├───────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │
│ │ │ WORKFLOW.md│ │VALIDATION.md│ │ REPORT.md │ │ GUIDE.md │ │ │
│ │ │ (839 lines)│ │ (946 lines)│ │ (852 lines)│ │ (580 lines)│ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ Phase 1-5 │ │ Phase 6 │ │ Phase 7-8 │ │ User Guide │ │ │
│ │ │ Steps │ │ Validation│ │ Mitigation │ │ │ │ │
│ │ └─────┬──────┘ └─────┬──────┘ └─────┬──────┘ └────────────┘ │ │
│ │ │ │ │ │ │
│ │ └───────────────┴───────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌──────────────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ 8-Phase Execution Pipeline │ │ │
│ │ │ P1 → P2 → P3 → P4 → P5 → P6 → P7 → P8 │ │ │
│ │ │ Project DFD Trust Security STRIDE Risk Mitigation Report │ │ │
│ │ │ Design Analysis Validate │ │ │
│ │ └──────────────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ SCRIPT LAYER (Layer 2) │ │
│ ├───────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ scripts/ │ │
│ │ ├── unified_kb_query.py (102KB) ◄── Main KB Query Interface │ │
│ │ │ ├── STRIDE queries (--stride) │ │
│ │ │ ├── CWE/CAPEC chains (--cwe, --capec, --full-chain) │ │
│ │ │ ├── CVE lookups (--cve, --cve-for-cwe) │ │
│ │ │ ├── Semantic search (--search) │ │
│ │ │ ├── ASVS/WSTG verification (--asvs-level, --wstg) │ │
│ │ │ └── Compliance queries (--stride-compliance) │ │
│ │ │ │ │
│ │ ├── module_discovery.py (11KB) ◄── Phase 1: Project Structure │ │
│ │ │ └── File categorization, type detection │ │
│ │ │ │ │
│ │ ├── stride_matrix.py (7.6KB) ◄── Phase 5: STRIDE per Interaction │ │
│ │ │ └── Threat category calculation │ │
│ │ │ │ │
│ │ ├── phase_data.py ◄── Cross-Phase Data & Validation (v2.2.2) │ │
│ │ │ └── YAML extraction, CP1/CP2/CP3 validation │ │
│ │ │ │ │
│ │ │ [Development Only - Not in Release] │ │
│ │ │ ├── collect_code_stats.py ◄── LOC/File Statistics │ │
│ │ │ ├── build_knowledge_base.py ◄── KB Build (Offline) │ │
│ │ │ ├── build_cve_index.py ◄── CVE Index Build │ │
│ │ │ ├── prebuild_semantic_index.py ◄── Embedding Generation │ │
│ │ │ └── kb_incremental_update.py ◄── KB Updates │ │
│ │ │ │
│ └───────────────────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ KNOWLEDGE LAYER (Layer 1) │ │
│ ├───────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ ┌─────────────────────────────┐ ┌─────────────────────────────────────────────────┐│ │
│ │ │ SQLite Databases │ │ YAML Knowledge Files ││ │
│ │ │ │ │ ││ │
│ │ │ security_kb.sqlite (14MB) │ │ security-design.yaml (17KB) ││ │
│ │ │ ├── CWE (974) │ │ ├── 16 Security Domains ││ │
│ │ │ ├── CAPEC (615) │ │ └── Domain → STRIDE mapping ││ │
│ │ │ ├── ATT&CK (835) │ │ ││ │
│ │ │ ├── WSTG (121) │ │ stride-library.yaml (5KB) ││ │
│ │ │ ├── MASTG (206) │ │ ├── STRIDE categories ││ │
│ │ │ ├── ASVS (345) │ │ └── Element→threat mapping ││ │
│ │ │ ├── Compliance (115) │ │ ││ │
│ │ │ └── Embeddings (3,278) │ │ capec-mappings.yaml (300KB) ││ │
│ │ │ │ │ ├── Attack patterns ││ │
│ │ │ security_kb_extension.sqlite │ │ └── ATT&CK mapping ││ │
│ │ │ (304MB) │ │ ││ │
│ │ │ ├── CVE (323,830) │ │ llm-threats.yaml (31KB) ││ │
│ │ │ └── CVE→CWE (108,409) │ │ └── OWASP LLM Top 10 ││ │
│ │ └─────────────────────────────┘ └─────────────────────────────────────────────────┘│ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Security Controls (L3+L4) │ │ │
│ │ │ security-controls/ │ │ │
│ │ │ ├── control-set-{01-10}-*.md ◄── 10 Core Domain Controls │ │ │
│ │ │ ├── control-set-ext-*.md ◄── 8 Extended Domain Controls │ │ │
│ │ │ └── references/ (73 files) ◄── OWASP Scenario Practices │ │ │
│ │ └─────────────────────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────┘
1.2 Component Summary
| Layer | Component | Files | Purpose |
|---|---|---|---|
| Layer 4 | Presentation | 1 SKILL + 9 templates + 4 schemas | User interface and report generation |
| Layer 3 | Workflow | WORKFLOW + VALIDATION + REPORT + GUIDE | Phase execution logic |
| Layer 2 | Scripts | 11 Python scripts | Automation and data processing |
| Layer 1 | Knowledge | 2 SQLite DBs + 12 YAML files + 90 MD controls | Security knowledge store |
2. Data Flow Diagram
2.1 Complete System Data Flow
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ STRIDE System Data Flow Diagram │
├─────────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ INPUT SOURCES │ │
│ ├──────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ [EI-01] [EI-02] [EI-03] [EI-04] │ │
│ │ User/Claude ───► Target ───► Knowledge ───► Previous │ │
│ │ Request Project Base Session │ │
│ │ (NL command) (Codebase) (SQLite+YAML) (_session_meta) │ │
│ │ │ │
│ └────────┬─────────────────┬─────────────────┬─────────────────────┬───────────────────┘ │
│ │ │ │ │ │
│ ▼ ▼ ▼ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ 8-PHASE PROCESSING PIPELINE │ │
│ ├──────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ ╔═══════════════╗ DF-01: project_context │ │
│ │ ║ Phase 1 ║ ────────────────────────────────────────────────────────────► │ │
│ │ ║ Project ║ - file_structure, tech_stack, entry_points │ │
│ │ ║ Understanding ║ - security_modules, scale_metrics │ │
│ │ ╚═══════════════╝ │ │
│ │ │ │ │
│ │ │ DF-01 │ │
│ │ ▼ │ │
│ │ ╔═══════════════╗ DF-02: dfd_elements │ │
│ │ ║ Phase 2 ║ ────────────────────────────────────────────────────────────► │ │
│ │ ║ DFD/Call ║ - processes[], data_stores[], data_flows[] │ │
│ │ ║ Flow ║ - external_interactors[], element_map │ │
│ │ ╚═══════════════╝ │ │
│ │ │ │ │
│ │ │ DF-01 + DF-02 │ │
│ │ ▼ │ │
│ │ ╔═══════════════╗ DF-03: boundary_context │ │
│ │ ║ Phase 3 ║ ────────────────────────────────────────────────────────────► │ │
│ │ ║ Trust ║ - trust_boundaries[], boundary_crossings[] │ │
│ │ ║ Boundaries ║ - security_zones, element_zone_mapping │ │
│ │ ╚═══════════════╝ │ │
│ │ │ │ │
│ │ │ DF-01 + DF-02 + DF-03 │ │
│ │ ▼ │ │
│ │ ╔═══════════════╗ DF-04: security_gaps │ │
│ │ ║ Phase 4 ║ ────────────────────────────────────────────────────────────► │ │
│ │ ║ Security ║ - domain_assessments[15], gaps[], recommendations[] │ │
│ │ ║ Design ║ - security_coverage_matrix │ │
│ │ ╚═══════════════╝ │ │
│ │ │ ┌──────────────────────────────────────────────────────┐ │ │
│ │ │ │ KB QUERY: STRIDE → CWE → CAPEC │ │ │
│ │ │ │ python unified_kb_query.py --stride {category} │ │ │
│ │ ▼ └──────────────────────────────────────────────────────┘ │ │
│ │ ╔═══════════════╗ DF-05: threat_inventory │ │
│ │ ║ Phase 5 ║ ────────────────────────────────────────────────────────────► │ │
│ │ ║ STRIDE ║ - threats[] (T-{S}-{E}-{Seq}) │ │
│ │ ║ Analysis ║ - element_threat_map, stride_distribution │ │
│ │ ╚═══════════════╝ - cwe_refs[], capec_refs[], total: 50-200 │ │
│ │ │ ┌──────────────────────────────────────────────────────┐ │ │
│ │ │ │ KB QUERY: CAPEC → ATT&CK → CVE/KEV │ │ │
│ │ │ │ python unified_kb_query.py --capec {id} --attack │ │ │
│ │ ▼ └──────────────────────────────────────────────────────┘ │ │
│ │ ╔═══════════════╗ DF-06: validated_risks │ │
│ │ ║ Phase 6 ║ ────────────────────────────────────────────────────────────► │ │
│ │ ║ Risk ║ - validated_risks[] (VR-{Seq}) │ │
│ │ ║ Validation ║ - poc_details[], attack_paths[], attack_chains[] │ │
│ │ ╚═══════════════╝ - threat_disposition (count conservation) │ │
│ │ │ ┌──────────────────────────────────────────────────────┐ │ │
│ │ │ │ KB QUERY: CWE Mitigations + ASVS + Controls │ │ │
│ │ │ │ python unified_kb_query.py --cwe {id} --mitigations │ │ │
│ │ ▼ └──────────────────────────────────────────────────────┘ │ │
│ │ ╔═══════════════╗ DF-07: mitigation_plan │ │
│ │ ║ Phase 7 ║ ────────────────────────────────────────────────────────────► │ │
│ │ ║ Mitigation ║ - mitigations[] (M-{Seq}) │ │
│ │ ║ Planning ║ - fix_locations, asvs_compliance, implementation_steps │ │
│ │ ╚═══════════════╝ │ │
│ │ │ │ │
│ │ │ ALL DataFlows (DF-01 to DF-07) │ │
│ │ ▼ │ │
│ │ ╔═══════════════╗ DF-08: final_reports │ │
│ │ ║ Phase 8 ║ ────────────────────────────────────────────────────────────► │ │
│ │ ║ Report ║ - 4 Required Reports + 6 Phase Documents │ │
│ │ ║ Generation ║ - Risk_Assessment_Report/{PROJECT}-*.md │ │
│ │ ╚═══════════════╝ │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ OUTPUT ARTIFACTS │ │
│ ├──────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ Risk_Assessment_Report/ │ │
│ │ │ │ │
│ │ ├── {PROJECT}-RISK-ASSESSMENT-REPORT.md ◄── Main Report (all phases aggregated) │ │
│ │ ├── {PROJECT}-RISK-INVENTORY.md ◄── Complete VR list with threat_refs │ │
│ │ ├── {PROJECT}-MITIGATION-MEASURES.md ◄── M-{Seq} with fix_locations │ │
│ │ ├── {PROJECT}-PENETRATION-TEST-PLAN.md ◄── POC-based test plan │ │
│ │ │ │ │
│ │ ├── P1-PROJECT-UNDERSTANDING.md ◄── Phase 1 working document │ │
│ │ ├── P2-DFD-ANALYSIS.md ◄── DFD elements and flows │ │
│ │ ├── P3-TRUST-BOUNDARY.md ◄── Boundary definitions │ │
│ │ ├── P4-SECURITY-DESIGN-REVIEW.md ◄── 16 domain assessments │ │
│ │ ├── P5-STRIDE-THREATS.md ◄── Complete threat inventory │ │
│ │ └── P6-RISK-VALIDATION.md ◄── POCs and attack paths │ │
│ │ │ │
│ │ .phase_working/ │ │
│ │ └── _session_meta.yaml ◄── Session state for recovery │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────┘
2.2 Data Flow Summary Table
| Flow ID | Source | Target | Data Structure | Volume |
|---|---|---|---|---|
| DF-01 | P1 | P2,P3,P4 | project_context | 1 object |
| DF-02 | P2 | P3,P4,P5 | dfd_elements | 10-50 elements |
| DF-03 | P3 | P4,P5 | boundary_context | 3-10 boundaries |
| DF-04 | P4 | P5,P6 | security_gaps | 16 domain assessments |
| DF-05 | P5 | P6 | threat_inventory | 50-200 threats |
| DF-06 | P6 | P7,P8 | validated_risks | 5-30 VRs |
| DF-07 | P7 | P8 | mitigation_plan | 5-20 mitigations |
| DF-08 | P8 | Output | final_reports | 10 files |
3. Module Relationships
3.1 File Dependency Graph
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ Module Dependency Graph │
├─────────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ SKILL.md (Entry Point) │ │
│ │ ════════════════════════ │ │
│ │ │ │
│ │ Defines: │ │
│ │ ├── Workflow activation triggers │ │
│ │ ├── 8-Phase structure │ │
│ │ ├── Core Data Model (Finding → Threat → VR → Mitigation) │ │
│ │ ├── ID conventions (F-P{N}-{Seq}, T-{S}-{E}-{Seq}, VR-{Seq}, M-{Seq}) │ │
│ │ ├── Count conservation rules │ │
│ │ └── Knowledge architecture overview │ │
│ │ │ │
│ └──────┬────────────────────────────────────────────────────────────────────┬─────────┘ │
│ │ │ │
│ │ references │ references │
│ ▼ ▼ │
│ ┌───────────────────────┐ ┌────────────────────┐ ┌─────────────────────────────────┐ │
│ │ WORKFLOW.md │ │ VALIDATION.md │ │ REPORT.md │ │
│ │ ═══════════════════ │ │ ═════════════════ │ │ ═══════════════════════════ │ │
│ │ │ │ │ │ │ │
│ │ Phase 1-5 Details: │ │ Phase 6 Details: │ │ Phase 7-8 Details: │ │
│ │ ├── Step definitions │ │ ├── Consolidation │ │ ├── KB query patterns │ │
│ │ ├── Output templates │ │ │ algorithm │ │ ├── Mitigation templates │ │
│ │ ├── Checkpoints │ │ ├── Dedup rules │ │ ├── ASVS integration │ │
│ │ └── KB query points │ │ ├── POC design │ │ ├── Fix location tracking │ │
│ │ │ │ └── Attack paths │ │ └── Report aggregation │ │
│ └───────────┬───────────┘ └─────────┬──────────┘ └───────────────┬─────────────────┘ │
│ │ │ │ │
│ │ │ │ │
│ └─────────────────────────┼─────────────────────────────┘ │
│ │ │
│ │ use │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ assets/templates/ (9 files) │ │
│ │ ═════════════════════ │ │
│ │ │ │
│ │ RISK-ASSESSMENT-REPORT.template.md ◄── Main report structure (9 chapters) │ │
│ │ RISK-INVENTORY.template.md ◄── VR table with threat_refs │ │
│ │ MITIGATION-MEASURES.template.md ◄── M-{Seq} with fix_location │ │
│ │ PENETRATION-TEST-PLAN.template.md ◄── POC-based testing plan │ │
│ │ ARCHITECTURE-ANALYSIS.template.md ◄── System architecture │ │
│ │ ATTACK-PATH-VALIDATION.template.md ◄── Attack chain analysis │ │
│ │ COMPLIANCE-REPORT.template.md ◄── Compliance mapping │ │
│ │ DFD-DIAGRAM.template.md ◄── DFD visualization │ │
│ │ DFD-TEMPLATES.md ◄── DFD ASCII patterns │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ │ validated by │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ assets/schemas/ (4 files) │ │
│ │ ══════════════════ │ │
│ │ │ │
│ │ risk-detail.schema.md ◄── VR structure, threat_refs required │ │
│ │ phase-risk-summary.schema.md ◄── threat_disposition, count conservation │ │
│ │ report-naming.schema.md ◄── {PROJECT}-{TYPE}.md naming rules │ │
│ │ mitigation-detail.schema.md ◄── M-{Seq} structure, fix_location schema │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────┘
3.2 Module Purpose Matrix
| Module | Type | Purpose | Dependencies |
|---|---|---|---|
| SKILL.md | Definition | Entry point, workflow definition, data model | - |
| WORKFLOW.md | Execution | Phase 1-5 step-by-step guide | SKILL.md |
| VALIDATION.md | Execution | Phase 6 consolidation and validation | SKILL.md, WORKFLOW.md |
| REPORT.md | Execution | Phase 7-8 mitigation and report | SKILL.md, VALIDATION.md |
| assets/templates/*.md | Template | Report structure and placeholders | Schemas |
| assets/schemas/*.md | Schema | Data validation rules | SKILL.md |
4. Workflow Decomposition
4.1 8-Phase Workflow Detail
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ 8-Phase Workflow Decomposition │
├─────────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ ╔═══════════════════════════════════════════════════════════════════════════════════════╗ │
│ ║ PHASE 1: Project Understanding ║ │
│ ╠═══════════════════════════════════════════════════════════════════════════════════════╣ │
│ ║ ║ │
│ ║ Steps: Scripts: ║ │
│ ║ 1. Get file structure ────────────────────────► module_discovery.py ║ │
│ ║ 2. Identify project type ║ │
│ ║ 3. Collect scale metrics ─────────────────────► module_discovery.py --stats ║ │
│ ║ 4. Read key files ║ │
│ ║ 5. Document architecture ║ │
│ ║ ║ │
│ ║ Output: P1-PROJECT-UNDERSTANDING.md ║ │
│ ║ Data: project_context {file_structure, tech_stack, scale_metrics, modules} ║ │
│ ╚═══════════════════════════════════════════════════════════════════════════════════════╝ │
│ │ │
│ ▼ │
│ ╔════════════════
…(truncated)