pre-commit-risk-scoring

A pre-commit check that compares current code changes with PagerDuty incidents, which are records of service problems and alerts.

In plain words
What is it for?
Use it before committing code to assess possible service risk through PagerDuty data.
Why use it?
It helps identify whether a change may be risky before you commit it, using recent operational incidents as context.

Command

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/pagerduty/claude-code-plugins/pre-commit-risk-scoring
Clone the repo
git clone --depth 1 https://github.com/PagerDuty/claude-code-plugins
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,326 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.00015 $0.03326
Opus 5 $0.00008 $0.01663
Sonnet 5 $0.00003 $0.00665
Haiku 4.5 $0.00002 $0.00333

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

Security

Grade A, and why

pre-commit-risk-scoring 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.

commands/pre-commit-risk-scoring.md · 240 lines

How it starts

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

You are performing a pre-commit risk assessment. Follow these steps precisely and in order. Do not skip steps. Do not silently degrade -- if a required tool is unavailable, stop and tell the user.

Step 0: Pre-flight Checks

Before doing anything else, verify that the required MCP tools are available.

0a: Verify PagerDuty MCP

First, call ToolSearch with query "select:mcp__plugin_pagerduty_pagerduty__get_service,mcp__plugin_pagerduty_pagerduty__list_services,mcp__plugin_pagerduty_pagerduty__list_incidents,mcp__plugin_pagerduty_pagerduty__list_incident_notes,mcp__plugin_pagerduty_pagerduty__list_service_change_events" to load all required PagerDuty tools. If ToolSearch returns no results, STOP immediately (see error below).

Once loaded, call mcp__plugin_pagerduty_pagerduty__list_services with query "test". This is a connectivity check.

If ToolSearch returns no PagerDuty tools, or the connectivity call fails, STOP and tell the user:

PagerDuty MCP server is not available. This plugin requires it.

To fix:
1. Set the PAGERDUTY_API_KEY environment variable with a valid PagerDuty API token
2. Restart Claude Code so the plugin's MCP server configuration is loaded
3. Re-run /pagerduty:pre-commit-risk-scoring

Do NOT proceed without PagerDuty MCP. Do NOT fall back to a degraded assessment. The entire point of this plugin is PagerDuty incident correlation.

0b: Verify changes exist

Run git diff --stat and git diff --cached --stat to check for uncommitted changes (unstaged and staged).

If both are empty, run git log -1 --oneline and tell the user:

No uncommitted changes detected. The most recent commit is:
<commit hash and message>

/pagerduty:pre-commit-risk-scoring analyzes uncommitted changes. Make some changes first, or if you want to assess the last commit, let me know.

Then STOP. Do not proceed to analyze committed history on your own.

Step 1: Resolve Service Mapping

Determine the PagerDuty service ID for this repository. Follow the steps in order and stop at the first one that resolves a service.

Read the full file on GitHub · 240 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 · 240 lines · 15 tokens per session scan A d26d4849e1fc

Subscribe to this mod's changes

pre-commit-risk-scoring is a command published in the GitHub repository PagerDuty/claude-code-plugins (6 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 15 tokens to every session and 3,326 once invoked, about $0.0001 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.