Open-source toolkit for AI memory that scales
FreeFreeFree tier
About Open-source toolkit for AI memory that scales
Lithium is an open-source storage engine designed for AI agents to navigate, store, and retrieve structured data with precision. Built on PostgreSQL's ltree extension, it offers hierarchical, versioned, and scoped data management. Unlike vector databases or graph traversals, Lithium provides deterministic, index-backed queries (e.g., 'give me everything under engineering.auth') with built-in immutable versioning. It includes a TypeScript API with Result types for error handling, MCP (Model Context Protocol) integration for AI tools like Claude Code, Cursor, and Windsurf, and hooks for extensibility. The toolkit supports fast setup via npx and manual installation, making it ideal for AI applications requiring exact structured memory.
Key Features
Hierarchical tree structure using PostgreSQL ltree
Built-in immutable versioning for entries
Scoped retrieval: get all entries under a path in one indexed lookup
Deterministic queries – no fuzzy or similarity search
TypeScript API with Result<T,E> – no thrown exceptions
MCP (Model Context Protocol) integration for AI tools
Hooks system for custom functionality
Runs on existing PostgreSQL – no separate service
Supports clusters (nodes) and versioned entries
Zero-cost setup with npx @lithium-ai/kit init
Pros & Cons
Pros
- Deterministic and exact retrieval – no approximation
- Runs on existing PostgreSQL infrastructure – no extra services
- Built-in immutable versioning ensures data history
- Fast ltree index-backed queries even at scale
- MCP support enables easy integration with popular AI tools
- TypeScript Result types provide explicit error handling
- Open-source and free to use
Cons
- Not suitable for fuzzy or similarity-based search
- Requires PostgreSQL with ltree extension – not a standalone solution
- Relatively new – limited community and documentation compared to graph/vector DBs
- No built-in support for graph traversal or vector embeddings
- Currently focused on structured hierarchical data – may not fit all AI memory needs
Best For
Storing and retrieving structured memory for AI agentsProviding deterministic context for AI coding assistants (Claude Code, Cursor, Windsurf)Managing hierarchical data (e.g., project structures, knowledge bases) with versioningReplacing vector or graph databases for exact, scoped lookups in AI pipelinesBuilding persistent, versioned state for AI agents
FAQ
What is Lithium?
Lithium is an open-source storage engine for AI agents to navigate, store, and retrieve structured data. It uses PostgreSQL's ltree for hierarchical, versioned, and scoped data management.
How does Lithium compare to vector databases?
While vector databases use similarity search, Lithium provides deterministic, indexed lookups. It is faster for exact scoped queries (e.g., 'get everything under engineering.auth') and runs on your existing Postgres, no separate service.
How do I get started?
Quick start: run 'npx @lithium-ai/kit init --adapter postgres' to set up, then serve with 'claude mcp add lithium -- npx @lithium-ai/kit serve'. Manual installation is also available via npm packages.
Does Lithium support versioning?
Yes, entries are automatically versioned – each update creates a new immutable version, providing a full history.
Can I use Lithium with non-Claude AI tools?
Yes, Lithium supports any MCP-compatible client. You can configure it with Cursor, Windsurf, or other MCP clients using a standard JSON config.