MagiCore 1.0.0
dotnet add package MagiCore --version 1.0.0
NuGet\Install-Package MagiCore -Version 1.0.0
<PackageReference Include="MagiCore" Version="1.0.0" />
<PackageVersion Include="MagiCore" Version="1.0.0" />
<PackageReference Include="MagiCore" />
paket add MagiCore --version 1.0.0
#r "nuget: MagiCore, 1.0.0"
#:package MagiCore@1.0.0
#addin nuget:?package=MagiCore&version=1.0.0
#tool nuget:?package=MagiCore&version=1.0.0
<div align="center"> <img src="assets/readme-header.svg" alt="MagiCore semantic, temporal, and spatial memory systems online" width="100%" /> </div>
<h1 align="center">MagiCore</h1>
<p align="center"><strong>Long-term memory infrastructure for AI applications and agents in .NET.</strong></p>
<p align="center"> Store what happened. Recover what mattered. Recall it in the right context. </p>
<div align="center">
</div>
MagiCore is a local-first C# library for building memory into agents, assistants, simulations, and robots. It combines semantic retrieval with auditable history, event-time recall, cognitive consolidation, and provider-neutral persistence.
| Memory plane | What it gives your application |
|---|---|
| Semantic | Dense and hybrid retrieval, reranking, entities, relations, and multimodal memories. |
| Temporal | Audit history, point-in-time reads, rollback, and event-time filtering. |
| Spatial | Timestamped 3D observations, reconstructed object beliefs, and measured action episodes. |
Everything runs in-process by default with no telemetry and no required hosted service. Production integrations use standard Microsoft.Extensions.AI and Microsoft.Extensions.VectorData abstractions, so model and storage choices stay at the application boundary.
Start the core
Install the package:
dotnet add package MagiCore
Then create a zero-configuration memory service. The default store, extractor, and lexical embedding generator are deterministic and local:
using MagiCore;
var memory = new MemoryService();
await memory.AddAsync("I prefer C# over Python.", new MemoryAddOptions { UserId = "alice" });
var results = await memory.SearchAsync(
"What language does Alice like?",
new MemorySearchOptions { Filter = new MemoryFilter(UserId: "alice"), TopK = 1 });
Console.WriteLine(results[0].Memory.Text);
How memory moves
flowchart LR
subgraph Ingestion["01 / Ingest"]
Msg["User & Agent Messages"] --> Extractor["LLM / Lexical Extractor"]
Extractor --> Dedupe["Deduplication & Conflict Resolver"]
end
subgraph Behaviors["02 / Resolve and shape"]
Dedupe --> Normal["Normal Fact Memory"]
Dedupe --> Dream["Dreaming & Consolidation"]
Dedupe --> Assoc["Spontaneous Associations"]
Dedupe --> Identity["Personality / First-Person"]
end
subgraph Storage["03 / Persist"]
Normal & Dream & Assoc & Identity --> Store["Storage Engine<br/>(InMemory / Qdrant / Microsoft.Extensions.VectorData)"]
end
subgraph Retrieval["04 / Recall"]
Query["Search Query"] --> Hybrid["Hybrid Search<br/>(Dense Vector + BM25)"]
Store --> Hybrid
Hybrid --> Rerank["Reranker (Cohere / Cross-Encoder / LLM)"]
Rerank --> Context["Filtered Agent Context"]
end
System capabilities
- Semantic & Hybrid Retrieval: Dense vector search combined with BM25 keyword scoring and LLM/Cohere/Cross-Encoder reranking.
- Multimodal & Image Memory: Ingest image content through
Microsoft.Extensions.AIand search direct image embeddings withIImageEmbeddingGenerator. - Model Integration: Bring any compatible
IChatClientandIEmbeddingGenerator; examples cover OpenAI, Ollama, and local ONNX workflows. - Cognitive Behaviors:
Normal: Standard factual extraction and recall.Dreaming: Background memory consolidation, compressing repeated facts into long-term insights.Random Thoughts: Spontaneous associations and creative prompt injections.Personal/Identity: First-person perspective memory shaping.
- Audit, Temporal Reads & Recovery: Track
ADD,UPDATE, andDELETEevents, query historical state without mutation, and perform filtered rollback with history-capable stores. See Providers & Persistence for provider limitations. - 3D Spatial & Robotics Memory: Save map-scoped observations, reconstruct event-time object beliefs with uncertainty and visibility states, derive conservative metric relations, and recall controller-reported action episodes.
- Scoped Organization: User, session, and agent-level memory partitioning with run filters and metadata matching.
- Model Context Protocol (MCP): A runnable sample server exposes nine local memory tools through the official .NET MCP SDK.
- Batch Operations: High-throughput transactional batch embeddings and searches.
Build from local to durable
Local memory lifecycle
using MagiCore;
var memory = new MemoryService();
// Add a memory
await memory.AddAsync("I prefer dark mode and vim keybindings", userId: "alice");
// Search memories
var results = await memory.SearchAsync(
"What editor settings does Alice prefer?",
new MemoryFilter(UserId: "alice"),
topK: 3);
foreach (var result in results)
{
Console.WriteLine($"{result.Score:F3}: {result.Memory.Text}");
}
// Update and History
var allMemories = await memory.GetAllAsync(new MemoryFilter(UserId: "alice"));
var memoryId = allMemories[0].Id;
await memory.UpdateAsync(memoryId, "I prefer dark mode and Neovim keybindings");
var history = await memory.GetHistoryAsync(memoryId);
Multi-turn and multimodal extraction
// Extract facts from messages including images
await memory.AddAsync(
[
new Message("user", "Here is my conference receipt."),
Message.FromImage(receiptBytes, "image/png"),
new Message("assistant", "I've reviewed the receipt.")
],
userId: "alice",
scope: MemoryScope.User);
Durable vector storage
using MagiCore;
using Microsoft.Extensions.VectorData;
// Use any MEVD-compatible vector store (Azure AI Search, PostgreSQL/pgvector, SQLite, Redis, Qdrant, Milvus, Pinecone, etc.)
VectorStore vectorStore = GetVectorStore();
var store = new VectorDataMemoryStore(vectorStore, new VectorDataMemoryStoreOptions
{
CollectionName = "user_memories",
VectorDimensions = 384,
AutoCreateCollection = true
});
await store.InitializeAsync();
var memory = new MemoryService(store: store);
Choose a working sample
Each sample is runnable and focused on one deployment path. Start with Getting Started, then select the infrastructure your application needs.
- Getting Started: Zero-setup CRUD, search, and history tracking.
- SQLite Vector Store: Local embedded persistence with
Microsoft.Extensions.VectorDataandsqlite-vec. - PostgreSQL pgvector: Enterprise persistent vector storage with
Microsoft.Extensions.VectorDataandpgvector. - Memory Behaviors: Fact extraction, dreaming/consolidation, spontaneous associations, and personality-shaped memory.
- 3D Spatial Memory Robot: A Godot warehouse robot that remembers camera observations and recalls nearby objects from PostgreSQL/pgvector.
- Ollama Integration: Fully offline local LLM extraction and embeddings.
- Agent Framework Memory: Cross-session persistent memory with
Microsoft.Extensions.VectorDatafor Microsoft Agent Framework. - MCP Server: Standalone Model Context Protocol host for Claude Desktop, Cursor, and other MCP clients.
Operator manual
- Guides: Documentation Home | Getting Started | Providers & Persistence
- Reference: API Reference
- Benchmarking: Evaluation Harness & Metrics
- Architecture: Architecture Overview | Contribution Guidelines
Verify the system
dotnet build .\MagiCore.slnx
dotnet test .\tests\MagiCore.Tests\MagiCore.Tests.csproj
License
MagiCore is licensed under the Apache License 2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.11)
- Microsoft.Extensions.AI.Abstractions (>= 10.9.0)
- Microsoft.Extensions.VectorData.Abstractions (>= 10.1.0)
- System.Net.Http.Json (>= 10.0.11)
- System.Numerics.Tensors (>= 10.0.11)
- System.Text.Json (>= 10.0.11)
-
net10.0
- Microsoft.Extensions.AI.Abstractions (>= 10.9.0)
- Microsoft.Extensions.VectorData.Abstractions (>= 10.1.0)
- System.Numerics.Tensors (>= 10.0.11)
-
net8.0
- Microsoft.Extensions.AI.Abstractions (>= 10.9.0)
- Microsoft.Extensions.VectorData.Abstractions (>= 10.1.0)
- System.Numerics.Tensors (>= 10.0.11)
-
net9.0
- Microsoft.Extensions.AI.Abstractions (>= 10.9.0)
- Microsoft.Extensions.VectorData.Abstractions (>= 10.1.0)
- System.Numerics.Tensors (>= 10.0.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 91 | 9/5/2026 |