Configures persistent, user-scoped AI memory in Orchard Core 4.0 with CrestApps.OrchardCore 3.0. Covers memory index setup, embedding deployment, memory settings, tools for save/search/list/remove, preemptive retrieval, and deferred indexing pipeline.
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.
None: SKILL.md is the whole skill.
You are an Orchard Core expert. Generate configuration, recipes, and code that let the AI remember durable, non-sensitive facts about the signed-in user across conversations.
ClaimTypes.NameIdentifier; anonymous users get no memory tools.CrestApps.OrchardCore.AI.Memory is EnabledByDependencyOnly; it depends on CrestApps.OrchardCore.AI.Chat.Core and OrchardCore.Indexing. Enable a provider feature and it comes along.AIMemoryEntry) plus one document in the configured master memory index (an index profile of type AIMemory).embedding slot, so the deployment must declare textEmbedding. It is locked once the index exists.IOptionsMonitor<AIMemoryOptions> and IOptionsMonitor<ChatInteractionMemoryOptions>; saving the Memory settings no longer releases the tenant.AIContactMemory, the profile's Contact memory card with UseMemory and SaveMemory) is part of AI Services, needs no memory index, and works for anonymous callers. See orchardcore-ai-conversations.| Feature | Feature ID | Depends on |
|---|---|---|
| AI Memory | CrestApps.OrchardCore.AI.Memory | CrestApps.OrchardCore.AI.Chat.Core, OrchardCore.Indexing (dependency only) |
| AI Memory indexing using Azure AI Search | CrestApps.OrchardCore.AI.Memory.AzureAI | AI Memory, OrchardCore.Indexing, OrchardCore.AzureAI |
| AI Memory indexing using Elasticsearch | CrestApps.OrchardCore.AI.Memory.Elasticsearch | AI Memory, OrchardCore.Elasticsearch |
Provider details are in orchardcore-ai-memory-azureai and orchardcore-ai-memory-elasticsearch.
{
"steps": [
{
"name": "Feature",
"enable": [
"OrchardCore.Elasticsearch",
"CrestApps.OrchardCore.AI.Memory.Elasticsearch"
],
"disable": []
}
]
}
Use OrchardCore.AzureAI and CrestApps.OrchardCore.AI.Memory.AzureAI for Azure AI Search.
textEmbedding (see orchardcore-ai-model-capabilities).| Setting | Stored as | Read through | Guarded by |
|---|---|---|---|
| Memory index profile and top N | AIMemorySettings (IndexProfileName, TopN) | IOptionsMonitor<AIMemoryOptions> | ManageAIProfiles |
| Chat interaction memory | site MemoryMetadata (EnableUserMemory) | IOptionsMonitor<ChatInteractionMemoryOptions> | ManageChatInteractionSettings |
| Preemptive memory retrieval | GeneralAISettings.EnablePreemptiveMemoryRetrieval (default true) | IOptionsMonitor<GeneralAIOptions> | AI settings |
{
"steps": [
{
"name": "Settings",
"AIMemorySettings": {
"IndexProfileName": "AIMemory",
"TopN": 5
},
"MemoryMetadata": {
"EnableUserMemory": true
}
}
]
}
The chat interaction setting is added only when CrestApps.OrchardCore.AI.Chat.Interactions is enabled; the feature migration turns it on for a new tenant. Memory stays inactive until a valid memory index profile is selected.
Profiles and profile-source templates store the switch in MemoryMetadata (Enable user memory on the Knowledge tab):
{
"steps": [
{
"name": "AIProfile",
"profiles": [
{
"Name": "personal-assistant",
"DisplayText": "Personal Assistant",
"Type": "Chat",
"Properties": {
"AIProfileMetadata": {
"SystemMessage": "You are a helpful assistant. Remember durable user preferences."
},
"MemoryMetadata": {
"EnableUserMemory": true
}
}
}
]
}
]
}
In code, use the extensions in CrestApps.Core.AI.Memory:
public sealed class PersonalAssistantMigrations : DataMigration
{
private readonly IAIProfileManager _profileManager;
public PersonalAssistantMigrations(IAIProfileManager profileManager)
{
_profileManager = profileManager;
}
public async Task<int> CreateAsync()
{
var profile = await _profileManager.NewAsync();
profile.Name = "personal-assistant";
profile.DisplayText = "Personal Assistant";
profile.Type = AIProfileType.Chat;
profile.Put(new AIProfileMetadata
{
SystemMessage = "You are a helpful assistant. Remember durable user preferences.",
});
profile.AlterMemoryMetadata(memory => memory.EnableUserMemory = true);
var result = await _profileManager.ValidateAsync(profile);
if (result.Succeeded)
{
await _profileManager.CreateAsync(profile);
}
return 1;
}
}
profile.GetMemoryMetadata() reads the switch, and template.WithMemoryMetadata(...) sets it on an AIProfileTemplate. Legacy AIProfileMemorySettings and ChatInteractionMemorySettings keys are migrated to MemoryMetadata automatically.
| Tool | Purpose |
|---|---|
save_user_memory | Create or update a named memory |
search_user_memories | Semantic search over the user's memories |
list_user_memories | List the user's memories |
remove_user_memory | Forget a memory |
They are system tools, added to a request only when memory is enabled for that profile or interaction and the user is signed in. The orchestration prompt tells the model to save durable facts in the same turn before promising to remember them, and to search or list memory before saying it does not know.
Each memory has a stable name (for example preferred_name), a description (The user's preferred name.), and the content. The embedding is built from the name and description, because the raw content alone is often not meaningful for retrieval.
AIMemoryEntryHandler collects created, updated, and deleted entries and adds one ShellScope deferred task per request.AIMemoryIndexingService loads the index named by AIMemoryOptions.IndexProfileName, embeds the memory with the index's deployment (UseUsageLabels(purpose: AIUsagePurposes.Indexing)), and builds an AIMemoryEntryIndexDocument.IDocumentIndexHandler maps it to memoryId, userId, name, description, content, updatedUtc, and embedding, and the keyed IDocumentIndexManager writes it.SyncByIndexProfileIdsAsync).IMemoryVectorSearchService, always filtered to the current user.Because indexing hangs off the store lifecycle, memories written by admin actions, tools, or custom code stay in sync. This pattern is the template for orchardcore-custom-indexing-elasticsearch and orchardcore-custom-indexing-azureai.
With OrchardCore.Users enabled, the user editor gets an AI memory card with a Danger zone and Clear saved AI memory button, shown only when the viewer is authorized and the user has memories. It uses the standard admin confirmation dialog, then removes the records and their index documents.
| Permission | Meaning |
|---|---|
ClearAIMemory | Clear your own memory. Grant it to the roles whose users may clear their memory. |
ClearAIMemoryForOthers | Clear another user's memory; implies ClearAIMemory. |
Both are given to Administrator by default. The UI and the clear endpoint check ClearAIMemory with the target user id as the resource; AIMemoryAuthorizationHandler then requires ClearAIMemory for your own id and ClearAIMemoryForOthers for anyone else. Use the same check in custom code:
var canClear = await _authorizationService.AuthorizeAsync(User, AIPermissions.ClearAIMemory, (object)targetUserId);
IOptions<AIMemoryOptions> and IOptions<ChatInteractionMemoryOptions> with IOptionsMonitor<T>.CurrentValue; settings changes are now pushed without a tenant release.embedding slot. Declare textEmbedding on new embedding deployments; legacy Purpose: "Embedding" records are projected automatically.| Symptom | Check |
|---|---|
| No memory tools | The user is anonymous, the profile has Enable user memory off, or no memory index is selected. |
| Nothing is remembered between sessions | The memory index has no embedding deployment, or the provider feature is disabled. |
| Memory not injected up front | Enable preemptive memory retrieval is off; the tools still work. |
| Clear button missing | The viewer lacks ClearAIMemory (own memory) or ClearAIMemoryForOthers (another user), or the user has no memories. |
| Wrong vector size after a model change | Create a new memory index with the new deployment, select it, and synchronize it. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, ai-memory, user-memory, embedding, memory-index
/crestapps-orchardcore:orchardcore-ai-memoryfrom 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