search

A command that searches a code repository using a plain-language question and reports the declarations that answer it. It includes each result's file, line range, matching words, and surrounding code context.

In plain words
What is it for?
Use it to find functions, classes, or other declarations related to a question, optionally including their callers, callees, or containing code.
Why use it?
It shortens the path from a coding question to the relevant implementation. It also makes results easier to verify by showing exactly where the supporting code is located.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/skymanbp/rag-your-code/search
Clone the repo
git clone --depth 1 https://github.com/skymanbp/rag-your-code
Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 618 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00029 $0.00618
Opus 5 $0.00015 $0.00309
Sonnet 5 $0.00006 $0.00124
Haiku 4.5 $0.00003 $0.00062

Measured 2d ago against content hash 04f3324b3ac8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

search scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/search.md · 57 lines

How it starts

The opening of the file, as written. The whole thing — 57 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Retrieve focused context for: $ARGUMENTS

What to do

python -m ragyourcode.cli search "$ARGUMENTS" --json --limit 8

Add --graph --hops 1 when callers, callees or containment are relevant. Prefer one hop; use two only when the first produced concrete edge evidence.

Then read the returned files and line ranges directly before saying anything about the code. Results are navigation, not the file: results carries the identifier, path, line range, signature, description, score and matched terms, and the code arrives once in context, trimmed to a budget. omitted_for_budget says how many results the context did not reach — read those from the path and line range each result reports, or raise --max-chars. (open is an action of the JSON-lines agent protocol, not a subcommand.)

Cite every claim as path:line, taken from the result rather than remembered.

Matching is lexical by default

The default embedder is a feature hash, so a query sharing no word with a unit scores zero against it — synonyms do not match. Ask in the vocabulary the code uses: prefer retry charge gateway timeout over "重试扣款失败", and try two or three wordings before concluding something is absent.

An empty result is an answer, not a failure

Retrieval returns nothing rather than the unit that ranked least badly. Read diagnosis.reason:

reason what it means what to do
no_query_term_in_index no word of the question is here re-ask in the code's vocabulary, or check the index root
only_ubiquitous_terms_matched only words used throughout matched add a term specific to what you want
too_little_of_the_query_matched most of the question is absent ask something narrower, or write descriptions
matched_terms_are_scattered the words are here, never together the subject is probably not in this repository — say so and stop

Never respond by lowering search.min_coverage or search.min_concentration. That restores the guessing this exists to prevent. If two or three rephrasings all come back empty, report that the repository does not appear to contain it — do not keep going until something is returned.

Read the full file on GitHub · 57 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 57 lines · 29 tokens per session scan A 04f3324b3ac8

Subscribe to this mod's changes

search is a command published in the GitHub repository skymanbp/rag-your-code (1 stars, last pushed 6d ago), licensed MIT. It adds 29 tokens to every session and 618 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.