Elffuss BraidHub

kikocis/continue public

main · 3.6 KiBRenderedRawPermalink
1# Modes
2
3Modes are a system for managing tool permissions in the CLI. They can be set via command-line flags at startup or switched dynamically during chat sessions. The following modes are available:
4
5## Available Modes
6
7### `normal` (default)
8
9The default mode that follows configured permission policies from `permissions.yaml` and command-line overrides without any additional restrictions or mode-specific policies.
10
11- **UI Indicator:** No indicator shown (clean interface for default behavior)
12- **Current directory:** Visible in status bar for context
13- **Permission behavior:** Uses existing permission policies as configured
14- **Backward compatibility:** Existing configurations work unchanged
15
16### `plan`
17
18Planning mode that **completely overrides all user permissions** to enforce read-only access with command execution. This mode prevents file modifications but allows command execution for analysis, regardless of user configuration.
19
20- **Command-line flag:** `--readonly` (for backward compatibility)
21- **UI Indicator:** `[plan]` shown in blue
22- **Current directory:** Hidden to save space and focus on analysis
23- **Permission override:** **Absolute** - excludes write tools (Write, Edit, etc.) and allows read tools (Read, Grep, LS, etc.) and Bash for command execution
24- **User config ignored:** Any user `--allow` flags for write tools are overridden
25
26### `auto`
27
28Auto mode that **completely overrides all user permissions** to allow everything without asking. This mode provides maximum automation by bypassing all permission policies and restrictions, regardless of user configuration.
29
30- **Command-line flag:** `--auto` (starts in auto mode)
31- **UI Indicator:** `[auto]` shown in green
32- **Current directory:** Hidden to save space and focus on automation
33- **Permission override:** **Absolute** - allows all tools with `*: allow` policy
34- **User config ignored:** Any user `--exclude` flags are overridden - everything is allowed
35
36## Usage
37
38### Command-Line Initialization
39
40Modes can be set when starting the CLI:
41
42```bash
43cn --readonly "Help me analyze this code" # Starts in plan mode
44cn --auto "Fix all the linting errors" # Starts in auto mode
45cn "Let me implement this feature" # Starts in normal mode (default)
46```
47
48### Dynamic Mode Switching
49
50Users can switch modes during chat sessions using:
51
52**Keyboard Shortcut:**
53
54- **Shift+Tab** - Cycle through modes: normal → plan → auto → (repeat)
55
56## Implementation
57
58Modes are implemented through the permission system:
59
60- **ModeService**: Singleton service managing the current mode and initialization
61- **ToolPermissionService**: Extended to support mode-specific policies with highest priority
62- **ModeIndicator**: UI component showing current mode (hidden for normal mode)
63- **Keyboard shortcuts**: Shift+Tab cycles through modes instantly
64- **Backward compatibility**: Existing `--readonly` flag maps to plan mode
65
66### Mode Policy Priority
67
68**Mode policies completely override all other configurations** when in plan or auto mode:
69
70**Plan and Auto modes:**
71
721. **Mode policies** (absolute override - ignores everything else)
73
74**Normal mode only:**
75
761. Command-line overrides (`--allow`, `--ask`, `--exclude`)
772. Permission configuration from `permissions.yaml`
783. Default tool policies
79
80### Mode-Specific Behaviors
81
82- **normal**: No mode policies applied, uses existing user configuration; shows current directory
83- **plan**: **Absolute override** - excludes write tools (Write, Edit), allows read tools (Read, Grep, LS) and Bash; hides current directory
84- **auto**: **Absolute override** - allows all tools with `*: allow` policy; hides current directory