canvas agent guard
canvas agent guard¶
Generate agent-safety config that blocks destructive canvas operations
Synopsis¶
guard generates the permission rules and hooks that stop an AI agent from running destructive canvas operations, derived from the live command tree so the list is always complete.
By default it hard-blocks the irreversible actions (delete, remove, conclude, crosslist, deactivate, unpublish, cancel, close, merge, split, reset, ...) and makes everything else that isn't a known read (create, update, grade, and any verb the guard doesn't recognize) require approval. Classification is fail-safe: only an explicit allowlist of read verbs (get, list, show, ...) stays allowed, so a new or non-obvious mutating command is gated rather than slipping through. Pass --all-writes to block writes too.
IMPORTANT: the "canvas api" escape hatch can issue any HTTP verb. The guard blocks "canvas api DELETE/PUT/POST/PATCH" patterns on the Bash surface but cannot enumerate arbitrary path arguments. For a hard guarantee, run the agent MCP-only (no Bash tool) or inside a read-only sandbox.
Output is printed for review by default; pass --write to install it. See the Agent Safety guide: https://jjuanrivvera.github.io/canvas-cli/user-guide/agent-safety/
Examples¶
canvas agent guard --host claude-code
canvas agent guard --host codex
canvas agent guard --host opencode --all-writes
canvas agent guard --host claude-code --write
Options¶
--all-writes Also block create/update/grade (default: those require approval)
-h, --help help for guard
--host string Target agent host: claude-code, codex, opencode
--write Write the config/hook files instead of printing them
Options inherited from parent commands¶
--as-user int Masquerade as another user (admin feature, requires permission)
--columns strings Select specific columns to display (comma-separated)
--config string config file (default is $HOME/.canvas-cli/config.yaml)
--dry-run Print curl commands instead of executing requests
--filter string Filter results by text (case-insensitive substring match)
--instance string Canvas instance URL (overrides config)
--limit int Limit number of results for list operations (0 = unlimited)
--no-cache Disable caching of API responses
-o, --output string Output format: table, json, yaml, csv (default "table")
--quiet Suppress informational messages, only output data and errors
--show-token Show actual token in dry-run output (default: redacted)
--sort string Sort results by field (prefix with - for descending, e.g., -name)
-v, --verbose Enable verbose output
SEE ALSO¶
- canvas agent - Helpers for running canvas under an AI agent