Skip to content
Auto Mode Gate

Control Bash permissions before execution

Deterministic policy for the built-in Bash tool, not an operating-system sandbox. One isolated Pi judge call only for eligible uncertainty.

Current release: 0.4.4MIT

Auto Mode Gate is a pre-tool gate for OpenCode and Pi users who want deterministic policy checks before built-in bash commands execute. It resolves known-safe reads, dangerous commands, and unsupported syntax without a model, and fails closed on missing or malformed input.

Version 0.4.4 is published on npm, GitHub Releases, and the documentation site. Validated baselines cover OpenCode 1.18.18, Pi 0.84.2, and Node 24.9.0 for the test suite.

Deterministic first

Exact rules decide trusted read-only paths, dangerous commands, and unsupported syntax before any model call.

Fail closed

Missing evidence, invalid configuration, timeout, cancellation, and transport errors block the call.

Host-owned policy

OpenCode and Pi read separate global and project JSON files, with exclusive migration from 0.2.0.

Sanitized logs

Optional JSONL decision logs exclude commands, arguments, prompts, secrets, and identifiers.

Outcome Effect
allow-final Continue without a model call.
deny-final Block without a model call.
unresolved-ineligible Block without a model call.
unresolved-eligible Pi may ask one isolated judge. OpenCode blocks as unavailable.

In Pi 0.84.2, /amg-judge persists Auto state, secondary judge model, thinking level, and shortcuts across sessions without changing Pi’s primary conversation model. Deterministic denials never yield to a model decision, and native host permissions still apply after an allowance.

  1. Install the adapter. Run opencode plugin auto-mode-gate@0.4.4 (or add "auto-mode-gate@0.4.4" to the plugin array in opencode.json), or run pi install npm:auto-mode-gate@0.4.4.
  2. Configure host policy. Set mode, shell, and exact trustedExecutablePaths in your host-owned JSON file.
  3. Review decisions and boundaries. Confirm discovery, runtime behavior, and native host permissions before relying on automated runs.