Cortex

SQLite Store

Lightweight SQLite backend using Grove ORM with sqlitedriver.

The SQLite store (store/sqlite) provides a lightweight, embedded backend using the Grove ORM with sqlitedriver. It implements the full store.Store composite interface and is well-suited for single-process deployments, local development, and testing.

Setup

import (
    "github.com/xraph/grove"
    "github.com/xraph/grove/drivers/sqlitedriver"
    "github.com/xraph/cortex/store/sqlite"
)

// Open a SQLite connection via Grove's sqlitedriver.
db := grove.Open(sqlitedriver.New("cortex.db"))

s := sqlite.New(db)
if err := s.Migrate(ctx); err != nil {
    log.Fatal(err)
}

Internals

AspectDetail
DriverGrove ORM with sqlitedriver (SQLite)
MigrationsGrove migration orchestrator with programmatic migrations
TransactionsDatabase-level transactions via SQLite

Tables

The SQLite store creates the same tables as the PostgreSQL store:

TableEntity
cortex_agentsAgent configs
cortex_skillsSkills
cortex_traitsTraits
cortex_behaviorsBehaviors
cortex_personasPersonas
cortex_runsRuns
cortex_stepsSteps
cortex_tool_callsTool calls
cortex_memoriesMemories
cortex_checkpointsCheckpoints

Composite store interface

The SQLite store implements all 8 sub-interfaces:

type Store interface {
    agent.Store
    skill.Store
    trait.Store
    behavior.Store
    persona.Store
    run.Store
    memory.Store
    checkpoint.Store

    Migrate(ctx context.Context) error
    Ping(ctx context.Context) error
    Close() error
}

Usage with engine

eng, err := engine.New(
    engine.WithStore(s),
)

When to use

  • Local development -- single-file database, no server process required.
  • Testing -- fast, isolated store with no external dependencies.
  • Embedded / single-process -- CLI tools, desktop apps, or edge deployments.
  • CI pipelines -- deterministic tests without a database container.

On this page