# Implementation Plan: MMA Core Engine Implementation

## Phase 1: Track 1 - The Memory Foundations (AST Parser) [checkpoint: ac31e41]
- [x] Task: Dependency Setup (8fb75cc)
    - [x] Add `tree-sitter` and `tree-sitter-python` to `pyproject.toml` / `requirements.txt` (8fb75cc)
- [x] Task: Core Parser Class (7a609ca)
    - [x] Create `ASTParser` in `file_cache.py` (7a609ca)
- [x] Task: Skeleton View Extraction (7a609ca)
    - [x] Write query to extract `function_definition` and `class_definition` (7a609ca)
    - [x] Replace bodies with `pass`, keep type hints and signatures (7a609ca)
- [x] Task: Curated View Extraction (7a609ca)
    - [x] Keep class structures, module docstrings (7a609ca)
    - [x] Preserve `@core_logic` or `# [HOT]` function bodies, hide others (7a609ca)

## Phase 2: Track 2 - State Machine & Data Structures [checkpoint: a518a30]
- [x] Task: The Dataclasses (f9b5a50)
    - [x] Create `models.py` defining `Ticket` and `Track` (f9b5a50)
- [x] Task: Worker Context Definition (ee71929)
    - [x] Define `WorkerContext` holding `Ticket` ID, model config, and ephemeral messages (ee71929)
- [x] Task: State Mutator Methods (e925b21)
    - [x] Implement `ticket.mark_blocked()`, `ticket.mark_complete()`, `track.get_executable_tickets()` (e925b21)

## Phase 3: Track 3 - The Linear Orchestrator & Execution Clutch [checkpoint: e6c8d73]
- [x] Task: The Engine Core (7a30168)
    - [x] Create `multi_agent_conductor.py` containing `ConductorEngine` and `run_worker_lifecycle` (7a30168)
- [x] Task: Context Injection (9d6d174)
    - [x] Format context strings using `file_cache.py` target AST views (9d6d174)
- [x] Task: The HITL Execution Clutch (1afd9c8)
    - [x] Before executing `write_file`/`shell_runner.py` tools in step-mode, prompt user for confirmation (1afd9c8)
    - [x] Provide functionality to mutate the history JSON before resuming execution (1afd9c8)

## Phase 4: Track 4 - Tier 4 QA Interception [checkpoint: 61d17ad]
- [x] Task: The Interceptor Loop (bc654c2)
    - [x] Catch `subprocess.run()` execution errors inside `shell_runner.py` (bc654c2)
- [x] Task: Tier 4 Instantiation (8e4e326)
    - [x] Make a secondary API call to `default_cheap` model passing `stderr` and snippet (8e4e326)
- [x] Task: Payload Formatting (fb3da4d)
    - [x] Inject the 20-word fix summary into the Tier 3 worker history (fb3da4d)

## Phase 5: Track 5 - UI Decoupling & Tier 1/2 Routing (The Final Boss)
- [x] Task: The Event Bus (695cb4a)
    - [x] Implement an `asyncio.Queue` linking GUI actions to the backend engine (695cb4a)
- [x] Task: Tier 1 & 2 System Prompts (a28d71b)
    - [x] Create structured system prompts for Epic routing and Ticket creation (a28d71b)
- [x] Task: The Dispatcher Loop (1dacd36)
    - [x] Read Tier 2 JSON flat-lists, construct Tickets, execute Stub resolution paths (1dacd36)
- [x] Task: UI Component Update (68861c0)
    - [x] Refactor `gui_2.py` to push `UserRequestEvent` instead of blocking on API generation (68861c0)