Anthropic · 2026-10-14 · major
Claude Code 2.1.300 — OpenTelemetry GenAI spans and new mod hooks
Claude Code 2.1.300 adds OpenTelemetry GenAI attributes to trace spans, splits cache-write tokens by 5-minute and 1-hour lifetime, and gives mods a prompt.change hook. It also brings /advisor to Claude Platform on AWS.
Claude Code 2.1.300 makes sessions easier to trace in standard OpenTelemetry tools and gives mods more control over the prompt box.
Quick facts
| Version | v2.1.300 |
|---|---|
| Maker | Anthropic |
| Released | 2026-10-14 |
| Telemetry | gen_ai.* span attributes; cache_creation_5m_tokens / _1h_tokens |
| New mod APIs | virtualText, prompt.change hook, $.ui.view({ agentId }) |
| AWS | /advisor on Claude Platform on AWS (opt-in) |
What is it?
OpenTelemetry GenAI semantic-convention attributes now appear on Claude Code 2.1.300 trace spans, including gen_ai.provider.name, gen_ai.conversation.id, gen_ai.tool.name and error.type. The api_request event also splits cache writes into cache_creation_5m_tokens and cache_creation_1h_tokens.
How does it work?
For mod authors, the release adds virtualText (text drawn in the prompt box that never enters the submitted prompt), a prompt.change hook for history recalls, clears, undos and plugin fills, and $.ui.view({ agentId }) to show an agent's transcript in the main view. The agent.spawn hook can now rewrite a workflow agent's prompt and model instead of only refusing it.
Why does it matter?
Teams that send Claude Code telemetry to an observability stack can now read it with standard GenAI dashboards and see what each cache lifetime costs. Hook authors get stricter behavior: updatedInput from PreToolUse and PermissionRequest hooks is validated like Claude's own input, and exit now force-kills background commands still running after 1.5 seconds.
Who is it for?
Claude Code users with OpenTelemetry pipelines, mod and hook authors, teams on Claude Platform on AWS
Frequently asked questions
- Which OpenTelemetry attributes did Claude Code 2.1.300 add?
- Claude Code 2.1.300 adds OpenTelemetry GenAI semantic-convention attributes to its trace spans, such as gen_ai.provider.name, gen_ai.conversation.id, gen_ai.tool.name and error.type. The api_request event also gains cache_creation_5m_tokens and cache_creation_1h_tokens, so cache writes can be split by their 5-minute or 1-hour lifetime.
- How do I use /advisor in Claude Code on AWS?
- Claude Code 2.1.300 brings /advisor to Claude Platform on AWS. No advisor runs until you pick one with /advisor, the advisorModel setting or the --advisor flag. Setting CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1 turns the advisor tool off completely for that environment.
- What changed for hooks in Claude Code 2.1.300?
- Claude Code 2.1.300 now validates updatedInput from PreToolUse and PermissionRequest hooks the same way it validates Claude's own tool input. Unknown keys are dropped, and input the tool rejects denies the call. The release also fixes SessionEnd hooks sometimes not running when you exit while a background command is still running.
- Can a Claude Code mod change a workflow agent before it starts?
- Claude Code 2.1.300 lets the agent.spawn mod hook rewrite a workflow agent's prompt and model. Before this release, the hook could only refuse a workflow agent. The same version adds the prompt.change hook and virtualText for prompt decorations that never reach the submitted prompt.
Try it
npm i -g @anthropic-ai/claude-code@2.1.300