Add semantic vector search via Qdrant + Ollama#11
Open
renezander030 wants to merge 1 commit intokvanland:mainfrom
Open
Add semantic vector search via Qdrant + Ollama#11renezander030 wants to merge 1 commit intokvanland:mainfrom
renezander030 wants to merge 1 commit intokvanland:mainfrom
Conversation
Keyword search iterates every project via the API on each query (N+1 calls) and only does substring matching. Vector search queries a local Qdrant index in <100ms and finds semantically related tasks that keywords miss. New CLI commands: semantic, similar, vector-sync, vector-status New MCP tools: ticktick_tasks_semantic_search, ticktick_tasks_similar, ticktick_vector_sync, ticktick_vector_status Falls back to keyword search when Qdrant/Ollama are unavailable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The current
tasks searchcommand fires N+1 API calls on every query (1 to list projects, then 1 per project to fetch and filter tasks). With hundreds of tasks across many projects, this takes 3-5 seconds per search. Worse, substring matching misses semantically related results: searching "deployment" won't find a task titled "push release to prod".Solution
Add optional vector search using Qdrant (vector database) and Ollama (local embeddings with
nomic-embed-text). Both run locally, no external API calls, no data leaves the machine.How it works
vector-syncfetches all active tasks, embeds them via Ollama, and stores vectors in Qdrantsemanticqueries embed the search string and match by cosine similarity in <100mssimilarfinds semantically related tasks for deduplication or discovering related workWhat I changed
lib/vector.js(new): Qdrant + Ollama integration, incremental sync, search, similar tasks, health checkslib/tasks.js: AddedsemanticSearch,findSimilar,vectorSync,vectorStatuswith keyword fallbackbin/ticktick.js: New subcommands:semantic,similar,vector-sync,vector-statuslib/mcp.js: 4 new MCP tools for AI assistant integrationlib/cli.js: Score-based result formatting, updated help textREADME.md: Full documentation with prerequisites, usage, cron setupProduction context
I've been running this architecture (same stack: Qdrant + Ollama + nomic-embed-text, same incremental sync pattern) on my own TickTick MCP server for several months with ~500 tasks. The speed difference is significant, and the semantic matching catches things keyword search never will.
New CLI commands
New MCP tools
ticktick_tasks_semantic_searchticktick_tasks_similarticktick_vector_syncticktick_vector_statusPrerequisites (optional)
Vector search is entirely optional. If Qdrant/Ollama aren't running, everything else works exactly as before.
docker run -d --name qdrant -p 6333:6333 qdrant/qdrant docker run -d --name ollama -p 11434:11434 ollama/ollama docker exec ollama ollama pull nomic-embed-textTest plan
ticktick tasks vector-syncindexes tasks from the APIticktick tasks semantic "query"returns scored resultsticktick tasks similar TASK_IDfinds related tasksticktick tasks vector-statusreports index health