Stash Adds Persistent Memory to AI Agents 🔗
Self-hosted Postgres-backed system consolidates AI agent episodes into structured knowledge with eight-stage pipeline
Stash addresses a core limitation in AI agents: each session starts with no retained knowledge. The system acts as a cognitive layer, storing episodes, facts and working context in Postgres with pgvector for semantic retrieval. It ships as a self-contained binary that includes an MCP server, requiring no cloud services or external dependencies.
Stash addresses a core limitation in AI agents: each session starts with no retained knowledge. The system acts as a cognitive layer, storing episodes, facts and working context in Postgres with pgvector for semantic retrieval. It ships as a self-contained binary that includes an MCP server, requiring no cloud services or external dependencies.
Raw observations enter an eight-stage consolidation pipeline that runs in the background. Episodes are distilled into facts. Facts generate relationships, causal links, goal annotations and pattern detection. The pipeline also identifies repeated failures, verifies hypotheses, resolves contradictions and applies confidence decay to outdated information. Only data since the last run is processed.
Release v0.2.6 significantly expands the consolidate MCP tool. It now returns the complete ConsolidationResult containing 20 fields, including episodes_read, causal_links_found, contradictions_auto_resolved, goals_annotated, failure_patterns_found, hypotheses_auto_confirmed, facts_decayed, llm_calls and duration. Agents can inspect exactly what occurred during consolidation, including any errors.
Setup takes three commands: clone the repository, configure the .env file with model settings, then run docker compose up. Postgres, migrations and the MCP server start together. The project is licensed Apache 2.0 and works with Claude Desktop, Cursor, Continue, Ollama and any MCP-compatible agent.
- Engineers equipping local coding agents with cross-session context
- Researchers tracking long-term AI goal progress and failure patterns
- Developers deploying self-hosted agents without cloud memory services
- mem0 - cloud-first vector memory requiring external APIs unlike Stash
- Zep - chat-oriented memory server with simpler consolidation than Stash's pipeline
- LangMem - LangChain module lacking Stash's standalone MCP server and detailed metrics