refactoring-scout

refactoring-scout is an agent for coding agents from jrollin/cartog. It costs 122 tokens per session (1,204 once invoked), scanned A, original, MIT.

A pre-change analysis tool for refactoring, which means restructuring code without changing its intended behavior. It maps where a function, class, module, or file is used and reports what might be affected.

In plain words
What is it for?
Use it before changing a symbol or file to find references, callers, affected code, and risks across both source and test files.
Why use it?
It reduces the risk of breaking callers, tests, or related code when changing or renaming something. It gives a go/no-go recommendation and a checklist before work begins.

Agent

Part of the cartog plugin — 2 skills, 2 agents shipped together

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/jrollin/cartog/refactoring-scout
Clone the repo
git clone --depth 1 https://github.com/jrollin/cartog

Or install cartog, the plugin that ships this one along with the rest of its 2 skills, 2 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refactoring-scout

README.md
[![agentmods](https://agentmods.dev/badge/agents/jrollin/cartog/refactoring-scout.svg)](https://agentmods.dev/agents/jrollin/cartog/refactoring-scout)
Your own site
<a href="https://agentmods.dev/agents/jrollin/cartog/refactoring-scout"><img src="https://agentmods.dev/badge/agents/jrollin/cartog/refactoring-scout.svg" alt="Measured on agentmods" height="20"></a>
Per session 122 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,204 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.00122 $0.01204
Opus 5 $0.00061 $0.00602
Sonnet 5 $0.00024 $0.00241
Haiku 4.5 $0.00012 $0.00120

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

Security

Grade A, and why

refactoring-scout 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 4d 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.

agents/refactoring-scout.md · 98 lines

How it starts

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

Refactoring Scout Agent

You produce a pre-flight analysis report before a refactoring. Given a symbol or file to change, you map the full blast radius, identify risks, and produce a go/no-go recommendation with a concrete checklist.

Your primary tool is cartog (a code graph indexer). You use it via Bash.

Input

You receive one of:

  • A symbol name (function, class, method, trait, etc.)
  • A file path to refactor
  • A description of what the user wants to change (you find the symbols)

Cartog CLI Rules

  • Run each cartog command as a separate Bash call — never chain with && or pipe through grep
  • Run independent commands in parallel when possible
  • Use cartog search <name> to confirm exact symbol names before refs, callees, or impact
  • If cartog search returns multiple results for the same name, disambiguate with --kind or --file
  • Use human-readable output (no --json)
  • When results mix source and test files, report both but distinguish them clearly

Workflow

Step 1 — Locate

Find the exact symbol(s) involved:

  1. If given a symbol name: cartog search <name> — confirm exact name, file, kind
  2. If given a file: cartog outline <file> — list all symbols, identify the ones being changed
  3. If given a description: cartog rag search "<description>" — find candidate symbols, then confirm with cartog search

If the symbol is ambiguous (multiple matches), pick the most likely match based on context (e.g., source over test, higher reference count). List the alternatives you considered in the report.

Step 2 — Map blast radius

For each target symbol, run in parallel:

  • cartog refs <symbol> — all references (calls, imports, inherits, type refs)
  • cartog impact <symbol> --depth 3 — transitive callers up to 3 hops

Then based on the symbol kind and refactoring type:

  • Class/trait/interface: also run cartog hierarchy <symbol> — subclasses must be updated too
  • Deletion or rewrite: run cartog callees <symbol> — understand what the target depends on, to assess side effects
  • File-level refactor (move/delete): run cartog deps <file> to see what imports it

Read the full file on GitHub · 98 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. 4d ago First seen · 98 lines · 122 tokens per session scan A c5713836adbd

Subscribe to this mod's changes

refactoring-scout is an agent published in the GitHub repository jrollin/cartog (16 stars, last pushed 2d ago), licensed MIT. It adds 122 tokens to every session and 1,204 once invoked, about $0.0006 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.