Sign In

@betterdb/memory

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@betterdb/memory

BetterDB Memory for Claude Code — Valkey-powered persistent memory across sessions

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
24
60%
Maintainers
1
Weekly downloads
 
Created
Source

BetterDB Memory for Claude Code

Persistent, semantic memory for Claude Code sessions — powered by Valkey.

Every time you start a new Claude Code session, context is lost. BetterDB Memory automatically captures what you did, embeds it as vectors in Valkey, and retrieves relevant history at the start of each new session.

Quick Start

Prerequisites

  • Bun runtime — required (the CLI and all hooks run on Bun, not Node)
  • Claude Code installed
  • Valkey 8.0+ with the Search module

Install

# Bun must be installed first — npx delegates to it
npx @betterdb/memory install

This will:

  • Compile native hook binaries to ~/.betterdb/bin/
  • Register 4 lifecycle hooks with Claude Code
  • Register the MCP server for mid-conversation tools
  • Create the Valkey search index

How It Works

HookWhat it does
SessionStartRetrieves relevant memories via vector search, injects as context
PostToolUseRecords every tool call to a temp JSONL file
StopSummarizes the session, embeds it, stores in Valkey
PreToolUseSurfaces file-specific history when accessing known files

MCP Tools

Claude can use these mid-conversation:

  • search_context — Semantic search over past sessions
  • store_insight — Save a decision, pattern, or warning
  • list_open_threads — Show unresolved items
  • forget — Delete a specific memory

CLI Commands

npx @betterdb/memory install    # Set up hooks + MCP server
npx @betterdb/memory status     # Check health
npx @betterdb/memory uninstall  # Remove everything
npx @betterdb/memory maintain   # Run aging/compression manually

Configuration

Via environment variables or ~/.betterdb/memory.json:

VariableDefaultDescription
BETTERDB_VALKEY_URLredis://localhost:6379Valkey connection URL
BETTERDB_EMBED_MODELauto-detectEmbedding provider
BETTERDB_SUMMARIZE_MODELauto-detectSummarization provider
BETTERDB_EMBED_DIM1024Embedding dimensions
BETTERDB_MAX_CONTEXT_MEMORIES5Memories injected per session
BETTERDB_CONTEXT_FILE.betterdb_context.mdContext injection file

License

MIT

Keywords

claude-code

FAQs

Package last updated on 02 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts