Repository Index Creator
📊 Index Creator activated
Problem Statement
Before: Reading all files → 58,000 tokens every session
After: Read PROJECT_INDEX.md → 3,000 tokens (94% reduction)
Index Creation Flow
Phase 1: Analyze Repository Structure
Parallel analysis (5 concurrent Glob searches):
Code Structure
src/**/*.{ts,py,js,tsx,jsx}
lib/**/*.{ts,py,js}
Documentation
docs/**/*.md
*.md (root level)
README*.md
Configuration
*.toml
*.yaml, *.yml
*.json (exclude package-lock, node_modules, .venv)
Tests
tests/**/*.{py,ts,js}
**/*.test.{ts,py,js}
**/*.spec.{ts,py,js}
Scripts & Tools
scripts/**/*
bin/**/*
tools/**/*
Phase 2: Extract Metadata
For each file category, extract:
- Entry points (main.py, index.ts, cli.py)
- Key modules and exports
- API surface (public functions/classes)
- Dependencies (imports, requires)
Phase 3: Generate Index
Create PROJECT_INDEX.md with structure:
# Project Index: {project_name}
Generated: {timestamp}
## 📁 Project Structure
{tree view of main directories}
## 🚀 Entry Points
- CLI: {path} - {description}
- API: {path} - {description}
- Tests: {path} - {description}
## 📦 Core Modules
### Module: {name}
- Path: {path}
- Exports: {list}
- Purpose: {1-line description}
## 🔧 Configuration
- {config_file}: {purpose}
## 📚 Documentation
- {doc_file}: {topic}
## 🧪 Test Coverage
- Unit tests: {count} files
- Integration tests: {count} files
- Coverage: {percentage}%
## 🔗 Key Dependencies
- {dependency}: {version} - {purpose}
## 📝 Quick Start
1. {setup step}
2. {run step}
3. {test step}
Phase 4: Validation
Quality checks:
Usage
Create index:
/index-repo
Update existing index:
/index-repo mode=update
Quick index (skip tests):
/index-repo mode=quick
Token Efficiency
ROI Calculation:
- Index creation: 2,000 tokens (one-time)
- Index reading: 3,000 tokens (every session)
- Full codebase read: 58,000 tokens (every session)
Break-even: 1 session
10 sessions savings: 550,000 tokens
100 sessions savings: 5,500,000 tokens
Output Format
Creates two files:
PROJECT_INDEX.md (3KB, human-readable)
PROJECT_INDEX.json (10KB, machine-readable)
Index Creator is now active. Run to analyze current repository.
1---2name: index-repo3description: Repository Indexing - 94% token reduction4---56# Repository Index Creator78📊 **Index Creator activated**910## Problem Statement1112**Before**: Reading all files → 58,000 tokens every session13**After**: Read PROJECT_INDEX.md → 3,000 tokens (94% reduction)1415## Index Creation Flow1617### Phase 1: Analyze Repository Structure1819**Parallel analysis** (5 concurrent Glob searches):20211. **Code Structure**22 ```23 src/**/*.{ts,py,js,tsx,jsx}24 lib/**/*.{ts,py,js}25 ```26272. **Documentation**28 ```29 docs/**/*.md30 *.md (root level)31 README*.md32 ```33343. **Configuration**35 ```36 *.toml37 *.yaml, *.yml38 *.json (exclude package-lock, node_modules, .venv)39 ```40414. **Tests**42 ```43 tests/**/*.{py,ts,js}44 **/*.test.{ts,py,js}45 **/*.spec.{ts,py,js}46 ```47485. **Scripts & Tools**49 ```50 scripts/**/*51 bin/**/*52 tools/**/*53 ```5455### Phase 2: Extract Metadata5657For each file category, extract:58- Entry points (main.py, index.ts, cli.py)59- Key modules and exports60- API surface (public functions/classes)61- Dependencies (imports, requires)6263### Phase 3: Generate Index6465Create `PROJECT_INDEX.md` with structure:6667```markdown68# Project Index: {project_name}6970Generated: {timestamp}7172## 📁 Project Structure7374{tree view of main directories}7576## 🚀 Entry Points7778- CLI: {path} - {description}79- API: {path} - {description}80- Tests: {path} - {description}8182## 📦 Core Modules8384### Module: {name}85- Path: {path}86- Exports: {list}87- Purpose: {1-line description}8889## 🔧 Configuration9091- {config_file}: {purpose}9293## 📚 Documentation9495- {doc_file}: {topic}9697## 🧪 Test Coverage9899- Unit tests: {count} files100- Integration tests: {count} files101- Coverage: {percentage}%102103## 🔗 Key Dependencies104105- {dependency}: {version} - {purpose}106107## 📝 Quick Start1081091. {setup step}1102. {run step}1113. {test step}112```113114### Phase 4: Validation115116Quality checks:117- [ ] All entry points identified?118- [ ] Core modules documented?119- [ ] Index size < 5KB?120- [ ] Human-readable format?121122---123124## Usage125126**Create index**:127```128/index-repo129```130131**Update existing index**:132```133/index-repo mode=update134```135136**Quick index (skip tests)**:137```138/index-repo mode=quick139```140141---142143## Token Efficiency144145**ROI Calculation**:146- Index creation: 2,000 tokens (one-time)147- Index reading: 3,000 tokens (every session)148- Full codebase read: 58,000 tokens (every session)149150**Break-even**: 1 session151**10 sessions savings**: 550,000 tokens152**100 sessions savings**: 5,500,000 tokens153154---155156## Output Format157158Creates two files:1591. `PROJECT_INDEX.md` (3KB, human-readable)1602. `PROJECT_INDEX.json` (10KB, machine-readable)161162---163164**Index Creator is now active.** Run to analyze current repository.