Nothing kills developer momentum quite like watching Roo Code freeze at 60 / 3483 blocks because a cloud API slapped you with an HTTP 429: Too Many Requests error.
Cloud-based embedding models like Gemini or OpenAI are convenient to set up, but when indexing an entire codebase, they quickly introduce rate limits, slow exponential backoffs, recurring token costs, and privacy concerns regarding proprietary code leaving your local machine.
The fix? A local, zero-cost, privacy-first semantic search pipeline using Ollama, the high-performance BAAI/bge-m3 embedding model, and Qdrant.
Here is a complete, step-by-step guide to setting up instantaneous codebase indexing in Roo Code.
Why the BGE-M3 + Qdrant Stack Wins
Semantic search in an IDE agent requires more than standard string matching (grep). It chunks functions, hooks, and types into high-dimensional vector representations so the LLM can resolve abstract natural-language requests—like "where do we handle session refresh tokens?"—into concrete file locations.
| Feature | Cloud APIs (Gemini Free / OpenAI) | Local Ollama (bge-m3) |
|---|---|---|
| Indexing Speed (~1,000 blocks) | 15–20 minutes (rate-limit stalls) | 15–30 seconds |
| Rate Limits | Stalls every 60 blocks (HTTP 429) | Zero (completely local) |
| Context Window | 2,048 tokens | 8,192 tokens (full components & files) |
| Cost & Privacy | Pay-per-token; code leaves machine | 100% free, offline, and private |
| Vector Storage | Ephemeral or remote cloud | Persistent, low-latency Qdrant index |
What Makes BGE-M3 Special?
-
Massive 8,192-Token Context Window: Lightweight embedding models (like
all-MiniLM-L6-v2) truncate inputs after 256 or 512 tokens, slicing large functions and interfaces in half.bge-m3embeds extensive React components, API routes, and type schemas in a single cohesive vector. -
1024-Dimension Semantic Resolution: Trained on massive multilingual and technical corpora,
bge-m3understands code semantics and structural syntax with exceptional accuracy. - CPU and GPU Efficient: Despite its 567M parameter density, it indexes repositories in seconds even on mid-tier modern processors.
Prerequisites
Before getting started, ensure you have:
- VS Code with the Roo Code extension installed.
- Ollama installed and running on your system (Download Ollama).
- An active Qdrant instance (either a free Qdrant Cloud cluster or a local Docker instance running on
localhost:6333).
Step 1: Pull the BGE-M3 Model in Ollama
Open your terminal and download the bge-m3 model:
ollama pull bge-m3
Verify that the model downloaded successfully and Ollama's local server is responding:
ollama list
curl http://localhost:11434/api/tags
You should see bge-m3 (~1.2 GB) in your list of local models.
Step 2: Prevent Index Bloat with a .rooignore File
By default, Roo Code scans build outputs, cache directories, and package lockfiles. A single package-lock.json or pnpm-lock.yaml can contain tens of thousands of lines of metadata, bloating your index by thousands of unnecessary blocks and slowing down search.
Create a .rooignore file in your project's root directory:
# Package Managers & Dependencies
node_modules/
package-lock.json
pnpm-lock.yaml
yarn.lock
bun.lockb
# Build Outputs & Framework Caches
.next/
out/
build/
dist/
.vercel/
.turbo/
# Static Assets & Media
public/
*.svg
*.png
*.jpg
*.jpeg
*.webp
*.ico
# Version Control & Secrets
.git/
.env*
*.log
# Types & Caches
*.tsbuildinfo
next-env.d.ts
Tip: Adding this file typically cuts a standard Next.js or React repository from 3,500+ blocks down to 300–800 blocks of actual application logic.
Step 3: Clear Stale Vector Data (Crucial Step!)
If you previously started indexing using Gemini (3072 dimensions) or OpenAI (1536 dimensions), your existing Qdrant collection is locked to that vector size. Pushing 1024-dimension vectors from bge-m3 without wiping will cause dimension mismatch errors.
- Open VS Code and open the Roo Code panel.
- Navigate to the Codebase Indexing configuration screen.
- Click Stop Indexing if a previous run is frozen.
- Expand Advanced Configuration.
- Click Clear Index Data.
This cleanly purges the old collection and resets the indexing status.
Step 4: Configure Roo Code Settings
In the Codebase Indexing settings pane, enter the following parameters:
-
Embedder Provider:
Ollama -
Ollama Base URL:
http://localhost:11434 -
Model:
bge-m3 -
Model Dimension:
1024(Make sure this is set to 1024, not 1536 or 3072) -
Qdrant URL: Your Qdrant endpoint (e.g.,
https://xxxx.eu-west-1-0.aws.cloud.qdrant.io:6333orhttp://localhost:6333) - Qdrant API Key: Your Qdrant authentication token (leave blank if running local unauthenticated Qdrant)
Step 5: Save and Start Indexing
- Check the box for Enable Codebase Indexing.
- Click Save in the bottom-right corner.
Watch the progress bar: instead of stalling every 60 blocks, the counter will continuously progress from 0 / 840 to completion in 15 to 30 seconds.
Once complete, the status indicator turns green:
Status:
Indexed - File watcher started.
What Happens Next?
- Automatic Incremental Indexing: The active file watcher monitors your workspace. When you write new code or edit existing files, Roo Code re-indexes only the modified files through Ollama in milliseconds.
- Instant Context for Roo Code: When you ask Roo Code questions like "where do we handle payment webhooks?" or "refactor the authentication middleware", it queries Qdrant using vector similarity to retrieve the exact files needed before generating code.
- Zero Monthly Bills: You get infinite embeddings and searches without consuming API credits or depending on cloud connectivity.

Top comments (0)