Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/agent0ai/space-agent/llms.txt

Use this file to discover all available pages before exploring further.

Space Agent provides three commands for running the server: serve starts a direct Node process, supervise wraps it with a production-ready reverse-proxy that handles zero-downtime updates and crash restarts, and update pulls the latest source from the configured Git repository. For local development serve is enough; for long-running production source checkouts supervise is the recommended entry point.

serve

node space serve starts the local Node server that serves the browser app, page shells, /mod/... assets, and /api/... endpoints. It is a single command with no subcommands — all configuration is passed as PARAM=VALUE launch overrides or read from the project .env.

Usage

# Minimal — binds to 0.0.0.0:3000 by default
node space serve

# Override host and port
node space serve HOST=0.0.0.0 PORT=3000

# Let the OS assign a free port (useful for ephemeral runtimes)
node space serve PORT=0

# Clustered mode with 8 HTTP workers
node space serve WORKERS=8

# Single always-authenticated user, no login required
node space serve SINGLE_USER_APP=true

# Force the isomorphic Git backend
node space serve GIT_BACKEND=isomorphic

# Combine overrides freely
node space serve PORT=3100 WORKERS=4 ALLOW_GUEST_USERS=false

Parameter override syntax

Any parameter defined in commands/params.yaml can be overridden at launch using PARAM=VALUE positional arguments. The resolution order from highest to lowest priority is:
  1. Launch argumentsPARAM=VALUE passed directly to node space serve
  2. Stored .env values — written by node space set KEY=VALUE
  3. Process environment variables — inherited from the shell
  4. Schema defaults — defined in commands/params.yaml
Use node space set CUSTOMWARE_PATH=<path> before creating users or groups when writable state should live outside the source checkout. A launch-only CUSTOMWARE_PATH=<path> override affects only that serve process.

Clustered mode

Setting WORKERS greater than 1 starts a clustered HTTP worker pool. One authoritative primary process owns shared filesystem and auth state; the remaining workers handle HTTP requests in parallel.
node space serve WORKERS=8
Process titles are set so operator tools like htop can identify each role:
RoleProcess title
Single-processspace-serve
Clustered primaryspace-serve-p
Clustered worker Nspace-serve-w<N>

supervise

node space supervise runs Space Agent behind a production-ready reverse-proxy supervisor. It manages replaceable space serve child processes, stages source-checkout updates in separate release directories, and switches traffic to a replacement child only after a health check passes. It also restarts the active child on crash with bounded backoff. supervise requires CUSTOMWARE_PATH — a stable writable directory that persists across source-release swaps and is shared by all child processes.

Usage

# Minimal production start
node space supervise CUSTOMWARE_PATH=/srv/space/customware

# Explicit host and port
node space supervise HOST=0.0.0.0 PORT=3000 CUSTOMWARE_PATH=/srv/space/customware

# Clustered workers behind the supervisor
node space supervise WORKERS=8 CUSTOMWARE_PATH=/srv/space/customware

# Track a branch with a 5-minute update interval (default)
node space supervise --branch main --auto-update-interval 300 CUSTOMWARE_PATH=/srv/space/customware

# Crash-restart only — disable auto-update checks
node space supervise --auto-update-interval 0 CUSTOMWARE_PATH=/srv/space/customware

Supervisor flags

--branch
string
Git branch to watch for source updates. Defaults to the current or remembered checkout branch.
--remote-url
string
Git remote URL to watch for updates. Overrides GIT_URL, which otherwise overrides the local origin remote URL.
--state-dir
string
Supervisor state directory for release staging and auth key storage. Defaults to <projectRoot>/supervisor.
--auto-update-interval
number
Seconds between zero-downtime source update checks. Defaults to 300 (5 minutes). Set to 0 or any value ≤ 0 to disable update checks and keep crash-restart supervision only.
--startup-timeout
number
Seconds to wait for a replacement child to become healthy before discarding it. Defaults to 30.
--drain-idle
number
Seconds of no proxied traffic before an old child process is cut off during a handover. Defaults to 1.
--drain-timeout
number
Maximum seconds to keep an old child alive during drain regardless of traffic. Defaults to 30.
--restart-backoff
number
Initial crash-restart backoff in seconds. Defaults to 1 and caps at 30.

How it works

1

Supervisor binds the public port

The supervisor process binds to the configured public HOST and PORT and sets its OS process title to space-supervise. Child space serve processes always run on private loopback HOST=127.0.0.1 PORT=0.
2

First child starts

The supervisor launches a space serve child with the normalized CUSTOMWARE_PATH, forced loopback bind, and all other PARAM=VALUE arguments passed through unchanged.
3

Periodic update checks (when enabled)

Every --auto-update-interval seconds the supervisor checks the watched Git remote and branch for a newer revision. Update attempts are non-overlapping — the next check is only scheduled after the current one finishes or fails.
4

Staged release

When a new revision is found, the supervisor clones it into a release directory under <state-dir>/releases/<revision>/ and runs npm install --omit=optional inside the staged checkout.
5

Health-gated promotion

A replacement child is started from the staged release on a private loopback port. The supervisor waits for the child to print its listening URL and pass /api/health. Unhealthy children are stopped and discarded; the active child keeps serving.
6

Traffic cutover

Once the replacement child is healthy, the supervisor switches the reverse proxy to it and begins draining the old child. The old child is stopped once in-flight requests and upgrade streams finish or go quiet.

Environment variables

GIT_URL
string
Optional Git repository URL for update checks and staged release clones. Remote resolution order: --remote-url flag → GIT_URL env → local origin remote URL → canonical fallback.
SPACE_GITHUB_TOKEN
string
Personal access token for fetching from private GitHub repositories. Used by both supervise update checks and node space update. When absent, no GitHub auth header is sent.
CUSTOMWARE_PATH is required by supervise. If it is missing from launch args, the stored .env, and the process environment, the command exits immediately with a descriptive error. Set it persistently with node space set CUSTOMWARE_PATH=<path>.

update

node space update fetches and applies source-checkout updates from the configured Git update repository. It is intended for source checkouts only and does not update packaged Electron apps.

Usage

# Fast-forward the current branch from origin
node space update

# Reattach to a specific branch and fast-forward
node space update --branch main
node space update main

# Move to an exact version tag
node space update v0.10

# Move to an exact commit hash (short or full)
node space update a1b2c3d4

Update flag

--branch
string
Force update of the named branch instead of inferring the current branch or positional target.

Remote resolution order

Before fetching, update resolves the update repository in this order and pins origin to the result:
  1. GIT_URL environment variable (or .env value)
  2. Local origin remote URL
  3. Canonical Space Agent repository fallback

Target resolution

ArgumentBehavior
(none)Fast-forwards the current or recoverable branch from origin
--branch <branch>Reattaches and fast-forwards the named branch
<branch> positionalSame as --branch when the name matches a remote branch
<version-tag>Moves the current or recovered branch to that exact tag revision
<commit>Moves the current or recovered branch to that exact commit hash
When the checkout is in detached HEAD, update attempts to reconnect using the last remembered branch or the remote default branch before fast-forwarding. If neither is available, the command exits with an error rather than silently doing nothing.

Build docs developers (and LLMs) love