Security & Permissions
Clew Code has a layered security model that controls what the AI can do and when it needs human approval.
Permission modes
| Mode | Description | Best for |
|---|---|---|
ask | Prompt before every operation | Maximum control, learning the tool |
default | Ask for sensitive ops (write, bash), auto-accept reads | Day-to-day development |
acceptEdits | Auto-accept file edits, ask for bash and sensitive ops | Focused coding sessions |
plan | Full bypass — no prompts | Planning mode |
bypassPermissions | Full bypass — no prompts | Automated workflows |
dontAsk | Auto-accept everything | CI/CD, trusted environments |
guardian | AI reviews and may deny tool calls | Safety net without constant prompts |
auto | Auto-accept in automated contexts | Scripted sessions |
Switch modes with:
> /profile default
> /profile guardian on
> /profile bypassPermissionsMode is persisted across sessions.
Guardian mode
Guardian is an AI-powered safety layer. Instead of asking you for every decision, the AI internally reviews each tool call and can approve, deny, or flag it.
> /profile guardian on
> /guardian statusGuardian can be configured with granular rules:
{
"guardian": {
"denyCommands": ["rm -rf", "git push --force"],
"denyPaths": [".env", "credentials.json"],
"requireApproval": ["npm publish", "gh pr merge"]
}
}Tool permissions
Tools can be explicitly allowed or denied in settings.json:
{
"permissions": {
"allow": ["Read", "Glob", "Grep", "Bash", "Edit", "Write"],
"deny": ["Bash"]
}
}The deny list takes precedence — if a tool is in both lists, it is denied.
Safety gates
Clew Code enforces several safety gates:
- Path validation — Prevents reading/writing outside the project directory (configurable)
- Command validation — Blocks dangerous shell commands (
rm -rf /, pipe tosh, etc.) - Secret scanning — Warns before committing files that look like credentials
- Git safety — Never force-pushes to main/master without explicit confirmation
- Hook enforcement — Pre-commit hooks always run (
--no-verifyis blocked)
Best practices
- Use
defaultmode for day-to-day work - Switch to
guardianwhen you want safety without friction - Use
acceptEditswhen you trust the model but want bash approval - Never use
bypassPermissionsin an untrusted environment - Review
.clew/settings.jsonfor permission overrides when sharing a project
Audit logging
All tool calls are logged to .session/ with timestamps, tool names, inputs, and results. Use these logs to review what the AI did after a session.
An enterprise-grade SIEM-compatible NDJSON audit log is available in src/services/auditLog/ with configurable rotation, filtering, and log levels.