---
title: "Run the Memdoor gateway on a remote server"
description: "Memdoor's gateway on an always-on exe.dev VM: reach it with `--gateway ssh://`, run open models through exe.dev with no API key, and watch from your phone."
url: https://exe.dev/deploy/memdoor
category: "AI agents"
updated: 2026-11-02
---

# Run the Memdoor gateway on a remote server

Memdoor's ssh gateway on a box that's always on, with open models included.

- **Software:** Memdoor (https://memdoor.ai/)
- **Source:** https://github.com/guregodevo/memdoor
- **License:** Apache-2.0
- **Time:** 5 minutes
- **Example VM name:** `my-memdoor` (yours will differ; on the VM, `hostname` prints it)
- **Machine-readable:** https://exe.dev/deploy/memdoor/manifest.json

## What you get

- Memdoor's gateway running as a systemd user service on port 8000, back after a reboot
- GLM 5.3 Flash through exe.dev's LLM integration, with no API key on the VM
- A Git repository at `~/project` and Memdoor's first account, ready for the ssh door

Running on the VM:

- **Memdoor gateway**: `memdoor gateway`, run by a systemd user service, port 8000, data in `~/.memdoor`
- **Open models**: GLM 5.3 Flash by default, through exe.dev's LLM integration
- **Your project**: a Git repository, data in `~/project`

How it is reached:

- memdoor --gateway ssh://exedev@my-memdoor.exe.xyz?port=8000 (private): the Memdoor window and `memdoor run` on your computer, tunneled over ssh
- https://my-memdoor.exe.xyz:8000/r/… (private): a /remote link, for watching and typing from your phone

## Deploy with Shelley

Open https://exe.dev/new?prompt=Set%20up%20Memdoor%20on%20this%20VM%20by%20following%20the%20exe.dev%20recipe%20at%20https%3A%2F%2Fexe.dev%2Fdeploy%2Fmemdoor.md%20from%20top%20to%20bottom.%0A%0AThe%20recipe%27s%20example%20VM%20name%20is%20my-memdoor.%20This%20VM%27s%20name%20is%20the%20output%20of%20%60hostname%60%3A%20use%20it%20wherever%20the%20recipe%20writes%20my-memdoor.%20Skip%20the%20step%20that%20creates%20the%20VM%3B%20you%20are%20on%20it.%0A%0AYou%20are%20done%20when%20all%20of%20these%20are%20true.%20Check%20each%20one%20yourself%3A%0A-%20Memdoor%27s%20gateway%20running%20as%20a%20systemd%20user%20service%20on%20port%208000%2C%20back%20after%20a%20reboot%0A-%20GLM%205.3%20Flash%20through%20exe.dev%27s%20LLM%20integration%2C%20with%20no%20API%20key%20on%20the%20VM%0A-%20A%20Git%20repository%20at%20%60~%2Fproject%60%20and%20Memdoor%27s%20first%20account%2C%20ready%20for%20the%20ssh%20door%0A%0ARun%20the%20VM-side%20commands%20in%20%22Set%20up%20the%20VM%22%20only%3B%20skip%20creating%20the%20VM.%0ARun%20the%20last%20command%20with%20%60%3C%2Fdev%2Fnull%60%20as%20written%3A%20%60memdoor%20run%60%20reads%0Apiped%20input%20as%20the%20task.%20Don%27t%20run%20%60memdoor%20connect%60%2C%20%60memdoor%20remote%60%20or%0A%60%2Fremote%60%2C%20and%20don%27t%20add%20keys%20to%20%60~%2F.memdoor%2Fenv%60.%20Verify%20that%0A%60memdoor%20--gateway%20http%3A%2F%2Flocalhost%3A8000%20gateway%20status%60%20says%20the%20gateway%0Ais%20answering%20and%20the%20service%20is%20active%2C%20and%20that%20the%20test%20run%20replied%20OK.%0ASkip%20the%20later%20sections%20and%20the%20FAQ.%20Finish%20by%20telling%20the%20owner%20to%20follow%0A%22Connect%20from%20your%20computer%22%20with%20this%20VM%27s%20name.%0A%0AFinish%20with%20the%20URLs%20I%20should%20open.%0A to create a VM whose agent, Shelley, follows this recipe. From a terminal:

```sh
curl -fsSL https://exe.dev/deploy/memdoor/prompt.txt | ssh exe.dev new --prompt=/dev/stdin
```

Or follow the steps below by hand.

[Memdoor](https://memdoor.ai/) is the open-source coding agent behind the
"small models beat a frontier model" result on Hacker News: a terminal
window, a `run` command for scripts and CI, and a gateway that holds your
sessions. Its gateway mode is made for a box you reach over ssh:
`memdoor --gateway ssh://you@box` tunnels to the gateway there, and every
turn runs on the box, next to the code.

An exe.dev VM is that box. SSH is how you already reach it, it's on when
your laptop sleeps, and its disk keeps the sessions, the project and the
login. exe.dev's LLM integration serves open-weight models such as GLM 5.3
Flash and Kimi K3, so no API key goes on the VM. Memdoor is weeks old and
ships several releases a day; this page was tested with v1.785.0.

## Set up the VM

On your computer, create a VM and connect. If you've already clicked Deploy
or have a VM, skip the first command and use its name:

```bash
ssh exe.dev new --name=my-memdoor
ssh my-memdoor.exe.xyz
```

On the VM, install Memdoor, point it at exe.dev's LLM integration, and run
the gateway as a service on port 8000:

```bash
curl -fsSL https://memdoor.ai/install.sh | bash
export PATH="$HOME/.local/bin:$PATH"
mkdir -p ~/.memdoor
cat > ~/.memdoor/env <<'EOF'
AI_GATEWAY_BASE_URL=https://llm.int.exe.xyz/v1
AI_GATEWAY_API=chat
AI_GATEWAY_TOKEN=exe-llm-integration
MEMDOOR_MODEL=accounts/fireworks/models/glm-5p3-flash
EOF
chmod 600 ~/.memdoor/env
memdoor gateway install --port 8000
git init ~/project
cd ~/project
MEMDOOR_GATEWAY=http://localhost:8000 memdoor run "Reply with exactly: OK" </dev/null
```

The installer puts `memdoor` in `~/.local/bin`. `memdoor gateway install`
writes a systemd user service, `memdoor`, that reads `~/.memdoor/env` and
starts again after a crash or reboot. The four lines in that file use
Memdoor's company-gateway mode: every model call goes to exe.dev's
integration, which adds the credentials itself, so the token is a
placeholder. Memdoor then contacts nothing else: no OpenRouter, no
memdoor.ai. `AI_GATEWAY_API=chat` matters: with Memdoor's default Responses
API, follow-up turns stalled in our tests.

The test run creates Memdoor's first account on the gateway and saves its
login in `~/.memdoor/local-login`, which the ssh door reads from your
computer. It should print `OK`. Check the gateway:

```bash
memdoor --gateway http://localhost:8000 gateway status
```

It says `answering at http://localhost:8000` and `service    active`.

## Connect from your computer

On your computer, install Memdoor (on Windows, `irm
https://memdoor.ai/install.ps1 | iex` instead of the first line), ssh to the
VM once to accept its host key, and save the gateway address:

```bash
curl -fsSL https://memdoor.ai/install.sh | bash
ssh exedev@my-memdoor.exe.xyz true
export MEMDOOR_GATEWAY='ssh://exedev@my-memdoor.exe.xyz?port=8000'
```

Put the `export` line in your shell's rc file to keep it. Memdoor runs
your own `ssh` with `BatchMode`, so it can't answer a host-key question
itself.

Give it a task with `memdoor run`. `--dir` names the directory on the VM:

```bash
memdoor run --dir /home/exedev/project "write a hello-world Go program with a test, and run the test"
```

The first command signs your computer in with the VM's login and stores it
in `~/.memdoor` on your computer. Then open the window:

```bash
memdoor --dir /home/exedev/project
```

The footer says `live my-memdoor.exe.xyz:~/project`. Files are read,
commands run and tests pass on the VM. Close the window or your laptop and
the gateway keeps the session; `memdoor resume --last` picks it up again.
On a computer that has never signed in, open the window only after one
`memdoor run`: in our tests the window alone answered `Authentication
required`.

If you skip "Set up the VM", `memdoor --gateway ssh://…` installs Memdoor
and the service on the VM by itself. But it then creates the first account
from your computer and leaves the model up to you, so write the env file on
the VM anyway to use exe.dev's models.

## Watch from your phone

In the window, type `/remote`. Memdoor prints a link and a QR code like
`http://my-memdoor.exe.xyz:8000/r/…#k=…`. Change `http` to `https` and open
it on a phone that's signed in to exe.dev: the conversation opens in a
Memdoor terminal, with keys for Esc, Tab and the arrows, through the exe.dev
HTTPS proxy. The gateway on the VM runs that terminal and is its own relay,
so no Memdoor plan is needed and the link keeps working after you close the
window on your computer. `/remote off` revokes it.

The proxy keeps port 8000 private to you. To let a teammate watch, [share
the VM](https://exe.dev/docs/sharing) with them and send the watch-only
link Memdoor prints alongside.

## Pick a model

`MEMDOOR_MODEL` in `~/.memdoor/env` is the model every turn uses. To
switch, on the VM:

```bash
sed -i 's|^MEMDOOR_MODEL=.*|MEMDOOR_MODEL=accounts/fireworks/models/kimi-k3|' ~/.memdoor/env
systemctl --user restart memdoor
```

Other open-weight models on exe.dev include
`accounts/fireworks/models/glm-5p3`, `accounts/fireworks/models/minimax-m3`
and `accounts/fireworks/models/deepseek-v4p1-flash`. `/model` in the window
can't list them: Memdoor reads its model list from OpenRouter.

<details class="dp-details">
<summary>Update, back up and troubleshoot</summary>

**Update.** The window says when a release is out. On the VM:

```bash
memdoor upgrade --yes
```

It swaps the binary and restarts the service. Ignore a warning that
nothing answers on :18789; `memdoor --gateway http://localhost:8000 gateway
status` shows the new version on 8000. Update your computer's copy the same
way.

**Back up.** Sessions, accounts and logins live in `~/.memdoor` on the VM;
your code in `~/project`. Copy both, or push the project to a Git remote.

**Troubleshoot.**

- *`Authentication required`* on your computer: run one `memdoor run`
  command first (see above), then open the window.
- *A turn hangs on `stream idle past deadline`*: check that
  `AI_GATEWAY_API=chat` is in `~/.memdoor/env` and the base URL ends in
  `/v1`, then `systemctl --user restart memdoor`.
- *The ssh door can't connect*: run `ssh exedev@my-memdoor.exe.xyz true`
  on its own and fix what it says.
- *The gateway is down*: `systemctl --user status memdoor` and
  `journalctl --user -u memdoor` on the VM.

</details>

## Frequently asked questions

### Why port 8000 instead of Memdoor's default, 18789?

The ssh door would work on any port, but the [exe.dev HTTPS proxy](https://exe.dev/docs/proxy) only forwards ports 3000 to 9999. On 8000, a `/remote` link opens on your phone through the proxy, behind your exe.dev login. The cost is adding `?port=8000` to the gateway address on your computer.

### Does Memdoor's "team of small models" work on exe.dev's models?

Memdoor's coder runs on whatever model `MEMDOOR_MODEL` names, and exe.dev serves open-weight models such as GLM 5.3, Kimi K3, MiniMax M3 and DeepSeek V4.1 Flash. The Qwen3.8-27B that Memdoor's benchmark uses isn't among them; run it yourself with `memdoor connect local` on a machine with a GPU. Memdoor's decision model (Jev) needs a TypeSafe or OpenRouter key, so it's off on this page: Memdoor says so under the prompt box. Turns work without it; they just read more.

### Can I use my own keys instead?

Yes. Remove the four `AI_GATEWAY_*` and `MEMDOOR_MODEL` lines from `~/.memdoor/env`, restart the service, then connect a provider through the ssh door, for example `memdoor connect openrouter`. The key is kept on the VM in `~/.memdoor/providers.json`, readable only by you, and every turn on the gateway uses it. Memdoor's company-gateway setting wins over connected keys, which is why the lines have to go.

### Who can reach the gateway?

The VM opens no ports to the internet. The ssh door needs your ssh key, and a `/remote` link needs your exe.dev login (or a share you set up), plus the key in the link itself: Memdoor encrypts the terminal end to end with it. `/remote off` revokes a link.


## Related

- [Run OpenCode on a remote server](https://exe.dev/deploy/opencode.md): Every model, one VM, and an agent that works while your laptop sleeps.
- [Run the Pi coding agent on a remote server](https://exe.dev/deploy/pi.md): An agent that doesn't ask first, on a computer that can take it.
- [Run Herdr agents on a remote machine](https://exe.dev/deploy/herdr.md): An always-on SSH machine for Herdr, with agents ready and no API keys.
- [Run Codex remote control on a server](https://exe.dev/deploy/codex-remote-control.md): Codex on an always-on VM, steered from the ChatGPT app on your phone.
- [Run DeepSeek Harness on a remote server](https://exe.dev/deploy/deepseek-harness.md): DeepSeek's agent in a browser tab, on a computer that never sleeps.
- [Run Claude Code on a remote server](https://exe.dev/deploy/claude-code.md): A computer for Claude. A breather for your laptop.
