# Implementation Plan: MMA Multi-Worker Visualization (mma_multiworker_viz_20260306)

> **Reference:** [Spec](./spec.md) | [Architecture Guide](../../../docs/guide_architecture.md)

## Phase 1: Stream Structure Enhancement
Focus: Extend existing mma_streams for per-worker tracking

- [ ] Task 1.1: Initialize MMA Environment
- [ ] Task 1.2: Review existing mma_streams structure
    - WHERE: `src/app_controller.py` line 142
    - WHAT: Current is `Dict[str, str]` - stream_id -> accumulated text
    - NOTE: Keep this structure, add per-worker metadata separately

## Phase 2: Worker Status Tracking
Focus: Track worker status separately

- [ ] Task 2.1: Add worker status dict
    - WHERE: `src/app_controller.py`
    - WHAT: Track status per worker
    - HOW:
      ```python
      self._worker_status: dict[str, str] = {}  # stream_id -> "running" | "completed" | "failed" | "killed"
      ```

- [ ] Task 2.2: Update status on worker events
    - WHERE: `src/app_controller.py` `_process_pending_gui_tasks()`
    - WHAT: Update status based on mma events
    - HOW: On "response" event, set status to "completed"

## Phase 3: Multi-Pane Display
Focus: Display all active streams

- [ ] Task 3.1: Iterate all Tier 3 streams
    - WHERE: `src/gui_2.py` `_render_tier_stream_panel()`
    - WHAT: Show all workers in split view
    - HOW:
      ```python
      tier3_keys = [k for k in self.mma_streams if "Tier 3" in k]
      for key in tier3_keys:
       status = self._worker_status.get(key, "unknown")
       imgui.text(f"{key}: {status}")
       if imgui.begin_child(f"stream_{key}", height=150):
        imgui.text_wrapped(self.mma_streams.get(key, ""))
       imgui.end_child()
      ```

## Phase 4: Stream Pruning
Focus: Limit memory per stream

- [ ] Task 4.1: Prune stream on append
    - WHERE: `src/app_controller.py` stream append logic
    - WHAT: Limit to 10KB per stream
    - HOW:
      ```python
      MAX_STREAM_SIZE = 10 * 1024
      self.mma_streams[stream_id] += text
      if len(self.mma_streams[stream_id]) > MAX_STREAM_SIZE:
       self.mma_streams[stream_id] = self.mma_streams[stream_id][-MAX_STREAM_SIZE:]
      ```

## Phase 5: Testing
- [ ] Task 5.1: Write unit tests
- [ ] Task 5.2: Conductor - Phase Verification
