Repo Map
The repo map is an aider-style, relevance-ranked overview of a codebase: a compact text listing of the most important definitions, grouped by file. It is built by joining references to the definitions they name, ranking files with personalized PageRank, and truncating the result to a token budget. It is designed to prime an LLM's context window with the shape of a repository, not to answer a single query.
How it is built
RCE Code constructs a directed graph over files. For every reference, it draws an edge from the file that uses a name to each file that defines that name, weighted by how often the name is mentioned. No reference resolution is needed for this — the join is purely on name — and self-edges plus ubiquitous noise identifiers (very short names and a built-in stoplist of words like get, run, self, data) are dropped so they do not wash out the ranking.
It then runs personalized PageRank over that graph. PageRank surfaces the files that many others depend on; the “personalized” part lets you bias the walk toward what you care about right now. Each definition inherits its file's rank, definitions are sorted by rank (then file path and source order), and the renderer emits a file header plus one signature line per definition.
Biasing the map
Two optional inputs steer the ranking via the personalization vector:
focused_files— files you are actively working in. They receive a large personalization boost, so their neighbours in the graph rank higher. Focused files are added to the graph even if nothing references them.mentioned_idents— identifiers that came up in the surrounding context (for example, names in a chat or a diff). Files that define any mentioned identifier receive a smaller boost.
Token budget
The map is fit to token_budget (default 1024). RCE Code renders the highest-ranked definitions first and keeps the largest prefix that fits the budget, so you get the most relevant slice of the repo for the space you allow. Raise the budget for a fuller map; lower it to fit a tighter context window.
Python API
build_repo_map(focused_files=None, mentioned_idents=None, token_budget=1024) returns a single text string. A typical map looks like:
Empty when there are no cross-file edges
build_repo_map() returns an empty string. Pass focused_files (or --focus on the CLI) to seed the graph with the files you care about so their definitions still appear.CLI
The repomap subcommand prints the map to stdout. --focus and --ident may each be passed multiple times.