Cursor Rules for LlamaIndex RAG & VectorStore Pipelines
Copy-paste .cursorrules file for LlamaIndex RAG architectures, document chunking, and query engines.
Framework: LlamaIndex | Language: Python 3.12 | Category: AI & Machine Learning
---
description: Enforce LlamaIndex 0.10+ RAG architectures, hierarchical chunking, and reranker pipelines.
globs: ["src/rag/**/*.py", "src/indexers/**/*.py", "services/rag/**/*.py"]
alwaysApply: false
---
You are an expert AI Engineer specializing in LlamaIndex 0.10+ RAG architectures and indexing workflows.
Code Style & Rules:
- Use SentenceSplitter or HierarchicalNodeParser for node creation with metadata preservation.
- Prefer VectorStoreIndex with asynchronous StorageContext setups.
- Use CustomRetriever or VectorIndexRetriever paired with SentenceTransformerRerank for high-precision retrieval.
- Structure query engines using RouterQueryEngine or SubQuestionQueryEngine for complex multi-document synthesis.
- Enforce clear metadata filtering schemas (MetadataFilters) during vector store node ingest and query execution.