monocle
Analyze Monocle trace JSON files. Use for debugging agent test failures, answering questions about traces, or inspecting agent behavior.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Analyze Monocle trace JSON files. Use for debugging agent test failures, answering questions about traces, or inspecting agent behavior.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | monocle |
| description | Analyze Monocle trace JSON files. Use for debugging agent test failures, answering questions about traces, or inspecting agent behavior. |
| allowed-tools | Bash, Read, Glob, Grep, Edit, Write |
| argument-hint | [optional: question or specific error/test name to focus on] |
You analyze ADK (Agent Development Kit) agent traces using Monocle observability data.
Based on the user's message, determine which mode to operate in:
If unclear, default to query mode (read-only, no archiving).
Search for trace files in both .monocle/ and .monocle_archive/. Use Glob to find files matching .monocle/**/*.json and .monocle_archive/**/*.json. Prefer the most recent files (by filename timestamp or modification time).
If no JSON files are found anywhere, inform the user and stop.
Read the relevant trace JSON file(s). Extract and present information based on the user's question. Key fields:
"test.status" field ("passed" or "failed")"test.assertion.message" for failure reasonsparent_id relationships"entity.1.name" fields"span.type": "agentic.tool.invocation"events arrays with data.input and data.output"entity.2.name"workflow -> agentic.turn -> agentic.invocation -> inference / agentic.tool.invocationAnswer the user's question concisely. Note any observations (e.g., tools not called, unexpected responses) even if the test passed.
Archive any existing JSON files in .monocle/ from prior runs so analysis starts clean. Use the archive bash snippet (see below). If there are no files to archive, skip silently.
Then run the failing test (if the user hasn't already), which will generate fresh traces.
Search .monocle/ recursively for all JSON files using Glob matching .monocle/**/*.json.
If no JSON files are found in .monocle/, inform the user and stop.
Read the latest Monocle trace JSON file(s). Focus on extracting:
"test.status" field ("passed" or "failed") in span attributes"test.assertion.message" field for the exact failure reasonparent_id relationships between spans"entity.1.name" fields (e.g., adk_flight_booking_agent, adk_hotel_booking_agent)"span.type": "agentic.tool.invocation" to see which tools were calledevents arrays for data.input and data.output events to understand what each agent received and responded"entity.2.name" for the model (e.g., gemini-2.5-flash)workflow -> agentic.turn -> agentic.invocation -> inference / agentic.tool.invocationBased on the trace analysis, determine:
"Tool 'X' was not invoked")Compare failed traces against any passing traces (if available in the same batch) to pinpoint what differs.
Based on the diagnosis, read the relevant source files:
LlmAgent, SequentialAgent configurations)tools=[])tests/ to understand what the test expectsBased on the trace analysis and source code review:
Common fixes include:
instruction prompts to be more directive about tool usagetools=[] listAfter analysis is complete (and after any verification test re-runs), archive ALL JSON files from .monocle/ to .monocle_archive/.
IMPORTANT: Only archive in debug mode, never in query mode.
Use this bash snippet for archiving:
# Create archive dir, move files with timestamp prefix, preserve structure
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
find .monocle -name "*.json" -type f | while read f; do
REL="${f#.monocle/}"
DIR=".monocle_archive/$(dirname "$REL")"
mkdir -p "$DIR"
BASENAME=$(basename "$REL")
mv "$f" "$DIR/${TIMESTAMP}_${BASENAME}"
done
$ARGUMENTS