Skip to content

promptrails/memoryrails

Repository files navigation

MemoryRails

Agent memory management for Go LLM applications. Pluggable embeddings + vector stores.

Go Reference CI Go Report Card

mgr := memoryrails.NewManager(embedder, store)

// Store a memory
mgr.Remember(ctx, "User prefers dark mode", memoryrails.TypeFact, nil)

// Recall relevant memories
results, _ := mgr.Recall(ctx, "What are the user's preferences?", memoryrails.RecallOptions{Limit: 5})

Install

go get github.com/promptrails/memoryrails

Features

  • 5 memory types — conversation, fact, procedure, episodic, semantic
  • 8 embedding providers — OpenAI, Ollama, Cohere, Gemini, Voyage AI, Fireworks, OpenRouter, Amazon Bedrock
  • Pluggable vector stores — in-memory (included), pgvector, SQLite, Qdrant, Amazon OpenSearch
  • Importance scoring — time-based decay + access frequency boost
  • Semantic search — cosine similarity with configurable threshold
  • Access tracking — automatic retrieval count and timestamp
  • Framework independent — works with any Go LLM library

Embedding Providers

Provider Package Models
OpenAI embedders/openai text-embedding-3-small (1536d), text-embedding-3-large (3072d)
Ollama embedders/ollama nomic-embed-text, mxbai-embed-large, all-minilm
Cohere embedders/cohere embed-v4.0 (1024d)
Gemini embedders/gemini text-embedding-004 (768d)
Voyage AI embedders/voyage voyage-3 (1024d)
Fireworks embedders/fireworks nomic-embed-text-v1.5 (768d), gte-large, bge-large-en-v1.5
OpenRouter embedders/openrouter Routes to any OpenRouter-supported embedding model
Amazon Bedrock embedders/bedrock Titan Text v2 (1024d, configurable), Titan v1 (1536d), Cohere Embed v3 (1024d) — AWS SigV4

Vector Stores

Store Package Use Case
In-Memory stores/inmemory Development, testing, small scale (< 10K)
PostgreSQL + pgvector stores/pgvector Production, HNSW indexing, GORM
SQLite stores/sqlite Edge, CLI tools, single-machine
Qdrant stores/qdrant High-performance vector DB, REST API
Amazon OpenSearch stores/opensearch AWS-managed k-NN search; Serverless (aoss) or domains (es), AWS SigV4

Documentation

Getting Started Installation and quick start
Embedders Embedding provider configuration
Stores Vector store backends
Scoring Importance decay and retrieval ranking

Full docs: promptrails.github.io/memoryrails

Part of the PromptRails AI Toolkit

  • LangRails — Unified LLM provider interface
  • GuardRails — Content safety scanning
  • MemoryRails — Agent memory management
  • MediaRails — AI media generation

License

MIT — PromptRails

About

Agent memory management for Go LLM applications

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors