Skip to content

Configuration ​

Codeg is configured in two places. The desktop app and the web UI expose almost everything through the Settings screens — appearance, agents, version control, web service, and more. Everything outside the UI — how the standalone codeg-server binds and authenticates, where data lives on disk, and a handful of advanced runtime knobs — is controlled by environment variables, and that's what this page documents.

Using the desktop app?

You probably don't need this page. Configure Codeg from Settings instead — see the Reference section. Reach for environment variables when you run codeg-server, or when you need to tune something the UI doesn't expose.

How it works ​

codeg-server reads its configuration from environment variables — set them however you launch it: inline in a shell, in a systemd unit, in your Docker Compose environment: block, or with docker run -e. There is no configuration file; the server's only persistent state is its SQLite database (plus, on the desktop, one small preferences file).

Two conventions apply throughout:

  • An empty or whitespace value counts as unset — the default applies.
  • Numeric knobs treat 0 or an unparseable value as "use the default," except where 0 explicitly means disable (called out below).

Core settings ​

The variables you're most likely to set on a server:

VariableDefaultDescription
CODEG_PORT3080HTTP and WebSocket listen port.
CODEG_HOST0.0.0.0Bind address — an IP, localhost, or a bracketed IPv6 literal. 0.0.0.0 exposes it on every interface.
CODEG_TOKEN(random)Access token for API and WebSocket requests. With CODEG_AUTH=proxy-jwt, a verified proxy assertion also works. The exceptions carry proof of their own — a single-use download link, an Office live preview's per-document capability, a forge's signed webhook delivery — or give nothing away: the web app's own files, and the login page's language lookup. If unset, one is generated, saved to the database, and printed to stderr at startup.
CODEG_AUTHtokenproxy-jwt also admits a browser that an identity-aware proxy has signed in, by checking the proxy's signed assertion, so the browser needs no token. Needs four CODEG_PROXY_AUTH_* settings. → Sign in through an identity-aware proxy
CODEG_DATA_DIR(per-OS — see below)Root for the database, uploads, logs, and secrets.
CODEG_STATIC_DIR./webDirectory of the bundled web UI to serve.
CODEG_MCP_BIN(auto)Path to the codeg-mcp companion when it doesn't sit beside the server binary — needed for some source builds. Without it, multi-agent delegation is silently disabled.
CODEG_BRIDGE_PORTS(CODEG_PORT+1 … +10)Ports the port bridge binds, one per dev server shown in the workbench: a range (3081-3090), a comma list, auto (any free port), or off. A value that doesn't parse turns the bridge off rather than guessing.
CODEG_BRIDGE_PUBLIC_HOST(unset)Hostname the workbench should use for the bridge ports instead of the one it was loaded from — for a reverse proxy that names them differently.
CODEG_BRIDGE_HOST_PATTERN(unset)Reach dev servers by hostname on Codeg's own port instead of binding a port range: auto (the port in front of the workbench's host — 3000.codeg.example.com) or a template with {port} in it once, such as {port}.preview.example.com. Needs a wildcard DNS record, and a wildcard virtual host on any proxy in front. A value that doesn't parse turns the bridge off. → By hostname
CODEG_BROWSER_TUNNELallWhat a desktop app attached to this server as a remote workspace may reach through its built-in browser: all, private (loopback, private and link-local addresses), or off, in any case. Unset or blank means all; any other value turns it off.
CODEG_HARNESS(on)off, 0, false or no, in any case, switches off the SRN Harness catalog for a deployment that shouldn't reach the internet: the Discover section disappears, installing or updating from the catalog is refused, and the daily update check doesn't run, so nothing goes to the catalog at all. The MCP, Skills, Plugins and Skill Packs sections keep working on what's installed. Anything else, a typo included, leaves it on. Read by the desktop app as well as the server.
CODEG_PUBLIC_URL, CODEG_SRN_CLIENT_ID, CODEG_SRN_CLIENT_SECRET_FILE(unset)Together, turn on signing in with an SRN account in a browser. → SRN sign-in in a browser
CODEG_COMPUTER_USE(off)1, true, yes or on offers computer use on the server machine's own desktop, through the codeg-computer-helper installed beside the server. On Linux it warns when there's no DISPLAY or WAYLAND_DISPLAY. The desktop app doesn't read it.

See Deployment for the networking and TLS implications of CODEG_HOST and CODEG_TOKEN.

Sign in through an identity-aware proxy ​

Since 0.39.0, when codeg-server sits behind a proxy that already signs people in, such as Cloudflare Access, the token is a second login on top of the proxy's. With CODEG_AUTH=proxy-jwt the server also admits a request that carries the proxy's signed assertion (a JWT), so the browser needs no token. The token keeps working in this mode, for clients that do not pass through the proxy, such as codeg-cli --url and scripts.

VariableValue
CODEG_AUTHproxy-jwt turns the mode on. Unset or token: token only.
CODEG_PROXY_AUTH_HEADERThe request header that holds the assertion.
CODEG_PROXY_AUTH_JWKS_URLWhere the proxy publishes its signing keys. https, or plain http for a loopback host only.
CODEG_PROXY_AUTH_ISSUERThe exact iss the assertion must carry.
CODEG_PROXY_AUTH_AUDIENCEA value the assertion's aud must hold.

The header alone admits nothing, since anything that can reach the port can set a header. The server checks the assertion's signature against the proxy's published keys, and checks its issuer, audience and expiry. Everything fails closed:

  • A missing setting, a misspelled mode, or a proxy setting without CODEG_AUTH=proxy-jwt stops the server at startup with exit code 2, naming the variable.
  • An assertion that is missing, malformed, expired, for another audience or issuer, signed with an unknown key, or signed with anything other than RS256 or ES256 gets a 401. So does every request without the token while no keys could be fetched. The server logs the reason, never the assertion.
  • A valid assertion on a request that a page on another origin sent gets a 403. See Requests from other origins.

Keys are fetched at startup and kept for an hour. They are fetched again early when an assertion names a key the server has not seen, at most once every 30 seconds. If a fetch fails, the keys already held stay in use. exp and nbf allow 60 seconds of clock skew.

Cloudflare Access ​

Replace <team> with your Zero Trust team name and <AUD tag> with the Application Audience (AUD) Tag from the application's overview page, then run this in a POSIX shell from the server installation directory:

bash
export CODEG_HOST=127.0.0.1
export CODEG_AUTH=proxy-jwt
export CODEG_PROXY_AUTH_HEADER=Cf-Access-Jwt-Assertion
export CODEG_PROXY_AUTH_JWKS_URL='https://<team>.cloudflareaccess.com/cdn-cgi/access/certs'
export CODEG_PROXY_AUTH_ISSUER='https://<team>.cloudflareaccess.com'
export CODEG_PROXY_AUTH_AUDIENCE='<AUD tag>'
./codeg-server --supervise

Bind the server to loopback (CODEG_HOST=127.0.0.1) and reach it only through the tunnel, so that every browser request passes Access. Opened that way, the web app skips the token prompt. When the Access session expires, the app shows Sign-in expired with Reload. Reloading lets Access run its login again.

Who gets in ​

Codeg does not pick users in this mode. It admits every request the proxy vouches for with a valid assertion for this application, including a service token that the application's policy allows. That makes the proxy's policy the user list. Keep it to the people who should use this server, such as your own address or one group, and never Everyone. The audience check ties an assertion to this one application, so a sign-in to another application behind the same proxy does not get in.

Requests from other origins ​

The assertion travels with the proxy's session cookie, which a browser may also attach to requests initiated by other pages. For a request authenticated by an assertion, the server first checks Sec-Fetch-Site: when present, only same-origin and none are accepted. If that header is absent and Origin is present, the origin's host and port must match Host or a proxy's X-Forwarded-Host; a mismatch or invalid origin gets a 403. A request carrying a valid Codeg token uses token authentication instead and does not go through this assertion check.

Chrome sends no Sec-Fetch-Site on a WebSocket handshake, so for the event socket the Origin decides. A proxy in front of Codeg must therefore pass the browser's Host on, or put it in X-Forwarded-Host. Cloudflare Tunnel does: it keeps the Host, and when httpHostHeader is set it moves the original to X-Forwarded-Host. Otherwise the socket is refused, and the server's warning names the Origin and the hosts it saw.

SameSite does not cover sibling subdomains

Setting the Access application's cookie to SameSite=Lax keeps it off requests from unrelated sites, apart from top-level navigations such as a link into Codeg. But SameSite is decided per site, meaning the scheme and the registrable domain, not per origin. A page on another subdomain of the same domain, such as another app at wiki.example.com next to Codeg at codeg.example.com, is the same site, so its requests carry the cookie even under Lax or Strict. The server-side check above is what refuses those, so keep it in mind before you serve other apps under the same domain.

This mode applies to the standalone codeg-server. The desktop app's web service stays token-only.

SRN sign-in in a browser ​

Since 0.46.0 the status bar's account menu can sign in with an SRN, the SpaceRing account. On the desktop that works out of the box. In a browser it stays off until the instance is registered with SpaceRing and given three settings, because the server runs the sign-in on the browser's behalf and needs a client of its own to do it.

An SRN sign-in says which SRN user a browser is. It doesn't let anyone into the server: a browser still needs the token, or the proxy sign-in, to use the workspace, and the workspace stays one, shared by everyone who has access. Each browser's SRN identity is its own, and none of them touches the desktop app's account.

1. Register the instance ​

Every Codeg Web instance needs its own SpaceRing client, and SpaceRing's operators create it. Ask them, giving your SRN and the address of your instance. You get back a client ID, codeg-web-…, and a client-secret file readable only by its owner. Keep that file out of images, backups, logs, command lines and anywhere an agent can read.

The address has rules. Codeg checks its shape at startup — not the certificate, and not that the host name is the instance's alone, which the registration has to ensure:

  • https://, with a certificate browsers trust. Plain http:// is never accepted, so local development needs a locally trusted certificate on a host name (mkcert, for instance) or a tunnel that provides one.
  • A full host name of its own — one with a dot in it, not an IP address — and one Codeg instance per host name. Sharing a host name across ports or paths isn't supported.
  • The root path on the standard port: no port other than 443, no path, query or fragment, no user name or password.

A private host name is fine as long as the browsers can reach it: SpaceRing never connects to your instance.

2. Set three variables ​

VariableValue
CODEG_PUBLIC_URLThe registered address, such as https://codeg.example.com. A browser's Origin must equal it, and the address SpaceRing returns the browser to, <it>/auth/srn/callback, is built from it alone — never from Host or X-Forwarded-*.
CODEG_SRN_CLIENT_IDThe client ID, codeg-web- followed by 16–128 letters, digits, _ or -. Never the desktop app's client.
CODEG_SRN_CLIENT_SECRET_FILEThe path of the client-secret file. The secret is read from the file; it's never accepted as a variable or an argument.
bash
export CODEG_PUBLIC_URL=https://codeg.example.com
export CODEG_SRN_CLIENT_ID=codeg-web-REPLACE_WITH_YOUR_ID
export CODEG_SRN_CLIENT_SECRET_FILE=/run/secrets/codeg-srn-client-secret

Set them in the environment codeg-server starts in — exported in its shell, as here, or in its service unit or container environment.

They're read once, at startup, and all three have to be present and well-formed: the address's shape, the client ID's format, and a readable secret file in the right format. Getting one wrong never stops the server and never changes who can reach it: it only leaves SRN sign-in off, and the log says why, once. Look for:

  • [srn-web] SRN sign-in is on for https://codeg.example.com — the settings passed those checks. Whether SpaceRing accepts the client ID and secret shows only at the first sign-in: a well-formed but wrong pair fails there.
  • [srn-web] SRN sign-in is off: not configured (…) — none of the three is set.
  • [srn-web] SRN sign-in is off: <reason>. Instance access is not affected. — something is set but wrong, and the reason names it.
  • A warning that the secret file is readable by other accounts — restrict it with chmod 600.

Codeg removes all three from the environment of every agent, terminal and MCP server it starts.

The desktop app's Web Service reads the same three variables, from the desktop app's environment, when the service first starts. It needs a registration of its own, with its own host name, and it leaves the desktop app's own SRN sign-in alone.

3. Let the callback through ​

SpaceRing sends the browser back to https://<your host>/auth/srn/callback with a one-time code in the query. Codeg answers that one address without the access token — a browser returning from another site carries none — and only completes a sign-in that a signed-in page in the same browser started.

  • Pass /auth/srn/callback through to Codeg unchanged. A proxy that demands its own login there can lose the query; the person then has to start the sign-in again.
  • Don't log that address's query string, only its path. The code is single-use and expires within a minute, but it doesn't belong in an access log.

What the server keeps ​

  • In codeg.db: sign-ins under way, for ten minutes, and the signed-in browsers. Cookies and sign-in states are kept only as SHA-256 hashes, and the SRN tokens encrypted (AES-256-GCM); the SRN number, display name and avatar path are kept in clear. All of it is included in Codeg's backup.
  • The encryption key: srn-web.key in the data directory on codeg-server, created on first use and readable only by its owner; on the desktop's Web Service, a keychain entry, srn-web-key. The key is not in the backup, so a backup restored on another machine signs those browsers out, and they sign in again. On codeg-server, a snapshot of the whole data volume holds both; the desktop's key stays in the keychain.
  • Sessions end after 30 days without use, as SpaceRing's connection does; an hourly job removes the expired ones and tries to end their connections on SpaceRing. Sessions survive restarts and upgrades. One server process per data directory is supported.

This is not a separation between users

The server holds each signed-in browser's SRN token, with read-only access to the profile, on that browser's behalf. Whoever operates the instance, or can run code on it — agents included — can reach those tokens. SpaceRing's authorization page names the instance a person is connecting. → Privacy & Security

Where Codeg stores its data ​

Before an update that changes the database, stop Codeg and copy this entire directory. See Upgrade Codeg for the backup and downgrade steps.

Unless you set CODEG_DATA_DIR, codeg-server keeps its data in the platform data directory:

PlatformDefault data directory
macOS~/Library/Application Support/codeg
Linux~/.local/share/codeg
Windows%APPDATA%\codeg

The desktop app stores the same kind of data in the same place, under an app.codeg folder. Inside the data directory you'll find:

  • codeg.db — the SQLite database: sessions, settings, channels, automations — effectively all of Codeg's state.
  • uploads/ — files uploaded as attachments in a browser or a remote-workspace window.
  • pets/ — desktop-pet assets.
  • logs/ — rotating daily log files (see Logging).
  • acp-transcripts/ — the history Codeg records itself, for custom agents and for ZCode, TRAE CLI and Command Code, one folder per agent.
  • mcp/ — Codeg's own record of the MCP servers it hands ZCode and MiniMax Code.
  • cache/harness/ — since 0.46.0, what the SRN Harness catalog sent, kept for display and for the update check. Not in the backup.
  • personal-agent/ and personal-agent-bots/ — since 0.49.0, the working directories of your personal assistants: persona, rules and memory, under git — the primary assistant's first, one folder per work assistant in the second, unless you moved one.
  • srn-web.key — on codeg-server with SRN sign-in in a browser set up, created on first use: the key the stored sign-ins are encrypted with. Not in the backup.
  • cli/ — private endpoint files for command-line access, created by each running instance; these are discovery credentials, not configuration files to edit.
  • tokens.json — the server's encrypted secret store (git credentials and the like). On the desktop these live in your OS keyring instead, so this file is server-only.

To back up or migrate a deployment, copy this directory. (The in-app backup feature exports the same state as a portable .codegbak archive.)

Skills live outside the data directory

Installed skills are kept under ~/.codeg/skills/, which follows CODEG_HOME (default ~/.codeg), not CODEG_DATA_DIR. If you relocate the data directory on a server, set CODEG_HOME too if you want skills to move with it. CODEG_HOME also takes precedence over CODEG_DATA_DIR for uploads/, pets/, logs/, acp-transcripts/ and mcp/ when both are set.

Since 0.46.0 a few files of the Harness Engineering page follow neither: the installed plugins under ~/.codeg/plugins/, the install records under ~/.codeg/harness/, and the backups of agents' MCP configs under ~/.codeg/mcp/backups/ always use the .codeg folder in the home directory of the account Codeg runs as.

Command-line environment ​

Since 0.38.0, codeg-cli can use environment variables to select a running Codeg. These configure the client, alongside its command-line options:

VariablePurpose
CODEG_URLHTTP(S) Codeg endpoint, used with CODEG_TOKEN.
CODEG_TOKENThe server's access token; also the fallback token for --url when no token option is supplied.
CODEG_DATA_DIRDiscover a local Codeg using this data directory.
CODEG_CLI_ENDPOINT_FILEA specific instance's discovery file. Set by Codeg in its own terminals and agent processes.
CODEG_CLIFull path to the CLI supplied by Codeg in those processes. Invoke "$CODEG_CLI" if your shell has changed PATH.

Selection order is --url → --data-dir → CODEG_CLI_ENDPOINT_FILE → CODEG_URL → CODEG_DATA_DIR → default directories. An explicit target that fails is not replaced by another instance. --standalone starts a temporary server only when requested. See runtime selection and the Command-line access setting.

Storage limits ​

By default the total size of uploads is limited only by your disk. To bound it:

VariableDefaultDescription
CODEG_UPLOAD_MAX_TOTAL_BYTES(no cap)Hard ceiling, in bytes, on everything under uploads/ — e.g. 10737418240 for 10 GiB. Unset, 0, or an invalid value disables the cap.
CODEG_UPLOAD_QUOTA_STRICT(off)When truthy (1 / true / yes / on), refuse to start (exit code 2) if the quota above is set but unparseable, instead of falling back to "no cap" with a warning. Use it when policy requires a configured quota to actually take effect.
CODEG_BACKUP_UPLOAD_MAX_BYTES(no cap)Largest backup archive the restore endpoint will accept.

Each file you upload as an attachment in a browser or a remote-workspace window is also capped at 20 MiB — a fixed limit, not configurable. A larger file is skipped with a message naming it, and the others still attach. A file that's already on the server, such as one you choose with Pick server file, is attached by its path on the server, so the cap doesn't apply to it. Before 0.22.0 the cap was 2 MiB.

Logging ​

Codeg writes rotating daily logs to logs/ in the data directory and mirrors them to the in-app viewer.

VariableDefaultDescription
CODEG_LOG(saved level)A tracing filter directive — info, debug, or targeted like codeg=debug,tower_http=warn. Takes precedence over RUST_LOG, and while it's set it locks the level picker in the UI.
RUST_LOG(unset)The standard Rust log filter. Used only when CODEG_LOG is empty.
CODEG_LOG_MAX_FILES30Number of rotated daily log files to retain.
CODEG_LOG_MAX_BYTES536870912Ceiling on a single day's log file (512 MB). Past it the file latches off for the day and the cut-off is reported in the Logs viewer. 0 disables the cap.

For day-to-day use you can change the level from the UI instead — see Settings → Logs.

Proxy support ​

At startup Codeg snapshots the standard HTTP_PROXY, HTTPS_PROXY, and ALL_PROXY variables (and their lowercase forms) and propagates them to every agent process it launches. One proxy setting therefore covers Codeg and the agents it drives — the intended path for corporate gateways. Since 0.32.2 every agent launched with a proxy also gets the local addresses — localhost, 127.0.0.1, ::1 — added to its NO_PROXY, so an agent's connections to its own local services never travel to a proxy on another machine; the Bypass proxy for list in Settings → System adds addresses of your own. A * in that list, or in a NO_PROXY you export, is passed on alone as bypass everything — which Antigravity no longer fully honours from 1.3.0 on; the same page explains why. See Privacy & Security for how Codeg handles network access.

Advanced tuning ​

You'll rarely touch these — the defaults are chosen to be right for almost everyone. They govern how long idle agent connections and preview servers linger before being reaped:

VariableDefaultDescription
CODEG_ACP_IDLE_TIMEOUT_SECS180Reap an agent connection after this many seconds idle. 0 disables the sweep.
CODEG_ACP_SPAWN_HANDSHAKE_TIMEOUT_SECS60How long to wait for an agent to launch and finish its handshake before giving up.
CODEG_ACP_BACKGROUND_KEEPALIVE_MAX_SECS3600How long a connection with unfinished background work stays exempt from the idle sweep — and, since 0.45.0, the longest a to-do or automation run waits before it settles: for native background work from Claude Code or Grok, and since 0.48.0 the native Antigravity CLI — other agents' own background work, such as Codex's background terminals, doesn't hold a run — or for an unanswered permission request or a Codeg delegation still running, with any agent. 0 disables both: the exemption, and the wait, so runs settle when the agent's turn ends.
CODEG_OFFICE_WATCH_IDLE_TIMEOUT_SECS300Reap an idle Office live-preview server after this many seconds. 0 disables.
CODEG_ACP_HOST_TOOLS(unset)Set to agent and Codeg stops serving file access and terminal commands, so the agent runs them itself, under its own sandbox — and loses the delegation tools with them. There's a per-agent switch for this beside each agent's environment editor; setting the variable on Codeg's own process makes it the default for agents that don't set it themselves. → Working with Agents

Remote-workspace sync exposes a further set of concurrency knobs (CODEG_WORKSPACE_UPLOAD_MAX_CONCURRENCY and friends); their defaults are sensible and rarely need changing.

Update supervision ​

When you run the server under --supervise (see Deployment), two knobs shape the in-place-upgrade safety net:

VariableDefaultDescription
CODEG_UPGRADE_TRIAL_SECS30The window a freshly upgraded server has to boot successfully before it's automatically rolled back.
CODEG_RESTART_DELAY_MS2000Pause before the supervisor relaunches the server after an upgrade (minimum 200).

The supervisor sets CODEG_SUPERVISED, and the Docker image sets CODEG_RUNTIME=docker, automatically — these are managed for you, not something you set by hand.

Desktop preferences ​

The desktop app keeps its settings in the database, managed from the Settings screens — with one exception. ~/.codeg/preferences.json is read before the app window starts and holds a single field:

json
{ "disable_hardware_acceleration": false }

It mirrors a toggle in the app's settings. Edit it by hand only to recover from a GPU or driver problem that stops the window from rendering — set it to true, relaunch, and Codeg starts without hardware acceleration. codeg-server never reads this file.

Two environment variables reach the built-in browser on the desktop, both read once at startup:

VariableDefaultWhat it does
CODEG_POLICY_FILE(per-OS — see Site rules)Path to the administrator policy that can fix per-site rules or turn the built-in browser off for every user of the machine.
CODEG_BROWSER_SIGN_IN_HOSTS(Google's sign-in hosts)Comma-separated hostnames — subdomains count — whose sign-in pages a tab should present a Firefox identity to, for a provider that refuses embedded browsers the way Google does.

Your agents' own settings ​

Codeg finds each agent's existing sessions through that agent's own environment variable — CLAUDE_CONFIG_DIR, CODEX_HOME, GEMINI_CLI_HOME, and so on. If you've pointed an agent CLI at a non-default location, Codeg follows it automatically — whether the variable is set in Codeg's own environment or, since 0.35.2, in that agent's Environment Variables under Settings → Agents, which wins. The full mapping is in Supported Agents.

Next steps ​

  • Deployment — launch, supervise, and update codeg-server.
  • Supported Agents — where each agent keeps its sessions, and the variables Codeg honors.
  • Settings → Logs — change log levels and inspect runtime logs from the UI.

Released under the Apache-2.0 License.