CLI reference
The brain ships a CLI: z4j-brain. Runs inside the container or from a local install.
Commands
Section titled “Commands”z4j-brain serve [--host 0.0.0.0] [--port 7700] [--workers 1]Starts the FastAPI application via Uvicorn. This is the container entrypoint.
migrate
Section titled “migrate”z4j-brain migrate [--status]Run pending Alembic migrations. --status shows current and pending revisions without applying.
audit verify
Section titled “audit verify”z4j-brain audit verifyWalks the full audit chain; exits 0 on success, 1 on broken chain.
audit export
Section titled “audit export”z4j-brain audit export --format csv --from 2026-01-01 --to 2026-04-01 > audit.csvz4j-brain audit export --older-than 1y --deleteExports audit rows. --delete removes exported rows (writes a final audit entry first).
smtp-test
Section titled “smtp-test”z4j-brain smtp-test --to admin@example.comSends a test email via the configured SMTP. Reports success/error.
password-reset
Section titled “password-reset”z4j-brain password-reset --email admin@example.comPrints a one-shot reset URL (bypasses SMTP). Requires direct brain access.
token mint
Section titled “token mint”z4j-brain token mint --project default --name web-01CLI equivalent of dashboard Mint token. Prints the token once.
token revoke
Section titled “token revoke”z4j-brain token revoke --agent-id <uuid>Immediately revokes the agent’s token.
version
Section titled “version”z4j-brain versionPrints version, commit, Python version, DB driver.
Global flags
Section titled “Global flags”| Flag | Description |
|---|---|
--db-url | Override Z4J_DATABASE_URL |
--log-level | debug / info (default) / warning / error |
--json-logs | Force JSON log format (default in containers) |