Skip to main content

Codebase Indexing

Codebase Indexing helps brewdata understand your code better by creating a searchable database of your workspace. This feature allows the extension to find relevant code snippets based on what you're asking about, even if you don't know exact function names or file locations.

How Codebase Indexing Works

When you enable indexing:

  1. Analyzes your code: The system scans your workspace and identifies meaningful code blocks (functions, classes, methods)
  2. Creates vector representations: Each code block is converted into numerical vectors that capture its meaning
  3. Stores only these vectors: For privacy and security, your actual code is never stored - only mathematical representations
  4. Powers intelligent search: The codebase_search tool uses these vectors to find relevant code

This enables natural language queries like "user authentication logic" or "database connection handling" to find relevant code across your entire project.

Key Benefits

  • Semantic Search: Find code by meaning, not just keywords
  • Enhanced AI Understanding: brewdata can better comprehend and work with your codebase
  • Cross-Project Discovery: Search across all files, not just what's open
  • Pattern Recognition: Locate similar implementations and code patterns

Privacy & Security

Brewdata takes your code privacy seriously:

  • Code privacy: Only vector representations are stored, not your actual code
  • Embeddings are numeric: These mathematical vectors cannot be reversed to reveal your code
  • Secure storage: API keys encrypted in VS Code's secure storage
  • Local option: Use Ollama for completely local processing without sending data externally
  • Access control: Respects existing file permissions

Accessing and Managing Codebase Indexing

You can manage codebase indexing through the brewdata extension:

  1. Click on the Settings icon ()
  2. Navigate to the Authentication tab
  3. Look for the Codebase Indexing section

Indexing Status Indicators

The indexing interface shows you the current status:

  • Not Indexed (Red): Your codebase hasn't been indexed yet
  • Indexing... (Yellow): Currently processing your codebase
  • Synced (Green): Shows how many records have been indexed successfully
Codebase Indexing Settings

Managing Your Index

  • Start Indexing: If your codebase isn't indexed, click this button to begin
  • Resync Index: After making changes to your code, use this to update the index
  • Delete Index: Removes the current index if you need to start fresh
Codebase Indexing Settings

When to Resync

For optimal results, resync your index:

  • After significant code changes
  • When switching branches
  • After adding new features or libraries
  • If you notice brewdata missing context from recent code changes

Privacy and Security

The codebase indexing feature is designed with privacy in mind:

  • Only mathematical vector representations are stored
  • No one (including OpenAI) can reconstruct your code from these vectors
  • You maintain complete control over your index