Portal Community

Storage Architecture

SQL Server

Stores episodic memory (conversation episodes), procedural memory (procedure steps), and agent configuration. Managed via EF Core with multi-tenant global query filters.

SQL Tables →

Vector Database

Stores semantic memory (knowledge chunk embeddings). Qdrant for production, PGVector for PostgreSQL-first teams. One collection per agent.

Vector Storage →

In-Process RAM

Working memory exists only in RAM for the duration of a single request. Rebuilt from the other stores on every turn. Never persisted to disk.

Working Memory Storage →

Storage Map

Memory TypeStorage SystemTable / CollectionPlugin
WorkingIn-process RAMN/ACore (no plugin needed)
EpisodicSQL ServerOctopus_Episodes, Octopus_EpisodeMessagesSqlServerPlugin
SemanticQdrant or PGVectoragent_{agentId} collectionSemanticKernelPlugin
ProceduralSQL ServerOctopus_ProceduresSqlServerPlugin
Agent ConfigSQL ServerOctopus_Agents, Octopus_AgentMemoryConfigSqlServerPlugin

SqlServerPlugin Responsibilities

The SqlServerPlugin manages all SQL-backed storage. It registers EF Core services, runs migrations on startup, and applies multi-tenant query filters globally:

public class SqlServerPlugin : IOctopusPlugin
{
    public void OnRegister(IServiceCollection services, OctopusConfig config)
    {
        services.AddDbContext<OctopusDbContext>(opt =>
            opt.UseSqlServer(config.SqlConnectionString,
                sql => sql.MigrationsAssembly("BizFirst.Octopus.SqlServerPlugin")));

        services.AddScoped<IEpisodicMemoryStore,  EpisodicMemoryStore>();
        services.AddScoped<IProceduralMemoryStore, ProceduralMemoryStore>();
        services.AddScoped<IAgentStore,            AgentStore>();
    }

    public async Task OnStartAsync(IServiceProvider sp, CancellationToken ct)
    {
        // Apply pending EF Core migrations on startup
        var db = sp.GetRequiredService<OctopusDbContext>();
        await db.Database.MigrateAsync(ct);
    }
}

Key Design Decisions

DecisionRationale
SQL for relational + vector DB for embeddingsRelational queries (by userId, agentId, date) are naturally SQL; vector similarity is naturally a vector store concern
One vector collection per agentEnforces knowledge isolation without any query-time filtering overhead
EF Core global query filters for TenantIdEvery SQL query automatically scoped to the tenant — no risk of cross-tenant data leakage
Soft delete before hard purgeEpisodic memory is soft-deleted at TTL expiry; a background job hard-purges after a grace period
Schema migrations in plugin assemblySelf-contained — deploying the plugin is sufficient to create all required tables