# Implementation Plan: Command Palette & UI Performance Fixes

## Phase 1: Offloading Performance Fixes
- [x] Task: Async Context Preview
    - [x] Add `self._is_generating_preview = False` to `App.__init__`.
    - [x] Modify `_check_auto_refresh_context_preview` in `src/gui_2.py` to use a background thread.
- [ ] Task: Incremental AST Selection (Future/Nuance)
    - [ ] Investigate if `_do_generate` can accept a partial update flag to avoid full project re-render.

## Phase 2: Command Palette Implementation
- [ ] Task: Define Command Registry
    - [ ] Create a list of dictionaries in `App` containing `name`, `desc`, and `callback`.
- [ ] Task: Render Command Palette UI
    - [ ] Handle `Ctrl+P` (or `Cmd+P`) to toggle `self.show_command_palette`.
    - [ ] Use `imgui.begin_popup_modal` for the palette feel.
- [ ] Task: Keyboard Interactivity
    - [ ] Implement fuzzy search and keyboard navigation.


## Phase 3: Verification
- [ ] Task: Verification
    - [ ] Verify no UI hang when toggling AST nodes.
    - [ ] Verify Command Palette opens, filters correctly, and executes actions.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Verification' (Protocol in workflow.md)
