Configures CrestApps AI Data Sources in Orchard Core 4.0 for knowledge base indexes, RAG retrieval, embedding deployments, and source types including Elasticsearch, Azure AI Search, PostgreSQL, Web, and File.
Ships in crestapps-orchardcore. 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.
Read when SKILL.md points to them.
You are an Orchard Core expert. Generate configuration, recipes, and code for CrestApps AI data sources: a data source reads documents from a source, chunks and embeds them into a shared AI knowledge base index, and AI profiles, chat interactions, workflow tasks, and tool instances retrieve from it (RAG).
CrestApps.OrchardCore.AI.DataSources is EnabledByDependencyOnly. Enable a provider feature (Elasticsearch, Azure AI Search, PostgreSQL), CrestApps.OrchardCore.AI.WebCrawlers, or CrestApps.OrchardCore.AI.FileSources and it comes along. It depends on CrestApps.OrchardCore.AI and OrchardCore.Indexing.DataSourceIndex, created under Search > Indexes as AI knowledge base index (Elasticsearch) or AI knowledge base index (Azure AI Search). Lucene cannot hold a knowledge base.embedding slot, so the deployment must declare the textEmbedding capability. The deployment is locked once the index exists, because it fixes the vector dimensions.SearchIndexProfile source must be an Elasticsearch or Azure AI Search index profile. Only those providers register an IDataSourceDocumentReader; a Lucene index or an AI-managed index (AI Documents, AI Memory, another knowledge base) is rejected.SearchIndexProfile, Elasticsearch, AzureAISearch, and PostgreSQL. Web and File sources shape their own documents.IOptionsMonitor<AIDataSourceOptions>.CurrentValue. Saving the Data sources card no longer releases the tenant.| Feature | Feature ID | Depends on |
|---|---|---|
| AI Data Sources | CrestApps.OrchardCore.AI.DataSources | CrestApps.OrchardCore.AI, OrchardCore.Indexing (dependency only) |
| AI Data Sources - Elasticsearch | CrestApps.OrchardCore.AI.DataSources.Elasticsearch | AI Data Sources, OrchardCore.Elasticsearch |
| AI Data Sources - Azure AI Search | CrestApps.OrchardCore.AI.DataSources.AzureAI | AI Data Sources, OrchardCore.Indexing, OrchardCore.AzureAI |
| AI Data Sources - PostgreSQL | CrestApps.OrchardCore.AI.DataSources.PostgreSQL | AI Data Sources |
| AI Web Crawlers | CrestApps.OrchardCore.AI.WebCrawlers | AI Data Sources (see orchardcore-ai-web-crawlers) |
| AI File Sources | CrestApps.OrchardCore.AI.FileSources | AI Data Sources, AI Documents (see orchardcore-ai-file-sources) |
PostgreSQL only reads source rows. Pair it with the Elasticsearch or Azure AI Search feature, which provides the knowledge base index.
Source value | Added by | Reads from |
|---|---|---|
SearchIndexProfile | AI Data Sources | An Orchard Elasticsearch or Azure AI Search index profile, for example the content index |
Elasticsearch | Elasticsearch feature | An external Elasticsearch index (self-managed URL or Elastic Cloud ID) |
AzureAISearch | Azure AI Search feature | An external Azure AI Search index |
PostgreSQL | PostgreSQL feature | A PostgreSQL table, read in batches ordered by the key column |
Web | AI Web Crawlers | Pages scraped by web crawlers that target the data source |
File | AI File Sources | Files ingested by file sources that target the data source |
{
"steps": [
{
"name": "Feature",
"enable": [
"OrchardCore.Elasticsearch",
"CrestApps.OrchardCore.AI.DataSources.Elasticsearch"
],
"disable": []
}
]
}
For Azure AI Search, enable OrchardCore.AzureAI and CrestApps.OrchardCore.AI.DataSources.AzureAI. To read a PostgreSQL table, add CrestApps.OrchardCore.AI.DataSources.PostgreSQL next to one of them.
textEmbedding (see orchardcore-ai-model-capabilities).orchardcore-ai-tool-instances).Field defaults for the content index: Elasticsearch uses key ContentItemId, title Content.ContentItem.DisplayText.keyword, content Content.ContentItem.FullText; Azure AI Search uses ContentItemId, Content__ContentItem__DisplayText__keyword, Content__ContentItem__FullText.
{
"steps": [
{
"name": "AIDataSource",
"DataSources": [
{
"ItemId": "articlesdatasource01",
"DisplayText": "Articles",
"Source": "SearchIndexProfile",
"SourceIndexProfileName": "articles",
"AIKnowledgeBaseIndexProfileName": "AIRagKnowledgeBase",
"KeyFieldName": "ContentItemId",
"TitleFieldName": "Content.ContentItem.DisplayText.keyword",
"ContentFieldName": "Content.ContentItem.FullText"
}
]
}
]
}
Source defaults to SearchIndexProfile and must be a registered source type, otherwise the step reports Invalid source used for AI data source.ItemId updates that data source; a new valid ItemId is kept as the id.DisplayText and AIKnowledgeBaseIndexProfileName are always required, and ContentFieldName is required for every source except Web.Properties, for example PostgreSQLSourceMetadata or ElasticsearchSourceMetadata. See data source examples for each source type, the knowledge base index recipe, and the profile recipe.The AIDataSource deployment step (Artificial Intelligence category) exports all or selected data sources (IncludeAll, SourceIds).
With the Data Connectors feature on, the Elasticsearch and AzureAISearch source editors offer a
Data connection picker to people who may manage data connections and their credentials. The choice is
stored as Properties.DataConnectionReference.ConnectionId and the data source then reads its endpoint and
credentials from the connection, where the secrets stay protected and are never written to the data source or
a deployment plan:
Elasticsearch takes an Elasticsearch connection (URL, none, Basic, header API key or bearer token
authentication, extra headers, timeout); everything but the index name comes from it. OAuth 2.0, OpenID
Connect and query-string API keys are refused.AzureAISearch takes an HTTP API connection whose URL is https://<service>.search.windows.net with
API key authentication; a connection without authentication uses the default Azure credential.ApiKey, Password and Base64ApiKey out while a connection is used.See orchardcore-data-connectors for connections.
The profile stores the selection in DataSourceMetadata and the retrieval settings in AIDataSourceRagMetadata:
{
"steps": [
{
"name": "AIProfile",
"profiles": [
{
"Name": "knowledge-assistant",
"DisplayText": "Knowledge Assistant",
"Type": "Chat",
"Properties": {
"AIProfileMetadata": {
"SystemMessage": "Answer using the provided knowledge base context."
},
"DataSourceMetadata": {
"DataSourceId": "articlesdatasource01"
},
"AIDataSourceRagMetadata": {
"Strictness": 3,
"TopNDocuments": 5,
"IsInScope": true,
"Filter": "category eq 'docs'"
}
}
}
]
}
]
}
| Editor field (Knowledge tab) | Property | Notes |
|---|---|---|
| Data source | DataSourceMetadata.DataSourceId | |
| Strictness | AIDataSourceRagMetadata.Strictness | 1 to 5, blank uses the site default |
| Retrieved documents | AIDataSourceRagMetadata.TopNDocuments | 3 to 20, blank uses the site default |
| Restrict answers to retrieved data only | AIDataSourceRagMetadata.IsInScope | |
| Filter | AIDataSourceRagMetadata.Filter | OData, validated with IODataValidator on save |
Site defaults live on the Data sources card of Settings > Artificial Intelligence (AIDataSourceSettings.DefaultStrictness, default 3, and DefaultTopNDocuments, default 5). Preemptive retrieval is the Enable preemptive retrieval-augmented generation (RAG) switch of the Default orchestrator card; when a profile has tools disabled, preemptive RAG always runs.
| Preemptive RAG | IsInScope | Behavior |
|---|---|---|
| On | On | Context is injected; the model must answer only from it |
| On | Off | Context is injected; the model may add general knowledge |
| Off | On | No injected context; the model must call search_data_sources first and use nothing else |
| Off | Off | No injected context; the model calls search_data_sources first, then may use general knowledge |
The preemptive retrieval and the search_data_sources tool read the same filter, strictness, and retrieved document count from the profile or chat interaction. Injected sections use bracket headers such as [Data Source Context], [Knowledge Source Instructions], and [Scope Constraint].
A knowledge base chunk stores every source field in a filters object. Write a field by its source name (category eq 'docs'); the translator adds the filters. prefix. The typed columns contentType, rootId, parentId, and page are not prefixed.
| Knowledge base index | Filter support |
|---|---|
| Elasticsearch | Translated by the CrestApps.Core Elasticsearch IODataFilterTranslator (AddElasticsearchODataFilterTranslator()) into a bool query. Strings are dynamically mapped as text plus keyword, so use category.keyword eq 'Support Docs' for an exact match. |
| Azure AI Search | Not supported. No translator is registered, so the filter is ignored and No OData filter translator available for provider is logged. |
Answers carry [doc:N] markers. Each reference has a ReferenceId (source key), a ReferenceType (the source index profile type), and a title. Indices are shared across data sources, documents, and tool calls through AIInvocationScope.Current. A reference gets a link only when an IAIReferenceLinkResolver is registered for its type:
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddKeyedScoped<IAIReferenceLinkResolver, ProductLinkResolver>("ProductIndex");
}
}
The Web source registers its own resolver, so crawled pages link back to their URL.
DataSourceContentHandler (requires OrchardCore.Contents) queues chunk updates and removals when content changes.IDocumentIndexHandler notifications after provider upserts and deletes; the module bridges them into IAIDataSourceIndexingQueue.OrchardAIDataSourceIndexingQueue batches the request's work and runs it after the response in a background job, through IAIDataSourceIndexingService.DataSourceAlignmentBackgroundTask (AI Data Source Alignment, 0 2 * * *) repairs drift every night.IDataSourceContentManager.DeleteByDataSourceIdAsync.Elasticsearch, AzureAISearch, and PostgreSQL sources are not touched by Orchard content events. Re-sync them with Sync index or the nightly task.A knowledge base answers anyone allowed to query its profiles, without the source's own access checks, so DataSourceIndexingService indexes only documents everyone may read. Before indexing a source document (full and targeted syncs), it asks every IIndexedDocumentVisibility (CrestApps.OrchardCore.Indexing, registered with services.AddIndexedDocumentVisibility<T>()) through IsForEveryoneAsync(documentId); a document that is not for everyone is skipped and its chunks are deleted, so a record restricted after indexing leaves at its next sync. Content Access Control registers one for content items (an item restricted to roles that leave out Anonymous). The check uses the reference id, so keep a content index's key field as the content item id.
IAIDataSourceResultFilter (CrestApps.OrchardCore.AI.Core.DataSources) decides per request which retrieved chunks a person may receive, with what the index does not know. FilterAsync(AIDataSourceResultFilterContext, IReadOnlyList<DataSourceSearchResult>) gets User, Resource (the AI profile or chat interaction), ProfileId, DataSourceId, IndexProfile and CancellationToken, and returns the chunks to keep. Learning AI uses it to keep exam content away from models and to scope a tutor to the learner's enrollments.
public sealed class InternalOnlyResultFilter : IAIDataSourceResultFilter
{
public Task<IReadOnlyList<DataSourceSearchResult>> FilterAsync(
AIDataSourceResultFilterContext context,
IReadOnlyList<DataSourceSearchResult> results)
{
if (context.User?.Identity?.IsAuthenticated == true)
{
return Task.FromResult(results);
}
IReadOnlyList<DataSourceSearchResult> kept = results
.Where(result => result.ReferenceType != "InternalArticle")
.ToList();
return Task.FromResult(kept);
}
}
// In the module's startup:
services.AddAIDataSourceResultFilter<InternalOnlyResultFilter>();
IDataSourceContentManager in FilteringDataSourceContentManager in ResultFiltersStartup (order 10,000, after the providers), so preemptive retrieval, the search tool, search tool instances and any other caller pass through the filters. A module that registers its own content manager later calls services.DecorateDataSourceContentManagers().AIDataSourceResultFilterOptions.OverfetchFactor, 4, at most MaxCandidates, 200) and returns the caller's count of what the filters keep. Filters run one at a time, so a filter may use the request's YesSql session. With no filter it is a pass-through.A source type is a keyed IAIDataSourceSourceHandler, an entry in AIDataSourceSourceOptions, and a display driver for its editor section. Opt into the shared field mapping with AIDataSourceFieldMappingOptions.Require:
public sealed class Startup : StartupBase
{
internal readonly IStringLocalizer S;
public Startup(IStringLocalizer<Startup> stringLocalizer)
{
S = stringLocalizer;
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddKeyedScoped<IAIDataSourceSourceHandler, CrmAIDataSourceSourceHandler>("Crm");
services.AddDisplayDriver<AIDataSource, CrmAIDataSourceDisplayDriver>();
services.Configure<AIDataSourceFieldMappingOptions>(options => options.Require("Crm"));
services.Configure<AIDataSourceSourceOptions>(options => options.AddOrUpdate(
"Crm",
S["CRM"],
S["Read source documents from the CRM."]));
}
}
The handler returns its key from SourceType, validates its settings (ValidateAsync), reports the reference type (GetReferenceTypeAsync), and streams documents (ReadAsync, ReadByIdsAsync). Follow the PostgreSQL handler: store settings as a metadata object on the data source, protect secrets with IDataProtectionProvider and AIDataSourceProtectionConstants.SourceSecretPurpose, and show the driver only when dataSource.Source matches. The shared contracts are covered in crestapps-core-data-sources.
Artificial Intelligence > Data Sources renders through the Orchard Core AdminList shape under the list name AIDataSources, with the grid columns Name, Indexes, Modified, and Actions. Each row is the AIDataSource shape in the SummaryAdmin (List) and SummaryAdminGrid (Grid) display types. A driver that adds to a row must place its shape for both display types; add a column with an IAdminListColumnsProvider for AIDataSources. Mechanics are in orchardcore-admin-lists.
ManageAIDataSources (Administrator by default) protects the data source screens. The Data sources card is part of the AI settings group, guarded by ManageAIProfiles.
Purpose: "Embedding" is projected onto textEmbedding automatically; declare Properties.AIDeploymentMetadata.Features: ["textEmbedding"] for new ones.IOptions<AIDataSourceOptions> with IOptionsMonitor<AIDataSourceOptions>; a singleton IOptions keeps the value captured at first use..keyword for exact string matches.search_data_sources now applies the interaction's filter, strictness, and retrieved document count, and an invalid filter rejects the save.AdminList. Row overrides only apply to the List layout; give added shapes a SummaryAdminGrid location.Source still import as SearchIndexProfile, and the legacy ProfileSource key still maps to SourceIndexProfileName.| Symptom | Check |
|---|---|
| No knowledge base index type in Search > Indexes | Enable the Elasticsearch or Azure AI Search data source feature and its Orchard Core search feature. |
| No embedding deployment to pick | Declare textEmbedding on an embedding deployment. Chat deployments are not offered. |
| Index stays empty | The knowledge base index has no embedding deployment, or the data source was never synced. |
| The selected source index provider cannot read source documents | The source index is Lucene. Use an Elasticsearch or Azure AI Search index. |
| Filter has no effect | The knowledge base is Azure AI Search, or the string needs .keyword on Elasticsearch. |
| External source misses changes | External sources sync only on Sync index, on save, or nightly. |
| A content item is missing from the knowledge base | It is restricted (an IIndexedDocumentVisibility, such as Content Access Control, says it is not for everyone), or the index key is not the content item id. |
| Monitoring syncs | crestapps.ai.datasource.sync.duration (outcome partial when some documents failed) and crestapps.ai.datasource.documents on the CrestApps.OrchardCore.AI meter; see orchardcore-observability. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, ai-data-sources, rag, knowledge-base, crestapps
/crestapps-orchardcore:orchardcore-ai-data-sourcesfrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts.Other plugins' skills for the same job