SOP-009: Codebase Indexing
Document Control
| Field | Value |
|---|---|
| SOP ID | SOP-009 |
| Version | 1.0 |
| Status | Active |
| Last Updated | 2024-12 |
Purpose
This SOP covers Cursor's codebase indexing feature, which enables semantic search across your workspace for AI-powered code discovery.
Scope
- How indexing works
- Privacy and security
- Configuration options
- Troubleshooting indexing issues
Prerequisites
- Cursor installed and configured
- Workspace open with code files
Procedure
How Indexing Works
Indexing Pipeline:
- Sync - Files securely synced to Cursor servers
- Chunk - Code split into meaningful chunks (functions, classes, logical blocks)
- Embed - AI converts chunks to vectors (semantic meaning captured)
- Store - Vectors stored in vector database
- Query - Your search → vector → similarity match
- Retrieve - Most similar code returned with context
Step 1: Check Indexing Status
View Status:
- Open Cursor Settings:
Cmd+Shift+J/Ctrl+Shift+J - Navigate to Indexing & Docs
- See indexing progress percentage
Semantic Search Available
Semantic search becomes available at 80% completion. You can start using it before full indexing completes.
Step 2: Understand What Gets Indexed
| File Type | Action |
|---|---|
| New files | Automatically added |
| Modified files | Re-indexed with new embeddings |
| Deleted files | Removed from index |
| Large/complex files | May be skipped for performance |
| Ignored files | Excluded (see below) |
Automatic Sync:
- Checks every 5 minutes
- Only changed files re-processed
- Minimal performance impact
Step 3: View Indexed Files
- Go to Cursor Settings → Indexing & Docs
- Click View included files
- Opens
.txtfile listing all indexed paths
Step 4: Configure Ignore Files
Files matching ignore patterns are excluded from indexing.
Ignore Sources:
.gitignore- Respected by default.cursorignore- Cursor-specific ignores
Create .cursorignore:
# Ignore large data files
*.csv
*.parquet
data/
# Ignore generated code
dist/
build/
node_modules/
# Ignore secrets
.env*
secrets/Improve Accuracy
Ignoring large non-code content files improves search accuracy by reducing noise.
Step 5: Force Re-Index
If indexing seems stale or corrupted:
- Open Command Palette:
Cmd+Shift+P/Ctrl+Shift+P - Search: "Cursor: Resync Index"
- Wait for re-indexing to complete
Privacy & Security
File Paths:
- Encrypted before transmission
- Project structure remains confidential
Code Content:
- Never stored in plaintext on servers
- Only held in memory during processing
- Discarded after embedding generation
Embeddings:
- Stored for search functionality
- Cannot be reversed to original code
Semantic Search vs Grep
| Type | Search: "navigation" | Result |
|---|---|---|
| Grep | Pattern matching | Finds files containing "navigation" literally. Misses header.tsx (has nav menu, not the word) |
| Semantic | Meaning-based | Finds header.tsx, sidebar.tsx, nav-menu.tsx - understands they're related |
Cursor uses both:
- Grep for exact patterns
- Semantic for conceptual matches
- Combined for best results
Benefits of Semantic Search:
- Faster results - Compute happens at index time, not search time
- Better accuracy - Custom-trained models for code
- Fewer clarifications - Find what you mean, not just what you type
- Conceptual matching - Find code by what it does
Configuration
Navigate to Cursor Settings → Indexing & Docs
| Setting | Description |
|---|---|
| Auto-index new repos | Automatically index when opening new projects |
| View included files | See list of indexed file paths |
| Show Settings | Configure ignore patterns |
Frequently Asked Questions
Where can I see all indexed codebases? Cursor Settings → Indexing & Docs shows current workspace. Historical indexes are managed automatically.
How do I delete all indexed codebases? Indexes are workspace-specific. Close workspace and delete .cursor folder to remove local cache.
How long are indexes retained? Indexes persist as long as you actively use the workspace. Unused indexes are cleaned up automatically.
Does Cursor store my source code? No. Code is processed in memory for embedding generation then discarded. Only vectors are stored.
How does team sharing work? Each team member has their own index. Indexes are not shared between users.
Multi-root workspaces? Supported. Each root folder is indexed separately.
Verification Checklist
- [ ] Indexing status shows percentage in settings
- [ ] Can view list of included files
- [ ]
.cursorignorefile is respected - [ ] Semantic search returns relevant results
- [ ] Large binary files are excluded
Troubleshooting
| Issue | Solution |
|---|---|
| Indexing stuck | Check network, try resync |
| Files not indexed | Check ignore patterns |
| Wrong results | Re-index, check file types |
| Slow indexing | Large codebase normal, ignore non-code |
| Privacy concerns | Enable Privacy Mode in settings |