Skip to content

Commit 9e74fa8

Browse files
committed
Merge branch 'feature/epic-717-claude-delegation'
2 parents fc04818 + 642c182 commit 9e74fa8

63 files changed

Lines changed: 15231 additions & 143 deletions

File tree

Some content is hidden

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

CLAUDE.md

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,28 @@
3434

3535
---
3636

37+
## CRITICAL: LOCAL TESTING BEFORE DEPLOYMENT
38+
39+
**ABSOLUTE PROHIBITION**: NEVER deploy to or test on the production CIDX server until work is approved.
40+
41+
**MANDATORY WORKFLOW**:
42+
1. **ALL development and testing happens LOCALLY** on the development machine
43+
2. CIDX server runs locally at localhost:8000
44+
3. For callbacks, use the development machine's external IP (reachable from Claude Server)
45+
4. The development machine and Claude Server can see each other - use this for E2E testing
46+
5. The production server is in a special firewalled network area - DO NOT TOUCH
47+
48+
**DEPLOYMENT ONLY WHEN**:
49+
- User explicitly approves the work
50+
- User tells you to "commit and push to master" (triggers auto-deployment), OR
51+
- User tells you to "deploy manually to production server"
52+
53+
**WHY**: The production server is production. Test everything locally first with full E2E validation before any deployment.
54+
55+
**VIOLATION = FUNDAMENTAL FAILURE**: Touching production server without explicit user approval breaks the development workflow.
56+
57+
---
58+
3759
## SSH SERVER RESTART - CRITICAL PROCEDURE
3860

3961
**ABSOLUTE PROHIBITION**: NEVER use `kill -15 && nohup python3 -m ... &` for server restarts.
@@ -64,10 +86,10 @@ systemctl status cidx-server --no-pager
6486

6587
**LOCKED CONFIGURATION** (verified working 2025-11-30):
6688
- cidx-server systemd service: port 8000
67-
- HAProxy backend (192.168.60.30): forwards to 192.168.60.20:8000
68-
- Firewall (192.168.60.20): allows port 8000 from 192.168.60.30
89+
- HAProxy backend: forwards to production server on port 8000
90+
- Firewall: allows port 8000 from HAProxy server
6991

70-
**WHY**: These three components must be synchronized. Changing any one breaks external access via https://linner.ddns.net:8383.
92+
**WHY**: These three components must be synchronized. Changing any one breaks external HTTPS access.
7193

7294
**VIOLATION = SERVER INACCESSIBLE**: Any port change will cause HAProxy 503 errors.
7395

@@ -92,6 +114,56 @@ When `cidx scip generate` runs:
92114

93115
---
94116

117+
## CIDX SERVER CONFIGURATION - NO ENVIRONMENT VARIABLES
118+
119+
**ABSOLUTE PROHIBITION**: NEVER use environment variables to store settings, configuration, or state within the CIDX server context.
120+
121+
**This is NOT negotiable. This is NOT a suggestion. This is a hard rule.**
122+
123+
**WHY**: Environment variables are:
124+
- Invisible and hard to debug
125+
- Not persisted properly across restarts
126+
- Inconsistent between development and production
127+
- A source of repeated configuration failures in this project
128+
129+
**CIDX SERVER HAS A DEDICATED CONFIGURATION SYSTEM**:
130+
131+
The CIDX server uses a **Web UI Configuration Screen** for all settings. This is the single source of truth for server configuration.
132+
133+
**MANDATORY**: When adding ANY new configurable setting to CIDX server:
134+
1. Add it to the Web UI Configuration Screen
135+
2. Store it in the server's configuration persistence layer
136+
3. Access it through the configuration API
137+
4. NEVER use environment variables as a shortcut
138+
139+
**CORRECT APPROACHES** for CIDX server configuration:
140+
1. **Web UI Config Screen** (PRIMARY - use this for all new settings)
141+
2. Configuration files (JSON, YAML, TOML)
142+
3. Command-line arguments (for startup options only)
143+
4. In-memory configuration objects passed explicitly
144+
145+
**WRONG APPROACH** (NEVER DO THIS):
146+
```python
147+
# WRONG - NEVER DO THIS
148+
import os
149+
os.environ["CIDX_SETTING"] = "value"
150+
setting = os.getenv("CIDX_SETTING")
151+
```
152+
153+
**RIGHT APPROACH**:
154+
```python
155+
# RIGHT - Use the server's configuration system
156+
from code_indexer.server.config import get_config
157+
config = get_config()
158+
setting = config.some_setting
159+
```
160+
161+
**VIOLATION = IMMEDIATE REJECTION**: Any code review that introduces environment variable usage for CIDX server settings MUST be rejected and rewritten.
162+
163+
**RECORDED**: 2025-01-14 - After repeated failures caused by environment variable-based configuration.
164+
165+
---
166+
95167
## 1. CRITICAL BUSINESS INSIGHT - Query is Everything
96168

97169
**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.

docs/ai-integration.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,14 @@ See [CIDX MCP Bridge](../README.md#cidx-mcp-bridge-for-claude-desktop) for compl
228228
- `git_diff` - Compare revisions
229229
- `git_blame` - Line attribution
230230

231-
Total: **75 MCP tools** available
231+
**Claude Delegation Tools** (execute AI workflows on protected repos):
232+
- `list_delegation_functions` - Discover available functions
233+
- `execute_delegation_function` - Execute function on Claude Server
234+
- `poll_delegation_job` - Wait for job completion via callback
235+
236+
See: [Delegation Functions Guide](delegation-functions.md) for complete documentation.
237+
238+
Total: **78 MCP tools** available
232239

233240
[✓ Corrected by fact-checker: Original claim was 53 tools, verified source code shows 75 tools in tool registry at src/code_indexer/server/mcp/tools.py]
234241

@@ -471,6 +478,7 @@ nano CLAUDE.md
471478

472479
## Related Documentation
473480

481+
- **Delegation Functions**: [Delegation Functions Guide](delegation-functions.md) - Execute AI workflows on protected repos
474482
- **Server Deployment**: [Server Deployment Guide](server-deployment.md)
475483
- **Architecture**: [Architecture Guide](architecture.md)
476484
- **Configuration**: [Configuration Guide](configuration.md)

0 commit comments

Comments
 (0)