# Specification: Comprehensive Codebase Curation & Style Alignment (codebase_curation_20260507) ## Overview Aggressive pruning, optimization, and standardization of the codebase. This track uses the findings from the Code Path Analysis and other Phase 5 audits to trim away non-essential logic, data, and processing while strictly enforcing the project's technical integrity standards. ## Foundational Context (MANDATORY REVIEW) All curation efforts MUST be informed by the following Phase 5 analysis reports: - `docs/PIPELINE_ANALYSIS_PHASE5_INIT.md`: Processing route and pipeline mapping. - `docs/STATE_INVENTORY_PHASE5.md`: Core data structure and property inventory. - `docs/MUTATION_MATRIX_PHASE5.md`: Thread-safe state modification and lock map. - `docs/CULLING_CANDIDATES_PHASE5.md`: Identified redundant symbols, modules, and structures. ## Granular Care & Regression Guardrails - **Surgical Execution:** Changes must be applied file-by-file with extreme granularity. No bulk culling without individual justification. - **Regression Monitoring:** Continuous verification of behavioral integrity. Any unintended entropy or performance degradation must trigger an immediate halt and review. - **Traceability:** Every removed line must be cross-referenced against the culling audit or pipeline map. ## Scope - **Target Files:** All `.py` files in `./src` and `./simulation`. - **Primary Goal:** Trimming the "slop" (redundancies, dead code, excessive complexity). ## Functional Requirements 1. **Redundancy Pruning:** Eliminate duplicate logic across different data pipelines. 2. **Dead Code Removal:** Strip out legacy "just-in-case" code and unused processing paths. 3. **Strict Style Enforcement:** - Universal 1-space indentation. - CRLF line endings. - Standardized type hinting. 4. **Guideline Alignment:** Refactor any code that deviates from `product-guidelines.md` (e.g., ensuring explicit composition over complex inheritance). 5. **Validation:** Ensure no loss of functionality or performance degradation. ## Acceptance Criteria - [ ] Significant reduction in total codebase line count (where applicable). - [ ] 100% pass on style audit (`scripts/ai_style_formatter.py`). - [ ] All remaining code is mapped to a necessary functional requirement or performance goal.