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
This commit updates the documentation for manually editing custom modes (`.roomodes`) to improve clarity and help users avoid some parsing pitfalls discovered during real-world testing.
The key changes include:
* Adding a new "Troubleshooting & Known Limitations" section to centralize practical advice.
* Clarifying that YAML Anchors & Aliases (`&`, `*`) are not supported by the parser.
* Warning that the complex `fileRegex` permission syntax is unstable and recommending a simpler, more reliable alternative (`groups: [read, edit]`).
* Adding guidance on basic details like ensuring UTF-8 file encoding and avoiding invisible characters in indentation.
These updates provide an accurate reflection of the YAML parser's behavior and will lead to a better user experience.
Copy file name to clipboardExpand all lines: docs/features/custom-modes.mdx
+48-17Lines changed: 48 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -163,25 +163,39 @@ customModes:
163
163
* *JSON Example:* `"roleDefinition": "You are a technical writer specializing in clear documentation."`
164
164
165
165
##### `groups`
166
-
* **Purpose:** Array/list defining which tool groups the mode can access and any file restrictions.
167
-
* **Available Tool Groups (Strings):** `"read"`, `"edit"`, `"browser"`, `"command"`, `"mcp"`.
168
-
* **File Restrictions for "edit" group:**
169
-
* To apply file restrictions, the "edit" entry becomes a list (YAML) or array (JSON) where the first element is `"edit"` and the second is a map/object defining the restrictions.
170
-
* `fileRegex`: A regular expression string to control which files the mode can edit.
171
-
* In YAML, typically use single backslashes for regex special characters (e.g., `\.md$`).
172
-
* In JSON, backslashes must be double-escaped (e.g., `\\.md$`).
173
-
* `description`: An optional string describing the restriction.
174
-
* For more complex patterns, see [Understanding Regex in Custom Modes](#understanding-regex-in-custom-modes).
175
-
* *YAML Example:*
166
+
* **Purpose:** Array/list defining which tool groups the mode can access and any file restrictions.
167
+
* **Available Tool Groups (Strings):** `"read"`, `"edit"`, `"browser"`, `"command"`, `"mcp"`.
168
+
* **File Restrictions for "edit" group (Advanced - Use with Caution):**
169
+
170
+
:::caution
171
+
This feature has been found to be **unstable** and may cause the entire file to fail parsing, even with valid syntax. It is strongly recommended to use simple `edit` permissions (`groups: [read, edit]`) instead of `fileRegex` where possible.
172
+
:::
173
+
174
+
* `fileRegex`: A regular expression string to control which files the mode can edit.
175
+
* In YAML, typically use single backslashes for regex special characters (e.g., `\.md$`).
176
+
* In JSON, backslashes must be double-escaped (e.g., `\\.md$`).
177
+
* `description`: An optional string describing the restriction.
178
+
* For more complex patterns, see [Understanding Regex in Custom Modes](#understanding-regex-in-custom-modes).
179
+
180
+
* *YAML Example (Simple Permissions - **Recommended**):*
181
+
```yaml
182
+
groups:
183
+
- read
184
+
- edit # Grants general edit permission
185
+
- browser
186
+
```
187
+
188
+
* *YAML Example (Advanced `fileRegex` - **Potentially Unstable**):*
176
189
```yaml
177
190
groups:
178
191
- read
179
-
- - edit # Start of "edit" tool with restrictions
180
-
- fileRegex: \.(js|ts)$ # Restriction map for JS/TS files
192
+
- - "edit" # Start of "edit" tool with restrictions
193
+
- fileRegex: \.(js|ts)$
181
194
description: JS/TS files only
182
195
- command
183
196
```
184
-
* *JSON Example:*
197
+
198
+
* *JSON Example:*
185
199
```json
186
200
"groups": [
187
201
"read",
@@ -256,10 +270,22 @@ While JSON is still fully supported, new modes created via the UI or by asking R
256
270
257
271
When editing YAML manually, keep these points in mind:
258
272
259
-
* **Indentation is Key:** YAML uses indentation (spaces, not tabs) to define structure. Incorrect indentation is the most common source of errors. Ensure consistent spacing for nested elements.
260
-
* **Colons for Key-Value Pairs:** Keys must be followed by a colon and a space (e.g., `slug: my-mode`).
261
-
* **Hyphens for List Items:** List items start with a hyphen and a space (e.g., `- read`).
262
-
* **Validate Your YAML:** If you encounter issues, use an online YAML validator or your editor's built-in validation to check for syntax errors.
273
+
* **Indentation is Key:** YAML uses indentation (spaces, not tabs) to define structure. Incorrect indentation is the most common source of errors. Ensure consistent spacing for nested elements.
274
+
* **Colons for Key-Value Pairs:** Keys must be followed by a colon and a space (e.g., `slug: my-mode`).
275
+
* **Hyphens for List Items:** List items start with a hyphen and a space (e.g., `- read`).
276
+
* **Validate Your YAML:** If you encounter issues, use an online YAML validator or your editor's built-in validation to check for syntax errors.
277
+
278
+
:::danger Troubleshooting & Known Limitations
279
+
Based on real-world use, the Roo Code YAML parser has several specific behaviors to be aware of to prevent parsing errors:
280
+
* **YAML Anchors/Aliases Not Supported**: The parser does not support YAML anchors (`&`) or aliases (`*`) for reusing content. All instructions must be written out fully in each mode.
281
+
282
+
* **Use Simple `groups` Permissions**: The complex `fileRegex` syntax for restricting file edits has been found to be unstable and can cause the entire file to fail parsing.
283
+
* **Recommended:** Use simple, proven lists for permissions (e.g., `groups: [read, edit]`).
284
+
* **Avoid (Unstable):** `groups: - ["edit", { "fileRegex": "..." }]`. While this may work in some YAML environments, it is not reliably parsed by Roo Code.
285
+
286
+
* **File Encoding Must Be UTF-8**: To support special characters and emojis (e.g., `📝`) in mode names, your `.roomodes` or `custom_modes.yaml` file must be saved with **UTF-8** encoding.
287
+
288
+
* **Check for Invisible Characters**: Some text editors or copy-pasting from web pages can insert non-standard characters (like "non-breaking spaces") instead of regular spaces for indentation. The parser will reject this. If you encounter a stubborn error, try re-typing the indentation for the problematic lines.
263
289
264
290
### Migration to YAML Format
265
291
@@ -457,6 +483,10 @@ When overriding default modes, test carefully. Consider backing up configuration
457
483
458
484
## Understanding Regex in Custom Modes
459
485
486
+
:::caution Important Note
487
+
The `fileRegex` feature can be unstable and may cause parsing errors. When debugging, simplifying your `groups` list to `[read, edit]` is a recommended first step before troubleshooting your regex pattern.
488
+
:::
489
+
460
490
Regular expressions (`fileRegex`) offer fine-grained control over file editing permissions.
461
491
462
492
:::tip
@@ -510,3 +540,4 @@ When a mode attempts to edit a file that doesn't match its `fileRegex` pattern,
510
540
511
541
## Community Gallery
512
542
Ready to explore more? Check out the [Custom Modes Gallery](/community/#custom-modes-gallery) section on the main community page to discover and share custom modes created by the community!
0 commit comments