For development and tests only. In-memory storage for memory of what worked, verified by your own checks, for .NET agents, used through the MAF adapter or with Core directly. Set it up with the quick start in the repository README.
Preview — not production ready. This is a
0.1.0-previewpackage, and it claims no production readiness. Public APIs may change between previews. Read Known limits and documented boundaries before you rely on it.
For development and tests only. Everything these stores hold is lost when the process ends, and none of the PostgreSQL store's guarantees apply: no database-enforced append-only logs, no erasure (so no erasure reach), no backups, no two database roles, no crypto-shredding. Its registration refuses to run in any environment but
Development,TestorTestingunless you override it explicitly.
In-memory storage for AgentExperience.NET, so you can run capture,
finalization, retrieval, injection and reuse feedback without provisioning PostgreSQL. It implements the three core
storage ports: the Experience Record store with its audited lifecycle (InMemoryExperienceRecordStore,
IExperienceRecordStore), word search over that same store (InMemoryExperienceCandidateSource,
IExperienceCandidateSource), and the reuse-feedback ledger (IExperienceReuseFeedbackStore, registered for you; its implementation is
internal). All three are thread-safe.
Requires Microsoft.Extensions.DependencyInjection.Abstractions 10.0.12 and
Microsoft.Extensions.Hosting.Abstractions 10.0.3, or any later release in the same major. Targets
net10.0. No dependency on Core, Npgsql or MAF.
using AgentExperience.Core.DependencyInjection;
using AgentExperience.Storage.InMemory.DependencyInjection;
builder.Services.AddAgentExperienceCore(AgentExperienceDefaults.Sanitization, AgentExperienceDefaults.CaptureLimits);
builder.Services.AddAgentExperienceInMemoryStorageForDevelopment();Under the one-call setup, choose it on the builder instead:
services.AddAgentExperience(...).UseInMemoryStorageForDevelopment(), which makes the same registration.
That is the only registration, and its name says what it is for. It registers the three ports as singletons, sharing
one record store. A candidate source or feedback store you registered first keeps your implementation, but a
different IExperienceRecordStore registered first is refused at registration, because the in-memory candidate
source would find nothing that store writes. Calling it a second time changes nothing; a second call with an options
delegate throws, because the first call's options are already in force.
The environment guard. The stores run only when the environment is Development, Test or Testing
(case-insensitive); Production, Staging, any other name and a blank one are refused. The name is the registered
IHostEnvironment's; with none registered (a plain console app, a test) it is DOTNET_ENVIRONMENT, else
ASPNETCORE_ENVIRONMENT, and with neither set there is nothing to check. A refused environment is caught twice: a
hosted service the registration adds throws from StartAsync, so a Generic Host refuses to start, and resolving any
of the stores throws InvalidOperationException. A demo that really must run elsewhere opts out explicitly:
builder.Services.AddAgentExperienceInMemoryStorageForDevelopment(options => options.AllowProductionEnvironment = true);In tests, construct the record store and candidate source directly; direct construction is not guarded. The
reuse-feedback ledger has no public constructor, so resolve it from the registration. That goes through the
environment guard, so a test process that may run under another environment name (DOTNET_ENVIRONMENT=Staging, say)
opts out as below. ServiceCollection comes from the Microsoft.Extensions.DependencyInjection package, which this
package does not reference:
using AgentExperience.Abstractions;
using AgentExperience.Storage.InMemory;
using AgentExperience.Storage.InMemory.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
var records = new InMemoryExperienceRecordStore();
var candidates = new InMemoryExperienceCandidateSource(records);
using var provider = new ServiceCollection()
.AddAgentExperienceInMemoryStorageForDevelopment(options => options.AllowProductionEnvironment = true) // a test process only
.BuildServiceProvider();
var feedback = provider.GetRequiredService<IExperienceReuseFeedbackStore>();To pair a feedback ledger with a different record store, or to wrap this one, implement IExperienceReuseFeedbackStore
yourself and register it before this call; the registration keeps yours.
It passes the same store conformance suite as the PostgreSQL store: create-only records with IDs unique across every scope; exact-scope reads that reveal nothing about another scope; idempotent lifecycle commits keyed on the event ID; the optimistic revision, prior-status and supersession guards, under concurrency too; ordered, paged history; and feedback idempotency. It validates every request with the PostgreSQL store's own rules, compiled from the same source file, so it refuses exactly the requests that store refuses. The confidence ledger's rules hold as well: an evidence ID is idempotent, independent evidence is counted once per independence key, and an assessment lands once per record.
The reuse-feedback ledger keeps the PostgreSQL ledger's rules. The feedback ID is the idempotency key: an identical
resubmission is AlreadyRecorded, and one differing in any stored field is Conflict with nothing written. A
submission's exposures are sorted by record ID before it is stored or compared, so their order never causes a
conflict. The conflicting stored submission is handed back only when the caller has authority over its scope. Each
submission is recorded atomically under one lock.
Everything is copied on write: a record or feedback submission is stored as a deep copy whose collections are
read-only, so changing your instance afterwards changes nothing stored, and what a read returns is safe to share. As
in PostgreSQL, a record's CreatedAt and UpdatedAt, a lifecycle event's OccurredAt and a submission's
ObservedAt and AttributedAt are stored in UTC, truncated to whole microseconds.
- Search is close to PostgreSQL's, not the same. The candidate source matches words in the task ID, the task
summary and the reflection lesson: text is normalized to Unicode form KC and case-folded, and a word is a run of
letters and digits (a combining mark stays in its word). A query's terms are its distinct words less common English
stopwords (the list PostgreSQL's
englishconfiguration drops) and less terms shorter than two characters, and a record matches only when it contains every term, as PostgreSQL ANDs them; a query with no terms left matches nothing. Only the first 100,000 characters of a record's text are indexed, PostgreSQL's bound. Candidates come strongest first, then by ID, after the scope, status and confidence filters and before the limit. There is no stemming ("invoices" does not match "invoice") and no query syntax, so the two stores can return different records for the same query, and the relevance values still differ from PostgreSQL's: here it is the fraction of the terms a record contains, weighted towards task-summary hits, in (0, 1], so retrieval scores differ between the two stores. - No grants. Sharing grants and the grant access log are not provided: every read behaves as if no grant exists, so a record is readable only in its own exact scope.
- An exact, in-memory embedding index, through the one-call setup only.
UseInMemoryStorageForDevelopment()registers one (exact cosine search, the PostgreSQL index's conditional-write and filter rules), used when the container also has aMicrosoft.Extensions.AIembedding generator.AddAgentExperienceInMemoryStorageForDevelopmentalone registers none. - No deletion, retention or encryption.
- No durability. Restarting the process empties every store.
Move to AgentExperience.Storage.Postgres for
anything you want to keep.