# Implementation Plan ## Phase 2: Vim Modes and Navigation **Done when:** Fluid mode switching and scrolling feels vim-native ### 2.3 Command Parser + Execution - Parse command buffer on enter: `:quit` -> `Quit`, `:clear` -> clear messages and history, `:q` alias for `:quit` - Return appropriate `LoopControl` or mutate `AppState` directly for display-only commands - Unknown commands -> show error in a transient status area ### 2.4 Status Bar + Command Overlay - Add a status bar row at the bottom of the layout (below input pane) - Status bar shows: current mode (`-- NORMAL --`, `-- INSERT --`), token totals (placeholder for now) - Style: bold, color-coded per mode (following vim convention) - Command input renders as a floating bar near the top of the screen (overlay on the output pane), not in the status bar - Command overlay: shows `:` prefix + partial command buffer, only visible in Command mode - Overlay dismisses on Esc or Enter ### 2.6 Input Pane Behavior by Mode - Normal mode: input pane shows last draft (unsent) message or is empty, not editable - Insert mode: input pane is editable (current behavior) - Command mode: floating overlay near top shows `:` prefix + command buffer; input pane unchanged - Cursor visibility: show cursor in Insert and Command modes, hide in Normal ### 2.7 Phase 2 Unit Tests - Mode transitions: Normal->Insert->Normal, Normal->Command->Normal, Command execute - Key dispatch: correct handler called per mode - Command parser: `:quit`, `:clear`, `:q`, unknown command - Scroll clamping: j/k at boundaries, G/gg - `insta` snapshot tests: mode indicator rendering for each mode, layout with status bar - Existing Phase 1 input tests still pass (insert mode behavior unchanged) ## Phase 3: Tool Execution - `Tool` trait, `ToolRegistry`, core tools (`read_file`, `write_file`, `shell_exec`) - Tool definitions in API requests, parse tool-use responses - Approval gate: core -> TUI pending event -> user approve/deny -> result back - Working directory confinement + path validation (no Landlock yet) - **Done when:** Claude can read, modify files, and run commands with user approval ## Phase 4: Sandboxing - Landlock: read-only system, read-write project dir, network blocked - Tools execute through `Sandbox`, never directly - `:net on/off` toggle, state in status bar - Graceful degradation on older kernels - **Done when:** Writes outside project dir fail; network toggle works