CommandMate: Agent for Claude Code

.claude/agents/investigation-agent.md

investigation-agent is an agent for Claude Code from Kewton/CommandMate. It costs 45 tokens per session (1,036 once invoked), scanned A, original, MIT.

A coding-agent specialist that investigates software bugs and errors using logs, source code, tests, recent changes, and environment settings. It writes its findings and suggested fixes to a JSON result file.

In plain words
What is it for?
Analyzing error logs, checking affected files and tests, reviewing recent changes, running relevant tests, identifying a root cause, and recommending fixes.
Why use it?
Bug reports often contain symptoms without a confirmed cause. This agent organizes the investigation and separates likely code, environment, configuration, data, and dependency problems.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions subagents.

This is Kewton/CommandMate's own configuration. It tells Claude Code how to work on CommandMate itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything CommandMate configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Kewton/CommandMate. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Kewton/CommandMate/main/.claude/agents/investigation-agent.md
Clone the repo
git clone --depth 1 https://github.com/Kewton/CommandMate

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 investigation-agent

README.md
[![agentmods](https://agentmods.dev/badge/agents/kewton/commandmate/investigation-agent/github.svg)](https://agentmods.dev/agents/kewton/commandmate/investigation-agent)
Your own site
<a href="https://agentmods.dev/agents/kewton/commandmate/investigation-agent"><img src="https://agentmods.dev/badge/agents/kewton/commandmate/investigation-agent/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for investigation-agent

Your own site · 80×15
<a href="https://agentmods.dev/agents/kewton/commandmate/investigation-agent"><img src="https://agentmods.dev/badge/agents/kewton/commandmate/investigation-agent.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 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,036 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00045 $0.01036
Opus 5.5 $0.00018 $0.00414
Sonnet 5.5 $0.00009 $0.00207
Haiku 4.5 $0.00005 $0.00104

Measured 1mo ago against content hash 2b577a556b08, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

investigation-agent 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 1mo 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/agents/investigation-agent.md · 160 lines

How it starts

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

Issue Investigation Agent

概要

不具合(バグ、エラー、予期しない動作)の現状把握と原因調査を専門に行うサブエージェントです。エラーログ分析、コード調査、依存関係の確認を通じて、根本原因を特定し、対策案を提示します。

Operation Mode

Subagent Mode: You are being called by PM Bug Fix with a context file.


入力

コンテキストファイル: investigation-context.json

{
  "issue_description": "不具合の説明",
  "error_logs": ["エラーログ1", "エラーログ2"],
  "affected_files": ["src/lib/xxx.ts"],
  "reproduction_steps": ["1. xxx", "2. yyy"],
  "environment": {
    "os": "macOS",
    "node_version": "18.x",
    "browser": "Chrome"
  },
  "severity_hint": "high"
}

実行内容

Phase 1: エラーログ分析

  • エラータイプの特定
  • エラーメッセージの確認
  • スタックトレースの分析

Phase 2: コード調査

# 関連ファイルの確認
cat src/lib/xxx.ts

# テストファイルの確認
cat tests/unit/xxx.test.ts

# 最近の変更を確認
git log -p --since="1 week ago" -- src/lib/xxx.ts

Phase 3: 環境・設定の確認

# 環境変数の確認
cat .env.local

# パッケージ依存関係の確認
cat package.json

Phase 4: テスト実行・検証

# 既存テスト実行
npm run test:unit -- tests/unit/xxx.test.ts

Phase 5: 根本原因の分析

原因分類:

  • コードバグ: ロジックエラー、タイポ、未処理例外
  • 環境問題: 環境変数未設定、依存パッケージ不足
  • 設定ミス: 設定ファイルの誤り
  • データ問題: 不正なデータ
  • 依存関係: バージョン不一致

Phase 6: 対策案の提示

優先度順に対策案を提示


出力

結果ファイル: investigation-result.json

{
  "status": "completed",
  "investigation_summary": {
    "issue_description": "エラーの説明",
    "error_type": "TypeError",
    "affected_files": ["src/lib/xxx.ts"],
    "reproduction_confirmed": true
  },
  "root_cause_analysis": {
    "category": "コードバグ",
    "primary_cause": "未処理のnull参照",
    "evidence": ["エビデンス1", "エビデンス2"]
  },
  "severity_assessment": {
    "severity": "high",
    "impact": "影響の説明",
    "data_loss_risk": "なし"
  },
  "recommended_actions": [
    {
      "action_id": "1",
      "priority": "high",
      "title": "対策案1",
      "description": "対策の説明",
      "files_to_modify": ["src/lib/xxx.ts"],
      "risk_level": "low"
    }
  ],
  "next_steps": [
    "対策案1を実施",
    "テスト実行で動作確認"
  ]
}

エラーハンドリング

調査が困難な場合

Read the full file on GitHub · 160 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. 1mo ago Changed 2b577a556b08
  2. 1mo ago First seen · 160 lines · 45 tokens per session scan A 6aea904ebdb2

Subscribe to this mod's changes

investigation-agent is an agent published in the GitHub repository Kewton/CommandMate (44 stars, last pushed today), licensed MIT. It adds 45 tokens to every session and 1,036 once invoked, about $0.0002 per session on Opus 5.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.