Kurrent.Kontext.AspNetCore 0.0.0-alpha.0.43

This is a prerelease version of Kurrent.Kontext.AspNetCore.
There is a newer prerelease version of this package available.
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
                    
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="Kurrent.Kontext.AspNetCore" Version="0.0.0-alpha.0.43" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kurrent.Kontext.AspNetCore" Version="0.0.0-alpha.0.43" />
                    
Directory.Packages.props
<PackageReference Include="Kurrent.Kontext.AspNetCore" />
                    
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 Kurrent.Kontext.AspNetCore --version 0.0.0-alpha.0.43
                    
#r "nuget: Kurrent.Kontext.AspNetCore, 0.0.0-alpha.0.43"
                    
#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 Kurrent.Kontext.AspNetCore@0.0.0-alpha.0.43
                    
#: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=Kurrent.Kontext.AspNetCore&version=0.0.0-alpha.0.43&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Kurrent.Kontext.AspNetCore&version=0.0.0-alpha.0.43&prerelease
                    
Install as a Cake Tool

Kurrent.Kontext

Agent memory and RAG library powered by KurrentDB. Built with .NET 10.

Gives AI agents two capabilities:

  • Agent Memoryretain 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 memory index.
  • 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:

  1. Indexing — Subscribes to KurrentDB's $all stream. 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).

  2. 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.

  3. Index separation — Retained facts are routed to a separate memory index using the fact text as the search key. Raw events go to the events index. 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 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

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