Skip to main content
Glama

gl finds the files a bug report is about. Point it at a repository and give it an issue. It ranks the source files most likely to need changes, in milliseconds on a laptop, with no LLM, no GPU and no index server.

Across 10 benchmarks, 5,960 issues and about 750 repos, it roughly doubles plain BM25's top-1 accuracy, every time scored against the files the real fix changed. It's built for places with no frontier model in the loop: triage bots, CI, small local models, and as a pre-fetched shortlist inside agent harnesses. The repo also reports an honest A/B showing that offering agents a better search tool doesn't change their accuracy.

Quickstart

go install github.com/soham504/gl-code-search/go/cmd/gl@latest     # Go 1.22+

cd your-repo
gl locate < issue.txt                 # ranked likely files, with the reasons
gl search "date field serialization"  # code-aware ranked search with matching lines
gl symbol QuerySet                    # where it's defined
gl -k 5 -markdown locate < issue.txt  # ready to paste into an issue (also: -json)

Works on Python, JS/TS, Go, Rust, Java, Kotlin, Scala, C/C++, C#, Ruby and PHP. The first run analyses the repo. After that an on-disk cache re-analyses only changed files: 3.9 s → 0.25 s on Django's 2,600 files.

Related MCP server: Semantic Code Search MCP Server

Results

Benchmark

Issues

Repos

BM25 Acc@1

gl Acc@1

Gain (95% CI)

BM25 Acc@5

gl Acc@5

SWE-bench Verified

500

12

24.0%

49.2%

+25.2 [+21.0, +29.4]

54.8%

76.0%

SWE-bench (full test)

2,294

12

25.9%

48.4%

+22.5 [+20.5, +24.4]

56.2%

75.0%

SWE-Gym (sample)

479

11

18.0%

41.3%

+23.4 [+19.2, +27.6]

52.2%

73.7%

LocBench

560

165

25.7%

49.3%

+23.6 [+19.5, +27.7]

55.0%

75.0%

SWE-bench-Live (sample)

500

133

28.0%

43.4%

+15.4 [+11.4, +19.4]

55.8%

68.8%

SWE-rebench (sample)

500

351

38.4%

58.8%

+20.4 [+16.2, +24.6]

77.0%

85.2%

SWE-bench Multilingual (9 languages)

299

41

18.7%

36.1%

+17.4 [+13.0, +22.1]

43.8%

62.9%

SWE-PolyBench (sample; mostly JS/TS)

500

19

13.2%

27.4%

+14.2 [+10.8, +17.6]

33.4%

50.8%

Fresh issues, opened after the model's cutoff

28

7

28.6%

50.0%

+21.4 [+0.0, +42.9]

57.1%

71.4%

Acc@k is the share of issues where a file changed by the real fix is in the top k. Ground truth is always the actual fix, never our own labels. Samples are seeded (500 instances); 21 SWE-Gym instances were skipped because their commits are no longer fetchable. The 28-issue fresh set is small and should be read as a sanity check.

By language (pooled):

  • Large gains: Python 27 → 49%, Go 15 → 42%, PHP 16 → 47%, Java 20 → 39%, Rust 15 → 33%, Ruby 18 → 34%, JavaScript 14 → 29%.

  • Weak spots: C 35 → 39% (C functions have no keyword for the regex symbol extractor to match) and TypeScript 9 → 14%.

Full tables are in eval/results/loc_summary.md.

Configuration

Acc@1

Plain BM25 (English analyzer)

25.7%

Code-aware analyzer only (camelCase/snake_case splitting, symbol and path fields)

39.0%

Full gl

48.3%

Full, without the test-file penalty

44.7%

Full, without stack-trace and path signals

46.7%

Full, without symbol signals

46.3%

Does better search help AI coding agents?

We gave the same agent the same 20 issues three times: with grep only, with grep + Graphify (a popular code knowledge graph), and with grep + gl. All 380 tool calls went through a logged harness with identical output caps.

grep

grep + Graphify

grep + gl

SWE-bench Lite: Acc@1

100%

100%

100%

Fresh post-cutoff issues: Acc@1

85%

85%

85%

Fresh: calls to the extra tool per run

–

0.0

0.3

IMPORTANT

On SWE-bench, agents had memorised the repos. They grepped straight to the right file on their first search, so SWE-bench can't evaluate agent search tools.

On fresh issues, agents ignored the extra tools, and accuracy was identical. All three toolkits missed the same 3 issues, which were reasoning errors, not search errors.

gl nearly doubles top-1 accuracy where no LLM is in the loop (triage bots, CI, small local models). A frontier agent with grep was already at 85%. Details, statistics and limitations are in docs/findings.md.

Use it with your tools

gl mcp serves locate, search and symbol over stdio. It re-scans on every call (cheap thanks to the cache), so results stay fresh while the agent edits.

claude mcp add gl -- gl mcp                                        # Claude Code
{ "mcpServers": { "gl": { "command": "gl", "args": ["mcp"] } } }

Cursor: .cursor/mcp.json. Our A/B shows agents rarely pick a new tool unprompted, so tell yours to start with locate.

Agents rarely choose to call a new tool, so the hook doesn't wait for one. gl hook runs on every prompt. When the ranking is confident, it adds the top files to the model's context (about 300 tokens, no tool call). Otherwise it does nothing.

{ "hooks": { "UserPromptSubmit": [ { "hooks": [ { "type": "command", "command": "gl hook" } ] } ] } }

Add to .claude/settings.json. Whether this helps agents is exactly what the pilot experiment measures; see findings.

This posts the top-k likely files as a comment on every new issue. It's where gl measurably helps, because no LLM is in the loop.

# .github/workflows/issue-triage.yml in the repo you want triaged
on: { issues: { types: [opened] } }
permissions: { issues: write, contents: read }
jobs:
  suggest-files:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: soham504/gl-code-search@main
        with: { k: "5" }

The comment format is tested locally; the Action hasn't been run on a real repository yet.

How it works

flowchart LR
    I["Issue text"] --> Q["Signals: stack-trace frames, file paths, dotted modules, backticked symbols"]
    I --> A
    R[("Repository")] --> A["Code-aware analyzer: camelCase / snake_case splitting, stemming, symbol + path fields"]
    A --> X[("BM25 index + symbol table, cached by file mtime")]
    X --> S["Score = BM25 + signal boosts − test-file penalty"]
    Q --> S
    S --> O["Ranked files + reasons"]
    O --> C1["CLI"] & C2["MCP server"] & C3["GitHub Action"]
make test                                                   # Go + Python unit tests
python3 -m venv .venv && .venv/bin/pip install pyarrow -e '.[dev]'
.venv/bin/python harness/datasets.py                        # 8 public benchmarks → data/bench/
go build -o bin/locbench ./go/cmd/locbench
./bin/locbench -data data/bench/swebench_verified.jsonl -repos data/repos -name verified -fetch -j 8
python3 harness/mine.py > data/fresh/instances.jsonl        # fresh post-cutoff issues from git history
.venv/bin/python -m groundline.locsummary                   # cross-benchmark table
.venv/bin/python -m groundline.readme_assets                # regenerate the charts on this page

The agent A/B prompt and workflow are in harness/agent_ab.workflow.js; the dispatcher that enforces each toolkit is harness/tool.py.

Path

What

go/internal/code

Analyzer, symbol extraction, issue signals, ranking, analysis cache, git-object loader

go/internal/index

Inverted index + BM25

go/cmd/gl

CLI and MCP server

go/cmd/locbench

Offline localization benchmark with ablations; fetches single commits on demand

action.yml

GitHub Action

harness/

Dataset normalisation, fresh-issue mining, agent tool dispatcher, A/B workflow

py/groundline/

A/B statistics, cross-benchmark summary, chart generation

eval/results/

Every report and per-instance result

docs/findings.md

Full write-up with limitations

go/cmd/bench, go/cmd/searchd, docs/archive/

Earlier work: BM25 on BEIR, a self-graded grounding pilot (superseded)

IR-based bug localization is an established research area. gl builds on it rather than inventing it:

  • BugLocator (Zhou et al., ICSE 2012) ranks files by bug-report similarity.

  • BRTracer (Wong et al., ICSME 2014) adds stack traces and segmentation.

  • Locus (Wen et al., ASE 2016) adds change histories.

  • ABLoTS (2024 replication) learns to combine signals.

  • In the LLM era, Agentless (Xia et al., 2024) localizes hierarchically with LLMs, Aider's repo map injects a tree-sitter + PageRank summary into every prompt, and SweRank (2025) trains code rankers.

What's different here:

  • No LLM or training at all. It's one Go binary, with multi-language support and an incremental cache.

  • Evaluated at scale. 10 public and fresh benchmarks, with confidence intervals and ablations.

  • Shipped as agent infrastructure. MCP, a context-injection hook and an Action.

  • Measured against agents. A controlled A/B shows whether agents benefit at all.

Limitations

  • Small agent study: 20 issues per condition and one model; tools were offered, not required.

  • Simple symbol extraction: it's regex-based. It finds types but not methods in Java and C#.

  • Fresh-issue gold isn't hand-checked: it comes from Fixes #N commits.

See docs/findings.md for the rest.

MIT licensed. Built with Go, plain BM25, and careful measurement.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables semantic code search across multiple repositories using natural language queries. Provides intelligent code discovery, symbol lookups, and cross-repo dependency analysis for AI coding agents.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides AI coding agents with structured access to indexed codebases via semantic search, symbol analysis, and file reading tools.
      13
      Server Side Public , v 1
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables code intelligence through semantic, structural, graph, and text search across indexed repositories, allowing AI agents to quickly locate the exact code they need.
      16 npm
      3
      MIT