Skip to content

Surface Slack image attachments for agents - #1

Merged
odfalik merged 1 commit into
mainfrom
feat/image-attachments
Jul 1, 2026
Merged

odfalik merged 1 commit into
mainfrom
feat/image-attachments

Conversation

@odfalik

@odfalik odfalik commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What

Read tools now surface file attachments, and download images so an agent can actually view them.

  • read_history, get_thread, and cold-reply thread context annotate attachments inline.
  • Images are fetched (via the user token's new files:read scope) to a durable cache dir (~/.cache/golem-slack-images, overridable via SLACK_IMAGE_CACHE_DIR) and referenced by absolute path:
    [image: chart.png · path=/Users/oded/.cache/golem-slack-images/F0…_chart.png]
  • Non-image files are noted by name so the agent knows they exist.

Why this shape (not inline base64)

Claude Code mishandles MCP image content blocks (treats base64 as text → ~10–20× token blowup, claude-code#31208), and even when fixed, inlining would drag image bytes into every history read. The path approach keeps context clean — the agent loads an image only when it chooses to Read the path (~1.6K tokens), which is 0 cost when it doesn't care.

Tested

Downloaded a real image from a DM, cached it, and viewed it end-to-end via the Read tool — renders correctly. Repeat reads reuse the cache (no re-download). HTML sign-in responses (token lacks file access) are treated as failures, not saved.

Notes

  • Requires the files:read user scope (added to the Golem app + reinstalled; token unchanged, no .env change).
  • Downloads run off the event loop via anyio.to_thread.

Read handlers (read_history, get_thread) and cold-reply thread context now
annotate file attachments. Images are downloaded (via the user token's
files:read scope) to a durable cache dir (~/.cache/golem-slack-images, not
/tmp) and referenced by absolute path, e.g. '[image: chart.png · path=...]'.

This keeps context clean — image bytes never enter a routine history read;
the agent loads an image only when it chooses to Read the path. Non-image
files are noted by name. Downloads run off the event loop; HTML sign-in
responses (token lacks access) are treated as failures, not saved.
@odfalik
odfalik merged commit 38d67e7 into main Jul 1, 2026
3 of 4 checks passed
@odfalik
odfalik deleted the feat/image-attachments branch July 1, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant