Memori 0.2.2

dotnet add package Memori --version 0.2.2
                    
NuGet\Install-Package Memori -Version 0.2.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Memori" Version="0.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Memori" Version="0.2.2" />
                    
Directory.Packages.props
<PackageReference Include="Memori" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Memori --version 0.2.2
                    
#r "nuget: Memori, 0.2.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Memori@0.2.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Memori&version=0.2.2
                    
Install as a Cake Addin
#tool nuget:?package=Memori&version=0.2.2
                    
Install as a Cake Tool

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

  • IConversationStorage for conversation/session/entity/process data — bring your own backend
  • VectorStoreCollection<string, MemoryFactRecord> for durable fact storage via any Microsoft.Extensions.VectorData provider
  • Built-in InMemoryConversationStorage and InMemoryVectorStore for tests, demos, and local development
  • IEmbeddingGenerator<string, Embedding<float>> from Microsoft.Extensions.AI as the embedding surface
  • A Memori facade for attribution, session tracking, capture, recall, and augmentation in one place
  • IChatClient middleware that wires recall and capture into any Microsoft.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 an IChatClient to extract structured JSON output.
  • Implement IAugmentationClient for 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

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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