analyze

analyze is a command for coding agents from MadAppGang/magus. It costs 31 tokens per session (1,017 once invoked), scanned A, original, MIT.

A read-only codebase investigation command that traces architecture, feature flows, file locations, bugs, patterns, and dependencies.

In plain words
What is it for?
Use it to locate an implementation, follow a request from an endpoint to a database, explain how a system works, or investigate a bug.
Why use it?
It helps you understand unfamiliar code and find where a problem begins without changing any files.

Command

Part of the code-analysis plugin — 3 skills, 3 commands, 1 agent, 1 hook 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 commands/madappgang/magus/analyze
Clone the repo
git clone --depth 1 https://github.com/MadAppGang/magus

Or install code-analysis, the plugin that ships this one along with the rest of its 3 skills, 3 commands, 1 agent, 1 hook.

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 analyze

README.md
[![agentmods](https://agentmods.dev/badge/commands/madappgang/magus/analyze.svg)](https://agentmods.dev/commands/madappgang/magus/analyze)
Your own site
<a href="https://agentmods.dev/commands/madappgang/magus/analyze"><img src="https://agentmods.dev/badge/commands/madappgang/magus/analyze.svg" alt="Measured on agentmods" height="20"></a>
Per session 31 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,017 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.00031 $0.01017
Opus 5 $0.00015 $0.00508
Sonnet 5 $0.00006 $0.00203
Haiku 4.5 $0.00003 $0.00102

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

Security

Grade A, and why

analyze 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 5d 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.

plugins/code-analysis/commands/analyze.md · 127 lines

How it starts

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

Mission

Dispatch the code-analysis:detective agent at one question about this codebase. The answer comes back as file:line locations and the flow between them. Nothing is modified.

Analysis request

$ARGUMENTS

When to use it

  • Architecture — how is authentication implemented, what does the data layer look like
  • Location — where is the user registration logic, which file handles payments
  • Flow — follow a request from endpoint to database
  • Bugs — why login fails, where an error originates
  • Patterns — where API calls are made, which components use a given store
  • Dependencies — what uses this service, what breaks if it changes

Step 1 — read the request

Parse three things out of $ARGUMENTS before dispatching:

  1. What do they want to understand?
  2. Which functionality does it concern?
  3. What is the context — debugging, learning, or refactoring? The same question wants a different answer in each.

A specific question beats a broad one. "Analyze the codebase" buys a tour; "where is the email validation logic" buys a file and a line number. If the request is broad enough that the investigation would be spent on orientation, narrow it first — ask which part matters, or state the narrower question you are about to answer and why.

Step 2 — dispatch the detective

Agent(
  subagent_type: "code-analysis:detective",
  run_in_background: false,
  description: "Investigate [brief description]",
  prompt: `
    Investigate the following in the codebase:

    [the request, restated as one specific question]

    Context: [debugging | learning | refactoring]
    Working directory: [current working directory]

    Return:
    1. Exact file:line locations
    2. The code at those locations, quoted
    3. How the mechanism works
    4. Related files and dependencies, inbound and outbound
    5. A flow diagram when the path crosses more than two or three hops

    Name the method behind each finding, and say what the configured engine could not answer.
  `
)

Read the full file on GitHub · 127 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. 5d ago First seen · 127 lines · 31 tokens per session scan A 387b1a42bedd

Subscribe to this mod's changes

analyze is a command published in the GitHub repository MadAppGang/magus (9 stars, last pushed yesterday), licensed MIT. It adds 31 tokens to every session and 1,017 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-31.