Configuration
Shell command to execute. Can include Jinja2 templates for dynamic parameters.
Working directory for command execution. Defaults to
config/extended_openai_conversation/.When
true, restricts file operations to the working directory and blocks path traversal. Set to false to allow access outside the workspace (use with caution).Optional list of regex patterns. If provided, commands must match at least one pattern to execute.
Examples
Execute Bash Command
Custom Working Directory
Execute commands in a specific directory. Thecwd parameter sets the working directory for command execution.
Unrestricted Access (Outside Workspace)
Allow access outside the workspace directory. Settingrestrict_to_workspace: false removes path restrictions.
Command Allowlist
Restrict to specific command patterns for additional security. Theallow_patterns parameter only allows commands matching the specified regex patterns.
Return Value
Bash functions return an object with command execution results:exit_code: Command exit status (0 = success, non-zero = error)stdout: Standard output from the commandstderr: Error output (only included if present)
Error Handling
If the command is blocked by security controls:Security Features
Deny Patterns
Deny Patterns
Commands matching these patterns are automatically blocked:
rm\s+-rf- Recursive force deleteformat- Disk formattingmkfs- Filesystem creationdd\s+if=- Low-level disk operations:(){:|:&};:- Fork bombs- And more destructive patterns
SHELL_DENY_PATTERNS in the source code for the complete list.Path Traversal Protection
Path Traversal Protection
When
restrict_to_workspace: true (default):- Blocks
../and..\patterns - Validates working directory is within allowed directories
- Extracts and validates all paths in the command
- Ensures paths don’t escape the workspace
Timeout Protection
Timeout Protection
Commands are terminated after timeout (default: 300 seconds):
Output Limits
Output Limits
Output is truncated if it exceeds 10,000 characters to prevent memory issues.
Use Cases
System Monitoring
Check disk usage, memory, processes, and system health
File Management
List, search, and organize files in the workspace
Backup Operations
Run backup scripts and verify backups
Git Operations
Check repository status, view logs, manage configs
Network Diagnostics
Ping hosts, check connectivity, view network status
Custom Scripts
Execute maintenance scripts and automation tools
Best Practices
Start with workspace restriction
Always use
restrict_to_workspace: true (default) unless you specifically need broader access. This prevents accidental access to sensitive system files.Use allowlist patterns for sensitive operations
When functions could be misused, add
allow_patterns to restrict commands:Common Patterns
Check if File Exists
Search Files by Content
Get File Count
Troubleshooting
Command blocked by security policy
Command blocked by security policy
Your command matches a deny pattern. Review
SHELL_DENY_PATTERNS in the code. If the command is safe, consider using a different approach or contact the maintainers to update the patterns.Path outside working directory
Path outside working directory
The command tries to access files outside the workspace. Either:
- Adjust paths to be within the workspace
- Set
restrict_to_workspace: false(use with caution) - Add custom
allow_dirin file functions
Command not in allowlist
Command not in allowlist
When
allow_patterns is set, commands must match at least one pattern. Check your regex patterns or adjust the command.Command timeout
Command timeout
Long-running commands may timeout. Pass a custom
timeout parameter or optimize the command.FAQ
Can bash functions modify system files?
Can bash functions modify system files?
Yes, if
restrict_to_workspace: false. By default, modifications are limited to the workspace directory (config/extended_openai_conversation/).Are environment variables available?
Are environment variables available?
Yes. Commands run in a shell environment with access to environment variables. The working directory persists between commands in a session.
Can I run interactive commands?
Can I run interactive commands?
No. Commands must complete without user interaction. Interactive commands (like
vim, top -i) will fail or timeout.How do I debug command failures?
How do I debug command failures?
Enable debug logging:This will log all executed commands and their output.