Skip to main content

CLI and MCP server for Pretorin Compliance API

Project description

Pretorin

Compliance tools for developers. Integrate with AI agents or your CI pipeline.

PyPI version MCP Registry MCP Compatible License: MIT Tests Python 3.10+


Beta — Pretorin is currently in closed beta. Framework/control browsing works for everyone. Platform write features (evidence, narratives, monitoring) require a beta code. Sign up for early access.

Pretorin CLI gives developers and AI agents direct access to compliance data, implementation context, and evidence workflows.

Two Usage Modes

  1. Pretorin-hosted model mode: run pretorin agent run and route model calls through Pretorin /v1 endpoints.
  2. Bring-your-own-agent mode: run pretorin mcp-serve and connect the MCP server to your existing AI tool (Claude Code, Codex CLI, Cursor, etc.).

Quick Start

uv tool install pretorin
pretorin login

Run the walkthrough:

bash scripts/demo-walkthrough.sh

Hosted Model Workflow (Recommended)

Use this flow when you want pretorin agent run to go through Pretorin-hosted model endpoints.

  1. Authenticate with your Pretorin API key:
pretorin login
  1. Optional: point model traffic to a custom/self-hosted Pretorin endpoint:
pretorin config set model_api_base_url https://platform.pretorin.com/v1
  1. Verify runtime setup:
pretorin agent doctor
pretorin agent install
  1. Run an agent task:
pretorin agent run "Assess AC-2 implementation gaps for my system"

Key behavior:

  • Preferred setup is pretorin login with no shell-level OPENAI_API_KEY override.
  • Model key precedence is: OPENAI_API_KEY -> config.api_key -> config.openai_api_key.
  • If OPENAI_API_KEY is set in your shell, it overrides stored login credentials.

Add to Your AI Tool

Use this flow when you already have an AI agent/tool and want Pretorin as an MCP capability provider.

Rome-bot

1. Claude Code

claude mcp add --transport stdio pretorin -- pretorin mcp-serve

Team setup via .mcp.json:

{
  "mcpServers": {
    "pretorin": {
      "type": "stdio",
      "command": "pretorin",
      "args": ["mcp-serve"]
    }
  }
}

2. Codex CLI

Add to ~/.codex/config.toml:

[mcp_servers.pretorin]
command = "pretorin"
args = ["mcp-serve"]

For Claude Desktop, Cursor, and Windsurf setup, see docs/MCP.md.

Core Commands

Platform-backed review and update workflows are single-scope: set one active system + framework first with pretorin context set, then run evidence, note, monitoring, narrative, or MCP-assisted compliance commands inside that scope. Multi-framework work must be split into separate runs.

Command Purpose
pretorin frameworks list List available frameworks
pretorin frameworks control <framework> <control> Get control details and guidance
pretorin context set Set active system/framework context
pretorin evidence create Create local evidence file
pretorin evidence push Push local evidence to Pretorin
pretorin evidence search Search platform evidence
pretorin evidence upsert <ctrl> <fw> Find-or-create evidence and link it
pretorin narrative get <ctrl> <fw> Get current control narrative
pretorin narrative push <ctrl> <fw> <sys> <file> Push a narrative file
pretorin notes list <ctrl> <fw> List control notes
pretorin notes add <ctrl> <fw> --content ... Add control note
pretorin monitoring push Push a monitoring event
pretorin agent run "<task>" Run Codex-powered compliance task
pretorin review run --control-id <id> --path <dir> Review local code for control coverage
pretorin mcp-serve Start MCP server

Artifact Authoring Rules

  • Narrative and evidence markdown must be human-readable for auditors: no markdown headings, use lists/tables/code blocks/links.
  • Markdown image embeds are temporarily disabled until platform-side file upload support is available.

Configuration

Credentials are stored at ~/.pretorin/config.json.

Variable Description
PRETORIN_API_KEY API key for platform access (overrides stored config)
PRETORIN_PLATFORM_API_BASE_URL Platform REST API base URL (/api/v1/public)
PRETORIN_API_BASE_URL Backward-compatible alias for PRETORIN_PLATFORM_API_BASE_URL
PRETORIN_MODEL_API_BASE_URL Model API base URL used by agent/harness flows (default: https://platform.pretorin.com/v1)
OPENAI_API_KEY Optional model key override for agent runtime

Documentation

Full documentation is built with mdbook. To view it locally:

# Install mdbook (if you don't have it)
cargo install mdbook

# Serve the docs and open in your browser
cd docs && mdbook serve --open

This starts a local server at http://localhost:3000 with live-reload.

To build static HTML without serving:

cd docs && mdbook build
# Output is in docs/book/

Quick links

Development

git clone https://github.com/pretorin-ai/pretorin-cli.git
cd pretorin-cli
uv pip install -e ".[dev]"
pytest
ruff check src/pretorin
ruff format --check src/pretorin

License

MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pretorin-0.8.2.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pretorin-0.8.2-py3-none-any.whl (111.6 kB view details)

Uploaded Python 3

File details

Details for the file pretorin-0.8.2.tar.gz.

File metadata

  • Download URL: pretorin-0.8.2.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pretorin-0.8.2.tar.gz
Algorithm Hash digest
SHA256 63d9d7ff945b64bd4d631570b254a83bae5d6e99b3106caf8f34d4463fb22ce7
MD5 8f794d85268bda33f0b4f799619753c4
BLAKE2b-256 08df632ca9e404a47c40202d4b78a96b6f1b9a9b3ceb4437e0841fe27d8dd5f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pretorin-0.8.2.tar.gz:

Publisher: publish.yml on pretorin-ai/pretorin-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pretorin-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: pretorin-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 111.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pretorin-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0afa58a5a691312d088c5aa898e142474e3177d9c1a6580a7a45b51ddb9a5a2
MD5 c8542090eef2cbda9d4b7407c44f2490
BLAKE2b-256 8b77f2cdc5d70ecc31d9928d23997fa8e11d33dcb4f5e42c3df7d99f80a62b95

See more details on using hashes here.

Provenance

The following attestation bundles were made for pretorin-0.8.2-py3-none-any.whl:

Publisher: publish.yml on pretorin-ai/pretorin-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page