AutomationCommercialFreeActiveMachine-verified· intermediate · ~5 min setup

Claude Code Cloud Schedule: Runs With Your Laptop Off

Schedule Claude Code on Anthropic-managed infra at 1-hour-or-coarser cadence, pushing only to claude/ branches.

by Shilpa Mitra· verified today· v1.0.0

Run this workflow

CI-verified, 4/4 fixtures passing.

Intended Use

Scheduling Claude Code on Anthropic-managed infrastructure so it runs with your laptop off, at one-hour-or-coarser cadence, pushing only to claude/-prefixed branches by default.

Not for

  • Sub-hourly cadence, the cloud minimum interval is 1 hour
  • Work that needs your local files, cloud runs clone fresh
  • Prompts that assume a human will answer mid-run, cloud runs are autonomous

The Stack

Tested Against

claude-code@2.1.72node@20.x

Side effects & data flow

Network
none, local only
Writes
./cloudcron.mjs
Credentials
none required

Steps

  1. 1

    Create the cloud schedule

    Create one at claude.ai/code/routines or with /schedule in the CLI. The minimum interval is 1 hour, and each run can only push to claude/-prefixed branches by default, so a bad run cannot touch main.

  2. 2

    What CI checks: the interval is 1-hour-or-coarser and the branch restriction is kept

    CI rejects a sub-hourly expression like */30 * * * * (a single-integer minute fires at most hourly; a wildcard or step minute fires sub-hourly) and confirms the config keeps the default claude/ branch prefix. No model runs.

    cat > cloudcron.mjs <<'EOF'
    // Cloud routines require >= 1 hour granularity: a single-integer minute fires at
    // most hourly; '*' or '*/n' or lists fire sub-hourly and are rejected.
    function granularityOK(expr){
      const f = expr.trim().split(' ').filter(Boolean);
      if (f.length !== 5) return false;
      const minute = f[0];
      return minute.length > 0 && [...minute].every(c => c >= '0' && c <= '9');
    }
    if(!granularityOK('0 9 * * 1-5')){ console.log('FAIL valid rejected'); process.exit(1); }
    console.log('VALID (>=1h): 0 9 * * 1-5');
    if(granularityOK('*/30 * * * *')){ console.log('FAIL sub-hourly accepted'); process.exit(1); }
    console.log('REJECTED (sub-hourly): */30 * * * *');
    const config = { branchPrefix: 'claude/' };
    if(config.branchPrefix !== 'claude/'){ console.log('FAIL branch restriction'); process.exit(1); }
    console.log('branch restriction kept: ' + config.branchPrefix);
    console.log('cloud schedule check OK');
    EOF
    node cloudcron.mjs
  3. 3

    Let the cloud run it (the model step, not checked by CI)

    The scheduled run is fully autonomous on Anthropic infra. That run invokes the model and is non-deterministic, so it is fenced: CI verifies the cadence and the branch safety, never the run's output.

Eval, 4 fixtures

Last passed: verified today
  • coarse-acceptedcontainstimeout 30s · max $0

    Expected: VALID (>=1h): 0 9 * * 1-5

  • subhourly-rejectedcontainstimeout 30s · max $0

    Expected: REJECTED (sub-hourly): */30 * * * *

  • branch-keptcontainstimeout 30s · max $0

    Expected: branch restriction kept: claude/

  • clean-exitexit_codetimeout 30s · max $0

    Expected: 0

Results

The top tier: no machine required; each run clones fresh and is restricted to claude/-prefixed branches by default.

Did this work for you?

Our CI checks the setup runs. You tell us if the whole thing worked. Tell us straight.

Liked this workflow?

Get new verified workflows in WebAfterAI, three issues a week (Tue, Thu, Sat).