Skip to content
Proposals/Rewrite a workflow agent's `prompt` and `model`
proposaldeveloperP5Worth a lookClaude Code

Rewrite a workflow agent's `prompt` and `model` in the `agent.spawn` mod hook

Claude Code v2.1.300 lets agent.spawn rewrite a workflow agent's prompt and model (it could only refuse them before), adds prompt.change for non-typed prompt-box updates, and virtualText decorations that never enter the draft or submitted prompt.

Why this loop

Mods that previously could only refuse workflow agents can now reshape them at spawn time by returning a rewritten prompt and model from agent.spawn. Pair that with prompt.change (history recall, clear, undo, or a plugin fill) and virtualText (drawn in the prompt box but never part of the draft or submitted prompt) so helpers never leak into what Claude sees. Agent hooks now honor model: aliases like haiku resolve, a subagent's model no longer overrides the hook, and an unavailable model falls back to the caller instead of allowing the action. prompt.edit is raised for newlines from the chat:newline keybinding (Ctrl+J). A prompt.submit rewrite or drop is no longer recorded as typed in OpenTelemetry user_prompt events, interaction spans, or session title requests. Use $.ui.view({ agentId }) to show an agent's transcript and $.ui.view({}) to return. The built-in plugin-authoring skill scans a mod's files for keys before opening them and asks before scanning a folder outside the project.

Proposed actions

  1. Update the agent.spawn mod hook so workflow agents are rewritten, not only refused: return a new prompt and model. Resolve aliases like haiku; if the model is unavailable, fall back to the caller's model instead of allowing the action. Do not let a subagent's model override the hook's model.
  2. Register a prompt.change mod hook for prompt-box updates that are not typed edits: a recalled history entry, a clear, an undo, or a plugin's fill. Also handle prompt.edit for a newline entered with the chat:newline keybinding (Ctrl+J, or a rebound Enter).
  3. Add virtualText to the mod's prompt decorations so helper text is drawn in the prompt box but never enters the draft or the submitted prompt.
  4. From the mod, call $.ui.view({ agentId }) to show that agent's transcript in the main view, and $.ui.view({}) to go back. On mod Text nodes, set the dir prop for right-to-left text so rows read in that direction and sit flush right on Windows and in VS Code's terminal.
  5. When using the built-in plugin-authoring skill, let Claude scan the mod's files for keys before opening them, and require confirmation before scanning a folder outside the project.

Agent prompt

Paste into your agent or query via MCP (get_agent_prompt) — free, no extra AI cost

Paste into Claude Code / CLAUDE.md task

DevAgentRadar → Claude Code

You are helping me adopt a real coding-assistant change. Work only from the facts below. Do not invent features.

Context

Assistant: Claude Code Proposal: Rewrite a workflow agent's prompt and model in the agent.spawn mod hook Summary: Claude Code v2.1.300 lets agent.spawn rewrite a workflow agent's prompt and model (it could only refuse them before), adds prompt.change for non-typed prompt-box updates, and virtualText decorations that never enter the draft or submitted prompt. Primary source: https://github.com/anthropics/claude-code/releases/tag/v2.1.300

Why it matters

Mods that previously could only refuse workflow agents can now reshape them at spawn time by returning a rewritten prompt and model from agent.spawn. Pair that with prompt.change (history recall, clear, undo, or a plugin fill) and virtualText (drawn in the prompt box but never part of the draft or submitted prompt) so helpers never leak into what Claude sees. Agent hooks now honor model: aliases like haiku resolve, a subagent's model no longer overrides the hook, and an unavailable model falls back to the caller instead of allowing the action. prompt.edit is raised for newlines from the chat:newline keybinding (Ctrl+J). A prompt.submit rewrite or drop is no longer recorded as typed in OpenTelemetry user_prompt events, interaction spans, or session title requests. Use $.ui.view({ agentId }) to show an agent's transcript and $.ui.view({}) to return. The built-in plugin-authoring skill scans a mod's files for keys before opening them and asks before scanning a folder outside the project.

Suggested actions

  1. Update the agent.spawn mod hook so workflow agents are rewritten, not only refused: return a new prompt and model. Resolve aliases like haiku; if the model is unavailable, fall back to the caller's model instead of allowing the action. Do not let a subagent's model override the hook's model.
  2. Register a prompt.change mod hook for prompt-box updates that are not typed edits: a recalled history entry, a clear, an undo, or a plugin's fill. Also handle prompt.edit for a newline entered with the chat:newline keybinding (Ctrl+J, or a rebound Enter).
  3. Add virtualText to the mod's prompt decorations so helper text is drawn in the prompt box but never enters the draft or the submitted prompt.
  4. From the mod, call $.ui.view({ agentId }) to show that agent's transcript in the main view, and $.ui.view({}) to go back. On mod Text nodes, set the dir prop for right-to-left text so rows read in that direction and sit flush right on Windows and in VS Code's terminal.
  5. When using the built-in plugin-authoring skill, let Claude scan the mod's files for keys before opening them, and require confirmation before scanning a folder outside the project.

Config surfaces this release may change

  • hooks (high confidence) — check your repo before applying
  • skills (high confidence) — check your repo before applying
  • subagent definitions (high confidence) — check your repo before applying
  • sandbox settings (high confidence) — check your repo before applying
  • context and compaction settings — check your repo before applying
  • MCP servers — check your repo before applying

After you finish

Do not report this as applied to DevAgentRadar. You cannot write the visitor's loop.

Tell the human: open https://devagentradar.com/proposals/claude-code-v2-1-300-rewrite-a-workflow-agent-s-prompt-and-model-in-the- and mark Applied, Skipped, or Failed. Proposal id: d853833b-79b2-4684-8717-360795309508

Your job

  1. Restate the change in one sentence.
  2. Propose a minimal plan for my repo (or a throwaway pilot).
  3. Implement only what I approve; prefer small diffs and tests.
  4. Call out risks (permissions, breaking APIs, cost).

Start by confirming you understood the proposal.

agentmcpmodelsecurityideRelease source ↗

Your loop

This browser · no sign-in · not shared as “you”

After you run the prompt

Only you can mark this. Agents cannot write your loop.

Your decision stays on this device. A public tally appears after a few votes.

Originating release signal

Claude Codev2.1.300Oct 14, 2026

v2.1.300

Added virtualText to a mod's prompt decorations: text drawn in the prompt box that never enters the draft or the submitted prompt · Added cache_creation_5m_tokens and cache_creation_1h_tokens to the OpenTelemetry api_request event, splitting cache writes by lifetime · Added $.ui.view({ agentId }) for mods: shows an agent's transcript in the main view when you ask, and $.ui.view({}) goes back · Added a dir prop on a mod's Text for right-to-left text: on Windows and in VS Code's terminal its rows read in that direction and sit flush right · +90 more changes
Verified excerpt — the source's own words

What's changed

  • Added virtualText to a mod's prompt decorations: text drawn in the prompt box that never enters the draft or the submitted prompt
  • Added cache_creation_5m_tokens and cache_creation_1h_tokens to the OpenTelemetry api_request event, splitting cache writes by lifetime
  • Added $.ui.view({ agentId }) for mods: shows an agent's transcript in the main view when you ask, and $.ui.view({}) goes back
  • Added a dir prop on a mod's Text for right-to-left text: on Windows and in VS Code's terminal its rows read in that direction and sit flush right
  • Added /advisor on Claude Platform on AWS; no advisor runs until you pick one with /advisor, advisorModel or --advisor, and CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1 turns it off
  • Added OpenTelemetry GenAI semantic-convention attributes to trace spans, such as gen_ai.provider.name, gen_ai.conversation.id, gen_ai.tool.name and error.type
  • Added support for rewriting a workflow agent's prompt and model in the agent.spawn mod hook, which could only refuse workflow agents before

Excerpt ends here — this release continues at the source ↗.

Primary source ↗