Skip to content

OpenClaw Tools (Part 3): Exec Tool, Thinking Levels, and Slash Commands

Mar 28, 2026 1 min
TL;DR Exec supports foreground/background/PTY execution with three security levels (deny/allowlist/full). Thinking has 7 levels (off to adaptive). Slash Commands come in two types: commands and directives.

🌏 中文版

This post covers OpenClaw’s lowest-level execution tool (Exec), reasoning control (Thinking), and user interaction interface (Slash Commands).

Exec Tool

Executes shell commands within the workspace. Supports both foreground and background execution.

Parameters

ParameterDefaultDescription
command(required)The command to execute
workdircwdWorking directory
yieldMs10000Automatically moves to background after this duration
backgroundfalseExecute in background immediately
timeout1800sKill on timeout
ptyfalsePseudo-terminal mode (PTY)
hostsandboxsandbox / gateway / node
securitydeny (sandbox)deny / allowlist / full
askon-missoff / on-miss / always
elevatedfalseExecute on the gateway host

Three Execution Hosts

HostDescription
sandboxInside the sandbox container (default)
gatewayOn the Gateway host
nodeOn the paired node device

Important: The sandbox is disabled by default. If the sandbox is off but host=sandbox, exec will fail closed rather than silently running on the host machine.

Security Model

Allowlist + Safe Bins:

  • The allowlist matches against resolved binary paths only (not basenames)
  • Chaining (;, &&, ||) in allowlist mode is only allowed when all segments are on the allowlist
  • Redirections are not supported

Safe Bins: Small, stdin-only stream filters.

{
  tools: {
    exec: {
      safeBins: ["cat", "sort", "head", "tail", "wc"],
      safeBinTrustedDirs: ["/bin", "/usr/bin"],
      safeBinProfiles: {
        sort: { maxPositional: 1, deniedFlags: ["-o"] }
      }
    }
  }
}

Do not add interpreters (python3, node, bash) to safeBins. Use explicit allowlist entries + approval prompts instead.

Strict Inline Eval: Setting strictInlineEval: true forces python -c, node -e, and similar inline eval commands to always require approval.

Exec Approvals

Sandbox agents can request per-invocation approval when executing on gateway/node:

  1. The Exec tool returns status: "approval-pending" + an approval id
  2. The user approves or denies
  3. The Gateway emits a system event (Exec finished / Exec denied)
/approve <id> allow-once    # Allow once
/approve <id> allow-always  # Allow always
/approve <id> deny          # Deny

PATH Handling

HostPATH Behavior
gatewayMerges login shell PATH; rejects env.PATH overrides
sandboxRuns sh -lc then prepends env.PATH; pathPrepend also applies
nodeRejects env.PATH overrides; uses the node host’s environment

Host execution rejects LD_*/DYLD_* loader overrides to prevent binary hijacking.

Session Overrides (/exec)

/exec host=gateway security=allowlist ask=on-miss node=mac-1

Only effective for authorized senders. Updates session state without writing to config.

apply_patch

A sub-tool of Exec for structured multi-file edits. Enabled by default for OpenAI/Codex models.

{
  tools: {
    exec: {
      applyPatch: { workspaceOnly: true, allowModels: ["gpt-5.2"] }
    }
  }
}

Thinking Levels

Controls the model’s reasoning depth.

7 Levels

LevelAliasDescription
offNo reasoning
minimalthinkMinimal reasoning
lowthink hardLow reasoning
mediumthink harderMedium reasoning
highultrathinkMaximum reasoning budget
xhighultrathink+GPT-5.2 + Codex only
adaptiveProvider-managed adaptive reasoning (Anthropic Claude 4.6)

Configuration Methods

Inline directive: Affects only the current message

/think:high Please analyze this code

Session default: Send a message containing only the directive

/think:medium

Resolution Order

  1. Inline directive
  2. Session override
  3. Per-agent default (agents.list[].thinkingDefault)
  4. Global default (agents.defaults.thinkingDefault)
  5. Fallback: Anthropic Claude 4.6 → adaptive, other reasoning models → low, otherwise → off

Provider-Specific Behavior

ProviderBehavior
Anthropic Claude 4.6Defaults to adaptive
Z.AIOnly supports on/off
MoonshotOnly supports enabled/disabled

Fast Mode (/fast)

A low-latency mode for reduced response times.

ProviderFast Mode Behavior
OpenAIservice_tier=priority + low reasoning + low verbosity
OpenAI CodexSame as above
Anthropic (API key)service_tier=auto
/fast on
/fast off

Verbose and Reasoning

Verbose (/verbose): Displays tool call details.

LevelBehavior
off (default)Shows only failure summaries
onOne bubble per tool call
fullTool calls + output after completion

Reasoning (/reasoning): Displays the reasoning process.

LevelBehavior
off (default)Hidden
onDisplayed as a separate Reasoning: message
streamTelegram only; streams reasoning to a draft bubble

Slash Commands System

Two Types

Commands: Standalone /... messages. Directives: /think, /fast, /verbose, /reasoning, /elevated, /exec, /model, /queue.

Directives in regular messages act as inline hints (not persisted). In directive-only messages, they persist to the session.

Configuration

{
  commands: {
    native: "auto",        // Register native commands (Discord/Telegram)
    nativeSkills: "auto",  // Register skill commands
    text: true,            // Parse /... text
    bash: false,           // Enable ! <cmd>
    config: false,         // Enable /config
    mcp: false,            // Enable /mcp
    plugins: false,        // Enable /plugins
  }
}

Common Commands

CommandFunction
/helpHelp
/statusCurrent status + provider usage
/toolsCurrently available tools
/contextContext usage info
/btw <question>Side question (does not affect session context)
/export-sessionExport session as HTML
/subagents listList sub-agents
/focus <target>Discord thread binding

Summary

Exec is OpenClaw’s most powerful and most dangerous tool — three layers of security control (host, security, ask) ensure it stays under control. Thinking lets you adjust reasoning depth based on task complexity. Slash Commands are the primary interface for users to interact with the Gateway.

References

This post is compiled from the following OpenClaw source documents: