Communitygithub.com

エージェント内省デバッグ

AIエージェントの障害に対して、キャプチャ、診断、限定復旧、内省レポートを用いた構造化された自己デバッグワークフローです。エージェント実行が失敗した際に、再試行ではなく再現可能な診断を提供します。

エージェント内省デバッグ とは?

このスキルは、AIエージェント(Claude Code、Cursor、Codexなど)が繰り返し失敗するランタイム障害を、体系的な自己デバッグワークフローで解決するためのものです。単なる再試行ではなく、障害の正確なキャプチャ、ルート原因の診断、最小限の復旧アクション、そして人間可読な内省レポートの生成という4つのフェーズで構成されます。主な使いどころは、ループ限界到達、コンテキストオーバーフロー、サービス接続エラー、ファイル状態不一致など、エージェントによく見られる障害パターンです。このワークフローは、障害の再現性を高め、開発者が根本原因を理解し、将来的な再発を防ぐための知識を蓄積することを可能にします。ECC(Execution Control Center)の他の検証・学習スキルと統合して使用することを想定しており、環境の前提を検証し、小さな是正行動で復旧することを推奨します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/agent-introspection-debugging

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

エージェント内省デバッグ は何をしますか?

このスキルは、エージェント実行が繰り返し失敗する場合、トークンを消費しながら進捗しない場合、同じツールをループする場合、または意図したタスクから逸脱している場合に使用します。

これはワークフロースキルであり、隠れたランタイムではありません。エージェントが人間にエスカレーションする前に、体系的に自己デバッグすることを教えます。

アクティブ化のタイミング

  • 最大ツールコール数 / ループ制限に達した場合
  • 前に進まずに同一の再試行を繰り返す場合
  • コンテキストの肥大化やプロンプトのドリフトが出力品質を低下させ始めた場合
  • 想定と現実のファイルシステム / 環境状態が一致しない場合
  • 診断と小さな是正措置で回復可能と思われるツール障害が発生した場合

スコープの境界

このスキルは以下のためにアクティブ化します:

  • 盲目的な再試行の前に障害状態をキャプチャするため
  • 一般的なエージェント固有の障害パターンを診断するため
  • 限定された復旧アクションを適用するため
  • 構造化された人間可読なデバッグレポートを生成するため

以下のために主要な情報源としてこのスキルを使用しないでください:

  • コード変更後の機能検証(verification-loopを使用してください)
  • より狭いECCスキルが既に存在する場合のフレームワーク固有のデバッグ
  • 現在のハーネスが自動的に強制できないランタイムの保証

4フェーズのループ

フェーズ1: 障害キャプチャ

回復を試みる前に、障害を正確に記録します。

キャプチャする内容:

  • エラータイプ、メッセージ、スタックトレース(利用可能な場合)
  • 最後の意味のあるツールコールシーケンス
  • エージェントが何をしようとしていたか
  • 現在のコンテキスト圧力:繰り返されるプロンプト、過度に大きなペーストログ、重複した計画、暴走するメモ
  • 現在の環境の前提:カレントディレクトリ、ブランチ、関連するサービス状態、想定されるファイル

最小限のキャプチャテンプレート:

## 障害キャプチャ
- セッション / タスク:
- 進行中の目標:
- エラー:
- 最後の成功したステップ:
- 最後に失敗したツール/コマンド:
- 確認された繰り返しパターン:
- 検証すべき環境の前提:

フェーズ2: ルート原因診断

何かを変更する前に、障害を既知のパターンに照合します。

パターン考えられる原因チェック内容
最大ツールコール数 / 同じコマンドの繰り返しループまたは終了しないオブザーバーパス直近N回のツールコールを繰り返しについて検査する
コンテキストオーバーフロー / 推論能力低下無制限のメモ、繰り返される計画、過度に大きなログ最近のコンテキストを重複と低シグナルの塊について検査する
ECONNREFUSED / タイムアウトサービス利用不可またはポート間違いサービス状態、URL、ポートの前提を確認する
429 / クォータ枯渇再試行ストームまたはバックオフ不足繰り返し呼び出しをカウントし、再試行間隔を検査する
書き込み後にファイルが存在しない / 差分が古い競合、間違ったCWD、またはブランチのドリフトパス、CWD、gitステータス、実際のファイル存在を再確認する
「修正」後もテストが失敗する間違った仮説正確に失敗しているテストを特定し、バグを再導出する

診断の質問:

  • これはロジック障害、状態障害、環境障害、それともポリシー障害ですか?
  • エージェントは本来の目的を見失い、間違ったサブタスクの最適化を始めていませんか?
  • 障害は決定論的ですか、それとも一時的ですか?
  • 診断を検証するための最小の可逆アクションは何ですか?

フェーズ3: 限定復旧

診断対象を変更する最小のアクションで復旧します。

安全な復旧アクション:

  • 繰り返しの再試行を停止し、仮説を言い直す
  • 低シグナルのコンテキストをトリミングし、アクティブな目標、ブロッカー、証拠のみを保持する
  • 実際のファイルシステム / ブランチ / プロセス状態を再確認する
  • タスクを1つの失敗コマンド、1ファイル、または1テストに絞り込む
  • 推測的な推論から直接観察に切り替える
  • 障害が高リスクまたは外部ブロックされている場合は人間にエスカレーションする

実際に現在の環境で実際のツールを使用して行っていない限り、「エージェント状態をリセットする」や「ハーネス設定を更新する」などのサポートされていない自動修復アクションを主張しないでください。

限定復旧チェックリスト:

## 復旧アクション
- 選択した診断:
- 取った最小アクション:
- これが安全である理由:
- 修正が成功したことを証明する証拠:

フェーズ4: 内省レポート

次のエージェントまたは人間が回復プロセスを理解できるようにするレポートで終了します。

## エージェント自己デバッグレポート
- セッション / タスク:
- 障害:
- 根本原因:
- 復旧アクション:
- 結果:成功 | 部分的成功 | ブロック
- トークン / 時間消費リスク:
- 必要なフォローアップ:
- 後でエンコードする予防的変更:

復旧ヒューリスティック

以下の介入を順に優先します:

  1. 本当の目的を一文で言い直す。
  2. メモリを信頼するのではなく、世界の状態を確認する。
  3. 失敗スコープを縮小する。
  4. 1つの識別チェックを実行する。
  5. その後にのみ再試行する。

悪いパターン:

  • 同じアクションをわずかに異なる文言で3回再試行する

良いパターン:

  • 障害をキャプチャする
  • パターンを分類する
  • 1つの直接チェックを実行する
  • チェックがサポートする場合のみ計画を変更する

ECCとの統合

  • コードが変更された場合、復旧後にverification-loopを使用する。
  • 障害パターンを見直しや将来のスキルにする価値がある場合はcontinuous-learning-v2を使用する。
  • 問題が技術的障害ではなく決定の曖昧さである場合はcouncilを使用する。
  • 障害がローカル状態の競合やリポジトリのドリフトに起因する場合はworkspace-surface-auditを使用する。

出力基準

このスキルがアクティブな場合、「修正しました」だけで終了しないでください。

常に以下を提供してください:

  • 障害パターン
  • ルート原因の仮説
  • 復旧アクション
  • 状況が改善されたか、または依然としてブロックされていることを示す証拠

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

api-connector-builder

Build a new API connector or provider by matching the target repo

関連スキル