Skip to main content

Module prompt

Module prompt 

Source
Expand description

Turning a message’s attachments into what the agent receives (docs/specs/SPEC_AGENT_PANE_IMAGE_ATTACHMENTS_2026_09_26.md §6.6, SPEC_AGENT_PANE_FILE_ATTACHMENTS_2026_09_26.md §7):

  • every provider gets a numbered list appended to the text, in an <attached_files> block: each image’s send-copy, each other file as a copy under its real name, plus notes (type, pages, text version), so any agent that can open a local file can reach every attachment;
  • Claude (stream-json) additionally gets images inline as image blocks and PDFs of up to 100 pages as document blocks, within a count and size budget.

The block is also how the pane rebuilds the tiles on reload: each line names the attachment and ends with a path that carries the attachment id (a <sha256>. file name or a named/<sha256>/ folder).

Structs§

Prepared
Everything a turn needs from its attachments.
Resolved
One attachment resolved to the file the agent gets.

Constants§

BLOCK_CLOSE
BLOCK_OPEN
DEFAULT_INLINE_MAX_COUNT
DEFAULT_SESSION_INLINE_MB
Inline at most this much base64 across one Claude session. Claude Code keeps every inline image in its own session transcript.
INLINE_MAX_B64_BYTES
Inline at most this many base64 bytes in one Claude message. The API caps a request at 32 MB, and the whole conversation is resent each turn.
INLINE_PDF_MAX_PAGES
Claude’s PDF support takes at most 100 pages per request on models with less than a 1M-token context; longer PDFs go by path and text version.

Functions§

append
The user’s text with the attachment list after it.
claude_user_line
A Claude stream-json user line. With no images, content is the plain string it always was; with images, the image blocks come first and the text last, as the Messages API recommends.
image_paths
The decoded pictures among items, as the paths of their send-copies, in the order of the tray: what a provider that takes a picture by path (Codex’s localImage) is given, besides the list in the text.
inline_bytes
Base64 bytes carried by inline blocks, for the session budget.
jekt_list_block
The <attached_files> block for files another agent sent with a jekt (SPEC_JEKT_FILE_TRANSFER_2026_10_05.md §6.2): the same list, with a lead naming the sender instead of the user.
list_block
The <attached_files> block. inlined holds the numbers of the items Claude was also given inline.
persisted_line
The form of a Claude stdin line that AgentMux stores for replay: image blocks dropped and the content collapsed back to its text, which still holds the <attached_images> list. Every reader of stored user lines expects content to be a string, and a stored line should never carry megabytes of base64. Lines without an array content pass through.
prepare
Build the list and (when inline_max_count > 0) the inline blocks, using at most inline_budget base64 bytes (further capped at INLINE_MAX_B64_BYTES per message). Reads the inlined files from disk. Blocking.
prepare_from
prepare for files another agent sent with a jekt: the list’s lead names sender (jekt_list_block).
resolve
Resolve refs to what the agent gets. Refs whose files are gone (swept, or never finished processing) come back as names in the second list. Blocking.