Skip to content

Stabilize runtime and hybrid search#1

Draft
chidev wants to merge 7 commits intomainfrom
feature/stabilize_qmd
Draft

Stabilize runtime and hybrid search#1
chidev wants to merge 7 commits intomainfrom
feature/stabilize_qmd

Conversation

@chidev
Copy link
Copy Markdown
Owner

@chidev chidev commented Apr 2, 2026

Summary

Context

This branch starts from upstream main because the old local install was still on the c85889d lineage and missed already-merged fixes like the collection filter and launcher/runtime patches.

Verification

  • bunx vitest run test/store.helpers.unit.test.ts test/structured-search.test.ts
  • bunx vitest run test/cli.test.ts -t "parallel startup regression"
  • bunx tsc -p tsconfig.build.json --noEmit

Notes

  • test/mcp.test.ts was not used as a verification gate here because it triggers a large model download path unrelated to the carried changes.

rymalia and others added 7 commits April 2, 2026 01:28
The validateSemanticQuery regex rejected any hyphen followed by a word
character, blocking common compound words (real-time, multi-client,
kebab-case identifiers like better-sqlite3). Tighten the check to only
match negation syntax at token boundaries (start of string or after
whitespace).

See tobi#383

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On CPU-only servers, LLM reranking (0.6B model) takes ~2s per document,
making the query tool unusable with timeouts under 30s.

This commit:
- Adds `skipRerank` boolean parameter to the MCP `query` tool schema.
  When true, returns results scored by RRF fusion only (no LLM rerank).
- Passes `candidateLimit` through to structuredSearch (was declared in
  schema but never forwarded to the store).

Use case: automated RAG hooks with 1-2s timeouts on VPS without GPU.
With skipRerank=true, queries complete in 30-50ms instead of 30-40s.
When OLLAMA_EMBED_URL is set, all embedding and tokenization operations
use the remote Ollama HTTP API instead of node-llama-cpp. This enables
QMD on platforms without local GPU/Vulkan support (ARM64 VPS, Docker
containers, CI runners) and with remote Ollama instances (Tailscale,
LAN, Docker networks).

Changes:
- Add ollamaEmbed() and ollamaEmbedBatch() helper functions using
  Ollama /api/embed endpoint
- Patch getEmbedding() to bypass node-llama-cpp when OLLAMA_EMBED_URL
  is set
- Patch generateEmbeddings() with dedicated Ollama fast-path that skips
  withLLMSessionForLlm entirely
- Patch expandQuery() to skip LLM-based HYDE query expansion (passes
  raw query as vector search)
- Patch chunkDocumentByTokens() to use char-based estimation instead of
  local tokenizer
- Patch vsearch and query CLI commands to skip withLLMSession wrapper

Environment variables:
  OLLAMA_EMBED_URL   - Ollama server URL (e.g. http://your-ollama:11434)
  OLLAMA_EMBED_MODEL - Model name (default: nomic-embed-text)

Tested on ARM64 Oracle Cloud VPS with qwen3-embedding:0.6b on remote
Ollama via Tailscale. 7,100+ documents indexed successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants