Skip to main content

Overview

The SDK supports file attachments in user messages using <vibe-work-attachment> tags. The framework automatically reads and processes attached files.

Basic Usage

The framework will:
  1. Detect the attachment tag
  2. Read the file at the specified path
  3. Create a multi-block user message with both text and file content

Multiple Attachments

Supported File Types

How It Works

  1. Framework detects <vibe-work-attachment> tags in user input
  2. Extracts file paths and deduplicates (same file referenced twice is only read once)
  3. Reads each file in order
  4. Creates multi-block user message with original text + content blocks
  5. If a file cannot be read, inserts an error message block instead

Message Structure

Deduplication

Duplicate file references are detected by resolved absolute path:
The second occurrence receives: “Note: File ./main.rs was already attached above”

Path Resolution

  • Absolute paths: Used as-is
  • Relative paths: Resolved from the current working directory

Error Handling

Individual attachment failures do not block the message:

Frontend Integration

Tags are preserved in the message text, allowing frontends to parse and display attachment badges. A typical flow:
  1. User types @main.rs or drags a file
  2. Frontend converts to <vibe-work-attachment>./main.rs</vibe-work-attachment>
  3. Backend processes automatically via handle.send_input(&message).await?

Programmatic Access

Next Steps

Image & PDF Support

Details on image and PDF processing

Tauri Integration

Building file attachment UI