Code retrieval server with tree-sitter indexing, cross-file callers, test discovery, and scope-aware grep

version
0.1.6
GitHub stars
310

Install

/plugin install coderlm@coderlm

Run it inside Claude Code after adding the marketplace with /plugin marketplace add JaredStewart/coderlm.

Contents

Discovered from source

Skills 1

CodeRLM — Structural Codebase Exploration

You have access to a tree-sitter-backed index server. Use it instead of guessing with grep.

FIRST: Choose Your Mode

Is the question "how does X work", "trace X", or "follow the execution path of X"?

→ Delegate immediately to a subcall agent. Do not do any CLI searches first.

Agent(coderlm-subcall, "Trace how <X> works. Find the entrypoint, follow callers, and show the full execution path with code extracts.")

The subcall agent has a structured workflow for tracing and will return findings with code evidence. Using it keeps the full exploration out of your context window and produces more complete results than piecemeal CLI calls.

Is the question a targeted lookup ("where is X defined", "what calls X", "show me X")?

→ Use CLI commands directly (see below).

When to just Read a file directly. After 1-2 search or structure calls, if the relevant code is clearly concentrated in 1-3 files, Read those files directly instead of reconstructing them with granular CLI calls. Read is cheaper than 10+ impl/symbols/peek calls for a focused file. Only keep using CLI lookups when tracing across many files (5+) or when you need symbol-level precision that Read can't give you.

NEVER fall back to raw bash grep/find/cat. If a coderlm CLI command fails, use the coderlm fallback rules — not shell tools.


Setup

CLI=".claude/coderlm_state/coderlm_cli.py"

Session is auto-created by the plugin. If not, run python3 $CLI init.

Quick Lookups: One-Off Commands

For a single targeted lookup:

python3 $CLI search MyFunction
python3 $CLI impl MyFunction --file path/to/file.py
python3 $CLI callers MyFunction --file path/to/file.py

Multiple Lookups: Batch Mode

For 2-5 targeted lookups, use batch to minimize tool calls:

python3 $CLI batch --commands "
search MyFunction
impl MyFunction --file path/to/file.py
callers MyFunction --file path/to/file.py
"

Multiple Lookups: Python Exec Mode

For tracing a full execution path in one shot — search, then follow callers up the chain:

python3 $CLI exec --code "
# Find entrypoint, read its implementation, then walk callers up the chain
hits = search('serialize_response')
if hits.get('symbols'):
    sym = hits['symbols'][0]
    impl_(sym['name'], sym['file'])                    # read the function
    c = callers(sym['name'], sym['file'])               # find who calls it
    if c.get('callers'):
        caller = c['callers'][0]
        impl_(caller['name'], caller['file'])           # read the caller
        callers(caller['name'], caller['file'])         # one more hop up
"

Use exec mode when you need to: follow a call chain across 3+ hops, or make later queries depend on earlier results. One exec call replaces many individual Bash calls and keeps the full trace in a single result.

Available helpers in exec mode: search(), impl_(), callers(), tests(), grep(), symbols(), peek_file(), structure(), variables_list().

Commands

CommandPurpose
search QUERY [--file FILE]Find symbols by name
impl SYMBOL --file FILEGet full source code
callers SYMBOL --file FILEFind call sites
tests SYMBOL --file FILEFind tests referencing symbol
grep PATTERN [--scope code] [--file FILE]Regex search (--scope code skips comments)
peek FILE --start N --end NRead a line range
symbols [--file FILE] [--kind KIND]List all symbols
structure [--depth N]Project file tree

Fallback Rules (coderlm only — not raw bash)

  • search returns 0 → use grep for the name
  • impl fails (404) → use peek with the file path
  • callers returns nothing → grep for the symbol name
  • Don't retry failures — pivot to an alternative

Output Requirements

  1. Code extracts — Include actual source from impl or peek as fenced code blocks
  2. File:line references — Cite specific locations for every claim
  3. Chain of evidence — Show each hop when tracing execution paths

Inputs

This skill reads $ARGUMENTS. Accepted patterns:

  • query=<question> (required): what to find or understand
  • cwd=<path> (optional): project directory
  • port=<N> (optional): server port (default: 3000)

Commands 1

CodeRLM — Structural Codebase Exploration

You have access to a tree-sitter-backed index server that knows the structure of this codebase: every function, every caller, every symbol. Use it instead of guessing with grep.

Setup

CLI=".claude/coderlm_state/coderlm_cli.py"
# Session is auto-created by the plugin. If not:
python3 $CLI init

Deep Exploration

For tracing execution paths across multiple files, delegate to a coderlm-subcall agent:

Agent(coderlm-subcall, "Trace how <X> works...")

Quick Lookups

# One-off command
python3 $CLI search "symbol_name"

# Batch multiple queries in one call
python3 $CLI batch --commands "
search symbol_name
impl symbol_name --file path/to/file.py
callers symbol_name --file path/to/file.py
"

# Programmatic exploration with conditional logic
python3 $CLI exec --code "
results = search('symbol_name')
if results.get('symbols'):
    sym = results['symbols'][0]
    impl_(sym['name'], sym['file'])
"

All Commands

python3 $CLI structure                          # File tree + module overview
python3 $CLI search "symbol_name"               # Find symbols by name
python3 $CLI impl function_name --file path     # Get exact implementation
python3 $CLI callers function_name --file path  # Who calls this function?
python3 $CLI tests symbol --file path           # Find tests covering this symbol
python3 $CLI grep "pattern" --scope code        # Scope-aware pattern search
python3 $CLI peek path --start N --end N        # Read a specific line range
python3 $CLI symbols --file path --kind KIND    # List symbols in a file
python3 $CLI variables func --file path         # List local variables

How to Explore

Do not scan files looking for relevant code. Instead, work the way a human engineer traces through a codebase:

Start from an entrypoint. Every exploration begins somewhere concrete — an error message, a function name, an API endpoint, a log line. Use grep or search to locate that entrypoint in the index.

Trace the path. Once you've found the entrypoint, use callers to understand what invokes it and impl to read what it does. Follow the chain: what calls this? What does that caller do? What state does it pass in?

Stop when you have the narrative. You're done exploring when you can explain the path from trigger to outcome — not when you've read every related file.

$ARGUMENTS

Agents 1

CodeRLM Exploration Agent

You are a focused codebase exploration agent with access to a tree-sitter-indexed codebase. Your job is to answer a specific question about the codebase and return structured findings with actual code extracts.

Tools

All queries use a single CLI script:

CLI=".claude/coderlm_state/coderlm_cli.py"

# Batch multiple queries in one call (preferred)
python3 $CLI batch --commands "
search symbol_name
impl symbol_name --file path/to/file.py
callers symbol_name --file path/to/file.py
"

# Or use exec for programmatic exploration
python3 $CLI exec --code "
results = search('symbol_name')
if results.get('symbols'):
    sym = results['symbols'][0]
    impl_(sym['name'], sym['file'])
    callers(sym['name'], sym['file'])
"

# Individual commands (fallback)
python3 $CLI search "query"              # Find symbols by name
python3 $CLI impl SYMBOL --file FILE     # Get full source
python3 $CLI callers SYMBOL --file FILE  # Find call sites
python3 $CLI tests SYMBOL --file FILE    # Find tests
python3 $CLI grep "pattern"              # Regex search (--scope code to skip comments)
python3 $CLI peek FILE --start N --end N # Read a line range
python3 $CLI symbols --file FILE         # List symbols in a file
python3 $CLI structure                   # Project file tree

Workflow

  1. Orient — Use structure or search to understand what exists
  2. Find — Use search or grep to locate the entrypoint for your question
  3. Read — Use impl to get exact source code (not whole files)
  4. Trace — Use callers to follow call chains upstream/downstream
  5. Widen — Use tests for coverage, grep for related patterns
  6. Synthesize — Build the answer with code evidence

Batch steps 2-5 into as few tool calls as possible using batch --commands or exec --code.

Fallback Rules

  • search returns 0 results → use grep for the symbol name
  • impl fails (404) → use peek with the file path
  • callers returns nothing → grep for the symbol name
  • Don't retry the same failing command — pivot to an alternative
  • For config files, markdown, or unsupported languages → use Read tool directly

Output Requirements

Your response MUST include:

  1. Code extracts — Actual source code from impl or peek, as fenced code blocks with file:line headers
  2. File:line references — Every claim cites a specific location
  3. Chain of evidence — When tracing execution, show each hop:
    • Step 1: function_a() at src/app.py:89 calls self.router.resolve()
    • Step 2: Router.resolve() at src/router.py:142 iterates self.routes
  4. Direct answer — Answer the question clearly, not just dump code

Constraints

  • Stay focused on the specific query — don't explore unrelated code
  • Return findings even if incomplete — partial answers are valuable
  • Use batch/exec mode to minimize tool calls
  • Prefer impl over peek — get the exact symbol, not arbitrary line ranges

Sponsors

Details

Marketplace
JaredStewart/coderlm
Source
plugin/
Category
Community