index
/index
Section titled “/index”Purpose
Section titled “Purpose”Generate a comprehensive project structure index for faster navigation and context loading. Creates a PROJECT_INDEX.md file mapping the codebase structure.
Analyze the current project and generate a comprehensive index.
Index Generation
Section titled “Index Generation”Step 1: Scan Project Structure
Section titled “Step 1: Scan Project Structure”Scan the entire project directory structure, excluding:
node_modules/.git/__pycache__/dist/,build/,.next/venv/,.venv/- Coverage and cache directories
Step 2: Identify Key Components
Section titled “Step 2: Identify Key Components”Categorize files by type:
- Entry Points: Main files, index files, app entry
- API/Routes: Endpoint definitions
- Models/Types: Data structures, schemas
- Services: Business logic
- Utilities: Helper functions
- Tests: Test files
- Configuration: Config files, env templates
- Documentation: README, docs
Step 3: Map Dependencies
Section titled “Step 3: Map Dependencies”Identify:
- Package managers and dependencies (package.json, requirements.txt, etc.)
- Internal import relationships between key files
- External service integrations
Step 4: Generate Index
Section titled “Step 4: Generate Index”Create PROJECT_INDEX.md with this structure:
# Project Index: [Project Name]
Generated: [timestamp]
## Quick Navigation
| Category | Key Files ||----------|-----------|| Entry Points | [list] || API Routes | [list] || Core Services | [list] || Models | [list] |
## Directory Structure[tree view]
## Key Files
### Entry Points- `[path]` - [description]
### API/Routes- `[path]` - [description]
### Services- `[path]` - [description]
### Models/Types- `[path]` - [description]
## Dependencies
### External- [package]: [purpose]
### Internal- [module] → [depends on]
## Architecture Notes[Brief description of patterns observed]| Flag | Description |
|---|---|
--depth=[N] | Limit directory depth (default: 5) |
--include=[pattern] | Include additional patterns |
--exclude=[pattern] | Exclude additional patterns |
--output=[path] | Custom output path |
Usage Examples
Section titled “Usage Examples”/index # Standard index/index --depth=3 # Shallow index/index --include="*.graphql" # Include GraphQL files/index --output=docs/INDEX.md # Custom output locationArguments
Section titled “Arguments”$ARGUMENTS
If no arguments provided, generate standard index with default settings.
After generating the index, inform the user:
- Index file location
- Number of files indexed
- Key components discovered
- Suggest using
/loadto load specific components into context
MCP Integration
Section titled “MCP Integration”This command leverages MCP servers for enhanced indexing:
Filesystem - Project Scanning (Primary)
Section titled “Filesystem - Project Scanning (Primary)”ALWAYS use Filesystem for project scanning:- Use list_dir for full structure view- Use list_directory for targeted exploration- Use grep_search to find specific patterns- Use get_file_info for file metadataMemory - Project Knowledge
Section titled “Memory - Project Knowledge”Store project structure in knowledge graph:- Create entities for key modules- Store component relationships- Recall structure in future sessions- Build project understanding over timeGap Analysis Rule
Section titled “Gap Analysis Rule”Always identify gaps and suggest next steps to users. In case there is no gaps anymore, then AI should clearly state that there is no gap left.