investigation-agent

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

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

Made for: Claude Code.

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. 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.00045 $0.01036
Opus 5 $0.00023 $0.00518
Sonnet 5 $0.00009 $0.00207
Haiku 4.5 $0.00005 $0.00104

Measured 2d ago against content hash 6aea904ebdb2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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/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. 2d 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 (39 stars, last pushed 2d ago), licensed MIT. It adds 45 tokens to every session and 1,036 once invoked, about $0.0002 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.