Header menu logo Nao

Nao.Persistence Namespace

Type/Module Description

Ado

Low-level, provider-agnostic ADO.NET helpers built on System.Data.Common. All SQL uses '@name' parameters (supported by SQLite, SQL Server, PostgreSQL and MySQL providers) and portable DDL (CREATE TABLE IF NOT EXISTS).

AdoAuditLog

ADO.NET-backed IAuditLog. The AuditAction/PermissionLevel unions are encoded to text columns so the schema stays portable across providers.

AdoExecutionJournal

ADO.NET-backed IExecutionJournal. History is returned most-recent-first.

AdoFeedbackStore

Feedback persisted in the nao_feedback_entries table (keyed by feedback Id).

AdoMemoryStore

ADO.NET-backed IMemoryStore. Provider-agnostic: works with any database reachable through an IDbConnectionFactory.

AdoSemanticMemory

ADO.NET-backed ISemanticMemory. Embeddings are stored as JSON; similarity is computed in-process so the implementation stays provider-agnostic.

AdoTurnStore

Turns persisted in the nao_feedback_turns table (keyed by TurnId).

AuditActionCodec

Codec for the AuditAction discriminated union (encoded as a small JSON DTO).

AuditLogs

Factory helpers for audit log implementations.

DbConnectionFactory

Helpers for building connection factories.

DbEventStore

ADO.NET event store: a single portable table holding ordered JSON events, partitioned by a logical stream name. Provider-agnostic via IDbConnectionFactory.

Dto

CLIMutable DTOs for file persistence and conversion helpers shared by both backends.

EpisodicEvent

Mutating events for episodic memory persistence.

EpisodicMemories

Factory helpers for episodic memory persistence.

EventStore

Factory helpers for event stores.

ExecutionJournals

Factory helpers for execution journal implementations.

FeedbackDb

 Backend factories for , mirroring :
   File baseDir (local JSONL files) | Database factory (any ADO.NET store).

FeedbackEventConsumer

Persists feedback that flows over the event bus and serves the read/command side for a session. It is BOTH an event consumer (the write side — it persists TurnCompleted under each session's folder) AND the provider of the read/command FeedbackService for a session (the query side). The folder is derived from the event's session key by `rootFor`; the backing FeedbackService is the store-level swap point (File today, Database later), so changing where data lands needs no producer change.

FileAuditLog

FileSystem-backed IAuditLog. A single append-style JSON document.

FileEventStore

FileSystem event store: newline-delimited JSON, one event per line.

FileExecutionJournal

FileSystem-backed IExecutionJournal. A single JSON document, newest-first.

FileFeedbackStore

Feedback persisted as JSONL at /feedback.jsonl.

FileJson

Simple file-backed JSON document helpers (whole-file read/write).

FileMemoryStore

FileSystem-backed IMemoryStore. One JSON document per agent under {baseDir}.

FileSemanticMemory

FileSystem-backed ISemanticMemory. One JSON document per agent.

FileTurnStore

Turn records persisted as JSONL at /turns.jsonl.

FSharpJson

Shared System.Text.Json options with full F# support (discriminated unions, options, lists, maps, single-case unions). Used by the event-sourced stores so the rich domain types serialize without bespoke DTOs.

GraphEvent

Mutating events for knowledge-graph persistence.

GraphMemories

Factory helpers for graph memory persistence.

IDbConnectionFactory

Provider-agnostic factory that creates ADO.NET connections. The persistence layer never references a concrete database provider — callers supply a factory backed by any provider (Microsoft.Data.Sqlite, Npgsql, Microsoft.Data.SqlClient, MySqlConnector, ...). This keeps a single unified implementation that works against any ADO.NET-compatible database.

IEventStore

Append-only event log used for event-sourced persistence of the richer stores. The store records each mutating call as a serialized event and replays them in order to rebuild in-memory state, reusing the existing in-memory query logic.

InMemory

Consolidated constructors for the in-memory reference implementations that used to live in Nao.Agents. Nao.Agents now exposes only interfaces/types; hosts and tests pick a concrete store from here (or one of the ADO/file factories) without the agent layer depending on any storage technology.

InMemoryAuditLog

In-memory audit log for testing (moved out of Nao.Agents)

InMemoryEpisodicMemory

In-memory episodic memory implementation

InMemoryEventBus

In-process synchronous bus: publishing awaits every consumer so persistence is deterministic for the desktop app. A failing consumer is isolated (its exception is swallowed) so one bad sink never breaks a producer's turn.

InMemoryExecutionJournal

In-memory execution journal (default implementation)

InMemoryGraphMemory

In-memory knowledge graph implementation

InMemoryMetricsCollector

In-memory metrics collector

InMemorySemanticMemory

In-memory semantic memory implementation

InMemoryStore

In-memory implementation of IMemoryStore for testing and simple scenarios

InMemoryTieredMemory

In-memory implementation of ITieredMemory with promotion, demotion, and eviction

InMemoryToolDiscovery

In-memory implementation of tool discovery with usage-based ranking

InMemoryTracer

In-memory tracer for testing and local development

InMemoryTraceStore

In-memory trace store for testing

InMemoryWorkingMemory

In-memory implementation of working memory

Json

JSON helpers used for serializing collection/value types into TEXT columns and to standalone files. Uses System.Text.Json with CLIMutable DTOs so the same payloads round-trip through both backends.

MemoryStores

Factory helpers for memory store implementations.

MetricsCollectors

Factory helpers for metrics collector persistence.

MetricsEvent

Mutating events for metrics persistence.

PermissionLevelCodec

Codec for the PermissionLevel discriminated union.

Persistence

Builds concrete persistence components for a chosen `PersistenceMode`. The rest of the system depends only on the interfaces; this module is the one place that maps a mode to an implementation, so swapping file for database is a single edit.

PersistenceMode

Selects which durable backend the persistence factories should produce. The host turns this single knob to choose between the two storage categories: file system or database.

PersistentEpisodicMemory

Event-sourced IEpisodicMemory. Delegates all query logic to an in-memory instance rebuilt by replaying the event log, so similarity/graph behaviour is identical to InMemoryEpisodicMemory.

PersistentGraphMemory

Event-sourced IGraphMemory. Query/traversal logic is delegated to an in-memory instance rebuilt by replaying the event log. Relations produced by ExtractRelationsAsync are persisted as concrete AddRelation events so reloads never re-run a (possibly external) extractor.

PersistentMetricsCollector

Event-sourced IMetricsCollector.

PersistentTieredMemory

Event-sourced ITieredMemory. Note: time-relative eviction is re-evaluated at load time when an Evict event replays, which is the desired durability behaviour.

PersistentToolDiscovery

Event-sourced tool discovery. Wraps InMemoryToolDiscovery, persisting recorded invocations so usage-based ranking survives restarts. Tool registration is a passthrough (re-register tools at startup as part of application wiring).

PersistentTracer

Event-sourced ITracer. Span identifiers are generated internally, so this is a self-contained implementation (mirroring InMemoryTracer) that persists each span upsert as a full span snapshot and rebuilds the span table on load.

PersistentTraceStore

Event-sourced ITraceStore.

PersistentWorkingMemory

Event-sourced IWorkingMemory.

Sanitize

Filesystem-safe identifier sanitization.

SemanticMemories

Factory helpers for semantic memory implementations.

SimpleEmbeddingProvider

A simple bag-of-words embedding provider for testing (no external dependencies)

TieredEvent

Mutating events for tiered memory persistence.

TieredMemories

Factory helpers for tiered memory persistence.

Time

ISO-8601 round-trippable timestamp helpers (stored as TEXT for portability).

ToolDiscoveries

Factory helpers for tool discovery persistence.

ToolDiscoveryEvent

Mutating events for tool-discovery persistence. Only usage statistics are durable; the in-process tool registry (populated via Register) is runtime configuration and is not persisted.

Tracers

Factory helpers for tracer persistence.

TraceStoreEvent

Mutating events for trace-store persistence.

TraceStores

Factory helpers for trace store persistence.

WorkingMemories

Factory helpers for working memory persistence.

WorkingMemoryEvent

Mutating events for working memory persistence. (Attention boosts from GetAsync are read-side effects and are not persisted.)

Type something to start searching.