opencode-codebase-indexing
v0.4.0
Published
OpenCode plugin for Kilo-style codebase indexing and semantic search.
Maintainers
Readme
OpenCode Codebase Indexing
OpenCode plugin for Kilo-style semantic codebase indexing. It indexes the workspace on startup, keeps the index fresh with a file watcher, stores vectors in Qdrant, and exposes semantic search as OpenCode tools.
Features
- Auto-index on plugin startup.
- Incremental updates on file create, edit, and delete.
- Public statuses:
indexing,complete, anderror. - Qdrant-compatible vector storage.
- Embedding providers:
ollama,openai,openrouter, andcustom. - Custom tools:
semantic_searchcodebase_index_statuscodebase_reindexcodebase_index_config
Local Development
Install dependencies:
npm installBuild:
npm run buildUse the included local plugin shim at:
.opencode/plugins/codebase-indexing.tsOpenCode loads local plugins from .opencode/plugins/ at startup.
Configuration
You can configure indexing globally once, then let every project use the same settings. Each project still gets its own Qdrant collection because the plugin hashes the workspace path into the collection name.
Global config path:
~/.config/opencode/codebase-indexing.jsonOn Windows, that is usually:
C:\Users\<you>\.config\opencode\codebase-indexing.jsonProject overrides are optional:
<project>/.opencode/codebase-indexing.jsonPrecedence is:
environment variables > project config > global config > defaultsExample global config:
{
"enabled": true,
"provider": "openrouter",
"model": "qwen/qwen3-embedding",
"dimension": 1024,
"qdrant": {
"url": "http://localhost:6333"
},
"searchMinScore": 0.6,
"searchMaxResults": 50,
"embeddingBatchSize": 60,
"scannerMaxBatchRetries": 3
}You can also point at a custom shared config file with:
OPENCODE_INDEX_CONFIGSupported providers:
ollamaopenaiopenroutercustom
custom means any OpenAI-compatible embedding endpoint.
Environment Variables
Environment variables override config for secrets and deployment-specific endpoints.
OPENCODE_INDEX_EMBEDDER
OPENCODE_INDEX_MODEL
OPENCODE_INDEX_DIMENSION
OPENAI_API_KEY
OPENCODE_INDEX_OPENROUTER_API_KEY
OPENCODE_INDEX_OPENROUTER_BASE_URL
OPENCODE_INDEX_OPENROUTER_SPECIFIC_PROVIDER
OPENCODE_INDEX_CUSTOM_BASE_URL
OPENCODE_INDEX_CUSTOM_API_KEY
OPENCODE_INDEX_OLLAMA_BASE_URL
OPENCODE_INDEX_QDRANT_URL
OPENCODE_INDEX_QDRANT_API_KEY
OPENCODE_INDEX_SEARCH_MIN_SCORE
OPENCODE_INDEX_SEARCH_MAX_RESULTS
OPENCODE_INDEX_EMBEDDING_BATCH_SIZE
OPENCODE_INDEX_SCANNER_MAX_BATCH_RETRIESDefaults:
- Qdrant URL:
http://localhost:6333 - Ollama base URL:
http://localhost:11434 - OpenRouter base URL:
https://openrouter.ai/api/v1 - Search min score:
0.4 - Search max results:
50 - Embedding batch size:
60 - Scanner max batch retries:
3
Qdrant
Start a local Qdrant instance:
docker run -p 6333:6333 qdrant/qdrantFor hosted Qdrant, set OPENCODE_INDEX_QDRANT_URL and OPENCODE_INDEX_QDRANT_API_KEY.
Attribution
This plugin mirrors Kilo Code's codebase indexing behavior and architecture. Kilo Code is MIT-licensed:
https://github.com/Kilo-Org/kilocode
