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
Footgun Prompting, AKA Overriding System Prompt, allows advanced users to completely replace the default system prompt for a specific Roo Code mode. This provides granular control over the AI's behavior but bypasses built-in safeguards.
8
8
9
-
:::info **footgun***(noun)*
9
+
:::info **footgun**_(noun)_
10
10
11
-
1.*(programming slang, humorous, derogatory)* Any feature likely to lead to the programmer shooting themself in the foot.
11
+
1._(programming slang, humorous, derogatory)_ Any feature likely to lead to the programmer shooting themself in the foot.
12
12
13
13
> The System Prompt Override is considered a footgun because modifying the core instructions without a deep understanding can lead to unexpected or broken behavior, especially regarding tool usage and response consistency.
14
14
@@ -21,6 +21,7 @@ Footgun Prompting, AKA Overriding System Prompt, allows advanced users to comple
21
21
3.**Activation:** Roo Code automatically detects this file. When present, it replaces most of the standard system prompt sections.
22
22
4.**Preserved Sections:** Only the core `roleDefinition` and any `customInstructions` you've set for the mode are kept alongside your override content. Standard sections like tool descriptions, rules, and capabilities are bypassed.
23
23
5.**Construction:** The final prompt sent to the model looks like this:
24
+
24
25
```
25
26
${roleDefinition}
26
27
@@ -39,14 +40,38 @@ You can find the option and instructions within the Roo Code UI:
39
40
40
41
<img src="/img/footgun-prompting/footgun-prompting.png" alt="UI showing the Advanced: Override System Prompt section" width="500" />
41
42
43
+
## Using Context Variables
44
+
45
+
When creating your custom system prompt file, you can use special variables (placeholders) that Roo Code will automatically replace with relevant information about the current environment. This allows you to make your prompts more dynamic and context-aware.
46
+
47
+
Here are the available variables:
48
+
49
+
- `{{mode}}`: The slug (short name) of the current Roo Code mode being used (e.g., `code`, `chat-mode`).
50
+
- `{{language}}`: The display language configured in VS Code (e.g., `en`, `es`).
51
+
- `{{shell}}`: The default terminal shell configured in VS Code (e.g., `/bin/bash`, `powershell.exe`).
52
+
- `{{operatingSystem}}`: The type of operating system your computer is running (e.g., `Linux`, `Darwin` for macOS, `Windows_NT`).
53
+
- `{{workspace}}`: The file path to the root of your current project workspace.
54
+
55
+
**Example Usage:**
56
+
57
+
You can include these variables directly in your prompt file content like this:
58
+
59
+
```
60
+
You are assisting a user in the '{{mode}}' mode.
61
+
Their operating system is {{operatingSystem}} and their default shell is {{shell}}.
62
+
The project is located at: {{workspace}}.
63
+
Please respond in {{language}}.
64
+
```
65
+
66
+
Roo Code will substitute these placeholders before sending the prompt to the AI model.
42
67
43
68
## Key Considerations & Warnings
44
69
45
-
- **Intended Audience:** Best suited for users deeply familiar with Roo Code's prompting system and the implications of modifying core instructions.
46
-
- **Impact on Functionality:** Custom prompts override standard instructions, including those for tool usage and response consistency. This can cause unexpected behavior or errors if not managed carefully.
47
-
- **Mode-Specific:** Each override file applies only to the mode specified in its filename (`{mode-slug}`).
48
-
- **No File, No Override:** If the `.roo/system-prompt-{mode-slug}` file doesn't exist, Roo Code uses the standard system prompt generation process for that mode.
49
-
- **Blank Files Ignored:** If the override file exists but is empty (blank), it will be ignored and the default system prompt will be used.
50
-
- **Directory Creation:** Roo Code ensures the `.roo` directory exists before attempting to read or create the override file.
70
+
- **Intended Audience:** Best suited for users deeply familiar with Roo Code's prompting system and the implications of modifying core instructions.
71
+
- **Impact on Functionality:** Custom prompts override standard instructions, including those for tool usage and response consistency. This can cause unexpected behavior or errors if not managed carefully.
72
+
- **Mode-Specific:** Each override file applies only to the mode specified in its filename (`{mode-slug}`).
73
+
- **No File, No Override:** If the `.roo/system-prompt-{mode-slug}` file doesn't exist, Roo Code uses the standard system prompt generation process for that mode.
74
+
- **Blank Files Ignored:** If the override file exists but is empty (blank), it will be ignored and the default system prompt will be used.
75
+
- **Directory Creation:** Roo Code ensures the `.roo` directory exists before attempting to read or create the override file.
51
76
52
-
Use this feature cautiously. While powerful for customization, incorrect implementation can significantly degrade Roo Code's performance and reliability for the affected mode.
77
+
Use this feature cautiously. While powerful for customization, incorrect implementation can significantly degrade Roo Code's performance and reliability for the affected mode.
0 commit comments