Skip to content

How people and computers reach gomoe.dev

gomoe.dev has one way in from the internet, the load balancer. The one other host the internet reaches is the Watchtower collector at watch.gomoe.dev, in a public subnet with a public address and 443 open to every address, outside the web ACL (watchtower.tf). Everything else sits in private subnets of the stack’s VPC, 10.42.0.0/16 across two zones, and the security groups in ops/terraform/agents/main.tf decide who reaches what inside. This page explains each path and why it is shaped the way it is.

The load balancer agents-alb sits in the public subnets. Its HTTPS listener on port 443 ends TLS with an ACM certificate for gomoe.dev, under the policy ELBSecurityPolicy-TLS13-1-2-2021-06, and its listener on port 80 answers every request with a 301 to HTTPS. It holds a connection open for up to 3,600 seconds idle, since screens and live tokens keep WebSockets open.

Two kinds of name answer without reaching the server. agents.intrepidrhino.dev, the old address, answers with a 301 to the same path on gomoe.dev. aws.gomoe.dev answers with a 302 to the AWS access portal.

A web ACL sits in front of the load balancer (waf.tf). Its country rule blocks every request from outside allowed_countries, which is the US only, apart from two kinds of path whose senders may be anywhere. Both answer before sign-in.

  • Stripe’s webhook at /v1/billing/stripe-webhook. The API answers 404 while the server has no Stripe key, and 400 to an event with no Stripe-Signature header or one whose signature does not verify for the body or is older than Stripe’s tolerance (server/billing/routes.ts).
  • A routine’s hook, /v1/hooks/routines/<routine id>, where a routine’s events come in. The exemption matches only that shape, 36 lower-case hex digits and dashes with nothing after them (waf_routine_hook in waf.tf), the shape ROUTINE_HOOK in server/routine-hooks.ts takes. waf.tf has matched it that way since #747, and the repo does not record whether that change has been applied to gomoe.dev. The API checks each delivery against the routine’s hook secret (server/outside-door.ts). A GitHub or Sentry event must carry that sender’s signature over the body, and a Linear event its signature and a webhookTimestamp within 5 minutes of the server’s clock. A webhook routine’s event carries either a signature over a timestamp within 5 minutes and the body, or, for a sender that can’t sign, the hook secret itself as Authorization: Bearer <secret>. On gomoe.dev routine hooks are off, since ROUTINE_HOOKS_ON in ops/aws-deploy/public-address.ts is false and the deploy writes no AGENTS_ROUTINE_HOOKS_DIR, so no event starts anything. A delivery sent as application/json, at most 256 KB, gets a 503 at an event routine’s hook and a 404 at an id no event routine has.

The per-address rate limit, 2,000 requests in 5 minutes, AWS’s managed rule groups, and the body-size rule, which blocks a body over 8 KB that the common rule set labels, except on those two paths, only count matches while waf_count_only is true, which is the default and which gomoe.tfvars leaves as it is. A person outside the US cannot open gomoe.dev until allowed_countries grows.

The load balancer forwards gomoe.dev to the target group agents-people, the server host on the people port, 8080, and checks it at /nginx-health. nginx listens there, and ops/aws-deploy/host.ts writes its site on every deploy.

  • A path under /machine/ goes to the laptop socket, /data/agents-app/laptops.sock, with the /machine prefix taken off.
  • nginx answers /nginx-health itself, for the load balancer’s check.
  • Every other path goes to the people socket, /data/agents-app/people.sock.

nginx passes WebSocket upgrades, sets X-Forwarded-Proto https, takes bodies up to 200 MB, and waits up to 3,600 seconds between two reads from the API (proxy_read_timeout). The API listens for people only on the socket, never on a TCP port, so nothing on the host’s network reaches the people routes without passing through nginx.

People sign in to Agents itself, because the server runs with AGENTS_AUTH=native. The API refuses a request that carries a Tailscale- header before its route runs, except the app’s built files, LiveKit’s webhook and routine hooks, which read no person (server/session.ts, server/api.ts). A person is known by a session cookie or an API token, never by a header a proxy sets.

A person’s own Mac reaches the machine routes at https://gomoe.dev/machine, the address the server writes as AGENTS_LAPTOP_URL. The door has two limits the machine port does not have, and shares a third with it (server/laptops.ts).

  • Only the token of a machine of kind mac opens it. A computer’s token is refused, so a token read off a Fargate task can’t be used from outside the VPC.
  • A person’s session and an API token are refused, as on the machine port, so person and machine credentials never stand in for each other.
  • The model gateway, connectors’ gateways and webhooks are not served. A Mac’s agents run on the person’s own Claude sign-in.

The API’s machine port, 7700, listens on every address of the host (AGENTS_MACHINE_HOST=0.0.0.0). The load balancer never forwards to it. The server’s security group admits it from two groups only.

  • The computers’ security group, so each computer’s daemon reaches the API.
  • The server’s own group, since API copies pass a viewer’s screen tunnel on to each other’s machine port.

On the host itself, the forge’s container reaches the machine port through Docker’s gateway, as host.docker.internal, to send its webhooks (ops/aws-deploy/compose.aws.yaml). No security group stands between them.

A computer’s security group admits nothing in and lets everything out. What a computer reaches inside the VPC is decided by the groups at the other end.

  • The server host’s machine port, through the rule above.
  • EFS on port 2049, where its home is.
  • The open web, through the NAT gateway. S3 traffic, such as the image’s layers, goes through a gateway endpoint instead.

RDS takes connections from the server’s group alone, so no computer reaches the database. Electric and the forge listen on the host’s loopback. A computer finds the server as server.agents.internal, a record in a private zone of the VPC. AGENTS_BOX_API names the server by that record, so a replaced host, with a new private address, is found again by computers already running.

The server host sits in a private subnet. It has no public address and no SSH. It reaches the internet through the NAT, which its first boot needs for packages. An operator runs commands on it through SSM Run Command, aws ssm send-command with the document AWS-RunShellScript, which ops/aws-deploy/ssm.ts and ops/aws-deploy/admin.ts wrap. The command’s output goes to the objects bucket under ssm/, since SSM keeps only part of it.

gomoe.tfvars names preview_domain = "preview.gomoe.app". With it applied, the load balancer forwards each name under *.preview.gomoe.app to nginx on port 8081, which reaches the preview socket and nothing else. nginx listens there only after the next deploy, which reads /agents/previews and writes the listener. The feature map .claude/skills/verify-agents/features/aws-deploys.md marks that step not run on the host, and describes it as following an apply by Tayler that sets preview_domain.