diagnose-ci

diagnose-ci is a command for Claude Code from sergei-aronsen/claude-code-toolkit. It costs 64 tokens per session (2,614 once invoked), scanned A, original, MIT.

A command that investigates a failed CI run step by step. CI, or continuous integration, automatically builds and tests code when changes are pushed or a pull request is opened.

In plain words
What is it for?
Use it to diagnose the latest failed run on a branch, a specific GitHub Actions run, or the latest run for a pull request; it then helps reproduce, fix, and verify the issue.
Why use it?
It helps separate real code problems from flaky tests, cache errors, or infrastructure failures before you start making guesses.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md). Also seen: mentions subagents; mentions Claude Code.

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/sergei-aronsen/claude-code-toolkit/diagnose-ci
Clone the repo
git clone --depth 1 https://github.com/sergei-aronsen/claude-code-toolkit

Made for: Claude Code.

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 diagnose-ci

README.md
[![agentmods](https://agentmods.dev/badge/commands/sergei-aronsen/claude-code-toolkit/diagnose-ci.svg)](https://agentmods.dev/commands/sergei-aronsen/claude-code-toolkit/diagnose-ci)
Your own site
<a href="https://agentmods.dev/commands/sergei-aronsen/claude-code-toolkit/diagnose-ci"><img src="https://agentmods.dev/badge/commands/sergei-aronsen/claude-code-toolkit/diagnose-ci.svg" alt="Measured on agentmods" height="20"></a>
Per session 64 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,614 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.1 $0.00064 $0.02614
Opus 5 $0.00032 $0.01307
Sonnet 5 $0.00013 $0.00523
Haiku 4.5 $0.00006 $0.00261

Measured 6d ago against content hash e041c992970a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

diagnose-ci 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 6d 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/diagnose-ci.md · 231 lines

How it starts

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

/diagnose-ci — CI Failure Diagnosis Loop

Purpose

When a PR's CI is red, you need a structured way to find the root cause without losing time to noise (flaky tests, cache misses, infra blips). This command walks the 7 most common CI failure layers in order of increasing effort to fix, so you stop at the cheapest layer that explains the failure.

The loop is designed to be runnable by a single Claude Code session: each step is a concrete action with concrete output, no "investigate further" hand-waving.


Usage

/diagnose-ci [<run-id> | <pr-number>]
  • <run-id> — explicit GitHub Actions run ID. Use this when you already have the URL or gh run list output.
  • <pr-number> — PR number. Resolves to the latest CI run on that PR's head SHA.
  • No argument — picks the latest failed run on the current branch.

Examples:

  • /diagnose-ci — diagnose the latest failure on the current branch.
  • /diagnose-ci 25636200176 — diagnose run ID 25636200176.
  • /diagnose-ci 94 — diagnose the latest failure on PR #94.

When to Use

Use this when:

  • A PR's CI just turned red and you want a triaged diagnosis before guessing.
  • You're rebasing or squashing and want to confirm a specific job is to blame, not noise.
  • Multiple jobs failed in one run and you want to know whether they share a root cause.
  • You hit a pre-merge gate and need to ship a minimal fix, not refactor the whole pipeline.

Do NOT use this when:

  • The CI is green. There is nothing to diagnose; this command will exit with no findings.
  • You are designing a new pipeline. Use /research or read components/github-actions-guide.md.
  • The failure is a well-known intermittent flake your team already has a runbook for. Run the runbook directly.

The 7-Step Loop

The loop runs sequentially. Stop at the first step that explains every failed job.

Step 1 — Fetch the failure surface

Goal: a list of {job, step, conclusion, exit_code, log_tail} for every failed job, not just the one that surfaced first.

Read the full file on GitHub · 231 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. 6d ago First seen · 231 lines · 64 tokens per session scan A e041c992970a

Subscribe to this mod's changes

diagnose-ci is a command published in the GitHub repository sergei-aronsen/claude-code-toolkit (5 stars, last pushed 20d ago), licensed MIT. It adds 64 tokens to every session and 2,614 once invoked, about $0.0003 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.