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
* Create a directory named `.roo/rules/` in your workspace root.
194
-
* Place instruction files (e.g., `.md`, `.txt`) inside. Roo Code reads files recursively, appending their content to the system prompt in **alphabetical order** based on filename.
195
-
* This method takes precedence if the directory exists and contains files.
194
+
* Place instruction files (e.g., `.md`, `.txt`) inside. Roo Code reads files recursively (including subdirectories), appending their content to the system prompt in **alphabetical order** based on filename.
195
+
* When this directory exists and contains files, its contents are loaded along with any global rules directories.
196
+
* Note: If the `.roo/rules/` directory exists but is empty, Roo Code will fall back to using the `.roorules` file instead.
196
197
***Fallback Method: File-Based (`.roorules`)**
197
198
* If `.roo/rules/` doesn't exist or is empty, Roo Code looks for a single `.roorules` file in the workspace root.
198
199
* If found, its content is loaded.
@@ -216,7 +217,7 @@ Mode-specific instructions can be set in two independent ways that can be used s
216
217
2.**Using Rule Files/Directories:** Provide mode-specific instructions via files:
* Create a directory named `.roo/rules-{modeSlug}/` (e.g., `.roo/rules-docs-writer/`) in your workspace root.
219
-
* Place instruction files inside (recursive loading). Files are read and appended to the system prompt in **alphabetical order** by filename.
220
+
* Place instruction files inside (recursive loading, including subdirectories). Files are read and appended to the system prompt in **alphabetical order** by filename.
220
221
* This method takes precedence over the fallback file method for the specific mode if the directory exists and contains files.
* If `.roo/rules-{modeSlug}/` doesn't exist or is empty, Roo Code looks for a single `.roorules-{modeSlug}` file (e.g., `.roorules-code`) in the workspace root.
@@ -236,37 +237,66 @@ USER'S CUSTOM INSTRUCTIONS
236
237
237
238
The following additional instructions are provided by the user, and should be followed to the best of your ability without interfering with the TOOL USE guidelines.
238
239
239
-
[Language Preference (if set)]
240
+
Language Preference:
241
+
[Language preference if set]
240
242
241
-
[Global Instructions (from Prompts Tab)]
243
+
Global Instructions:
244
+
[Global Instructions from Prompts Tab]
242
245
243
-
[Mode-specific Instructions (from Prompts Tab for the current mode)]
246
+
Mode-specific Instructions:
247
+
[Mode-specific Instructions from Prompts Tab for the current mode]
244
248
245
-
Global Rules (from ~/.roo/):
246
-
[Contents of files in ~/.roo/rules-{modeSlug}/ (if directory exists and is not empty)]
247
-
[Contents of files in ~/.roo/rules/ (if directory exists and is not empty)]
[Contents of files in .roo/rules/ (if directory exists and is not empty)]
255
-
[Contents of .roorules file (if .roo/rules/ does not exist or is empty, and file exists)]
254
+
# Rules from .roorules-{modeSlug}:
255
+
[Contents of .roorules-{modeSlug} file if no mode-specific directories have files]
256
+
257
+
# Rules from .rooignore:
258
+
[.rooignore-related instructions if applicable]
259
+
260
+
# Agent Rules Standard (AGENTS.md):
261
+
[Contents of AGENTS.md or AGENT.md from workspace root if present and enabled]
262
+
263
+
# Rules from rules directories:
264
+
[Contents of ALL files from ~/.roo/rules/ AND .roo/rules/ if they exist]
265
+
266
+
# Rules from .roorules:
267
+
[Contents of .roorules file if no general rules directories have files]
256
268
257
269
====
258
270
```
259
271
260
-
*Note: Global rules load first, followed by workspace rules that can override them. Mode-specific rules appear before general rules within each level, and directory-based rules take precedence over file-based fallbacks.*
272
+
*Note: The system loads rules from ALL applicable directories (both global `~/.roo/` and workspace `.roo/`), not just the first one with files. Mode-specific rules appear before general rules. Directory-based rules take precedence over file-based fallbacks only when determining which method to use, but all applicable directories are read.*
261
273
262
274
---
263
275
264
276
## Rules about .rules files
265
277
266
278
***File Location:** The preferred method uses directories within `.roo/` (`.roo/rules/` and `.roo/rules-{modeSlug}/`). The fallback method uses single files (`.roorules` and `.roorules-{modeSlug}`) located directly in the workspace root.
279
+
***Recursive Reading:** Rules directories are read recursively, including all files in subdirectories
280
+
***File Filtering:** System automatically excludes cache and temporary files (`.DS_Store`, `*.bak`, `*.cache`, `*.log`, `*.tmp`, `Thumbs.db`, etc.)
267
281
***Empty Files:** Empty or missing rule files are silently skipped
268
-
***Source Headers:**Each rule file's contents are included with a header indicating its source
282
+
***Source Headers:**Directory-based rules are included without headers, while file-based rules include `# Rules from {filename}:` headers
269
283
***Rule Interaction:** Mode-specific rules complement global rules rather than replacing them
284
+
***Symbolic Links:** Fully supported for both files and directories, with a maximum resolution depth of 5 to prevent infinite loops
285
+
286
+
---
287
+
288
+
## AGENTS.md Support
289
+
290
+
Roo Code also supports loading rules from an `AGENTS.md` (or `AGENT.md` as fallback) file in your workspace root:
291
+
292
+
***Purpose:** Provides agent-specific rules and guidelines for AI behavior
293
+
***Location:** Must be in the workspace root directory
294
+
***Loading:** Automatically loaded by default. To disable AGENTS.md loading, set `"roo-cline.useAgentRules": false` in your VSCode settings
295
+
***Priority:** Loaded after mode-specific rules but before general workspace rules
296
+
***Header:** Added to system prompt with header `# Agent Rules Standard (AGENTS.md):`
297
+
***Symbolic Links:** Supports symbolic links to AGENTS.md files in other locations
298
+
299
+
This feature allows teams to maintain standardized AI agent behavior rules that can be version-controlled alongside the project code.
0 commit comments