You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bundle two query-author-facing custom agents as part of the extensions/vscode/ VSIX so users get a turnkey, named-agent experience the moment the extension is installed — no repo .github/agents/*.md files required. Mirror the user-provided-dir paradigm from #2 (--prompts-dir) so teams can override or extend with their own .agent.md / .prompt.md / SKILL.md files at both packaging time and runtime.
This complements (does not replace) the existing repo-local .github/agents/*.md files used by maintainers of this MCP server.
Why
Repo-local .github/agents/*.md files are not portable — they only exist for users working inside the codeql-development-mcp-server checkout. End users who install the VSIX into their own CodeQL workspace currently see the ql-mcp/* MCP tools but get no curated agent personas, slash-command prompts, or skills out of the box. Shipping these as VSIX content closes that gap and aligns with VS Code's documented chatPromptFiles / chatSkills contribution points and the chat.agentFilesLocations mechanism for .agent.md files.
Implementation methodology: TDD (mandatory)
Implementation must follow test-driven development. The highest-value tests for this work are extension-level integration tests that exercise the activated VSIX inside a real VS Code instance — write these first, watch them fail, then implement until they pass.
Primary suite — @vscode/test-electron integration tests in extensions/vscode/test/integration/:
Activate the extension in a temp workspace and assert:
The bundled agents/ directory is registered with VS Code (present in the effective chat.agentFilesLocations value).
The two shipped .agent.md files are discoverable from context.extensionPath.
Contributed prompt files and skills (per package.jsonchatPromptFiles / chatSkills) are visible to chat APIs (best-effort via vscode.lm / file probes).
Toggling codeql-mcp.agents.enabled = false removes the registered directory; re-enabling restores it.
Adding a path to codeql-mcp.additionalAgentDirs appends it to chat.agentFilesLocations.
Deactivation cleans up registrations idempotently (no stale entries on re-activate).
The new codeql-mcp.showAgentsStatus command runs and reports bundled + extra paths.
These are the tests we trust most. They must be the primary acceptance gate.
Secondary — Vitest unit tests in extensions/vscode/test/customizations/:
Tertiary — packaging smoke tests: npm run package succeeds; resulting .vsix contains agents/, prompts/, skills/ but not the customizations/ source dir.
Workflow per phase: red (integration test asserting the missing behavior) → green (minimal implementation) → refactor. Do not advance to the next phase until the integration tests for the current phase pass.
Model choice — user-controlled, never forced
Neither shipped .agent.md file may set a model: frontmatter key. Agent behavior must respect whichever model the user selects in the chat model picker (Claude Sonnet, GPT, etc.). Likewise, no code path may default to or coerce a specific model. This is a non-negotiable design requirement: do not copy the model: Claude Opus 4.6 (...) line that appears in the repo-local .github/agents/*.md files.
If a model recommendation is helpful, surface it only in human-readable docs (README), never in agent frontmatter or runtime configuration.
Scope decisions (confirmed)
Ship two agents only (renamed, codeql-* prefix):
codeql-query-developer (derived from mcp-enabled-ql-query-developer)
codeql-workshop-author (derived from mcp-enabled-ql-workshop-developer)
Out of scope to ship (stay repo-internal in .github/agents/): ql-mcp-tool-developer, ql-mcp-tool-tester, ql-agent-skills-developer.
All five existing .github/agents/*.md files stay untouched.
Prompts + skills are in scope: contribute via documented contributes.chatPromptFiles and contributes.chatSkills.
Hybrid registration for agents: bundle in VSIX + programmatically add to chat.agentFilesLocations (no documented chatAgents contribution point exists as of 2026-05; try one speculatively, fall back to programmatic).
User extensibility: build-time overlay (npm run package -- --customizations-dir=…) and runtime setting codeql-mcp.additionalAgentDirs.
Architecture (3 layers)
1. Build-time bundling
New script extensions/vscode/scripts/bundle-customizations.js:
Copies "source of truth" agent files from a new tracked dir extensions/vscode/customizations/agents/ → packaged agents/.
Copies a whitelisted subset of ../../server/src/prompts/*.prompt.md → packaged prompts/.
Copies a whitelisted subset of ../../.github/skills/*/SKILL.md (starting with create-codeql-query-tdd-generic, create-codeql-query-development-workshop, validate-ql-mcp-server-tools-queries) → packaged skills/<name>/SKILL.md.
Optional overlay: --customizations-dir <path> (or env CODEQL_MCP_CUSTOMIZATIONS_DIR) copies <path>/{agents,prompts,skills} over the bundled files (collision → warn + replace).
Emits dist-customizations-manifest.json listing all bundled files (consumed by package.json contribution generation + runtime checks + tests).
Whitelist config lives at customizations/bundle-customizations.config.js.
Wired into vscode:prepublish after bundle:server.
.vscodeignore excludes the customizations/ source dir; only generated agents/, prompts/, skills/ ship in the VSIX.
clean script removes the generated output dirs.
2. package.json contribution points
Add contributes.chatPromptFiles[] — one entry per packaged prompt file (auto-generated from the manifest).
Add contributes.chatSkills[] — one entry per packaged SKILL.md.
New extensions/vscode/src/customizations/agent-registrar.ts:
On activation, computes the bundled agents/ absolute path from context.extensionUri.
Reads current chat.agentFilesLocations, appends (1) the bundled dir and (2) any additionalAgentDirs, using ConfigurationTarget.Workspace only when a workspace is open, otherwise Global. Path comparison is cross-platform normalized before adding.
Idempotent; removes its own entries on deactivation.
Re-fires on onDidChangeConfiguration('codeql-mcp.agents') and onDidChangeWorkspaceFolders.
Defensive: try/catch with warn-level log; never blocks activation.
Wired into src/extension.tsactivate() alongside the existing McpProvider registration; disposed via the existing disposables[] pattern.
Shipped agent definitions
Both .agent.md files use VS Code custom-agent frontmatter. Slimmed from the existing repo versions for portability:
Document the runtime alternative (codeql-mcp.additionalAgentDirs).
Phase E — Docs, changelog (final polish)
Update extensions/vscode/README.md: "Built-in Custom Agents" section (list the two agents, where they appear, how to disable, how to extend, no specific model required).
@vscode/test-electron integration tests cover all behaviors in §Implementation methodology and pass green.
Vitest unit tests for bundler overlay semantics and agent registrar pass green.
npm run package --workspace=extensions/vscode succeeds and produces a VSIX containing agents/codeql-query-developer.agent.md, agents/codeql-workshop-author.agent.md, the whitelisted prompt + skill files, with customizations/ source dir absent.
npm run package --workspace=extensions/vscode -- --customizations-dir=./examples/team-customizations produces a VSIX where overlay files replace defaults with collision warnings printed.
npm run lint --workspace=extensions/vscode passes.
Neither shipped .agent.md contains a model: key, and no code path forces a specific model.
Manual smoke: install the VSIX in a fresh VS Code profile, open a workspace, run Chat: Open Customizations — both agents appear as "extension-contributed"; switching to codeql-query-developer and invoking a contributed slash command works; toggling codeql-mcp.agents.enabled to false removes them; setting codeql-mcp.additionalAgentDirs to a temp dir surfaces user files.
codeql-mcp.showAgentsStatus command prints bundled + extra paths.
extensions/vscode/README.md and CHANGELOG.md updated.
All five .github/agents/*.md files in this repo remain unchanged.
Out of scope (track separately)
Renaming or removing repo-local .github/agents/*.md files.
Runtime merging of additionalPromptDirs / additionalSkillDirs (documented contribution points are static — follow-up issue mirroring this design).
A vscode.chat.createChatParticipant-based @codeql chat participant (a different mechanism from custom agents — consider in a separate issue).
Open considerations
contributes.chatAgents availability — not in the published 2026-05 Contribution Points reference. Recommendation: try-then-fallback. If proposed APIs require enabledApiProposals, decide whether to gate behind that or stay programmatic-only.
Skill curation — start with three (create-codeql-query-tdd-generic, create-codeql-query-development-workshop, validate-ql-mcp-server-tools-queries); expand based on user feedback.
Summary
Bundle two query-author-facing custom agents as part of the
extensions/vscode/VSIX so users get a turnkey, named-agent experience the moment the extension is installed — no repo.github/agents/*.mdfiles required. Mirror the user-provided-dir paradigm from #2 (--prompts-dir) so teams can override or extend with their own.agent.md/.prompt.md/SKILL.mdfiles at both packaging time and runtime.This complements (does not replace) the existing repo-local
.github/agents/*.mdfiles used by maintainers of this MCP server.Why
Repo-local
.github/agents/*.mdfiles are not portable — they only exist for users working inside thecodeql-development-mcp-servercheckout. End users who install the VSIX into their own CodeQL workspace currently see theql-mcp/*MCP tools but get no curated agent personas, slash-command prompts, or skills out of the box. Shipping these as VSIX content closes that gap and aligns with VS Code's documentedchatPromptFiles/chatSkillscontribution points and thechat.agentFilesLocationsmechanism for.agent.mdfiles.Implementation methodology: TDD (mandatory)
Implementation must follow test-driven development. The highest-value tests for this work are extension-level integration tests that exercise the activated VSIX inside a real VS Code instance — write these first, watch them fail, then implement until they pass.
@vscode/test-electronintegration tests inextensions/vscode/test/integration/:agents/directory is registered with VS Code (present in the effectivechat.agentFilesLocationsvalue)..agent.mdfiles are discoverable fromcontext.extensionPath.package.jsonchatPromptFiles/chatSkills) are visible to chat APIs (best-effort viavscode.lm/ file probes).codeql-mcp.agents.enabled = falseremoves the registered directory; re-enabling restores it.codeql-mcp.additionalAgentDirsappends it tochat.agentFilesLocations.codeql-mcp.showAgentsStatuscommand runs and reports bundled + extra paths.extensions/vscode/test/customizations/:bundle-customizations.test.ts— overlay semantics, collision warnings, manifest output.agent-registrar.test.ts— mockedvscode.workspace.getConfiguration, ConfigurationTarget choice, cross-platform path normalization, dedupe, idempotency.npm run packagesucceeds; resulting.vsixcontainsagents/,prompts/,skills/but not thecustomizations/source dir.Workflow per phase: red (integration test asserting the missing behavior) → green (minimal implementation) → refactor. Do not advance to the next phase until the integration tests for the current phase pass.
Model choice — user-controlled, never forced
Neither shipped
.agent.mdfile may set amodel:frontmatter key. Agent behavior must respect whichever model the user selects in the chat model picker (Claude Sonnet, GPT, etc.). Likewise, no code path may default to or coerce a specific model. This is a non-negotiable design requirement: do not copy themodel: Claude Opus 4.6 (...)line that appears in the repo-local.github/agents/*.mdfiles.If a model recommendation is helpful, surface it only in human-readable docs (README), never in agent frontmatter or runtime configuration.
Scope decisions (confirmed)
codeql-*prefix):codeql-query-developer(derived frommcp-enabled-ql-query-developer)codeql-workshop-author(derived frommcp-enabled-ql-workshop-developer).github/agents/):ql-mcp-tool-developer,ql-mcp-tool-tester,ql-agent-skills-developer..github/agents/*.mdfiles stay untouched.contributes.chatPromptFilesandcontributes.chatSkills.chat.agentFilesLocations(no documentedchatAgentscontribution point exists as of 2026-05; try one speculatively, fall back to programmatic).npm run package -- --customizations-dir=…) and runtime settingcodeql-mcp.additionalAgentDirs.Architecture (3 layers)
1. Build-time bundling
New script
extensions/vscode/scripts/bundle-customizations.js:extensions/vscode/customizations/agents/→ packagedagents/.../../server/src/prompts/*.prompt.md→ packagedprompts/.../../.github/skills/*/SKILL.md(starting withcreate-codeql-query-tdd-generic,create-codeql-query-development-workshop,validate-ql-mcp-server-tools-queries) → packagedskills/<name>/SKILL.md.--customizations-dir <path>(or envCODEQL_MCP_CUSTOMIZATIONS_DIR) copies<path>/{agents,prompts,skills}over the bundled files (collision → warn + replace).dist-customizations-manifest.jsonlisting all bundled files (consumed bypackage.jsoncontribution generation + runtime checks + tests).customizations/bundle-customizations.config.js.vscode:prepublishafterbundle:server..vscodeignoreexcludes thecustomizations/source dir; only generatedagents/,prompts/,skills/ship in the VSIX.cleanscript removes the generated output dirs.2.
package.jsoncontribution pointscontributes.chatPromptFiles[]— one entry per packaged prompt file (auto-generated from the manifest).contributes.chatSkills[]— one entry per packagedSKILL.md.contributes.chatAgents[]if/when supported; remove if vsce package validation rejects.codeql-mcp:codeql-mcp.agents.enabled(boolean, defaulttrue)codeql-mcp.additionalAgentDirs(string[], default[])codeql-mcp.showAgentsStatus.3. Runtime agent registration
New
extensions/vscode/src/customizations/agent-registrar.ts:agents/absolute path fromcontext.extensionUri.chat.agentFilesLocations, appends (1) the bundled dir and (2) anyadditionalAgentDirs, usingConfigurationTarget.Workspaceonly when a workspace is open, otherwiseGlobal. Path comparison is cross-platform normalized before adding.onDidChangeConfiguration('codeql-mcp.agents')andonDidChangeWorkspaceFolders.src/extension.tsactivate()alongside the existingMcpProviderregistration; disposed via the existingdisposables[]pattern.Shipped agent definitions
Both
.agent.mdfiles use VS Code custom-agent frontmatter. Slimmed from the existing repo versions for portability:customizations/agents/codeql-query-developer.agent.mddescription: "Develop CodeQL queries, libraries, and tests with TDD via the ql-mcp server."tools:['ql-mcp/*', 'edit', 'read', 'search', 'todo']model:key (user-controlled).customizations/agents/codeql-workshop-author.agent.mddescription: "Create CodeQL query development workshops from production-grade queries."tools:['ql-mcp/*', 'edit', 'read', 'search', 'todo']model:key (user-controlled).codeql-query-developer(label "Develop and Test Query"). No reverse handoff (avoid loops).Phased plan (TDD throughout)
Each phase begins by writing failing integration tests, then implementation, then refactor.
Phase A — Bundling pipeline (foundation)
customizations/absent).extensions/vscode/customizations/with the two.agent.mdfiles (nomodel:key) andbundle-customizations.config.jswhitelist.scripts/bundle-customizations.jswith overlay support + manifest output.bundle:customizationsintovscode:prepublish; update.vscodeignoreandclean.Phase B — Contribution points (declarative wiring) — depends on A
chatPromptFiles+chatSkillsarrays topackage.json(generated from the manifest).contributes.configuration/contributes.commands.contributes.chatAgentsspeculatively; remove if rejected by vsce.Phase C — Runtime agent registration — parallel with B
chat.agentFilesLocationsregistration, toggle behavior,additionalAgentDirs, idempotent deactivation, andshowAgentsStatus.src/customizations/agent-registrar.ts.src/extension.ts; register thecodeql-mcp.showAgentsStatuscommand.Phase D — User-overlay packaging story — depends on A, B, C
--customizations-diroverlay path (collision warnings, override precedence).extensions/vscode/README.md.extensions/vscode/examples/team-customizations/showing override + add-new patterns.codeql-mcp.additionalAgentDirs).Phase E — Docs, changelog (final polish)
extensions/vscode/README.md: "Built-in Custom Agents" section (list the two agents, where they appear, how to disable, how to extend, no specific model required).CHANGELOG.mdUnreleasedper.github/instructions/changelog_md.instructions.md.Relevant files
Modify
extensions/vscode/package.json— settings, contribution points, scripts.extensions/vscode/src/extension.ts— wire the new agent registrar.extensions/vscode/.vscodeignore— excludecustomizations/source dir.extensions/vscode/README.md— new "Built-in Custom Agents" section.CHANGELOG.md— Unreleased entry.New
extensions/vscode/customizations/agents/codeql-query-developer.agent.mdextensions/vscode/customizations/agents/codeql-workshop-author.agent.mdextensions/vscode/customizations/bundle-customizations.config.jsextensions/vscode/scripts/bundle-customizations.jsextensions/vscode/src/customizations/agent-registrar.tsextensions/vscode/test/customizations/bundle-customizations.test.tsextensions/vscode/test/customizations/agent-registrar.test.tsextensions/vscode/test/integration/agents.integration.test.ts(primary suite)extensions/vscode/examples/team-customizations/(sample overlay)Reference (read-only — do not modify)
.github/agents/*.mdserver/src/prompts/*.prompt.md.github/skills/*/SKILL.mdextensions/vscode/scripts/bundle-server.js(sibling pattern reference)Acceptance criteria
@vscode/test-electronintegration tests cover all behaviors in §Implementation methodology and pass green.npm run package --workspace=extensions/vscodesucceeds and produces a VSIX containingagents/codeql-query-developer.agent.md,agents/codeql-workshop-author.agent.md, the whitelisted prompt + skill files, withcustomizations/source dir absent.npm run package --workspace=extensions/vscode -- --customizations-dir=./examples/team-customizationsproduces a VSIX where overlay files replace defaults with collision warnings printed.npm run lint --workspace=extensions/vscodepasses..agent.mdcontains amodel:key, and no code path forces a specific model.Chat: Open Customizations— both agents appear as "extension-contributed"; switching tocodeql-query-developerand invoking a contributed slash command works; togglingcodeql-mcp.agents.enabledtofalseremoves them; settingcodeql-mcp.additionalAgentDirsto a temp dir surfaces user files.codeql-mcp.showAgentsStatuscommand prints bundled + extra paths.extensions/vscode/README.mdandCHANGELOG.mdupdated..github/agents/*.mdfiles in this repo remain unchanged.Out of scope (track separately)
.github/agents/*.mdfiles.*.prompt.mdfiles #2 already provides--prompts-dir).additionalPromptDirs/additionalSkillDirs(documented contribution points are static — follow-up issue mirroring this design).vscode.chat.createChatParticipant-based@codeqlchat participant (a different mechanism from custom agents — consider in a separate issue).Open considerations
contributes.chatAgentsavailability — not in the published 2026-05 Contribution Points reference. Recommendation: try-then-fallback. If proposed APIs requireenabledApiProposals, decide whether to gate behind that or stay programmatic-only.create-codeql-query-tdd-generic,create-codeql-query-development-workshop,validate-ql-mcp-server-tools-queries); expand based on user feedback.References
chatInstructions,chatPromptFiles,chatSkillsdocumented;chatAgentsnot yet)*.prompt.mdfiles #2 (--prompts-diruser extensibility for MCP server prompts)