anomalyco / anomalyco/opencode
Attached images degrade to a bare text placeholder when the model lacks vision — agent has no way to read them
@neriousy is already working on this.
Since Aug 15, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
When a user pastes images into a chat and the active model does not support vision (e.g. a text-only model like deepseek-v4-flash), the image file parts are replaced by a plain text placeholder before being sent to the model. The agent then has no way to access the actual image content — the placeholder carries no reference to how the image can be retrieved.
Current behavior
In packages/opencode/src/session/message-v2.ts (around line 213):
if (options?.stripMedia && isMedia(part.mime)) {
userMessage.parts.push({
type: "text",
text: `[Attached ${part.mime}: ${part.filename ?? "file"}]`,
})
}
So the model sees only [Attached image/png: image-2.png]. There is no session/message/part id, no API reference, no data URL — nothing the agent could use to fetch the image itself. The only way to recover the image is to query the local opencode.db (the part table stores {type:"file", mime, filename, url} with session_id/message_id) or hit the local serve API, which is undocumented for this purpose and requires guessing the current session.
Why it matters
This forces workarounds: to read a pasted image, an agent (or a skill like an "image recognition" skill) has to:
- guess the current session (no env var exposes
session_id), - query the sqlite DB / serve API to find the most recent image part,
- forward the
data:URL to a separate vision model.
That's fragile (parallel sessions race) and entirely non-obvious from the placeholder alone.
Proposal (any of these would help)
- Include a retrievable reference in the placeholder, e.g.
[Attached image/png: image-2.png] (session: …, message: …, part: …)or a URL likeopencode://session/{sessionID}/message/{messageID}/part/{partID}the agent can dereference. - Expose the current session id to agents (e.g.
OPENCODE_SESSION_IDenv var when running tool calls) so tools/skills can scope queries precisely. - A config option to keep sending lightweight media metadata (mime, filename, session/message/part ids) to text-only models instead of dropping it.
Environment
- opencode version: 1.18.18 (OpenChamber distribution,
opencode serve) - Model:
deepseek-v4-flash(no vision) - OS: macOS
Happy to help with a PR if a direction is agreed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.