Stash (GitHub Repo)
Stash is an open-source tool that gives AI agents persistent memory across sessions, solving the problem of LLMs starting every conversation from scratch.
Deep dive
- Uses Postgres with pgvector as the underlying storage engine for vector-based memory retrieval
- Implements an 8-stage consolidation pipeline that progressively refines raw observations: episodes → facts → relationships → patterns → wisdom
- Each consolidation stage only processes new data since the last run, making it efficient for continuous operation
- Includes advanced features like causal link analysis, goal tracking, failure pattern recognition, hypothesis verification, and confidence decay over time
- Runs as an MCP server with background consolidation, meaning the memory processing happens automatically without blocking agent interactions
- Works with a broad range of AI platforms including Claude Desktop, Cursor, Windsurf, Cline, Continue, OpenAI Agents, Ollama, and OpenRouter
- Self-hosted design means you maintain control over your agent's memory data rather than relying on third-party services
- Apache 2.0 licensed, allowing commercial use and modification
Decoder
- MCP: Model Context Protocol, a standard interface that allows AI agents to connect to external tools and data sources
- pgvector: PostgreSQL extension for storing and querying vector embeddings, enabling semantic similarity search
- Consolidation pipeline: Multi-stage process that transforms raw data into increasingly abstract and useful knowledge structures
Original article
Stash
Your AI has amnesia. We fixed it.
Every LLM starts every conversation from zero. Stash gives your agent persistent memory — it remembers, recalls, consolidates, and learns across sessions. No more explaining yourself from scratch.
Open source. Self-hosted. Works with any MCP-compatible agent.
Quick Start
git clone https://github.com/alash3al/stash.git
cd stash
cp .env.example .env # edit with your API key + model
docker compose up
That's it. Postgres + pgvector, migrations, MCP server with background consolidation — all in one command.
What It Does
Stash is a cognitive layer between your AI agent and the world. Episodes become facts. Facts become relationships. Relationships become patterns. Patterns become wisdom.
An 8-stage consolidation pipeline turns raw observations into structured knowledge — facts, relationships, causal links, goal tracking, failure patterns, hypothesis verification, and confidence decay. Each stage only processes new data since the last run.
Works with Claude Desktop, Cursor, Windsurf, Cline, Continue, OpenAI Agents, Ollama, OpenRouter — anything MCP.
Learn More
License
Apache 2.0