Headless & CLI

Egg ships two command-line binaries. egg launches the browser (with or without a window) and runs short headless tasks like screenshots, PDF rendering, and data exports. egg-daemon manages the persistent gateway service: start, stop, inspect status, pin a port for development.

Headless mode runs the full browser engine without showing a window. You get the same rendering, cookies, sessions, extensions, and privacy posture an interactive Egg session has, just without the UI. That makes it useful for scripted automation: capture a full-page screenshot from a CI job, render a styled invoice to PDF, dump the rendered DOM after JavaScript runs, or pull a reader-mode extraction of an article. Each task flag implies --headless and exits when the task finishes, so the binary works as a one-shot in shell pipelines.

Both binaries accept Chrome-style flags, and unrecognized --* flags forward to the underlying engine. Most existing Chromium tooling and command-line patterns work without changes; the differences are documented inline.

egg

Open a URL, run a headless task, or export data.

# Open a URL (positional or --url=)
egg https://eggbrowser.com/
egg --url=https://eggbrowser.com/

# Open as a chromeless app window
egg --app=https://eggbrowser.com/

# Help / version
egg --help
egg --version

General

FlagDescription
-h, --helpShow help and exit.
-V, --versionShow version and exit.
--url=<url>Initial URL. Equivalent to a positional argument; explicit form wins on conflict.
--no-restoreSkip tab restoration on this launch.
--new-windowChrome-compat. No-op; every launch is a new window.
--restore-last-sessionChrome-compat. No-op; restoration is the default.

Window

FlagDescription
--start-maximizedStart maximized.
--start-fullscreenStart fullscreen. Overrides --start-maximized.
--window-size=WxHInitial logical window size, e.g. 1920x1080. Sets the hidden-window size in headless mode.
--window-position=X,YInitial window position in screen pixels.
--app=<url>Open as a chromeless window pointed at <url>. No tab strip or sidebar. Mutually exclusive with --headless.

Privacy & sessions

FlagDescription
--incognito, --inprivate, --guestFirst tab opens in incognito. Aliases for Chrome / Edge compat.
--user-data-dir=<path>Override the engine’s data directory (WebView2 on Windows, WKWebView on macOS) for browser-side state: cookies, web storage, HTTP cache. Applies to default-profile tabs only; named profiles and incognito tabs use their own data stores. Does not redirect Egg’s own database or settings. Chrome-compatible.
--profile-directory=<name>Sub-profile within --user-data-dir. Without --user-data-dir, maps to one of Egg’s named profiles by id.
--user-agent=<string>Override the per-tab user agent.

Headless tasks

Each task flag implies --headless. Default timeout is 30000 ms; exit code 124 on timeout.

FlagDescription
--headlessBoot with the main window hidden.
--screenshot=<path>Capture full-page PNG to <path> after the URL loads.
--print-to-pdf=<path>Render the page to PDF.
--dump-domPrint rendered document.documentElement.outerHTML to stdout.
--extract-pageReader-mode extraction; main article text to stdout.
--export-bookmarks=<path>Dump bookmarks. JSON by default; CSV based on extension.
--export-history=<path>Dump browsing history. JSON or CSV.
--export-passwords=<path>Dump decrypted passwords. Master password from EGG_VAULT_PASSWORD, never from a flag.
--timeout=<ms>Maximum wait for the task. Default 30000.

Automation

FlagDescription
--remote-debugging-port=<n>Forwarded to WebView2. Exposes the underlying Chromium DevTools server on <n>. Attach Playwright, Puppeteer, or any CDP client.

Advanced

FlagDescription
--strict-flagsReject unknown --* flags (exit 2) instead of forwarding to Chromium.

Recipes

# Full-page screenshot
egg --screenshot=out.png https://eggbrowser.com/

# PDF render with a custom viewport
egg --print-to-pdf=invoice.pdf --window-size=1280x1600 https://invoices.example.com/

# Pipe rendered HTML into another tool
egg --dump-dom https://news.ycombinator.com/ | htmlq '.athing'

# Reader-mode extraction
egg --extract-page https://en.wikipedia.org/wiki/Browser

# Export data
egg --export-bookmarks=bookmarks.json
egg --export-history=history.csv
EGG_VAULT_PASSWORD="..." egg --export-passwords=secrets.csv

# Open as a focused PWA window
egg --app=https://app.example.com/ --window-size=1100x800

# Attach a CDP client
egg --remote-debugging-port=9222 https://example.com/
curl http://127.0.0.1:9222/json/version

Chromium passthrough

Unknown --* flags forward to the underlying engine via WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS. Pass --strict-flags to reject unknowns instead.

# Forwarded to Chromium
egg --proxy-server=socks5://127.0.0.1:1080 https://example.com/
egg --lang=en-US --disable-features=Translate

# Strict mode rejects unknowns
egg --strict-flags --bogus-flag
# → exit 2: unknown flag --bogus-flag

egg-daemon

The persistent gateway service. The browser auto-launches it; you can also run it directly to inspect state, terminate it, or pin port + token for development.

# Boot in foreground (logs to stdout)
egg-daemon

# JSON status of the running instance
egg-daemon --status

# Terminate the running daemon
egg-daemon --kill

# Pin port + token
egg-daemon --port=19999 --token=devtoken

Lifecycle

FlagDescription
-h, --helpShow help and exit.
-V, --versionShow version and exit.
--port=<n>Bind the API server to this port. Default: random.
--token=<t>Bearer token for the API. Default: random UUID per start.
--info-file=<path>Write the discovery file (daemon_info.json) to a custom path.
--no-info-fileDon’t write a discovery file. Useful for sandboxes and tests.
--foregroundDon’t detach. Currently the default; the flag exists for service-supervisor scripts.

Status & control

FlagDescription
--statusRead the discovery file, probe the PID, print JSON status, exit. Exit 0 if running, 1 otherwise.
--killRead the discovery file, terminate the running daemon, exit.