From c75b926c4506de3126e61e6108a3101aaf7cfa71 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 27 Feb 2026 23:37:03 -0500 Subject: [PATCH] chore(conductor): Add new track 'AI-Optimized Python Style Refactor' --- conductor/tracks.md | 7 ++-- .../python_style_refactor_20260227/index.md | 5 +++ .../metadata.json | 8 +++++ .../python_style_refactor_20260227/plan.md | 22 +++++++++++++ .../python_style_refactor_20260227/spec.md | 32 +++++++++++++++++++ 5 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 conductor/tracks/python_style_refactor_20260227/index.md create mode 100644 conductor/tracks/python_style_refactor_20260227/metadata.json create mode 100644 conductor/tracks/python_style_refactor_20260227/plan.md create mode 100644 conductor/tracks/python_style_refactor_20260227/spec.md diff --git a/conductor/tracks.md b/conductor/tracks.md index edee6ae..2577aed 100644 --- a/conductor/tracks.md +++ b/conductor/tracks.md @@ -4,7 +4,10 @@ This file tracks all major tracks for the project. Each track has its own detail --- -- [ ] **Track: Robust Live Simulation Verification** +- [~] **Track: Robust Live Simulation Verification** *Link: [./tracks/robust_live_simulation_verification/](./tracks/robust_live_simulation_verification/)* ---- \ No newline at end of file +--- + +- [ ] **Track: AI-Optimized Python Style Refactor** +*Link: [./tracks/python_style_refactor_20260227/](./tracks/python_style_refactor_20260227/)* \ No newline at end of file diff --git a/conductor/tracks/python_style_refactor_20260227/index.md b/conductor/tracks/python_style_refactor_20260227/index.md new file mode 100644 index 0000000..d698627 --- /dev/null +++ b/conductor/tracks/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/tracks/python_style_refactor_20260227/metadata.json b/conductor/tracks/python_style_refactor_20260227/metadata.json new file mode 100644 index 0000000..136d6d5 --- /dev/null +++ b/conductor/tracks/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/tracks/python_style_refactor_20260227/plan.md b/conductor/tracks/python_style_refactor_20260227/plan.md new file mode 100644 index 0000000..a16c515 --- /dev/null +++ b/conductor/tracks/python_style_refactor_20260227/plan.md @@ -0,0 +1,22 @@ +# Implementation Plan: AI-Optimized Python Style Refactor + +## Phase 1: Research and Pilot Tooling +- [ ] Task: Conductor - Define and Test Style Transformation Logic. (Develop or adapt a tool to perform 1-space indentation and newline reduction safely). +- [ ] Task: Conductor - Run Style Pilot on a Representative Module (e.g., `theme.py`). +- [ ] Task: Conductor - User Manual Verification 'Phase 1: Pilot and Tooling' (Protocol in workflow.md) + +## Phase 2: Core Refactor - Indentation and Newlines +- [ ] Task: Conductor - Refactor Primary Engine Modules (`ai_client.py`, `aggregate.py`, `mcp_client.py`, `shell_runner.py`). +- [ ] Task: Conductor - Refactor Project & Session Management Modules (`project_manager.py`, `session_logger.py`). +- [ ] Task: Conductor - Refactor UI Modules (`gui_2.py`, `gui_legacy.py`, `theme.py`, `theme_2.py`). +- [ ] Task: Conductor - Refactor Remaining Utility and Support Modules (`events.py`, `file_cache.py`, `models.py`, `mma_prompts.py`). +- [ ] Task: Conductor - User Manual Verification 'Phase 2: Indentation and Newline Refactor' (Protocol in workflow.md) + +## Phase 3: AI-Optimized Metadata and Final Cleanup +- [ ] Task: Conductor - Implement Strict Type Hinting and Compact Imports across the Entire Codebase. +- [ ] Task: Conductor - Update `conductor/code_styleguides/python.md` with the new AI-optimized standard. +- [ ] Task: Conductor - User Manual Verification 'Phase 3: Metadata and Final Documentation' (Protocol in workflow.md) + +--- + +**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. diff --git a/conductor/tracks/python_style_refactor_20260227/spec.md b/conductor/tracks/python_style_refactor_20260227/spec.md new file mode 100644 index 0000000..f0bf8de --- /dev/null +++ b/conductor/tracks/python_style_refactor_20260227/spec.md @@ -0,0 +1,32 @@ +# 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. +- **Imports (Compact):** Consolidate imports into compact blocks to reduce vertical space. +- **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. Acceptance Criteria +- [ ] Codebase indentation is uniformly 1 space. +- [ ] No `.py` file contains consecutive blank lines. +- [ ] No `.py` file contains blank lines within function or method bodies. +- [ ] All functions/methods have complete type hints. +- [ ] Application remains functional and passes existing tests. + +## 5. Out of Scope +- Architectural changes or logic refactoring. +- Modification of non-Python files (e.g., `.md`, `.toml`, `.ps1`). +- Breaking PEP 8 compliance where it's not strictly necessary for token reduction (though indentation and blank lines are explicitly targeted).