Modality preserving binary offload

From ychampion/cskill-agents · View interactive version

Modality preserving binary offload is an AI agent skill from the GitHub repository ychampion/cskill-agents. Persist binary output with a mime-derived extension and a matching saved-file message so downstream tools keep the right modality.

How to use this skill

Skill file

SKILL: Modality-Preserving Binary Offload

Domain: tool-result-storage

Trigger: Apply when a tool emits binary content that must be saved out of band without losing the file type or downstream usability.

Source Pattern: Distilled from reviewed tool execution, streaming, persistence, and output-budget implementations.

Core Method

Preserve modality by deriving the output extension from MIME type, writing the raw bytes unchanged, and returning a saved-file message that names the type, size, and location. This ensures the resulting file can be opened by the correct downstream tool chain instead of being flattened into an opaque blob with the wrong extension. The offload path remains generic while still honoring modality-specific dispatch.

Key Rules

Example Application

If an MCP server returns a PDF or spreadsheet, derive pdf or xlsx from the MIME type, persist the raw bytes into the tool-results directory, and emit a saved-file message so later steps can hand the file to a PDF reader or spreadsheet parser without guessing the format.

Anti-Patterns (What NOT to do)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.