Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions src/extension/prompts/node/agent/agentPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ import { InternalToolReference } from '../../../prompt/common/intents';
import { IPromptVariablesService } from '../../../prompt/node/promptVariablesService';
import { ToolName } from '../../../tools/common/toolNames';
import { TodoListContextPrompt } from '../../../tools/node/todoListContextPrompt';
import { CopilotIdentityRules, GPT5CopilotIdentityRule } from '../base/copilotIdentity';
import { IPromptEndpoint, renderPromptElement } from '../base/promptRenderer';
import { Gpt5SafetyRule, SafetyRules } from '../base/safetyRules';
import { Tag } from '../base/tag';
import { TerminalStatePromptElement } from '../base/terminalState';
import { ChatVariables } from '../panel/chatVariables';
Expand Down Expand Up @@ -86,25 +84,8 @@ export class AgentPrompt extends PromptElement<AgentPromptProps> {
const instructions = await this.getInstructions();

const omitBaseAgentInstructions = this.configurationService.getConfig(ConfigKey.Advanced.OmitBaseAgentInstructions);
const baseAgentInstructions = <>
<SystemMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />
{isGpt5PlusFamily(this.props.endpoint.family) ? (
<>
<GPT5CopilotIdentityRule />
<Gpt5SafetyRule />
</>
) : (
<>
<CopilotIdentityRules />
<SafetyRules />
</>
)}
</SystemMessage>
{instructions}
</>;
const baseInstructions = <>
{!omitBaseAgentInstructions && baseAgentInstructions}
{!omitBaseAgentInstructions && instructions}
{await this.getAgentCustomInstructions()}
<UserMessage>
{await this.getOrCreateGlobalAgentContext(this.props.endpoint)}
Expand Down
8 changes: 8 additions & 0 deletions src/extension/prompts/node/agent/anthropicPrompts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
import { IChatEndpoint } from '../../../../platform/networking/common/networking';
import { ToolName } from '../../../tools/common/toolNames';
import { CopilotIdentityRules } from '../base/copilotIdentity';
import { InstructionMessage } from '../base/instructionMessage';
import { ResponseTranslationRules } from '../base/responseTranslationRules';
import { SafetyRules } from '../base/safetyRules';
import { Tag } from '../base/tag';
import { EXISTING_CODE_MARKER } from '../panel/codeBlockFormattingRules';
import { MathIntegrationRules } from '../panel/editorIntegrationRules';
Expand All @@ -20,6 +22,9 @@ class DefaultAnthropicAgentPrompt extends PromptElement<DefaultAgentPromptProps>
const tools = detectToolCapabilities(this.props.availableTools);

return <InstructionMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />
<CopilotIdentityRules />
<SafetyRules />
<Tag name='instructions'>
You are a highly sophisticated automated coding agent with expert-level knowledge across many different programming languages and frameworks.<br />
The user will ask a question, or ask you to perform a task, and it may require lots of research to answer correctly. There is a selection of tools that let you perform actions or retrieve helpful context to answer the user's question.<br />
Expand Down Expand Up @@ -116,6 +121,9 @@ class Claude45DefaultPrompt extends PromptElement<DefaultAgentPromptProps> {
const tools = detectToolCapabilities(this.props.availableTools);

return <InstructionMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />
<CopilotIdentityRules />
<SafetyRules />
<Tag name='instructions'>
You are a highly sophisticated automated coding agent with expert-level knowledge across many different programming languages and frameworks and software engineering tasks - this encompasses debugging issues, implementing new features, restructuring code, and providing code explanations, among other engineering activities.<br />
The user will ask a question, or ask you to perform a task, and it may require lots of research to answer correctly. There is a selection of tools that let you perform actions or retrieve helpful context to answer the user's question.<br />
Expand Down
5 changes: 5 additions & 0 deletions src/extension/prompts/node/agent/defaultAgentInstructions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { Tag } from '../base/tag';
import { CodeBlockFormattingRules, EXISTING_CODE_MARKER } from '../panel/codeBlockFormattingRules';
import { MathIntegrationRules } from '../panel/editorIntegrationRules';
import { KeepGoingReminder } from './agentPrompt';
import { CopilotIdentityRules } from '../base/copilotIdentity';
import { SafetyRules } from '../base/safetyRules';

// Types and interfaces for reusable components
interface ToolCapabilities extends Partial<Record<ToolName, boolean>> {
Expand Down Expand Up @@ -52,6 +54,9 @@ export class DefaultAgentPrompt extends PromptElement<DefaultAgentPromptProps> {
const tools = detectToolCapabilities(this.props.availableTools);

return <InstructionMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />
<CopilotIdentityRules />
<SafetyRules />
<Tag name='instructions'>
You are a highly sophisticated automated coding agent with expert-level knowledge across many different programming languages and frameworks.<br />
The user will ask a question, or ask you to perform a task, and it may require lots of research to answer correctly. There is a selection of tools that let you perform actions or retrieve helpful context to answer the user's question.<br />
Expand Down
5 changes: 5 additions & 0 deletions src/extension/prompts/node/agent/geminiPrompts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
import { IChatEndpoint } from '../../../../platform/networking/common/networking';
import { ToolName } from '../../../tools/common/toolNames';
import { CopilotIdentityRules } from '../base/copilotIdentity';
import { InstructionMessage } from '../base/instructionMessage';
import { ResponseTranslationRules } from '../base/responseTranslationRules';
import { SafetyRules } from '../base/safetyRules';
import { Tag } from '../base/tag';
import { EXISTING_CODE_MARKER } from '../panel/codeBlockFormattingRules';
import { MathIntegrationRules } from '../panel/editorIntegrationRules';
Expand All @@ -23,6 +25,9 @@ export class DefaultGeminiAgentPrompt extends PromptElement<DefaultAgentPromptPr
const tools = detectToolCapabilities(this.props.availableTools);

return <InstructionMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />
<CopilotIdentityRules />
<SafetyRules />
<Tag name='instructions'>
You are a highly sophisticated automated coding agent with expert-level knowledge across many different programming languages and frameworks.<br />
The user will ask a question, or ask you to perform a task, and it may require lots of research to answer correctly. There is a selection of tools that let you perform actions or retrieve helpful context to answer the user's question.<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
import { IChatEndpoint } from '../../../../../platform/networking/common/networking';
import { ToolName } from '../../../../tools/common/toolNames';
import { CopilotIdentityRules } from '../../base/copilotIdentity';
import { InstructionMessage } from '../../base/instructionMessage';
import { ResponseTranslationRules } from '../../base/responseTranslationRules';
import { SafetyRules } from '../../base/safetyRules';
import { Tag } from '../../base/tag';
import { EXISTING_CODE_MARKER } from '../../panel/codeBlockFormattingRules';
import { MathIntegrationRules } from '../../panel/editorIntegrationRules';
Expand All @@ -20,6 +22,9 @@ export class DefaultOpenAIAgentPrompt extends PromptElement<DefaultAgentPromptPr
const tools = detectToolCapabilities(this.props.availableTools);

return <InstructionMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />
<CopilotIdentityRules />
<SafetyRules />
<Tag name='instructions'>
You are a highly sophisticated automated coding agent with expert-level knowledge across many different programming languages and frameworks.<br />
The user will ask a question, or ask you to perform a task, and it may require lots of research to answer correctly. There is a selection of tools that let you perform actions or retrieve helpful context to answer the user's question.<br />
Expand Down
5 changes: 5 additions & 0 deletions src/extension/prompts/node/agent/openai/gpt51CodexPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
import { IChatEndpoint } from '../../../../../platform/networking/common/networking';
import { ToolName } from '../../../../tools/common/toolNames';
import { GPT5CopilotIdentityRule } from '../../base/copilotIdentity';
import { InstructionMessage } from '../../base/instructionMessage';
import { Gpt5SafetyRule } from '../../base/safetyRules';
import { Tag } from '../../base/tag';
import { MathIntegrationRules } from '../../panel/editorIntegrationRules';
import { DefaultAgentPromptProps, detectToolCapabilities } from '../defaultAgentInstructions';
Expand All @@ -19,6 +21,9 @@ class Gpt51CodexPrompt extends PromptElement<DefaultAgentPromptProps> {
async render(state: void, sizing: PromptSizing) {
const tools = detectToolCapabilities(this.props.availableTools);
return <InstructionMessage>
Copy link

Copilot AI Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The introductory sentence "You are an expert AI programming assistant, working with a user in the VS Code editor." is missing here but present in gpt5Prompt.tsx and gpt5CodexPrompt.tsx. This inconsistency means different GPT-5.1 models get different identity preambles. Add the missing introductory sentence before <GPT5CopilotIdentityRule /> for consistency, or document why this model should have a different introduction.

Suggested change
return <InstructionMessage>
return <InstructionMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />

Copilot uses AI. Check for mistakes.
<GPT5CopilotIdentityRule />
You are running as a coding agent in VS Code on a user's computer.<br />
<Gpt5SafetyRule />
<Tag name="editing_constraints">
- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.<br />
- Add succinct code comments that explain what is going on if code is not self-explanatory. You should not add comments like "Assigns the value to the variable", but a brief comment might be useful ahead of a complex code block that the user would otherwise have to spend time parsing out. Usage of these comments should be rare.<br />
Expand Down
5 changes: 5 additions & 0 deletions src/extension/prompts/node/agent/openai/gpt51Prompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
import { isGpt51Family, isGptCodexFamily } from '../../../../../platform/endpoint/common/chatModelCapabilities';
import { IChatEndpoint } from '../../../../../platform/networking/common/networking';
import { ToolName } from '../../../../tools/common/toolNames';
import { GPT5CopilotIdentityRule } from '../../base/copilotIdentity';
import { InstructionMessage } from '../../base/instructionMessage';
import { ResponseTranslationRules } from '../../base/responseTranslationRules';
import { Gpt5SafetyRule } from '../../base/safetyRules';
import { Tag } from '../../base/tag';
import { MathIntegrationRules } from '../../panel/editorIntegrationRules';
import { ApplyPatchInstructions, DefaultAgentPromptProps, detectToolCapabilities, McpToolInstructions } from '../defaultAgentInstructions';
Expand All @@ -18,6 +20,9 @@ class Gpt51Prompt extends PromptElement<DefaultAgentPromptProps> {
async render(state: void, sizing: PromptSizing) {
const tools = detectToolCapabilities(this.props.availableTools);
return <InstructionMessage>
Copy link

Copilot AI Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The introductory sentence "You are an expert AI programming assistant, working with a user in the VS Code editor." is missing here but present in gpt5Prompt.tsx and gpt5CodexPrompt.tsx. This inconsistency means different GPT-5.1 models get different identity preambles. Add the missing introductory sentence before <GPT5CopilotIdentityRule /> for consistency, or document why this model should have a different introduction.

Suggested change
return <InstructionMessage>
return <InstructionMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />

Copilot uses AI. Check for mistakes.
<GPT5CopilotIdentityRule />
You are running as a coding agent in VS Code on a user's computer. You are expected to be precise, safe, and helpful.<br />
<Gpt5SafetyRule />
<Tag name='coding_agent_instructions'>
You are a coding agent running in VS Code. You are expected to be precise, safe, and helpful.<br />
<br />
Expand Down
5 changes: 5 additions & 0 deletions src/extension/prompts/node/agent/openai/gpt5CodexPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
import { IChatEndpoint } from '../../../../../platform/networking/common/networking';
import { ToolName } from '../../../../tools/common/toolNames';
import { GPT5CopilotIdentityRule } from '../../base/copilotIdentity';
import { InstructionMessage } from '../../base/instructionMessage';
import { Gpt5SafetyRule } from '../../base/safetyRules';
import { DefaultAgentPromptProps, detectToolCapabilities } from '../defaultAgentInstructions';
import { IAgentPrompt, PromptConstructor, PromptRegistry } from '../promptRegistry';

class CodexStyleGpt5CodexPrompt extends PromptElement<DefaultAgentPromptProps> {
async render(state: void, sizing: PromptSizing) {
const tools = detectToolCapabilities(this.props.availableTools);
return <InstructionMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />
<GPT5CopilotIdentityRule />
<Gpt5SafetyRule />
You are a coding agent based on GPT-5-Codex.<br />
<br />
## Editing constraints<br />
Expand Down
5 changes: 5 additions & 0 deletions src/extension/prompts/node/agent/openai/gpt5Prompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
import { isGpt5Family } from '../../../../../platform/endpoint/common/chatModelCapabilities';
import { IChatEndpoint } from '../../../../../platform/networking/common/networking';
import { ToolName } from '../../../../tools/common/toolNames';
import { GPT5CopilotIdentityRule } from '../../base/copilotIdentity';
import { InstructionMessage } from '../../base/instructionMessage';
import { ResponseTranslationRules } from '../../base/responseTranslationRules';
import { Gpt5SafetyRule } from '../../base/safetyRules';
import { Tag } from '../../base/tag';
import { MathIntegrationRules } from '../../panel/editorIntegrationRules';
import { ApplyPatchInstructions, DefaultAgentPromptProps, detectToolCapabilities, McpToolInstructions } from '../defaultAgentInstructions';
Expand All @@ -18,6 +20,9 @@ class DefaultGpt5AgentPrompt extends PromptElement<DefaultAgentPromptProps> {
async render(state: void, sizing: PromptSizing) {
const tools = detectToolCapabilities(this.props.availableTools);
return <InstructionMessage>
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />
<GPT5CopilotIdentityRule />
<Gpt5SafetyRule />
<Tag name='coding_agent_instructions'>
You are a coding agent running in VS Code. You are expected to be precise, safe, and helpful.<br />
Your capabilities:<br />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### System
~~~md
You are an expert AI programming assistant, working with a user in the VS Code editor.
Your name is GitHub Copilot. When asked about the model you are using, state that you are using test.
You are running as a coding agent in VS Code on a user's computer.
Follow Microsoft content policies.
Avoid content that violates copyrights.
If you are asked to generate content that is harmful, hateful, racist, sexist, lewd, or violent, only respond with "Sorry, I can't assist with that."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### System
~~~md
You are an expert AI programming assistant, working with a user in the VS Code editor.
Your name is GitHub Copilot. When asked about the model you are using, state that you are using test.
You are running as a coding agent in VS Code on a user's computer.
Follow Microsoft content policies.
Avoid content that violates copyrights.
If you are asked to generate content that is harmful, hateful, racist, sexist, lewd, or violent, only respond with "Sorry, I can't assist with that."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### System
~~~md
You are an expert AI programming assistant, working with a user in the VS Code editor.
Your name is GitHub Copilot. When asked about the model you are using, state that you are using test.
You are running as a coding agent in VS Code on a user's computer. You are expected to be precise, safe, and helpful.
Follow Microsoft content policies.
Avoid content that violates copyrights.
If you are asked to generate content that is harmful, hateful, racist, sexist, lewd, or violent, only respond with "Sorry, I can't assist with that."
Expand Down
Loading
Loading