- AST-aware chunking for JavaScript/TypeScript (+ 25 languages via tree-sitter: Python, Java, Go, C#, Kotlin, Swift, Rust, Ruby, PHP, SQL, YAML, TOML, XML, HTML, CSS, JSON, Markdown, Bash, Dockerfile, PowerShell, INI, TeX, Razor, SLN, StarLIMS SSL)
- Document chunking for PDF, DOCX, DOC, Excel
- Hybrid keyword + vector search with configurable fusion weights
- LanceDB vector storage with incremental indexing
- Background indexing with file watching (chokidar-based live re-indexing)
- Configurable embeddings with proxy support (custom HTTP client with connection pooling, raw TCP/TLS sockets, NO_PROXY matching)
- API key auto-resolution from OpenCode provider config
- Manifest schema versioning with auto-rebuild
- Runtime overrides system (no JSON editing required)
- OpenCode plugin integration with
search_semantic,get_file_skeleton,find_usages,describe_imagetools - TUI settings menu with model picker for embedding and description providers
- RAG-backed read tool with related code enrichment
- Install/uninstall scripts for global setup
- Workspace-native bootstrap (
opencode-rag init) - Web UI with chunk browser, file explorer, and evaluation dashboard
- MCP server (
opencode-rag mcp) — exposesearch_semantic,get_file_skeleton,find_usages,describe_imagevia stdio MCP for any MCP-compatible client - Programmatic TypeScript API (
search(),indexWorkspace(),getContext(),validateConfig(),scanWorkspace(),createBackgroundIndexer(),getIndexStatusSummary()) - Retrieval debug surfaces (explain why files/chunks were returned) —
SearchExplanationtype,getMatchedTerms(),--explainCLI flag,explainparam on API calls - Image description via vision LLMs —
describe_imagetool in OpenCode plugin, MCP server, and CLI; 4 vision providers (Ollama, OpenAI, Anthropic, Gemini); image resizing via sharp; image chunking with searchable vector chunks - Evaluation framework — session event capture, token usage analysis, RAG impact measurement, cross-session comparison (
eval:sessions,eval:analyze,eval:comparecommands) - Multi-provider description generation — Anthropic Claude, Google Gemini, and OpenAI-compatible providers with batch description support
- Self-updater via npm — check/install updates via
npm update -g opencode-rag-plugin - Provider health checking — validates all configured providers (embedding, description, image_description) at startup
- Enhanced CLI — 16 commands:
index,query,show,dump,status,init,clear,list,eval,describe-image,mcp,ui,update, plus progress tracking - Pluggable chunker loading — dynamic import of custom chunker modules from config
- In-memory vector store — ephemeral alternative to LanceDB for testing/embedding
- Lock-file concurrency protection for index passes
- Data-loss detection in indexing pipeline
- Batch description generation with failure tracking and retry
- Live terminal progress table with pipeline breadcrumbs (Chunking → Description → Embedding → Finished)
- Documentation mode progress tracking (
doc-mode-progress.json) - SSL/STARLIMS chunker for procedural script files
- Cohere embedding provider with health check
- Config validation at startup — validate
opencode-rag.jsonschema with clear error messages - Better ranking/diversity for
chat.messagefile suggestions
- Git-aware incremental indexing —
git diff --name-onlysince last indexed commit, skips unchanged tracked files - LLM-based re-ranking layer (cross-encoder or lightweight model after vector search)
- Query rewriting / multi-variant expansion
- Context window optimization (dedup, merge adjacent chunks)
- Persistent query cache (disk-based, not just in-memory)
- Cross-file relationship graph (imports, call graph)
- Dependency-aware search
- Multi-repo / cross-workspace search
- IDE context awareness (current file, cursor position)
- Prompt template customization
- Memory / persistent context across sessions
- Code execution-aware retrieval
- Semantic refactoring assistant
- Agent-based code navigation
- Richer non-code / multimodal support (diagrams, API specs, JSON schemas, YAML configs)
- Access control (per-folder permissions, sensitive file exclusion)
- Index export/import — serialize the index for CI/CD, team sharing, or backup/restore
- Performance benchmark suite — measure index time, query latency, memory usage across repo sizes
Improve retrieval quality by expanding shorthand queries into multiple semantic variants before searching.
Build a structural understanding of the codebase: function call graphs, import dependencies, class hierarchies. Enables "where is this function used?" and "what depends on this module?" queries.
After vector search, use a cross-encoder or lightweight LLM to re-rank results. Drastically improves precision for ambiguous queries.
Prevent token overload by deduplicating similar chunks, merging adjacent chunks, and ranking by diversity. Currently maxContextChunks limits the count, but no quality filtering is applied.
Integrate with the editor's current context: active file, cursor position, and selected code. Boost retrieval relevance by weighting results near the user's current focus.
Per-folder permissions and sensitive file exclusion for enterprise or multi-user environments.
Persist query→results on disk (not just in-memory session cache) so repeated queries across restarts are instant.
Initial document support already in place via extracted text for PDF, DOCX, DOC, and Excel. Future work: diagrams, JSON schemas, API specs, YAML configs.
Allow users to customize how retrieved context is formatted and injected into LLM prompts. Currently uses a fixed pattern.
Quantized embeddings to reduce storage, pruning stale entries, garbage collection on unused chunks.
Retain coding patterns, project conventions, and past decisions across sessions. Inspired by opencode-mem: store structured memories in a local vector DB, auto-capture insights, inject relevant memories into future prompts.
Support indexing and searching across multiple repositories. Enable cross-project queries for monorepo setups or microservice architectures. Could use per-workspace vector shards with a unified query layer.
Serialize the full index (vectors + metadata + keyword index) to a portable format. Enables: CI/CD pipelines that pre-index and ship the index, team sharing of a common index, and backup/restore across machines.
Automated suite measuring: index time by repo size, query latency p50/p95/p99, memory/disk usage. Track regressions across releases. Essential before optimizing chunking or storage.
Validate opencode-rag.json against a JSON schema on load. Surface clear, actionable error messages for invalid or missing fields instead of silent fallback to defaults.
Allow per-extension overrides for nodeTypes, chunkSize, overlap in config. E.g., Python gets smaller AST nodes than Java; Go gets different function boundaries.
Parallel file scanning and chunking for large repos. LanceDB already handles concurrent writes via promise guard; the bottleneck is sequential chunking in runIndexPass.
LLM produces directory-level summaries from indexed chunks. Useful for onboarding, project overview retrieval ("what does the auth module do?"), and context injection.
Score chunks during indexing for size, coherence, and boundary quality. Flag poorly-chunked files for improvement. Could guide chunker selection or parameter tuning.