Skip to main content

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

Repository Map Demo Repo Map Shows Repository Structure

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:
  1. Reference count - How often they’re used elsewhere
  2. Symbol type - Classes rank higher than functions
  3. 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:
Tree-sitter provides:
  • 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

  1. Set appropriate limits - Balance detail vs. token usage
  2. Use focus files - Prioritize relevant files
  3. Refresh after changes - Keep map up to date
  4. Install tree-sitter - Better extraction accuracy