Skip to content

About

Vendor-neutral memory abstraction layer for Go. Store and retrieve semantic memories across multiple backends with a unified API.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

43 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OmniMemory

Go CI Go Lint Go SAST Docs Docs Visualization License

Vendor-neutral memory abstraction layer for Go. Store and retrieve semantic memories across multiple backends with a unified API.

Features

  • πŸ”Œ Multi-Provider Support: PostgreSQL+pgvector, In-memory, KVS, Twilio Memory API
  • 🎯 Unified API: Same interface across all providers
  • πŸ” Semantic Search: Vector similarity search with configurable embeddings
  • 🏒 Multi-Tenancy: Built-in tenant and subject isolation
  • πŸ“ Memory Scopes: User, agent, tenant, team, session, domain
  • 🏷️ Memory Types: Observation, fact, preference, summary, trait, relationship
  • πŸ”„ Fallback Support: Automatic failover to backup providers
  • βœ… Conformance Tests: Validate provider implementations

Installation

go get github.com/plexusone/omnimemory

Quick Start

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/plexusone/omnimemory"
    "github.com/plexusone/omnimemory/core"
    _ "github.com/plexusone/omnimemory/provider/memory" // Register provider
)

func main() {
    client, err := omnimemory.NewClient(core.ClientConfig{
        Providers: []core.ProviderConfig{
            {Name: core.ProviderNameMemory},
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    defer client.Close()

    ctx := context.Background()

    // Add a memory
    memory, err := client.Add(ctx, &core.AddRequest{
        Context: core.Context{
            TenantID:  "tenant-123",
            SubjectID: "user-456",
        },
        Type:    core.MemoryTypeObservation,
        Content: "User prefers dark mode interfaces",
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Added memory: %s\n", memory.ID)

    // Recall memories
    recalled, err := client.Recall(ctx, &core.RecallRequest{
        Context: core.Context{
            TenantID:  "tenant-123",
            SubjectID: "user-456",
        },
        Query: "user interface preferences",
    })
    if err != nil {
        log.Fatal(err)
    }

    for _, mem := range recalled.Memories {
        fmt.Printf("- %s\n", mem.Content)
    }
}

Providers

Provider Package Use Case
In-Memory provider/memory Testing, development
KVS + SQLite provider/kvs Local persistence, no server
KVS + Redis provider/kvs Distributed, shared state
PostgreSQL provider/postgres Production with pgvector
AWS DynamoDB omni-aws Serverless, auto-scaling
mem0 mem0-go mem0 hosted API
Twilio omni-twilio Twilio Memory API

SQLite (Local Persistence)

Single-file database, no server required. Recommended for local development with persistence.

import (
    "github.com/plexusone/omnimemory"
    "github.com/plexusone/omnimemory/core"
    _ "github.com/plexusone/omnimemory/provider/kvs"
    "github.com/plexusone/omnistorage-core/kvs/backend/sqlite"
)

store, _ := sqlite.New(sqlite.Config{Path: "memories.db"})

client, _ := omnimemory.NewClient(core.ClientConfig{
    Providers: []core.ProviderConfig{
        {Name: core.ProviderNameKVS, Options: map[string]any{
            "store": store,
        }},
    },
})

Redis (Distributed)

Shared state across multiple instances. Good for horizontally scaled applications.

import (
    "github.com/plexusone/omnimemory"
    "github.com/plexusone/omnimemory/core"
    _ "github.com/plexusone/omnimemory/provider/kvs"
    "github.com/plexusone/omnistorage-core/kvs/backend/redis"
)

store, _ := redis.New(redis.Config{Addr: "localhost:6379"})

client, _ := omnimemory.NewClient(core.ClientConfig{
    Providers: []core.ProviderConfig{
        {Name: core.ProviderNameKVS, Options: map[string]any{
            "store": store,
        }},
    },
})

PostgreSQL + pgvector (Production)

Full vector similarity search with HNSW indexing. Recommended for production.

import _ "github.com/plexusone/omnimemory/provider/postgres"

client, _ := omnimemory.NewClient(core.ClientConfig{
    Providers: []core.ProviderConfig{
        {Name: core.ProviderNamePostgres, Options: map[string]any{
            "connection_string": os.Getenv("DATABASE_URL"),
        }},
    },
})

AWS DynamoDB (Serverless)

Fully managed, serverless with automatic scaling and TTL support.

import _ "github.com/plexusone/omni-aws/omnimemory/dynamodb"

client, _ := omnimemory.NewClient(core.ClientConfig{
    Providers: []core.ProviderConfig{
        {Name: core.ProviderNameAWSDynamoDB, Options: map[string]any{
            "table_name":   "omnimemory",
            "region":       "us-east-1",
            "create_table": true, // Auto-create for development
        }},
    },
})

mem0 (Hosted API)

Managed memory service with automatic fact extraction.

import _ "github.com/plexusone/mem0-go/omnimemory"

client, _ := omnimemory.NewClient(core.ClientConfig{
    Providers: []core.ProviderConfig{
        {Name: core.ProviderNameMem0, APIKey: os.Getenv("MEM0_API_KEY")},
    },
})

Multi-Provider with Fallback

client, _ := omnimemory.NewClient(core.ClientConfig{
    Providers: []core.ProviderConfig{
        // Primary: PostgreSQL
        {Name: core.ProviderNamePostgres, Options: map[string]any{
            "connection_string": os.Getenv("DATABASE_URL"),
        }},
        // Fallback: SQLite
        {Name: core.ProviderNameKVS, Options: map[string]any{
            "store": sqliteStore,
        }},
    },
})

Memory Types

Type Description
observation Observed behaviors or interactions
fact Verified pieces of information
preference User preferences
summary Summarized information
trait Personality traits
relationship Relationships between entities

Memory Scopes

Scope Description
user Personal to one user
agent What an agent has learned
tenant Organization-wide shared
team Project/group level
session Single conversation
domain Domain-specific (support, sales)

Documentation

Related Projects

License

MIT License - see LICENSE for details.

About

Vendor-neutral memory abstraction layer for Go. Store and retrieve semantic memories across multiple backends with a unified API.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages