agent-host-chat-contributions

Implement cross-cutting agent-host chat lifecycle behavior through registered contribution classes.

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

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 implement such behavior as self-contained, dependency-injected lifecycle contributions instead. ## Core Features & Use Cases - Contribution Model Guidance: Explains the seven lifecycle hooks (onIncomingRequest, onTurnEnd, onDidApplyClientAction, onDidDispatchAction, onOutgoingTurn, onHydrateTurns, onHydrateChat) and when each applies. - Architecture Decision Rules: Provides a decision test for whether behavior belongs in a contribution versus routing fabric or provider-shaped code in AgentSideEffects or AgentService. - Ordering, Mementos, and Failure Isolation: Documents load-bearing hook ordering, memento lifecycle and eviction, and the fail-closed semantics of onIncomingRequest. - Use Case: When adding a feature that reacts to a completed turn, injects prompt context before a send, or transforms restored chat history, use this Skill to create a properly registered, ordered, and tested contribution under node/chatContributions/. ## Quick Start Ask the agent to add a new chat lifecycle behavior, such as attaching metadata on turn end, as a contribution following the agent-host-chat-contributions model.

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 chat lifecycle behavior to the agent host?▼

Create a class implementing IAgentHostChatContribution with a unique static id and explicit order, place it in its own directory under node/chatContributions/, and register it once in builtInChatContributions.ts. Do not add the behavior to AgentSideEffects or AgentService.

When should code 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, and composes in a defined order. Routing fabric like subagent signal routing and turn-id remapping, plus provider-shaped SDK mappers, stay in AgentSideEffects.

What are the seven agent host chat contribution hooks?▼

The hooks are onIncomingRequest, onTurnEnd, onDidApplyClientAction, onDidDispatchAction, onOutgoingTurn, onHydrateTurns, and onHydrateChat. Each fires at a distinct lifecycle moment, from admission gating through send-time injection to restored-history transformation.

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 past a guard. Observer and hydration hooks isolate failures because losing one enrichment is preferable to losing chat history or blocking unrelated contributions.

How do contribution mementos get cleaned up?▼

Chat mementos are evicted when their chat is disposed, and session mementos when their session is disposed. For keys with extra segments, call deleteMemento when the value is no longer needed, since setting it to undefined leaves the map entry alive until disposal.

Why do tests break after extracting behavior into a contribution?▼

Some hand-built test graphs construct AgentSideEffects without calling registerBuiltInChatContributions, so extracted behavior silently stops running. Add the missing registration to mirror production wiring rather than weakening the assertion.