Skip to content

Commit 92f04c8

Browse files
author
vijay upadya
committed
Prompt updates to make them consistent across models
1 parent 5784ec6 commit 92f04c8

File tree

72 files changed

+2213
-1832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2213
-1832
lines changed

src/extension/prompts/node/agent/anthropicPrompts.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,9 @@ class Claude45DefaultPrompt extends PromptElement<DefaultAgentPromptProps> {
191191
{this.props.availableTools && <McpToolInstructions tools={this.props.availableTools} />}
192192
<NotebookInstructions {...this.props} />
193193
<Tag name='outputFormatting'>
194-
Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and code locations, follow `FileLinkificationInstructions` (markdown links with line anchors; never backticks).<br />
195-
<Tag name='example'>
196-
File path and line anchor formatting rules are defined in `FileLinkificationInstructions` below.
197-
</Tag>
194+
Use proper Markdown formatting:
195+
- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()`<br />
196+
- When mentioning files or line numbers, always follow the rules in fileLinkification section below:
198197
<FileLinkificationInstructions />
199198
<MathIntegrationRules />
200199
</Tag>

src/extension/prompts/node/agent/fileLinkificationInstructions.tsx

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,42 @@ import { Tag } from '../base/tag';
99
export class FileLinkificationInstructions extends PromptElement<{}> {
1010
render() {
1111
return <Tag name='fileLinkification'>
12-
ALWAYS convert file paths to markdown links with 1-based line numbers whenever you cite specific code locations in the workspace. Paths should be relative to workspace root.<br />
12+
When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers.<br />
13+
NO BACKTICKS ANYWHERE:<br />
14+
- Never wrap file names, paths, or links in backticks.<br />
15+
- Never use inline-code formatting for any file reference.<br />
1316
<br />
14-
**Inline references:** Use the file path as link text within sentences:<br />
15-
- `The handler lives in [path/to/file.ts](path/to/file.ts#L10).` (single line)<br />
16-
- `See [path/to/file.ts](path/to/file.ts#L10-L12) for the range.` (line range)<br />
17-
- `Configuration is defined in [path/to/file.ts](path/to/file.ts).` (whole file)<br />
17+
18+
REQUIRED FORMATS:<br />
19+
- File: [path/file.ts](path/file.ts)<br />
20+
- Line: [file.ts](file.ts#L10)<br />
21+
- Range: [file.ts](file.ts#L10-L12)<br />
1822
<br />
19-
**Bullet lists:** Explains what each reference is, so readers understand the context without clicking:<br />
20-
- [Await chat view](path/to/file.ts#L142)<br />
21-
- [Show widget](path/to/file.ts#L321)<br />
22-
Don't just list bare file paths like `file.ts#L142`<br />
23+
24+
PATH RULES:<br />
25+
- Without line numbers: Display text must match the target path.<br />
26+
- With line numbers: Display text can be either the path or descriptive text.<br />
27+
- Use '/' only; strip drive letters and external folders.<br />
28+
- Do not use these URI schemes: file://, vscode://<br />
29+
- Encode spaces only in the target (My File.md → My%20File.md).<br />
30+
- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20.<br />
31+
- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10<br />
2332
<br />
24-
NEVER cite file paths as plain text when referring to specific locations. For example, instead of saying `The function is in exampleScript.ts at line 25.`, say `The function is in [exampleScript.ts](exampleScript.ts#L25).`<br />
33+
34+
USAGE EXAMPLES:<br />
35+
- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10).<br />
36+
- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup.<br />
37+
- Bullet list: [Init widget](src/widget.ts#L321)<br />
38+
- File only: See [src/config.ts](src/config.ts) for settings.<br />
39+
<br />
40+
41+
FORBIDDEN (NEVER OUTPUT):<br />
42+
- Inline code: `file.ts`, `src/file.ts`, `L86`.<br />
43+
- Plain text file names: file.ts, chatService.ts.<br />
44+
- References without links when mentioning specific file locations.<br />
45+
- Specific line citations without links ("Line 86", "at line 86", "on line 25").<br />
46+
- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20)<br />
2547
<br />
26-
Critical rules:<br />
27-
- Always include both brackets **and** parentheses. `[src/file.ts](src/file.ts#L25)` is valid; `[src/file.ts#L25]` is not.<br />
28-
- Path format: Strip drive letters and workspace parent folders - use only path after workspace root<br />
29-
- Transform `c:\Repos\workspace\src\file.ts` → `[src/file.ts](src/file.ts)`<br />
30-
- Always use forward slashes `/`, never backslashes `\`<br />
31-
- Do not use URIs like file://, vscode:// for file paths.<br />
32-
- Percent-encode spaces in target only: `[My File.md](My%20File.md)`<br />
33-
- Each file reference needs complete path (don't abbreviate repeated files)<br />
34-
- Integrate line numbers into anchor: `#L10` or `#L10-L12` for ranges<br />
35-
- Don't wrap links in backticks; only cite existing paths from context<br />
3648
</Tag>;
3749
}
3850
}

src/extension/prompts/node/agent/geminiPrompts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class DefaultGeminiAgentPrompt extends PromptElement<DefaultAgentPromptPr
102102
{this.props.availableTools && <McpToolInstructions tools={this.props.availableTools} />}
103103
<NotebookInstructions {...this.props} />
104104
<Tag name='outputFormatting'>
105-
Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section<br />
105+
Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below<br />
106106
<FileLinkificationInstructions />
107107
<MathIntegrationRules />
108108
</Tag>

src/extension/prompts/node/agent/openai/defaultOpenAIPrompt.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,8 @@ export class DefaultOpenAIAgentPrompt extends PromptElement<DefaultAgentPromptPr
100100
{this.props.availableTools && <McpToolInstructions tools={this.props.availableTools} />}
101101
<NotebookInstructions {...this.props} />
102102
<Tag name='outputFormatting'>
103-
Use proper Markdown formatting. Backtick code identifiers (classes, functions, variables, commands). For file paths or specific code locations, do NOT use backticks—convert them to markdown links with line anchors; file path and line anchor link rules are defined in `FileLinkificationInstructions` below. Avoid duplicating those examples here.<br />
104-
<Tag name='example'>
105-
Identifiers only: `calculateTotal`, `Person`, `AppConfig`.<br />
106-
File path link examples live in fileLinkification section below.<br />
107-
</Tag>
103+
- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()`<br />
104+
- When mentioning files or line numbers, always follow the rules in fileLinkification section below:
108105
<FileLinkificationInstructions />
109106
<MathIntegrationRules />
110107
</Tag>

src/extension/prompts/node/agent/openai/gpt51CodexPrompt.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ class Gpt51CodexPrompt extends PromptElement<DefaultAgentPromptProps> {
7979
- Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets.
8080
</Tag>
8181
<Tag name='special_formatting'>
82-
When referring to a filename or symbol in the user's workspace, wrap it in backticks.<br />
83-
<Tag name='example'>
84-
The class `Person` is in `src/models/person.ts`.
85-
</Tag>
82+
Use proper Markdown formatting:
83+
- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()`<br />
84+
- When mentioning files or line numbers, always follow the rules in fileLinkification section below:
8685
<FileLinkificationInstructions />
8786
<MathIntegrationRules />
8887
</Tag>

src/extension/prompts/node/agent/openai/gpt51Prompt.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ class Gpt51Prompt extends PromptElement<DefaultAgentPromptProps> {
260260
Generally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what's needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable.<br />
261261
<br />
262262
For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting.
263+
<FileLinkificationInstructions />
263264
</Tag>
264265
<ResponseTranslationRules />
265-
<FileLinkificationInstructions />
266266
</InstructionMessage >;
267267
}
268268
}

src/extension/prompts/node/agent/openai/gpt5Prompt.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,8 @@ class DefaultGpt5AgentPrompt extends PromptElement<DefaultAgentPromptProps> {
215215
<br />
216216
For casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting.<br />
217217
<br />
218-
When referring to a filename or symbol in the user's workspace, wrap it in backticks.<br />
219-
<Tag name='example'>
220-
The class `Person` is in `src/models/person.ts`.
221-
</Tag>
218+
- Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()`<br />
219+
- When mentioning files or line numbers, always follow the rules in fileLinkification section below:
222220
<FileLinkificationInstructions />
223221
<MathIntegrationRules />
224222
</Tag>

src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-claude-sonnet-4.5.spec.snap

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -74,35 +74,40 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce
7474
Important Reminder: Markdown cells cannot be executed
7575
</notebookInstructions>
7676
<outputFormatting>
77-
Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and code locations, follow `FileLinkificationInstructions` (markdown links with line anchors; never backticks).
78-
<example>
79-
File path and line anchor formatting rules are defined in `FileLinkificationInstructions` below.
80-
</example>
81-
<fileLinkification>
82-
ALWAYS convert file paths to markdown links with 1-based line numbers whenever you cite specific code locations in the workspace. Paths should be relative to workspace root.
83-
84-
**Inline references:** Use the file path as link text within sentences:
85-
- `The handler lives in [path/to/file.ts](path/to/file.ts#L10).` (single line)
86-
- `See [path/to/file.ts](path/to/file.ts#L10-L12) for the range.` (line range)
87-
- `Configuration is defined in [path/to/file.ts](path/to/file.ts).` (whole file)
88-
89-
**Bullet lists:** Explains what each reference is, so readers understand the context without clicking:
90-
- [Await chat view](path/to/file.ts#L142)
91-
- [Show widget](path/to/file.ts#L321)
92-
Don't just list bare file paths like `file.ts#L142`
93-
94-
NEVER cite file paths as plain text when referring to specific locations. For example, instead of saying `The function is in exampleScript.ts at line 25.`, say `The function is in [exampleScript.ts](exampleScript.ts#L25).`
95-
96-
Critical rules:
97-
- Always include both brackets **and** parentheses. `[src/file.ts](src/file.ts#L25)` is valid; `[src/file.ts#L25]` is not.
98-
- Path format: Strip drive letters and workspace parent folders - use only path after workspace root
99-
- Transform `c:/Repos/workspace/src/file.ts` → `[src/file.ts](src/file.ts)`
100-
- Always use forward slashes `/`, never backslashes `/`
101-
- Do not use URIs like file://, vscode:// for file paths.
102-
- Percent-encode spaces in target only: `[My File.md](My%20File.md)`
103-
- Each file reference needs complete path (don't abbreviate repeated files)
104-
- Integrate line numbers into anchor: `#L10` or `#L10-L12` for ranges
105-
- Don't wrap links in backticks; only cite existing paths from context
77+
Use proper Markdown formatting: - Wrap symbol names (classes, methods, variables) in backticks: `MyClass`, `handleClick()`
78+
- When mentioning files or line numbers, always follow the rules in fileLinkification section below:<fileLinkification>
79+
When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers.
80+
NO BACKTICKS ANYWHERE:
81+
- Never wrap file names, paths, or links in backticks.
82+
- Never use inline-code formatting for any file reference.
83+
84+
REQUIRED FORMATS:
85+
- File: [path/file.ts](path/file.ts)
86+
- Line: [file.ts](file.ts#L10)
87+
- Range: [file.ts](file.ts#L10-L12)
88+
89+
PATH RULES:
90+
- Without line numbers: Display text must match the target path.
91+
- With line numbers: Display text can be either the path or descriptive text.
92+
- Use '/' only; strip drive letters and external folders.
93+
- Do not use these URI schemes: file://, vscode://
94+
- Encode spaces only in the target (My File.md → My%20File.md).
95+
- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20.
96+
- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10
97+
98+
USAGE EXAMPLES:
99+
- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10).
100+
- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup.
101+
- Bullet list: [Init widget](src/widget.ts#L321)
102+
- File only: See [src/config.ts](src/config.ts) for settings.
103+
104+
FORBIDDEN (NEVER OUTPUT):
105+
- Inline code: `file.ts`, `src/file.ts`, `L86`.
106+
- Plain text file names: file.ts, chatService.ts.
107+
- References without links when mentioning specific file locations.
108+
- Specific line citations without links ("Line 86", "at line 86", "on line 25").
109+
- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20)
110+
106111

107112
</fileLinkification>
108113

src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-all_non_edit_tools-gemini-2.0-flash.spec.snap

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,40 @@ Important Reminder: Avoid referencing Notebook Cell Ids in user messages. Use ce
4343
Important Reminder: Markdown cells cannot be executed
4444
</notebookInstructions>
4545
<outputFormatting>
46-
Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section
46+
Use proper Markdown formatting. When referring to symbols (classes, methods, variables) in user's workspace wrap in backticks. For file paths and line number rules, see fileLinkification section below
4747
<fileLinkification>
48-
ALWAYS convert file paths to markdown links with 1-based line numbers whenever you cite specific code locations in the workspace. Paths should be relative to workspace root.
49-
50-
**Inline references:** Use the file path as link text within sentences:
51-
- `The handler lives in [path/to/file.ts](path/to/file.ts#L10).` (single line)
52-
- `See [path/to/file.ts](path/to/file.ts#L10-L12) for the range.` (line range)
53-
- `Configuration is defined in [path/to/file.ts](path/to/file.ts).` (whole file)
54-
55-
**Bullet lists:** Explains what each reference is, so readers understand the context without clicking:
56-
- [Await chat view](path/to/file.ts#L142)
57-
- [Show widget](path/to/file.ts#L321)
58-
Don't just list bare file paths like `file.ts#L142`
59-
60-
NEVER cite file paths as plain text when referring to specific locations. For example, instead of saying `The function is in exampleScript.ts at line 25.`, say `The function is in [exampleScript.ts](exampleScript.ts#L25).`
61-
62-
Critical rules:
63-
- Always include both brackets **and** parentheses. `[src/file.ts](src/file.ts#L25)` is valid; `[src/file.ts#L25]` is not.
64-
- Path format: Strip drive letters and workspace parent folders - use only path after workspace root
65-
- Transform `c:/Repos/workspace/src/file.ts` → `[src/file.ts](src/file.ts)`
66-
- Always use forward slashes `/`, never backslashes `/`
67-
- Do not use URIs like file://, vscode:// for file paths.
68-
- Percent-encode spaces in target only: `[My File.md](My%20File.md)`
69-
- Each file reference needs complete path (don't abbreviate repeated files)
70-
- Integrate line numbers into anchor: `#L10` or `#L10-L12` for ranges
71-
- Don't wrap links in backticks; only cite existing paths from context
48+
When mentioning files or line numbers, always convert them to markdown links using workspace-relative paths and 1-based line numbers.
49+
NO BACKTICKS ANYWHERE:
50+
- Never wrap file names, paths, or links in backticks.
51+
- Never use inline-code formatting for any file reference.
52+
53+
REQUIRED FORMATS:
54+
- File: [path/file.ts](path/file.ts)
55+
- Line: [file.ts](file.ts#L10)
56+
- Range: [file.ts](file.ts#L10-L12)
57+
58+
PATH RULES:
59+
- Without line numbers: Display text must match the target path.
60+
- With line numbers: Display text can be either the path or descriptive text.
61+
- Use '/' only; strip drive letters and external folders.
62+
- Do not use these URI schemes: file://, vscode://
63+
- Encode spaces only in the target (My File.md → My%20File.md).
64+
- Non-contiguous lines require separate links. NEVER use comma-separated line references like #L10-L12, L20.
65+
- Valid formats: [file.ts](file.ts#L10) or [file.ts#L10] only. Invalid: ([file.ts#L10]) or [file.ts](file.ts)#L10
66+
67+
USAGE EXAMPLES:
68+
- With path as display: The handler is in [src/handler.ts](src/handler.ts#L10).
69+
- With descriptive text: The [widget initialization](src/widget.ts#L321) runs on startup.
70+
- Bullet list: [Init widget](src/widget.ts#L321)
71+
- File only: See [src/config.ts](src/config.ts) for settings.
72+
73+
FORBIDDEN (NEVER OUTPUT):
74+
- Inline code: `file.ts`, `src/file.ts`, `L86`.
75+
- Plain text file names: file.ts, chatService.ts.
76+
- References without links when mentioning specific file locations.
77+
- Specific line citations without links ("Line 86", "at line 86", "on line 25").
78+
- Combining multiple line references in one link: [file.ts#L10-L12, L20](file.ts#L10-L12, L20)
79+
7280

7381
</fileLinkification>
7482

0 commit comments

Comments
 (0)