Skip to main content
The filesystem gate walks every string value in ctx.output — including nested strings inside objects and arrays — and blocks the evaluation if it finds patterns that indicate a destructive or unauthorized filesystem operation. It is designed for agents that can generate or suggest shell commands: coding assistants, DevOps automation bots, CI/CD orchestrators, and similar tools where a single bad output could wipe data or expose credentials. All three checks are enabled by default. You can disable any of them individually through the options if your use case requires it.

Usage

What it detects

Destructive rm commands

The gate matches any of the following patterns:

Path traversal

Any occurrence of .. used as a directory component — whether delimited by /, \, whitespace, or quotes — is flagged. This blocks attempts to escape a working directory such as ../../etc/passwd.

Sensitive directories

The gate flags references to the following paths:

What a failure looks like

Configuration

boolean
Enable destructive rm command detection. Defaults to true.
boolean
Enable path traversal (..) detection. Defaults to true.
boolean
Enable sensitive directory detection. Defaults to true.
string
Override the gate name recorded in results. Defaults to "filesystem".

Disabling individual checks

Turn off specific checks while keeping the others:
The gate scans strings recursively through the entire output value, including deeply nested objects and arrays. Very large or deeply nested outputs are capped at 10,000 visited nodes to prevent pathological runtime. Outputs beyond that cap are not fully scanned.