Skip to main content

Overview

CLI providers (geminicli:, claudecli:, codex:, vibe:, opencode:) support file and folder attachments through the extra_body.cli parameter. This enables the AI to read, analyze, and modify local files.
CLI attachments are only supported with CLI providers. API providers (gemini:, claude:, etc.) do not support this feature.

Syntax

Add attachments via the extra_body.cli.attachments array:

Attachment Types

File Attachments

Attach a single file:
Supported Path Formats:
  • Absolute: /home/user/project/main.py
  • Relative: ./src/main.py (relative to server working directory)
  • Home directory: ~/projects/file.py

Folder Attachments

Attach an entire directory:
All files in the folder and subdirectories are included.

Examples

Single File

Multiple Files

Folder Attachment

Mixed Attachments

Combine files and folders:

CLI Flags

Control CLI behavior with flags:

Available Flags

boolean
default:false
Run in restricted execution mode. Prevents file modifications.CLI Mapping:
  • geminicli: -s or --sandbox
  • codex: --sandbox
  • claudecli: Not supported
  • vibe: Not supported
boolean
default:false
Skip confirmation prompts for file operations.CLI Mapping:
  • geminicli: -y or --yes
  • vibe: --auto-approve
  • claudecli: --dangerously-skip-permissions
  • codex: --full-auto
boolean
default:false
Maximum autonomy mode. Combines auto-approve with other permissive flags.CLI Mapping:
  • geminicli: --yolo
  • vibe: --auto-approve
  • claudecli: --dangerously-skip-permissions
  • codex: --full-auto

Flag Examples

Session Management

Resume or name CLI sessions:

Session ID Values

Session Example

Use Cases

Code Review

Automated Refactoring

Test Generation

Documentation Generation

Codebase Migration

Provider Support

⚠️ = Partial support (limited flags)

Security Considerations

switchAILocal validates all file paths to prevent directory traversal attacks:
Use sandbox mode for untrusted operations:
Large files may exceed CLI limits:
config.yaml
Avoid attaching sensitive files:

Error Handling

Limitations

Best Practices

  1. Start with Sandbox: Test with read-only mode first
  2. Use Relative Paths: More portable and secure
  3. Minimize Attachments: Only include relevant files
  4. Name Sessions: Use descriptive session IDs for continuity
  5. Validate Outputs: Review AI changes before committing

Next Steps

Provider Prefixes

Learn about CLI provider routing

Chat Completions

Master the chat completions API

Configuration

Configure CLI provider settings