Skip to content

[FEATURE]: Inline image attachments don't include trigger text for skill auto-activation #21514

@divitkashyap

Description

@divitkashyap

Problem

When OpenCode shows inline image previews in the chat, it displays just the filename (e.g., filename.png) without any surrounding trigger words like "analyze", "screenshot", "describe", or "look at".

Skills like vision-analysis are configured to auto-activate when the message contains these trigger words. However, since inline images only show the filename without any such context words, the skill never auto-activates.

Without trigger words: Agent doesn't know what to do → says "API requires valid key" and gives up.
With trigger words adjacent to image: Skill auto-activates → agent uses correct tool → works.

Expected Behavior

Skills with text trigger patterns should be able to auto-activate even when the image is shown inline, because the skill's activation depends on text adjacent to the image in the message.

Example

User sends: "[inline image: screenshot.png]"

OpenCode displays: Just screenshot.png with no trigger words

Agent receives: No trigger words in the text portion → vision-analysis skill doesn't activate

Proposed Solution

The inline image rendering should either:

  1. Include trigger words in the text that gets sent to the agent (e.g., "look at this image: screenshot.png")
  2. Extract trigger words from the filename itself (e.g., "Screenshot" from "Screenshot 2026-04-08 at 2.54.51 pm.png" normalizes to "screenshot" which IS a trigger word)
  3. Or ensure that the skill activation logic considers image attachments as implicit triggers

This is an OpenCode-side limitation, not a skill configuration issue.

Investigation Summary

File to change: packages/opencode/src/session/message-v2.ts lines 654-669

Currently when stripMedia is true, it adds [Attached ${mime}: ${filename}] text, but for actual image input to the LLM, no trigger text is added before the file part.

The fix would add a text part with appropriate trigger words (extracted from filename or a fallback) before the file part, so skills like vision-analysis can auto-activate.

Verification

  • This is a feature request for the core opencode application
  • I have searched the existing issues and confirmed this is not a duplicate
  • I understand this is a feature request and not a bug report

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)webRelates to opencode on web / desktop

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