What is the Gateway?
The Gateway is a local Fastify HTTP server (default port7787) bundled into the @redplanethq/corebrain CLI. It runs on your laptop, on a Docker host you control, or on Railway, and exposes your browser, coding agents, shell, and a registered set of folders to CORE over an authenticated HTTP + WebSocket API.
CORE never touches your machine directly. Every action CORE takes on your environment, opening a tab, running a test, editing a file, spawning Claude Code, goes through this gateway. It’s the bridge between CORE’s cloud intelligence and your local environment.
Looking for the runbook? See Gateway Setup for a linear, copy-pasteable guide. This page is the conceptual overview.
Why connect a Gateway?
Without a gateway, CORE is a memory and reasoning layer in the cloud. With one, CORE can act on your actual machine and accounts. Concrete examples:Remote coding from your phone
Message CORE on WhatsApp, “Fix the auth timeout in the API.” CORE spawns Claude Code on your gateway, pulls context from memory, and works on the bug while you’re on the train.
Authenticated browser automation
Log in to LinkedIn once on your
personal Playwright profile. CORE can research leads, scrape your dashboards, or drive a checkout flow without you re-authenticating.Live terminal in the webapp
Watch a coding session stream into the webapp’s terminal pane in real time, attach, type, and resize, with a Chrome DevTools-style live view of the browser running alongside.
Scheduled local actions
“Every morning at 9am, run the test suite and summarize failures.” A reminder fires
exec_command against your repo and posts the result back to your channel of choice.What does it expose?
The gateway advertises a manifest of capability slots. Each slot can be turned off incorebrain gateway config; disabled slots aren’t just hidden, their HTTP routes are not registered.
In addition the gateway exposes a few HTTP routes the webapp uses directly:
GET /manifest: full capability manifest the webapp reads on every poll.WS /api/coding/coding_xterm_session: terminal stream for coding sessions and the per-gateway shell.WS /api/browser/cdp/:session: Chrome DevTools Protocol proxy for the live browser viewer.POST /api/folders/local,POST /api/folders/git,DELETE /api/folders/:idOrName: folder management.POST /api/shell/spawn: general-purpose PTY for the shell tab.
Authorization: Bearer gwk_<key>. There is no localhost bypass, the same flow applies whether the gateway is on 127.0.0.1, behind a tunnel, or on a public Docker host.
For the protocol details and a route-by-route reference, see packages/gateway-protocol/README.md.
Install (quick path)
For the full step-by-step including Tailscale / ngrok install, see Gateway Setup.1
Install the CLI
2
Run the wizard
- Native: this machine. Installs a launchd (macOS) / systemd (Linux) service and gives full access to local browser, shells, and folders. Native gateways listen on
127.0.0.1and need a tunnel (Tailscale or ngrok) before CORE’s cloud can reach them. See Tunnels or the Setup runbook for the tunnel install steps you must run first. - Docker: local or remote Docker host. Drops
docker-compose.yaml+.envinto~/.corebrain/gateways/<name>/(templates fetched frommainso they stay in sync), runsdocker compose up -d, and optionally exposes via Tailscale Funnel. - Railway: managed cloud. Detects (or installs) the Railway CLI, runs
railway init+railway deploy -t core-gateway, and provisions a public domain.
CLAUDE_CODE_OAUTH_TOKEN, OPENAI_API_KEY, and GITHUB_TOKEN so the coding + git slots work out of the box.3
Register the gateway with a tunnel
Native installs need a tunnel before the cloud can reach them:The CLI prints a
baseUrl and a securityKey (gwk_...). The raw key is shown exactly once.4
Paste URL + key into the CORE app
This is the step that links the gateway to your workspace. Without it, the gateway is reachable but CORE doesn’t know it exists.
- Open https://app.getcore.me (or your self-hosted instance).
- Sidebar → Gateways → + New gateway.
- Paste the Base URL and the Security key from the CLI output.
- Click Submit. The gateway should show Connected within a few seconds.
5
Verify
Skipping the wizard
corebrain gateway setup --kind native|docker|railway jumps straight into one path. Useful for headless installs and CI.
One-click Railway deploy
COREBRAIN_API_URL: your CORE instance URL (e.g.https://app.getcore.me)COREBRAIN_API_KEY: a Personal Access Token from the webappCOREBRAIN_GATEWAY_NAME: name shown in the webappCOREBRAIN_GATEWAY_SECURITY_KEY: (optional) leave empty and Railway will auto-generate one
Gateway Commands
Top-level (work on any gateway)
Native gateway lifecycle (this machine only)
The
folder, browser, coding, and exec command groups configure the native gateway’s slots and only run when one is set up on this machine. They print a redirect to corebrain gateway setup otherwise.
Folders and scopes
Browser (Playwright)
See Browser for the full reference.
Coding (Claude Code, Codex)
See Coding for the full reference and the
coding_ask payload shape.
Exec (shell)
See Exec for the security model.
Folders and scopes
Folders are registered paths the gateway is allowed to touch. Each folder carries one or more scopes:
When at least one folder is registered, a request that names a path outside any matching-scope folder is rejected with
FOLDER_SCOPE_DENIED / PATH_OUTSIDE_FOLDER. With zero folders registered the gateway runs in permissive first-run mode.
Security
- Bearer-only auth. The gateway stores
sha256(securityKey)on disk; the webapp encrypts the raw key at rest. Constant-time comparison; no localhost bypass. - Slot toggles. Disabled slots are not just hidden, their HTTP routes are not registered, so a leaked key still cannot hit them.
- Folder scopes. Coding / exec / files tools are pinned to registered folders with the matching scope.
- Exec patterns.
exec_commandvalidates each command against allow / deny globs (Bash(<glob>)) plus a built-in deny list for unsafe primitives. - Browser profiles. Stored locally; auth state never leaves your machine.
- Tunnels for native gateways. Native installs always need HTTPS to be reachable from CORE’s cloud. Use Tailscale Funnel, ngrok, or your own reverse proxy. See Tunnels.
Environment Variables (Headless / Docker)
When running without an interactivecorebrain login flow, the gateway reads:
Bootstrap is idempotent. Values you set manually inside the container are never overwritten.
Where next?
- Gateway Setup runbook: linear copy-paste guide from zero to connected.
- Tunnels: Tailscale Funnel and ngrok deep-dive.
- Browser, Coding, Exec: per-capability references.
- Gateway protocol README: full HTTP / WebSocket reference.
