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.
Syntax
Add attachments via theextra_body.cli.attachments array:
Attachment Types
File Attachments
Attach a single file:- 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: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:-sor--sandboxcodex:--sandboxclaudecli: Not supportedvibe: Not supported
boolean
default:false
Skip confirmation prompts for file operations.CLI Mapping:
geminicli:-yor--yesvibe:--auto-approveclaudecli:--dangerously-skip-permissionscodex:--full-auto
boolean
default:false
Maximum autonomy mode. Combines auto-approve with other permissive flags.CLI Mapping:
geminicli:--yolovibe:--auto-approveclaudecli:--dangerously-skip-permissionscodex:--full-auto
Flag Examples
- Sandbox Mode
- Auto-Approve
- YOLO Mode
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
Path Validation
Path Validation
switchAILocal validates all file paths to prevent directory traversal attacks:
Sandbox Mode
Sandbox Mode
Use sandbox mode for untrusted operations:
File Size Limits
File Size Limits
Large files may exceed CLI limits:
config.yaml
Sensitive Files
Sensitive Files
Avoid attaching sensitive files:
Error Handling
Limitations
Best Practices
- Start with Sandbox: Test with read-only mode first
- Use Relative Paths: More portable and secure
- Minimize Attachments: Only include relevant files
- Name Sessions: Use descriptive session IDs for continuity
- 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