Skip to content

Commit f4f4c50

Browse files
authored
docs: add context variables section to the footgun page (#148)
1 parent eed8d78 commit f4f4c50

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

docs/features/footgun-prompting.md

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ sidebar_label: 'Footgun Prompting'
66

77
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.
88

9-
:::info **footgun** *(noun)*
9+
:::info **footgun** _(noun)_
1010

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.
1212

1313
> 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.
1414
@@ -21,6 +21,7 @@ Footgun Prompting, AKA Overriding System Prompt, allows advanced users to comple
2121
3. **Activation:** Roo Code automatically detects this file. When present, it replaces most of the standard system prompt sections.
2222
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.
2323
5. **Construction:** The final prompt sent to the model looks like this:
24+
2425
```
2526
${roleDefinition}
2627
@@ -39,14 +40,38 @@ You can find the option and instructions within the Roo Code UI:
3940
4041
<img src="/img/footgun-prompting/footgun-prompting.png" alt="UI showing the Advanced: Override System Prompt section" width="500" />
4142
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.
4267
4368
## Key Considerations & Warnings
4469
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.
5176
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

Comments
 (0)