One-off hero images are easy; shipping twenty consistent PNGs for Instagram, LinkedIn, X, and Pinterest is where teams bleed time. This playbook is a concrete, repeatable setup for running OpenClaw on a remote Mac: what to install, how to handle API keys and gateways, copy-paste style prompt and shell templates, retry and naming rules, and a folder layout you can diff in git. For broader install context, see our OpenClaw install guide; for PNG-focused automation ideas, see AI PNG processing on Mac.
Table of Contents
Environment prep on the remote Mac
Reproducibility starts with a machine that does not change under your feet. On the rented or dedicated Mac, pin these basics before you touch OpenClaw:
- Shell and paths: Use one login user for batch jobs (e.g.
batch), a fixed$HOME, and absolute paths in configs. Avoid iCloud-synced Desktop folders; use/Users/batch/jobs/or a dedicated volume. - OpenClaw runtime: Install the same OpenClaw version everywhere (Docker tag or pinned release). Record
openclaw --versioninlogs/env-snapshot.txtat the start of each campaign. - Image tooling: macOS
sipsis enough to read width/height after export. Add ImageMagick orpngcheckif you want alpha and chunk audits. Install via Homebrew once and lock the Brewfile in the repo. - Network egress: Confirm the Mac can reach your model API and any storage (S3, R2) without interactive browser login. Run a five-line smoke script that performs one HEAD request and one tiny image job.
If you are still wiring the host itself, the SSH/VNC help pages cover access patterns; MacPng home summarizes rental nodes when you need stable M4 hardware off your laptop.
API keys, gateways, and least-privilege access
Treating the API key like a password is not enough—you also need to contain blast radius when a script leaks or a contractor copies a folder.
- Never in git: Put
.envin.gitignore. On macOS, prefersecurity add-generic-passwordor a small helper that exports env vars for the job session only. - Gateway instead of raw keys on laptops: Run a thin reverse proxy (Caddy or nginx) on the remote Mac or a VPC that adds auth, rate limits, and IP allow lists. OpenClaw calls
https://gateway.internal/v1/...with a short-lived JWT, not the provider master key. - Scoped keys: In the provider console, create keys limited to image endpoints and monthly caps. Rotate after any screen-share where a terminal was visible.
- Logs: Strip Authorization headers from access logs. Write job logs to
logs/run-YYYYMMDD-HHMM.jsonlwith request ids, not full payloads containing secrets.
Apply the same rules to any OpenClaw skill that can read files or call HTTP: whitelist hosts, cap payload size, and disable arbitrary shell execution unless the skill is explicitly reviewed.
Platform size matrix you can paste into config
Social networks change specs often; treat this table as a starting manifest you version in JSON or CSV. Width × height in pixels, PNG, sRGB.
| Platform / placement | Size (px) | Notes |
|---|---|---|
| Instagram feed (square) | 1080 × 1080 | Safe default; keep important content centered for crop |
| Instagram story / reel cover | 1080 × 1920 | 9:16; leave top/bottom safe zones |
| LinkedIn / X / FB link preview | 1200 × 627 | 1.91:1; text left, logo bottom-right |
| Pinterest standard pin | 1000 × 1500 | 2:3; tall canvas |
Store as manifest.csv with columns platform, width, height, slug. Your batch loop reads one row at a time so adding YouTube thumbnails later is a row, not a rewrite.
Prompt and script templates
LLM image path: Split “what to draw” from “how to export.” Keep a frozen system block and only substitute variables in the user block.
SYSTEM (fixed):
You generate marketing stills. Output: one PNG, sRGB, no border, no watermark.
Always honor exact width and height given. If the tool returns wrong dimensions, respond with ERROR_DIMS and do not claim success.
USER (per row):
Campaign: {{campaign_slug}}
Visual brief: {{brief_one_line}}
Size: {{width}}x{{height}} px
Filename stem: {{campaign_slug}}__{{platform}}__{{width}}x{{height}}
Shell glue (conceptual): A loop reads manifest.csv, calls your OpenClaw CLI or HTTP skill with JSON body {"prompt": "...", "out": "staging/..."}, then runs sips -g pixelWidth -g pixelHeight on the result. Only on match does mv into out/. This is the same control flow whether the model runs locally or via API.
Retries, validation, and naming
Batch jobs fail for boring reasons: rate limits, TLS blips, model refusals, wrong aspect ratio. Make failure boring too.
- Retry policy: Exponential backoff with jitter: 2s, 4s, 8s caps at 60s; max 5 attempts per asset. Count 429 and 5xx as retryable; 400 with policy violation is not—log and skip.
- Dimension gate: After each write, assert
width == expected && height == expected. On mismatch, move file tofailed/dim-mismatch/and append a JSON line tologs/errors.jsonl. - Naming convention:
{{campaign_slug}}__{{platform}}__{{width}}x{{height}}.png— double underscore separates token layers; lowercase; hyphens inside slugs only. Avoid spaces and localized characters so CI and CDNs stay happy. - Idempotency: Include a content hash or brief checksum in a sidecar
.meta.jsonif you regenerate often, so you can tell whetherout/foo__ig__1080x1080.pngis stale.
out/ in place during a run. Write to staging/, validate, then atomic rename into out/ so a half-written PNG never ships.
Folder output convention
Use one tree per campaign so designers, PMs, and scripts all speak the same language:
~/jobs/{{campaign_slug}}/
manifest.csv
inbox/ # optional source PSD/exports
staging/ # raw model output, disposable
out/ # validated PNGs ready for upload
failed/ # dim errors, policy blocks, corrupt files
logs/ # jsonl run logs, env snapshot
archive/ # zip of out/ + manifest for handoff
At end of day, zip -r archive/{{campaign_slug}}-$(date +%Y%m%d).zip out manifest.csv logs/env-snapshot.txt gives auditors a reproducible bundle. If you need watch-folder rename steps after this stage, chain the flow from our watch-folder PNG rename guide.
When you outgrow a single Mac, the same manifest and naming rules move to a queue worker; only the executor changes.
Run this playbook on dedicated M4 hardware
Stable macOS, fixed egress, and room for heavy batches—without tying up your primary machine. Browse Tech Insights, then reserve a node.