You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Roo Code allows you to create **custom modes** to tailor Roo's behavior to specific tasks or workflows. Custom modes can be either **global** (available across all projects) or **project-specific** (defined within a single project). They allow you to define:
4
-
5
-
***A unique name and slug:** For easy identification
6
-
***A role definition:** Placed at the beginning of the system prompt, this defines Roo's core expertise and personality for the mode. This placement is crucial as it shapes Roo's fundamental understanding and approach to tasks
7
-
***Custom instructions:** Added at the end of the system prompt, these provide specific guidelines that modify or refine Roo's behavior. Unlike `.clinerules` files (which only add rules at the end), this structured placement of role and instructions allows for more nuanced control over Roo's responses
8
-
***Allowed tools:** Which Roo Code tools the mode can use (e.g., read files, write files, execute commands)
9
-
***File restrictions:** (Optional) Limit file access to specific file types or patterns (e.g., only allow editing `.md` files)
3
+
Roo Code allows you to create **custom modes** to tailor Roo's behavior to specific tasks or workflows. Custom modes can be either **global** (available across all projects) or **project-specific** (defined within a single project).
10
4
11
5
## Why Use Custom Modes?
12
6
@@ -15,56 +9,18 @@ Roo Code allows you to create **custom modes** to tailor Roo's behavior to speci
15
9
***Experimentation:** Safely experiment with different prompts and configurations without affecting other modes
16
10
***Team Collaboration:** Share custom modes with your team to standardize workflows
17
11
18
-
## Creating Custom Modes
19
-
20
-
You have three options for creating custom modes:
21
-
22
-
### 1. Ask Roo! (Recommended)
23
-
24
-
You can quickly create a basic custom mode by asking Roo Code to do it for you. For example:
25
-
26
-
> Create a new mode called "Documentation Writer". It should only be able to read files and write Markdown files.
27
-
28
-
Roo Code will guide you through the process. However, for fine-tuning modes or making specific adjustments, you'll want to use the Prompts tab or manual configuration methods described below.
29
-
30
-
### 2. Using the Prompts Tab
31
-
32
-
1.**Open Prompts Tab:** Click the <Codiconname="notebook" /> icon in the Roo Code top menu bar
33
-
2.**Create New Mode:** Click the <Codiconname="add" /> button to the right of the Modes heading
34
-
3.**Fill in Fields:**
35
-
***Name:** Enter a display name for the mode
36
-
***Slug:** Enter a lowercase identifier (letters, numbers, and hyphens only)
37
-
***Save Location:** Choose Global (via `cline_custom_modes.json`, available across all workspaces) or Project-specific (via `.roomodes` file in project root)
38
-
***Role Definition:** Define Roo's expertise and personality for this mode (appears at the start of the system prompt)
39
-
***Available Tools:** Select which tools this mode can use
40
-
***Custom Instructions:** (Optional) Add behavioral guidelines specific to this mode (appears at the end of the system prompt)
41
-
4.**Create Mode:** Click the "Create Mode" button to save your new mode
42
-
43
-
Note: File type restrictions can only be added through manual configuration.
44
-
45
-
### 3. Manual Configuration
46
-
47
-
You can configure custom modes by editing JSON files through the Prompts tab:
48
-
49
-
Both global and project-specific configurations can be edited through the Prompts tab:
50
-
51
-
1.**Open Prompts Tab:** Click the <Codiconname="notebook" /> icon in the Roo Code top menu bar
52
-
2.**Access Settings Menu:** Click the <Codiconname="bracket" /> button to the right of the Modes heading
53
-
3.**Choose Configuration:**
54
-
* Select "Edit Global Modes" to edit `cline_custom_modes.json` (available across all workspaces)
55
-
* Select "Edit Project Modes" to edit `.roomodes` file (in project root)
56
-
4.**Edit Configuration:** Modify the JSON file that opens
57
-
5.**Save Changes:** Roo Code will automatically detect the changes
12
+
<imgsrc="/img/custom-modes/custom-modes.png"alt="Overview of custom modes interface"width="400" />
13
+
*Roo Code's interface for creating and managing custom modes.*
2. Global mode configurations (from `cline_custom_modes.json`)
65
-
3. Default mode configurations
66
-
67
-
This means that project-specific configurations will override global configurations, which in turn override default configurations.
19
+
***A unique name and slug:** For easy identification
20
+
***A role definition:** Placed at the beginning of the system prompt, this defines Roo's core expertise and personality for the mode. This placement is crucial as it shapes Roo's fundamental understanding and approach to tasks
21
+
***Custom instructions:** Added at the end of the system prompt, these provide specific guidelines that modify or refine Roo's behavior. Unlike `.clinerules` files (which only add rules at the end), this structured placement of role and instructions allows for more nuanced control over Roo's responses
22
+
***Allowed tools:** Which Roo Code tools the mode can use (e.g., read files, write files, execute commands)
23
+
***File restrictions:** (Optional) Limit file access to specific file types or patterns (e.g., only allow editing `.md` files)
68
24
69
25
## Custom Mode Configuration (JSON Format)
70
26
@@ -115,13 +71,11 @@ Both global and project-specific configurations use the same JSON format. Each c
115
71
}]
116
72
```
117
73
118
-
### Optional Properties
74
+
### Understanding File Restrictions
119
75
120
-
#### `customInstructions`
121
-
* Additional behavioral guidelines for the mode
122
-
* Example: `"Focus on explaining concepts and providing examples"`
In addition to the `customInstructions` property in JSON, you can use a dedicated file for mode-specific instructions:
107
+
108
+
1. Create a file named `.clinerules-{mode-slug}` in your workspace root
109
+
* Replace `{mode-slug}` with your mode's slug (e.g., `.clinerules-docs-writer`)
110
+
2. Add your custom instructions to this file
111
+
3. Roo Code will automatically apply these instructions to the specified mode
112
+
113
+
This approach is particularly useful for:
114
+
* Keeping lengthy instructions separate from your mode configuration
115
+
* Managing instructions with version control
116
+
* Allowing non-technical team members to modify instructions without editing JSON
117
+
118
+
Note: If both `.clinerules-{mode-slug}` and the `customInstructions` property exist, they will be combined, with the file contents appended after the JSON property.
2. Global mode configurations (from `cline_custom_modes.json`)
126
+
3. Default mode configurations
127
+
128
+
This means that project-specific configurations will override global configurations, which in turn override default configurations.
129
+
130
+
## Creating Custom Modes
131
+
132
+
You have three options for creating custom modes:
133
+
134
+
### 1. Ask Roo! (Recommended)
135
+
136
+
You can quickly create a basic custom mode by asking Roo Code to do it for you. For example:
137
+
```
138
+
Create a new mode called "Documentation Writer". It should only be able to read files and write Markdown files.
139
+
```
140
+
Roo Code will guide you through the process. However, for fine-tuning modes or making specific adjustments, you'll want to use the Prompts tab or manual configuration methods described below.
141
+
:::info
142
+
#### Custom Mode Creation Settings
143
+
When enabled, Roo allows you to create custom modes using prompts like 'Make me a custom mode that...'. Disabling this reduces your system prompt by about 700 tokens when this feature isn't needed. When disabled you can still manually create custom modes using the + button above or by editing the related config JSON.
144
+
<imgsrc="/img/custom-modes/custom-modes-1.png"alt="Enable Custom Mode Creation Through Prompts setting"width="600" />
145
+
You can find this setting within the prompt settings by clicking the <Codiconname="notebook" /> icon in the Roo Code top menu bar.
146
+
:::
147
+
148
+
### 2. Using the Prompts Tab
149
+
150
+
1.**Open Prompts Tab:** Click the <Codiconname="notebook" /> icon in the Roo Code top menu bar
151
+
2.**Create New Mode:** Click the <Codiconname="add" /> button to the right of the Modes heading
152
+
3.**Fill in Fields:**
153
+
154
+
<imgsrc="/img/custom-modes/custom-modes-3.png"alt="Custom mode creation interface in the Prompts tab"width="600" />
155
+
*The custom mode creation interface showing fields for name, slug, save location, role definition, available tools, and custom instructions.*
156
+
157
+
* **Name:** Enter a display name for the mode
158
+
* **Slug:** Enter a lowercase identifier (letters, numbers, and hyphens only)
159
+
* **Save Location:** Choose Global (via `cline_custom_modes.json`, available across all workspaces) or Project-specific (via `.roomodes` file in project root)
160
+
* **Role Definition:** Define Roo's expertise and personality for this mode (appears at the start of the system prompt)
161
+
* **Available Tools:** Select which tools this mode can use
162
+
* **Custom Instructions:** (Optional) Add behavioral guidelines specific to this mode (appears at the end of the system prompt)
163
+
4.**Create Mode:** Click the "Create Mode" button to save your new mode
164
+
165
+
Note: File type restrictions can only be added through manual configuration.
166
+
167
+
### 3. Manual Configuration
168
+
169
+
You can configure custom modes by editing JSON files through the Prompts tab:
170
+
171
+
Both global and project-specific configurations can be edited through the Prompts tab:
172
+
173
+
1.**Open Prompts Tab:** Click the <Codiconname="notebook" /> icon in the Roo Code top menu bar
174
+
2.**Access Settings Menu:** Click the <Codiconname="bracket" /> button to the right of the Modes heading
175
+
3.**Choose Configuration:**
176
+
* Select "Edit Global Modes" to edit `cline_custom_modes.json` (available across all workspaces)
177
+
* Select "Edit Project Modes" to edit `.roomodes` file (in project root)
178
+
4.**Edit Configuration:** Modify the JSON file that opens
179
+
5.**Save Changes:** Roo Code will automatically detect the changes
180
+
181
+
## Example Configurations
140
182
141
183
Each example shows different aspects of mode configuration:
142
184
143
-
####Basic Documentation Writer
185
+
### Basic Documentation Writer
144
186
```json
145
187
{
146
188
"customModes": [{
@@ -156,7 +198,7 @@ Each example shows different aspects of mode configuration:
156
198
}
157
199
```
158
200
159
-
####Test Engineer with File Restrictions
201
+
### Test Engineer with File Restrictions
160
202
```json
161
203
{
162
204
"customModes": [{
@@ -171,7 +213,7 @@ Each example shows different aspects of mode configuration:
171
213
}
172
214
```
173
215
174
-
####Project-Specific Mode Override
216
+
### Project-Specific Mode Override
175
217
```json
176
218
{
177
219
"customModes": [{
@@ -188,6 +230,61 @@ Each example shows different aspects of mode configuration:
188
230
```
189
231
By following these instructions, you can create and manage custom modes to enhance your workflow with Roo-Code.
190
232
233
+
## Understanding Regex in Custom Modes
234
+
235
+
Regex patterns in custom modes let you precisely control which files Roo can edit:
236
+
237
+
### Basic Syntax
238
+
239
+
When you specify `fileRegex` in a custom mode, you're creating a pattern that file paths must match:
-`.*` - Match any character (except newline) zero or more times
267
+
-`(a|b)` - Match either "a" or "b"
268
+
-`(?!...)` - Negative lookahead (exclude matches)
269
+
270
+
### Testing Your Patterns
271
+
272
+
Before applying a regex pattern to a custom mode:
273
+
274
+
1. Test it on sample file paths to ensure it matches what you expect
275
+
2. Remember that in JSON, each backslash needs to be doubled (`\d` becomes `\\d`)
276
+
3. Start with simpler patterns and build complexity gradually
277
+
278
+
279
+
:::tip
280
+
### Let Roo Build Your Regex Patterns
281
+
Instead of writing complex regex patterns manually, you can ask Roo to create them for you! Simply describe which files you want to include or exclude:
282
+
```
283
+
Create a regex pattern that matches JavaScript files but excludes test files
284
+
```
285
+
Roo will generate the appropriate pattern with proper escaping for JSON configuration.
286
+
:::
287
+
191
288
## Community Gallery
192
289
193
-
Ready to explore more? Check out the [Custom Modes Gallery](/community#custom-modes-gallery) to discover and share custom modes created by the community!
290
+
Ready to explore more? Check out the [Custom Modes Gallery](/community#custom-modes-gallery) to discover and share custom modes created by the community!
0 commit comments