1.9 KiB
1.9 KiB
Granular Review Protocol: Codebase Curation
This protocol defines the mandatory procedure for auditing and modifying files during the Phase 5 Heavy Curation. It is designed to minimize entropy and prevent regression propagation.
1. File-by-File Audit Cycle
For every .py file identified for curation:
- Dependency Check: Use
derive_code_pathandpy_get_importsto identify all upstream and downstream dependencies. - State Verification: Consult the
MUTATION_MATRIX_PHASE5.mdto identify any global state modifications performed by the file. - Redundancy Identification: Cross-reference the file against
CULLING_CANDIDATES_PHASE5.md. - Proposed Change Log: Before editing, document the specific lines/symbols to be removed or refactored and the technical justification (e.g., "Superseded by theme_2.py").
- Surgical Edit: Use the
replacetool for targeted deletions. Avoid bulk file overwrites. - Style Verification: Immediately run
scripts/ai_style_formatter.pyon the modified file to ensure indentation and formatting standards are maintained.
2. Regression Guardrails
- Functional Parity: After every major deletion (e.g., removing a redundant module), run the associated unit tests (if any).
- Simulation Verification: For changes to core pipelines (AI loop, Aggregation), run at least one relevant simulation (e.g.,
simulation/ping_pong.py) to verify end-to-end behavior. - Human-in-the-Loop: Significant refactors (e.g., the
aggregate.pyrework) MUST be presented to the user with a detailed diff before final commitment.
3. Culling Justification Standards
- "Unused": Symbol has 0 project-wide references in the audit.
- "Redundant": Logic exists in a superior or more modern form elsewhere (e.g.,
theme.py). - "Slop": Code that adds complexity without contributing to performance, configuration, or a specified feature.