Skip to content

Dunya-8a/ClaudeContextVault

Repository files navigation

Context Vault

Your persistent memory layer for Claude.

Every conversation with Claude starts fresh. Context Vault fixes that. Save decisions, patterns, and knowledge into searchable scopes that persist across sessions and projects.

The Problem

  • You explain the same project context repeatedly
  • Decisions made in past conversations are forgotten
  • "Maintain a docs file" is manual friction
  • Switching between projects means rebuilding context

The Solution

Context Vault is an MCP server that gives Claude persistent memory:

  • Save naturally - "Remember this pattern for later"
  • Organize by scope - Per-project, per-topic, or personal knowledge
  • Search everything - Full-text search across all your saved context
  • Load on demand - Start a new chat, load your scope, continue where you left off
  • Works everywhere - Any MCP client (Claude Code, Claude Desktop, custom agents)

Quick Start

git clone https://github.com/Dunya-8a/ClaudeContextVault.git
cd ClaudeContextVault
bun install && bun run build

Add .mcp.json to your project (already included), restart Claude Code.

How It Works

1. Save context as you work

"Remember that we're using JWT for auth, not sessions"
"Save this API pattern to my project scope"
"Add this error handling snippet for later"

2. Search when you need it

"Search my project for authentication decisions"
"What patterns have I saved about error handling?"

3. Load context in new chats

"Load my Backend API scope"
"What do you know about this project?"

4. Share across projects

"Search all my scopes for database patterns"
"Import my TypeScript patterns into this project"

Use Cases

Project Memory Save architectural decisions, API designs, and rationale. When you return to a project months later, the context is there.

Personal Patterns Library Build a collection of your preferred approaches: error handling, testing patterns, code styles. Use across all projects.

Learning & Research Save insights, code examples, and links as you learn. Search and resurface them when relevant.

Team Knowledge (via bundles) Export scopes as .vault bundles. Share with teammates or transfer between machines.

Tools Reference (13 tools)

Tool Description
list_scopes List all scopes with item counts
create_scope Create a new scope
get_scope Get scope with items (paginated)
update_scope Update scope name, description, or tags
delete_scope Delete scope and all items
add_item Add note/snippet/link/file
update_item Update item title, content, tags, etc.
delete_item Delete an item
search_scope Full-text search within a scope
search_all Full-text search across all scopes
summarize_scope Get content for summarization
export_scope Export as .vault bundle
import_scope Import from .vault bundle

Item Types

  • note - Free-form markdown (decisions, documentation, ideas)
  • snippet - Code with optional language metadata
  • link - URLs with descriptions
  • file - Local file contents

Content supports full markdown with no size limit.

Configuration

Environment variables (set in .mcp.json):

Variable Default Description
VAULT_DIRECTORY OS-appropriate app data folder Data storage location
LOG_LEVEL info Logging level (debug, info, warn, error)

Architecture

┌─────────────────────────────────────────────────────────┐
│                    Claude Code / Desktop                │
│                      (MCP Client)                       │
└─────────────────────────┬───────────────────────────────┘
                          │ stdio
┌─────────────────────────▼───────────────────────────────┐
│                   Context Vault Server                  │
│                    (MCP Server, Node.js)                │
├─────────────────────────────────────────────────────────┤
│  Tools (13)           │  Services                       │
│  - list_scopes        │  - ScopeService                 │
│  - create_scope       │  - ItemService                  │
│  - add_item           │  - SearchService                │
│  - search_all         │  - BundleService                │
│  - export_scope       │                                 │
│  - ...                │                                 │
├─────────────────────────────────────────────────────────┤
│                     SQLite + FTS5                       │
│              (Full-text search, BM25 ranking)           │
└─────────────────────────────────────────────────────────┘

Stack:

  • Runtime: Node.js 20+
  • Language: TypeScript
  • Database: SQLite via better-sqlite3
  • Search: FTS5 with BM25 ranking
  • Protocol: MCP (Model Context Protocol)
  • Validation: Zod schemas

Data

All data is stored locally:

  • Database: $VAULT_DIRECTORY/vault.db (SQLite with FTS5)
  • Bundles: $VAULT_DIRECTORY/bundles/ (gzip-compressed JSON)

Development

bun run build     # Build
bun run test      # Run 40 tests
bun run typecheck # Type check

"Remember This" Auto-Detection

Context Vault includes instructions (.claude/CLAUDE.md) that enable natural saving:

"Remember that we're using PostgreSQL for this project"
"Save this error handling pattern for later"
"Keep this API design decision"

Claude will automatically detect save intent and use the vault. It will also proactively suggest saving important decisions.

For explicit hook-based detection, see hooks/remember-this.md.

Roadmap

  • "Remember this" auto-detection
  • MCP Resources for automatic context loading
  • Browser extension for saving web content
  • Semantic search with embeddings

License

MIT

About

Personal knowledge base MCP server for Claude Code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors