# Enterprise Guardrails Gap Analysis — Template

> **Version:** 1.0 | **Last Updated:** 2026-02-18  
> **Purpose:** Map existing code violations found during Enterprise Code Elevation to EGS guardrails. Generated by the AI collaborator during Enterprise Code Elevation (Stage 3, alongside the Technical Debt Inventory).  
> **Usage:** Copy this template into `aidlc-docs/code-elevation/guardrails_gap_analysis.md`. The AI populates it during the session. The team validates.

---

## Session Info

| Field | Value |
|-------|-------|
| **Brownfield Intent** | [Intent description] |
| **Codebase Analyzed** | [Modules/folders in scope] |
| **Date** | [YYYY-MM-DD] |
| **EGS Reference** | aidlc-docs/egs_definition.md |
| **Validated by** | [Team members who reviewed] |

---

## Violation Inventory

| ID | Violation Description | EGS Category | EGS Section | Severity | Risk Level | Location | Related Tech Debt |
|----|----------------------|-------------|-------------|----------|-----------|----------|-------------------|
| [GV-001] | [What violates the guardrail] | [e.g., Security Baseline] | [e.g., 1.4 Secrets Management] | [Mandatory/Required/Recommended] | [Critical/High/Medium/Low] | [File/module/component] | [TD-XX or N/A] |
| [GV-002] | [Description] | [Category] | [Section] | [Severity] | [Risk] | [Location] | [TD-XX or N/A] |

---

## Triage

### Critical (Mandatory Violations) — Must Fix Before New Feature Work

| ID | Violation | EGS Reference | Remediation Approach | Estimated Effort |
|----|-----------|---------------|---------------------|-----------------|
| [GV-XXX] | [Description] | [Section] | [How to fix] | [Hours/story points] |

### High (Required Violations) — Fix in First Bolt or Document ADR Exception

| ID | Violation | EGS Reference | Remediation Approach | ADR Required? |
|----|-----------|---------------|---------------------|---------------|
| [GV-XXX] | [Description] | [Section] | [How to fix] | [Yes/No] |

### Medium (Recommended Deviations) — Plan Remediation, Does Not Block

| ID | Violation | EGS Reference | Remediation Approach | Target Timeline |
|----|-----------|---------------|---------------------|----------------|
| [GV-XXX] | [Description] | [Section] | [How to fix] | [Sprint/quarter] |

### Low (Informational) — Note for Future Improvement

| ID | Violation | EGS Reference | Notes |
|----|-----------|---------------|-------|
| [GV-XXX] | [Description] | [Section] | [Context] |

---

## Triage Summary

| Triage Level | Count | IDs |
|-------------|-------|-----|
| Critical (Mandatory) | [N] | [GV-XXX, ...] |
| High (Required) | [N] | [GV-XXX, ...] |
| Medium (Recommended) | [N] | [GV-XXX, ...] |
| Low (Informational) | [N] | [GV-XXX, ...] |

---

## Category Coverage

| EGS Category | Violations Found | Critical | High | Medium | Low |
|-------------|-----------------|----------|------|--------|-----|
| 1. Security Baseline | [N] | [N] | [N] | [N] | [N] |
| 2. Compliance Constraints | [N] | [N] | [N] | [N] | [N] |
| 3. Architectural Guardrails | [N] | [N] | [N] | [N] | [N] |
| 4. Coding Standards | [N] | [N] | [N] | [N] | [N] |
| 5. Operational Readiness | [N] | [N] | [N] | [N] | [N] |
| 6. Cost Guardrails | [N] | [N] | [N] | [N] | [N] |
| 7. AI/GenAI Guardrails | [N] | [N] | [N] | [N] | [N] |
| 8. Reliability Guardrails | [N] | [N] | [N] | [N] | [N] |
| 9. Performance Efficiency Guardrails | [N] | [N] | [N] | [N] | [N] |
| 10. Sustainability Guardrails | [N] | [N] | [N] | [N] | [N] |

---

## Remediation Stories (Input for Brownfield Mob Elaboration)

> Critical and High violations should become remediation stories in the next Brownfield Mob Elaboration session.

| Violation ID | Proposed Story | Priority | Fixes Debt |
|-------------|---------------|----------|------------|
| [GV-XXX] | [As the system, I ... so that ...] | [Must Have / Should Have] | [TD-XX or N/A] |

---

## Validation Sign-Off

| Role | Name | Approved | Date |
|------|------|----------|------|
| Tech Lead / Architect | [Name] | [ ] | |
| Security / Compliance | [Name] | [ ] | |
| Facilitator | [Name] | [ ] | |
