Skip to content

[FEATURE]: Inline image attachments should include trigger text so skills can auto-activate #29096

@divitkashyap

Description

@divitkashyap

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

When the user attaches an image inline (e.g. a screenshot or clipboard paste), the message that reaches the model is a bare `file` part — there's no surrounding text like "screenshot" / "describe" / "analyze".

Skills such as `vision-analysis` are configured to auto-activate when those trigger words appear in the message text. Because the inline image carries no trigger text, the skill never matches and the agent ends up replying with something like "this API requires a valid key" instead of routing to the vision tool.

Proposed fix: when pushing a media file part in `packages/opencode/src/session/message-v2.ts`, also push a short text part containing a trigger word derived from the filename:

  • `Screenshot 2026-...-png` → `[screenshot]`
  • `clipboard-...-png` → `[clipboard]`
  • `photo*.jpg` → `[photo]`
  • otherwise → `[image]`

The change is local and tiny (~12 lines + a test expectation update), and matches the way the `stripMedia` branch already injects an `[Attached : ]` text part.

This re-opens the earlier issue #21514 (which I opened and which got auto-closed by the template bot within the 2-hour window). PR to follow.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions