Footgun Prompting: Override System Prompts
Footgun Prompting (System Prompt Override) lets you replace the default system prompt for a specific Saarthi mode. This offers granular control but bypasses built-in safeguards. Use with caution.
Warning Indicator: When a system prompt override is active for the current mode, Saarthi will display a warning icon in the chat input area to remind you that the default behavior has been modified.
- (programming slang, humorous, derogatory) Any feature likely to lead to the programmer shooting themself in the foot.
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.
How It Works
-
Override File: Create a file named
.saarthi/system-prompt-{mode-slug}
in your workspace root (e.g.,.saarthi/system-prompt-code
for the Code mode). -
Content: The content of this file becomes the new system prompt for that specific mode.
-
Activation: Saarthi automatically detects this file. When present, it replaces most of the standard system prompt sections.
-
Preserved Sections: Only the core
roleDefinition
and anycustomInstructions
you've set for the mode are kept alongside your override content. Standard sections like tool descriptions, rules, and capabilities are bypassed. -
Construction: The final prompt sent to the model looks like this:
${roleDefinition}
${content_of_your_override_file}
${customInstructions}
Accessing the Feature
Find the option and instructions in the Saarthi UI:
- Click the icon in the Saarthi top menu bar.
- Expand the "Advanced: Override System Prompt" section.
- Clicking the file path link within the explanation will open or create the correct override file for the currently selected mode in VS Code.
Using Context Variables
When creating your custom system prompt file, you can use special variables (placeholders) that Saarthi will automatically replace with relevant information about the current environment. This allows you to make your prompts more dynamic and context-aware.
Here are the available variables:
{{mode}}
: The slug (short name) of the current Saarthi mode being used (e.g.,code
,chat-mode
).{{language}}
: The display language configured in VS Code (e.g.,en
,es
).{{shell}}
: The default terminal shell configured in VS Code (e.g.,/bin/bash
,powershell.exe
).{{operatingSystem}}
: The type of operating system your computer is running (e.g.,Linux
,Darwin
for macOS,Windows_NT
).{{workspace}}
: The file path to the root of your current project workspace.
Example Usage:
You can include these variables directly in your prompt file content like this:
You are assisting a user in the '{{mode}}' mode.
Their operating system is {{operatingSystem}} and their default shell is {{shell}}.
The project is located at: {{workspace}}.
Please respond in {{language}}.
Saarthi substitutes these placeholders before sending the prompt to the model.
Key Considerations & Warnings
- Intended Audience: Best suited for users deeply familiar with Saarthi's prompting system and the implications of modifying core instructions.
- 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.
- Mode-Specific: Each override file applies only to the mode specified in its filename (
{mode-slug}
). - No File, No Override: If the
.saarthi/system-prompt-{mode-slug}
file doesn't exist, Saarthi uses the standard system prompt generation process for that mode. - Blank Files Ignored: If the override file exists but is empty (blank), it will be ignored and the default system prompt will be used.
- Directory Creation: Saarthi ensures the
.saarthi
directory exists before attempting to read or create the override file. Use this feature cautiously. Incorrect implementation can significantly degrade Saarthi's performance and reliability for the affected mode.