feat(core): use git remote origin for shared team collection naming#373
Open
triadmoko wants to merge 2 commits into
Open
feat(core): use git remote origin for shared team collection naming#373triadmoko wants to merge 2 commits into
triadmoko wants to merge 2 commits into
Conversation
added 2 commits
May 6, 2026 23:56
All developers who clone the same repository now share one Milvus collection automatically, regardless of their local checkout path. SSH and HTTPS variants of the same remote URL are normalised to the same hash before collection name resolution. Resolution priority (unchanged for steps 1-2): 1. ContextConfig.collectionNameOverride (constructor) 2. CODE_CHUNKS_COLLECTION_NAME_OVERRIDE env var 3. git remote origin URL hash [NEW] — enables team sharing 4. local absolute-path hash (original fallback) New env var CLAUDE_CONTEXT_GIT_REMOTE_COLLECTION (default: true) lets users opt out and restore path-hash behaviour. URL normalisation strips .git suffix, lowercases, and collapses SSH (git@host:org/repo) and HTTPS (https://host/org/repo) variants to the canonical form host/org/repo before hashing. Closes zilliztech#271
…ication Added the getCanonicalKey method to the Context class, which returns a normalized remote URL for git repositories or the absolute path for non-git directories. This ensures consistent identification of codebases across different environments. Updated related components to utilize the canonical key for indexing and syncing, enhancing team collaboration by sharing the same identifiers regardless of local paths. Also, modified snapshot management to support canonical keys, improving the handling of indexed codebases. Closes zilliztech#271
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
Closes #271
All developers who clone the same repository now automatically share one Milvus collection, regardless of their local checkout path. No extra configuration is needed — the feature is on by default.
How it works:
The collection name resolution now follows this priority order (steps 1–2 unchanged):
ContextConfig.collectionNameOverride(constructor argument)CODE_CHUNKS_COLLECTION_NAME_OVERRIDEenv varoriginURL hash → enables team sharingURL normalisation ensures SSH and HTTPS variants of the same repo resolve to the same hash:
https://github.com/org/repo.gitgithub.com/org/repocode_chunks_git_<hash>git@github.com:org/repo.gitgithub.com/org/repocode_chunks_git_<hash>(same)ssh://git@github.com/org/repo.gitgithub.com/org/repocode_chunks_git_<hash>(same)New env var:
CLAUDE_CONTEXT_GIT_REMOTE_COLLECTION(default:true)Set to
falseto opt out and restore path-hash behaviour.Changes
packages/core/src/context.ts—getCollectionName()extended with git-remote fallback; addedisGitRemoteCollectionEnabled(),getGitRemoteUrl()(with per-instance cache), andnormalizeGitRemoteUrl()helperspackages/core/src/context.git-remote.test.ts— 12 new unit tests covering: remote detection, fallback to path hash, opt-out env var, override precedence, caching, and URL normalisation for 6 remote formatspackages/mcp/src/config.ts— new env var documented in help text and startup logTest plan
pnpm testinpackages/core)pnpm buildsucceeds inpackages/coreCLAUDE_CONTEXT_GIT_REMOTE_COLLECTION=falserestores original behaviourCODE_CHUNKS_COLLECTION_NAME_OVERRIDEstill takes full precedence🤖 Generated with Claude Code