Skip to main content

A codebase search engine for LLM coding agents

Project description

CodeXLR8

PyPI version Python 3.10+ License CI

A codebase search engine for LLM coding agents. One query, precise results, no noise.

Setup

pip install codexlr8
codexlr8 setup

setup auto-detects MCP clients (Claude Code, Cursor) and injects the server config, then walks you through project configuration. After setup, build the search index:

codexlr8 index .

Your agents now have codebase_search and codebase_index tools. Search from the CLI yourself:

codexlr8 search . "login auth"
# 1. auth/session.py:14-27  [score: 1.60]
#    meta: User authentication — login, logout, session management
#    tags: auth, login, session, security

How It Works

CodeXLR8 indexes your codebase into an SQLite FTS5 database alongside optional .meta.yaml sidecar files that boost ranking precision:

Layer Source Boost
1 Raw file content 0.3× per token
2a File path (filename, directory) 0.5× – 0.8×
2b .meta.yaml summary + tags 0.6× – 0.8×
3 .meta.yaml public_api 1.0× (strongest)

Search uses OR semantics with token-coverage scoring: more matching tokens = higher score. A ≥50% post-filter eliminates single-token noise for multi-word queries. Path weighting (Layer 2a) provides differentiation even without metadata — a file whose name IS the query token ranks above one that merely mentions it.

Scoped search and clustering

# Narrow to a specific directory (like grep -rn "pattern" dir/)
codexlr8 search . "get_visible" --scope lib/mpl_toolkits/

# Cluster results by directory to see where matches concentrate
codexlr8 search . "get_visible" --grouped
# 12 results in 3 directories (8 files) across project:
#   lib/mpl_toolkits/mplot3d/  (5 files)
#     ─ axes3d.py:388  [score: 0.90]
#     ...

# Diagnose your query — see which terms hit, which don't
codexlr8 search . "axes not hiding" --explain
# Query analysis:
#   "axes"    212 matches  — broad term (212/212 results)
#   "not"     77 matches
#   "hiding"  0 matches    — consider dropping or replacing
#   Top score: 1.20 (strong match)

# Combine both — group, then scope to drill down

Search Quality & Fine-Tuning

# Measure search accuracy against known queries
codexlr8 eval . --queries queries.json
# Precision@1: 67%, MRR: 0.83, Recall@5: 67%

# Typos are auto-corrected (fuzzy fallback on zero results)
codexlr8 search . "funtion"  # → corrects to "function"

# Opt-in embeddings: hybrid BM25 + semantic search
# pip install codexlr8[embeddings]
# set embeddings.enabled: true in .codexlr8.yaml

# Fine-tune a model on YOUR codebase vocabulary
codexlr8 recommend-model .   # picks the right model for your size
codexlr8 train .              # TSDAE training, 5-45min on CPU
codexlr8 eval .               # measure improvement

.meta.yaml Sidecars

Optional YAML files next to source files, created by codexlr8 init:

public_api: [login, logout, reset_password]
summary: "User auth: login, session, password reset"
tags: [auth, security, session]
invariants:
  - "db.connect() must be called first"

Files without .meta.yaml still get indexed — metadata just produces higher ranking scores.

Configuration

Optional .codexlr8.yaml at the project root:

root: "."
include: []                     # scope: only scan these
exclude:                        # skip these
  - tests/*
  - test_*
extensions:                     # file types to index
  - .py
  - .js
ignore_dirs:                    # skip entirely
  - .git
  - __pycache__

All fields have defaults. Use codexlr8 setup to create one interactively, or edit by hand.

Agent Integration

Works with Claude Code, Cursor, Windsurf, Continue.dev and any MCP-compatible client.

codexlr8 setup auto-detects installed clients and offers to inject the MCP server config. For manual setup, add this to your client's config:

{
  "mcpServers": {
    "codexlr8": {
      "command": "uvx",
      "args": ["codexlr8", "mcp-server"]
    }
  }
}

Tools available to agents:

Tool Description
codebase_search(query, path?, limit?, exclude?) Search the codebase, return ranked results
codebase_index(path?, incremental?, exclude?) Build or update the search index

The included agent skill (SKILL.md) teaches agents to search before reading files, maintain .meta.yaml sidecars, and keep the index fresh.

Commands

codexlr8 setup            Interactive project + MCP config
codexlr8 scan <path>      List source files and line counts
codexlr8 init <path>      Bootstrap .meta.yaml sidecars
codexlr8 index <path>     Build the search index
codexlr8 search <path> <q> Search the codebase
codexlr8 status <path>    Show index coverage and age
codexlr8 install-skill    Install agent skill for Claude Code
codexlr8 mcp-config       Print MCP client config JSON

Contributing

See AGENTS.md for principles and development guidelines.

License

Apache 2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codexlr8-0.0.3.tar.gz (42.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codexlr8-0.0.3-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file codexlr8-0.0.3.tar.gz.

File metadata

  • Download URL: codexlr8-0.0.3.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codexlr8-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f067bd8bc521251dce16d34fe55755fb7408a83295a71d96a868cbfff4e97612
MD5 e0e371f3a4ddc0dc8e58c965d3a05239
BLAKE2b-256 2169e7e572bb30a07b2c812ff1ba9b5268247d9173a7a5ff42cea53931fb0a3f

See more details on using hashes here.

File details

Details for the file codexlr8-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: codexlr8-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 37.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codexlr8-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 073dc83af4080da5edbb9ba97a8d3cdd16448db3e2a466fc2607777b1fb641b2
MD5 3e722e9eb01bd82b0bd5a014eb672717
BLAKE2b-256 3bd3b3cbb33195b9df41e716acea2a55e5dc7be2e4e0be81b19bccea7d616c23

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page