Back to browse
GitHub Repository
5 starsTypeScript

Valkey-powered semantic memory for Claude Code sessions

by kaliades·Mar 2, 2026·2 points·1 comment

AI Analysis

●●SolidBig BrainNiche GemShip It

Valkey vector search for Claude Code memory—clever glue, narrow audience.

Strengths
  • Uses Valkey's native FT.SEARCH + HNSW instead of separate vector DB—genuinely elegant.
  • Lifecycle hooks (SessionStart, PostToolUse, Stop) integrate deeply with Claude Code's workflow.
  • Aging pipeline and compression queues show thoughtful long-term memory hygiene.
Weaknesses
  • Requires Valkey 8.0+ with Search module—non-trivial operational overhead for target users.
  • Use case limited to Claude Code; unclear if architecture generalizes to other AI editors.
Target Audience

Claude Code users working on complex, multi-session projects who need persistent architectural context.

Similar To

Continue.dev · Cursor AI · Aider

Post Description

I wanted to explore Valkey's vector search capabilities for AI workloads and had been looking for an excuse to build something with Bun. This weekend I combined both into a memory layer for Claude Code.

https://github.com/BetterDB-inc/memory

The problem: Claude Code has CLAUDE.md and auto memory, but it's flat text with no semantic retrieval. You end up repeating context, especially around things not to do.

BetterDB Memory hooks into Claude Code's lifecycle (SessionStart, PostToolUse, PreToolUse, Stop), summarizes each session, generates embeddings, and stores everything in Valkey using FT.SEARCH with HNSW. Next session, relevant memories surface automatically via vector similarity search.

The interesting technical bit is that Valkey handles all of it - vector search, hash storage for structured memory data, sorted sets for knowledge indexing, lists for compression queues. No separate vector database.

There's also an aging pipeline that applies exponential decay to old memories based on recency, clusters similar ones via cosine similarity, and merges them to keep the memory store from growing unbounded.

Self-hostable with Ollama for embeddings and summarization, or plug in any LLM provider. Runs on Bun, ships as compiled binaries. MIT licensed.

Similar Projects