Reference
CLI reference
Every lokra command and flag, generated from the CLI itself.
Every command and flag, generated from lokra itself, so this page always matches the version it was built from. Run lokra <command> --help for the same text in your terminal.
Global options#
These go before the command, for example lokra --config ./policies.yaml check.
| Option | What it does |
|---|---|
--config |
path to policies.yaml (default: ./policies.yaml or $LOKRA_CONFIG) |
--home |
state directory (default: .lokra next to the config) |
-V, --version |
show program's version number and exit |
lokra init#
Introspect a database (read-only) and scaffold a starter policies.yaml.
lokra init [-h] [--out OUT] [--force] [--schemas SCHEMAS] dsn
| Argument | What it does |
|---|---|
dsn |
connection string to the target database, e.g. a Supabase or local Postgres |
--out |
where to write the policy (default: policies.yaml) |
--force |
overwrite the file if it already exists |
--schemas |
comma-separated schemas to include (default: public) |
lokra check#
Validate the policy against the database (read-only).
lokra check [-h] [--dsn DSN] [--strict]
| Argument | What it does |
|---|---|
--dsn |
connection string to check against (default: $LOKRA_ADMIN_DSN) |
--strict |
fail on warnings too, such as an unmasked sensitive column (for CI) |
lokra provision#
Create or update one DB role per agent.
lokra provision [-h] [--admin-dsn ADMIN_DSN]
| Argument | What it does |
|---|---|
--admin-dsn |
admin connection string (default: $LOKRA_ADMIN_DSN) |
lokra mint-token#
Issue a short-lived token for an agent.
lokra mint-token [-h] [--on-behalf-of ON_BEHALF_OF] [--ttl TTL]
[--purpose PURPOSE]
agent
| Argument | What it does |
|---|---|
agent |
|
--on-behalf-of |
the human launching the agent (default: your username) |
--ttl |
seconds, max 8 hours |
--purpose |
declared purpose-of-use, recorded on every request |
lokra try#
Run SQL as an agent from the terminal.
lokra try [-h] [--write] [--reason REASON] [--purpose PURPOSE]
agent sql
| Argument | What it does |
|---|---|
agent |
|
sql |
|
--write |
propose a write instead of a read |
--reason |
|
--purpose |
declared purpose-of-use for this request |
lokra pending#
List writes waiting for approval.
lokra pending [-h] [--all]
| Argument | What it does |
|---|---|
--all |
lokra approve#
Approve a proposed write.
lokra approve [-h] [--by BY] [--yes] write_id
| Argument | What it does |
|---|---|
write_id |
|
--by |
your name for the audit log |
--yes |
skip the confirmation prompt |
lokra deny#
Deny a proposed write.
lokra deny [-h] [--by BY] write_id
| Argument | What it does |
|---|---|
write_id |
|
--by |
your name for the audit log |
lokra verify-ledger#
Check the audit ledger has not been tampered with.
lokra verify-ledger [-h]
lokra log#
Show recent audit entries.
lokra log [-h] [-n N]
| Argument | What it does |
|---|---|
-n |
lokra report#
Activity and risk report from the audit ledger.
lokra report [-h] [--agent AGENT] [--json]
| Argument | What it does |
|---|---|
--agent |
limit to one agent |
--json |
lokra evidence#
Generate a control evidence pack from the policy and ledger.
lokra evidence [-h] [--out OUT] [--json]
| Argument | What it does |
|---|---|
--out |
write the Markdown pack to this file instead of stdout |
--json |
emit structured JSON instead of Markdown |
lokra dashboard#
Serve a local web dashboard of the ledger and policy.
lokra dashboard [-h] [--port PORT] [--admin-dsn ADMIN_DSN]
| Argument | What it does |
|---|---|
--port |
|
--admin-dsn |
admin connection string, needed to apply policy changes (default: $LOKRA_ADMIN_DSN) |
lokra cloud#
Connect this Lokra to Lokra Cloud (token in $LOKRA_CLOUD_TOKEN).
lokra cloud [-h] [--url URL] [--admin-dsn ADMIN_DSN] [--once]
| Argument | What it does |
|---|---|
--url |
Lokra Cloud address (default: $LOKRA_CLOUD_URL or https://cloud.lokra.dev) |
--admin-dsn |
admin connection string, so pauses from the Cloud also block the database login (default: $LOKRA_ADMIN_DSN) |
--once |
sync once and exit |
lokra connect#
Add an agent to Claude Code, Claude Desktop, Cursor, VS Code or Windsurf.
lokra connect [-h]
[--client {claude-code,claude-desktop,cursor,vscode,windsurf}]
[--name NAME] [--purpose PURPOSE] [--print] [--no-check]
[--force]
[agent]
| Argument | What it does |
|---|---|
agent |
agent from the policy (optional when there is only one) |
--client |
where to add it (default: claude-code, which writes .mcp.json in this folder) Choices: claude-code, claude-desktop, cursor, vscode, windsurf. |
--name |
server name in the client (default: lokra- |
--purpose |
declared purpose-of-use for the agent's session token |
--print |
print the config entry instead of writing it |
--no-check |
skip logging in as the agent to test it |
--force |
replace a server of the same name that is not Lokra |
lokra demo#
Watch Lokra handle two AI agents on a throwaway Postgres (needs Docker or --dsn).
lokra demo [-h] [--dsn DSN] [--keep]
| Argument | What it does |
|---|---|
--dsn |
use this Postgres instead of Docker; the demo needs to create roles, and removes everything it creates |
--keep |
leave the demo database in place afterwards |
lokra pause#
Stop an agent now: refuse its requests and block its database login.
lokra pause [-h] [--reason REASON] [--admin-dsn ADMIN_DSN] agent
| Argument | What it does |
|---|---|
agent |
|
--reason |
recorded in the ledger and shown to the agent |
--admin-dsn |
admin connection string (default: $LOKRA_ADMIN_DSN) |
lokra resume#
Let a paused agent run again.
lokra resume [-h] [--admin-dsn ADMIN_DSN] agent
| Argument | What it does |
|---|---|
agent |
|
--admin-dsn |
admin connection string (default: $LOKRA_ADMIN_DSN) |
lokra revoke-token#
Revoke one token, by the token itself or its id.
lokra revoke-token [-h] token
| Argument | What it does |
|---|---|
token |
lokra slack#
Post pending writes to Slack and take approvals there.
lokra slack [-h] [--admin-dsn ADMIN_DSN]
| Argument | What it does |
|---|---|
--admin-dsn |
admin connection string, so pausing from Slack also blocks the database login (default: $LOKRA_ADMIN_DSN) |
lokra serve#
Run the MCP server, over stdio (default) or HTTP.
lokra serve [-h] [--http] [--host HOST] [--port PORT]
[--dev-agent DEV_AGENT] [--on-behalf-of ON_BEHALF_OF]
[--purpose PURPOSE]
| Argument | What it does |
|---|---|
--http |
serve MCP over HTTP for agents on other machines; each request needs an Authorization: Bearer token |
--host |
HTTP bind address (default: 127.0.0.1) |
--port |
HTTP port (default: 8787) |
--dev-agent |
LOCAL DEV ONLY: issue an 8h token for this agent at startup if LOKRA_TOKEN is not set |
--on-behalf-of |
human recorded in the audit log (default: your username) |
--purpose |
declared purpose-of-use for the --dev-agent token |