Enriches CrestApps.Core 2.0 AI completion and orchestration contexts via handler pipelines. Covers IAICompletionContextBuilder, IOrchestrationContextBuilder, built-in handlers for profiles, chat interactions, personas, tools, MCP, and error isolation.
Ships in crestapps-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Two handler pipelines prepare every AI request:
| Level | Builder | Handler | Produces |
|---|---|---|---|
| Completion | IAICompletionContextBuilder.BuildAsync(resource, configure, cancellationToken) | IAICompletionContextBuilderHandler | AICompletionContext (deployments, system message, tools, agents, model parameters, data source) |
| Orchestration | IOrchestrationContextBuilder.BuildAsync(resource, configure, cancellationToken) | IOrchestrationContextBuilderHandler | OrchestrationContext (user message, history, documents, SystemMessageBuilder, completion context) |
BuildingAsync on every handler, then the caller's configure delegate, then BuiltAsync on every handler.CancellationToken; orchestration handler methods take an optional one.Resource (AIProfile, ChatInteraction, or your own type) instead of assuming one resource type.| Completion handler | Adds |
|---|---|
AIProfileCompletionContextBuilderHandler | Profile system message, sampling, deployments, prompt templates, tools, agents, chat and utility model parameters; RunningAgentName for an agent profile; the ToolApprovalPolicy from AIToolApprovalSettings |
ChatInteractionCompletionContextBuilderHandler | The same for a ChatInteraction |
AIPersonaCompletionContextBuilderHandler | In BuiltAsync, prepends the linked persona block and stores it under AICompletionContextKeys.Persona (when personas are enabled) |
AIToolInstanceCompletionContextBuilderHandler | ToolInstanceNames from AIToolInstanceMetadata (when tool instances are enabled) |
DataSourceAICompletionContextBuilderHandler | The selected data source id |
McpAICompletionContextBuilderHandler | MCP connection ids (when MCP is enabled) |
Orchestration handlers include CompletionContextOrchestrationHandler (builds the completion context and seeds SystemMessageBuilder), PreemptiveRagOrchestrationHandler, RealtimeRagGuidanceHandler, AIToolExecutionContextOrchestrationHandler, SecurityPromptOrchestrationHandler, plus data source, memory, document, extracted-data, Claude and Copilot handlers from their features. After all orchestration handlers run, the builder flushes SystemMessageBuilder back to CompletionContext.SystemMessage.
using CrestApps.Core.AI.Completions;
using CrestApps.Core.AI.Models;
public sealed class TenantCompletionContextHandler : IAICompletionContextBuilderHandler
{
private readonly ITenantAccessor _tenantAccessor;
public TenantCompletionContextHandler(ITenantAccessor tenantAccessor)
{
_tenantAccessor = tenantAccessor;
}
public Task BuildingAsync(AICompletionContextBuildingContext context)
{
return Task.CompletedTask;
}
public Task BuiltAsync(AICompletionContextBuiltContext context)
{
if (context.Resource is not AIProfile profile || profile.Type == AIProfileType.Agent)
{
return Task.CompletedTask;
}
var tenant = _tenantAccessor.Current;
context.Context.SystemMessage = string.Join(
"\n\n",
new[] { context.Context.SystemMessage, $"Only use data that belongs to tenant '{tenant.Name}'." }
.Where(part => !string.IsNullOrWhiteSpace(part)));
context.Context.AdditionalProperties["tenant-id"] = tenant.Id;
return Task.CompletedTask;
}
}
builder.Services.AddScoped<IAICompletionContextBuilderHandler, TenantCompletionContextHandler>();
ITenantAccessor stands for the host's own service. AICompletionContextBuildingContext and AICompletionContextBuiltContext both expose Resource and the mutable Context. The profile handler sets the system message in BuildingAsync, so appending in BuiltAsync keeps your text after it. The persona handler also works in BuiltAsync; register your handler after AddPersonas(...) so it runs first and the persona block still ends up at the top.
using CrestApps.Core.AI.Orchestration;
public sealed class TenantOrchestrationContextHandler : IOrchestrationContextBuilderHandler
{
public Task BuildingAsync(
OrchestrationContextBuildingContext context,
CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}
public Task BuiltAsync(
OrchestrationContextBuiltContext context,
CancellationToken cancellationToken = default)
{
context.OrchestrationContext.SystemMessageBuilder
.AppendLine()
.Append("Do not access data outside the active tenant.");
return Task.CompletedTask;
}
}
builder.Services.AddScoped<IOrchestrationContextBuilderHandler, TenantOrchestrationContextHandler>();
OrchestrationContextBuildingContext exposes Resource, GetResource<T>() and Context; OrchestrationContextBuiltContext exposes Resource and OrchestrationContext.
During a chat turn, the response handler stores the chat interaction or session in AIInvocationScope.Current (ChatInteraction, ChatSession) before it builds the orchestration context, and the completion context and data source after it. Handlers and IAIProfileProviders can therefore read the active chat during the build. Do not rely on IHttpContextAccessor inside SignalR hubs; use IUserAccessor.User for the caller.
The profile and chat interaction handlers copy AIDeploymentParametersMetadata onto AICompletionContext.ModelParameters (chat) and UtilityModelParameters (utility). A handler can adjust them or mark a background call with IsUtilityCompletion = true:
public Task BuiltAsync(AICompletionContextBuiltContext context)
{
if (context.Resource is AIProfile { Name: "nightly-summary" })
{
context.Context.IsUtilityCompletion = true;
context.Context.UtilityModelParameters["reasoningEffort"] = "Low";
}
return Task.CompletedTask;
}
var completionContext = await completionContextBuilder.BuildAsync(
profile,
context => context.DisableTools = true,
cancellationToken);
var orchestrationContext = await orchestrationContextBuilder.BuildAsync(
profile,
context => context.UserMessage = prompt,
cancellationToken);
Use the delegate for a one-request adjustment and a handler for reusable policy.
BuiltAsync. A custom handler that prepends text in BuiltAsync and runs after it (registered earlier) puts that text above the persona block.AIProfileSystemPromptTemplateProvider now ships with AddCoreAITemplating(), which fixes profiles that lost their whole context because the template handler threw.AICompletionContext gained UtilityModelParameters and IsUtilityCompletion; usage labels go in AdditionalProperties under AICompletionContextKeys.UsageContextType and UsagePurpose.What SKILL.md sets; muted values are Claude Code's defaults
51 skills in this plugin
/crestapps-core-a2aSkill for Agent-to-Agent (A2A) protocol support in CrestApps.Core on the A2A 1.0 SDK. Covers AddA2AClient and AddCoreAIA2AClient with Entity Framework Core or YesSql connection stores, A2AConnection and A2AConnectionMetadata authentication, AIProfileA2AMetadata, the agent card cache and A2AToolRegistryProvider, the listAvailableAgents, findAgentForTask and findToolsForTask tools, building an A2A host with IAgentHandler, A2AServer, ITaskStore and MapA2A, A2A 1.0 agent cards with supportedInterfaces published at /.well-known/agent-card.json, A2AHostOptions authentication and ExposeAgentsAsSkill, system agents exposed through the host, and upgrading from the 0.3 SDK./crestapps-core-ag-uiSkill for running the CrestApps.Core 2.0 AI chat as an AG-UI agent. Covers the CrestApps.Core.AI.AGUI package (AGUIRunEventWriter, AGUIRunRequest, AGUIJson), AIChatHubCore.RunAgent over SignalR and MapAGUIChat with Server-Sent Events, the RunAgentInput members and streamed events, tool approvals with RequireApproval or an approval tool kind, ApprovalRequiredAIFunction, interrupts and resume, approvals inside agents, page context with crestAppsAGUI.registerContextProvider, shared state with registerStateProvider and update_shared_state, frontend tools, stored tool calls (ChatTurnToolActivity), runs that continue on the next page, AGUIChatOptions.DisconnectedRunTimeout, the protocol and sendPageContext chat options, and the AICompletionContextKeys and ChatResponseHandlerContext members. Use it when showing tool calls in the chat, asking a person before a tool runs, sharing page state with the agent, connecting CopilotKit or another AG-UI client, or troubleshooting approvals and continued runs./crestapps-core-ai-agentsSkill for AI agents in CrestApps.Core 2.0, specialized AIProfile records of type Agent that the primary model invokes as tools. Covers creating agent profiles with AgentMetadata availability (OnDemand or AlwaysAvailable), linking them with AgentInvocationMetadata, how AgentProxyTool runs an agent with tools disabled or through the orchestrator when AllowToolInvocation is set, the AgentInvocationDepth recursion guard, never offering an agent to itself (RunningAgentName), tools of an agent that require an approval and pause the agent, deployment inheritance and the chat slot, code-defined and system agents through IAIProfileProvider including the Tabular Data, PDF, Presentation and Word agents, chat-specific agents that read AIInvocationScope, exposing agents to MCP clients with McpServerOptions Agents and ExposeAllAgents, and SubAgent usage labels. Use it when delegating work to sub-agents, adding a framework-managed agent, publishing an agent over MCP, or troubleshooting an agent the model does not call./crestapps-core-ai-markdownSkill for Markdig-backed Markdown normalization in CrestApps.Core 2.0 AI document, data source and RAG flows. Covers the CrestApps.Core.AI.Markdown package, AddMarkdown on the AI suite builder and AddCoreAIMarkdown on IServiceCollection, MarkdownAITextNormalizer replacing the default IAITextNormalizer, RagTextNormalizer content, chunk and title normalization with HTML stripping and Microsoft.Extensions.DataIngestion.Markdig parsing, the gpt-4o tokenizer chunker with 500 tokens per chunk and 50 tokens of overlap, the plain-text fallback for unsupported inline types, where the normalizer is used (data source indexing, preemptive retrieval, reference titles), and pairing it with document processing. Use it when indexing Markdown-heavy content for retrieval, replacing the text normalizer, or troubleshooting chunk sizes and leftover markup in retrieved text./crestapps-core-ai-memorySkill for AI memory in CrestApps.Core. Covers AddAIMemory, AddCoreAIMemory and AddCoreAIMemoryIndexing, Entity Framework Core and YesSql memory stores, the AIMemory index profile on the Elasticsearch, Azure AI Search and PostgreSQL backends, AIMemoryOptions, the store fallback when no index is usable, background memory indexing, the three kinds of memory (session memory with AIConversationMemory summaries and search_conversation, past conversations with search_past_conversations and list_recent_conversations, durable user memory) switched by MemoryMetadata and ChatInteractionMemoryOptions, preemptive memory retrieval and RunsWhenPreemptiveRagIsDisabled, owner-only chat sessions, the user memory tools, IAIMemorySafetyService validation, and custom IMemoryVectorSearchService implementations./crestapps-core-ai-model-capabilitiesSkill for metadata-driven deployment capabilities in CrestApps.Core 2.0. Covers trained model features such as textGeneration, toolCalling, streaming, reasoning, realtime, textEmbedding, speechToText and textToSpeech, model parameters such as reasoningEffort, declaring them with AIDeploymentMetadata or the Features and Parameters configuration shorthand for Azure App Service settings, registering custom features, parameters and slots with AddAIDeploymentFeature, AddAIDeploymentParameter, AddAIDeploymentSlot and AIDeploymentCapabilityOptions, IAIDeploymentCapabilityService, deployment slots and their resolution chain, AIDeploymentParametersMetadata chat and utility values, IAIDeploymentParameterBinder, UseModelParameters, capability enforcement, the ChatApi Responses routing for reasoning with tools, capability-aware chat UIs, and migrating from AIDeploymentPurpose. Use it when declaring what a model supports, adding a new knob, or fixing stripped tools, missing pickers, or reasoning-effort errors./crestapps-core:crestapps-core-context-buildersfrom crestapps-core
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-coreOther plugins' skills for the same job