Repository Map
PraisonAI CLI includes a powerful repository mapping feature that helps the AI understand your codebase structure. Inspired by Aider’s RepoMap, it extracts and ranks symbols to provide intelligent context.Overview
The repository map:- Extracts symbols - Classes, functions, methods from your code
- Ranks by importance - Most-referenced symbols appear first
- Supports multiple languages - Python, JavaScript, TypeScript, Go, Rust, Java
- Optimizes context - Fits within token limits
Quick Start
How It Works
Symbol Extraction
The system parses your code to find:- Classes - Class definitions and their structure
- Functions - Top-level function definitions
- Methods - Class methods with their signatures
- Imports - Module dependencies
Ranking Algorithm
Symbols are ranked by:- Reference count - How often they’re used elsewhere
- Symbol type - Classes rank higher than functions
- File importance - Core files rank higher
Example Output
Python API
Basic Usage
Configuration
Focus Files
Prioritize specific files in the map:Get Symbol Context
Get detailed context for a specific symbol:Language Support
Python
Full support with tree-sitter or regex fallback:JavaScript/TypeScript
Go
Rust
Java
Symbol Extraction
Using Tree-Sitter
For best results, install tree-sitter:- Accurate parsing
- Full signature extraction
- Better language support
Regex Fallback
Without tree-sitter, regex patterns are used:- Works for common patterns
- May miss edge cases
- No external dependencies
CLI Integration
/map Command
/map with Arguments
Advanced Usage
Custom Symbol Extraction
Symbol Ranking
Refresh Map
Integration with AI
The repository map is automatically included in AI context:Performance
Token Optimization
The map is optimized to fit within token limits:Caching
The map is cached and only refreshed when needed:Best Practices
- Set appropriate limits - Balance detail vs. token usage
- Use focus files - Prioritize relevant files
- Refresh after changes - Keep map up to date
- Install tree-sitter - Better extraction accuracy
Related Features
- Fast Context - Quick codebase search
- Slash Commands - Use
/mapcommand - Knowledge - RAG-based code understanding

