CLI reference
The brain ships a CLI: z4j-brain. Runs inside the container or from a local pip install.
z4j-brain --helpServing
Section titled “Serving”z4j-brain serve [--host 0.0.0.0] [--port 7700] [--workers 1]Starts the FastAPI application via Uvicorn. This is the container entrypoint.
Health
Section titled “Health”z4j-brain checkValidates config + DB connectivity and confirms Alembic is at head. Non-destructive. Exit 0 = healthy.
status
Section titled “status”z4j-brain statusPrints a summary of current brain state: version, Alembic head, environment, database URL, and row counts (users, projects, agents, tasks, active sessions, audit rows).
version
Section titled “version”z4j-brain versionPrints the installed z4j-brain version.
User management
Section titled “User management”createsuperuser
Section titled “createsuperuser”Creates an admin user (Django-style alias for bootstrap-admin). First-boot only - call this once right after pip install z4j or the first container start. Use --password-stdin to pipe the password in from a secret manager.
bootstrap-admin
Section titled “bootstrap-admin”Creates the initial admin user and the default project. First-boot only. createsuperuser is the same command under a Django-friendly name.
changepassword
Section titled “changepassword”Changes a user’s password. Intended for admin recovery / CLI-only ops when the user can’t reach the dashboard reset flow.
Destructive operations
Section titled “Destructive operations”reset-setup
Section titled “reset-setup”z4j-brain reset-setupWipes pending first-boot tokens and recent setup audit rows. Refuses if an admin user already exists - use reset for a full wipe.
z4j-brain reset # refuses without --forcez4j-brain reset --forceWipes every runtime table (users, sessions, projects, agents, tasks, events, schedules, audit, …). Schema stays; Alembic does not re-run. Leaves the brain in a pre-first-boot state.
Migrations
Section titled “Migrations”migrate
Section titled “migrate”z4j-brain migrate upgrade headz4j-brain migrate currentz4j-brain migrate historyRuns an Alembic command against the brain database.
Audit log
Section titled “Audit log”audit verify
Section titled “audit verify”z4j-brain audit verifyWalks the full HMAC-chained audit log. Exits 0 on success, 1 on broken chain.
Global flags
Section titled “Global flags”| Flag | Description |
|---|---|
-h, --help | Show help for the command |
Per-command flags surface with z4j-brain <command> --help.