Stash — persistent memory layer for AI agents. Episodes, facts, and working context stored in Postgres. MCP server included. Self-hosted, single binary, no cloud required.
$git clone https://github.com/alash3al/stashInstalls into the current project.
Install stash by running `git clone https://github.com/alash3al/stash`, then use it for the current task and follow its documentation at https://github.com/alash3al/stash.
| 1 | # Stash |
| 2 | |
| 3 | **Your AI has amnesia. We fixed it.** |
| 4 | |
| 5 | 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. |
| 6 | |
| 7 | Open source. Self-hosted. Works with any MCP-compatible agent. |
| 8 | |
| 9 | --- |
| 10 | |
| 11 | > **Don't want to self-host?** |
| 12 | > **[usestash.io](https://usestash.io)** is the hosted cloud version — sign in with Google, copy one MCP URL, and you're done. Free to start. |
| 13 | |
| 14 | --- |
| 15 | |
| 16 | ## Quick Start |
| 17 | |
| 18 | ```bash |
| 19 | git clone https://github.com/alash3al/stash.git |
| 20 | cd stash |
| 21 | cp .env.example .env # edit with your API key + model |
| 22 | docker compose up |
| 23 | ``` |
| 24 | |
| 25 | That's it. Postgres + pgvector, migrations, MCP server with background consolidation — all in one command. |
| 26 | |
| 27 | **Next:** [Getting Started guide](docs/GETTING_STARTED.md) — connect your MCP client, run `init` / `remember` / `recall`, and verify everything works. |
| 28 | |
| 29 | **Fully local (no cloud API):** [Ollama setup guide](docs/LOCAL_OLLAMA.md) — host Ollama + Docker Compose, private embeddings and reasoner. |
| 30 | |
| 31 | ## Atlas Cloud |
| 32 | |
| 33 | > [Atlas Cloud](https://www.atlascloud.ai/?utm_source=github&utm_medium=link&utm_campaign=stash) is a full-modal AI inference platform that gives developers a single AI API to access video generation, image generation, and LLM APIs. Instead of managing multiple vendor integrations, you connect once and get unified access to 300+ curated models across all modalities. |
| 34 | > |
| 35 | > Check out Atlas Cloud's coding plan promotion: [https://www.atlascloud.ai/console/coding-plan](https://www.atlascloud.ai/console/coding-plan) |
| 36 | |
| 37 | Stash already supports Atlas Cloud through its OpenAI-compatible API. Set your `.env` like this: |
| 38 | |
| 39 | ```bash |
| 40 | STASH_OPENAI_API_KEY=your-atlas-cloud-api-key |
| 41 | STASH_OPENAI_BASE_URL=https://api.atlascloud.ai/v1 |
| 42 | STASH_EMBEDDING_MODEL=text-embedding-3-small |
| 43 | STASH_REASONER_MODEL=deepseek-ai/DeepSeek-V3-0324 |
| 44 | STASH_VECTOR_DIM=1536 |
| 45 | ``` |
| 46 | |
| 47 | Atlas Cloud works well here because Stash only needs: |
| 48 | |
| 49 | - an embeddings model for vectorization |
| 50 | - a chat-capable reasoning model for consolidation |
| 51 | - an OpenAI-compatible base URL and API key |
| 52 | |
| 53 | See [Getting Started](docs/GETTING_STARTED.md) for a fuller configuration checklist. |
| 54 | |
| 55 | ## MCP Client Setup |
| 56 | |
| 57 | After `docker compose up`, Stash exposes an MCP server over SSE at: |
| 58 | |
| 59 | ``` |
| 60 | http://localhost:8080/sse |
| 61 | ``` |
| 62 | |
| 63 | Point any MCP-compatible client at that URL. Example configs: |
| 64 | |
| 65 | **Cursor** — `~/.cursor/mcp.json` |
| 66 | ```json |
| 67 | { |
| 68 | "mcpServers": { |
| 69 | "stash": { |
| 70 | "url": "http://localhost:8080/sse" |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | ``` |
| 75 | |
| 76 | **Claude Desktop** — `claude_desktop_config.json` |
| 77 | ```json |
| 78 | { |
| 79 | "mcpServers": { |
| 80 | "stash": { |
| 81 | "url": "http://localhost:8080/sse" |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | ``` |
| 86 | |
| 87 | **OpenCode** — `~/.config/opencode/config.json` |
| 88 | ```json |
| 89 | { |
| 90 | "mcp": { |
| 91 | "stash": { |
| 92 | "type": "remote", |
| 93 | "url": "http://localhost:8080/sse", |
| 94 | "enabled": true |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | ``` |
| 99 | |
| 100 | **Windsurf** — `~/.codeium/windsurf/mcp_config.json` |
| 101 | ```json |
| 102 | { |
| 103 | "mcpServers": { |
| 104 | "stash": { |
| 105 | "url": "http://localhost:8080/sse" |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | ``` |
| 110 | |
| 111 | Works with any agent that supports MCP over SSE — Claude Desktop, Cursor, Windsurf, Cline, Continue, OpenAI Agents, Ollama, OpenRouter, Atlas Cloud-backed setups, and more. |
| 112 | |
| 113 | ## What It Does |
| 114 | |
| 115 | Stash is a cognitive layer between your AI agent and the world. Episodes become facts. Facts become relationships. Relationships become patterns. Patterns become wisdom. |
| 116 | |
| 117 | A 9-stage consolidation pipeline turns raw observations into structured knowledge — facts, relationships, causal links, patterns, contradictions, goal tracking, failure patterns, and hypothesis verification. Each stage only processes new data since the last run. |
| 118 | |
| 119 | ## Stash Cloud (Beta — Free) |
| 120 | |
| 121 | A hosted, multi-tenant version of Stash is available at **[usestash.io](https://usestash.io/)** and is currently free while in beta. |
| 122 | |
| 123 | The cloud version is written from scratch — it shares no code with this repository. It is designed from the ground up for scalability, multi-tenancy, and long-term sustainability as a product. Feature set |