Ship while you sleep
Ship while you sleep is an autonomous-agent pattern in four moves: the agent writes the spec with you, splits the work into isolated workspaces (a real clone and a port block per sub-task), an E2E agent finds the root cause and self-corrects until 3 clean runs in a row, and you come back to something 99% prod-ready with everything documented.
Leave big goals running and come back to something 99% prod-ready. This is the pattern we use at 021 to work with autonomous agents — plus the answers to the questions I got the most when I shared it.

I built an interactive site that explains the full pattern, with terminals and diagrams: ship.alonsogrimaldo.com
The problem: you are the loop
You ask the agent for something big, it comes back half-done, you repeat the context. Two agents in parallel step on each other's files, branches and ports. You test by hand, find the bug, explain it, repeat. You end up babysitting every step.
The way out isn't a framework: it's structure. Each piece takes one decision out of your hands and gives it to the agent, with guardrails so nothing breaks.
The pattern: four moves
- 1 · Iterate → prompt. The agent discusses the goal with you and writes the spec before touching code.
- 2 · Split → workspace. If the task is big, it splits it and creates an isolated workspace per sub-task: a real clone of every repo it touches and a dedicated port block. Two agents in parallel never share files, branches or ports.
- 3 · E2E agent. Tests in the browser, finds bugs, analyzes the root cause (not the symptom), applies the fix and tests again. The E2E is only done after 3 clean runs in a row — any fix resets the streak.
- 4 · You come back ready. Screenshots, feedback and fixes documented in a per-task reports folder.
Why clones and not worktrees?
The question I got the most. I started with worktrees: fine with one agent; with several autonomous ones running at once, corrupted files and branch cross-overs started. The root problem is that worktrees share the same .git:
- An agent running
gc --prune,reset --hardorbranch -Dcan affect all worktrees. - Git won't check out the same branch in two worktrees → nasty edge cases when two autonomous agents cross paths.
- Config and hooks are inherited from the parent: one agent touching them affects everyone.
With real clones from a local bare mirror, cloning is instant and each task is 100% isolated — including its own no-push hook against staging/main. And no heavy framework: bash + git, a thin helper layer that in one command clones, branches, renders the env, assigns ports and installs the hook. Full detail in worktrees vs clones.
The handoff matters more than verbosity
How detailed should the prompt be? It's not length: it's giving the agent a way to verify its iterations, and a handoff that's specific on the WHAT / WHY / criteria, loose on the HOW. What I hand over per front:
- Observable symptom.
- Root cause verified against the code, with
file:line— the most important part: it removes ambiguity, no re-discovery. - Fix direction + constraints ("do NOT build X", "reuse Y") — not line by line.
- Exact files: main one + which to reuse / not touch.
- Testable acceptance criteria.
- Repo conventions.
## Symptom
checkout doubles the discount with 2 coupons
## Root cause (verified)
web/lib/cart.ts:142 — recalculates the total
without clearing the previous discount
## Fix + constraints
accumulate in a single pass.
Do NOT build a new promo system;
reuse applyDiscount()
## Acceptance criteria
- 2 coupons → 1 discount each
- test:e2e checkout greenAnd I split big goals into disjoint fronts — files that never overlap — to run them in parallel, each with its own verification loop. Each front lives in its own session (Claude / Codex GUI) and I rotate between sessions like tabs: to review progress, not to babysit.
The result
What matters isn't the exact commands — it's the structure: isolate to scale, protect what's critical, and make the agent close its own quality loop.
FAQ
What is the ship-while-you-sleep pattern?
An autonomous-agent workflow in four moves: the agent iterates the goal with you and writes the spec; it splits the work into fully isolated workspaces (a real clone per sub-task, dedicated port block); an E2E agent tests in the browser, finds the root cause and self-corrects until 3 clean runs in a row; and you come back to screenshots, feedback and documented fixes — usually 99% prod-ready.
How detailed does a prompt for an autonomous agent need to be?
It's not about length: it's about giving the agent a way to verify its iterations. A good handoff is specific on the WHAT, the WHY and the acceptance criteria, and loose on the HOW: observable symptom, root cause verified with file:line, fix direction with constraints, exact files, and testable criteria.
When is a task's E2E considered done?
Only after 3 clean browser runs in a row. Any fix resets the streak: if the agent touched code, it tests again from scratch.