Memori 0.2.2
dotnet add package Memori --version 0.2.2
NuGet\Install-Package Memori -Version 0.2.2
<PackageReference Include="Memori" Version="0.2.2" />
<PackageVersion Include="Memori" Version="0.2.2" />
<PackageReference Include="Memori" />
paket add Memori --version 0.2.2
#r "nuget: Memori, 0.2.2"
#:package Memori@0.2.2
#addin nuget:?package=Memori&version=0.2.2
#tool nuget:?package=Memori&version=0.2.2
Memori
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.
Installation
dotnet add package Memori
What You Get
IConversationStoragefor conversation/session/entity/process data — bring your own backendVectorStoreCollection<string, MemoryFactRecord>for durable fact storage via anyMicrosoft.Extensions.VectorDataprovider- Built-in
InMemoryConversationStorageandInMemoryVectorStorefor tests, demos, and local development IEmbeddingGenerator<string, Embedding<float>>fromMicrosoft.Extensions.AIas the embedding surface- A
Memorifacade for attribution, session tracking, capture, recall, and augmentation in one place IChatClientmiddleware that wires recall and capture into anyMicrosoft.Extensions.AI-compatible provider- Scope isolation for multi-tenant memory
- Versioning and conflict resolution (last-write-wins, merge, manual)
- Thread summarization via
ChatClientThreadSummarizer - Memory management APIs for user-facing inspection, search, edit, soft-delete, and restore
Basic Example
using 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,
options: new MemoriOptions { RecallRelevanceThreshold = 0.1 });
var results = await search.RecallAsync(entityId, "What is my favorite color?");
Console.WriteLine(search.FormatPromptContext(results));
Facade Usage
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 Memori(
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);
Scope Isolation
memori.Attribution("user_123");
memori.SetScope("workspace-a");
var results = await memori.RecallAsync("coffee");
memori.ClearScope();
Microsoft.Extensions.AI Middleware
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.
Dependency Injection
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
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 anIChatClientto extract structured JSON output.- Implement
IAugmentationClientfor custom extraction logic.
Versioning
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.
Thread Summarization
var summarizer = new ChatClientThreadSummarizer(chatClient);
var summary = await summarizer.SummarizeAsync(messages);
var updated = await summarizer.SummarizeAsync(newMessages, previousSummary);
Memory Management
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");
Learn More
- Full feature overview: README.md
- Developer guide: GETTING-STARTED.md
- Architecture and design notes: ARCHITECTURE.md
Status
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.
License
Apache-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.AI (>= 10.5.2)
- Microsoft.Extensions.AI.Abstractions (>= 10.5.2)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Options (>= 10.0.7)
- Microsoft.Extensions.VectorData.Abstractions (>= 10.1.0)
- System.Numerics.Tensors (>= 10.0.7)
NuGet packages (1)
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. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.2 | 226 | 5/12/2026 |