# Implementation Plan

## Phase 1: Fix Tool Preset Manager Crashes
- [x] Task: Investigate `render_tool_preset_manager_content` in `src/gui_2.py` to identify the missing `current_cat_tools` initialization or scope.
- [x] Task: Fix the `NameError` and ensure correct ImGui child window scoping (`EndChild` vs `End`) in the Tool Preset Manager.
- [x] Task: Conductor - User Manual Verification 'Fix Tool Preset Manager Crashes' (Protocol in workflow.md)

## Phase 2: Fix Discussion Hub Crashes
- [x] Task: Investigate `render_discussion_entries` in `src/gui_2.py` to address the `IndexError` when deleting a discussion entry during rendering.
- [x] Task: Fix the `IndexError` (e.g. by deferring deletion or copying the list) and associated ImGui scoping errors (`PopID() too many times!`).
- [x] Task: Conductor - User Manual Verification 'Fix Discussion Hub Crashes' (Protocol in workflow.md)

## Phase 3: Global Verification
- [x] Task: Run `python scripts/check_imgui_scopes.py` to statically verify all ImGui scopes are correct across the codebase.
- [x] Task: Run automated test suite to ensure no regressions were introduced.
- [x] Task: Conductor - User Manual Verification 'Global Verification' (Protocol in workflow.md)

## Phase 4: Fix Take Tab Switching Bug
- [x] Task: Investigate the logic that handles switching between Takes in the Discussion Hub (e.g. `render_takes_panel` or similar tab rendering function) to find why it reverts state.
- [x] Task: Fix the state management bug causing the 1-frame flicker so the selected take persists.
- [x] Task: Conductor - User Manual Verification 'Fix Take Tab Switching' (Protocol in workflow.md)