Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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.ts
  • src/vs/platform/agentHost/node/agentHostChatContributionsService.ts
  • src/vs/platform/agentHost/node/chatContributions/TODO.md
  • src/vs/platform/agentHost/node/chatContributions/builtInChatContributions.ts

The rule that prevents the old failure mode

New cross-cutting features go in contributions, not in AgentSideEffects or AgentService.

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:

  1. 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?
  2. Can an explicitly registered, dependency-injected unit own it without changing protocol routing or provider mapping?
  3. 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.ts are routing fabric and correctness invariants.
  • Turn-id remapping in node/agentSideEffects.ts is 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 into IHydrationContext for 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:

  • onTurnConsumable became onTurnEnd with TurnEndReason.kind === 'localCommand'.
  • onUserMessage became onOutgoingTurn.

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.

  • onHydrateChat restores host-owned chat state before a chat enters the catalog. onHydrateTurns runs lazily, after a provider returns turns, so reusing it would leave a restored peer chat untitled until it was opened.
  • onIncomingRequest gates a turn before it reaches a provider, and can reject it. No observer hook can refuse.
  • onDidDispatchAction observes server-dispatched and rejected actions, which onDidApplyClientAction structurally 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
Полный SKILL.md на GitHub

Установить 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), без исполняемых скриптов.

Похожие скиллы

Сравнить agent-host-chat-contributions с