Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

5-Minute Quickstart

This guide shows two ways to start using Dmint immediately:
  1. Track A (CLI & Coding Agents): Protect shell and file tools in Claude Code, OpenAI Codex CLI, OpenCode, Cursor, Windsurf, or Cline with dmint init.
  2. Track B (Python SDK): Protect Python functions with Dmint.local(), approve a paused call via dmint approve, and execute a single-use retry.

Prerequisites

  • Python: 3.10, 3.11, 3.12, or 3.13.
  • Operating system: Linux, macOS, or Windows WSL.
mkdir dmint-quickstart && cd dmint-quickstart python3 -m venv .venv source .venv/bin/activate pip install dmint dmint --version
dmint 2.0.4

Track A: Coding Agent Hooks in 30 Seconds (dmint init)

Run dmint init to generate local signing/integrity keys (.dmint/), a starter policy.json (shell and filesystem templates), and pre-tool execution hooks for your coding agents:
dmint init --harness all dmint doctor
Test how your policy evaluates commands from the terminal using dmint check:
# 1. Allowed command (exit code 0) dmint check --tool shell.execute --resource "git status" # 2. Approval-required command (exit code 1) dmint check --tool shell.execute --resource "git push origin main" # 3. Denied command (exit code 2) dmint check --tool shell.execute --resource "rm -rf /"
When your coding agent triggers an APPROVAL_REQUIRED command, approve it from your terminal and tell the agent to retry:
dmint pending dmint approve apr_... --by alice@company.com # Inspect and verify the SHA-256 hash-chained audit log: dmint logs dmint logs --verify

Track B: Python SDK Quickstart (Dmint.local)

Step 1: Create policy.json

policy.json
{ "rules": [ { "effect": "allow", "tool": "ledger", "action": "view_balance" }, { "effect": "approval_required", "tool": "ledger", "action": "transfer_funds" }, { "effect": "deny", "tool": "ledger", "action": "delete_account" } ] }
Validate it offline:
dmint verify-policy policy.json
✓ Verified policy.json: 3 rule(s) [ALLOW] tool='ledger', action='view_balance', resource='NoResource' [APPROVAL_REQUIRED] tool='ledger', action='transfer_funds', resource='NoResource' [DENY] tool='ledger', action='delete_account', resource='NoResource'

Step 2: Protect Functions in app.py

Dmint.local("policy.json") automatically provisions .dmint/signing.key, .dmint/integrity.key, and .dmint/approvals.sqlite3 with zero boilerplate:
app.py
import sys from dmint import ApprovalRequiredError, AuthorizationError, Dmint dmint = Dmint.local("policy.json", agent_id="ledger-agent-01") @dmint.protect("ledger.view_balance") def view_balance(account_id: str) -> dict: return {"account_id": account_id, "balance_usd": 12500} @dmint.protect("ledger.transfer_funds") def transfer_funds(from_acct: str, to_acct: str, amount: int) -> dict: return {"from": from_acct, "to": to_acct, "amount": amount, "status": "transferred"} @dmint.protect("ledger.delete_account") def delete_account(account_id: str) -> dict: return {"deleted": account_id} if __name__ == "__main__": if len(sys.argv) > 1 and sys.argv[1] == "--retry": # Automatically verifies and consumes the single-use approval from .dmint/approvals.sqlite3 res = dmint.retry(transfer_funds, "acct_100", "acct_200", 500) print(f"[✓] Approved retry succeeded: {res}") sys.exit(0) # 1. ALLOW: executes immediately print("[✓] Balance:", view_balance("acct_100")) # 2. DENY: fails closed immediately try: delete_account("acct_100") except AuthorizationError as exc: print(f"[✗] Denied as expected: {exc.code}") # 3. APPROVAL_REQUIRED: pauses and writes pending record to .dmint/approvals.sqlite3 try: transfer_funds("acct_100", "acct_200", 500) except ApprovalRequiredError as exc: print(f"[⏸] Paused for approval: {exc.approval_id}") print(f" Run: dmint approve {exc.approval_id}") print(" Then run: python app.py --retry")

Step 3: Run, Approve, and Retry

  1. Run app.py:
    python app.py
    [✓] Balance: {'account_id': 'acct_100', 'balance_usd': 12500} [✗] Denied as expected: DMT_POLICY_DENIED [⏸] Paused for approval: apr_7x9K... Run: dmint approve apr_7x9K... Then run: python app.py --retry
  2. Approve the pending request in your terminal:
    dmint approve apr_7x9K... --by finance@company.com --reason "Verified invoice #402"
    ✓ Approved 'apr_7x9K...' (ledger.transfer_funds) successfully. Reason: Verified invoice #402
  3. Run the approved retry:
    python app.py --retry
    [✓] Approved retry succeeded: {'from': 'acct_100', 'to': 'acct_200', 'amount': 500, 'status': 'transferred'}
  4. Try replaying the exact same retry a second time:
    python app.py --retry
    It fails closed with DMT_APPROVAL_CONSUMED because every Dmint approval assertion is single-use.