From 53752dfc556eaff1a68a7a0dd90abf4f70ef71c6 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 28 Feb 2026 20:53:35 -0500 Subject: [PATCH] chore(conductor): Archive track 'python_style_refactor_20260227' --- .../python_style_refactor_20260227/index.md | 5 ++ .../metadata.json | 8 +++ .../python_style_refactor_20260227/plan.md | 60 +++++++++++++++++++ .../python_style_refactor_20260227/spec.md | 39 ++++++++++++ conductor/tracks.md | 5 -- 5 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 conductor/archive/python_style_refactor_20260227/index.md create mode 100644 conductor/archive/python_style_refactor_20260227/metadata.json create mode 100644 conductor/archive/python_style_refactor_20260227/plan.md create mode 100644 conductor/archive/python_style_refactor_20260227/spec.md diff --git a/conductor/archive/python_style_refactor_20260227/index.md b/conductor/archive/python_style_refactor_20260227/index.md new file mode 100644 index 0000000..d698627 --- /dev/null +++ b/conductor/archive/python_style_refactor_20260227/index.md @@ -0,0 +1,5 @@ +# Track python_style_refactor_20260227 Context + +- [Specification](./spec.md) +- [Implementation Plan](./plan.md) +- [Metadata](./metadata.json) diff --git a/conductor/archive/python_style_refactor_20260227/metadata.json b/conductor/archive/python_style_refactor_20260227/metadata.json new file mode 100644 index 0000000..136d6d5 --- /dev/null +++ b/conductor/archive/python_style_refactor_20260227/metadata.json @@ -0,0 +1,8 @@ +{ + "track_id": "python_style_refactor_20260227", + "type": "refactor", + "status": "new", + "created_at": "2026-02-27T10:00:00Z", + "updated_at": "2026-02-27T10:00:00Z", + "description": "Adjust python code style. I want to covert all the python code in this codebase (not thirdparty pacakge code) to usse single space python indentation. I also want to reduce empty newlines. This is to reduce redundant tokens as this codebase is mostly managed by ai agents. Do any ideal adjustments for ai agents to the code style in @C:\projects\manual_slop\conductor\code_styleguides\python.md and if they are non-trivval changes we'll make phases for their refactors." +} diff --git a/conductor/archive/python_style_refactor_20260227/plan.md b/conductor/archive/python_style_refactor_20260227/plan.md new file mode 100644 index 0000000..34530a0 --- /dev/null +++ b/conductor/archive/python_style_refactor_20260227/plan.md @@ -0,0 +1,60 @@ +# 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) [checkpoint: 3b96b67] +- [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/.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`. +- [x] Task: Conductor - User Manual Verification 'Phase 6: Test Suite Stabilization' + + + + + + +## Phase: Review Fixes +- [x] Task: Apply review suggestions da7a2e3 diff --git a/conductor/archive/python_style_refactor_20260227/spec.md b/conductor/archive/python_style_refactor_20260227/spec.md new file mode 100644 index 0000000..7ad9d57 --- /dev/null +++ b/conductor/archive/python_style_refactor_20260227/spec.md @@ -0,0 +1,39 @@ +# Specification: AI-Optimized Python Style Refactor + +## 1. Overview +Refactor the Python codebase to a "Single-Space, Ultra-Compact" style specifically designed to minimize token consumption for AI agents. This involves reducing whitespace and blank lines while enhancing structural metadata (type hints) for better agent comprehension. + +## 2. Functional Requirements +- **Indentation:** All 4-space indentations must be converted to **exactly 1 space** per level. This includes hanging indents and line continuations. +- **Newlines (Ultra-Compact):** + - Maximum **one (1)** blank line between top-level definitions (classes, functions). + - **Zero (0)** blank lines inside function or method bodies. +- **Typing (Strict):** Ensure all function and method signatures include strict type hints for `Args` and `Returns`. +- **Scope:** + - Target: All `.py` files in the project root and subdirectories. + - Exclusions: `.venv/`, `__pycache__/`, and third-party package code. + +## 3. Non-Functional Requirements +- **Valid Python:** The resulting code MUST remain syntactically valid and executable Python 3.11+. +- **AST Compatibility:** The style must not interfere with existing AST tools (`ast`, `tree-sitter`) used for interface extraction and code outlines. +- **Token Efficiency:** The primary goal is to reduce the total token count of the codebase. + +## 4. Current Status (Progress Checkpoint) +- **Phase 1: Completed.** Tooling developed (`scripts/ai_style_formatter.py`) and verified. +- **Phase 2: Completed.** Global codebase refactor for indentation and ultra-compact newlines (including 1-line gap before definitions) applied to all Python files. +- **Phase 3: In Progress.** + - **Surgical Tooling:** New tools added to `mcp_client.py` and `.gemini/tools.json`: `get_file_slice`, `set_file_slice`, `py_update_definition`, `py_get_signature`, `py_set_signature`, `py_get_class_summary`, `py_get_var_declaration`, `py_set_var_declaration`. + - **Core Typing:** `ai_client.py`, `mcp_client.py`, `aggregate.py`, `shell_runner.py` fully updated with strict type hints. + - **Remaining:** `project_manager.py`, `session_logger.py`, `gui_2.py`, `gui_legacy.py` need strict typing. + +## 5. Acceptance Criteria +- [x] Codebase indentation is uniformly 1 space. +- [x] No `.py` file contains consecutive blank lines. +- [x] No `.py` file contains blank lines within function or method bodies. +- [~] All functions/methods have complete type hints (Core Engine complete, UI/Manager pending). +- [x] Application remains functional and passes existing tests. + +## 6. Out of Scope +- Architectural changes or logic refactoring. +- Modification of non-Python files (e.g., `.md`, `.toml`, `.ps1`). +- Import compaction (discarded per user request). diff --git a/conductor/tracks.md b/conductor/tracks.md index 43488ab..693b846 100644 --- a/conductor/tracks.md +++ b/conductor/tracks.md @@ -7,9 +7,4 @@ This file tracks all major tracks for the project. Each track has its own detail - [~] **Track: Robust Live Simulation Verification** *Link: [./tracks/robust_live_simulation_verification/](./tracks/robust_live_simulation_verification/)* ---- - -- [x] **Track: AI-Optimized Python Style Refactor** -*Link: [./tracks/python_style_refactor_20260227/](./tracks/python_style_refactor_20260227/)* -