Run a prompt from the command line

The interface answers on its own and the final answer goes to standard output.

1. How it works

zerochat --prompt "TEXT" (or python3 zerochat.py --prompt "TEXT") starts the local server and, by default, opens the interface without a window in Playwright's Chromium using the local profile stored on the server (or the one you pass with --profile). When it finishes, it returns the answer and the process exits.

With --conversation ID you can continue a conversation already stored on the local server (either adding a new --prompt or resuming its last pending message), or turn on the Run on server switch in the chat header so turns run in the background even if you close the tab.

zerochat --prompt "Summarize today's changes in this repository" > summary.txt

2. Options

OptionEffect
--conversation IDContinues the conversation with that ID stored on the local server (see --list-conversations). Can be combined with --prompt TEXT to append a new user turn or used on its own to resume the last pending message or answer.
--profile NAMEUses that profile (name or id) for this run only, without changing the saved active profile. If omitted, uses the conversation's original profile (if present) or the server's local profile; if it does not exist, the run ends with an error.
--browserOpens the user's default browser in visible mode instead of Playwright's windowless Chromium.
--headlessWith --browser, opens the user's default browser without a window. See section 5.
--export FILESaves the conversation to FILE; the format comes from the extension: .md (Markdown), .json (session) or .html (as shown in the chat). It is also exported after a generation error.
--keep-pageWith --browser (without --headless), does not close the page when it finishes, so you can see the conversation. The process exits anyway and the page is left disconnected from the server.
--allow-dangerous-toolsAlso approves the tools that write or execute. See section 3.
--log on|offShows the startup banner and the server log on standard error. Defaults to off with --prompt.
--port PORTListening port; if it is in use, the run does not start. Without --port, if another open ZeroChat uses the default port, the run listens on a free port and coexists with it (in development, with --browser and the local interface, it does not start).

--prompt is not combined with --no-browser or --keep-server, because the run needs the browser and ends when it returns the result.

3. Tools, requests to the user and server runs

4. Time limits and exit codes

The run is cut off after 15 minutes, or after 3 minutes without progress from the interface (each step, tool or answer fragment counts as progress).

CodeMeaning
0Finished: the answer is on standard output (or the needs_input JSON if --conversation paused waiting for permission or a reply).
1Generation error, unknown profile, unavailable profile MCP service, request to the user, or a requested export that could not be written (in that last case the answer is still printed).
2Time limit reached, or the browser closed without returning a result.
3Startup failure: port in use or browser that could not be opened.
4Invalid arguments (also outside --prompt).

5. Windowless mode and user browser (--browser / --headless)

By default, --prompt runs without a window using the Chromium installed in Playwright's cache and the profiles stored on the local server (~/zerochat/storage/zerochat.db), without needing a graphical session or requiring your browser to be closed.

6. Scheduled jobs (cron)

MAILTO=user
0 7 * * * cd "$HOME/project" && PATH="$HOME/.local/bin:/usr/local/bin:/usr/bin:/bin" flock -n /tmp/zerochat-prompt.lock zerochat --prompt "Prepare the daily report" --export "$HOME/reports/daily.html"

7. What each run needs

Before scheduling a run, check that the machine has everything it uses: