Policy rule matches? │ ▼ DENY > APPROVAL_REQUIRED > ALLOW │ └── no rule matches ──► DENY (DMT_DEFAULT_DENIED)
rules. Every rule has a lowercase effect, an exact tool selector, an exact action selector, and optional scoping fields:{ "rules": [ { "effect": "allow", "tool": "database", "action": "query", "resource": "public.*", "resource_kind": "identifier" }, { "effect": "approval_required", "tool": "database", "action": "update", "resource": "public.accounts", "constraints": { "properties": { "amount": { "type": "number", "maximum": 50000 } } } }, { "effect": "deny", "tool": "database", "action": "drop", "resource": "*" } ] }
dmint verify-policy policy.json dmint check -p policy.json -t database.query -r "public.users" dmint policy-digest policy.json
verify-policy is offline and deterministic. policy-digest prints the domain-separated SHA-256 digest used for policy provenance.| Effect | Meaning |
allow | Permit execution if every matching rule’s conditions and constraints pass. |
deny | Reject execution immediately. The protected function never runs. |
approval_required | Persist one pending request and stop. No tool execution occurs until a trusted human approves the exact request. |
ALLOW, APPROVAL_REQUIRED, and DENY are rejected by the loader and verify-policy.Decision.ALLOW, Decision.DENY, and Decision.APPROVAL_REQUIRED.1. DENY (highest priority) 2. APPROVAL_REQUIRED 3. ALLOW (lowest priority)
deny overrides every matching approval_required and allow; a matching approval_required overrides a matching allow.allow before a deny.DENY:| Case | Decision | Code |
A deny rule matches | DENY | DMT_POLICY_DENIED |
| No rule matches | DENY | DMT_DEFAULT_DENIED |
| A matching rule’s constraints fail | DENY | DMT_CONSTRAINT_VIOLATION |
A matching approval_required rule exists (and no deny wins) | APPROVAL_REQUIRED | DMT_APPROVAL_REQUIRED |
allow rule but violates its constraints, Dmint denies the request. To express different handling for different argument ranges, use distinct capabilities (for example billing.issue_small_refund and billing.issue_large_refund) selected by trusted host code, as the tutorial demonstrates.tool and actiontool or action."*" is a whole-field wildcard. It matches any tool or action."read_*" are not supported; use exact values or "*".deny therefore overrides any more specific allow.resourceresource selector is optional.Omitted or NO_RESOURCE | "*" | Exact string / pattern |
| Matches only requests with no resource | Matches any resource | Matches the request resource according to resource_kind |
"resource": "*". Writing Rule.deny("database", "drop") without a resource does not deny resource-bearing calls; it only matches no-resource calls.resource_kind values are exact, path, url, host, and identifier. The default is derived from the resource value: no-resource for omitted, any for "*", exact for a string. Set case_sensitive only where the chosen kind supports it.agent_idagent_id optionally narrows a rule to one principal. Omit it to match every principal.conditionsTrustedContext. They never read model output or request arguments.{ "effect": "approval_required", "tool": "cloud", "action": "deploy", "conditions": [ { "field": "environment", "operator": "equals", "value": "production" } ] }
equals, notEquals, in, contains, startsWith, and endsWith.constraintsallow and approval_required rules; attaching constraints to a deny rule is rejected. A matching rule with failing constraints produces DENY (DMT_CONSTRAINT_VIOLATION) before any effect is applied.{ "rules": [ { "effect": "allow", "tool": "filesystem", "action": "read_file", "resource": "/var/log/*", "resource_kind": "path" }, { "effect": "approval_required", "tool": "database", "action": "update", "resource": "*", "constraints": { "properties": { "amount": { "type": "number", "maximum": 50000 } } } }, { "effect": "deny", "tool": "*", "action": "*", "resource": "*" } ] }
deny overrides the first two rules for every request. It is a backstop only if it is intended to make the policy deny everything; usually a catch-all deny is omitted because unmatched requests already fail closed. Prefer an explicit deny for the specific dangerous capabilities you want to document.DMT_APPROVAL_POLICY_INVALID and invalidates the record. This prevents an approval granted under one policy from authorizing execution under another.policy-digest in deployment tooling and pin the value with expected_policy_digest when loading a policy from a remote URL.dmint verify-policy policy.json after every edit."resource": "*" on any global deny or approval rule.else branch.policy.json under version control and rotate its digest deliberately.shell: Safe terminal commands (git, pytest, npm test) allowed; service management (systemctl, docker) approval-gated; destructive commands (rm -rf /, dd, mkfs) denied.filesystem: Path-scoped workspace reads allowed; write operations approval-gated; credentials (.env*, *.key, *.pem, /etc/*) denied.postgres: SELECT and EXPLAIN allowed; mutations and DDL approval-gated; DROP TABLE and TRUNCATE denied.github: Issues and PR reads allowed; PR and issue creation approval-gated; repo deletion and force push denied.stripe: Customer/charge lookups allowed; billing transactions approval-gated; payouts and secret keys denied.aws: Resource inspection allowed; provisioning approval-gated; deletion and termination denied.kubernetes: Pod and log observation allowed; rollouts and scaling approval-gated; cluster deletion denied.from dmint.templates import get_template_policy, list_templates. See the Policy Templates Reference for full JSON schemas and deduplication rules.