Skip to main content

File Operations

OrcBot provides cross-platform file system skills for reading, writing, and managing files. All file operations are sandboxed to the agent’s workspace to prevent accidental modification of system files.

Workspace Sandboxing

File paths are resolved relative to the build workspace:
  • Default workspace: ~/.orcbot/workspace/
  • Configured workspace: Set via buildWorkspacePath in config
  • Restricted paths: node_modules and .git are blocked

Path Resolution Rules

  1. Absolute paths: Resolved as-is (subject to restriction checks)
  2. Relative paths: Resolved relative to workspace root
  3. Empty path (for list_directory): Defaults to workspace root
Example:
Restricted paths are blocked. You cannot read from or write to node_modules or .git directories to prevent accidental modification of dependencies or version control.

read_file

Read the contents of a file with optional line range support.

Parameters

string
required
File path (absolute or relative to workspace)
number
1-based starting line number (inclusive)
number
1-based ending line number (inclusive)

Return Value

string
File contents. Truncated to 20,000 chars with instructions to use line ranges for larger files.

Limits

  • Max content: 20,000 characters per response
  • Line ranges: Use start_line and end_line to page through large files

Example Usage

Read entire file:
Read specific lines:

Response Examples

Small file:
Large file (truncated):

Error Handling

File not found:
Path is directory:

Metadata

  • isDeep: true - Counts as substantive progress
  • isParallelSafe: true - Safe to run in parallel workers
For large files, read in chunks. Use start_line and end_line to avoid truncation. Each chunk can be up to 20,000 chars.

write_file

Write or append content to a file.

Parameters

string
required
File path (absolute or relative to workspace)
string
required
Content to write
boolean
default:"false"
Append to existing file instead of overwriting

Return Value

string
Confirmation message with absolute file path

Limits

  • Max content size: 10 MB per write operation
  • Auto-creates parent directories: No need to create directories first

Example Usage

Create new file:
Append to existing file:

Response Examples

Success:
Append:

Error Handling

Content too large:
Restricted path:

Metadata

  • isDeep: true
  • isParallelSafe: false (concurrent writes to same file are unsafe)
Use write_file instead of shell commands. Always prefer this skill over echo > or cat <<EOF for creating files. It’s cross-platform, handles escaping correctly, and enforces size limits.

list_directory

List files and subdirectories in a directory.

Parameters

string
Directory path. Defaults to workspace root if omitted.

Return Value

string
Formatted list with emoji indicators:
  • 📁 for directories
  • 📄 for files

Example Usage

List workspace root:
List specific directory:

Response Example

Error Handling

Directory not found:
Path is file:

Metadata

  • isDeep: true
  • isParallelSafe: true
Use list_directory to explore structure. Start with the workspace root to understand the project layout, then navigate deeper.

create_directory

Create a directory and all parent directories.

Parameters

string
required
Directory path to create

Return Value

string
Confirmation message or “already exists” if directory exists

Example Usage

Response Examples

Success:
Already exists:

Metadata

  • isDeep: true
  • isParallelSafe: false (concurrent directory creation can race)
create_directory uses recursive: true, so it creates all missing parent directories automatically. No need to create intermediate paths.

analyze_media

Use AI to analyze an image, audio, or document file.

Parameters

string
required
Absolute path to the file
string
Question or instruction. Defaults to “Describe the content of this file.”

Return Value

string
AI-generated description or analysis

Supported Formats

  • Images: JPEG, PNG, GIF, WebP, SVG
  • Audio: MP3, WAV, OGG (transcription)
  • Documents: PDF (OCR + text extraction)

Example Usage

Analyze image:
Transcribe audio:

Response Example

Metadata

  • isDeep: false
Use analyze_media after downloading files with download_file to extract insights without manual inspection.

Common Workflows

Download and Process

  1. download_file - Download from web
  2. analyze_media or read_file - Extract content
  3. write_file - Save processed results

Generate and Deliver

  1. generate_image or text_to_speech - Create media
  2. send_file - Deliver to user

Read, Modify, Write

  1. read_file - Load existing file
  2. Process content (using LLM or code execution)
  3. write_file - Save updated version

Best Practices

File operation strategy:
  1. Use list_directory to explore structure before reading
  2. Read large files in chunks with start_line/end_line
  3. Always use write_file instead of shell redirection
  4. Use analyze_media for images and audio instead of guessing content
Avoid these mistakes:
  • Don’t use run_command with echo > — use write_file
  • Don’t guess file paths — use list_directory first
  • Don’t read entire huge files — use line ranges
  • Don’t write >10MB in one call — chunk it

Web Search

Download files from the web

Shell Execution

Execute file processing scripts