A coder tools plugin for elizaOS that provides filesystem, shell, and git capabilities in a restricted/sandboxed environment.
- File Operations: Read, write, edit, list, and search files
- Shell Execution: Run shell commands in a sandboxed directory
- Git Commands: Execute git operations
- Directory Navigation: Change working directory (restricted)
- Safety Controls: Command filtering, path validation, forbidden command blocking
bun add @elizaos/plugin-codeSet the following environment variables:
| Variable | Description | Required | Default |
|---|---|---|---|
CODER_ENABLED |
Enable/disable the plugin | No | false |
CODER_ALLOWED_DIRECTORY |
Directory for operations | Yes | process.cwd() |
CODER_TIMEOUT |
Command timeout (ms) | No | 30000 |
CODER_FORBIDDEN_COMMANDS |
Additional forbidden commands (comma-separated) | No | - |
import { coderPlugin } from '@elizaos/plugin-code';
// Add to your agent's plugins
const agent = {
plugins: [coderPlugin],
// ...
};| Action | Description | Similes |
|---|---|---|
READ_FILE |
Read file contents | VIEW_FILE, OPEN_FILE, CAT_FILE, SHOW_FILE, GET_FILE |
WRITE_FILE |
Create or overwrite a file | CREATE_FILE, SAVE_FILE, OUTPUT_FILE |
EDIT_FILE |
Replace substring in file | REPLACE_IN_FILE, PATCH_FILE, MODIFY_FILE |
LIST_FILES |
List directory contents | LS, LIST_DIR, LIST_DIRECTORY, DIR |
SEARCH_FILES |
Search text in files | GREP, RG, FIND_IN_FILES, SEARCH |
CHANGE_DIRECTORY |
Change working directory | CD, CWD |
EXECUTE_SHELL |
Run shell command | SHELL, RUN_COMMAND, EXEC, TERMINAL |
GIT |
Run git command | GIT_COMMAND, GIT_RUN |
The CODER_STATUS provider supplies context about:
- Current working directory
- Allowed directory
- Recent command history
- Recent file operations
The plugin implements several security measures:
- Path Validation: All file operations are restricted to
CODER_ALLOWED_DIRECTORY - Command Filtering: Blocks shell control operators (
&&,||,;,$(, backticks) - Forbidden Commands: Blocks dangerous commands like
rm -rf /,sudo rm, etc. - Timeout: Commands are killed after
CODER_TIMEOUTmilliseconds - Disabled by Default: Must explicitly set
CODER_ENABLED=true
MIT