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
Copy file name to clipboardExpand all lines: docs/features/custom-instructions.md
+16-10Lines changed: 16 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ You can provide custom instructions using global rules (applied across all proje
20
20
***Linux/macOS:**`~/.roo/rules/` and `~/.roo/rules-{modeSlug}/`
21
21
***Windows:**`%USERPROFILE%\.roo\rules\` and `%USERPROFILE%\.roo\rules-{modeSlug}\`
22
22
23
-
**Workspace Rules:** Apply only to the current project, can override global rules.
23
+
**Workspace Rules:** Apply only to the current project and take precedence over global rules when they conflict.
24
24
***Preferred Method: Directory (`.roo/rules/`)**
25
25
```
26
26
.
@@ -54,7 +54,7 @@ You can provide custom instructions using global rules (applied across all proje
54
54
└── ... (other project files)
55
55
```
56
56
57
-
Rules are loaded in order: Global rules first, then workspace rules (which can override global rules). See [Global Rules Directory](#global-rules-directory) for details.
57
+
Rules are loaded in order: Global rules first, then workspace rules. If there's a conflict, workspace rules take precedence. See [Global Rules Directory](#global-rules-directory) for details.
58
58
:::
59
59
60
60
---
@@ -92,7 +92,7 @@ The Global Rules Directory feature provides reusable rules and custom instructio
92
92
93
93
**With Global Rules**: Create rules once and use them everywhere:
94
94
- Set up your preferred coding standards globally
95
-
- Override specific rules per project when needed
95
+
- Customize specific rules per project when needed
96
96
- Maintain consistency across all your work
97
97
- Easy to update rules for all projects at once
98
98
@@ -176,8 +176,8 @@ The global rules directory location is fixed and cannot be customized:
176
176
Rules are loaded in this order:
177
177
178
178
1.**Global Rules** (from `~/.roo/`)
179
-
2.**Project Rules** (from `project/.roo/`) - can override global rules
180
-
3.**Legacy Files** (`.roorules`, `.clinerules` - for backward compatibility)
179
+
2.**Project Rules** (from `project/.roo/`) - take precedence over global rules when they conflict
180
+
3.[Generic only]**Legacy Files** (workspace root `.roorules`, `.clinerules`) - used only if no generic rules directory content was loaded
181
181
182
182
Within each level, mode-specific rules are loaded before general rules.
183
183
@@ -279,7 +279,10 @@ Rules:
279
279
***Recursive Reading:** Rules directories are read recursively, including all files in subdirectories
280
280
***File Filtering:** System automatically excludes cache and temporary files (`.DS_Store`, `*.bak`, `*.cache`, `*.log`, `*.tmp`, `Thumbs.db`, etc.)
281
281
***Empty Files:** Empty or missing rule files are silently skipped
282
-
***Source Headers:** Directory-based rules are included without headers, while file-based rules include `# Rules from {filename}:` headers
282
+
***Source Headers:** Directory-based rules include per-file headers `# Rules from {absolute path}:`, while file-based rules include `# Rules from {filename}:` headers
283
+
***Aggregation:** Both global and workspace rules directories are aggregated for mode-specific and generic rules (not either-or)
284
+
***Sorting:** Files are sorted by basename only, case-insensitive
285
+
***Header Paths:** Header paths are absolute and follow symlinks
283
286
***Rule Interaction:** Mode-specific rules complement global rules rather than replacing them
284
287
***Symbolic Links:** Fully supported for both files and directories, with a maximum resolution depth of 5 to prevent infinite loops
285
288
@@ -292,9 +295,12 @@ Roo Code also supports loading rules from an `AGENTS.md` (or `AGENT.md` as fallb
292
295
***Purpose:** Provides agent-specific rules and guidelines for AI behavior
293
296
***Location:** Must be in the workspace root directory
294
297
***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
***Preference:** If both exist, `AGENTS.md` is preferred over `AGENT.md`
300
+
***Priority:** Loaded after mode-specific rules and `.rooignore`, before generic rules from both `~/.roo/rules` and `.roo/rules`
301
+
***Header:** Added to system prompt with header `# Agent Rules Standard (AGENTS.md):` or `(AGENT.md):` accordingly
302
+
***Empty Files:** Empty or whitespace-only `AGENTS.md` is ignored
303
+
***Symbolic Links:** Symbolic links to files or directories are resolved before reading
298
304
299
305
This feature allows teams to maintain standardized AI agent behavior rules that can be version-controlled alongside the project code.
300
306
@@ -317,7 +323,7 @@ For team environments, consider these approaches:
317
323
318
324
**Organization Standards**: Use global rules (`~/.roo/rules/`) to establish organization-wide coding standards that apply to all projects. Team members can set up identical global rules for consistency across all work.
319
325
320
-
**Hybrid Approach**: Combine global rules for organization standards with project-specific workspace rules for project-specific requirements. Workspace rules can override global rules when needed.
326
+
**Hybrid Approach**: Combine global rules for organization standards with project-specific workspace rules for project-specific requirements. When rules conflict, workspace rules take precedence.
321
327
322
328
The directory-based approach offers better organization than single `.roorules` files and supports both global and project-level customization.
0 commit comments