From judgeval
Automatically trace Claude Code sessions to Judgeval for observability and debugging.
How this skill is triggered — by the user, by Claude, or both
Slash command
/judgeval:trace-claude-codeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Automatically trace Claude Code sessions to Judgeval for observability and debugging.
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:
Guides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Resolves in-progress git merge or rebase conflicts by analyzing history, understanding intent, and preserving both changes where possible. Runs automated checks after resolution.
npx claudepluginhub judgmentlabs/judgeval-claude-plugin --plugin trace-claude-code