Status: Complete — All core phases done (2026-03-03)
Replaces: OpenClaw and CrewAI (both decommissioned as part of this setup)
Architecture: Claude Code as the intelligence layer, n8n as a lightweight automation/routing layer
No API keys or OpenRouter: All intelligence tasks run through Patrick’s Claude Max account and Asia’s Claude Pro account. No OpenRouter, no Anthropic API billing.
This document covers setting up Claude Code on the OpenClaw VPS for both Patrick and Asia. Each user gets their own Linux account, their own Claude Code session authenticated with their personal Claude.ai subscription (Max/Pro), and access to shared Baseworks project directories. n8n on the separate Agents VPS connects to Claude Code via SSH to run headless tasks and post results to Slack.
This replaces the CrewAI + OpenClaw stack entirely. CrewAI was the previous “brain” layer and used OpenRouter for API access. Claude Code fills that role directly using each user’s personal Claude.ai subscription — no API keys, no OpenRouter, no per-token billing.
n8n remains on the Agents VPS but in a reduced, non-AI role: Slack event routing, scheduled git syncs, and simple triggers. It no longer makes AI calls. Any task requiring intelligence is handled by Claude Code directly, either interactively in a tmux session or headlessly via claude -p.
Claude Code also runs interactively — Patrick and Asia can SSH in directly and work in their own tmux sessions, accessing the shared project directories and Git repositories.
OpenClaw stays on this server but in a stopped state. The container, config, volumes, NGINX proxy, and Cloudflare DNS record are all preserved — nothing is removed. A stopped container has zero attack surface. If OpenClaw is ever needed for evaluation, it can be restarted with a single command.
This is the right posture for personal/dev use: Claude Code runs natively as a host process, OpenClaw stays sandboxed in Docker but offline.
Terminal window
sshpatrick@46.224.129.16
# Stop OpenClaw (leaves config, volumes, and images intact)
cd/opt/baseworks-claw/openclaw
sudodockercomposestop
# Verify it is stopped
sudodockerps
# openclaw-openclaw-gateway-1 should not appear in the running list
# Disable the NGINX site for claw.baseworks.com while OpenClaw is offline
user: "1000:1000" — runs as non-root (already the case, now explicit)
read_only: true — container filesystem is read-only; only the mounted volumes (config, workspace, state, credentials) remain writable
tmpfs: /tmp — gives Node.js a writable temp directory in RAM, since the main filesystem is read-only
cap_drop: [ALL] — drops all Linux kernel capabilities; OpenClaw is a Node.js app on port 18789 and needs none
no-new-privileges: true — prevents any process inside the container from gaining elevated privileges
openclaw-net — dedicated Docker bridge network, isolating OpenClaw from any other Docker services on the host
Note on read_only: true: If OpenClaw fails to start with this enabled (some Node.js apps write to unexpected internal paths), remove read_only: true and the tmpfs line and try again. The remaining hardening (cap_drop, no-new-privileges, dedicated network, non-root user) is still a significant improvement over the default config.
The Cloudflare DNS record (claw.baseworks.com) stays pointing at this server throughout, so it comes back online immediately with no DNS changes needed.
Migration note: If OpenClaw ever needs to move to its own VPS, everything under /opt/baseworks-claw/ plus the NGINX config and SSL certs (/etc/ssl/cloudflare/) can be rsynced to a new server in under an hour. See OpenClaw-Deployment-Guide for full reference.
Docker itself stays installed — not needed for Claude Code but causes no harm.
Note: The GitHub PAT from the Agents VPS (expires ~2026-05-19) can be reused here, or a new fine-grained PAT created specifically for this VPS. Store it in the remote URL: https://<token>@github.com/p-oancia/repo.git
This is what replaces CrewAI in the existing n8n workflows. Instead of n8n calling the CrewAI container at crewai:8000, it SSHes into the Claude Code VPS and runs claude -p.
claude -p runs use Patrick’s authenticated Claude Max session — no API key or OpenRouter involved. Usage counts against the Max subscription, same as interactive use.
All server administration — container management, config edits, nginx, firewall rules — can be issued as natural language messages in Slack or Discord. The pipeline is n8n as the routing layer, Claude Code on the VPS as the executor.
"Stop OpenClaw and disable its nginx proxy" (Slack #agent-alerts or Discord)
↓
n8n Slack/Discord Event Router
↓
SSH Execute → claude -p "..." --allowedTools "Bash(sudo docker *),
Bash(sudo systemctl *),Bash(sudo ufw *),Edit"
↓
Claude Code runs the appropriate sudo commands with full VPS authority
Rather than --dangerously-skip-permissions (which approves everything blindly), use --allowedTools to pre-authorise specific command categories per task type:
“Stop OpenClaw” → sudo docker compose stop in /opt/baseworks-claw/openclaw
“Restart OpenClaw with hardened config” → updates override file, runs docker compose up -d
“Disable OpenClaw nginx” → disables site in /etc/nginx/sites-enabled/, reloads nginx
“Show firewall rules” → sudo ufw status verbose
“Block port 8080” → sudo ufw deny 8080
“Show running containers” → sudo docker ps
“Exec into OpenClaw and show logs” → sudo docker logs openclaw-openclaw-gateway-1
Patrick’s account has passwordless sudo — Claude Code executes all of these with full authority. Asia’s account can be granted the same if needed.
Discord note: Discord works identically to Slack via n8n. n8n has a native Discord trigger node. Switch the Event Router workflow input from Slack to Discord (or run both in parallel) to support either interface.
Remote Control connects claude.ai/code and the Claude mobile app (iOS/Android) to a Claude Code session running on the VPS. Start a session at your desk, then continue it from your phone, tablet, or any browser — full interactive conversation, not one-shot commands.
tmux solves the only real limitation (the terminal process must stay running). On the VPS, the process keeps running inside tmux even after you close your SSH connection or shut your laptop.
Terminal window
sshpatrick@46.224.129.16
tmuxattach-tpatrick-kb
# Start Remote Control — generates a URL and QR code
clauderemote-control
# Press spacebar to toggle the QR code display
# Scan from phone or open the URL in any browser
# Then detach from tmux: Ctrl+B D
# Close your laptop — session stays alive on the VPS
# Open on phone — full interactive conversation continues
Set Enable Remote Control for all sessions to true — every Claude Code session will have Remote Control active without needing to run the command manually.
Remote Control uses outbound HTTPS only — no inbound ports open on the VPS. All traffic goes through the Anthropic API over TLS with short-lived, purpose-scoped credentials.