Forge Documentation

Deploy a security-hardened AI coding agent on your own server in under 10 minutes.

Last updated: March 18, 2026

New to servers? Let AI walk you through it.

Download the Forge Setup Agent template and paste it into Claude, ChatGPT, or any AI chatbot. It becomes your personal deployment assistant — step by step, no experience required.

Download Forge Setup Agent Markdown file · Works with any AI chatbot · Free

Requirements

RequirementDetails
VPS ServerUbuntu 22.04 or 24.04, minimum 2GB RAM, root access
Cloudflare AccountFree account with at least one domain added
GitHub AccountTo access the private Forge repository after purchase
LLM API KeyAt least one: OpenAI, Anthropic, Google, or any OpenCode-supported provider
Time~10 minutes from first command to live agent
Don't have a VPS yet? The next section walks you through getting one. Recommended: Hetzner CX22 (~$7/month) — provisions in under 30 seconds.

Step 1 — Get a VPS

A VPS (Virtual Private Server) is a remote computer you rent. Your AI agent runs here — not on your laptop. This means it's available 24/7 from any device, and your local machine stays clean.

Recommended — Hetzner Cloud

Fast setup, reliable, ~$7/month

  1. Go to hetzner.com/cloud and create an account
  2. Click Add Server
  3. Location: choose the closest region to you
  4. Image: select Ubuntu 24.04
  5. Type: select CX22 (2 vCPU, 4 GB RAM)
  6. Authentication: choose Password and set a strong root password
  7. Click Create & Buy Now
  8. Your server is ready in ~20 seconds. Copy the IP address from the dashboard.
Budget Option — Contabo

Lower cost, slower provisioning, ~$4/month

  1. Go to contabo.com/en/vps
  2. Select Cloud VPS S
  3. Choose your region, select Ubuntu 24.04
  4. Set a root password and complete purchase
  5. Wait for the provisioning email (3–15 minutes). It contains your IP address and credentials.
Save these You need two things from this step: your server IP address and your root password. Keep them somewhere safe. You'll need both in the next step.

Step 2 — Connect to Your Server

SSH (Secure Shell) lets you type commands on your remote server from your own computer. Think of it as a remote control for your VPS.

Windows

Using PowerShell

Open PowerShell (search "PowerShell" in your Start menu), then type:

ssh root@YOUR_SERVER_IP

Replace YOUR_SERVER_IP with the actual IP from Step 1. If it asks "Are you sure you want to continue connecting?" type yes and press Enter. Then enter your root password. Characters won't appear as you type — that's a security feature, not a bug.

Mac

Using Terminal

Open Terminal (search "Terminal" in Spotlight), then type the same command:

ssh root@YOUR_SERVER_IP
Mobile

Using Termius

Download Termius from the App Store or Google Play. Add a new host with your server IP, username root, and your password. Tap Connect.

You're connected when you see a prompt like:

root@ubuntu:~#

Step 3 — Deploy Forge

Three commands. The script handles everything else.

apt update && apt install -y git
git clone https://github.com/HodgeLuke/forge-dev.git
cd forge-dev && bash deploy.sh

The script will ask for:

PromptWhat to enter
Cloudflare API TokenThe token from Cloudflare API Token setup
DomainYour domain on Cloudflare (e.g., yourdomain.com)
SubdomainWhat goes before the domain (e.g., agent for agent.yourdomain.com)
EmailYour email — becomes the Zero Trust identity gate
Proceed?Type Y

The script runs 11 automated steps. Each shows a green ✓ on success. On completion, you'll see:

✓ FORGE DEPLOYMENT COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Your Agent
  URL: https://agent.yourdomain.com
  Password: [auto-generated]
Security Layers Active
  ✓ Cloudflare Tunnel
  ✓ Zero Trust Access
  ✓ OpenCode server password
  ✓ UFW firewall
  ✓ fail2ban + kernel hardening
Important Copy your URL and password immediately. The password is generated once. You can always retrieve it later with: cat /root/.forge-credentials

Step 4 — Access Your Agent

  1. Open the URL from the deployment output in any browser
  2. Cloudflare Zero Trust asks for your email — enter the email you configured
  3. Check your inbox for a verification code and enter it
  4. The OpenCode interface asks for a password — enter the generated password
  5. You're in. Your AI coding agent is live.
First task to try Type: List all files in the current directory and explain what each one does. — This confirms the agent is working and can read the filesystem.

MCP Server Configuration

MCP (Model Context Protocol) connects your agent to external tools and services. Forge ships with 7 pre-configured servers:

ServerWhat it doesAuth type
Cloudflare APIManage Workers, DNS, TunnelsOAuth (browser)
Cloudflare BindingsD1 databases, KV, R2 storageOAuth (browser)
Cloudflare DocsSearch Cloudflare documentationNone (ready)
Cloudflare ObservabilityLogs, analytics, monitoringOAuth (browser)
GitHubRepos, issues, PRs, code reviewAPI token
SupabaseDatabase access, auth, storageAPI token
Brave SearchWeb search from the agentAPI key

Cloudflare servers use OAuth — the agent will prompt you to authorize in your browser on first use. GitHub, Supabase, and Brave Search use API tokens configured during setup.

Agent Templates

Four pre-built agent templates ship in the agents/ folder:

TemplateRolePermissions
wcag-auditor.mdWCAG 2.2 AA accessibility checkerRead-only
security-reviewer.mdVulnerability scanner with CWE refsRead-only
deployer.mdCloudflare deployment specialistWrite (scoped to CF)
docs-writer.mdTechnical documentation generatorWrite

Use them by referencing @agent-name in your OpenCode session. Each template contains standing instructions, scope boundaries, and output format rules.

Creating a Cloudflare API Token

  1. Go to dash.cloudflare.com/profile/api-tokens
  2. Click Create Token
  3. Click "Get started with a custom token" (bottom option)
  4. Add these permissions:
    • Account → D1 → Edit
    • Account → Cloudflare Workers Scripts → Edit
    • Account → Cloudflare Tunnel → Edit
    • Account → Access: Apps and Policies → Edit
    • Zone → DNS → Edit
  5. Account Resources: Include → your account
  6. Zone Resources: Include → your domain (or All zones)
  7. Click Continue → Create Token
  8. Copy immediately — Cloudflare only shows it once
Security Never paste your API token into an AI chat. The deploy.sh script prompts for it securely. The token is stored in environment variables on your VPS and never logged.

Useful Commands

# Check agent status
systemctl status opencode

# Check tunnel status
systemctl status cloudflared

# View agent logs (live stream)
journalctl -u opencode -f

# Restart the agent
systemctl restart opencode

# Restart the tunnel
systemctl restart cloudflared

# View your credentials
cat /root/.forge-credentials

# Terminal access (bypasses browser)
OPENCODE_SERVER_PASSWORD='YOUR_PASS' opencode attach http://127.0.0.1:4096

Troubleshooting

Error 1033 — Cloudflare Tunnel error

The tunnel isn't connected. Check its status:

systemctl status cloudflared
journalctl -u cloudflared -n 20

If you see "Unauthorized" — the API token may have been rotated since deployment. Re-run bash deploy.sh with a fresh token.

Permission denied when cloning the repo

Either you haven't accepted the GitHub invitation (check email from HodgeLuke), or you're using your GitHub password instead of a Personal Access Token. GitHub requires tokens for command-line access — create one at github.com → Settings → Developer settings → Personal access tokens.

Zero Trust keeps asking for email

The WebSocket/Zero Trust cookie conflict. In your Cloudflare dashboard → Zero Trust → Settings → enable "Binding Cookie" and set "SameSite Attribute" to "None."

Agent is slow or unresponsive

systemctl restart opencode
journalctl -u opencode -f

Most common cause: no LLM API key configured. OpenCode needs at least one provider key (OpenAI, Anthropic, Google, etc.) to function. Configure it in the OpenCode settings once you're logged in.

Security Model

Forge implements 5 layers of defense-in-depth, addressing CVE-2026-22812 (CVSS 8.8, unauthenticated RCE) and CVE-2026-22813 (CVSS 9.6, XSS-to-RCE). Every layer is automated by the deployment script.

LayerWhat it doesAddresses
1. Cloudflare TunnelOutbound-only encrypted connection. No open ports. No public IP.Network exposure
2. Zero Trust AccessIdentity gate. Only your email reaches the agent.Unauthorized access
3. Server Auth192-bit password on the OpenCode server.Direct server access
4. Host HardeningUFW firewall, fail2ban, kernel hardening, SSH key-only.OS-level attacks
5. Scoped PermissionsPer-agent MCP restrictions. Read-only auditors.Agent blast radius