Skip to content

Commit 2454e9a

Browse files
authored
Merge 7c2d717 into 9d6787b
2 parents 9d6787b + 7c2d717 commit 2454e9a

File tree

222 files changed

+12169
-53948
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+12169
-53948
lines changed

.claude/settings.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"hooks": [
1717
{
1818
"type": "command",
19-
"command": "~/.claude/hooks/post-tool-use.sh",
20-
"timeout": 360
19+
"command": "tdd-guard"
2120
}
2221
]
2322
}
@@ -28,10 +27,6 @@
2827
{
2928
"type": "command",
3029
"command": "tdd-guard"
31-
},
32-
{
33-
"type": "command",
34-
"command": "~/.claude/hooks/user-prompt-submit.sh"
3530
}
3631
]
3732
}

CLAUDE.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Code-Indexer (CIDX) Project Instructions
22

3+
## 0. CRITICAL BUSINESS INSIGHT - Query is Everything
4+
5+
**THE SINGLE MOST IMPORTANT FEATURE**: Query capability is the core value proposition of CIDX. All query features available in CLI MUST be available in MCP/REST APIs with full parity.
6+
7+
**Query Parity is Non-Negotiable**: Any feature gap between CLI and MCP/REST query interfaces represents a critical degradation of the product's primary function. This is not optional - this is the business.
8+
9+
**Current Status** (as of 2025-11-18):
10+
- CLI query parameters: 23 total
11+
- MCP query parameters: 11 total (48% parity)
12+
- **P0 filters implemented**: language, exclude_language, path_filter, exclude_path, file_extensions, accuracy
13+
- **Remaining gap**: FTS-specific options (8 params), temporal options (4 params)
14+
15+
**Never remove or break query functionality** without explicit approval. Query degradation = product failure.
16+
17+
---
18+
319
## 1. Operational Modes Overview
420

521
CIDX has **three operational modes**. Understanding which mode you're working in is critical.
@@ -84,6 +100,31 @@ CIDX has **three operational modes**. Understanding which mode you're working in
84100
- Real-time vs batch updates
85101
- Performance optimizations
86102

103+
### MCP Protocol (Server Mode)
104+
105+
**Protocol Version**: `2024-11-05` (Model Context Protocol)
106+
107+
**Initialize Handshake** (CRITICAL for Claude Code connection):
108+
- Method: `initialize` - MUST be first client-server interaction
109+
- Server Response: `{ "protocolVersion": "2024-11-05", "capabilities": { "tools": {} }, "serverInfo": { "name": "CIDX", "version": "7.3.0" } }`
110+
- Implemented in: `src/code_indexer/server/mcp/protocol.py` (process_jsonrpc_request)
111+
- Required for OAuth flow completion - Claude Code calls `initialize` after authentication
112+
113+
**Key Points**:
114+
- Without `initialize` method, Claude Code fails with "Method not found: initialize"
115+
- Must return protocolVersion, capabilities (with tools), and serverInfo (name + version)
116+
- Tests in: `tests/unit/server/mcp/test_protocol.py::TestInitializeMethod`
117+
118+
**Tool Response Format** (CRITICAL for Claude Code compatibility):
119+
- All tool results MUST return `content` as an **array of content blocks**, NOT a string
120+
- Each content block must have: `{ "type": "text", "text": "actual content here" }`
121+
- Empty content should be `[]`, NOT `""` or missing
122+
- Error responses must also include `content: []` (empty array is valid)
123+
- Example: `{ "success": true, "content": [{"type": "text", "text": "file contents"}], "metadata": {...} }`
124+
- Violating this format causes Claude Code to fail with "Expected array, received string"
125+
- Implemented in: `src/code_indexer/server/mcp/handlers.py` (all tool handlers)
126+
- Tests in: `tests/unit/server/mcp/test_handlers.py::TestFileHandlers::test_get_file_content`
127+
87128
---
88129

89130
## 3. Daily Development Workflows
@@ -337,13 +378,15 @@ cidx query "def.*" --fts --regex # FTS/regex search
337378
```
338379

339380
**Key Flags** (ALWAYS use `--quiet`):
340-
- `--limit N` - Results (default 10)
381+
- `--limit N` - Results (default 10, start with 5-10 to conserve context window)
341382
- `--language python` - Filter by language
342383
- `--path-filter */tests/*` - Path pattern
343384
- `--min-score 0.8` - Similarity threshold
344385
- `--accuracy high` - Higher precision
345386
- `--quiet` - Minimal output
346387

388+
**Context Conservation**: Start with low `--limit` values (5-10) on initial queries. High limits consume context window rapidly when results contain large code files.
389+
347390
**Search Decision**:
348391
- ✅ "What code does", "Where is X implemented" → CIDX
349392
- ❌ Exact strings (variable names, config) → grep/find

file1.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

plans/.archived/00_Surgical_Integration_Specification.md

Lines changed: 0 additions & 225 deletions
This file was deleted.

0 commit comments

Comments
 (0)