What
Plugins are add-on packages that extend Claude Code, and a hook is code a plugin runs at a set moment. prompt.submit is the moment a prompt is sent. A new built-in tool lets a hook read the contents of an image or document attached to that prompt.
- The hook asks with
{ id, offset }, whereidis the attachment's id from the prompt being sent. - Claude Code answers with a chunk of the file encoded as base64 (a way of writing binary data as text), plus a
nextoffset for asking for the following chunk. - Claude Code refuses ids that do not belong to the prompt being sent.
- Claude Code refuses attachments that point to a web address or a file path instead of carrying the data directly.
Why
Plugin authors can now work with images and documents a user pastes into a prompt. Before, hooks had no way to read them.
Names in the bundleprompt.submit
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
Confirmed since
Anthropic's documentation has since written up prompt.submit, on Use the mods API.
Apart from `$.prompt.submit` and `$.command.run`, this handling of calls and background work after an interruption requires Claude Code v2.1.304 or later.plugins/mods/api see the edit
Two sources agreeTwo things we can check say the same as this entry.
Anthropic's documentation agrees
Anthropic's documentation has since written up prompt.submit, on Use the mods API.
Anthropic's release notes agree
Added $.prompt.media so a prompt.submit hook of a mod installed by managed settings can read the bytes of an image or document attached to…