Cortex · Set up

cortex

Usage: cortex [COMMAND] [OPTIONS]. No command means status. cortex-ctl and pi-ctl are executable aliases using exactly the same parser; their complete command paths are indexed below. Daemon aliases are cortexd / pi-durable-daemon; stdio MCP aliases are cortex-mcp / pi-durable-mcp.

Common daemon-client options (inherited by every online operator command below):

Option Meaning and default
--daemon-url <URL> Explicit daemon base URL. Otherwise PI_DURABLE_DAEMON_URL, then discovered daemon.json, then http://${PI_DURABLE_HOST}:${PI_DURABLE_PORT} (host 127.0.0.1, port 4319). Trailing slash removed. Discovery is skipped when explicit URL, URL environment or port environment is set.
--token <TOKEN> Bearer token; otherwise PI_DURABLE_API_TOKEN, otherwise none. Prefer environment injection to shell-history exposure.
--seat <ID> Target seat. Omitted uses the server's unscoped conversation endpoints/default seat.
--conv <ID> Conversation ID, default 1; only commands targeting a conversation use it.
--json Exact true enables JSON mode for status, doctor/preflight, local reports/facts. Most other commands already print JSON unconditionally.

The CLI loads .env in the current directory without replacing existing environment values. Discovery reads <PI_DURABLE_SESSION_DIR or ./.pi-durable-sessions>/daemon.json; missing/corrupt discovery state is ignored.

Parser syntax: --key value and --key=value; repeated keys overwrite earlier values. Boolean keys are wait, json, background, sync-twilio, allow-critical-path, verify, running; they accept a bare flag or explicit true/false. Other keys consume the next non--- token or become the string true. Unknown flags are not rejected and can consume what you intended as message text. There is no short-option parser, -- terminator, help command, --help handler or --version handler. Do not run cortex --help expecting a side-effect-free usage page: with no positional command it requests status. --sync-twilio is parsed as a boolean but not consumed by any operator operation.

Online commands return 0 on completion and 1 on caught validation/HTTP/transport errors. Local report/facts commands use the distinct 2/3 cases documented below; filesystem errors in these early branches can propagate outside the online catch. Numeric strings are converted with Number, not comprehensively validated locally. Server-side configuration/authorization validation still applies.