# Stash

> Persistent memory layer for AI agents that stores episodes, facts, and working context in Postgres with an MCP server included. Self-hosted, open source, works with any MCP-compatible agent.

Stash is an open-source, self-hosted persistent memory layer for AI agents, solving the problem of LLMs starting every conversation from zero. It stores episodes, facts, and working context in Postgres with pgvector, and ships with a built-in MCP server. An 8-stage consolidation pipeline transforms raw observations into structured knowledge — covering facts, relationships, causal links, goal tracking, failure patterns, hypothesis verification, and confidence decay.

- **Persistent Memory** — *Gives AI agents memory that survives across sessions, so users never have to re-explain context.*
- **8-Stage Consolidation Pipeline** — *Automatically turns raw observations into structured knowledge: facts, relationships, causal links, goals, failure patterns, hypotheses, and confidence decay.*
- **MCP Server Included** — *Ships with a built-in Model Context Protocol server; works with Claude Desktop, Cursor, Windsurf, Cline, Continue, OpenAI Agents, Ollama, OpenRouter, and any MCP-compatible agent.*
- **Self-Hosted & Single Binary** — *Runs entirely on your own infrastructure with no cloud dependency; deploy with a single `docker compose up` command.*
- **Postgres + pgvector Backend** — *Uses battle-tested Postgres with the pgvector extension for semantic storage and retrieval.*
- **Background Consolidation** — *Each pipeline stage only processes new data since the last run, keeping memory fresh and efficient.*
- **Open Source (Apache 2.0)** — *Freely available to use, modify, and distribute under the Apache License 2.0.*
- **Quick Setup** — *Clone the repo, copy `.env.example`, add your API key and model, then run `docker compose up` — migrations and all services start automatically.*

## Features
- Persistent cross-session memory for AI agents
- 8-stage knowledge consolidation pipeline
- Built-in MCP server
- Postgres + pgvector storage backend
- Self-hosted, no cloud required
- Single binary deployment
- Docker Compose setup
- Background consolidation processing
- Fact and relationship extraction
- Causal link tracking
- Goal tracking
- Failure pattern recognition
- Hypothesis verification
- Confidence decay
- Works with Claude Desktop, Cursor, Windsurf, Cline, Continue, OpenAI Agents, Ollama, OpenRouter

## Integrations
Claude Desktop, Cursor, Windsurf, Cline, Continue, OpenAI Agents, Ollama, OpenRouter, Postgres, pgvector, Docker

## Platforms
WINDOWS, API, CLI

## Pricing
Open Source

## Version
v0.2.6

## Links
- Website: https://alash3al.github.io/stash/
- Documentation: https://alash3al.github.io/stash/
- Repository: https://github.com/alash3al/stash
- EveryDev.ai: https://www.everydev.ai/tools/stash-ai-memory
