baz-codebase-exploration

Instructions for exploring code across an organisation’s repositories using Baz’s indexed search tools. A repository is a project containing code and related files.

In plain words
What is it for?
Searching repositories, matching code by name or pattern, finding files by path, and then reading known files from GitHub or GitLab.
Why use it?
They help find the right repositories, symbols, and files before planning changes, especially when the needed code is not checked out locally.

Cursor rule for Cursor

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 rules/baz-scm/baz-plugin/baz-codebase-exploration
Clone the repo
git clone --depth 1 https://github.com/baz-scm/baz-plugin

Made for: Cursor.

Per session 2,175 This file is loaded in full into every session.
When invoked 2,175 The same file — it is already loaded in full.
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.02175 $0.02175
Opus 5 $0.01087 $0.01087
Sonnet 5 $0.00435 $0.00435
Haiku 4.5 $0.00217 $0.00217

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

Security

Grade A, and why

baz-codebase-exploration 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.

.cursor/rules/baz-codebase-exploration.mdc · 112 lines

How it starts

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

Baz Codebase Exploration

This rule applies when planning a change across your org's repos. It applies whether or not the relevant repos are cloned locally — and especially when a change crosses a contract boundary between repos: you edit one side, another repo defines the other. Baz MCP tools replace gh / glab for code search. Use gh / glab only to read a specific file once you already know its path.

When this rule fires

  • The user asks to plan a feature, scope a change, or design an implementation
  • The change might touch more than one repository in the org
  • You own one side of a cross-repo contract (API param, request/response schema, event payload) — even when that side is checked out locally
  • The relevant code lives in repos the user has not cloned locally

Tool routing — strict

Job Tool
Find which repos are involved repo_search (Baz)
Find code by symbol / regex inside a repo remote_grep (Baz)
Find files by name / glob inside a repo remote_file_search (Baz)
Read a specific file you already know the path of gh api repos/<owner>/<repo>/contents/<path>

Forbidden — these are the patterns that cause the most waste:

  • Do not call gh api repos/<owner>/<repo>/git/trees/HEAD?recursive=1. Use remote_file_search instead.
  • Do not call gh search code. Use remote_grep instead.
  • Do not call remote_file_search and then gh api .../git/trees for the same directory. Pick one — and the answer is always remote_file_search.
  • Do not call gh api .../contents/<dir> to walk a directory. That's a search; use remote_file_search.

Step 1: Orient (once)

If the user has not told you which repo(s) to look in, call repo_search exactly once with broad keywords:

repo_search(keywords: ["<topic>", "<topic synonym>"], domains?: ["API", "BUSINESS_LOGIC", ...])

Read the full file on GitHub · 112 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 · 112 lines · 2,175 tokens per session scan A 64879809db23

Subscribe to this mod's changes

baz-codebase-exploration is a cursor rule published in the GitHub repository baz-scm/baz-plugin (10 stars, last pushed 5d ago), licensed MIT. It adds 2,175 tokens to every session, about $0.0109 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.