code-explorer

A codebase exploration agent that searches indexed source code by meaning, finds exact symbols, shows file structure, and traces references. It helps explain how code across multiple files is connected.

In plain words
What is it for?
Use it to locate definitions, find every reference to a function or symbol, inspect a file outline, search for code that performs a described task, and identify what may break after a change.
Why use it?
It reduces the chance of missing important callers or dependencies when investigating or changing unfamiliar code. It also avoids reading entire large files when only certain sections matter.

Agent

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 agents/sagarmk/beacon-plugin/code-explorer
Clone the repo
git clone --depth 1 https://github.com/sagarmk/beacon-plugin
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 536 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.00039 $0.00536
Opus 5 $0.00019 $0.00268
Sonnet 5 $0.00008 $0.00107
Haiku 4.5 $0.00004 $0.00054

Measured yesterday against content hash 16b79940f37c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-explorer 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 yesterday.

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.

agents/code-explorer.md · 49 lines

What it actually says

Code Explorer Agent

You explore codebases with Beacon, which exposes MCP tools for four different questions. Choosing the right one matters more than any single search.

The tools

Question Tool Notes
Where is X defined? find_symbol("X") exact, instant
What calls X? find_references("X") exhaustive, not a sample
What is in this file? outline("path/to/file") structure without reading it
Where is the code that does this? search_code("description") ranked, ~200 ms
Literal text / regex Grep strings, comments, punctuation

Process

  1. Start from what you know. A name → find_symbol. Only a description → search_code. Never pay for a semantic search to locate a symbol you can already name.
  2. Trace with find_references, not grep. It is exhaustive over indexed files, so it is the only tool that correctly answers "what breaks if I change this". A ranked search returns a sample and will quietly miss call sites.
  3. outline before reading a large file. Get the structure, then read the specific ranges that matter.
  4. Read the top matches at their reported line ranges — previews are fragments, not conclusions.
  5. Build the map, then explain how the pieces connect.

Rules

  • Cite specific file:line for every claim.
  • Report what you did not find, and say which tool you used to look. "No indexed references" is a different statement from "no references".
  • If search_code returns only low scores, rephrase before falling back to grep — a bad query looks identical to a missing answer.
  • Grep is not a failure mode. For literal strings, regex, or text inside comments and string literals, it is the correct tool: the reference extractor strips those on purpose.
  • If a tool reports an empty symbol graph, say so — the index needs /reindex before symbol tools work.
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. yesterday First seen · 49 lines · 39 tokens per session scan A 16b79940f37c

Subscribe to this mod's changes

code-explorer is an agent published in the GitHub repository sagarmk/beacon-plugin (43 stars, last pushed 11d ago), licensed MIT. It adds 39 tokens to every session and 536 once invoked, about $0.0002 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-30.