Skip to content

CLI reference

The brain ships a CLI: z4j-brain. Runs inside the container or from a local install.

Terminal window
z4j-brain serve [--host 0.0.0.0] [--port 7700] [--workers 1]

Starts the FastAPI application via Uvicorn. This is the container entrypoint.

Terminal window
z4j-brain migrate [--status]

Run pending Alembic migrations. --status shows current and pending revisions without applying.

Terminal window
z4j-brain audit verify

Walks the full audit chain; exits 0 on success, 1 on broken chain.

Terminal window
z4j-brain audit export --format csv --from 2026-01-01 --to 2026-04-01 > audit.csv
z4j-brain audit export --older-than 1y --delete

Exports audit rows. --delete removes exported rows (writes a final audit entry first).

Terminal window
z4j-brain smtp-test --to admin@example.com

Sends a test email via the configured SMTP. Reports success/error.

Terminal window
z4j-brain password-reset --email admin@example.com

Prints a one-shot reset URL (bypasses SMTP). Requires direct brain access.

Terminal window
z4j-brain token mint --project default --name web-01

CLI equivalent of dashboard Mint token. Prints the token once.

Terminal window
z4j-brain token revoke --agent-id <uuid>

Immediately revokes the agent’s token.

Terminal window
z4j-brain version

Prints version, commit, Python version, DB driver.

FlagDescription
--db-urlOverride Z4J_DATABASE_URL
--log-leveldebug / info (default) / warning / error
--json-logsForce JSON log format (default in containers)