What is Shell Gate?

Shell Gate is Alius’s human-in-the-loop security layer. It performs risk analysis and scope checking on all shell and file operations requested by the Agent, ensuring you remain in control during sensitive operations.

Shell Gate is not a simple “allow/deny” switch. It analyzes the command string, arguments, paths, redirection targets, current working directory, origin, workspace root, and authorization policy to make fine-grained decisions.

How It Works

When the Agent wants to execute an operation (Shell command, file write, etc.), Shell Gate:

  1. Intercepts the operation
  2. Analyzes command risk and scope
  3. Decides: Allow / Deny / ApprovalRequired
  4. Records the decision for auditing

Shell Gate Decisions

DecisionPlan Mode BehaviorBypass Mode Behavior
AllowExecute directlyExecute directly
DenyReject executionReject execution
ApprovalRequiredPause and wait for user confirmationExecute directly and return result

In Bypass mode, Shell Gate’s ApprovalRequired decisions are executed directly rather than waiting for confirmation. Denied operations still do not execute.

Git Command Risk Classification

Shell Gate classifies Git subcommands:

Risk LevelCommandsDescription
Low riskgit status, git log, git diff, git show, git branchRead-only operations
Medium riskgit clone, git fetch, git pull, git submoduleWrite to workspace and/or use network
Medium riskgit push, git checkout, git switch, git merge, git rebase, git restore, git add, git commitModification operations
High riskgit clean, git reset --hardMay cause data loss

Workspace Boundary Checks

All file operations go through resolve_within_workspace(path, workspace, must_exist) for boundary checking:

  • Blocks absolute path access (e.g., /etc/passwd)
  • Blocks parent directory traversal (e.g., ../secret)
  • Blocks symlink escapes
  • Checks paths in option values (e.g., --output=/tmp/file)
  • Checks redirection targets (e.g., > /tmp/file, 2>/tmp/error)
  • Ignores URL-like values (not treated as paths)

Built-in Tool Permissions

ToolPermission LevelDescription
shellExecuteExecute shell commands, 120-second timeout, output truncated to 20,000 characters
read_fileReadRead files, workspace boundary check
write_fileWriteWrite files, requires confirmation in Plan mode
list_dirReadList directory contents
edit_fileWriteReplace file content, requires confirmation in Plan mode

Shell Tool

The complete execution flow for the Shell tool:

  1. Parse arguments
  2. Resolve cwd within workspace scope
  3. Call shell_gate::authorize for risk analysis
  4. Deny → reject execution
  5. Allow → execute command
  6. ApprovalRequired → Plan mode pauses for confirmation, Bypass mode executes directly
  7. Output format: [exit:N]\n<stdout>\n<stderr>, truncated to 20,000 characters

Configuring Permissions

Configure in .alius/config/permissions.toml:

[shell]
default = "ask"
auto_approve = ["ls", "cat", "git status", "git log", "git diff"]
deny = ["rm -rf /", "format", "mkfs"]

[file_write]
default = "ask"
deny_patterns = [".env", "credentials", "*.key"]

[network]
default = "ask"

Best Practices

  1. Start strict — Use ask as the default for all operation types
  2. Add auto-approvals gradually — Only for commands you run frequently and trust
  3. Review Traces — Regularly check audit logs
  4. Don’t auto-approve writes — Keep file modifications requiring approval
  5. Be mindful of Bypass mode — In Bypass mode, ApprovalRequired executes directly, so ensure you trust the current task

Auditing

All tool calls produce ToolCallStarted and ToolCallCompleted events, recorded in the Session’s Trace. Shell calls appear in the session area as shell: <command>, and completion blocks include a brief output summary.