/long-haul:long-haulfrom long-haul
Drives a long-horizon goal loop: sharpens specs, defines verifiable goals, then runs explore/exploit cycles in git worktrees until the goal holds. For sustained multi-turn tasks.
Ships in long-haul. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The orchestrator: the interactive Claude session the user runs. It drives a four-phase arc that forces work across the long horizon — a loop that does not stop until a measurable goal holds. You advance automatically, halting only at two human gates.
The phases are sibling skills; invoke each in turn:
haul-spec — turn the ask into a well-defined spec with a transcript-demonstrable success signal and a declared toolbox (the skills + MCP the haul may use). If the ask is vague, grill it first.haul-goal — forge a /goal-ready completion condition from the spec. GATE: user approves + runs /goal.haul-loop — each /goal turn, run one round: decide explore vs exploit, implement the attempt in a worktree, keep it only if it beats the incumbent. Repeat until the goal clears.haul-ship — once the goal clears (or the cap trips), report goal-vs-achieved and open a PR. GATE: user confirms.You are the orchestrator and the implementer. Unlike a race, there is one pair of hands — yours. The leverage is not a second agent; it's the explore/exploit discipline and the ratcheting incumbent that keep a long run from drifting.
/goal <condition> is a Claude Code built-in (v2.1.139+): it sets a completion
condition, and after every turn a fast model checks the transcript to decide
whether it holds. If not, it starts another turn automatically; when it holds,
the goal auto-clears. Two consequences shape this skill:
/goal, /grill-me, or /implement yourself. Where the arc needs one, you either run its model-invocable equivalent (the grilling skill) or follow its contract inline (the /implement contract, executed by you inside each /goal turn). /goal itself is a hard gate — haul-goal produces the exact line and the user runs it.haul-loop must surface the goal's stated check output in chat. A goal whose proof never lands in the transcript loops forever.Once /goal is active it re-invokes you turn after turn. Your standing job each
turn is at most one haul-loop round — ROUND in STATE.md is the source of
truth, so a turn that does zero or (accidentally) two doesn't desync the count.
When the condition is met haul-loop records STATUS: GOAL-MET and the goal
clears — then proceed to haul-ship.
digraph long_haul {
"Init .longhaul/, record PHASE" [shape=box];
"haul-spec -> SPEC.md" [shape=box];
"haul-goal -> GOAL.md" [shape=box];
"GATE: user approves + runs /goal" [shape=diamond];
"haul-loop: 1 round this turn (explore|exploit)" [shape=box];
"Goal met? (/goal cleared)" [shape=diamond];
"haul-ship -> SUMMARY.md + PR" [shape=doublecircle];
"Init .longhaul/, record PHASE" -> "haul-spec -> SPEC.md";
"haul-spec -> SPEC.md" -> "haul-goal -> GOAL.md";
"haul-goal -> GOAL.md" -> "GATE: user approves + runs /goal";
"GATE: user approves + runs /goal" -> "haul-loop: 1 round this turn (explore|exploit)" [label="approved"];
"haul-loop: 1 round this turn (explore|exploit)" -> "Goal met? (/goal cleared)";
"Goal met? (/goal cleared)" -> "haul-loop: 1 round this turn (explore|exploit)" [label="no (next /goal turn)"];
"Goal met? (/goal cleared)" -> "haul-ship -> SUMMARY.md + PR" [label="yes (or cap hit)"];
}
<REPO>/.longhaul/STATE.md exists, read PHASE/STATUS and jump to that phase — do not restart. Otherwise create .longhaul/ under the target repo (REPO, resolved in preflight), append .longhaul/ to its .gitignore, write STATE.md (PHASE: spec, STATUS: ACTIVE: orchestrator, ROUND: 0, ROUNDS: 8, MODE: -, STALL: 0, STALL_CAP: 2, INCUMBENT: none, SCORE: none, REPO: <abs path>, BASE: <REPO's git short-sha>, GATES: approve_goal=required confirm_pr=required, GOAL: pending), and record the user's ask.PHASE as you cross each boundary so a re-invocation resumes cleanly. If the user gave no ask, don't enumerate the spec questions yourself — go straight into haul-spec, which collects them via tabbed AskUserQuestion calls.Everything a later phase needs, checked before it's too late to fix cheaply. A hard failure stops the run; a soft one is flagged with the phase it will block at — say "this will block at X" rather than letting the user discover it after they've disconnected.
git rev-parse --git-dir. Worktrees need it. Missing → stop.REPO; all .longhaul/ state, BASE, worktrees, the incumbent branch, and the eventual PR live under it, not cwd. Default REPO to cwd's repo toplevel when they're the same.REPO, gh pr view for the current branch, else gh pr list --search. Echo the resolved PR (number, title, base) back for confirmation before sharpening — the branch you're on may have no PR while a sibling branch at the same SHA does.haul-ship opens a PR, so verify now, not at the end: gh present + authed (gh auth status), REPO's remote reachable, push permission. Missing → soft-flag "blocks at haul-ship".--background). An unattended haul that hits any interactive stop parks until a human returns, so confirm the whole path is clear:
/goal only auto-runs turns with it; otherwise every tool call prompts. (Foreground only.)/goal is off under disableAllHooks / allowManagedHooksOnly.confirm_pr=auto in GATES — the default required parks forever before the PR.check.sh written, haul_bg_start available (reference/haul-bg.sh), host stays powered.
Any unmet item → name it and the step it blocks at.GOAL.md) — →
say so plainly ("this haul will incur prod compute at the acceptance gate"), so
the user opts into the cost before the loop, not after a surprise bill. A long
autonomous run that fires paid infra is not bounded by the per-round worktree.| Gate | When | What you do |
|---|---|---|
| approve-goal | after haul-goal | Show GOAL.md's condition and the /goal … line. Wait for the user to edit/approve and to actually run /goal. Do not start hauling until the goal is active. |
| confirm-pr | in haul-ship | Show the branch name + commit list + PR body. Only push/open after the user confirms — unless GATES sets confirm_pr=auto. |
Set STATUS: WAITING-USER: <gate> while waiting so a resume knows it's parked on a human.
Gate policy. GATES in STATE.md sets each gate's mode. approve_goal is
always required — only the user can run /goal. confirm_pr is required
(default — haul-ship parks for a yes) or auto (for an unattended finish —
haul-ship opens a draft PR without parking and never pushes to a protected or
default branch). Set confirm_pr=auto only once the user has accepted an
unattended finish.
Each phase's mechanics live in its own skill — invoke it, don't reimplement it:
haul-spec writes SPEC.md (the deliverable, the success signal, the toolbox, constraints).haul-goal writes GOAL.md (+ the /goal line) from SPEC.md.haul-loop runs one explore-or-exploit round per /goal turn against GOAL.md, writes R<N>.md, and ratchets the INCUMBENT.haul-ship writes SUMMARY.md, then commits on a branch and opens the PR.State-file templates live in reference/file-formats.md.
haul-loop sets STATUS: GOAL-MET → haul-ship → user confirms → PR opened → STATUS: DONE.haul-loop's own stopping conditions): it sets STATUS: WAITING-USER: cap-decision and surfaces a partial against the incumbent. Decide with the user whether to raise ROUNDS, accept (→ haul-ship), or stop. (Definitions live in haul-loop; don't restate them here.)/goal unavailable: STATUS: BLOCKED: <reason>, surface, stop.git worktree prune)./long-haul with an existing .longhaul/: read STATUS. First check
.longhaul/bg.pid — if it names a live process, a background driver owns the
haul; this session is read-only. Show haul_bg_status (tail of PROGRESS.log)
and either watch or haul_bg_stop before taking over. Otherwise dispatch on STATUS:
ACTIVE: orchestrator → resume the phase named by PHASE (spec→haul-spec, goal→haul-goal, haul→haul-loop, wrap→haul-ship) from the top; the phases are re-entrant (e.g. a haul interrupted mid-grilling just re-asks).WAITING-USER: <gate> → re-present that gate (approve-goal, confirm-pr, or cap-decision).HAULING: R<n> → an attempt may be mid-flight in .longhaul/attempt/; check it, judge if done, else continue it. Don't start a second attempt for the same round.GOAL-MET → the loop is done and the goal holds; go straight to haul-ship.BLOCKED → report what's blocked.DONE → show SUMMARY.md.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub ccomkhj/skills --plugin long-haul5 skills in this plugin
/haul-goalPhase 2 of long-haul. Turn .longhaul/SPEC.md into a /goal-ready completion condition — one measurable end state, a stated transcript-demonstrable check, the constraints that must hold, and a round cap — written to .longhaul/GOAL.md plus the literal /goal line for the user to run. If the end state isn't clear or measurable, iterate with the user one question at a time until it is. Use after haul-spec, or standalone to craft a good /goal condition from a clear spec./haul-loopPhase 3 of long-haul — the per-turn loop. Under an active /goal, each turn run exactly one round: decide explore (a fresh approach off the base commit) vs exploit (refine the incumbent), implement the attempt in a git worktree following the /implement contract, run the goal's stated check, and keep the attempt only if it beats the incumbent — a ratchet that never regresses. Writes R<N>.md, surfaces the check output in chat. Pass --background to detach the whole haul into a nohup'd driver that survives terminal/session close (for overnight/remote runs), logging a structured block per loop to PROGRESS.log. Use as the iteration phase of a long-haul run./haul-shipPhase 4 of long-haul — the finishing move. Fires once the /goal condition is met (the goal auto-clears) or the round cap trips. Reports goal-vs-achieved with the final check output, the explore/exploit path each round took, and the net kept diff; then commits the incumbent on a feature branch and opens a PR. Always confirms the branch and PR body with the user before pushing. Use as the last phase of a long-haul run./haul-specPhase 1 of long-haul. Turn the user's ask into a well-defined spec — a located deliverable, a transcript-demonstrable success signal, the toolbox of skills + MCP the haul may use, constraints, and out-of-scope. If the ask is vague, grill it first. Produces .longhaul/SPEC.md. Use as the first phase of a long-haul run, or standalone to harden a fuzzy ask into something buildable before setting a goal.Other plugins' skills for the same job