Claude Code 2.1.145
**`claude agents --json`** unlocks JSON-based session introspection for scripting, enabling tmux-resurrect integration, custom status bars, and programmatic session pickers. This is the first machine-readable gate to live Claude agent state.
New primitives
claude agents --jsoncommandList live Claude sessions as JSON for scripting, integration with tmux-resurrect, status bars, and session pickers
agent_id OTEL span attributecapabilityOTEL trace attribute on `claude_code.tool` spans to track agent identity and enable subagent debugging
parent_agent_id OTEL span attributecapabilityOTEL trace attribute on `claude_code.tool` spans to track parent-child relationships in subagent spans
Status line JSON GitHub contextcapabilityStatus line JSON input now includes GitHub repo and PR information when detected for contextual awareness
/plugin pre-installation metadata displaycapabilityDiscover and Browse screens show a plugin's commands, agents, skills, hooks, and MCP/LSP servers before installation
claude agents awaiting-input indicatorcapabilityTerminal tab title now shows the awaiting-input count so an alt-tabbed window tells you when an agent needs attention
Mouse hover and click in suggestion listcapabilitySlash command and @-mention suggestion list now supports mouse hover and click in fullscreen mode
background_tasks in Stop/SubagentStop hook inputfieldStop and SubagentStop hook input now includes `background_tasks` field for hook-aware task management
session_crons in Stop/SubagentStop hook inputfieldStop and SubagentStop hook input now includes `session_crons` field for hook-aware cron management
Workflow recipes
A subagent orchestrator can now introspect all live Claude sessions, disambiguate parent-child agent relationships through trace attributes, and monitor which agents are waiting for input—enabling tmux-resurrect-style session persistence, automated session pruning, and responsive multi-agent coordination without polling dashboards.
Build a session-shepherd layer that polls claude agents --json every 5 seconds, enriches each session with its trace ancestry via agent_id and parent_agent_id lookups, and emits events when agents transition to awaiting-input state. A parent orchestrator uses these events to decide whether to feed input, spawn a sibling subagent, or gracefully halt a backgrounded chain. On terminal restart, session-shepherd resurrects interrupted subagent trees by replaying the ancestor chain and reattaching to the highest-priority agent.
Stop/SubagentStop hooks can now inspect what background tasks and crons a session owns before teardown, enabling hooks to implement graceful cleanup patterns (drain task queues, migrate crons to persistent storage, or abort stale work). The fixed context: fork loop prevents unintended skill re-invocations that would mask task leaks.
Create a task-drain-hook that fires on SubagentStop, reads background_tasks and session_crons, and implements a drain policy: reschedule high-priority tasks to a recovery queue, log stale crons for audit, and emit a structured "session lifecycle event" for observability. This hook becomes the canonical cleanup surface, ensuring no task or cron is orphaned when a subagent dies unexpectedly. Parent agents can attach this hook globally and trust that all child sessions leave no residue.
A user or automation can now inspect what capabilities a plugin exports (commands, agents, skills, hooks, MCP/LSP servers) before committing to installation, and use fullscreen suggestion navigation to browse plugin catalogs interactively—reducing discovery friction and installation regret.
Build an interactive plugin explorer that lists all installed and candidate plugins in fullscreen, uses hover/click to reveal capabilities, and allows users to stage a plugin install by bulk-previewing metadata. A CI/CD integration can extend this: validate that a plugin exports expected commands/agents/skills before green-lighting a dependency upgrade, catching API mismatches before they break automation.
Agentic relevance
The new `claude agents --json` command enables machine-readable session enumeration critical for autonomous subagent orchestration, tmux-based session recovery, and persistent agent coordination. The OTEL span attributes (`agent_id`, `parent_agent_id`) unlock trace-based debugging and parent-child relationship forensics in complex multi-agent workflows. Stop/SubagentStop hook enrichment (`background_tasks`, `session_crons`) allows hooks to implement cleanup and dependency tracking—essential for safe agent teardown and resource handoff patterns.
Hardening & fixes (13)
- Fixed a permission-prompt bypass where bare variable assignments to non-allowlisted environment variables in Bash commands were auto-approved
- Fixed MCP prompt slash commands showing raw server validation errors when a required argument is omitted — the error now names the missing argument and shows expected usage
- Fixed the spinner and elapsed-time display freezing until a keypress after the terminal was resized or refocused
- Fixed the cross-project resume hint failing in default Windows PowerShell 5.1 — Windows now uses `;` as the command separator
- Fixed voice push-to-talk not working in the agent view's reply pane
- Fixed task lists rendering in random order when several tasks are created at once
- Fixed stale "Failed to install Anthropic marketplace" banner showing when the marketplace is already installed
- Fixed the PR badge in the footer not updating immediately after `gh pr create` and other PR-state-changing commands run in-session
- Fixed Agent Teams teammates with non-ASCII names failing every API call due to invalid header encoding
- Fixed `/review` using a deprecated `projectCards` GraphQL query that errored on repos with Classic Projects
- Fixed `claude plugin validate` not flagging `skills:` entries that point at a file instead of a directory — the error now suggests the parent directory
- Fixed an infinite loop where a skill using `context: fork` could repeatedly re-invoke itself instead of running
- Improved the Read tool to return a truncated first page with a "PARTIAL view" notice instead of a hard error when a whole-file read exceeds the token limit
Raw changelog
## 2.1.145 - Added `claude agents --json` to list live Claude sessions as JSON for scripting (tmux-resurrect, status bars, session pickers) - Added `agent_id` and `parent_agent_id` attributes to `claude_code.tool` OTEL spans, and fixed trace parenting so background subagent spans nest under the dispatching Agent tool span - Status line JSON input now includes GitHub repo and PR information when detected - `/plugin` Discover and Browse screens now show a plugin's commands, agents, skills, hooks, and MCP/LSP servers before installation - `claude agents` terminal tab title now shows the awaiting-input count so an alt-tabbed window tells you when an agent needs attention - Slash command and @-mention suggestion list now supports mouse hover and click in fullscreen mode - Stop and SubagentStop hook input now includes `background_tasks` and `session_crons` fields - Fixed a permission-prompt bypass where bare variable assignments to non-allowlisted environment variables in Bash commands were auto-approved - Fixed MCP prompt slash commands showing raw server validation errors when a required argument is omitted — the error now names the missing argument and shows expected usage - Fixed the spinner and elapsed-time display freezing until a keypress after the terminal was resized or refocused - Fixed the cross-project resume hint failing in default Windows PowerShell 5.1 — Windows now uses `;` as the command separator - Fixed voice push-to-talk not working in the agent view's reply pane - Fixed task lists rendering in random order when several tasks are created at once - Fixed stale "Failed to install Anthropic marketplace" banner showing when the marketplace is already installed - Fixed the PR badge in the footer not updating immediately after `gh pr create` and other PR-state-changing commands run in-session - Fixed Agent Teams teammates with non-ASCII names failing every API call due to invalid header encoding - Fixed `/review` using a deprecated `projectCards` GraphQL query that errored on repos with Classic Projects - Fixed `claude plugin validate` not flagging `skills:` entries that point at a file instead of a directory — the error now suggests the parent directory - Fixed an infinite loop where a skill using `context: fork` could repeatedly re-invoke itself instead of running - Improved the Read tool to return a truncated first page with a "PARTIAL view" notice instead of a hard error when a whole-file read exceeds the token limit