feat: auto-index on first tool call when project is not yet indexed#156
Open
maplenk wants to merge 2 commits intoDeusData:mainfrom
Open
feat: auto-index on first tool call when project is not yet indexed#156maplenk wants to merge 2 commits intoDeusData:mainfrom
maplenk wants to merge 2 commits intoDeusData:mainfrom
Conversation
Author
|
These changes are based on other open PRs. Majorly #151 |
When any query tool is called and the project isn't indexed yet, the server now auto-indexes it inline instead of returning "not indexed". This eliminates the manual index_repository step for first-time use. Key changes: - try_auto_index() consolidates resolve_store + verify_project_indexed across query handlers, with config/file-limit guards and pipeline lock - session_project_alt handles macOS /tmp → /private/tmp symlink variants - char **project_ptr pattern ensures callers get the canonical name - cbm_mcp_server_set_session_root() public API for external session injection - Integration test covers the full auto-index-on-search_graph path
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c1e3b1e to
35642b1
Compare
Owner
|
@maplenk — auto-indexing on first tool call is an interesting idea, but this is a UX/behavior change that needs discussion first. Please open an issue. See CONTRIBUTING.md. The current explicit |
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.
Summary
When any query tool is called and the project isn't indexed yet, the server now auto-indexes it inline instead of returning "not indexed". This eliminates the manual
index_repositorystep for first-time use — users can just start asking questions.The existing background auto-index at startup is preserved; this adds synchronous fallback when a tool call arrives before background indexing completes (or when it wasn't triggered).
Changes
try_auto_index()— consolidatesresolve_store+verify_project_indexedinto a single function that auto-indexes on cache miss. Respectsauto_indexconfig flag andauto_index_limitfile count guard. Uses pipeline lock to avoid concurrent indexing. Waits for any in-progress background auto-index thread before falling back to inline indexing.session_project_alt— handles macOS/tmp→/private/tmpsymlink variants so tool calls with either project name resolve correctlycbm_mcp_server_set_session_root()— public API for external session injection (derives both primary and alt project names)try_auto_index():get_graph_schema,search_graph,query_graph,get_architecture,trace_call_path,get_code_snippetGuards
auto_index = true(default: false)auto_index_limit(default: 50,000 files)git ls-filesBlocking behavior
On a cache miss, the first query can block while inline indexing runs; this path is gated by
auto_index=trueandauto_index_limit.Test plan
search_graph→ verifies auto-index triggers and returns results