Kurrent.Kontext.AspNetCore
0.0.0-alpha.0.43
See the version list below for details.
dotnet add package Kurrent.Kontext.AspNetCore --version 0.0.0-alpha.0.43
NuGet\Install-Package Kurrent.Kontext.AspNetCore -Version 0.0.0-alpha.0.43
<PackageReference Include="Kurrent.Kontext.AspNetCore" Version="0.0.0-alpha.0.43" />
<PackageVersion Include="Kurrent.Kontext.AspNetCore" Version="0.0.0-alpha.0.43" />
<PackageReference Include="Kurrent.Kontext.AspNetCore" />
paket add Kurrent.Kontext.AspNetCore --version 0.0.0-alpha.0.43
#r "nuget: Kurrent.Kontext.AspNetCore, 0.0.0-alpha.0.43"
#:package Kurrent.Kontext.AspNetCore@0.0.0-alpha.0.43
#addin nuget:?package=Kurrent.Kontext.AspNetCore&version=0.0.0-alpha.0.43&prerelease
#tool nuget:?package=Kurrent.Kontext.AspNetCore&version=0.0.0-alpha.0.43&prerelease
Kurrent.Kontext
Agent memory and RAG library powered by KurrentDB. Built with .NET 10.
Gives AI agents two capabilities:
- Agent Memory — retain synthesized knowledge across sessions and recall it later. Facts are stored as events in KurrentDB and indexed for fast retrieval.
- Retrieval-Augmented Generation (RAG) — search and read raw event streams directly as grounding context. When retained facts are missing, outdated, or need verification, agents go straight to the source of truth.
KurrentDB as the backend means every fact and event is durably stored, fully auditable, and replayable — agents can always trace back to the source. Lucene.NET handles full-text search, USearch handles vector similarity, and all indexing runs on CPU with lightweight ONNX models — no LLM calls or GPUs needed for preprocessing.
How It Works
Data Import
Agent ──import_events──> KurrentDB (event streams) ──subscription──> Lucene + USearch (events index)
Agent Memory
Agent ──retain_facts───> KurrentDB (memory stream) ──subscription──> Lucene + USearch (memory index)
Agent ──recall_facts───> Lucene + USearch (memory index) ──hydrate──> KurrentDB
RAG
Agent ──query_events───> Lucene + USearch (events index) ──hydrate──> KurrentDB
- Import: Agent translates external data (CSV, API responses, logs, etc.) into events and writes them to KurrentDB. The subscription indexes them automatically.
- Retain (Memory): Agent stores synthesized facts as events in KurrentDB. The subscription indexes them into a separate
memoryindex. - Recall (Memory): Agent searches the memory index for previously retained facts. Results are hydrated from KurrentDB.
- Search (RAG): Agent searches the events index for raw KurrentDB events as grounding context. Separate from memory — no cross-contamination.
Retained facts may become outdated. Raw events are always the source of truth.
Project Structure
Kurrent.Kontext — Core library: memory, RAG, search, indexing, MCP tools
Kurrent.Kontext.AspNetCore — ASP.NET Core endpoint extensions (bulk import HTTP endpoint)
Kurrent.Kontext.ExternalClient — gRPC-backed IKontextClient for standalone use
Kurrent.Kontext.Models — Embedded INT8 quantized ONNX models (auto-downloaded on first build)
Usage
With the external KurrentDB client
// Register gRPC-backed client + all Kontext services
services.AddKontextWithExternalClient(configuration);
// Add MCP tools (chain a transport)
services.AddKontextMcp().WithStdioServerTransport();
Custom client implementation
Implement IKontextClient for your own backend:
services.AddSingleton<IKontextClient, MyCustomClient>();
services.AddKontext(configuration);
DI API
| Method | Description |
|---|---|
services.AddKontext(config) |
Register all Kontext services (memory, RAG, search, indexing, embeddings, NLP) |
services.AddKontextMcp() |
Register MCP tools and server. Chain a transport. |
services.AddKontextWithExternalClient(config) |
Convenience: gRPC client + AddKontext |
MCP Tools
Agent Memory
| Tool | Description |
|---|---|
recall_facts |
Search agent memory for previously retained facts |
retain_facts |
Store synthesized facts for future recall |
Data Import
| Tool | Description |
|---|---|
import_events |
Import external data into KurrentDB as events (batch writes, auto-indexed) |
RAG (Event Retrieval)
| Tool | Description |
|---|---|
create_session |
Create a search session for querying raw events |
query_events |
Search, read, and/or forget events within a session |
view_events |
View all events in a session's working set |
delete_session |
Delete a session and free resources |
System
| Tool | Description |
|---|---|
status |
Check if indexing is caught up with KurrentDB. Returns Caught Up or Catching up (X% remaining, Y bytes) |
How Search Works
Both agent memory and RAG share the same hybrid search pipeline:
Indexing — Subscribes to KurrentDB's
$allstream. Each event's type name is split by naming convention (OrderPlaced→"order placed") and combined with recursively flattened data values. Noun phrases are extracted, a 384-dim embedding is generated, and the event is indexed into Lucene.NET (full-text, BM25) and USearch (vector similarity, cosine).Search — Extracts noun phrases from the query, generates an embedding, runs BM25 text matching (Lucene.NET) and k-NN vector similarity (USearch) in parallel. Results are fused via Reciprocal Rank Fusion (RRF, k=60), diversified with Maximal Marginal Relevance (MMR, lambda=0.7), and optionally re-ranked with a cross-encoder.
Index separation — Retained facts are routed to a separate
memoryindex using the fact text as the search key. Raw events go to theeventsindex. Same search pipeline, separate indexes — no cross-contamination.
ML Models
Embedded in the Kurrent.Kontext.Models assembly (downloaded automatically on first build):
| Model | Purpose | Size |
|---|---|---|
| all-MiniLM-L6-v2 (INT8 quantized) | 384-dim sentence embeddings | ~22 MB |
| ms-marco-TinyBERT-L2-v2 | Cross-encoder re-ranking | ~17 MB |
Two INT8 quantized embedding models are shipped — model_quint8_avx2.onnx (universal x86) and model_qint8_avx512.onnx (AVX-512 capable CPUs). The best model is selected at runtime based on CPU capabilities. Dynamic token length (no fixed padding) further reduces inference time.
Testing
dotnet test --solution Kurrent.Kontext.slnx
| Project | Tests | What |
|---|---|---|
Kurrent.Kontext.Tests |
176 | Unit tests (search, indexing, tools, import, access control, status) |
Kurrent.Kontext.Integration.Tests |
7 | End-to-end with KurrentDB testcontainers |
Kurrent.Kontext.ExternalClient.Tests |
4 | External client config |
| 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
- Kurrent.Kontext (>= 0.0.0-alpha.0.43)
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 |
|---|---|---|
| 0.0.0-alpha.0.50 | 73 | 5/5/2026 |
| 0.0.0-alpha.0.49 | 77 | 4/15/2026 |
| 0.0.0-alpha.0.48 | 74 | 4/10/2026 |
| 0.0.0-alpha.0.47 | 132 | 4/2/2026 |
| 0.0.0-alpha.0.46 | 94 | 4/2/2026 |
| 0.0.0-alpha.0.45 | 138 | 4/1/2026 |
| 0.0.0-alpha.0.44 | 70 | 4/1/2026 |
| 0.0.0-alpha.0.43 | 72 | 4/1/2026 |