vscode / prompts
AGENTS.md196k starsChanged 17 days agoMITView on GitHub
This directory customizes the system prompt for Copilot CLI agent host (ahp+cli) sessions. Read this before changing how the system message is built or adding per-model / per-tool guidance. It mirrors the Copilot extension's extensions/copilot/.../prompts/node/agent/ (agentPrompts), but the agent host runs in its own process and cannot use prompt-tsx, so contributors return plain data the SDK accepts directly. Unless the matching chat.agentHost.copilot.modelCapabilityOverrides entry provides a YAML promptOverrideString or promptOverrideFile containing systemPrompt, resolveSystemMessageConfig(model, context) layers, in order: The per-model prompt override…
Trending
More talk lately.about the whole repository
Who's talking about microsoft/vscode
- A Hacker News story“VS Code inserting 'Co-Authored-by Copilot' into commits regardless of usage”Hacker News · May 2, 2026 · 1.5k points
- microsoft/TypeScript“Convert the codebase to modules”GitHub · Nov 2, 2022 · 1.3k reactions
- A Hacker News story“VS Code uses 13% CPU when idle due to blinking cursor rendering”Hacker News · Mar 23, 2017 · 899 points
- A Hacker News story“VS Code Roadmap 2018”Hacker News · Nov 1, 2017 · 360 points
- microsoft/vscode-python“Fix environment-dependent git pre-commit hooks”GitHub · Feb 18, 2020 · 338 reactions
The biggest 5 of 96 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 96
Talked about on Bluesky, Hacker News and GitHub (96 times).
On Bluesky · 48
- Jan 18, 2026Decided to quit being hard headed and just do what everyone else is doing/has done. — @advanced-eschatonics.com12 likes and reposts · 1 reply
- Jul 12, 2026📦 microsoft / vscode ⭐ 187,428 (+52) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social3 likes and reposts
- Jul 2, 2026📦 microsoft / vscode ⭐ 186,897 (+73) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social3 likes and reposts
- Nov 2, 2025📦 microsoft / vscode ⭐ 178,121 (+34) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social3 likes and reposts
- Jan 15, 2025📦 microsoft / vscode ⭐ 166,156 (+43) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social3 likes and reposts
43 more on Bluesky
- Jul 8, 2023📦 microsoft / vscode ⭐ 147,967 (+41) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social3 likes and reposts
- Apr 5, 2026📦 microsoft / vscode ⭐ 183,440 (+45) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Jul 18, 2025Sorry to hear you are hitting this problem! We would love to help you out over at github.com/microsoft/vs... and if you assign your issue… — @eleanor-py.bsky.social2 likes and reposts
- May 21, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 171,731 (+283) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social2 likes and reposts
- May 20, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 171,513 (+253) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts · 1 reply
- Mar 30, 2025📦 microsoft / vscode ⭐ 169,312 (+41) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Mar 7, 2025📦 microsoft / vscode ⭐ 168,219 (+82) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social2 likes and reposts
- Feb 12, 2025📦 microsoft / vscode ⭐ 167,217 (+56) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Feb 8, 2025📦 microsoft / vscode ⭐ 167,047 (+49) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Jan 24, 2025📦 microsoft / vscode ⭐ 166,533 (+32) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Jan 15, 2025📦 microsoft / vscode ⭐ 166,156 (+43) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social2 likes and reposts
- Sep 1, 2024📦 microsoft / vscode ⭐ 162,015 (+32) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Jun 10, 2024📦 microsoft / vscode ⭐ 159,629 (+49) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Aug 26, 2023🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / vscode ⭐ 150,079 (+137) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social2 likes and reposts · 1 reply
- Nov 7, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 194,788 (+295) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost · 1 reply
- Nov 6, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 194,788 (+295) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social1 likes and repost · 1 reply
- Sep 26, 2026📦 microsoft / vscode ⭐ 192,963 (+78) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Sep 26, 2026📦 microsoft / vscode ⭐ 192,963 (+78) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social1 likes and repost
- Jun 25, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / vscode ⭐ 186,883 (+192) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jun 4, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / vscode ⭐ 185,791 (+129) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- May 20, 2026📦 microsoft / vscode ⭐ 185,087 (+57) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Apr 16, 2026📦 microsoft / vscode ⭐ 183,924 (+72) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Mar 5, 2026📦 microsoft / vscode ⭐ 182,312 (+76) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Dec 28, 2025📦 microsoft / vscode ⭐ 180,078 (+53) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jul 2, 2025📦 microsoft / vscode ⭐ 174,099 (+53) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- May 24, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 172,520 (+306) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- May 8, 2025📦 microsoft / vscode ⭐ 170,885 (+85) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Apr 11, 2025📦 microsoft / vscode ⭐ 169,887 (+76) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Apr 7, 2025📦 microsoft / vscode ⭐ 169,634 (+51) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Mar 6, 2025📦 microsoft / vscode ⭐ 168,138 (+89) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Feb 16, 2025📦 microsoft / vscode ⭐ 167,406 (+60) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jan 2, 2025lol yeah vscode is kinda wild tbh github.com/microsoft/vscode is the open source project but the versions you get from… — @benharri.org1 likes and repost · 2 replies
- Nov 1, 2024📦 microsoft / vscode ⭐ 163,956 (+52) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jun 18, 2024📦 microsoft / vscode ⭐ 159,805 (+32) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jun 6, 2024📦 microsoft / vscode ⭐ 159,414 (+58) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Apr 11, 2024📦 microsoft / vscode ⭐ 157,765 (+42) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jan 29, 2024📦 microsoft / vscode ⭐ 155,349 (+36) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jan 19, 2024📦 microsoft / vscode ⭐ 155,009 (+57) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Dec 24, 2023📦 microsoft / vscode ⭐ 154,283 (+39) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Mar 17, 2025Something I just realized I want: wikilinks but for any website; kinda like DDG bangs, but for linking to things more easily. Generally… — @blakes.dev0 likes and reposts · 1 reply
- Feb 16, 2024🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 156,140 (+203) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social0 likes and reposts · 1 reply
- Sep 4, 2023🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / vscode ⭐ 150,693 (+178) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social0 likes and reposts · 1 reply
- Aug 26, 2023🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / vscode ⭐ 150,078 (+137) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social0 likes and reposts · 1 reply
On Hacker News · 39
- May 2, 2026VS Code inserting 'Co-Authored-by Copilot' into commits regardless of usage1.5k points · 850 comments
- Mar 23, 2017VS Code uses 13% CPU when idle due to blinking cursor renderingsays it tested it899 points · 760 comments
- Nov 1, 2017VS Code Roadmap 2018360 points · 230 comments
- Dec 19, 2019Santa hat removed from VS Code after complaint243 points · 157 comments
- Apr 18, 2017Show HN: Visual Studio Code for ARM, submitted to core236 points · 83 comments
34 more on Hacker News
- Feb 8, 2026Billing can be bypassed using a combo of subagents with an agent definition213 points · 122 comments
- Oct 27, 2023Microsoft: Require user consent before sending any telemetry128 points · 122 comments
- May 29, 2020Insider Build of VSCode for Windows/ARM64106 points · 79 comments
- May 6, 2026Update on "Co-authored-by: Copilot" in commit messages102 points · 66 comments
- Dec 20, 2019Visual Studio Code repository is open again87 points · 163 comments
- Jun 19, 2018Want free VS Code? Build it from source84 points · 65 comments
- Oct 21, 2020Issue Grooming81 points · 68 comments
- Sep 25, 2026Bug: Border radius has infected VSCode editor80 points · 53 comments
- Mar 19, 2022Visual Studio Code is randomly erasing included header files with latest update75 points · 44 comments
- Sep 3, 2023VSCode Removes Twitter Integration68 points · 31 comments
- Oct 15, 2017New VS Code icon is ugly66 points · 48 comments
- Feb 4, 2023Microsoft mangles VS Code protected properties to prevent UI customization65 points · 28 comments
- Apr 29, 2020VS Code was lost on shutdown with pending update (2018)64 points · 90 comments
- Oct 27, 2025Severe performance penalty found in VSCode rendering loop63 points · 45 comments
- Nov 24, 2020VSCode memory leak issue marked “out-of-scope”62 points · 71 comments
- Feb 16, 2021Visual Studio Code team considers Vim mode depending on upvotes56 points · 27 comments
- Nov 3, 2023VS Code Introduces Floating Windows Support - The Most Requested Feature Ever46 points · 10 comments
- Jan 29, 2019VS Code Roadmap 201933 points · 3 comments
- Apr 21, 2022VS Code Development Process27 points · 3 comments
- Feb 2, 2024VSCode stopped supporting an old glibc version and near EOL users are in trouble23 points · 8 comments
- Jul 11, 2024VSCode won't start on several Mac OS versions, broken over a week16 points · 3 comments
- Nov 15, 2025Markdown files are not openable because of GitHub Copilot11 points · 1 comment
- Mar 17, 2022VSCode creates many empty file with invalid code automatically8 points · 1 comment
- Dec 19, 2019VS Code Issue Tracker Meltdown8 points · 4 comments
- Aug 31, 2023VSCode, have you collaborated with China?7 points
- Mar 15, 2023VS Code Monitors Full Command Line, CPU, Memory Usage of All Processes7 points · 1 comment
- Nov 20, 2024Thing Deleted 3 Months of Work6 points · 4 comments
- Nov 3, 2024VSCode high CPU usage issue affecting macOS6 points
- Oct 9, 2026VSCode silently switches to Microsoft models, ignoring BYO agent configuration5 points · 1 comment
- May 28, 2026VSCode fires up screen recording5 points
- Oct 5, 2025Microsoft Accidentally removes extensions from VSCode Marketplace5 points · 1 comment
- Nov 2, 2023After 7 years, VS Code finally implements preview support for floating windows5 points · 2 comments
- Feb 27, 2020THIS THING DELETED 3 MONTHS OF WORK!!!!5 points · 5 comments
- Dec 20, 2019VS Code is getting flak for removing Santa hat emoji5 points · 7 comments
On GitHub · 9
- Nov 2, 2022Convert the codebase to modules — microsoft/TypeScript1.3k reactions · 56 comments
- Feb 18, 2020Fix environment-dependent git pre-commit hooks — microsoft/vscode-python338 reactions · 57 comments
- Dec 12, 2025Handle writes to non-blocking pty instead of wrapping via Node's tty api — microsoft/node-pty256 reactions · 5 comments
- Oct 31, 2016Add Windows support and first-class Linux support — vercel/hyper160 reactions · 98 comments
- Sep 11, 2024Proposed expandable hover API — microsoft/TypeScript99 reactions · 15 comments
4 more on GitHub
- Dec 22, 2020LSP 3.16.0 — neoclide/coc.nvim64 reactions · 52 comments
- Mar 8, 2021Import statement completions — microsoft/TypeScript47 reactions · 9 comments
- Aug 13, 2017Feature/simple fullscreen mode — electron/electron43 reactions · 8 comments
- May 30, 2018Add support for grid layout — VSCodeVim/Vim37 reactions · 18 comments
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository96 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .eslint-plugin-local/AGENTS.mdAGENTS.md
- extensions/copilot/assets/prompts/skills/agent-customization/references/agents.mdAGENTS.md
- extensions/copilot/src/extension/chatSessions/copilotcli/AGENTS.mdAGENTS.md
- extensions/copilot/src/platform/authentication/common/AGENTS.mdAGENTS.md
- src/vs/platform/agentHost/AGENTS.mdAGENTS.md
- src/vs/platform/agentHost/common/state/AGENTS.mdAGENTS.md
- src/vs/platform/agentHost/test/node/AGENTS.mdAGENTS.md
- src/vs/workbench/contrib/imageCarousel/AGENTS.mdAGENTS.md
- extensions/copilot/.github/copilot-instructions.mdCopilot instructions
- .github/copilot-instructions.mdCopilot instructions
- launchSkill
- github-copilot-upgraderSkill
- launchSkill
- agent-customizationSkill
- chronicleSkill
- create-agentSkill
- create-canvasSkill
- create-hookSkill
- create-instructionsSkill
- create-promptSkill
- create-skillSkill
- initSkill
- migrate-customizationsSkill
- record-videoSkill
- troubleshootSkill
- accessibilitySkill
- agent-host-chat-contributionsSkill
- agent-host-e2e-testsSkill
- agent-host-logsSkill
- author-contributionsSkill
- auto-perf-optimizeSkill
- azure-pipelinesSkill
- build-champ-triageSkill
- chat-customizations-editorSkill
- chat-perfSkill
- chat-pet-sprite-creationSkill
- ci-artifact-testingSkill
- codenotifySkill
- code-oss-logsSkill
- code-reviewSkill
- component-fixturesSkill
- componentSkill
- context-menusSkill
- cpu-profile-analysisSkill
- customizations-in-the-agent-hostSkill
- design-philosophySkill
- doc-commentsSkill
- endgame-statusSkill
- experimentsSkill
- feature-tryoutsSkill
- feedback-learningSkill
- fix-ci-failuresSkill
- fixissuenoSkill
- flaky-smoke-testsSkill
- heap-snapshot-analysisSkill
- hoverSkill
- integrated-browserSkill
- integration-testsSkill
- issue-groupingSkill
- The first 60 shown.
The file
We split this AGENTS.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Write a ToolInstructionLine — a function (context) => string | undefined that returns one sentence (no surrounding newlines), or undefined …
- Very specific: line 36
Add it to TOOL_INSTRUCTION_LINES.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent host system-prompt customization
This directory customizes the system prompt for Copilot CLI agent host (ahp+cli) sessions. Read this before changing how the system message is built or adding per-model / per-tool guidance. It mirrors the Copilot extension's extensions/copilot/.../prompts/node/agent/ (agentPrompts), but the agent host runs in its own process and cannot use prompt-tsx, so contributors return plain data the SDK accepts directly.
Files
promptRegistry.ts—AgentHostPromptRegistry: resolves the finalSystemMessageConfigfor a session's model. Defines theIAgentHostPromptcontributor interface and theIAgentHostPromptContextread-time context.systemMessage.ts— the default message (COPILOT_AGENT_HOST_SYSTEM_MESSAGE), shared identity text, thefullSystemPrompt/sectionOverridesbuilders, anddescribeSystemMessageConfig(the one-line log summary).toolInstructions.ts— the model-agnostictool_instructionslayer: gated or unconditional nudges (TOOL_INSTRUCTION_LINES) composed into the SDK'stool_instructionssection, including the default-model guidance for subagents.anthropicPrompt.ts— example per-model contributor (Claude Opus 4.8).openaiPrompt.ts— OpenAI targeted post-edit inspection guidance, appended tocode_change_ruleswithout replacing the SDK foundation prompt.progressUpdatesInstructions.ts— the shared GPT model matcher and the experiment-gated progress-update guidance for GPT and Auto launches.allPrompts.ts— side-effect import hub; importing it registers every contributor into the sharedagentHostPromptRegistry.
How the system message is built
Unless the matching chat.agentHost.copilot.modelCapabilityOverrides entry provides a YAML promptOverrideString or promptOverrideFile containing systemPrompt, resolveSystemMessageConfig(model, context) layers, in order:
- Base —
_resolveModelConfigpicks the per-model (or default) config. Falls back toCOPILOT_AGENT_HOST_SYSTEM_MESSAGEwhen there's no model, no matching contributor, or the contributor opts out for thiscontext. A contributor'scustomizeconfig gets the default sections composed underneath it (withDefaultSections), so a contributor only overrides the sections it names — the defaultidentitysurvives unless explicitly overridden. _withUniversalSections— layers the model-agnostic tool instructions on top, composing with — never clobbering — any per-model override for that section. For areplacebase the lines are appended after the replacement content instead.- Workspaceless scratch, progress updates + file-link contract — appended as trailing
contentfor every mode, includingreplace, so a full replacement owns the prompt body but not the host's response-format plumbing. The progress-update guidance (progressUpdatesInstructions.ts) applies only to GPT and Auto launches while the experiment-controlledchat.agentHost.copilot.progressUpdatesPrompt.enabledsetting is on; it asks for one user-visible sentence in the same response as the first tool call, and short updates between phases, so these turns show text before their first tool call as Copilot Chat's GPT prompts do. The launcher decides eligibility at launch from the family-aliased model and anysystemPromptoverride, in both arms, and the session reports the experiment trigger at root turn start only for eligible launches whose setting is still controlled by its default.
The per-model prompt override supports the same fields and precedence as the Copilot Chat debug prompt override: inline YAML takes precedence over a YAML file, systemPrompt bypasses this registry and is sent directly as the Copilot SDK's systemMessage in replace mode, and toolDescriptions replaces descriptions on tools registered by Agent Host. This internal debugging setting assumes those values use the documented string shape.
Launch-time freeze. The SDK accepts a system message only at session create/resume; there is no mid-session update. The launcher resolves tools together with their initialization data (
systemMessage,toolSearch,excludedTools, andcustomAgents) and passes that exact data to the SDK. At queued configuration boundaries, the session generically compares the applied initialization data with the same resolver's desired data: a mismatch requires a relaunch; otherwise it usessession.setTools. All tool-only changes, including removals and renames, can apply during active turns or subagents without waiting for idle. The host does not alter the SDK's handling of in-flight tool calls; already-running tool handlers finish on their original handlers. Plugin changes also relaunch. Parsed custom agents and prompt-description overrides are retained from launch and reprojected for the current client tools without rereading their files; the system prompt remains frozen until relaunch.
Prompt-cache layout. The runtime, not this folder, decides how the rendered prompt is cut into cache blocks. By default it splits after
</environment_limitations>, so everything after that line (tool instructions, the hostcontent, the session folder) is in one block that differs in every session.chat.copilot.stabilityOrderedPrompt.enabled(off by default) sends theSTABILITY_ORDERED_SYSTEM_PROMPT_V2feature flag. With it, the runtime regroups the sections into a global block, a repository block and a per-session block, so new sessions with the same tools and workspace reuse the first two. That moves the per-session sections (environment, hostcontent, session folder, commit trailer) to the end of the prompt. Check model behavior before turning it on. The runtime classifiescustomizeoverrides by section and falls back to the default split when it cannot attribute one. Overrides ofruntime_instructionsorlast_instructionsalways go in the per-session block, so keep fixed guidance in other sections. See microsoft/vscode#339643.
There are two ways to customize, and a model can use both at once.
Lever 1 — universal, all models (toolInstructions.ts)
Guidance that should apply to every model. A line can be unconditional for host-wide behavior such as reading offloaded tool output, gated on a client tool as the browser line is, or gated on a host setting as the subagent model-guidance line is.
- Write a
ToolInstructionLine— a function(context) => string | undefinedthat returns one sentence (no surrounding newlines), orundefinedwhen its gate does not apply. TheIToolInstructionContextexposeshasTool(name)andgetSetting(key)(aCopilotCliConfigKey). - Add it to
TOOL_INSTRUCTION_LINES.
const exampleToolInstructions: ToolInstructionLine = ({ hasTool }) =>
hasTool('someClientToolReferenceName')
? 'One sentence of guidance, shown only when that tool is present.'
: undefined;
const TOOL_INSTRUCTION_LINES: readonly ToolInstructionLine[] = [largeOutputToolInstructions, browserToolInstructions, exampleToolInstructions];Caveat — hasTool sees CLIENT tools only. It is context.hasClientTool, which knows only the forwarded workbench tools, addressed by their camelCase toolReferenceName (e.g. openBrowserPage, runTask, getTaskOutput) — NOT the extension's snake_case ids, and NOT shell / server-SDK / MCP tools (MCP is discovered dynamically and isn't in the launch snapshot). A line gated on a name that is never a client tool silently never renders. The default client-tool allowlist is chat.agentHost.clientTools (see chat.shared.contribution.ts). Broadening this context is a known follow-up.
These lines compose with a per-model tool_instructions override (see composeToolInstructions), so Lever 1 and Lever 2 stack.
Tool search (deferred tool loading)
When the client forwards its toolSearch tool (users turn it off with the Search Tools toggle in Chat Customizations) AND the session's model supports it (agentHostModelSupportsToolSearch), the launcher sets toolSearch: { enabled: true, deferThreshold: TOOL_SEARCH_DEFER_THRESHOLD } (1) and the session defers MCP tools, non-core client tools, and server tools that do not set deferLoading: false behind the runtime's tool_search_tool. Without the forwarded tool, every tool is loaded eagerly:
- The override (
copilotAgentSession._createClientSdkTools): the client's forwardedtoolSearchtool is registered astool_search_toolwithoverridesBuiltInTool: trueanddefer: 'never', so the runtime routes the model's search to the client's semantic search. The SDK supplies the runtime's live deferred-tool metadata to the override handler; Agent Host carries that corpus as transient tool-call metadata and injects it only into the localtoolSearchinvocation, so embeddings rank the runtime/MCP tools rather than the extension's registry. The corpus is never added to model-facing tool input. Every other client tool getsdefer: 'never'if it is inNON_DEFERRED_CLIENT_TOOL_NAMES(currently empty), elsedefer: 'auto'. Built-in runtime tools are never deferred. The renderer (agentHostSessionHandler._setupClientToolCall) mapstool_search_toolback totoolSearchto execute the real VS Code tool. - The prompt (this folder):
toolSearchInstructionLines(toolSearchActive)adds atool_instructionsline (toolSearchToolInstructions) telling the model to load deferred tools viatool_search_toolfirst — gated oncontext.toolSearchActivebecause a forwardedtoolSearchtool alone does not mean the session's model supports tool search. The runtime already emits its own deferred-tools reminder (build_deferred_tools_user_message) with the accurate deferred set, so this layer intentionally does NOT re-list the deferred tools. - The host fallback (
copilotAgentSession._searchToolsOnHost): the tool-search decision is fixed when the SDK session launches, so a session can outlive the client that runs its search — e.g. an autonomous Agent Merge turn after the window closes. Deferred server and MCP tools need no client to run, so when no client can take a search call the override answers it on the host (searchToolsWithoutClient) instead of failing the call: it loads the host-runnable deferred tools the query names exactly, leaves out client tools, and tells the model why. When nothing matches, the result lists the loadable names so the model can search again by name. An error result would carry no tool references, so every deferred tool would stay unreachable until the next turn relaunches the session with tool search off. A search already routed to a client that then leaves keeps the failure Agent Host publishes for it, so chat state and the model agree; the next search has no client and takes the fallback.
The two identity/count levers are independent: deferThreshold is a total tool-count gate (1 ⇒ always active), while each tool's defer flag decides whether that tool is deferred.
Deferred is the default. A server tool without deferLoading becomes defer: 'auto' (only an explicit false is eager), but on models without tool search every tool is eager, so each eager tool is a per-request token cost for every session. The reviewed eager sets are pinned by test/node/serverToolGroups.test.ts, test/node/toolSearchDeferral.test.ts and the prompt snapshot suite; the rules for earning an eager slot, for SDK bumps, and for where prompt text and reminders may live are in ../../../AGENTS.md §9. Do not add a tool_instructions line to advertise a tool: the runtime's deferred-tools reminder already lists it, and a line is paid for by every session that has the tool.
This B-inject bridge is intentionally interim. A follow-up moves tool-search registration and ranking into VS Code core so Agent Host no longer depends on the Copilot extension's tool implementation or embeddings plumbing.
Lever 2 — per-model contributor (promptRegistry.ts + allPrompts.ts)
Guidance scoped to a model or family. Implement IAgentHostPrompt and register it. Use anthropicPrompt.ts as the template.
A contributor provides EITHER:
resolveSectionOverrides→{ mode: 'customize' }— overrides named sections, keeps the SDK foundation prompt and its guardrails. Prefer this. The default sections are composed underneath, so there's no need to re-state the identity.resolveFullSystemPrompt→{ mode: 'replace' }— owns the entire prompt body and drops all SDK guardrails (including safety). Only for callers that truly own the whole prompt. The registry still appends the universal layers (tool instructions, workspaceless guidance, file-link contract) after the replacement content.
class MyModelPrompt implements IAgentHostPrompt {
static readonly familyPrefixes = ['my-model']; // or implement static matchesModel(model)
resolveSectionOverrides(model: ModelSelection, context: IAgentHostPromptContext) {
// Gate on host settings; return undefined to fall back to the default message.
return context.getSetting(CopilotCliConfigKey.SomeFlag) === true
? { tool_instructions: { action: 'append', content: '\nFor this model, batch independent tool calls.' } }
: undefined;
}
}
agentHostPromptRegistry.registerPrompt(MyModelPrompt); // then add `import './myModelPrompt.js'` to allPrompts.tsMatching: a contributor matches a model by static matchesModel(model) (takes precedence) or by familyPrefixes (model-id startsWith). The registry resolves exactly one contributor per model (first match wins) — base + version layering is a known follow-up.
This branch's OpenAI contributor is unconditional for GPT families, legacy o1/o3/o4 families, and the openai family alias; it has no setting. GPT and openai matching follows Copilot Chat's isOpenAIModel family conventions, case-insensitively. Agent Host has a model ID rather than endpoint-provider metadata; a custom model ID can use the existing family override to route through a known OpenAI family. The experiment is isolated to the branch and tracked in microsoft/vscode-internalbacklog#9579. It discourages automatic post-edit rereads and full-diff reviews, but preserves targeted reads for failed checks, ambiguous tool output, or correctness uncertainty, required validation, and explicitly requested broader reviews. It does not change delegation or non-OpenAI models. Guidance is resolved on session create/resume; existing in-flight sessions keep their launch-time prompt.
Related — per-model experimentation knobs (copilotCliConfig.ts)
chat.agentHost.copilot.modelCapabilityOverrides entries (keyed by model id; '*' matches every model, a specific entry wins field-by-field) carry the experimentation knobs the launcher applies: family (prompt and tool-profile alias, so a preview model resolves through another family's contributor), reasoningEffort (wins over the model picker's effort level; set it on the '*' entry to pin every model, re-applied on session resume and mid-session model change), availableTools/excludedTools (SDK tool filters; applied on launch and resume, but not on a mid-session model change — and enforced against every SDK-registered tool, including the host's shell and server tools, not just the forwarded client tools), modelCapabilities (per-property overrides passed through to the SDK's modelCapabilities field — e.g. vision support, token limits — applied on every launch and resume), and promptOverrideString/promptOverrideFile (YAML system-prompt and tool-description overrides, applied on launch and resume).
family is host-side only: it selects the prompt contributor and the tool-search capability gate, and the model id sent to the runtime is unchanged, so the session still runs on the selected model. That is the point — a preview model can be evaluated against a known family's prompt and tool profile while still hitting its own endpoint.
The runtime keeps its own per-model config (system-prompt parts, capabilities, reasoning-effort profile) keyed off the model id it receives, so an aliased session gets the real model's runtime config with the family's host overrides layered on top. Aliasing the runtime's half too would need COPILOT_MODEL_FAMILY, which is process-scoped and would leak across every session in the window.
Security note. The setting is application-scoped (not workspace-configurable) and forwarded to the agent host.
promptOverrideStringandpromptOverrideFiledeliberately carry prompt content and a host-local file path for debugging and evaluation; do not add other prompt or filesystem inputs to this setting without an explicit security review. Code-managed prompt experiments should still use a contributor (Lever 2) gated on its own opt-in setting.
Reference
- Modes (
SystemMessageConfig.mode):append(foundation + text, default),customize(override named sections),replace(own the whole prompt, no guardrails). - Sections (
SystemMessageSection):preamble,identity,tone,tool_efficiency,environment_context,code_change_rules,guidelines,safety,tool_instructions,custom_instructions,runtime_instructions,last_instructions. - Override actions (
SectionOverride.action):replace,append,prepend,remove, or a(content: string) => stringtransform.
Gotchas
- Empty overrides = no override.
resolveSectionOverridesreturning{}(orundefined) falls back to the default message — equivalent to composing nothing over the defaults, kept explicit to avoid pointless object churn. - Don't mutate the shared default.
COPILOT_AGENT_HOST_SYSTEM_MESSAGEis a shared constant; layering spreads into a fresh object, preserving any other customize-mode fields (e.g.content). Keep it that way. - Spacing is relative to the foundation.
composeToolInstructionspads by action (appendleads with\n,prependtrails with\n,replaceowns the section). When writing a section'scontentby hand, a leading\nkeeps appended text off the foundation's last line. - Observability. The launcher logs
describeSystemMessageConfig(...)atinfo(mode + overridden sections) and the full config attrace. Keep new config shapes summarizable there. - Tests.
../../../test/node/agentHostPromptRegistry.test.tscovers the registry/wiring;../../../test/node/toolInstructions.test.tscovers the composition/gating. Add cases there, not new harnesses.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

