{hook.event}`
+
+**Desired Behavior:**
+
+- Replace with a set of checkboxes for event selection
+- Available events (from `HookEventType`):
+ - `PreToolUse`
+ - `PostToolUse`
+ - `PostToolUseFailure`
+ - `PermissionRequest`
+ - `UserPromptSubmit`
+ - `Stop`
+ - `SubagentStop`
+ - `SubagentStart`
+ - `SessionStart`
+ - `SessionEnd`
+ - `Notification`
+ - `PreCompact`
+
+**Technical Approach for YAML Updates:**
+
+Since hooks are currently structured under event keys in YAML:
+
+```yaml
+hooks:
+ PreToolUse:
+ - id: example-hook
+ ...
+```
+
+The UI will treat a "hook" as a **conceptual entity** that may have multiple YAML entries (one per event).
+
+**Update Logic:**
+
+- **When adding an event**: Copy the hook definition to the new event key in YAML
+- **When removing an event**: Remove the hook definition from that event key in YAML
+- **When changing events**: Combination of remove from old + add to new
+- **Validation**: A hook must have at least one event selected at all times
+
+**Edge Case - Multiple Entries with Same ID:**
+If the same hook ID exists under multiple event keys (which can happen with manual editing), the UI should:
+
+1. Load all entries as separate instances in the list
+2. Allow editing each independently OR merge them into a "multi-event" view
+3. **Recommendation**: Show as separate expandable items, but allow bulk event changes via a context menu
+
+### 2. Matcher Configuration
+
+**Current Behavior:**
+
+- Displays as a bulleted list of matcher patterns
+- No edit capability in UI
+
+**Desired Behavior:**
+
+- Replace with a set of checkboxes for tool groups
+- Available groups (from `TOOL_GROUPS`):
+
+ - `read` - read_file, fetch_instructions, search_files, list_files, codebase_search
+ - `edit` - apply_diff, write_to_file, generate_image (plus customTools)
+ - `browser` - browser_action
+ - `command` - execute_command
+ - `mcp` - use_mcp_tool, access_mcp_resource
+ - `modes` - switch_mode, new_task
+
+- Additional "Custom" option that reveals a text input for regex patterns
+- Checkboxes represent the `matcher` field, joined with `|` (e.g., `read|edit`)
+
+**UI Layout:**
+
+```
+[ ] read [ ] edit [ ] browser
+[ ] command [ ] mcp [ ] modes
+[ ] Custom matcher:
+ ┌─────────────────────────┐
+ │ file.*\.ts │
+ └─────────────────────────┘
+```
+
+**Update Logic:**
+
+- Selected checkboxes → join with `|` → `matcher: "read|edit"`
+- If custom input has value → append to the joined string
+- Pattern: `[group1]|[group2]|[customPattern]`
+
+**Handling Mixed Matchers:**
+
+- If user has `matcher: "read|file.*\.ts"`:
+ - `read` checkbox: checked
+ - `file.*\.ts` shown in custom input (with label indicating it's not a standard group)
+
+### 3. Timeout Configuration
+
+**Current Behavior:**
+
+- Displays as plain text: `{hook.timeout}s`
+
+**Desired Behavior:**
+
+- Replace with a dropdown menu with preset options
+- Options:
+ - 15 seconds
+ - 30 seconds
+ - 1 minute
+ - 5 minutes
+ - 10 minutes
+ - 15 minutes
+ - 30 minutes
+ - 60 minutes
+
+**UI Component:**
+
+```
+Timeout: [ 30 seconds ▼ ]
+```
+
+**Update Logic:**
+
+- Convert selected dropdown value to seconds for YAML storage
+- Store as `timeout: 30` (seconds) in YAML
+
+---
+
+## Technical Design
+
+### Data Model Updates
+
+Extend `ResolvedHook` or create a new `HookConfigUIState` for the enhanced UI:
+
+```typescript
+interface HookConfigUIState {
+ id: string
+ filePath: string
+ source: "project" | "mode" | "global"
+ enabled: boolean
+
+ // New fields for enhanced UI
+ events: HookEventType[] // Multiple events this hook responds to
+ matcher: string // Raw matcher string (for editing)
+ matcherGroups: ToolGroup[] // Parsed group names from matcher
+ timeout: number // in seconds
+ command: string
+ shell?: string
+ description?: string
+ commandPreview: string
+}
+```
+
+### Backend Message Protocol
+
+Add new message type for updating hook configuration:
+
+```typescript
+// Webview -> Extension
+interface HooksUpdateHookMessage {
+ type: "hooksUpdateHook"
+ hookId: string
+ filePath: string // Source file to modify
+ updates: {
+ events?: HookEventType[] // New set of events
+ matcher?: string // New matcher string
+ timeout?: number // New timeout in seconds
+ }
+}
+
+// Extension -> Webview (response)
+interface HooksUpdateHookResult {
+ success: boolean
+ error?: string
+}
+```
+
+### YAML Update Algorithm
+
+```typescript
+async function updateHookConfig(filePath: string, hookId: string, updates: HookUpdates): Promise
- {hook.event}
-
+