agent-host-chat-contributions
БесплатноБез исполняемых скриптовНе проверенBuild and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context…
от posit-dev★ 4 361 звезда на GitHubОб этом скилле
Agent Host Chat Contributions
Use the contribution model for a self-contained behavior that crosses an agent-host chat lifecycle boundary. Read these files before changing the model:
src/vs/platform/agentHost/common/agentHostChatContributionsService.tssrc/vs/platform/agentHost/node/agentHostChatContributionsService.tssrc/vs/platform/agentHost/node/chatContributions/TODO.mdsrc/vs/platform/agentHost/node/chatContributions/builtInChatContributions.ts
The rule that prevents the old failure mode
New cross-cutting features go in contributions, not in
AgentSideEffectsorAgentService.
AgentSideEffects has shed well over 700 lines by extracting seventeen behaviors. Do not put another lifecycle side effect, outgoing-prompt addition, restored-turn enrichment, admission check, or action observer back into either large orchestration class. AgentSideEffects dispatches the lifecycle and retains routing and send mechanics; AgentService owns session lifecycle and invokes hydration and memento eviction. See agentSideEffects.ts and agentService.ts.
This is also a review rule: code added to either file needs a specific reason that it is routing, a correctness invariant, provider-shaped behavior, or a dispatcher call site. "It was convenient to add here" is not a reason.
Decide before you code
Write a contribution when the behavior answers yes to this test:
- Does it react to a lifecycle moment the hooks already name — a turn request asking to proceed, a completed turn, a dispatched action, a turn about to be sent, a restored turn list, or a chat being restored?
- Can an explicitly registered, dependency-injected unit own it without changing protocol routing or provider mapping?
- Does it compose with other behavior in a defined order?
Examples are admission gating, local-command interception, checkpoint and changeset work, queue draining, GitHub-reference attachment, title handling, persisted usage, session input-needed aggregation, session flag persistence, chat drafts, a chat's own config, worktree announcements, unread state, rich-link guidance, and chat-surface guidance. Their directories under node/chatContributions/ are the reference implementations.
Do not use a contribution for the following:
- Subagent signal routing and buffering in
node/agentSideEffects.tsare routing fabric and correctness invariants. - Turn-id remapping in
node/agentSideEffects.tsis also routing fabric. - The three SDK event mappers and three attachment serializers are provider-shaped.
- Provider-shaped overlays applied during restore, such as seeding a draft's model from
IAgent-supplied session metadata in_doRestoreSession. Moving one would push provider metadata intoIHydrationContextfor one consumer.
If the answer is "this must route every signal correctly before state changes" or "this differs by SDK," it is not a contribution. Open work and standing caveats are tracked in node/chatContributions/TODO.md.
Keep the hook surface small
IAgentHostChatContribution has seven hooks in common/agentHostChatContributionsService.ts. Only add another method when no existing payload can express the behavior.
The set was once reduced from six to four:
onTurnConsumablebecameonTurnEndwithTurnEndReason.kind === 'localCommand'.onUserMessagebecameonOutgoingTurn.
Prefer adding a discriminant or payload to an existing type, such as a new TurnEndReason variant, over adding a hook. A proposed single-purpose hook with one caller and one implementer is the smell that produced both removals. Do not create an abstraction merely to move one direct call.
The three hooks added since clear a specific bar: no existing payload could express them because they fire at a different moment or from a different source, not merely with different data.
onHydrateChatrestores host-owned chat state before a chat enters the catalog.onHydrateTurnsruns lazily, after a provider returns turns, so reusing it would leave a restored peer chat untitled until it was opened.onIncomingRequestgates a turn before it reaches a provider, and can reject it. No observer hook can refuse.onDidDispatchActionobserves server-dispatched and rejected actions, whichonDidApplyClientActionstructurally cannot see.
Adding a { kind: ... } discriminant to an existing hook was considered and rejected for onHydrateChat: the discriminant guidance covers payload variants within one moment, the way TurnEndReason discriminates outcomes of a single turn ending.
Anatomy and registration
Give every contribution its own directory under node/chatContributions/<feature>/. It owns its implementation, helpers, and tests as it grows. A contribution must have:
static readonly id, unique across registrations.- An explicit
order, even when it currently appears independent. - A constructor whose first parameter is
IAgentHostChatContributionContext, followed by in
Установить agent-host-chat-contributions в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл agent-host-chat-contributions?
Build and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context injection, restored-history transformation, protocol-action observation, or when reviewing changes that add code to AgentSideEffects or AgentService.
Как установить скилл agent-host-chat-contributions?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл agent-host-chat-contributions запускает скрипты?
Нет, скилл состоит только из инструкций (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