# Implementation Plan: AI-Optimized Python Style Refactor

## Phase 1: Research and Pilot Tooling
- [x] Task: Conductor - Define and Test Style Transformation Logic. (Develop or adapt a tool to perform 1-space indentation and newline reduction safely). [c75b926]
- [x] Task: Conductor - Run Style Pilot on a Representative Module (e.g., `theme.py`). [13c15ed]
- [x] Task: Conductor - User Manual Verification 'Phase 1: Pilot and Tooling' (Protocol in workflow.md) [checkpoint: Phase1]

## Phase 2: Core Refactor - Indentation and Newlines
- [x] Task: Conductor - Refactor Primary Engine Modules (`ai_client.py`, `aggregate.py`, `mcp_client.py`, `shell_runner.py`). [db65162]
- [x] Task: Conductor - Refactor Project & Session Management Modules (`project_manager.py`, `session_logger.py`). [db65162]
- [x] Task: Conductor - Refactor UI Modules (`gui_2.py`, `gui_legacy.py`, `theme.py`, `theme_2.py`). [db65162]
- [x] Task: Conductor - Refactor Remaining Utility and Support Modules (`events.py`, `file_cache.py`, `models.py`, `mma_prompts.py`). [db65162]
- [x] Task: Conductor - User Manual Verification 'Phase 2: Indentation and Newline Refactor' (Protocol in workflow.md) [checkpoint: Phase2]

## Phase 3: AI-Optimized Metadata and Final Cleanup [checkpoint: 3216e87]
- [x] Task: Conductor - Implement Strict Type Hinting across the Entire Codebase. [c816f65]
    - [x] Engine Core (`ai_client.py`, `mcp_client.py`, `aggregate.py`, `shell_runner.py`)
    - [x] Develop/Integrate Surgical AST Tools in `mcp_client.py` and `tools.json`.
    - [x] Management Modules (project_manager.py, session_logger.py) [19c28a1]
    - [x] UI Modules (`gui_2.py`, `gui_legacy.py`) [c816f65]
- [x] Task: Conductor - Update `conductor/code_styleguides/python.md` with the new AI-optimized standard. [602cea6]
- [x] Task: Conductor - User Manual Verification 'Phase 3: Metadata and Final Documentation' (Protocol in workflow.md)

## Phase 4: Codebase-Wide Type Hint Sweep [checkpoint: 2907eb9]
- [x] Task: Conductor - Type hint pass on core modules (`api_hook_client.py`, `api_hooks.py`, `log_registry.py`, `performance_monitor.py`, `theme.py`, `theme_2.py`, `gemini_cli_adapter.py`, `multi_agent_conductor.py`, `dag_engine.py`, `events.py`, `file_cache.py`, `models.py`, `log_pruner.py`, `gemini.py`, `orchestrator_pm.py`, `conductor_tech_lead.py`, `outline_tool.py`, `summarize.py`). 46c2f9a
- [x] Task: Conductor - Type hint pass on remaining variable-only files (`ai_client.py` vars, `mcp_client.py` vars, `mma_prompts.py` vars) 8c5a560
- [x] Task: Conductor - Type hint pass on scripts (`scripts/*.py`) 53c2bbf
- [x] Task: Conductor - Type hint pass on simulation modules (`simulation/*.py`) ec91c90
- [x] Task: Conductor - Type hint pass on test files (`tests/*.py`, `conductor/tests/*.py`) 7a0e8e6
- [x] Task: Conductor - User Manual Verification 'Phase 4: Codebase-Wide Type Hint Sweep'

---

**Protocol Note:** Each task will follow the Standard Task Workflow (Red/Green phases with Tier 3 Worker delegation). Phase completion will trigger the mandatory Verification and Checkpointing protocol.


## Phase 5: Ultra-Compact Indentation Refactor (1-Space Indent) [checkpoint: 173ea96]
- [x] Task: Conductor - Implement automated conversion script for 4-space to 1-space indentation. 53c2bbf
- [x] Task: Conductor - Apply 1-space indent refactor to all `.py` files in the codebase. 173ea96
- [x] Task: Conductor - User Manual Verification 'Phase 5: Ultra-Compact Indentation Refactor'


## Phase 6: Test Suite Stabilization (High-Signal Reporting)
- [x] Task: Conductor - Resolve API/Method name drift (e.g., `run_linear` -> `run` in ConductorEngine).
    - **Requirement:** Implement "Before vs After" state tables in `logs/test/unique_signature/<script_name>.txt`.
- [x] Task: Conductor - Fix `ai_style_formatter.py` test expectations for ultra-compact style.
    - **Requirement:** Log table-based comparison of code states in `logs/test/unique_signature/test_ai_style_formatter.txt`.
- [x] Task: Conductor - Align `tier4_interceptor.py` tests with current PowerShell output formatting.
    - **Requirement:** Log expected vs actual PowerShell output mappings in `logs/test/unique_signature/test_tier4_interceptor.txt`.
- [x] Task: Conductor - Investigate and stabilize `live_gui` test environment collection/startup. 173ea96
    - **Requirement:** Log comprehensive environment telemetry (Before/After/Delta) in `logs/test/unique_signature/live_gui_diag.txt`.
- [ ] Task: Conductor - User Manual Verification 'Phase 6: Test Suite Stabilization'




