Skip to content
tinAI
Go back

Stash: memory layer mã nguồn mở để AI agent có "cuộc đời"

Bài gốc: Stash — Your AI has amnesia. We fixed it.

Tác giả: alash3al

Ngày đăng: Dịch ngày:

TL;DR

Stash là memory layer mã nguồn mở dùng được với mọi AI agent qua MCP. Khác RAG ở chỗ Stash tự extract episode thành fact, build knowledge graph, track goals và phát hiện failure pattern — agent không lặp lại sai lầm cũ. Setup 3 commands trên Postgres + pgvector.

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:

  1. Episodes — raw observation, append-only.
  2. Facts — synthesize từ episode bằng LLM.
  3. Relationships — entity edges từ facts.
  4. Causal Links — cause-effect pair giữa các facts.
  5. Patterns — abstract higher-order insight.
  6. Contradictions — self-correction, confidence decay.
  7. Goal Inference — facts auto-track theo active goals, progress detected, contradictions surfaced.
  8. 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.
  9. 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

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.


Read Original (EN) Quay lại Newsletter