agent-host-chat-contributions

Implement and review cross-cutting agent-host chat behavior through lifecycle contribution hooks.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/jimeh/hucode --skill agent-host-chat-contributions-jimeh
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: agent-host-chat-contributions
Source: https://github.com/jimeh/hucode/tree/main/.github/skills/agent-host-chat-contributions
Command: npx skills add https://github.com/jimeh/hucode --skill agent-host-chat-contributions-jimeh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Cross-cutting chat behaviors like admission gating, checkpoint capture, and title handling tend to accumulate inside large orchestration classes such as AgentSideEffects and AgentService, making them hard to maintain and review. This Skill guides you to build each behavior as an explicitly registered, dependency-injected contribution with defined ordering and failure isolation. ## Core Features & Use Cases - Contribution Model Guidance: Decide whether a behavior belongs in a contribution using a three-question test, and learn which behaviors (routing fabric, provider-shaped mappers) must stay out. - Seven Lifecycle Hooks: Implement onIncomingRequest, onTurnEnd, onDidApplyClientAction, onDidDispatchAction, onOutgoingTurn, onHydrateTurns, and onHydrateChat with correct ordering, memento lifecycle, and failure-isolation semantics. - Review Rules: Apply concrete criteria when reviewing changes that add code to AgentSideEffects or AgentService, including the fail-closed synchronous admission gate and built-in-sequence regression tests. - Use Case: When adding a feature that reacts to a completed turn, create a new directory under node/chatContributions/, implement the hook with a unique id and explicit order, register it in builtInChatContributions.ts, and add dispatcher tests. ## Quick Start Ask the agent to add a new chat contribution that reacts to completed turns, following the contribution model in this Skill.

Frequently Asked Questions about agent-host-chat-contributions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new agent-host chat contribution?▼

Create a directory under node/chatContributions/<feature>/ containing a class with a static readonly id, an explicit order, and a constructor taking IAgentHostChatContributionContext first. Register it once in builtInChatContributions.ts via contributions.registerContribution.

When should behavior go in a contribution versus AgentSideEffects?▼

Use a contribution when the behavior reacts to a named lifecycle moment, can be owned by an injected unit without changing routing, and composes in a defined order. Routing fabric like subagent signal buffering and provider-shaped SDK mappers stay in AgentSideEffects.

What are the seven chat contribution lifecycle hooks?▼

The hooks are onIncomingRequest, onTurnEnd, onDidApplyClientAction, onDidDispatchAction, onOutgoingTurn, onHydrateTurns, and onHydrateChat. Each fires at a distinct lifecycle moment with specific constraints on ordering, failure handling, and payload access.

Why does onIncomingRequest fail closed while other hooks isolate failures?▼

onIncomingRequest is a synchronous admission gate, so a throw rejects the request with internalError rather than letting it proceed. Observer and hydration hooks isolate failures because losing one enrichment is preferable to losing chat history or blocking the send.

How does contribution ordering work in the dispatcher?▼

The dispatcher sorts contributions by their explicit order value, lower first, with registration order breaking ties. Ordering is per hook and load-bearing, so built-in-sequence regression tests in chatContributions.test.ts protect the intended sequences.

When should I not add a new hook to the contribution interface?▼

Avoid new hooks when an existing payload can express the behavior, such as adding a discriminant to TurnEndReason. A single-purpose hook with one caller and one implementer is a known anti-pattern that previously caused hook removals.