Skip to content

memvid/memvid-extension

Repository files navigation

Memvid Code

AI-powered codebase search and Q&A for VS Code, powered by Memvid.

Index your workspace once, then ask questions about your code in natural language.

Features

  • One-Click Indexing - Index your entire workspace with a single button click
  • Incremental Indexing - Only re-index changed files for faster updates
  • Natural Language Q&A - Ask questions about your codebase in plain English
  • Semantic Search - Find code by meaning, not just keywords
  • Sidebar Chat - Interactive chat panel for ongoing conversations
  • Context Menu Actions - Right-click on code to ask questions, explain, or find similar code
  • Cloud Sync - Sync your index to Memvid cloud for backup and sharing
  • Keyboard Shortcuts - Quick access with Cmd+Shift+M (macOS) or Ctrl+Shift+M

Quick Start

  1. Install the extension
  2. Open a workspace/folder
  3. Click "Index Workspace" in the Memvid sidebar
  4. Start asking questions!

Requirements

  • Node.js 18+
  • OpenAI API Key (required for Q&A, optional for local embeddings)

Setup

Set your OpenAI API Key

Add to your VS Code settings (Cmd+,):

{
  "memvid.openaiApiKey": "sk-..."
}

Or set the environment variable:

export OPENAI_API_KEY="sk-..."

Commands

Command Shortcut Description
Memvid: Index Workspace - Index all code files in workspace
Memvid: Ask Question Cmd+Shift+A Ask a question about your code
Memvid: Open Chat Panel Cmd+Shift+M Open the sidebar chat
Memvid: Search Codebase - Search your indexed code
Memvid: Show Index Stats - View index statistics
Memvid: Clear Index - Delete the index and start fresh
Memvid: Sync to Cloud - Sync your index to Memvid cloud
Memvid: Configure Cloud Sync - Set up API key and Memory ID
Memvid: Show Sync Status - View cloud sync status
Memvid: Set OpenAI API Key - Set your OpenAI API key
Memvid: Clear OpenAI API Key - Clear your OpenAI API key
Memvid: Report Issue - Report a bug or issue
Memvid: Ask about this code - Ask a question about selected code (context menu)
Memvid: Explain this code - Get an explanation of selected code (context menu)
Memvid: Find similar code - Find similar code in your codebase (context menu)
Memvid: Add to context - Add selected code to chat context (context menu)

Configuration

Setting Default Description
memvid.indexPath .memvid/codebase.mv2 Path to the index file
memvid.openaiApiKey - OpenAI API key for embeddings and Q&A
memvid.embeddingModel bge-small Embedding model (bge-small, nomic, openai-small)
memvid.llmModel openai:gpt-4o-mini LLM for answering questions
memvid.includePatterns ["**/*.ts", ...] File patterns to index
memvid.excludePatterns ["**/node_modules/**", ...] File patterns to exclude
memvid.autoIndex false Auto-index on workspace open
memvid.maxFileSize 100000 Max file size in bytes to index
memvid.apiKey - Memvid API key for cloud sync
memvid.memoryId - Memory ID for cloud sync
memvid.autoSync false Auto-sync to cloud after indexing
memvid.batchSize 100 Batch size for indexing (higher = faster)
memvid.parallelReads 10 Number of files to read in parallel during indexing
memvid.incrementalIndexing true Enable incremental indexing (only index changed files)
memvid.dashboardUrl https://api.memvid.com Memvid API endpoint URL

Example Questions

  • "How does authentication work in this project?"
  • "Where is the database connection configured?"
  • "What API endpoints are available?"
  • "Explain the user registration flow"
  • "Find all error handling code"

How It Works

  1. Indexing: Memvid reads your source files, generates embeddings, and stores them in a portable .mv2 file
    • Supports incremental indexing to only process changed files
    • Parallel file reading for faster indexing
    • Configurable batch sizes for optimal performance
  2. Search: Uses hybrid BM25 + vector search to find relevant code
  3. Q&A: Retrieves relevant code snippets and uses an LLM to synthesize answers
  4. Cloud Sync: Syncs your index to Memvid cloud using tickets for version control

Cloud Sync

Sync your indexed codebase to Memvid cloud for backup, sharing, and access from other devices.

Setup Cloud Sync

  1. Get your API key from memvid.com/dashboard
  2. Create a Memory in the dashboard to get a Memory ID
  3. Run Memvid: Configure Cloud Sync and enter your credentials
  4. Run Memvid: Sync to Cloud to sync your index

Settings

{
  "memvid.apiKey": "mv2_your_api_key_here",
  "memvid.memoryId": "mem_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "memvid.autoSync": true
}

Privacy

  • Your code stays local - only indexed in a local .mv2 file
  • Search queries are processed locally using embeddings
  • Only Q&A requests are sent to OpenAI (with relevant code context)
  • No telemetry or analytics by default

Development

# Install dependencies
npm install

# Compile TypeScript
npm run compile

# Watch mode
npm run watch

# Package extension
npm run package

Testing

Quick Test

  1. Build and Run:

    npm run compile
    # Press F5 in VS Code to launch extension in development mode
  2. Test Features:

    • Set API key via Memvid: Set OpenAI API Key
    • Index workspace via Memvid: Index Workspace
    • Ask questions via chat panel or Memvid: Ask Question
    • Test context menu actions (right-click on selected code):
      • Ask about this code
      • Explain this code
      • Find similar code
      • Add to context
    • Test cloud sync functionality
    • View index statistics

Troubleshooting

"No documents indexed"

Run Memvid: Index Workspace command first.

"API key not configured"

Set memvid.openaiApiKey in settings or OPENAI_API_KEY env var.

Large workspaces are slow

  • Increase memvid.maxFileSize threshold
  • Add more patterns to memvid.excludePatterns
  • Consider indexing specific folders only

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

Links

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published