/coder), the AI has the ability to read, write, create, and execute commands on your system. To ensure you are always in control, we implemented a governance system inspired by ClaudeCode.
How Does It Work?
Every time the AI suggests an action (such as creating a file or running a script), ChatCLI checks your local security rules before executing.The 3 Permission States
Allow (Permitted)
The action is executed automatically, without interruption. Ideal for read commands (
read, tree, search) and read-only Git operations (git-status, git-diff, git-log, git-changed, git-branch).Deny (Blocked)
The action is silently blocked (or with an error for the AI). Ideal for protecting sensitive files or destructive commands.
Ask (Prompt)
ChatCLI pauses and displays an interactive menu for you to decide. This is the default for unconfigured actions.
Interactive Approval Menu
When an action falls into the “Ask” state, you will see a security box with contextual information about the action:Recognized Action Types
| Subcommand | Prompt Label | Details Displayed |
|---|---|---|
exec | Execute shell command | $ <command>, dir: <cwd> |
test | Run tests | $ <command>, dir: <cwd> |
write | Write file | file: <path> |
patch | Modify file (patch) | file: <path> |
read | Read file | file: <path> |
search | Search code | term: <pattern>, dir: <path> |
tree | List directory structure | dir: <path> |
Prompt with Context in Parallel Mode
When the action is requested by a multi-agent mode worker, the prompt includes additional information about which agent is making the request:This allows you to know exactly which agent is requesting the action and why, facilitating informed security decisions.
Options
a (Always)
Creates a permanent ALLOW rule for this command (e.g., allows all writes with
@coder write).For
exec commands, the “Always” and “Deny Forever” options are not available, as each execution is unique and requires individual approval.Rule Management
Rules are saved locally in~/.chatcli/coder_policy.json. You can edit this file manually if desired, but the interactive menu is the easiest way to configure.
The matching uses the effective @coder subcommand even when args is JSON (e.g., {"cmd":"read"} becomes @coder read).
Local Policy (Per Project)
You can add a local policy in the project directory:- Local:
./coder_policy.json - Global:
~/.chatcli/coder_policy.json
- With merge (local + global)
- Without merge (local only)
If
merge: true, local rules merge with global ones (local overrides matching patterns).Policy Example (coder_policy.json)
Word Boundary Matching
The policy system uses word boundary matching, ensuring that rules do not partially match different subcommands:| Rule | Command | Result |
|---|---|---|
@coder read = allow | @coder read file.txt | Allowed |
@coder read = allow | @coder readlink /tmp | Does not match (falls to Ask) |
@coder read --file /etc = deny | @coder read --file /etc/passwd | Deny (path-prefix match) |
Command Validation (50+ Patterns)
Beyond policy governance,@coder exec validates each command against 50+ regex patterns that detect:
Data destruction
rm -rf, dd if=, mkfs, drop databaseRemote execution
curl | bash, base64 | shCode injection
python -c, eval, $(curl ...)Process substitution
<(cmd), >(cmd)Kernel manipulation
insmod, modprobe, rmmodEvasion
${IFS;cmd}, VAR=x; bashCHATCLI_AGENT_DENYLIST:
For the complete list of ChatCLI security protections, see the Security and Hardening documentation.
Best Practices
Start with Caution
Keep write commands (
write, patch, exec) as ask until you feel confident in the agent.Allow Reads
Generally, it is safe to give “Always” for
coder read, coder tree, coder search, and read-only Git (git-status, git-diff, git-log).Be Specific
Matching uses word boundary for subcommand prefixes and path-prefix for arguments. You can allow
coder exec --cmd 'ls but block coder exec --cmd 'rm.Governance in Multi-Agent Mode (Parallel)
Security policies are fully respected by multi-agent mode workers. When/coder or /agent operates in parallel mode, each worker checks the coder_policy.json rules before executing any action.
Behavior
| Rule | Worker Action |
|---|---|
| allow | Action executed automatically by the worker |
| deny | Action blocked; the worker receives [BLOCKED BY POLICY] and continues its flow |
| ask | The worker pauses, the progress spinner is suspended, and the security prompt is displayed |
Security prompts from multiple workers are serialized — only one prompt at a time is displayed, avoiding visual overlap. Rules created during the session (via “Always” or “Deny”) are immediately visible to all subsequent workers.
Coder Mode UI
You can control the style and banner of/coder via environment variables:
| Variable | Values | Description |
|---|---|---|
CHATCLI_CODER_UI | full (default), minimal | Interface style |
CHATCLI_CODER_BANNER | true (default), false | Show/hide the cheat sheet |