Skip to content

RepoMapBuilder entrypoint heuristic has no fallback quality metric or confidence #2003

Description

@Widthdom

Summary

In RepoMapBuilder.Build() at src/CodeIndex/Database/RepoMapBuilder.cs:78-100+, the entrypoint detection uses language-specific name hints (line 17-39) and path hints (line 40-63) with a simple match-first strategy. However, when multiple candidate entrypoints exist in the same language, or when heuristic hints are weak (e.g., Python "app" matching dozens of helper modules), the Build() result provides no confidence metric. This makes it risky for AI clients to trust the entrypoint list without independent validation, yet there's no structured way to report confidence.

Where

  • src/CodeIndex/Database/RepoMapBuilder.cs:17-39 (EntrypointNameHints dictionary)
  • src/CodeIndex/Database/RepoMapBuilder.cs:40-63 (EntrypointPathHints dictionary)
  • src/CodeIndex/Database/RepoMapBuilder.cs:78-100 (Build method signature)

Suggested approach

  1. Add a EntrypointMatch record that includes (symbol_name, kind, path, language, match_type: name|path, confidence: 0.0..1.0, hint_rank: int)
  2. For each language, score path hints higher than name hints, and prefer files in the repo root or conventional locations
  3. Compute confidence as (matches_multiple_heuristics ? 0.8 : matches_single_heuristic ? 0.5 : 0.2) and adjust downward if hint_name is ambiguous (matches_count > 1)
  4. Return a RepoMapResult that includes entrypoints: List<EntrypointMatch> instead of bare symbol names
  5. Document the confidence intervals in USER_GUIDE so clients know when to treat results as advisory
  6. Add --min-entrypoint-confidence <0.0..1.0> flag to filter weak matches at query time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions