Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
664 changes: 664 additions & 0 deletions .cursorrules

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ QDRANT_URL=http://localhost:6333

# Multi-repo mode: 0=single-repo (default), 1=multi-repo
# Single-repo: All files go into one collection (COLLECTION_NAME)
# Multi-repo: Each subdirectory gets its own collection
# Multi-repo: Each subdirectory with .git gets its own collection
# Falls back to treating all subdirectories as repos if no .git found (for K8s/containers)
MULTI_REPO_MODE=0

# Logical repo reuse (experimental): 0=disabled (default), 1=enable logical_repo_id-based
Expand Down
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,4 @@ ctx_config.json
/deploy/eks-cdk
/deploy/eks-cdk-PATHFUL
.env
.contextstream/config.json
.contextstream/ignore
.cursorrules
GEMINI.md
ctx-mcp-bridge/bin/ctxce.js
/ctx-mcp-bridge/bin

29 changes: 25 additions & 4 deletions .skills/mcp-tool-selection/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,26 @@ description: Decision rules for when to use MCP Qdrant-Indexer semantic search v

**Core principle:** MCP Qdrant-Indexer tools are primary for exploring code and history. Start with MCP for exploration, debugging, or "where/why" questions; use literal search/file-open only for narrow exact-literal lookups.

## STOP — Do NOT Use Read File or Grep for Exploration

**DO NOT use `Read File`, `grep`, `ripgrep`, `cat`, `find`, or any filesystem search tool for code exploration.**
You have MCP tools that are faster, smarter, and return ranked, contextual results.

- About to `Read` a file to understand it? → use `repo_search` or `context_answer`
- About to `grep` for a symbol? → use `symbol_graph` or `search_callers_for`
- About to `grep -r` for a concept? → use `repo_search` with natural language
- About to `find`/`ls` for project structure? → use `workspace_info` or `qdrant_status`

The ONLY acceptable use of grep/Read: confirming exact literal strings (e.g., `REDIS_HOST`), or reading a file you already located via MCP for editing.

## Use MCP Qdrant-Indexer When

- Exploring or don't know exact strings/symbols
- Need semantic or cross-file understanding (relationships, patterns, architecture)
- Want ranked results with surrounding context, not just line hits
- Asking conceptual/architectural or "where/why" behavior questions
- Need rich context/snippets around matches
- Finding callers, definitions, or importers of any symbol

## Use Literal Search/File-Open Only When

Expand All @@ -27,6 +40,10 @@ grep -r "auth" . # → Use MCP: "authentication mechanisms"
grep -r "cache" . # → Use MCP: "caching strategies"
grep -r "error" . # → Use MCP: "error handling patterns"
grep -r "database" . # → Use MCP: "database operations"
# Also DON'T:
Read File to understand a module # → Use repo_search or context_answer
Read File to find callers # → Use symbol_graph
find/ls for project structure # → Use workspace_info
```

## Literal Search Patterns (DO)
Expand All @@ -42,14 +59,18 @@ grep -rn "REDIS_HOST" . # Exact environment variable
| Question Type | Tool |
|--------------|------|
| "Where is X implemented?" | MCP `repo_search` |
| "Who calls this and show code?" | MCP `symbol_graph` (hydrated w/ snippets) |
| "Callers of callers? Multi-hop?" | MCP `neo4j_graph_query` (transitive_callers, depth=2) |
| "What breaks if I change X?" | MCP `neo4j_graph_query` (impact, depth=2) |
| "Circular dependencies?" | MCP `neo4j_graph_query` (cycles) |
| "Who calls this and show code?" | MCP `symbol_graph` — **DEFAULT for all graph queries, always available** |
| "Where is X defined?" | MCP `symbol_graph` (query_type="definition") |
| "What imports X?" | MCP `symbol_graph` (query_type="importers") |
| "Callers of callers? Multi-hop?" | MCP `symbol_graph` (depth=2+) or `neo4j_graph_query` (if NEO4J_GRAPH=1) |
| "What breaks if I change X?" | MCP `neo4j_graph_query` (ONLY if available, else use `symbol_graph`) |
| "Circular dependencies?" | MCP `neo4j_graph_query` (ONLY if available) |
| "How does authentication work?" | MCP `context_answer` |
| "High-level module overview?" | MCP `info_request` (with explanations) |
| "Does REDIS_HOST exist?" | Literal grep |
| "Why did behavior change?" | `search_commits_for` + `change_history_for_path` |

> **`symbol_graph`** is ALWAYS available (Qdrant-backed). **`neo4j_graph_query`** is ONLY available when `NEO4J_GRAPH=1`. If `neo4j_graph_query` is not in your tool list, use `symbol_graph` for everything. Never error about missing Neo4j.

**If in doubt → start with MCP**

664 changes: 664 additions & 0 deletions GEMINI.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions deploy/helm/context-engine/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ watcher:
WATCH_ROOT: /work
WATCH_DEBOUNCE_SECS: "2.0"
WATCH_USE_POLLING: "1"
# Multi-repo mode: 0=single-repo, 1=multi-repo (each .git subdir gets own collection)
# Falls back to treating all subdirectories as repos if no .git found (K8s resilience)
MULTI_REPO_MODE: "0"
# -- Init containers configuration
initContainers:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# Repos stored in /work/ (which is project root - avoiding docker volumes) and metadata are stored in /work/.codebase/repos (project root/.codebase)
# Updated to use separate PVCs for workspace and codebase to eliminate circular dependencies

version: '3.8'

# YAML Anchors for common configurations
x-common-config: &common-config
env_file:
Expand Down
24 changes: 22 additions & 2 deletions docs/CLAUDE.example.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ AI agent rules for using Context‑Engine Qdrant‑Indexer and Memory MCP tools.

These rules are NOT optional - favor qdrant-indexer tooling at all costs over existing file reading, grep-like searching, and unrelated codebase search tools.

## STOP — Read This First

**DO NOT use `Read File`, `grep`, `ripgrep`, `cat`, `find`, or any filesystem search tool for code exploration.**
You have MCP tools that are faster, smarter, and return ranked, contextual results.

- About to `Read` a file to understand it? → use `repo_search` or `context_answer`
- About to `grep` for a symbol? → use `symbol_graph` or `search_callers_for`
- About to `grep -r` for a concept? → use `repo_search` with natural language
- About to `find`/`ls` for project structure? → use `workspace_info` or `qdrant_status`

The ONLY acceptable use of grep/Read: confirming exact literal strings (e.g., `REDIS_HOST`), or reading a file you already located via MCP for editing.

## Agentic AI Project Rules: When to Use MCP Qdrant-Indexer vs Grep

Core Decision Rules (for AI agents)
Expand Down Expand Up @@ -29,6 +41,9 @@ These rules are NOT optional - favor qdrant-indexer tooling at all costs over ex
grep -r "cache" . # → Use MCP: "caching strategies"
grep -r "error" . # → Use MCP: "error handling patterns"
grep -r "database" . # → Use MCP: "database operations"
Read File to understand a module # → Use repo_search or context_answer
Read File to find callers # → Use symbol_graph
find/ls for project structure # → Use workspace_info

## DO - Efficient for exact matches
grep -rn "UserAlreadyExists" . # Specific error class
Expand Down Expand Up @@ -99,15 +114,19 @@ These rules are NOT optional - favor qdrant-indexer tooling at all costs over ex
- Cross-language: Python pattern can match Go/Rust/Java with similar control flow.
- Note: Returns error if pattern detection module is not available.
- symbol_graph:
- **DEFAULT for ALL graph/relationship queries. Always available (Qdrant-backed, no Neo4j required).**
- Use for: structural navigation (callers, definitions, importers).
- Think: "who calls this function?", "where is this class defined?".
- **Note**: Results are "hydrated" with ~500-char source snippets for immediate context.
- Supports `depth` for multi-hop traversals (depth=2 = callers of callers).
- neo4j_graph_query:
- Use this FIRST for any graph query. Do NOT attempt neo4j_graph_query unless it's in your tool list.
- neo4j_graph_query (OPTIONAL — only when NEO4J_GRAPH=1):
- **Only available when NEO4J_GRAPH=1. If not in your tool list, use symbol_graph instead.**
- Use for: advanced graph traversals that grep CANNOT do.
- Query types: `callers`, `callees`, `transitive_callers`, `transitive_callees`, `impact`, `dependencies`, `cycles`.
- Think: "what would break if I change X?" (impact), "callers of callers" (transitive_callers), "circular deps?" (cycles).
- Example: `neo4j_graph_query(symbol="normalize_path", query_type="impact", depth=2)` → finds all code that would break.
- **Never error or warn about Neo4j being unavailable — just use symbol_graph.**
- info_request:
- Use for: rapid broad discovery and architectural overviews.
- Good for: "how does the reranker work?", "overview of database modules".
Expand Down Expand Up @@ -194,4 +213,5 @@ These rules are NOT optional - favor qdrant-indexer tooling at all costs over ex

- context_answer timeout → repo_search + info_request(include_explanation=true)
- pattern_search unavailable → repo_search with structural query terms
- neo4j_graph_query empty → symbol_graph (Qdrant-backed fallback)
- neo4j_graph_query unavailable → symbol_graph (Qdrant-backed, ALWAYS available — this is the DEFAULT)
- grep / Read File → repo_search, symbol_graph, info_request (ALWAYS use MCP instead)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies = [
"tree_sitter_html>=0.23.0",
"tree_sitter_css>=0.23.0",
"tree_sitter_markdown>=0.5.0",
"mcp==1.17.0",
"mcp==1.23.0",
"fastmcp==2.12.4",
"fastapi",
"uvicorn[standard]",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tree_sitter_kotlin>=1.1.0
tree_sitter_swift>=0.0.1
tree_sitter_scala>=0.24.0
tree_sitter_php>=0.24.0
mcp==1.25.0
mcp==1.23.0
fastmcp==2.12.4
fastapi
uvicorn[standard]
Expand Down
Loading