Skip to content

SOP-009: Codebase Indexing

Document Control

FieldValue
SOP IDSOP-009
Version1.0
StatusActive
Last Updated2024-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:

  1. Sync - Files securely synced to Cursor servers
  2. Chunk - Code split into meaningful chunks (functions, classes, logical blocks)
  3. Embed - AI converts chunks to vectors (semantic meaning captured)
  4. Store - Vectors stored in vector database
  5. Query - Your search → vector → similarity match
  6. Retrieve - Most similar code returned with context

Step 1: Check Indexing Status

View Status:

  1. Open Cursor Settings: Cmd+Shift+J / Ctrl+Shift+J
  2. Navigate to Indexing & Docs
  3. 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 TypeAction
New filesAutomatically added
Modified filesRe-indexed with new embeddings
Deleted filesRemoved from index
Large/complex filesMay be skipped for performance
Ignored filesExcluded (see below)

Automatic Sync:

  • Checks every 5 minutes
  • Only changed files re-processed
  • Minimal performance impact

Step 3: View Indexed Files

  1. Go to Cursor Settings → Indexing & Docs
  2. Click View included files
  3. Opens .txt file 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:

  1. Open Command Palette: Cmd+Shift+P / Ctrl+Shift+P
  2. Search: "Cursor: Resync Index"
  3. 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

TypeSearch: "navigation"Result
GrepPattern matchingFinds files containing "navigation" literally. Misses header.tsx (has nav menu, not the word)
SemanticMeaning-basedFinds 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

SettingDescription
Auto-index new reposAutomatically index when opening new projects
View included filesSee list of indexed file paths
Show SettingsConfigure 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
  • [ ] .cursorignore file is respected
  • [ ] Semantic search returns relevant results
  • [ ] Large binary files are excluded

Troubleshooting

IssueSolution
Indexing stuckCheck network, try resync
Files not indexedCheck ignore patterns
Wrong resultsRe-index, check file types
Slow indexingLarge codebase normal, ignore non-code
Privacy concernsEnable Privacy Mode in settings

See Also

Built with VitePress | Powered by Claude AI