Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Code Base Indexing Setup

Run

podman compose up -d

Test

curl http://localhost:6333/collections
curl http://localhost:11435/api/tags

Setup Embedding Model

Pull the embedding model into Ollama:

podman exec roo-ollama ollama pull nomic-embed-text

Verify it works:

curl http://localhost:11435/api/embed \
  -d '{"model":"nomic-embed-text","input":"test"}'

You should receive a JSON response with an embeddings array.

Configure Roo Code

In Roo Code → Codebase Indexing settings, use:

Setting Value
Embedder Provider Ollama
Base URL http://localhost:11435
Model nomic-embed-text
Qdrant URL http://localhost:6333
Qdrant API Key (leave blank)
Search score threshold (leave default)
Max search results (leave default)

If you are using OpenCode

Important correction

For OpenCode, use the open-codebase-index plugin. It can use your external Ollama instance at http://localhost:11435, but it does not store its index in Qdrant. Its documented storage is a local index inside .opencode/index/ using SQLite, usearch vectors, and BM25.

So:

  • ✅ Ollama at http://localhost:11435
  • ❌ Qdrant at http://localhost:6333 is not used by this OpenCode plugin
  • ✅ Index stored locally in your repository at .opencode/index/

These instructions assume that is the “OpenCode” you mean.

1. Verify Ollama on port 11435

Run:

curl http://localhost:11435/api/tags

You should receive JSON listing models. If this fails, OpenCode cannot reach your embedding service yet.

2. Pull an embedding model into that Ollama instance

A good starting point:

OLLAMA_HOST=http://localhost:11435 ollama pull nomic-embed-text

Then confirm it is installed:

curl http://localhost:11435/api/tags

You should see nomic-embed-text in the returned model list.

If you want a higher-quality local embedding model instead:

OLLAMA_HOST=http://localhost:11435 ollama pull qwen3-embedding:0.6b

3. Test embeddings directly

This validates that the running endpoint and model both work:

curl -X POST http://localhost:11435/api/embed \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nomic-embed-text",
    "input": "Test codebase embedding"
  }'

A successful response includes an embeddings array.

4. Install the OpenCode index plugin

From the root of the repository you want indexed:

npm install open-codebase-index

Then add the plugin to the repository’s opencode.json file:

{
  "plugin": ["open-codebase-index"]
}

If opencode.json already exists, add open-codebase-index to its existing plugin array rather than replacing the rest of the configuration.

5. Add the project indexing configuration

Create the directory:

mkdir -p .opencode

Create .opencode/codebase-index.json with this content:

{
  "embeddingProvider": "ollama",
  "embeddingModel": "nomic-embed-text",
  "scope": "project",
  "indexing": {
    "autoIndex": false,
    "watchFiles": true,
    "requireProjectMarker": true
  },
  "embedding": {
    "batch": {
      "maxBatchItems": 4,
      "maxBatchTokens": 16384
    }
  },
  "search": {
    "maxResults": 20,
    "minScore": 0.1
  }
}

6. Point OpenCode’s Ollama provider at port 11435

The plugin documentation confirms the Ollama provider, but its shown configuration does not document a custom Ollama base URL. Therefore, the reliable method is to make the process that launches OpenCode see your non-default endpoint via OLLAMA_HOST.

macOS/Linux:

export OLLAMA_HOST=http://localhost:11435
opencode

PowerShell:

$env:OLLAMA_HOST = "http://localhost:11435"
opencode

To make that permanent, put the environment variable in the shell profile or service configuration that you use to launch OpenCode.

7. Start OpenCode and build the index

Launch OpenCode from the repository root, then run:

/status

Confirm it recognizes the indexer and Ollama provider. Then run:

/index

The plugin creates the project index under:

.opencode/index/

Future indexing is incremental when file watching is enabled.

8. Check that search works

Ask OpenCode something about the repository, for example:

Where is authentication checked before an API request?

Or use its codebase tools such as codebase_search, codebase_context, or implementation_lookup.

If you change models later

Do a forced rebuild, because changing models changes embeddings and may change vector dimensions:

/index --force

About your Qdrant instance

Your Qdrant server at http://localhost:6333 can stay running, but the current open-codebase-index configuration supports its own local vector storage rather than Qdrant. It will not connect to or populate Qdrant.

The plugin configuration reference is here: open-codebase-index configuration.

About

A code-base index example that you can run locally for your interp interpreter.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors