<< All versions

Skill v1.0.1

currentAutomated scan100/100
crestapps/crestapps.agentskills/crestapps-core-ai-memory

+2 new

──Details
PublishedOctober 25, 2026 at 04:20 PM
Content Hashsha256:1d1b5a97ee410bf3...
Git SHAd86d04f234b1
Bump Typepatch
Compare with v1.0.0
──Files
Files (1 file, 4.9 KB)
SKILL.md4.9 KBactive
SKILL.md · 109 lines · 4.9 KB

version: "1.0.1" name: crestapps-core-ai-memory description: Skill for durable, user-scoped AI memory in CrestApps.Core. Covers AddAIMemory and AddCoreAIMemory, Entity Framework Core and YesSql memory stores, the AIMemory index profile and the AddAIMemory option on the Elasticsearch, Azure AI Search and PostgreSQL backends, AIMemoryOptions IndexProfileName and TopN, enabling memory per AI profile with MemoryMetadata and for chat interactions with ChatInteractionMemoryOptions, preemptive memory retrieval through GeneralAIOptions, the save_user_memory, search_user_memories, list_user_memories and remove_user_memory tools, IAIMemorySafetyService validation, and custom IMemoryVectorSearchService implementations. license: Apache-2.0 metadata: author: CrestApps Team version: "1.0"


CrestApps.Core AI Memory

Memory stores long-lived facts about the authenticated user (preferences, projects, roles) and recalls them in later conversations. It is not for transient chat state.

Registration

csharp
builder.Services.AddCrestAppsCore(crestApps => crestApps
.AddAISuite(ai => ai
.AddOpenAI()
.AddAIMemory(memory => memory
.AddEntityCoreStores())) // or .AddYesSqlStores()
.AddIndexingServices(indexing => indexing
.AddEntityCoreStores()
.AddElasticsearch(
builder.Configuration.GetSection("CrestApps:Elasticsearch"),
elasticsearch => elasticsearch.AddAIMemory()))
.AddEntityCoreSqliteDataStore("Data Source=app.db"));
builder.Services.Configure<AIMemoryOptions>(options =>
{
options.IndexProfileName = "user-memories"; // an index profile of type AIMemory
options.TopN = 5;
});
  • AddAIMemory(...) calls AddCoreAIMemory(), which registers IAIMemorySafetyService, IAIMemorySearchService, AIMemoryIndexingService, AIMemoryOrchestrationHandler, AIMemoryPreemptiveRagHandler, the options and the four memory tools.
  • The store builder call registers IAIMemoryStore (and ICatalog<AIMemoryEntry>). YesSql hosts also create the index table with CreateAIMemoryEntryIndexSchemaAsync(...).
  • A backend's AddAIMemory() registers the AIMemory index-profile source, its profile handler and the keyed IMemoryVectorSearchService. Without it, memory is stored but never searched semantically.
  • AIMemoryOptions.IndexProfileName must name an existing index profile of type AIMemory; otherwise indexing logs a warning and skips.

Turning Memory On

SurfaceSwitch
AI profileMemoryMetadata.EnableUserMemory = true on the profile (profile.Put(new MemoryMetadata { EnableUserMemory = true }))
Chat interactionsChatInteractionMemoryOptions.EnableUserMemory (default true)
Preemptive recallGeneralAIOptions.EnablePreemptiveMemoryRetrieval (default true)

Memory runs only for an authenticated user. The user id is read from ClaimTypes.NameIdentifier, falling back to ClaimTypes.Name.

Tools

ToolUse
save_user_memorycreate or update a memory by name
search_user_memoriessemantic search over the user's memories
list_user_memorieslist what is already known
remove_user_memoryforget a memory

Contracts

ContractRole
IAIMemoryStoreICatalog<AIMemoryEntry> plus CountByUserAsync, FindByUserAndNameAsync, GetByUserAsync
IAIMemorySearchServiceshared semantic retrieval
IMemoryVectorSearchServiceprovider-keyed vector search adapter
IAIMemorySafetyServiceTryValidate(name, description, content, out errorMessage) before a write

AIMemoryEntry holds UserId, Name, Description, Content, CreatedUtc and UpdatedUtc.

Custom Safety Rules

csharp
using CrestApps.Core.AI.Memory;
public sealed class StrictMemorySafetyService : IAIMemorySafetyService
{
private static readonly string[] _blockedWords = ["password", "api key", "secret"];
public bool TryValidate(string name, string description, string content, out string errorMessage)
{
var text = $"{name} {description} {content}";
foreach (var word in _blockedWords)
{
if (text.Contains(word, StringComparison.OrdinalIgnoreCase))
{
errorMessage = "Memories cannot contain credentials or secrets.";
return false;
}
}
errorMessage = null;
return true;
}
}
builder.Services.AddScoped<IAIMemorySafetyService, StrictMemorySafetyService>();

The default registration is a TryAdd, so register your implementation before or after AddAIMemory(...); a plain AddScoped registered later wins for single resolution.

Custom Vector Backend

Implement IMemoryVectorSearchService.SearchAsync(SearchIndexProfile indexProfile, float[] embedding, string userId, int topN, CancellationToken) and register it keyed by the provider name of the memory index profile. Always filter by userId so one user can never retrieve another user's memories.

← v1.0.0All versions