/judgeval:trace-claude-codefrom judgeval
Automatically trace Claude Code sessions to Judgeval for observability and debugging.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /judgeval:trace-claude-code still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Automatically trace Claude Code sessions to Judgeval for observability and debugging.
judgment.session_idClaude session_id
├── Trace for user turn 1
│ └── Task
│ ├── claude-opus-4-5 (llm span)
│ ├── Read (tool span)
│ └── Subagent: code-reviewer (task span)
└── Trace for user turn 2
└── Task
└── claude-opus-4-5 (llm span)
After installing the plugin, run setup in your project directory:
cd /path/to/your/project
bash ~/.claude/plugins/marketplaces/judgeval-claude-plugin/skills/trace-claude-code/setup.sh
This will prompt you for:
JUDGMENT_API_KEY - Your Judgeval API keyJUDGMENT_ORG_ID - Your organization IDJUDGMENT_API_URL - API URL (default: https://api.judgmentlabs.ai)JUDGEVAL_CC_PROJECT - Project name (default: claude-code)| Variable | Required | Description |
|---|---|---|
TRACE_TO_JUDGEVAL | Yes | Set to true to enable tracing |
JUDGMENT_API_KEY | Yes | Your Judgeval API key |
JUDGMENT_ORG_ID | Yes | Your organization ID |
JUDGMENT_API_URL | No | API URL (default: https://api.judgmentlabs.ai) |
JUDGEVAL_CC_PROJECT | No | Project name (default: claude-code) |
JUDGEVAL_CC_DEBUG | No | Set to true for debug logging |
| Hook | Trigger | Action |
|---|---|---|
session_start.sh | Session begins | Records session metadata |
user_prompt_submit.sh | User sends prompt | Creates a new trace and Task span for the turn |
stop_hook.sh | Response complete | Parses transcript delta and finalizes the turn trace |
subagent_stop.sh | Subagent completes | Parses subagent transcript, creates nested spans |
session_end.sh | Session ends | Fallback-finalizes any open turn trace, then flushes the upload queue |
Hooks never perform network I/O and always exit 0, so they cannot change
Claude Code's behavior or add meaningful latency. Spans are appended to a
local queue (~/.claude/state/judgeval_queue/) and uploaded by a detached
background worker (worker.sh) with bounded, retried, time-limited requests;
project-name resolution also happens in the worker. Each hook registers with
an explicit timeout as a hard backstop.
judgment.span_kind: "task"judgment.input: JSON envelope with session metadata, prior conversation history, current user prompt, and tool context used by the turnjudgment.output: JSON envelope with session metadata, assistant output, and the conversation after the turnjudgment.session_id: Claude Code session IDturn_index: Turn number within the Claude sessionjudgment.span_kind: "llm"judgment.input: Conversation historyjudgment.output: Model responsejudgment.llm.model: Model namejudgment.llm.provider: "anthropic"judgment.usage.non_cached_input_tokens: Input tokensjudgment.usage.output_tokens: Output tokensjudgment.usage.cache_creation_input_tokens: Cache write tokensjudgment.usage.cache_read_input_tokens: Cache read tokensjudgment.span_kind: "tool"judgment.input: Tool inputjudgment.output: Tool outputtool_name: Tool identifierHook logs are written to: ~/.claude/state/judgeval_hook.log
Enable debug logging:
export JUDGEVAL_CC_DEBUG=true
Traces not appearing:
TRACE_TO_JUDGEVAL=true is setMissing spans:
hooks/common.sh (opens in a new tab)hooks/migrate_state.sh (opens in a new tab)hooks/record_event.sh (opens in a new tab)hooks/session_end.sh (opens in a new tab)hooks/session_start.sh (opens in a new tab)hooks/stop_hook.sh (opens in a new tab)hooks/subagent_start.sh (opens in a new tab)hooks/subagent_stop.sh (opens in a new tab)hooks/turn_trace_common.sh (opens in a new tab)hooks/user_prompt_submit.sh (opens in a new tab)hooks/worker.sh (opens in a new tab)setup.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Read when SKILL.md points to them.
Other plugins' skills for the same job
npx claudepluginhub judgmentlabs/judgeval-claude-plugin --plugin judgeval