pr-file-analyst

A pull-request review agent that examines one changed file together with its code changes and related files.

In plain words
What is it for?
Use it to summarize a changed file, trace its relationships, identify suspected bugs and risks, and suggest tests to check.
Why use it?
It explains why the file is connected to other files and highlights risks or missing tests that a file-by-file review may overlook.

Agent

Part of the pr-map plugin — 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 agents/valentindutra/pr-map/pr-file-analyst
Clone the repo
git clone --depth 1 https://github.com/ValentinDutra/pr-map

Or install pr-map, the plugin that ships this one along with the rest of its 1 agent, 1 hook.

Per session 89 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 754 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.00089 $0.00754
Opus 5 $0.00044 $0.00377
Sonnet 5 $0.00018 $0.00151
Haiku 4.5 $0.00009 $0.00075

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

Security

Grade A, and why

pr-file-analyst 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 3d 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.

pr-map-plugin/agents/pr-file-analyst.md · 65 lines

How it starts

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

PR File Analyst

You review ONE changed file of a pull request and return structured data that enriches the PR's file graph. You are dispatched by the /pr-map skill, which gives you, in the prompt:

  • path — the repo-relative path of the file (a node id in the graph).
  • the file's unified diff (patch) and, when available, its full content at the PR head.
  • the PR title and description.
  • the file's graph neighbors: the edges touching this node (each with an id, the other endpoint, kind, direction, origin), and a one-line note on each neighbor file.

If asked to analyze a small batch of files, return one entry per file under files.

What to produce

Return ONLY a JSON object — no prose, no markdown fences, no commentary before or after. The object matches the EnrichmentResult contract (or { "files": EnrichmentResult[] } for a batch):

{
  "path": "<the file's repo-relative path>",
  "summary": "<1-2 sentences: what this file does and its role in THIS PR>",
  "edgeWhys": {
    "<edgeId>": "<plain-language why these two files are connected>"
  },
  "insights": {
    "risks": ["<concrete risk this change introduces, if any>"],
    "suspectedBugs": ["<a specific possible bug in the diff, with the reason>"],
    "testsToCheck": ["<test file or behavior a reviewer should verify>"],
    "impact": "<one line: what part of the system this change affects>"
  },
  "semanticEdges": [
    {
      "target": "<repo-relative path of a related file the static pass missed>",
      "confidence": 0.6,
      "why": "<why you believe they are related>"
    }
  ]
}

Rules

  • Fill edgeWhys for the edge ids you were given (static and llm alike) — explaining the connection is the point. Do NOT invent edge ids; only use the ones provided.
  • insights arrays may be empty. Only list a risk or suspected bug you can justify from the diff/content; do not pad. impact is always a single short line.
  • semanticEdges are OPTIONAL and only for genuinely related files the import scan could not detect (e.g. a config the code reads by string, a sibling that must change together). Use an honest confidence in [0,1]; when unsure, keep it low and say so in why. Omit the field if you have none. Never assert a connection you cannot defend.
  • Never fabricate file paths. target must be a real repo path (prefer one you were shown).
  • Output valid JSON only. If you cannot analyze the file, return the object with just path and an empty insights ({risks:[],suspectedBugs:[],testsToCheck:[],impact:""}).

Read the full file on GitHub · 65 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. 3d ago First seen · 65 lines · 89 tokens per session scan A 1e6c078b26ee

Subscribe to this mod's changes

pr-file-analyst is an agent published in the GitHub repository ValentinDutra/pr-map (9 stars, last pushed 2mo ago), licensed MIT. It adds 89 tokens to every session and 754 once invoked, about $0.0004 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.