Skip to content

Commit 837ce9e

Browse files
committed
feat: add other useful variables to the custom system prompt
1 parent 4606e9a commit 837ce9e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/core/prompts/sections/custom-system-prompt.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { fileExistsAtPath } from "../../../utils/fs"
55

66
export type PromptVariables = {
77
workspace?: string
8+
mode?: string
9+
language?: string
10+
shell?: string
11+
operatingSystem?: string
812
}
913

1014
function interpolatePromptContent(content: string, variables: PromptVariables): string {

src/core/prompts/system.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { DiffStrategy } from "../../shared/tools"
1414
import { McpHub } from "../../services/mcp/McpHub"
1515
import { getToolDescriptionsForMode } from "./tools"
1616
import * as vscode from "vscode"
17+
import * as os from "os"
1718
import {
1819
getRulesSection,
1920
getSystemInfoSection,
@@ -128,6 +129,10 @@ export const SYSTEM_PROMPT = async (
128129
// Try to load custom system prompt from file
129130
const variablesForPrompt: PromptVariables = {
130131
workspace: cwd,
132+
mode: mode,
133+
language: language ?? formatLanguage(vscode.env.language),
134+
shell: vscode.env.shell,
135+
operatingSystem: os.type(),
131136
}
132137
const fileCustomSystemPrompt = await loadSystemPromptFile(cwd, mode, variablesForPrompt)
133138

0 commit comments

Comments
 (0)