![]() |
VOOZH | about |
dotnet add package Memori --version 0.3.0
NuGet\Install-Package Memori -Version 0.3.0
<PackageReference Include="Memori" Version="0.3.0" />
<PackageVersion Include="Memori" Version="0.3.0" />Directory.Packages.props
<PackageReference Include="Memori" />Project file
paket add Memori --version 0.3.0
#r "nuget: Memori, 0.3.0"
#:package Memori@0.3.0
#addin nuget:?package=Memori&version=0.3.0Install as a Cake Addin
#tool nuget:?package=Memori&version=0.3.0Install as a Cake Tool
Durable memory for AI applications built on Microsoft.Extensions.AI.
Memori gives your AI app a persistent, searchable memory layer: capture conversations, recall relevant facts, and inject context into prompts — without coupling your code to a specific database or LLM provider.
dotnet add package Memori
IConversationStorage for conversation/session/entity/process data — bring your own backendVectorStoreCollection<string, MemoryFactRecord> for durable fact storage via any Microsoft.Extensions.VectorData providerInMemoryConversationStorage and InMemoryVectorStore for tests, demos, and local developmentIEmbeddingGenerator<string, Embedding<float>> from Microsoft.Extensions.AI as the embedding surfaceMemori facade for attribution, session tracking, capture, recall, and augmentation in one placeIChatClient middleware that wires recall and capture into any Microsoft.Extensions.AI-compatible providerChatClientThreadSummarizerusing Memori.Models;
using Memori.Search;
using Memori.Storage;
var conversationStorage = new InMemoryConversationStorage();
var vectorStore = new InMemoryVectorStore();
var factCollection = vectorStore.GetCollection<string, MemoryFactRecord>("memori_facts");
var entityId = await conversationStorage.GetOrCreateEntityAsync("user_123");
await factCollection.UpsertAsync(new MemoryFactRecord
{
Id = Guid.NewGuid().ToString("N"),
EntityId = entityId,
Content = "The user's favorite color is blue",
CreatedAt = DateTimeOffset.UtcNow
});
var search = new MemorySearchService(factCollection);
var results = await search.RecallAsync(entityId, "What is my favorite color?");
Console.WriteLine(search.FormatPromptContext(results));
using Memori;
using Memori.Augmentation;
using Memori.Models;
using Memori.Storage;
var conversationStorage = new InMemoryConversationStorage();
var vectorStore = new InMemoryVectorStore();
var factCollection = vectorStore.GetCollection<string, MemoryFactRecord>("memori_facts");
var memori = new MemoriEngine(
conversationStorage,
factCollection,
new MemoriOptions { StripSystemMessagesOnCapture = true },
augmentationClient: new NullAugmentationClient());
memori.Attribution("user_123", "support_agent");
memori.SetSession("session_abc");
await memori.CaptureAsync(new[]
{
new ConversationMessage(ConversationRoles.User, "My favorite color is blue."),
new ConversationMessage(ConversationRoles.Assistant, "Noted.")
});
var recalled = await memori.RecallAsync("What is my favorite color?");
await memori.WaitForAugmentationAsync();
var promptContext = memori.BuildPromptContext(recalled);
Console.WriteLine(promptContext.RenderedText);
memori.Attribution("user_123");
memori.SetScope("workspace-a");
var results = await memori.RecallAsync("coffee");
memori.ClearScope();
using Memori;
using Microsoft.Extensions.AI;
IChatClient innerClient = /* your provider-backed IChatClient */;
IChatClient client = new ChatClientBuilder(innerClient)
.UseMemori(memori)
.Build(serviceProvider);
Recalled memory is injected as a system message before the existing chat history by default. Injection placement and role are configurable.
services.AddMemori(options =>
{
options.SessionTimeout = TimeSpan.FromMinutes(30);
options.PromptInjectionPlacement = PromptInjectionPlacement.AfterSystemAndDeveloperMessages;
});
var memori = serviceProvider.CreateMemori();
Bind from configuration:
services.AddMemori(configuration.GetSection("Memori"));
Supply custom conversation storage, embedding, and augmentation through factories:
services.AddMemori(
sp => new MyConversationStorage(),
configureOptions: options => { options.RecallRelevanceThreshold = 0.2; });
Augmentation extracts structured memory (facts, semantic triples, process attributes, summaries) from captured conversations in the background.
NullAugmentationClient: no-op, for hosts that only want capture/recall.PromptAugmentationClient: uses an IChatClient to extract structured JSON output.IAugmentationClient for custom extraction logic.var versioning = new VersioningService(ConflictResolutionStrategy.LastWriteWins);
var resolution = versioning.ResolveConflict(incoming, existing, expectedVersion: 1);
Supports last-write-wins, merge, and manual resolution strategies with audit trail.
var summarizer = new ChatClientThreadSummarizer(chatClient);
var summary = await summarizer.SummarizeAsync(messages);
var updated = await summarizer.SummarizeAsync(newMessages, previousSummary);
var management = serviceProvider.GetRequiredService<IMemoryManagementService>();
var memories = await management.ListMemoriesAsync("entity-1");
await management.SoftDeleteMemoryAsync("fact-id");
await management.RestoreMemoryAsync("fact-id");
await management.HardDeleteMemoryAsync("fact-id");
Core primitives, distributed ranking, composite collection, scope isolation, versioning, thread summarization, and memory management are all implemented. 211 NUnit tests. No first-party database integrations — implement IConversationStorage and supply a VectorStore provider in your own package.
Apache-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Memori:
| Package | Downloads |
|---|---|
|
CodeMemory
Transform repositories into queryable intelligence — a persistent, semantic memory layer for codebases exposed via MCP. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.3.0 | 185 | 5/29/2026 |