Overview
The Swif OpenClaw Tools Runtime Policy controls how OpenClaw runs commands, detects repetitive tool activity, and handles files attached to spawned sessions on managed devices.
Use this policy to:
Decide when a long-running command moves to the background
Limit how long commands can run
Control background-process completion notifications
Enable or restrict the
apply_patchfile-editing toolDetect repeated tool calls that make no progress
Set size and retention limits for files passed to spawned sessions
This policy changes runtime behavior. It does not grant an agent access to a tool that is denied by the Swif OpenClaw Tools Access Policy.
Important: Runtime settings can affect agent reliability, resource use, and access to local files. Test changes with a small device group before broad deployment.
Requirements
Requirement | Details |
Supported operating systems | macOS, Windows, and Linux |
Device ownership | Company-owned and BYOD |
Device management | The device must be enrolled in Swif Agentic Security |
OpenClaw | The OpenClaw gateway must be installed |
Connectivity | The device must be online to receive the policy |
Administrator access | A Swif administrator must be able to create and assign policies |
How This Policy Relates to Other OpenClaw Policies
OpenClaw controls are most effective when access, runtime behavior, and audit visibility are managed together.
Policy | Purpose |
Swif OpenClaw Tools Access Policy | Allows or denies access to tools such as command execution, process management, file editing, and session spawning. |
Swif OpenClaw Tools Runtime Policy | Controls how permitted tools run, when they stop, and how they handle loops and attachments. |
Swif Agentic Security Logging Policy | Controls the security events and activity available for monitoring and investigation. |
For example, enabling Apply Patch in this policy does not make the tool available if it is denied by the Tools Access Policy. Access rules remain authoritative.
Defaults and Version Compatibility
The Swif policy does not prepopulate a default configuration. A setting that you leave unconfigured is omitted from the policy, allowing the installed OpenClaw version to use its own default behavior.
At the time of publication, OpenClaw documents the following native defaults:
Setting | Current OpenClaw default |
Exec background delay |
|
Exec timeout |
|
Completed-output cleanup |
|
Notify on background-process exit | Enabled |
Notify on empty successful exit | Disabled |
Command highlighting | Disabled |
Apply Patch | Enabled |
Apply Patch allowed models | Any compatible model |
Rolling-history loop detection | Disabled |
Spawned-session attachments | Disabled |
Maximum total attachment size |
|
Maximum attachment count |
|
Maximum size per attachment |
|
Retain attachments when keeping a session | Disabled |
OpenClaw can change defaults and schema names between releases. Review the OpenClaw configuration reference and the live schema on the managed device before changing advanced settings:
openclaw config schema
Two naming differences deserve particular attention:
Swif exposes the exec timeout as
timeoutSec; current OpenClaw documentation names the native settingtimeoutSeconds.Swif groups attachment settings under
sessionsSpawn; current OpenClaw documentation usestools.sessions_spawn.attachments.
The Swif agent is expected to translate policy fields to the applicable OpenClaw configuration. Confirm the effective behavior on every OpenClaw version you approve for production.
Create the Policy
Sign in to the Swif Admin Dashboard.
Go to Agentic Security > Policies.
Create a new policy.
Select Swif OpenClaw Tools Runtime Policy.
Enter a descriptive policy name.
Configure only the settings your organization intends to manage.
Assign the policy to a test device or test group.
Allow the device to check in and apply the policy.
Review the policy report and test the expected OpenClaw behavior.
Expand the assignment after testing succeeds.
For general assignment instructions, see Assigning policies to devices or groups.
Exec Settings
Exec settings control command lifetime, background behavior, completion notifications, output presentation, and access to apply_patch.
Background Ms
Specifies how long OpenClaw waits before moving a running command to the background.
The value is measured in milliseconds. For example:
Value | Behavior |
| Moves the command to the background after 5 seconds. |
| Moves the command to the background after 10 seconds. |
| Moves the command to the background after 30 seconds. |
Moving a command to the background does not stop it. The agent can continue to monitor the process through the applicable process-management tool when that tool is allowed.
Timeout Sec
Specifies the maximum command runtime in seconds. OpenClaw stops a command that exceeds the configured limit.
Choose a timeout long enough for approved builds, package operations, and security scans, but not so long that a stalled process consumes resources indefinitely.
The timeout should normally be greater than the background delay. For example, a 10-second background delay and a 30-minute timeout would be entered as:
Background Ms: 10000
Timeout Sec: 1800
Compatibility note: Current OpenClaw documentation calls the native setting timeoutSeconds. Verify that the installed Swif agent and OpenClaw release apply the value correctly.
Cleanup Ms
Specifies how long OpenClaw retains completed exec output before cleaning it up. The value is measured in milliseconds.
This controls runtime output cleanup. It is not an organizational log-retention policy and should not be treated as a replacement for security logging or centralized audit storage.
Notify on Exit
When enabled, OpenClaw sends a notification when a background process exits.
Enable this setting when agents must know that a build, scan, installation, or other background operation has finished.
Notify on Exit Empty Success
When enabled, OpenClaw also sends an exit notification when a background process completes successfully without producing output.
Leave this disabled if empty success notifications create unnecessary activity. Enable it when silent processes are operationally important and their successful completion must be visible.
Command Highlighting
Enables syntax highlighting for exec output. This is a presentation setting and does not change command permissions or execution behavior.
Apply Patch
Controls OpenClaw's apply_patch capability.
apply_patch can modify files by applying structured patches. Because it can change source code, configuration, and other local content, enable it only for workflows and models that require file editing.
Setting | Purpose |
Enabled | Makes |
Allow Models | Limits use to the listed model identifiers. An empty list permits any compatible model. |
For least-privilege deployments:
Explicitly disable Apply Patch when agents do not need to edit files.
If file editing is required, enter the exact approved model identifiers in Allow Models.
Also confirm that the Tools Access Policy grants only the necessary tool access.
Monitor file-editing activity through your approved logging workflow.
Loop Detection
Loop detection helps identify repeated tool activity that is not making useful progress. It can warn an agent, block a repeated tool batch, and eventually stop a run that remains stuck.
OpenClaw documents two related safeguards:
Rolling-history detectors for repeated or no-progress tool patterns
A post-compaction guard for repeated context-overflow recovery cycles
The rolling-history detectors are disabled by default in current OpenClaw documentation. The post-compaction guard can remain active when the main loop-detection setting is unset. Explicitly disabling loop detection can disable both safeguards, depending on the installed OpenClaw version.
OpenClaw recommends enabling rolling-history detection for smaller or less capable models. Regardless of model size, test the setting against representative workflows because legitimate polling, retries, and iterative tasks can resemble a loop.
Loop Detection Settings
Setting | Purpose |
Enabled | Enables rolling-history loop detection. |
History Size | Controls how many recent tool calls are evaluated. |
Warning Threshold | Sets the point at which OpenClaw warns about repeated behavior. |
Critical Threshold | Sets the point at which OpenClaw treats the pattern as a critical loop. |
Global Circuit Breaker Threshold | Sets the final limit at which the run is stopped. |
When you configure thresholds, keep them in increasing order:
Warning Threshold < Critical Threshold < Global Circuit Breaker Threshold
Do not copy threshold values from an older OpenClaw release without validation. The current public documentation does not define authoritative defaults for these advanced fields. Leave them unconfigured to inherit the installed gateway's behavior, or confirm supported values with openclaw config schema before deployment.
Loop Detectors
Detector | Behavior |
Generic Repeat | Detects repeated calls with the same or substantially similar tool input. |
Known Poll No Progress | Detects repeated status or polling calls whose result does not show progress. |
Ping Pong | Detects alternating calls that repeat without advancing the task. |
Disabling an individual detector can reduce false positives for a known workflow, but it also removes protection for that pattern. Prefer adjusting a workflow or its thresholds before broadly disabling safeguards.
For more detail, see OpenClaw tool-loop detection.
Sessions Spawn Attachments
These settings control files passed to sessions created through the session-spawning tool.
Attachments are disabled by default. Enable them only when a spawned session must receive a file to complete its work.
Setting | Purpose |
Enabled | Permits attachments to be passed to spawned sessions. |
Max Total Bytes | Limits the combined decoded size of all attachments in one spawn request. |
Max Files | Limits the number of files in one spawn request. |
Max File Bytes | Limits the decoded size of each individual file. |
Retain on Session Keep | Retains materialized attachment files when the parent workflow keeps the spawned session. |
Use byte values rather than display units:
Size | Bytes |
512 KiB |
|
1 MiB |
|
5 MiB |
|
10 MiB |
|
Ensure Max File Bytes is less than or equal to Max Total Bytes.
OpenClaw materializes subagent attachments in a session-specific directory under .openclaw/attachments/ and creates a manifest for them. Current OpenClaw documentation states that attachment content is redacted from transcript persistence, directories use restrictive permissions, and files are removed when the session is deleted. However, the receiving agent can still read the attachment while it is available. Do not attach secrets or regulated data unless the workflow, model, storage, and logging controls are approved for that data.
For ACP-based spawned sessions, current OpenClaw documentation limits attachments to images. A rejected non-image attachment may therefore be expected behavior rather than a policy installation failure.
Recommended Attachment Baseline
For organizations that need attachments, begin with a narrow limit:
Setting | Suggested value |
Enabled | Enabled |
Max Total Bytes |
|
Max Files |
|
Max File Bytes |
|
Retain on Session Keep | Disabled |
Adjust these limits only after reviewing the file types and sizes required by the workflow.
Recommended Baseline
The following configuration is a practical starting point for a pilot. It preserves familiar command behavior while applying explicit least-privilege choices.
Setting | Suggested value |
Background Ms |
|
Timeout Sec |
|
Cleanup Ms |
|
Notify on Exit | Enabled |
Notify on Exit Empty Success | Disabled |
Command Highlighting | Disabled |
Apply Patch | Disabled unless required |
Loop Detection | Enabled for pilot testing |
Advanced loop thresholds | Leave unconfigured initially |
All loop detectors | Enabled |
Sessions Spawn Attachments | Disabled unless required |
Retain on Session Keep | Disabled |
This is a starting point, not a universal security standard. Shorter timeouts can disrupt legitimate builds or scans, while longer timeouts increase the impact of stalled or unintended commands.
Configuration Examples
Support Long-Running Commands
Use the following settings for workflows that may continue after the interactive response:
Background Ms: 10000
Timeout Sec: 1800
Cleanup Ms: 1800000
Notify on Exit: Enabled
Notify on Exit Empty Success: Disabled
A command moves to the background after 10 seconds and can continue for up to 30 minutes. Completed output remains available for up to 30 minutes.
Restrict File Editing to Approved Models
Apply Patch Enabled: Enabled
Allow Models:
- <approved-model-id>
Replace the placeholder with the exact model identifier approved by your organization. Model aliases and identifiers can change, so validate the list after model or OpenClaw upgrades.
Enable Loop Protection Without Custom Tuning
Loop Detection Enabled: Enabled
Generic Repeat: Enabled
Known Poll No Progress: Enabled
Ping Pong: Enabled
Leave the history and threshold fields unconfigured during the initial deployment. This avoids hard-coding values that may not match the installed OpenClaw release.
Allow Small Attachments Without Retention
Attachments Enabled: Enabled
Max Total Bytes: 5242880
Max Files: 10
Max File Bytes: 1048576
Retain on Session Keep: Disabled
This permits up to ten files, limits each file to 1 MiB, and limits the entire request to 5 MiB.
Verify the Policy
After assignment:
Confirm that the device is online in Swif.
Confirm that the policy reports as installed.
Confirm that the OpenClaw gateway is running.
Start a new OpenClaw session so it reads the current configuration.
Run
openclaw config schemaand confirm that the targeted fields are supported by the installed version.Run a harmless command that lasts longer than Background Ms and confirm that it transitions to the background.
Confirm that an exit notification appears when the background command finishes.
If Apply Patch is restricted, test both an approved and an unapproved model.
If loop detection is enabled, review normal workflows for warnings or false positives.
If attachments are enabled, test a permitted small file and a file that exceeds the configured limit.
Review the Swif policy report and Agentic Security logs for errors.
Use non-production files and harmless commands for verification. Do not deliberately create an uncontrolled process or destructive file-editing test.
Security Considerations
A longer timeout increases the period during which an unintended command can consume CPU, memory, network, or disk resources.
A very short timeout can interrupt patching, package installation, builds, or security scans and leave partial changes.
Background-process notifications can expose command context or output to recipients who can view the session.
apply_patchcan alter source code and configuration. Combine it with explicit access rules, model restrictions, and logging.Exec output can contain file paths, environment details, credentials, or tokens. Runtime cleanup does not guarantee removal from other logs or destinations.
Spawned-session attachments can contain sensitive data. Keep attachment limits narrow and retention disabled unless a documented workflow requires it.
Loop detection reduces runaway repetition but does not replace command approval, access control, budgets, or monitoring.
For broader deployment guidance, see Getting Started with Swif's Agentic Security for Enterprise.
Troubleshooting
The Policy Reports Installed but the Runtime Behavior Does Not Change
Check the following:
The policy is assigned to the correct device or group.
The device is online and has checked in since the policy was changed.
The OpenClaw gateway is installed and running.
A newer session was started after the configuration changed.
Another policy or local configuration is not managing the same field.
The installed OpenClaw version supports the field shown in the Swif policy.
Compare the policy with the live output from:
openclaw config schema
Pay particular attention to the timeout and spawned-session key names described under Defaults and Version Compatibility.
Commands Move to the Background Too Soon
Increase Background Ms. This setting affects when the command becomes asynchronous; it does not increase the maximum runtime. Increase Timeout Sec separately if the command is also being stopped too early.
Commands Stop Before Finishing
Increase Timeout Sec after confirming the command is expected and safe. Also check whether an operating-system service, endpoint security tool, resource limit, or user action terminated the process.
No Background Exit Notification Appears
Confirm that:
Notify on Exit is enabled.
The command actually moved to the background.
The process reached an exit state.
The active channel supports the notification.
The gateway remained running and connected.
If the command succeeds without output, enable Notify on Exit Empty Success for the test.
Apply Patch Is Unavailable
Confirm that:
Apply Patch > Enabled is enabled.
The Tools Access Policy permits
apply_patchand any required exec access.The active model is included in Allow Models, or the list is empty.
The selected model and OpenClaw release support the capability.
Legitimate Work Triggers Loop Warnings
Identify which detector matches the workflow. Repeated polling commonly affects Known Poll No Progress, while alternating calls can affect Ping Pong.
First, reduce unnecessary retries or add progress between calls. If tuning is still necessary, increase thresholds gradually on a test group. Disable an individual detector only after reviewing the resulting loss of protection.
Loop Detection Does Not Stop Repetition
Confirm that Enabled is explicitly enabled for rolling-history detection. An unset value can leave only the post-compaction safeguard active. Also confirm that the relevant detector is enabled and that the configured thresholds are supported by the installed OpenClaw version.
An Attachment Is Rejected
Confirm that:
Attachments are enabled.
The file count does not exceed Max Files.
Each decoded file is no larger than Max File Bytes.
The combined decoded size does not exceed Max Total Bytes.
The attachment encoding is valid.
The session type supports the file type. ACP spawned sessions may accept images only.
Attachments Remain After a Kept Session
Confirm the Retain on Session Keep value and the workflow's cleanup mode. Disable retention if kept sessions should not preserve materialized attachments, then validate the behavior with a new test session.
Change or Remove the Policy
To change the runtime configuration:
Edit the policy in Swif.
Save the changes.
Allow assigned devices to check in.
Start a new OpenClaw session and verify the new behavior.
To stop managing these settings:
Remove the policy assignment or delete the policy.
Allow the device to check in.
Confirm whether Swif removes the managed values or leaves the last-applied values in place.
Review the effective OpenClaw configuration and restore the organization's desired settings if necessary.
Removing an assignment does not always guarantee that a previously written application setting returns to its earlier value. Test policy removal before relying on it as a rollback method.
Summary
The Swif OpenClaw Tools Runtime Policy gives administrators a central way to manage command execution, file-patching controls, loop safeguards, and spawned-session attachments across enrolled macOS, Windows, and Linux devices.
For a safe initial deployment:
Start with a small test group.
Configure only the settings you need to manage.
Keep
apply_patchand attachments disabled unless a documented workflow requires them.Enable loop detection and observe representative workflows before tuning thresholds.
Verify field support against the live OpenClaw schema.
Pair runtime controls with the Tools Access Policy and Agentic Security logging.
Revalidate the policy after OpenClaw or Swif agent upgrades.