Internal Tools

Core file and system tools available to the agent.

read

Read file contents.

Input:

{
  "path": "/path/to/file.txt",
  "offset": 0,
  "limit": 100
}
FieldTypeRequiredDescription
pathstringYesFile path (absolute or relative to workspace)
offsetintNoStart line (0-indexed)
limitintNoMax lines to read

Output: File contents with line numbers

Security:

  • Path traversal protection (no ../ escape)
  • Symlink protection
  • Unicode normalization
  • Blocked files: users.json, goclaw.json, openclaw.json

write

Write content to a file.

Input:

{
  "path": "/path/to/file.txt",
  "content": "File contents here"
}
FieldTypeRequiredDescription
pathstringYesFile path
contentstringYesContent to write

Output: Success message with bytes written

Behavior:

  • Atomic writes (temp file + rename)
  • Creates parent directories if needed
  • Overwrites existing files

edit

Edit a file using string replacement.

Input:

{
  "path": "/path/to/file.txt",
  "old_string": "text to replace",
  "new_string": "replacement text"
}
FieldTypeRequiredDescription
pathstringYesFile path
old_stringstringYesText to find (must be unique)
new_stringstringYesReplacement text

Output: Success message with change preview

Validation:

  • old_string must exist in file
  • old_string must be unique (exactly one match)
  • old_string cannot be empty

Error: old_string is not unique — Include more context to make the match unique.


exec

Execute a shell command.

Input:

{
  "command": "ls -la",
  "timeout": 30,
  "working_dir": "/path/to/dir"
}
FieldTypeRequiredDescription
commandstringYesCommand to execute
timeoutintNoTimeout in seconds (default: 30, max: 1800)
working_dirstringNoWorking directory

Output: Command output (stdout + stderr) with exit code

Configuration:

{
  "tools": {
    "exec": {
      "timeout": 1800,
      "bubblewrap": {
        "enabled": false,
        "extraRoBind": [],
        "extraBind": [],
        "extraEnv": {},
        "allowNetwork": true
      }
    }
  }
}
OptionDefaultDescription
timeout1800Default timeout (30 minutes)
bubblewrap.enabledfalseEnable managed exec sandboxing (platform backend)
bubblewrap.extraRoBind[]Additional read-only paths
bubblewrap.extraBind[]Additional writable paths
bubblewrap.extraEnv{}Additional environment variables
bubblewrap.allowNetworktrueAllow network access

See Sandbox for sandboxing details.


Security

All internal tools share these protections:

ProtectionDescription
Path traversalBlocks ../ and symlinks escaping workspace
Unicode normalizationNormalizes space characters to prevent confusion
Blocked filesProtects users.json, goclaw.json from agent access
Workspace containmentAll paths resolved within workspace

Users with sandbox: false in their config can bypass path restrictions.


See Also