customizations-in-the-agent-host
БесплатноБез исполняемых скриптовНе проверенArchitecture and hard-won debugging lessons for customization enablement (plugins, MCP servers, agents, skills, instructions) in the agent host. Use when…
от posit-dev★ 4 361 звезда на GitHubОб этом скилле
Customizations in the Agent Host
Customizations are the plugins, MCP servers, agents, skills and instructions that an agent-host session exposes to a model. This skill covers enablement: how a customization's on/off state is decided, stored, published and enforced.
Read this before changing anything in:
src/vs/platform/agentHost/node/agentHostCustomizationEnablementService.tssrc/vs/platform/agentHost/node/shared/customizationEnablementGate.tssrc/vs/platform/agentHost/common/customizationEnablement.ts- the per-provider customization paths under
node/copilot/,node/claude/,node/codex/
The mental model
Enablement is a list of scoped decisions, not a boolean
A plugin or MCP server carries enablement?: CustomizationEnablement[] — an ordered list of decisions, most specific first:
| Kind | Owner | Meaning |
|---|---|---|
Session |
agent host | this session only |
Workspace |
agent host | this working directory (carries uri) |
Global |
client, unless the host discovered it | everywhere |
isCustomizationEnabled() picks the first entry; absent entries inherit from the next scope out, and an absent list means enabled. Never re-add a parallel enabled boolean to plugins or MCP servers — a second source of truth is what this design exists to remove. (DirectoryCustomization legitimately keeps a plain enabled; consumers derive its state through isCustomizationEnabled() all the same.)
Who owns Global
The host owns Global for anything it discovered, even when that thing lives inside a plugin the client forwarded. The client owns Global only for what it actually bundled. The discriminator is childEnablement — not clientId. A plugin whose childEnablement record has a key for a child MCP server means "the client bundled this child and owns its global decision"; anything else the host discovered by parsing the plugin directory.
The overlay model
This is the single most important invariant, and getting it wrong caused a self-defeating write that silently erased user decisions:
The client's value is the base. Host decisions layer on top. "Store only what differs" compares against that base — never against a hardcoded
true.
Concretely, in agentHostCustomizationEnablementService.ts:
_clientGlobalEnablementis the in-memory base, per session._setClientGlobalwrites here and must never touch_persistent._persistentholds only host-owned decisions that differ from the base.- Inheritance runs host → base →
DEFAULT_CUSTOMIZATION_ENABLED(_globalEnablement,_workspaceInheritedEnablement). _setPersistentDecisiondeletes a decision that matches its inherited value, so the UI can restore inheritance without a third "Inherit" action.
Keeping these separate is what stops this loop: replaceEnablement → synchronous republish → client's stale [{global,true}] → _setClientGlobal → "store only what differs" deletes the entry just written.
Identity must not depend on tree position
An MCP server's storage key is derived from owningPluginUri, never from where it happened to appear in the published tree. The same server discovered top-level (mcpServers#azure) and nested under a plugin (<pluginURI>#mcp=azure) must produce one key, or a decision written in one session is invisible to the next. targetForMcpServer() and withOwningPluginUri() in the gate are the only supported way to build that target.
Pending means fail closed — but pending must be transient
resolve() returns {kind:'pending'} when the session isn't initialized yet (reason: 'session') or the working directory isn't known (reason: 'workingDirectory'). resolveCustomizationEnablement() records those in pendingCustomizationIds, and isCustomizationSdkEligible() makes SDK-boundary consumers fail closed.
Two rules follow:
- Never "fix" a pending customization by defaulting it to enabled.
- Never cache the pending verdict. Pending is a temporary state; recompute it, and republish when the enablement service settles. A cached
pendingEnablement: truesilently drops a plugin forever.
A pending child MCP server also marks its containing plugin pending, because a plugin directory can cause the SDK to discover the child on its own.
The rule that prevents most bugs
Every publication, emit and SDK-handoff path must go through resolution.
Three separate production bugs on this feature came from paths that skipped it (four sites in copilotAgent, one in mcpCustomizationController, plus the post-startup reconcile). When you add a new place that publishes a customization or hands one to a provider, route it through resolveCustomizationEnablement() — do not read a stored snapshot.
The corollary: state computed once must be rebuilt when its inputs change. Merged per-client enablement maps that are only appended to will leak stale decisions onto a newly parsed plugin with the sa
Установить customizations-in-the-agent-host в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл customizations-in-the-agent-host?
Architecture and hard-won debugging lessons for customization enablement (plugins, MCP servers, agents, skills, instructions) in the agent host. Use when changing how customizations are discovered, published, enabled/disabled, or handed to a provider SDK; when a customization shows the wrong enabled state in the UI; or when a disabled MCP server or plugin is still reaching the model.
Как установить скилл customizations-in-the-agent-host?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл customizations-in-the-agent-host запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic