Image attached to user prompt is not picked up by hooks

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When I attach an image to my prompt in the IDE and ask the agent to do something with it, the image data is not captured. The beforeSubmitPrompt hook captures this:

{"conversation_id":"915654d7-5ad1-4285-8b06-99ca33b3bdb1",...
"model":"default",
"composer_mode":"agent",
"prompt":"read this",
"attachments":[],..."hook_event_name":"beforeSubmitPrompt"...}

Note how the attachments field is empty.

There is also a write file that occurs following the beforeSubmitPrompt, writing the PNG file to the project’s assets directory, captured by the preToolUse hook:

{"conversation_id":"915654d7-5ad1-4285-8b06-99ca33b3bdb1",...
"tool_name":"Write",
"tool_input":{"file_path":"/Users/user/.cursor/projects/Users-user-Documents-cursor/assets/image-a1b4a6dc-db23-43ef-2af-891441b858e5.png",
"content":""},...
"hook_event_name":"preToolUse","...}

Note how the content field is empty. The agent understands the image, and text within the image, but the data is never captured by the hooks.

Steps to Reproduce

Attach an image to a prompt and ask the agent to describe it / explain text within it, anything like that. The agent will perform the action, but the image data is not captured in the hooks where expected.

Expected Behavior

Image data is captured under the preToolUse file “content” key above, and/or in the beforeSubmitPrompt “attachments” key

Operating System

MacOS

Version Information

Version: 3.5.38
VSCode Version: 1.105.1
Commit: 009bb5a3600dd98fe1c1f25798f767f686e14750
Date: 2026-05-26T21:32:06.537Z
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Darwin arm64 25.3.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the detailed report with the payloads.

This is expected behavior right now, not a bug:

  1. beforeSubmitPrompt.attachments currently only includes file and rule attachments. Images attached to the prompt are handled separately, so they don’t show up in the hook payload.

  2. preToolUse.tool_input.content is intentionally empty for binary files like PNG, so we don’t bloat the JSON that gets sent to the hook over stdin.

Workaround: the file_path in the payload is correct, in your example it’s /assets/image-*.png, so the hook can read the file from disk if it needs the binary data.

I’ll pass this to the Extensibility team as a feature request to add image attachments to beforeSubmitPrompt. I can’t share an ETA, but if there are updates I’ll reply in the thread.

Thanks Dean. We’d have to use the postToolUse hook for this workaround though, right? Because for the preToolUse hook the data wouldn’t have been written to disk yet? I do have this working (postToolUse) but just wanted to confirm where in the pipeline this happens - does the assistant wait for the postToolUse hook to read the file from disk to get the binary data before it takes action? Or is the act of writing the image to disk happening in parallel to the model working from the image?

Yeah, that’s right. This workaround needs postToolUse. preToolUse runs before the tool executes, so the file in /assets/ isn’t written yet and there’s nothing to read. postToolUse runs after the write, so the file is on disk and the hook can grab the binary data. You’re doing it correctly.

About the pipeline, the model doesn’t wait for your hook to get the image. When you attach an image to the prompt, it’s sent to the model directly as an attachment, separate from writing the file to disk. So the model already “sees” the image whether or not your hook reads it from disk. Writing to /assets/ is just persisting the attached image in the workspace, not the model’s data source.

So a postToolUse hook that reads the file runs in parallel or after and isn’t on the model’s critical path. It won’t block the model or “feed” it anything. For your use case, grabbing the binary after the write, this is the right place in the pipeline.

Let me know if anything else comes up.