From 1eb9d2923f7335d78237882c8e4856ee6b5d82a5 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Wed, 4 Mar 2026 09:51:51 -0500 Subject: [PATCH] chore(cleanup): Remove unused scripts and artifacts from project root --- conductor/tracks.md | 2 +- .../codebase_migration_20260302/plan.md | 14 +- fix_task.toml | 17 - full_codebase_skeleton.txt | 7231 ----------------- gemini.py | 35 - get_file_summary.bat | 2 - gui_2_mypy.txt | Bin 78834 -> 0 bytes gui_2_only_errors.txt | Bin 10462 -> 0 bytes refactor_ui_task.toml | 10 - reproduce_missing_hints.py | 21 - run_tests.py | 113 - sanity_task.toml | 3 - scan_report.txt | 31 - task.toml | 17 - test_mma_persistence.py | 30 - verify_pm_changes.py | 0 16 files changed, 4 insertions(+), 7522 deletions(-) delete mode 100644 fix_task.toml delete mode 100644 full_codebase_skeleton.txt delete mode 100644 gemini.py delete mode 100644 get_file_summary.bat delete mode 100644 gui_2_mypy.txt delete mode 100644 gui_2_only_errors.txt delete mode 100644 refactor_ui_task.toml delete mode 100644 reproduce_missing_hints.py delete mode 100644 run_tests.py delete mode 100644 sanity_task.toml delete mode 100644 scan_report.txt delete mode 100644 task.toml delete mode 100644 test_mma_persistence.py delete mode 100644 verify_pm_changes.py diff --git a/conductor/tracks.md b/conductor/tracks.md index d2aa0cb..3ccae4f 100644 --- a/conductor/tracks.md +++ b/conductor/tracks.md @@ -8,7 +8,7 @@ This file tracks all major tracks for the project. Each track has its own detail *The following tracks MUST be executed in this exact order to safely resolve tech debt before feature development.* -1. [ ] **Track: Codebase Migration to `src` & Cleanup** +1. [~] **Track: Codebase Migration to `src` & Cleanup** *Link: [./tracks/codebase_migration_20260302/](./tracks/codebase_migration_20260302/)* 2. [ ] **Track: GUI Decoupling & Controller Architecture** diff --git a/conductor/tracks/codebase_migration_20260302/plan.md b/conductor/tracks/codebase_migration_20260302/plan.md index be4ca0f..69587f8 100644 --- a/conductor/tracks/codebase_migration_20260302/plan.md +++ b/conductor/tracks/codebase_migration_20260302/plan.md @@ -1,17 +1,9 @@ # Implementation Plan: Codebase Migration to `src` & Cleanup (codebase_migration_20260302) ## Phase 1: Unused File Identification & Removal -- [ ] Task: Initialize MMA Environment `activate_skill mma-orchestrator` -- [ ] Task: Audit Codebase for Dead Files - - [ ] WHERE: Project root - - [ ] WHAT: Run `py_find_usages` or grep on suspected unused files to verify they are not referenced by `gui_2.py`, `tests/`, `simulation/`, or core config files. - - [ ] HOW: Gather a list of unused files. - - [ ] SAFETY: Do not delete files referenced in `.toml` files or Github action workflows. -- [ ] Task: Delete Unused Files - - [ ] WHERE: Project root - - [ ] WHAT: Use `run_powershell` with `Remove-Item` to delete the identified unused files. - - [ ] HOW: Explicitly list and delete them. - - [ ] SAFETY: Stage deletions to Git carefully. +- [x] Task: Initialize MMA Environment `activate_skill mma-orchestrator` +- [x] Task: Audit Codebase for Dead Files +- [x] Task: Delete Unused Files - [ ] Task: Conductor - User Manual Verification 'Phase 1: Unused File Identification & Removal' (Protocol in workflow.md) ## Phase 2: Directory Restructuring & Migration diff --git a/fix_task.toml b/fix_task.toml deleted file mode 100644 index 3c7685c..0000000 --- a/fix_task.toml +++ /dev/null @@ -1,17 +0,0 @@ -role = "tier3-worker" -prompt = """FIX DeepSeek implementation in ai_client.py. - -CONTEXT: -Several tests in @tests/test_deepseek_provider.py are failing (returning '(No text returned by the model)') because the current implementation of '_send_deepseek' in @ai_client.py forces 'stream=True' and expects SSE format, but the test mocks provide standard JSON responses. - -TASK: -1. Modify '_send_deepseek' in @ai_client.py to handle the response correctly whether it is a stream or a standard JSON response. - - You should probably determine this based on the 'stream' value in the payload (which is currently hardcoded to True, but the implementation should be flexible). - - If 'stream' is True, use the iter_lines() logic to aggregate chunks. - - If 'stream' is False, use resp.json() to get the content. -2. Fix the 'NameError: name 'data' is not defined' and ensure 'usage' is correctly extracted. -3. Ensure 'full_content', 'full_reasoning' (thinking tags), and 'tool_calls' are correctly captured and added to the conversation history in both modes. -4. Ensure all tests in @tests/test_deepseek_provider.py pass. - -OUTPUT: Provide the raw Python code for the modified '_send_deepseek' function.""" -docs = ["ai_client.py", "tests/test_deepseek_provider.py"] diff --git a/full_codebase_skeleton.txt b/full_codebase_skeleton.txt deleted file mode 100644 index 3923f7a..0000000 --- a/full_codebase_skeleton.txt +++ /dev/null @@ -1,7231 +0,0 @@ ---- File: aggregate.py --- -# aggregate.py -from __future__ import annotations -""" -Note(Gemini): -This module orchestrates the construction of the final Markdown context string. -Instead of sending every file to the AI raw (which blows up tokens), this uses a pipeline: -1. Resolve paths (handles globs and absolute paths). -2. Build file items (raw content). -3. If 'summary_only' is true (which is the default behavior now), it pipes the files through - summarize.py to generate a compacted view. - -This is essential for keeping prompt tokens low while giving the AI enough structural info -to use the MCP tools to fetch only what it needs. -""" -import tomllib -import re -import glob -from pathlib import Path, PureWindowsPath -from typing import Any -import summarize -import project_manager -from file_cache import ASTParser - -def find_next_increment(output_dir: Path, namespace: str) -> int: - ... - -def is_absolute_with_drive(entry: str) -> bool: - ... - -def resolve_paths(base_dir: Path, entry: str) -> list[Path]: - ... - -def build_discussion_section(history: list[str]) -> str: - ... - -def build_files_section(base_dir: Path, files: list[str | dict[str, Any]]) -> str: - ... - -def build_screenshots_section(base_dir: Path, screenshots: list[str]) -> str: - ... - -def build_file_items(base_dir: Path, files: list[str | dict[str, Any]]) -> list[dict[str, Any]]: - """ - Return a list of dicts describing each file, for use by ai_client when it - wants to upload individual files rather than inline everything as markdown. - - Each dict has: - path : Path (resolved absolute path) - entry : str (original config entry string) - content : str (file text, or error string) - error : bool - mtime : float (last modification time, for skip-if-unchanged optimization) - tier : int | None (optional tier for context management) - """ - ... - -def build_summary_section(base_dir: Path, files: list[str | dict[str, Any]]) -> str: - """ - Build a compact summary section using summarize.py — one short block per file. - Used as the initial block instead of full file contents. - """ - ... - -def _build_files_section_from_items(file_items: list[dict[str, Any]]) -> str: - """Build the files markdown section from pre-read file items (avoids double I/O).""" - ... - -def build_markdown_from_items(file_items: list[dict[str, Any]], screenshot_base_dir: Path, screenshots: list[str], history: list[str], summary_only: bool = False) -> str: - """Build markdown from pre-read file items instead of re-reading from disk.""" - ... - -def build_markdown_no_history(file_items: list[dict[str, Any]], screenshot_base_dir: Path, screenshots: list[str], summary_only: bool = False) -> str: - """Build markdown with only files + screenshots (no history). Used for stable caching.""" - ... - -def build_discussion_text(history: list[str]) -> str: - """Build just the discussion history section text. Returns empty string if no history.""" - ... - -def build_tier1_context(file_items: list[dict[str, Any]], screenshot_base_dir: Path, screenshots: list[str], history: list[str]) -> str: - """ - Tier 1 Context: Strategic/Orchestration. - Full content for core conductor files and files with tier=1, summaries for others. - """ - ... - -def build_tier2_context(file_items: list[dict[str, Any]], screenshot_base_dir: Path, screenshots: list[str], history: list[str]) -> str: - """ - Tier 2 Context: Architectural/Tech Lead. - Full content for all files (standard behavior). - """ - ... - -def build_tier3_context(file_items: list[dict[str, Any]], screenshot_base_dir: Path, screenshots: list[str], history: list[str], focus_files: list[str]) -> str: - """ - Tier 3 Context: Execution/Worker. - Full content for focus_files and files with tier=3, summaries/skeletons for others. - """ - ... - -def build_markdown(base_dir: Path, files: list[str | dict[str, Any]], screenshot_base_dir: Path, screenshots: list[str], history: list[str], summary_only: bool = False) -> str: - ... - -def run(config: dict[str, Any]) -> tuple[str, Path, list[dict[str, Any]]]: - ... - -def main() -> None: -# Load global config to find active project - ... - -if __name__ == "__main__": - main() - - ---- File: ai_client.py --- -# ai_client.py -from __future__ import annotations -""" -Note(Gemini): -Acts as the unified interface for multiple LLM providers (Anthropic, Gemini). -Abstracts away the differences in how they handle tool schemas, history, and caching. - -For Anthropic: aggressively manages the ~200k token limit by manually culling -stale [FILES UPDATED] entries and dropping the oldest message pairs. - -For Gemini: injects the initial context directly into system_instruction -during chat creation to avoid massive history bloat. -""" -# ai_client.py -import tomllib -import json -import sys -import time -import datetime -import hashlib -import difflib -import threading -import requests -from typing import Optional, Callable, Any -import os -import project_manager -import file_cache -import mcp_client -import anthropic -from gemini_cli_adapter import GeminiCliAdapter -from google import genai -from google.genai import types -from events import EventEmitter - -_provider: str = "gemini" -_model: str = "gemini-2.5-flash-lite" -_temperature: float = 0.0 -_max_tokens: int = 8192 - -_history_trunc_limit: int = 8000 - -# Global event emitter for API lifecycle events -events: EventEmitter = EventEmitter() - -def set_model_params(temp: float, max_tok: int, trunc_limit: int = 8000) -> None: - ... - -def get_history_trunc_limit() -> int: - ... - -def set_history_trunc_limit(val: int) -> None: - ... - -_gemini_client: genai.Client | None = None -_gemini_chat: Any = None -_gemini_cache: Any = None -_gemini_cache_md_hash: int | None = None -_gemini_cache_created_at: float | None = None - -# Gemini cache TTL in seconds. Caches are created with this TTL and -# proactively rebuilt at 90% of this value to avoid stale-reference errors. -_GEMINI_CACHE_TTL: int = 3600 - -_anthropic_client: anthropic.Anthropic | None = None -_anthropic_history: list[dict] = [] -_anthropic_history_lock: threading.Lock = threading.Lock() - -_deepseek_client: Any = None -_deepseek_history: list[dict] = [] -_deepseek_history_lock: threading.Lock = threading.Lock() - -_send_lock: threading.Lock = threading.Lock() - -_gemini_cli_adapter: GeminiCliAdapter | None = None - -# Injected by gui.py - called when AI wants to run a command. -# Signature: (script: str, base_dir: str) -> str | None -confirm_and_run_callback: Callable[[str, str], str | None] | None = None - -# Injected by gui.py - called whenever a comms entry is appended. -# Signature: (entry: dict) -> None -comms_log_callback: Callable[[dict[str, Any]], None] | None = None - -# Injected by gui.py - called whenever a tool call completes. -# Signature: (script: str, result: str) -> None -tool_log_callback: Callable[[str, str], None] | None = None - -# Set by caller tiers before ai_client.send(); cleared in finally. -# Safe — ai_client.send() calls are serialized by the MMA engine executor. -current_tier: str | None = None -# Increased to allow thorough code exploration before forcing a summary -MAX_TOOL_ROUNDS: int = 10 - -# Maximum cumulative bytes of tool output allowed per send() call. -# Prevents unbounded memory growth during long tool-calling loops. -_MAX_TOOL_OUTPUT_BYTES: int = 500_000 - -# Maximum characters per text chunk sent to Anthropic. -# Kept well under the ~200k token API limit. -_ANTHROPIC_CHUNK_SIZE: int = 120_000 - -_SYSTEM_PROMPT: str = ( - "You are a helpful coding assistant with access to a PowerShell tool and MCP tools (file access: read_file, list_directory, search_files, get_file_summary, web access: web_search, fetch_url). " - "When calling file/directory tools, always use the 'path' parameter for the target path. " - "When asked to create or edit files, prefer targeted edits over full rewrites. " - "Always explain what you are doing before invoking the tool.\n\n" - "When writing or rewriting large files (especially those containing quotes, backticks, or special characters), " - "avoid python -c with inline strings. Instead: (1) write a .py helper script to disk using a PS here-string " - "(@'...'@ for literal content), (2) run it with `python