/acf-whip:clean-checkout-before-taskfrom acf-whip
Mandatory first step for any agent that mutates code. Resolves the task's Worktree slug, lazy-creates an isolated git worktree on a derived branch, validates the branch, hydrates the dev env from .worktreeinclude, stashes unrelated changes, and logs the clean-checkout token. Gives each task its own index and branch, so tasks do not bundle each other's commits and rarely contend on index.lock.
Ships in acf-whip. 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.
Concurrency primitive for the agents that work on acf-whip tasks. Every implementer and reviewer runs it before any edit, commit, or state move.
All the logic lives in one script,
${CLAUDE_PLUGIN_ROOT}/skills/clean-checkout-before-task/bin/clean-checkout.sh, with its lock
backoff in the shared skills/lib/acfw-git.sh. This skill wraps it so the legacy /go path and the
whip-go workflow run the same code. Run:
bash "${CLAUDE_PLUGIN_ROOT}/skills/clean-checkout-before-task/bin/clean-checkout.sh" "$TASK_FILE"
$TASK_FILE is the absolute path to the task markdown: the live file in .backlog/pending/ or
in-progress/ on the files store, or the spec acfw-store read --materialize wrote on any other
store. On success the script prints the worktree path on stdout and sends all git output to
stderr. cd into that path and do all further work there.
Git is the lock. git worktree add -b worktree/<slug> fails when the branch already exists, a
re-attach fails when the branch is already checked out in another worktree, and that failure is the
mutual exclusion. There is no lock file, daemon or scheduler.
Worktree: slug from the task front-matter (missing → exit 1 for code tasks). Only
the first Worktree: line counts, so a store comment appended to a materialized spec that
repeats the field cannot change the slug.$ACFW_TRUNK_ROOT / $ACFW_TRUNK_BRANCH (set by /go), else from git. Run from inside a task worktree, that is the root that owns it, never the worktree..worktree/<slug> on worktree/<slug> from the local trunk, and record the fork
base (refs/acfw/forkbase/<slug> = the trunk SHA the branch's code sits on). If the branch
already exists but its directory is gone (a reaped worktree, or one an older release made), the
script re-attaches the branch as it is, with its commits, instead of failing. It never resets or
rebases it, and it does not record today's trunk tip as its fork base: step 6 backfills
merge-base when no fork base is recorded..worktreeinclude (the script's Step 3.5). This
copies or symlinks untracked dev files such as .env and node_modules, so the worktree can run
the full dev environment. No manifest, no hydration. See hydrate-worktree.sh.worktree/<slug> (any other branch → exit 3).merge-base for a worktree
created before 3.0.0. Nothing is rebased, snapshotted or re-aligned (LP-CAS, 3.0.0). The branch
holds the task's commits on top of the fork base, and integrate-lpcas applies that change
to the live trunk at integration time. Before 3.0.0 the branch was rebased onto a cached
refs/acfw/trunk-snapshot, and on a rewritten trunk that snapshot stopped advancing and froze
every worktree's base. The snapshot and the rebase are both gone.You can run hydration by itself against an existing worktree: one made by a bare
git worktree add, or one whose .env/node_modules you want refreshed after editing
.worktreeinclude.
bash "${CLAUDE_PLUGIN_ROOT}/skills/clean-checkout-before-task/bin/hydrate-worktree.sh" <REPO_ROOT> <WORKTREE_PATH>
It is safe to re-run. Targets that already exist are skipped, and a missing manifest does nothing.
| Caller | When |
|---|---|
Implementer (the task's installed agent, or whippet with its role skill) | Step 0, before reading task implementation requirements. Once per attempt: the script is not reentrant, so a subagent never runs it again in the same worktree |
| quality-reviewer | Before moving the task to .backlog/in-review/ (idempotent: re-logs a fresh token) |
| task-engineer | Never. It works only on .backlog/ at the repo root on trunk. |
| research-agent, lean-architect, retro, precommit | Only if the task mutates code outside docs/. |
| Exit | Cause | Caller action |
|---|---|---|
| 0 | success (worktree path on stdout) | cd into it; proceed |
| 1 | Worktree: field missing on a code task | Send back to task-engineer; do not pick up |
| 2 | branch in use elsewhere (lock held); stderr names the worktree it is checked out in | Defer; try a different task. If that worktree's directory is gone, git worktree prune clears it |
| 3 | worktree on the wrong branch | Stop; manual intervention |
| 5 | trunk branch not resolvable (detached HEAD) | Operator must check out a branch at root |
| 6 | the durable clean-checkout token could not be written to a non-files task store | Transient; orchestrator retries next iteration |
| 8 | ACFW_TRUNK_ROOT names a task worktree, not a trunk | Stop; no retry can help. The message names the real root |
| 99 | lock contention persisted through the backoff (three attempts) | Transient; orchestrator retries next iteration |
| <UTC ts> | clean-checkout | ok | clean-checkout-before-task | <slug> | <branch> |
The agent field is the literal clean-checkout-before-task. The script hard-codes it rather than
deriving it from its own path, which would give clean-checkout.sh. Quality-reviewer rejects any
task in .backlog/in-review/ whose transition log lacks at least one clean-checkout | ok line.
On a non-files store the script also writes the token to the task store, because the next
read --materialize rewrites the spec it appended to. Exit 6 means that write failed.
Each worktree has its own index, so agents do not share one index.lock and a pre-commit stash
cannot bundle another task's changes. When two agents race to create the same slug's worktree, the
first wins and the second gets exit 2 and defers. That exclusion covers creation only. Against a
worktree that already exists the script passes the branch check and stashes whatever is uncommitted
there, including the work of an agent still writing in it. When two worktrees change the same
lines, the conflict surfaces at integration: integrate-lpcas hands it to a resolver instead of
dropping it silently.
Last Updated: 2026-09-29
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub fib7/acf-tools --plugin acf-whip13 skills in this plugin
/goContinuous backlog execution until 100% of tasks reach a terminal state (accepted/blocked)/integrate-lpcasLP-CAS integrator. Lands one accepted task's single-parent candidate on the live trunk by cherry-picking it, co-committing an in-tree ledger marker, gating the union tree, and CAS-updating trunk. A task counts as integrated when its marker is in the live-trunk tree, never because of a markdown field. Only /go's orchestrator invokes it; the agents that implement tasks never do./researchResearch a topic with MCP tools (Perplexity, Context7, Figma), write a temporal (YYYYMMDD-dated) research document, and generate a backlog task from the findings/retroClose a planned acf-whip cycle, and learn from it when something went wrong. A clean cycle closes in one script call with zero agents. When a trigger fired (a task reworked, a task stuck, a deliverable not met), a retro agent writes the frozen analysis, at most 3 one-rule lessons, and a retro-actions cycle you approve like any plan. Works on every task store. It never creates tasks or edits agent files or role skills, and it leaves deleting a lesson to you./taskDecompose a scope into atomic tasks using task-engineer agents. It only orchestrates and never implements anything./whipThe front door of the acf-whip cycle (PLAN, DECOMPOSE, BUILD, VERIFY, RETRO). Bare /whip says where you are and prints the one command to run next. /whip "<goal>" sends small work straight to /task and risky work to a plan you approve with one yes, which then starts /task --plan itself. /whip <file.md> adopts a plan written anywhere else. Spec tools (plan reviewers and workbenches) run through it too: --review, --push, --pull, --from, --tools. /whip --auto "<goal>" runs the whole loop hands-off until a judge finds the condition met. Use it to start work, to find out what to run next, to approve, amend or abandon a plan, or to start or stop an autopilot run.