Skip to content

verkyyi/always-on-claude

Repository files navigation

Always-On Claude Code

Your own persistent AI coding workspace on AWS. SSH in from any device, reconnect where you left off, and run Claude Code or Codex inside the same environment.

~$14/mo on AWS. One slash command to set up.


The Problem

Running Claude Code locally... Always-On Claude Code
Dies when your laptop closes Runs 24/7 on a server or Mac
Tied to one machine SSH from laptop, phone, tablet
Session lost on disconnect Reconnect and pick up where you left off
No background tasks Claude keeps working while you sleep

Two Options

Hosted Cloud (AWS EC2)
Best for Zero setup, no AWS needed Dedicated remote server
Cost $39/mo ~$14/mo (EC2 + EBS)
Setup Pay and connect /provision
Teardown Cancel subscription /destroy
Networking Public IP Public IP or Tailscale
You manage Nothing AWS account + instance

Hosted

Don't want to manage infrastructure? Always-On Claude Hosted gives you a fully managed workspace — no AWS account, no Docker, no setup. Pay, get an SSH key, connect.


Quick Start

Prerequisites

  • Claude Code CLI installed (npm install -g @anthropic-ai/claude-code)
  • Claude auth for provisioning slash commands — either a subscription (Pro/Max) or an API key (ANTHROPIC_API_KEY)
  • AWS account with CLI configured (brew install awscli && aws configure)

The runtime workspace itself supports both Claude Code and Codex. Set DEFAULT_CODE_AGENT=codex before install/provision (or export it on the workspace host) if you want the SSH workspace picker to launch Codex by default. On provisioned hosts, first-run onboarding now guides Codex users through codex --login; on remote SSH hosts that means completing the device-code browser step Codex shows to sign the workspace into ChatGPT for subscription-based access. Codex auth can also use OPENAI_API_KEY. Provisioned hosts also set Codex defaults to approval_policy = "never" and sandbox_mode = "danger-full-access" in ~/.codex/config.toml, and re-materialize repo-managed Codex home state like ~/.codex/AGENTS.md, custom skills, MCP wrappers, and selected repo .codex/ templates from this repo on install/update.

1. Clone and provision

git clone https://github.com/verkyyi/always-on-claude.git
cd always-on-claude
claude

Inside the Claude Code session:

/provision

Claude walks you through the entire AWS setup — SSH keys, security groups, instance launch — and connects you in ~40 seconds.

2. Connect

ssh claude-dev

On first login, the workspace walks you through setup — git config, GitHub auth, preferred assistant auth, and cloning your first repo. After that, you'll see a workspace picker to launch Claude Code or Codex in any repo. Press t in the picker to toggle which assistant is the default for future launches.

3. Tear down when done

Back in your local Claude Code session:

/destroy

Slash Commands

All lifecycle operations run from inside a Claude Code session in this repo:

Command What it does
/provision Launch a new workspace on AWS (~40s)
/destroy Tear down all AWS resources
/update Apply updates to a running workspace
/tailscale Set up Tailscale for private SSH
/workspace Manage repos and git worktrees
/host-schedule Schedule one-off or recurring container commands through the host

The lifecycle control plane is still Claude-based for now. Codex is supported inside the provisioned workspace for repo work, onboarding, and SSH-launched coding sessions.


What You Get

Your Mac / Phone / Tablet
    │
    └── SSH
         └── Ubuntu 24.04 (EC2 t4g.small, 20GB)
              ├── Docker container (claude-dev)
              │    ├── Claude Code + Codex
              │    ├── Node.js 22, Bun, npm
              │    ├── Git, GitHub CLI, AWS CLI
              │    └── Your project repos
              ├── tmux (session persistence)
              ├── host scheduling bridge (container → atd)
              └── Workspace picker on SSH connect

Everything persists — auth, settings, repos, tmux sessions, Claude/Codex state — all survive container restarts and reconnects.


How It Works

Component Purpose
Pre-built AMI Docker + Claude Code + Codex pre-installed, arm64 + x86_64 (~40s boot)
Docker container Isolated workspace with dev tools, bind-mounted for persistence
tmux Sessions survive SSH disconnects
Login menu SSH in → choose your default assistant, bash, or host shell

Cost

What Cost
EC2 t4g.small (on-demand) ~$12/mo
20GB gp3 EBS ~$1.60/mo
Total ~$14/mo

Stop the instance when not in use to save money. No additional fees — you bring your own Claude or OpenAI credentials.


Script Fallbacks

Destroy has a script fallback for automation:

bash <(curl -fsSL https://raw.githubusercontent.com/verkyyi/always-on-claude/main/scripts/deploy/destroy.sh)

For details, see Deployment.


Further Reading

  • Architecture — Docker, networking, sessions, resource limits, update pipeline
  • Deployment — provisioning, install, config, AMI, portable mode, Tailscale
  • Operations — onboarding, sessions, worktrees, updates, mobile, slash commands
  • CI/CD — all GitHub Actions workflows

License

MIT

About

Always-on Claude Code dev environment on EC2 + Docker Compose (~$22/mo)

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors