Giới thiệu
Stash là memory layer mã nguồn mở nằm giữa AI agent và thế giới. Nó không thay thế model — nó làm model trở nên liên tục: episodes thành facts, facts thành patterns, patterns thành wisdom.
Claude.ai có memory, ChatGPT có memory — nhưng chỉ làm việc cho chính platform đó, locked vào một model, một công ty. Stash chạy với mọi model (kể cả local), bạn sở hữu data, mã nguồn mở, và đi sâu hơn nhiều so với memory built-in của các platform.
Stash khác RAG thế nào
RAG là một search engine nhanh — đưa cho nó pile of documents, hỏi gì nó search và trả về page liên quan. Nó không nhớ conversation, không học, không biết bạn. Mỗi câu hỏi bắt đầu lại từ đầu.
Stash là một mind that grows — tự học từ mọi conversation, mọi quyết định, mọi success và failure. Nó synthesize raw observation thành facts, kết facts thành knowledge graph, phát hiện contradiction, track goals, và build understanding về bạn theo thời gian.
Dùng cả hai được không? Được. RAG hợp với search documents, Stash hợp với remember experience — hai bài toán khác nhau.
Tính năng chính
Stash xử lý memory qua 9 tầng:
- Episodes — raw observation, append-only.
- Facts — synthesize từ episode bằng LLM.
- Relationships — entity edges từ facts.
- Causal Links — cause-effect pair giữa các facts.
- Patterns — abstract higher-order insight.
- Contradictions — self-correction, confidence decay.
- Goal Inference — facts auto-track theo active goals, progress detected, contradictions surfaced.
- Failure Patterns — phát hiện sai lầm lặp lại, extract failure pattern thành facts mới — agent không lặp lại.
- Hypothesis Scan — evidence mới passively confirm hoặc reject hypothesis đang mở.
Namespaces — memory tổ chức như folder
Không phải tất cả memory đều bằng nhau. Cái agent học về bạn khác cái nó học về project, khác cái nó biết về chính nó. Namespace cho phép tổ chức memory thành các bucket sạch, kiểu folder hierarchy.
📁 /everything
📁 /users/alice # alice là ai, preferences
📁 /projects # tất cả project
📁 /projects/restaurant-saas
📁 /projects/mobile-app
📁 /self # agent self-knowledge
📄 /self/capabilities
📄 /self/limits
📄 /self/preferences
- Recursive reads: đọc từ
/projectstự động bao gồm mọi sub-project. - Precise writes: ghi luôn target chính xác một namespace — không cross-contamination.
- Clean separation: user memory không trộn với project memory.
Cách sử dụng
Setup 3 commands qua Docker Compose (Postgres + pgvector + Stash):
git clone https://github.com/alash3al/stash
cd stash
cp .env.example .env
# edit .env với API key, model preferences và STASH_VECTOR_DIM
docker compose up
⚠️ Set STASH_VECTOR_DIM đúng dimension model embedding trước khi run đầu tiên — sau khi migration không sửa được.
Stash speak MCP native — drop vào Claude Desktop, Cursor, hoặc bất kỳ MCP-compatible client nào.
Dev nên quan tâm vì
Nếu bạn đang build agent có long-running goal, hoặc đang chán việc phải re-explain context mỗi session, đây là alternative open-source cho memory built-in của các platform. Postgres + pgvector là stack quen thuộc, không cần học infra mới.