# Specification: Command Palette & UI Performance Fixes

## 1. Overview
This track addresses two distinct but critical areas:
1.  **UI Performance (Fix):** The application currently hangs when users adjust AST or slice configurations. This is because the context preview is regenerated synchronously on the GUI thread, blocking all interactions.
2.  **Command Palette (Feature):** A central, keyboard-driven interface for all application actions, similar to professional editors like VSCode or Sublime Text.

## 2. Functional Requirements
### 2.1 Async Context Preview
*   **Background Generation:** The `_do_generate` call within `_check_auto_refresh_context_preview` must be offloaded to an asynchronous worker thread.
*   **State Locking:** Prevent multiple concurrent generation threads from running if a preview refresh is already in progress.
*   **Incremental Signaling:** (Optional future goal) Investigate ways to only re-parse the affected file, but offloading is the immediate priority.

### 2.2 Everything Command Palette
*   **Shortcut Trigger:** Triggered by `Ctrl+P` (global project context).
*   **Fuzzy Search:** An input field that filters a global list of available commands.
*   **Action Mapping:** Includes actions like "Generate Response", "Clear Discussion", "Toggle Diagnostics", "Add All Files to Context", etc.
*   **Keyboard Navigation:** Use Up/Down arrows to navigate results and Enter to select/execute.
*   **Modal UX:** A centered, floating popup that dismisses on selection or Escape.

## 3. Non-Functional Requirements
*   **Smooth GUI Loop:** Offloading the generation must eliminate the UI hang.
*   **Low Latency Palette:** Search and filtering must feel instantaneous.

## 4. Acceptance Criteria
*   Toggling "Def", "Sig", or "Hide" on an AST node no longer causes the GUI to stutter or hang.
*   Pressing `Ctrl+P` opens the Command Palette.
*   Typing "Reset" shows "Reset Session" and executing it successfully resets the discussion.