CapabilityWire
// event · cli

Claude Code v2.1.251: PreModelSwitch/PostModelSwitch hooks, subagent tool-call streaming, background session CLI

cli
vendor: anthropicspublished: 12h agoconfidence: 0.85id: 3f27876f-ea43-471b-b9f7-a15609669098

Claude Code 2.1.251 adds PreModelSwitch/PostModelSwitch hook events for blocking or annotating model switches, live streaming of foreground subagent tool calls to Remote Control clients, and new background-session CLI subcommands (attach/logs/stop/respawn/rm). SessionStart resume hooks now receive staleness and re-cache cost. Also includes /cost prompt-cache stats, spend-limit status fields, and many symlink/path-traversal security fixes.

capability delta

an agent can now intercept model switches via PreModelSwitch/PostModelSwitch hooks, stream foreground subagent tool calls to Remote Control clients, and read prompt-cache stats plus spend limits from status line fields.

curator note

Notable additions: PreModelSwitch/PostModelSwitch hook events, live subagent tool call streaming to Remote Control, and new background session CLI subcommands (attach/logs/stop/respawn/rm). Also includes many security fixes around symlink handling and path traversal in plugin commands.

// install
npm i -g @anthropic-ai/claude-code@2.1.251
npm · @anthropic-ai/claude-code @ 2.1.251
// example
bash
# Update Claude Code
npm i -g @anthropic-ai/claude-code@2.1.251

# List and attach to background sessions using the new subcommands
claude --help | grep -E 'attach|logs|stop|respawn|rm'
claude attach <session-id>
claude logs <session-id>

# Register a PreModelSwitch hook in settings.json to block/confirm model switches
# Example hook config:
# {
#   "hooks": {
#     "PreModelSwitch": [{ "command": "./guard-model-switch.sh" }],
#     "PostModelSwitch": [{ "command": "./log-model-switch.sh" }]
#   }
# }
// links
claude-codeclihookssubagentsremote-controlbackground-sessionsprompt-cache
source: github_release · https://github.com/anthropics/claude-code/releases/tag/v2.1.251