golem-file-io-rust

Implements file reading and writing in Rust Golem agents using std::fs over WASI.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-file-io-rust
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-file-io-rust
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/rust/golem-file-io-rust
Command: npx skills add https://github.com/golemcloud/golem --skill golem-file-io-rust

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires golem_rust.

What problem does it solve?

Rust Golem agents compile to wasm32-wasip1, and developers need clear guidance on performing filesystem operations inside this sandboxed WebAssembly environment, including which paths are writable and how provisioned files behave.

Core Features & Use Cases

  • File Reading: Read text and binary files from the agent's WASI filesystem using the standard std::fs module.
  • File Writing and Appending: Write new files or append to logs with OpenOptions, respecting read-only permissions on provisioned files.
  • Directory and Existence Checks: List directory entries and check file existence with std::path::Path.
  • Use Case: Build a Golem agent that reads a provisioned configuration file at /data/config.json on each invocation and appends processing results to a persistent per-agent log at /tmp/agent.log.

Quick Start

Ask the AI to write a Rust Golem agent that reads a text file from /data and appends results to a log file using std::fs.

Frequently Asked Questions about golem-file-io-rust

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I read files in a Rust Golem agent?

Use the standard std::fs module, such as fs::read_to_string for text files or fs::read for binary files. Golem Rust agents compile to wasm32-wasip1, which provides WASI filesystem access, so std::fs works out of the box.

How do I write or append to files in a Golem agent?

Use fs::write for simple writes or OpenOptions with append(true) and create(true) for appending. Only files provisioned with read-write permission, or files in non-provisioned paths like /tmp, can be written to.

Can I use third-party Rust crates that access the filesystem in Golem?

Yes, third-party crates that use std::fs internally, such as serde_json's file reading, work in Golem agents because the wasm32-wasip1 target provides WASI filesystem support for the standard library.

Why can't I write to a file provisioned in my Golem agent?

Files provisioned via golem-add-initial-files with read-only permission cannot be written to. Write to non-provisioned paths such as /tmp, or provision the file with read-write permission instead.

Is the Golem agent filesystem shared between agents?

No, the filesystem is per-agent-instance, so each agent has its own isolated filesystem. File changes within an agent are persistent across invocations as durable state.