cause-analysis

A workflow that investigates the underlying cause of a problem described in a GitHub issue and adds the cause and possible solutions to that issue.

In plain words
What is it for?
Use it to collect issue details, inspect related source code, request deeper analysis from another coding agent, and document the findings and proposed fixes.
Why use it?
It helps move beyond describing symptoms by examining reproduction steps, affected areas, related code, and possible design or edge-case causes.

Command for 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/kewton/commandmate/cause-analysis
Clone the repo
git clone --depth 1 https://github.com/Kewton/CommandMate

Made for: Claude Code.

Per session 23 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,118 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.00023 $0.02118
Opus 5 $0.00012 $0.01059
Sonnet 5 $0.00005 $0.00424
Haiku 4.5 $0.00002 $0.00212

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

Security

Grade A, and why

cause-analysis 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.

.claude/commands/cause-analysis.md · 213 lines

How it starts

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

根本原因分析(Cause Analysis)

概要

Issueに記載されている不具合事象を元に、他のコーディングエージェント(commandmatedev経由)を活用して根本原因を深く分析し、原因と対策案をIssue本文に追記します。

使用方法

/cause-analysis [Issue番号]

例:

/cause-analysis 571
/cause-analysis 576

前提条件

実行内容

あなたはシニアデバッグエンジニアとして、不具合の根本原因を分析します。

重要: commandmatedev で他のコーディングエージェントに分析を委譲する際は、必ず --agent オプションで claude 以外のエージェント(copilot, codex 等)を指定すること。オーケストレーター自身(claude)に送信してはならない。

Step 1: Issue情報の取得

ISSUE_NUM="$ARGUMENTS"
gh issue view "$ISSUE_NUM" --repo Kewton/CommandMate --json number,title,body,labels,comments

Issue本文から以下を抽出:

  • 事象の要約
  • 再現手順
  • 影響範囲
  • 関連するソースコード

Step 2: 事前調査(オーケストレーター側)

Issue本文に記載された関連ソースコードを確認し、分析の初期仮説を立てます。

以下の観点で初期仮説を整理:

観点 内容
直接原因 コードのどの部分が事象を引き起こしているか
根本原因の候補 なぜその状態になるのか(設計問題、仕様漏れ、エッジケース等)
影響パス データフローのどの経路で問題が発生するか

Step 3: 他エージェントによる深層分析

commandmatedevを使用して、develop worktreeの別エージェントに根本原因分析を依頼します。

WORKTREE_ID="mycodebranchdesk-develop"

ANALYSIS_PROMPT="Issue #${ISSUE_NUM} の根本原因分析を実施してください。

## Issue内容
$(gh issue view ${ISSUE_NUM} --repo Kewton/CommandMate --json body -q '.body')

## 分析要求

### Phase 1: 事象の再現パス特定
1. Issue記載の再現手順に基づき、コード上の実行パスを特定してください
2. 関連するソースファイルを読み取り、処理フローを追跡してください
3. 事象が発生する条件(トリガー条件)を具体的に特定してください

### Phase 2: 根本原因の特定
以下の観点で根本原因を分析してください:
- **直接原因**: どのコードが事象を直接引き起こしているか(ファイル名:行番号)
- **根本原因**: なぜそのコードがその状態になるのか
- **設計上の問題**: アーキテクチャや設計レベルで改善すべき点があるか
- **類似リスク**: 同じパターンが他の箇所にも存在するか

### Phase 3: 対策案の策定
以下の粒度で対策案を提示してください:
- **即座対策(Quick Fix)**: 最小限の変更で事象を解消する方法
- **恒久対策(Permanent Fix)**: 根本原因を解消する方法
- **予防策(Prevention)**: 再発を防ぐための設計改善・テスト追加"

# 必ず --agent copilot 等でclaude以外のエージェントを指定する
commandmatedev send "$WORKTREE_ID" "$ANALYSIS_PROMPT" --agent copilot --model claude-opus-4.6 --auto-yes --duration 1h

Step 4: 分析結果の待機と取得

commandmatedev wait "$WORKTREE_ID" --timeout 3600 --on-prompt agent
commandmatedev capture "$WORKTREE_ID" --agent copilot

Read the full file on GitHub · 213 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 · 213 lines · 23 tokens per session scan A fcf700db56b5

Subscribe to this mod's changes

cause-analysis is a command published in the GitHub repository Kewton/CommandMate (39 stars, last pushed 2d ago), licensed MIT. It adds 23 tokens to every session and 2,118 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.