Plain-English Recap

What We Did Today

A walkthrough of the dev-server cleanup, the concepts behind it, and the workflow you'll use from here.

2026-05-01 mikvehworks.com (dev server) 137.184.21.83

01The TL;DR

In one paragraph.

You wanted multiple branches running on multiple subdomains at the same time, all on this one dev server. It was already working — sort of — but fragile and tangled. We cleaned it up. The result: each feature now lives in its own folder, on its own subdomain, on its own port, with auto-restart and reboot survival. You also have a four-phrase workflow to drive your aigent.

02The Setup You Have Now

Five subdomains, five folders, five ports. Each row is independent.

URLFolderBranchPort
mikvehworks.com/opt/watchflow-devdev3009
invoices.mikvehworks.com/home/agentruntime/wf-invoiceinvoice-module3011
activity.mikvehworks.com/home/agentruntime/wf-activity-logactivity-log3013
reporting.mikvehworks.com/home/agentruntime/wf-reportingreporting3015
marketing.mikvehworks.com/home/agentruntime/wf-marketingmarketing3017

Edit code in a folder → changes show on its URL. Other rows keep running undisturbed.

03What Was Broken (and Why)

Three problems we found and fixed today.

1. Processes were "babysat by luck"

Your subdomain servers were started by hand using nohup — a Linux command that means "run this and don't kill it when I log off." Works fine until something goes wrong:

2. The disk was 100% full

Earlier in the session, root-Claude (running as the root user) made a mistake — it created four duplicate copies of your code under /opt/watchflow-*. Each copy needs its own node_modules/ folder, weighing about 4 GB (mostly because of onnxruntime-node and Playwright's bundled browsers). That's roughly 17 GB of pure waste, on a 96 GB disk that was already crowded.

3. Two Claude sessions didn't know about each other

You have two Linux user accounts on this server: root (system admin) and agentruntime (your aigent app). Each had its own Claude session, its own pm2, its own folders. They were stepping on each other's toes — both trying to run the same subdomains.

04What We Actually Fixed

Five concrete changes, in order.

  1. Deleted the 17 GB of duplicate folders — freed disk back to 16 GB headroom.
  2. Repaired the broken node_modules in /opt/watchflow-dev (it was a self-referencing symlink — pointing at itself, infinite loop).
  3. Stopped the manually-started processes and re-started them under your aigent's pm2 instead.
  4. Registered a systemd unit so your aigent's pm2 starts automatically on reboot.
  5. Confirmed all four subdomains return HTTP 200 — healthy, no crash loops.

05Concepts You Asked About

Plain definitions for the moving parts.

Branch vs. folder

A branch is a version of your code that lives on GitHub. A folder is where that code is downloaded on a computer.

You can download the same repo into multiple folders — one per branch you want to work on at the same time. That's called a git worktree. All your wf-* folders share one underlying .git directory, but each has a different branch checked out.

nohup vs. pm2

Two ways to run a Node.js server in the background:

  • nohup node server.js & → "Just run it and don't kill it when I log off." No safety net. Dies on crash. Dies on reboot.
  • pm2 start server.js → "Run it, watch it, restart it if it dies." Auto-recovers. Combined with a systemd unit, also survives reboot.

Subdomains, nginx, and ports

Your server runs many Node.js processes at once. Each one listens on a numbered "port" (3009, 3011, 3013...). When a visitor types invoices.mikvehworks.com in their browser, here's the chain of events:

invoices.mikvehworks.com DNS lookup 137.184.21.83 (your server's IP) nginx reads /etc/nginx/sites-enabled/ 127.0.0.1:3011 (forward to this local port) wf-invoice node process (responds with HTML)

Change the port number, or kill the process → the subdomain breaks. Keep them stable → everything works.

Two servers, not one

The site at mywatchflow.com (your live production site, with real customer data) runs on a different physical machine at 24.144.109.84. This dev server cannot reach it. They're completely separate.

Merging code to main on GitHub does not automatically deploy to mywatchflow.com — that machine has its own deploy process, run separately.

06Your Four-Phrase Workflow

Talk to your aigent like this. Each phrase runs a script that handles the plumbing.

01

Set up a new feature called X

aigent creates the branch, the folder, the subdomain, the SSL cert, and starts the process. You get back a working URL.

02

I want to work on X in this chat

aigent switches its working directory to the right folder so further edits go in the right place.

03

Sync X with main

aigent pulls the latest main branch into your feature branch, pushes, and restarts the subdomain.

04

Retire X

After you've merged the feature, aigent tears it down: stops the process, deletes the cert, removes the folder, deletes the branch.

You still own: committing your code, pushing to GitHub, and merging the PR. The aigent only handles the infrastructure plumbing — never the code review or deploy decisions.

07What Lives Where

Reference table for paths you'll see again.

ThingWhere it lives
Main dev folder/opt/watchflow-dev
Feature folders/home/agentruntime/wf-*
nginx configs/etc/nginx/sites-available/
SSL certs (Let's Encrypt)/etc/letsencrypt/live/
pm2 dumps (root)/root/.pm2/dump.pm2
pm2 dumps (aigent)/home/agentruntime/.pm2/dump.pm2
Workflow scripts (planned)/home/agentruntime/bin/wf-*
Production server24.144.109.84 never touched from here

08What Could Have Gone Wrong (but didn't)

The careful checks paid off.

Lesson: Slow, careful, "stop and ask" beats fast and confident. We checked git status before deleting, verified PIDs before killing, and read every error before moving on. Nothing of yours was lost.

09Still To Do (Next Session)

Three small steps to finish the workflow.

  1. Install the three workflow scripts (wf-new, wf-sync, wf-retire) in /home/agentruntime/bin/ — with the bug fixes we already identified.
  2. Run wf-new manually for the first time on a test feature, with you watching, end-to-end.
  3. Update /home/agentruntime/CLAUDE.md to document the four phrases.