A walkthrough of the dev-server cleanup, the concepts behind it, and the workflow you'll use from here.
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.
Five subdomains, five folders, five ports. Each row is independent.
| URL | Folder | Branch | Port |
|---|---|---|---|
| mikvehworks.com | /opt/watchflow-dev | dev | 3009 |
| invoices.mikvehworks.com | /home/agentruntime/wf-invoice | invoice-module | 3011 |
| activity.mikvehworks.com | /home/agentruntime/wf-activity-log | activity-log | 3013 |
| reporting.mikvehworks.com | /home/agentruntime/wf-reporting | reporting | 3015 |
| marketing.mikvehworks.com | /home/agentruntime/wf-marketing | marketing | 3017 |
Edit code in a folder → changes show on its URL. Other rows keep running undisturbed.
Three problems we found and fixed today.
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:
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.
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.
Five concrete changes, in order.
node_modules in /opt/watchflow-dev (it was a self-referencing symlink — pointing at itself, infinite loop).pm2 instead.Plain definitions for the moving parts.
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. pm2Two 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.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:
Change the port number, or kill the process → the subdomain breaks. Keep them stable → everything works.
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.
Talk to your aigent like this. Each phrase runs a script that handles the plumbing.
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.
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.
Sync X with main
aigent pulls the latest main branch into your feature branch, pushes, and restarts the subdomain.
Retire X
After you've merged the feature, aigent tears it down: stops the process, deletes the cert, removes the folder, deletes the branch.
Reference table for paths you'll see again.
| Thing | Where 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 server | 24.144.109.84 never touched from here |
The careful checks paid off.
Three small steps to finish the workflow.
wf-new, wf-sync, wf-retire) in /home/agentruntime/bin/ — with the bug fixes we already identified.wf-new manually for the first time on a test feature, with you watching, end-to-end./home/agentruntime/CLAUDE.md to document the four phrases.