Skip to content

Commit 4ecb332

Browse files
committed
feat: add global/local scope option to Mode Writer mode
- Updated mode-writer fileRegex to allow writing to any XML/YAML files - Added scope selection as first step in mode creation workflow - Updated workflow to handle different file paths for global vs local modes - Created new instruction file for global mode path guidance - Fixes #5972
1 parent de13d8a commit 4ecb332

File tree

3 files changed

+171
-12
lines changed

3 files changed

+171
-12
lines changed

.roo/rules-mode-writer/1_mode_creation_workflow.xml

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,31 @@
66

77
<detailed_steps>
88
<step number="1">
9+
<title>Choose Mode Scope</title>
10+
<description>
11+
Determine whether the mode should be global (available in all projects) or local (specific to current project)
12+
</description>
13+
<actions>
14+
<action>Ask user to choose between global and local scope</action>
15+
<action>Store the choice to determine file paths throughout the workflow</action>
16+
</actions>
17+
<example>
18+
<ask_followup_question>
19+
<question>Should this be a global mode (available in all projects) or a local mode (only for this project)?</question>
20+
<follow_up>
21+
<suggest>Global mode - available in all projects</suggest>
22+
<suggest>Local mode - only for this project</suggest>
23+
</follow_up>
24+
</ask_followup_question>
25+
</example>
26+
<important_note>
27+
The user's choice here determines where all files will be written:
28+
- Global: Uses the system's global settings directory
29+
- Local: Uses the current project's .roomodes and .roo/ directories
30+
</important_note>
31+
</step>
32+
33+
<step number="2">
934
<title>Gather Requirements</title>
1035
<description>
1136
Understand what the user wants the mode to accomplish
@@ -29,7 +54,7 @@
2954
</example>
3055
</step>
3156

32-
<step number="2">
57+
<step number="3">
3358
<title>Design Mode Configuration</title>
3459
<description>
3560
Create the mode definition with all required fields
@@ -46,7 +71,7 @@
4671
<field name="roleDefinition">
4772
<description>Detailed description of the mode's role and expertise</description>
4873
<best_practice>
49-
Start with "You are Roo Code, a [specialist type]..."
74+
Start with "You are Roo, a [specialist type]..."
5075
List specific areas of expertise
5176
Mention key technologies or methodologies
5277
</best_practice>
@@ -69,13 +94,36 @@
6994
</field>
7095
</recommended_fields>
7196
<important_note>
72-
Do not include customInstructions in the .roomodes configuration.
97+
Do not include customInstructions in the mode configuration.
7398
All detailed instructions should be placed in XML files within
74-
the .roo/rules-[mode-slug]/ directory instead.
99+
the appropriate rules directory instead.
75100
</important_note>
76101
</step>
77102

78-
<step number="3">
103+
<step number="4">
104+
<title>Write Mode Configuration</title>
105+
<description>
106+
Save the mode configuration to the appropriate location based on scope
107+
</description>
108+
<scope_based_paths>
109+
<global_mode>
110+
<description>For global modes, write to the system's custom_modes.yaml file</description>
111+
<path_logic>
112+
Use the SYSTEM INFORMATION context to get the Home Directory,
113+
then construct the path to the global settings directory.
114+
The exact path varies by OS but follows patterns like:
115+
- Windows: C:\Users\[username]\AppData\Roaming\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\custom_modes.yaml
116+
- macOS/Linux: ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/custom_modes.yaml
117+
</path_logic>
118+
</global_mode>
119+
<local_mode>
120+
<description>For local modes, write to the project's .roomodes file</description>
121+
<path>.roomodes</path>
122+
</local_mode>
123+
</scope_based_paths>
124+
</step>
125+
126+
<step number="5">
79127
<title>Implement File Restrictions</title>
80128
<description>
81129
Configure appropriate file access permissions
@@ -98,11 +146,21 @@ groups:
98146
</guidelines>
99147
</step>
100148

101-
<step number="4">
149+
<step number="6">
102150
<title>Create XML Instruction Files</title>
103151
<description>
104-
Design structured instruction files in .roo/rules-[mode-slug]/
152+
Design structured instruction files in the appropriate rules directory
105153
</description>
154+
<scope_based_directories>
155+
<global_mode>
156+
<description>For global modes, create rules in the global .roo directory</description>
157+
<path_pattern>[global-settings-dir]/.roo/rules-[mode-slug]/</path_pattern>
158+
</global_mode>
159+
<local_mode>
160+
<description>For local modes, create rules in the project's .roo directory</description>
161+
<path_pattern>.roo/rules-[mode-slug]/</path_pattern>
162+
</local_mode>
163+
</scope_based_directories>
106164
<file_structure>
107165
<file name="1_workflow.xml">Main workflow and step-by-step processes</file>
108166
<file name="2_best_practices.xml">Guidelines and conventions</file>
@@ -118,7 +176,7 @@ groups:
118176
</xml_best_practices>
119177
</step>
120178

121-
<step number="5">
179+
<step number="7">
122180
<title>Test and Refine</title>
123181
<description>
124182
Verify the mode works as intended
@@ -129,14 +187,18 @@ groups:
129187
<item>Instructions are clear and actionable</item>
130188
<item>Mode integrates well with Orchestrator</item>
131189
<item>All examples are accurate and helpful</item>
190+
<item>For global modes: Verify the mode is available in other projects</item>
132191
</checklist>
133192
</step>
134193
</detailed_steps>
135194

136195
<quick_reference>
137-
<command>Create mode in .roomodes for project-specific modes</command>
138-
<command>Create mode in global custom_modes.yaml for system-wide modes</command>
139-
<command>Use list_files to verify .roo folder structure</command>
196+
<command>Always ask for scope (global/local) before creating a mode</command>
197+
<command>Global modes: Write to system's custom_modes.yaml file</command>
198+
<command>Local modes: Write to project's .roomodes file</command>
199+
<command>Global rules: Create in [global-settings-dir]/.roo/rules-[slug]/</command>
200+
<command>Local rules: Create in project's .roo/rules-[slug]/</command>
201+
<command>Use list_files to verify folder structure</command>
140202
<command>Test file regex patterns with search_files</command>
141203
</quick_reference>
142204
</mode_creation_workflow>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<global_mode_path_guidance>
2+
<overview>
3+
This file provides specific guidance for creating global modes that are available across all projects.
4+
Global modes require special handling of file paths that vary by operating system.
5+
</overview>
6+
7+
<path_construction>
8+
<description>
9+
When creating a global mode, you need to construct the correct path to the global settings directory.
10+
This path varies by operating system and must be determined from the SYSTEM INFORMATION context.
11+
</description>
12+
13+
<steps>
14+
<step number="1">
15+
<title>Get System Information</title>
16+
<description>
17+
Check the SYSTEM INFORMATION section for:
18+
- Operating System (Windows, macOS, Linux)
19+
- Home Directory path
20+
</description>
21+
</step>
22+
23+
<step number="2">
24+
<title>Construct Global Settings Path</title>
25+
<os_specific_patterns>
26+
<windows>
27+
<pattern>C:\Users\[username]\AppData\Roaming\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\</pattern>
28+
<example>C:\Users\VooDoo\AppData\Roaming\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\</example>
29+
<custom_modes_file>custom_modes.yaml</custom_modes_file>
30+
</windows>
31+
<macos>
32+
<pattern>~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/</pattern>
33+
<example>/Users/username/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/</example>
34+
<custom_modes_file>custom_modes.yaml</custom_modes_file>
35+
</macos>
36+
<linux>
37+
<pattern>~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/</pattern>
38+
<example>/home/username/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/</example>
39+
<custom_modes_file>custom_modes.yaml</custom_modes_file>
40+
</linux>
41+
</os_specific_patterns>
42+
</step>
43+
44+
<step number="3">
45+
<title>Create Global Rules Directory</title>
46+
<description>
47+
For global modes, the rules directory follows the same pattern but in a .roo subdirectory
48+
</description>
49+
<pattern>[global-settings-dir]/.roo/rules-[mode-slug]/</pattern>
50+
<example>
51+
Windows: C:\Users\VooDoo\AppData\Roaming\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\.roo\rules-api-dev\
52+
macOS/Linux: ~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/.roo/rules-api-dev/
53+
</example>
54+
</step>
55+
</steps>
56+
</path_construction>
57+
58+
<implementation_example>
59+
<scenario>Creating a global mode called "api-dev"</scenario>
60+
<workflow>
61+
<action>Read SYSTEM INFORMATION to determine OS and home directory</action>
62+
<action>Construct the global custom_modes.yaml path based on OS</action>
63+
<action>Read existing custom_modes.yaml content (if it exists)</action>
64+
<action>Add the new mode configuration to the customModes array</action>
65+
<action>Write the updated content back to custom_modes.yaml</action>
66+
<action>Create the global rules directory at [global-settings-dir]/.roo/rules-api-dev/</action>
67+
<action>Write XML instruction files to the global rules directory</action>
68+
</workflow>
69+
</implementation_example>
70+
71+
<important_notes>
72+
<note priority="high">
73+
Always use absolute paths when working with global mode files.
74+
The write_to_file tool will automatically create parent directories if they don't exist.
75+
</note>
76+
<note priority="high">
77+
The Mode Writer mode now has permission to write to any .yaml or .xml file,
78+
which enables it to write to the global custom_modes.yaml file.
79+
</note>
80+
<note priority="medium">
81+
When reading the global custom_modes.yaml file, handle the case where it might not exist yet.
82+
The file should be created with an empty customModes array if it doesn't exist.
83+
</note>
84+
</important_notes>
85+
86+
<testing_global_modes>
87+
<description>
88+
After creating a global mode, verify it works correctly
89+
</description>
90+
<checklist>
91+
<item>The mode appears in the mode list in the current project</item>
92+
<item>Switch to a different project and verify the mode appears there too</item>
93+
<item>The global rules are loaded correctly from the global .roo directory</item>
94+
<item>The mode's file restrictions work as expected</item>
95+
</checklist>
96+
</testing_global_modes>
97+
</global_mode_path_guidance>

.roomodes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ customModes:
2222
groups:
2323
- read
2424
- - edit
25-
- fileRegex: (\.roomodes$|\.roo/.*\.xml$|\.yaml$)
25+
- fileRegex: (\.roomodes$|.*\.xml$|.*\.yaml$)
2626
description: Mode configuration files and XML instructions
2727
- command
2828
- mcp

0 commit comments

Comments
 (0)