/acf-whip:whip-init [--with-specialists] [--backend=<stack>] [--frontend=<stack>]from acf-whip
Initialize ACF Whip backlog workflow in a project (task store, quality gates, agents, role skills, CLAUDE.md sections)
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.
None: SKILL.md is the whole skill.
Sets up the acf-whip backlog workflow in the current project. It has to be run explicitly: the SessionStart hook installs the managed docs and nothing else, so the task store, agents, role skills and quality gates all come from this skill.
.backlog/ directory structure (9 state folders)..claude/agents/ from the plugin's patterns, filled in for this
project's stack rather than copied verbatim. They include whippet, the worker /go runs a task on
when the task's role is a role skill..claude/agents/workflow-architect.md, which acf-whip no longer uses (3.7.0).--with-specialists, also write role skills (.claude/skills/python-engineer/SKILL.md,
react-engineer, ...) for the detected stack, so no separate /whip-add-skills run is needed. It
never writes specialist agent files.docs/agents/ (Priority 1/2/3 structure), one per universal agent that
has a manifest pattern and one per role skill.docs/acf/ (the SessionStart hook keeps the managed ones current).CLAUDE.md, creating the file if needed.ACFW_INTEGRATION_MODE=default in a new project only. An existing pin, or an existing
project's choice to stay unpinned, is never changed.docs/cycles/ (planned
cycles), docs/acf/ (managed docs, refreshed by content digest), .backlog/ (task state) and
.acfwhip/ (config and the LP-CAS ledger). The pre-commit config this skill installs gets a
top-level exclude, and existing ignore files get a line.Steps 4 and 5 copy files (the pre-commit config, gates docs and core docs) from the plugin into the
project. Steps 6, 6.5 and 7 read pattern templates and fill them in for this project. Claude Code
replaces ${CLAUDE_PLUGIN_ROOT} with the installed plugin's path when it loads this skill. If a file
cannot be read, report which one.
Detect the language stack with the plugin's detector (the same one /whip-add-skills runs, so the
two skills never disagree). Run it from the project root. A --backend= or --frontend= flag the
user passed overrides detection for that slot; set FLAGS to those flags verbatim, or leave it empty:
FLAGS='' # e.g. FLAGS='--backend=python'. Only --backend= and --frontend= matter to the detector.
bash "${CLAUDE_PLUGIN_ROOT}/content/quality-gates/detect-stack.sh" "$FLAGS"
It prints one key='value' line per fact, every value from a fixed vocabulary or a validated flag.
Keep them for the later steps; Step 4 re-runs the detector itself with the same FLAGS, because shell
variables do not survive between steps.
| Key | Values | Used by |
|---|---|---|
backend | go, python, nodejs, empty | Step 6.5 backend role skill |
frontend | nextjs, react, vue, empty | Step 6.5 frontend role skill |
node_framework | express, fastify, nestjs, none (plain Node.js) | Step 6.5 {framework} |
node_test_runner | vitest, jest, mocha, node --test, npm test, none | Step 6.5 {test-runner} |
node_typescript | true only with tsconfig.json or a typescript dependency | Step 6.5 {type-checker} |
node_linter | eslint only with an eslint config or dependency, npm run lint, none | Step 6.5 {linter} |
node_formatter | prettier only with a prettier config or dependency, none | Step 6.5 {formatter} |
node_test_cmd, node_lint_cmd, node_typecheck_cmd, node_format_cmd, node_build_cmd | the gate command for that slot (npm test, npm run lint, npx tsc --noEmit, ...), or empty when the project has no such gate | Steps 6 and 6.5: the command slots |
gate_stack | go, python, nodejs, empty | Step 4: which pre-commit config, and the backend's docs/development/quality-gates-<gate_stack>.md |
gates_doc | go.md, python-fastapi.md, nextjs-typescript.md, nodejs.md | Step 4: the backend's gates doc source |
frontend_gate_stack | nodejs whenever frontend is set, else empty | Step 4: the frontend's own docs/development/quality-gates-nodejs.md |
frontend_gates_doc | nextjs-typescript.md, nodejs.md, empty | Step 4: the frontend's gates doc source |
A package.json with no Express/Fastify/NestJS/Next/React/Vue is still a Node.js project:
backend='nodejs', node_framework='none', the test runner read from its "test" script. Never
fill a node_* value the detector did not report: a plain project has no ESLint, no TypeScript and
no build step, and an agent told it does fails every gate.
Each role reads its own gates. One gate_stack cannot serve a polyglot repo: a React app
next to a FastAPI backend would be sent to ruff, mypy and pytest. So the backend role reads
docs/development/quality-gates-<gate_stack>.md and a frontend role reads
docs/development/quality-gates-<frontend_gate_stack>.md, which is always quality-gates-nodejs.md.
When the backend is Node.js too, the two are the same file.
Infrastructure is still read by hand:
# Infrastructure flags: has_docker, has_k8s, has_ci, detected_ci_tool, detected_orchestration, has_monitoring
# Docker: Dockerfile|docker-compose.yml → has_docker=true, detected_orchestration="docker-compose"
# K8s: k8s/|kubernetes/|skaffold.yaml|helm/|charts/ → has_k8s=true, detected_orchestration="kubernetes"
# CI/CD: .github/workflows → "github-actions" | .gitlab-ci.yml → "gitlab-ci" | .circleci/config.yml → "circleci" | Jenkinsfile → "jenkins"
# Monitoring: prometheus.yml|monitoring/|grafana/ → has_monitoring=true
# suggest_devops=true if has_docker OR has_k8s OR has_ci
Use AskUserQuestion to gather preferences:
| Question | Options | Default | Variable |
|---|---|---|---|
| Task Store | files (.backlog/ folders in git), beads (bd issue tracker), multica (multica server), linear (Linear workspace) | files | task_store |
| Priority System | 3-level (high/medium/low) or 5-level (blocker/critical/high/medium/low) | 3-level (smaller projects), 5-level (team > 5) | priority_system |
| Coverage Thresholds | 60% (rapid prototyping), 80% (standard), 95% (critical systems) | 80% | coverage_threshold |
| Quality Gate Strictness | Standard (10 retry attempts), Aggressive (5 retry attempts) | Standard | max_retries |
| DevOps Role Skill | "Yes, create devops" (a devops role skill for Docker/K8s/CI/CD work), "No, skip devops" (add later via /whip-add-skills) | "Yes" if suggest_devops=true, else "No" | create_devops |
Only offer the Task Store question when the user asks about it or a non-files store is already
configured; otherwise skip it. files is the right default for almost everyone.
task_store ≠ files)The task store is pluggable behind an executable adapter contract (see the plugin's
adapters/CONTRACT.md and the mechanics guide adapters/README.md; shipped adapters: files,
beads, multica, linear; third-party adapters drop into .acfwhip/adapters/). For a
non-files store:
.backlog/.acfw-config as the config home).
A new project (no config file yet, no task documents) gets ACFW_INTEGRATION_MODE=default
pinned; an existing project keeps whatever it has, pinned or not. Never write a second pin over
an existing one:
mkdir -p .acfwhip
# Decide "new" BEFORE the first write below creates the file.
new_project=1
if [ -f .acfwhip/config ] || [ -f .backlog/.acfw-config ]; then new_project=0; fi
if [ -n "$(find .backlog -type f -name '*.md' ! -name README.md 2>/dev/null | head -1)" ]; then new_project=0; fi
printf 'ACFW_STORE=%s\n' "$task_store" >> .acfwhip/config
if [ "$new_project" = 1 ]; then
cat >> .acfwhip/config <<'EOF'
# Integration mode. /whip-init pinned `default` because this project was new.
# default accepted work is folded into the LOCAL trunk by LP-CAS (no push, no PR)
# override /go stops at accepted and leaves worktree/<slug> intact; YOU push and open PRs
# Unset = /go decides per run by reading CLAUDE.md/AGENTS.md. Switch to `override` if the repo
# has a protected trunk with review-gated merges. An unrecognized value is FATAL, and a trailing
# "# comment" is part of the value, so keep comments on their own line.
ACFW_INTEGRATION_MODE=default
# Autopilot, off unless set. `on` makes every /whip "<goal>" run hands-off until a judge finds
# the goal met; `approve` also approves the plans a run drafts, and counts only once committed.
# See /whip --auto.
# ACFW_AUTOPILOT=off
EOF
echo "✓ Pinned ACFW_INTEGRATION_MODE=default in .acfwhip/config (new project)"
else
echo "✓ Integration mode left as found (existing project)"
fi
Why pin at all: /whip counts a cycle's deliverable done only once its tasks are on trunk, and
an unpinned project decides the mode per run by reading prose. A run that guessed override never
integrates, so the cycle would never finish. An existing unpinned project gets a /whip card
asking you to pin instead of a silent change.
acfw_resolve_config_file reads the first existing file: .acfwhip/config, then the legacy
.backlog/.acfw-config. A project with both only ever reads .acfwhip/config, so put the pin in
the file the project reads.
Backend env goes in the operator's shell, never in the repo:
bd on PATH, currently built from beads main (optional
ACFW_BEADS_PREFIX). adapters/beads/README.md has the version floor.MULTICA_SERVER_URL, MULTICA_TOKEN, MULTICA_WORKSPACE_ID (optional
ACFW_MULTICA_PROJECT).LINEAR_API_KEY and ACFW_LINEAR_TEAM (team key, e.g. ENG; optional
ACFW_LINEAR_PROJECT, ACFW_LINEAR_LABEL).bash "${CLAUDE_PLUGIN_ROOT}/skills/lib/bin/acfw-store" init
bash "${CLAUDE_PLUGIN_ROOT}/skills/lib/bin/acfw-store" info
On beads, init runs bd init, which creates one commit of its own and appends a
beads section to the project .gitignore. Because bd init commits the whole index, the
adapter refuses with exit 8 when anything is staged. Commit or unstage it first. The
adapter passes --skip-hooks --skip-agents, so bd will not set core.hooksPath or write
AGENTS.md/CLAUDE.md into the repo..backlog/), and in Step 3.5a drop the
.backlog/.acfw-run.json line. Keep the .acfwhip/run/ and .acfwhip/specs/ entries: they
cover the run state on every backend.
Everything else (agents, role skills, quality gates, docs) runs unchanged.Check if .backlog/ already exists:
if [ -d ".backlog" ]; then
echo "⚠️ .backlog/ directory already exists. Skipping directory creation."
echo " Verifying folder structure..."
else
echo "Creating .backlog/ structure..."
fi
Create 9 state folders and .gitkeep files (only if missing):
for folder in draft pending in-progress completed in-review blocked rejected accepted archive; do
mkdir -p ".backlog/$folder"
touch ".backlog/$folder/.gitkeep"
done
Verify structure:
echo "✓ .backlog/ structure verified:"
ls -1 .backlog/ | grep -v README.md | xargs -I {} echo " - {}"
3.5a: gitignore entries. Add the per-task worktree dir (default .worktree/, or the
ACFW_WORKTREE_DIR you set in 3.5c), .backlog/.acfw-run.json (the /go run heartbeat), and the
/go run-state directories to .gitignore. ACF convention: per-task worktrees live at
<repo-root>/.worktree/ and are gitignored (see docs/acf/organization.md → "Per-Task Worktree
Directory").
WT_DIR="${ACFW_WORKTREE_DIR:-.worktree}" # honor a custom dir if .acfw-config sets one
ensure_gitignore() { # <pattern> <comment>
if [ -f .gitignore ] && grep -qxF "${1}" .gitignore; then return; fi
printf '\n# %s\n%s\n' "${2}" "${1}" >> .gitignore
echo "✓ Added ${1} to .gitignore"
}
ensure_gitignore "${WT_DIR%/}/" 'ACF Whip per-task worktrees (clean-checkout-before-task)'
ensure_gitignore '.backlog/.acfw-run.json' 'ACF Whip /go run heartbeat'
ensure_gitignore '.acfwhip/run/' 'ACF Whip /go run state (per-task harness scripts, stage ledgers, /task staging, the run focus)'
ensure_gitignore '.acfwhip/specs/' 'ACF Whip materialized task specs (non-files stores)'
Managed documents refresh themselves. The plugin owns docs/acf/style/task-descriptions.md,
docs/acf/backlog/task-template.md, docs/acf/backlog/workflow.md and
docs/acf/backlog/recovery-runbook.md. The SessionStart hook stamps each one with the plugin version
on install. On later sessions it refreshes any copy whose content matches a version this plugin has
shipped, because such a copy is only stale. A copy edited locally is never overwritten: the hook
reports that it is behind and leaves the decision to the operator. So do not re-copy these here, and
never overwrite one by hand.
For maintainers: if a managed document changes in the plugin, regenerate the pristine-content
manifest before release with bash skills/lib/bin/acfw-gen-digests.sh. Without it the next session
cannot recognise the newly shipped file, and every consumer's copy is classed as "edited" for good.
tests/phase18-artifact-provenance.test.sh fails when that happens.
Recommended project setting (not written by this skill). On a large backlog the store walk and
the integrity battery each take minutes, and the Bash tool's default timeout can kill them mid-walk.
The partial output that comes back reads like an empty backlog. /go asks for an explicit
per-command timeout, which covers the orchestrator. For interactive work on a big board, tell the
operator they may also want these in .claude/settings.json:
{ "env": { "BASH_DEFAULT_TIMEOUT_MS": "300000", "BASH_MAX_TIMEOUT_MS": "600000" } }
Do not write that file from this skill: it is the operator's, it is frequently git-ignored, and silently editing a user's settings to make a plugin work is the wrong trade. Say what the values are and why, and let them decide.
Never gitignore
.acfwhip/wholesale..acfwhip/configis committed. It is the namespace source of truth, and its values overwrite inherited env (ACFW_STORE,ACFW_WORKTREE_DIR,ACFW_BRANCH_PREFIX), so ignoring the whole directory would silently revert those settings on a fresh clone. The LP-CAS ledger at.acfwhip/integrated/is committed too, by design: it is the integration oracle. Ignore onlyrun/andspecs/.
3.5b: .worktreeinclude manifest. If there is none, scaffold a starter manifest listing the
untracked dev files to copy or symlink into each fresh worktree, so the agent working a task can run
a full dev sandbox. The default mode is copy; link: symlinks, and secret: copies with stripped perms.
Every listed path must be git-ignored: a tracked path is a hard error. Large dependency trees are
copied too (isolated, race-free). Switch a line to link: only if tasks never run installs inside
the worktree.
if [ ! -f .worktreeinclude ]; then
cat > .worktreeinclude <<'EOF'
# .worktreeinclude — untracked files to hydrate into each fresh .worktree/<slug>.
# Honored by clean-checkout-before-task. Default mode: copy. Modes: copy: / link: / secret:.
# Every path MUST be git-ignored. Globs allowed. Edit to match your project.
#
# Local environment (copied so a worktree owns its own and edits don't leak across slugs):
# .env
# .env.local
#
# Dependency trees (COPY = isolated & safe; switch to `link:` only if no in-worktree installs):
# node_modules
# .venv
#
# Symlink large read-only caches to save disk:
# link: .cache
#
# Secrets are copied with stripped perms and NEVER symlinked:
# secret: .secrets/local.key
EOF
echo "✓ Created starter .worktreeinclude (edit to match your project)"
else
echo "✓ .worktreeinclude already present"
fi
3.5c: doctor config. Scaffold .backlog/.acfw-config with the in-progress timeout
(default 8h; lower it for overnight runs so an agent killed mid-edit frees its slug sooner) and
the worktree namespace acf-whip owns. doctor.sh, scan-backlog.sh, clean-checkout.sh,
integrate-lpcas.sh and /go all read it.
A new project also gets ACFW_INTEGRATION_MODE=default pinned (same rule and reason as
Step 2.5: no config file and no task documents yet). An existing project keeps whatever it has, and
an existing .backlog/.acfw-config is never rewritten, so an existing pin is never touched.
if [ ! -f .backlog/.acfw-config ]; then
# Decide "new" BEFORE writing. Step 3 has already created the state folders, so the test is
# "no task documents", not "no .backlog/". A .acfwhip/config means the project was set up before
# (and shadows this file entirely), so it is never "new" here.
new_project=1
if [ -f .acfwhip/config ]; then new_project=0; fi
if [ -n "$(find .backlog -type f -name '*.md' ! -name README.md 2>/dev/null | head -1)" ]; then new_project=0; fi
cat > .backlog/.acfw-config <<'EOF'
# ACF Whip runtime config (sourced by doctor.sh, scan-backlog.sh, clean-checkout.sh,
# integrate-lpcas.sh, and /go).
# Hours before an in-progress task is flagged stale / timed out to blocked.
ACFW_INPROGRESS_TIMEOUT_HOURS=8
# Integration mode. Unset = /go decides per run by reading CLAUDE.md/AGENTS.md.
# default accepted work is folded into the LOCAL trunk by LP-CAS (no push, no PR)
# override /go stops at accepted and leaves worktree/<slug> intact; YOU push and open PRs
# Pin it if the repo has a delivery discipline that must not depend on a per-run judgement — a
# protected trunk with review-gated merges is the usual reason to pin `override`. An unrecognized
# value is FATAL, and a trailing "# comment" is part of the value, so keep comments on their own line.
# ACFW_INTEGRATION_MODE=override
# Autopilot, off unless set. `on` makes every /whip "<goal>" run hands-off until a judge finds
# the goal met; `approve` also approves the plans a run drafts, and counts only once committed.
# See /whip --auto.
# ACFW_AUTOPILOT=off
# Worktree namespace acf-whip OWNS and may create/remove. acf-whip only ever touches
# worktrees on the <ACFW_BRANCH_PREFIX>/<slug> branch — any other worktree (including one
# you park under ACFW_WORKTREE_DIR for your own research/benchmarking) is left untouched.
# Change these ONLY on a fresh backlog: existing worktrees are pinned to the old namespace.
ACFW_WORKTREE_DIR=.worktree
ACFW_BRANCH_PREFIX=worktree
# LP-CAS (3.0.0) integration gates, run by integrate-lpcas on the CANDIDATE tree (trunk + the
# task's change) before it lands — the backstop that catches a union-level break a per-worktree
# gate cannot see (#8) and a botched conflict resolution (#18). Both optional; empty = skip.
# ACFW_PARSE_SANITY_CMD — cheap parse/lint, run first; failure = mechanism (re-resolve), not a reject.
# ACFW_GATE_CMD — the full union gate; failure = quality reject. CWD is the candidate worktree.
# Example (uncomment + adapt to your stack):
# ACFW_PARSE_SANITY_CMD='npx tsc --noEmit'
# ACFW_GATE_CMD='npm test --silent'
EOF
echo "✓ Created .backlog/.acfw-config (timeout=8h, worktree namespace .worktree / worktree)"
if [ "$new_project" = 1 ]; then
printf '\n# Pinned by /whip-init because this project was new (see "Integration mode" above).\n# Switch to override if the repo has a protected trunk with review-gated merges.\nACFW_INTEGRATION_MODE=default\n' >> .backlog/.acfw-config
echo "✓ Pinned ACFW_INTEGRATION_MODE=default (new project)"
fi
fi
3.5d: verify shipped scripts. The legacy and workflow paths both call the worktree and integrity scripts that ship in the plugin. Check that they are there:
for s in skills/clean-checkout-before-task/bin/clean-checkout.sh \
skills/integrate-lpcas/bin/integrate-lpcas.sh \
skills/whip-doctor/bin/doctor.sh \
skills/lib/acfw-git.sh; do
[ -f "${CLAUDE_PLUGIN_ROOT}/$s" ] || echo "WARN: missing ${CLAUDE_PLUGIN_ROOT}/$s — concurrency/integrity will not work." >&2
done
Install the pre-commit config and the quality-gates docs that Step 1's detector selected. Nothing
here overwrites an existing file: an existing .pre-commit-config.yaml is the operator's (Step 4.5
covers it), and an existing gates doc is the team's.
gate_stack | Pre-commit config source | Quality gates doc source (gates_doc) | Destination |
|---|---|---|---|
| go | ${CLAUDE_PLUGIN_ROOT}/content/pre-commit-configs/.pre-commit-config-go.yaml | ${CLAUDE_PLUGIN_ROOT}/content/quality-gates/go.md | .pre-commit-config.yaml, docs/development/quality-gates-go.md |
| python | ${CLAUDE_PLUGIN_ROOT}/content/pre-commit-configs/.pre-commit-config-python.yaml | ${CLAUDE_PLUGIN_ROOT}/content/quality-gates/python-fastapi.md | .pre-commit-config.yaml, docs/development/quality-gates-python.md |
| nodejs | ${CLAUDE_PLUGIN_ROOT}/content/pre-commit-configs/.pre-commit-config-nodejs.yaml | ${CLAUDE_PLUGIN_ROOT}/content/quality-gates/nodejs.md (plain Node, Express, Fastify, NestJS, React, Vue), ${CLAUDE_PLUGIN_ROOT}/content/quality-gates/nextjs-typescript.md (Next.js) | .pre-commit-config.yaml, docs/development/quality-gates-nodejs.md |
A frontend next to a Go or Python backend also gets docs/development/quality-gates-nodejs.md, from
frontend_gates_doc. The pre-commit config stays the backend's: only one .pre-commit-config.yaml
exists, and the Node.js hooks run npm scripts from the root.
The shipped configs run only tools the project already has. The Node.js one runs
npm run lint|typecheck|build --if-present when a commit stages source or JSON, the project's own
prettier only when package.json declares it, and npm test on push unless the script is still npm
init's placeholder, so a plain "test": "node --test" project commits and pushes clean. The Python
one runs mypy and pytest only once the project configures them; the Go one runs golangci-lint only
when it is installed.
The installed config keeps every hook out of the paths acf-whip writes and commits itself.
docs/cycles/: /whip keeps each planned cycle there, and acfw-cycle hashes plan.md and
record.md and commits them itself, so a hook that rewrites either file fails that commit. prettier
re-aligns record.md's tables, so on a Node.js project with prettier no plan could be approved.docs/acf/: plugin-managed docs the SessionStart hook refreshes by content digest. A formatter's
rewrite makes a copy match no shipped version, so it counts as edited and is never refreshed again..backlog/: task state. /go commits every transition at the repo root with hooks active, and
prettier re-aligns a task's Transition Log table, so every transition would hit the writer's
"commit failed" FATAL..acfwhip/: config and the LP-CAS ledger. Every integration commits a one-line JSON marker with
hooks active, and a JSON formatter that reflows it fails the integration.The shipped configs carry a top-level exclude: '^(docs/(cycles|acf)/|\.backlog/|\.acfwhip/)', which
pre-commit applies to every hook. The block below says so, and adds the line only to a freshly
written copy that lacks it:
FLAGS='' # the same flags as Step 1
eval "$(bash "${CLAUDE_PLUGIN_ROOT}/content/quality-gates/detect-stack.sh" "$FLAGS")"
f=.pre-commit-config.yaml
wrote=0
if [ -z "$gate_stack$frontend_gate_stack" ]; then
echo "NOTE: no stack detected: no pre-commit config or quality-gates doc installed (see Error Handling)"
fi
if [ -f "$f" ]; then
echo "✓ $f exists: it is the operator's, left alone (Step 4.5 checks it)"
elif [ -z "$gate_stack" ]; then
[ -n "$backend" ] && echo "NOTE: no shipped pre-commit config for ${backend}: none installed"
elif [ "$gate_stack" = nodejs ] && [ ! -f package.json ]; then
echo "NOTE: no package.json at the repo root. The Node.js config runs npm scripts from the root, so it was not installed."
elif cp "${CLAUDE_PLUGIN_ROOT}/content/pre-commit-configs/.pre-commit-config-${gate_stack}.yaml" "$f"; then
wrote=1
echo "✓ Installed $f (${gate_stack})"
fi
# The backend's gates doc, then the frontend's. They are one file when the backend is Node.js too.
last_d=''
for pair in "${gate_stack}:${gates_doc}" "${frontend_gate_stack}:${frontend_gates_doc}"; do
stack=${pair%%:*}; doc=${pair#*:}
[ -n "$stack" ] && [ -n "$doc" ] || continue
d="docs/development/quality-gates-${stack}.md"
[ "$d" = "${last_d:-}" ] && continue # backend and frontend share the Node.js doc
last_d=$d
mkdir -p docs/development
if [ -f "$d" ]; then
echo "✓ $d exists, left as is"
elif cp "${CLAUDE_PLUGIN_ROOT}/content/quality-gates/${doc}" "$d"; then
echo "✓ Installed $d (from ${doc})"
fi
done
if [ -n "$frontend_gate_stack" ] && [ -n "$gate_stack" ] && [ "$frontend_gate_stack" != "$gate_stack" ]; then
echo "NOTE: $f runs the ${gate_stack} hooks only. The ${frontend} app's gates are in docs/development/quality-gates-${frontend_gate_stack}.md, which the frontend role runs."
fi
# Only the copy written just now. An existing config is the operator's, never edited here.
if [ "$wrote" = 1 ]; then
ex=$(grep -E '^exclude:' "$f")
if printf '%s' "$ex" | grep -q cycles && printf '%s' "$ex" | grep -qE 'acf[)/|]' \
&& printf '%s' "$ex" | grep -q backlog && printf '%s' "$ex" | grep -q acfwhip; then
echo "✓ $f keeps its hooks out of docs/cycles/, docs/acf/, .backlog/ and .acfwhip/"
elif [ -n "$ex" ]; then
# A second top-level key would be invalid YAML, and merging two regexes by script is a guess.
echo "NOTE: $f has its own top-level exclude. Make it cover ^(docs/(cycles|acf)/|\\.backlog/|\\.acfwhip/) by hand, or /whip approvals, /go transitions and integrations fail to commit, and managed docs stop refreshing."
else
T=$(mktemp "${TMPDIR:-/tmp}/acfw-precommit.XXXXXX") || exit 1
# Insert before the first top-level `repos:` key. awk exits 0 only when it inserted, so a file
# without that key is never rewritten. `cat >` keeps the file's own mode (mktemp files are 0600).
if awk '
!done && /^repos:/ {
print "# acf-whip: no hook may rewrite docs/cycles/ (acfw-cycle hashes and commits it), docs/acf/ (managed docs, refreshed by digest),"
print "# .backlog/ (task state /go commits) or .acfwhip/ (config and the LP-CAS ledger)."
print "exclude: '"'"'^(docs/(cycles|acf)/|\\.backlog/|\\.acfwhip/)'"'"'"
print ""
done = 1
}
{ print }
END { exit done ? 0 : 1 }' "$f" > "$T"; then
cat "$T" > "$f" && echo "✓ $f: every hook skips docs/cycles/, docs/acf/, .backlog/ and .acfwhip/"
else
echo "NOTE: $f has no top-level repos: key. Add exclude: '^(docs/(cycles|acf)/|\\.backlog/|\\.acfwhip/)' at its top level by hand."
fi
rm -f "$T"
fi
fi
This runs after Step 4, so it sees the pre-commit config whether the operator had one or Step 4
just installed it. Add docs/cycles/, docs/acf/, .backlog/ and .acfwhip/ to the formatter
ignore files the project already has; never create one:
for f in .prettierignore .markdownlintignore; do
[ -f "$f" ] || continue
for d in docs/cycles docs/acf .backlog .acfwhip; do
if grep -qxF -e "$d" -e "$d/" -e "/$d" -e "/$d/" "$f"; then echo "✓ $f already ignores ${d}/"; continue; fi
case "$d" in
docs/cycles) why='acf-whip cycle records: acfw-cycle hashes these bytes, so a formatter must not rewrite them' ;;
docs/acf) why='acf-whip managed docs: refreshed by content digest, so a formatter rewrite freezes them' ;;
.backlog) why='acf-whip task state: /go commits every transition, so a formatter rewrite fails the run' ;;
.acfwhip) why='acf-whip config and LP-CAS ledger: a formatter rewrite of a ledger marker fails the integration' ;;
esac
printf '\n# %s\n%s/\n' "$why" "$d" >> "$f"
echo "✓ Added ${d}/ to $f"
done
done
# A formatter wired straight into the OPERATOR's pre-commit config: say what to add, never edit it.
# The config Step 4 installed already carries the exclude, so it never reaches this NOTE.
f=.pre-commit-config.yaml
if [ -f "$f" ] && grep -qiE 'prettier|markdownlint|mdformat' "$f"; then
ex=$(grep -E '^[[:space:]]*exclude:' "$f")
if ! { printf '%s' "$ex" | grep -q cycles && printf '%s' "$ex" | grep -qE 'acf[)/|]' \
&& printf '%s' "$ex" | grep -q backlog && printf '%s' "$ex" | grep -q acfwhip; }; then
echo "NOTE: $f runs a formatter. If it does not read .prettierignore or .markdownlintignore, add exclude: ^(docs/(cycles|acf)/|\\.backlog/|\\.acfwhip/) to that hook, or /whip approvals, /go transitions and integrations fail to commit, and managed docs stop refreshing."
fi
fi
Install core docs (Read/Write, skip if exists):
| File | Source | Destination |
|---|---|---|
| Task style guide | ${CLAUDE_PLUGIN_ROOT}/content/style/task-descriptions.md | docs/acf/style/task-descriptions.md |
| Research style guide | ${CLAUDE_PLUGIN_ROOT}/content/style/research-documents.md | docs/acf/style/research-documents.md |
| Task template | ${CLAUDE_PLUGIN_ROOT}/content/backlog/task-template.md | docs/acf/backlog/task-template.md |
| Workflow | ${CLAUDE_PLUGIN_ROOT}/content/backlog/workflow.md | docs/acf/backlog/workflow.md |
| Recovery runbook | ${CLAUDE_PLUGIN_ROOT}/content/backlog/recovery-runbook.md | docs/acf/backlog/recovery-runbook.md |
| Research protocol | ${CLAUDE_PLUGIN_ROOT}/content/acf/research-protocol.md | docs/acf/research-protocol.md |
Create directories if missing.
Collect project data before generating agents and role skills:
# Tech stack: From Step 1 (backend, frontend, frameworks)
# Project: project_name=$(basename $(pwd))
# Structure: services/|packages/ → is_monorepo=true | services/ + multiple → has_microservices=true | kafka|rabbitmq|pulsar|nats → has_event_driven=true
# Quality tools: Extract from .pre-commit-config.yaml → quality_tools list. A hook named "(when ...)" runs
# only when the project has that tool, so list it only if the project does (Node.js: its node_*_cmd is
# non-empty; Python: mypy or pytest is configured; Go: golangci-lint is installed)
# Coverage/Priority: From Step 2 user selection
# Database: postgres|psycopg|pg → "postgresql" | mongo → "mongodb"
# Doc paths: docs/acf/backlog/task-template.md, docs/acf/backlog/workflow.md, and the gates docs Step 4 wrote:
# docs/development/quality-gates-{gate_stack}.md (backend), docs/development/quality-gates-{frontend_gate_stack}.md (frontend)
# DevOps-specific (if create_devops=true):
# Monitoring: prometheus.yml|docker-compose.yml → "prometheus-grafana" | datadog → "datadog" | newrelic → "newrelic" | has_k8s → "prometheus-grafana"
# Cloud: terraform/ → google|gcp|gke → "gke" | aws|eks → "eks" | azure|aks → "aks" | skaffold.yaml → check for gke|eks | .github/workflows/ → check for gcloud|aws|azure
# Registry: gcr.io → "gcr" | ecr|amazonaws.com → "ecr" | azurecr.io → "acr" | docker.io|dockerhub → "dockerhub"
# Deployment: has_k8s → "kubernetes" | has_docker + swarm|stack → "docker-swarm" | has_docker → "docker-compose"
Store values for Steps 6 and 6.5.
Create .claude/agents/ if it is missing, then generate 7 agents from the patterns in ${CLAUDE_PLUGIN_ROOT}/content/agent-patterns/universal/{agent}-pattern.md:
Always generate: task-engineer, quality-reviewer, lean-architect, precommit, retro, research-agent, whippet
whippet is the worker. /go runs a task on the installed agent its role names; when no agent of
that name is installed, it runs the task on whippet, which loads the role skill
.claude/skills/<role>/SKILL.md first (Step 6.5 writes those). devops is no longer an agent: it is a
role skill, written in Step 6.5 when create_devops=true.
Customization variables per agent:
| Agent | Template Variables | Examples |
|---|---|---|
| task-engineer | {backend_stack}, {frontend_stack}, {backend_role}, {frontend_role}, the other {*_role} values its pattern lists, {priority_system}, {database_stack}, {infrastructure}, {type_signature_example}, {bad_example_code} | go-engineer, 3-level, postgresql, Go type signatures. Each {*_role} must name a role the project will have: one Step 6.5 writes or one already installed. Leave out a conditional row with no role; the pattern's whippet row covers work no role fits |
| quality-reviewer | {backend_stack}, {frontend_stack}, {coverage_threshold}, {api_coverage}, {core_coverage}, {backend_linter}, {backend_test_runner}, {frontend_linter} | Coverage 80% → api 90-95%, golangci-lint, go test |
| lean-architect | {backend_stack}, {frontend_stack}, {database_stack}, {infrastructure}, {has_microservices}, {has_event_driven}, {project_name} | kubernetes, microservices=true |
| precommit | {backend_stack}, {frontend_stack}, {backend_linter}, {backend_formatter}, {pre_commit_config_path} | golangci-lint, gofmt, .pre-commit-config.yaml |
| retro | {project_name}, {has_sla_priorities} | sla=true if 5-level |
| research-agent | {project_name} | Replace project references |
| whippet | {project_name} | Replace project references. Keep the template's model: sonnet unless the project wants another: /go runs whippet on the model: its frontmatter declares. |
Coverage threshold logic: 95% → api 95-98%, core 95% | 80% → api 90-95%, core 90% | 60% → api 75-80%, core 70%
Tool variables on a Node.js project ({backend_linter}, {backend_formatter},
{backend_test_runner}, {frontend_linter}) come from Step 1's node_* values, never from a
default: node_lint_cmd, node_format_cmd, node_test_cmd. An empty one means the project has no
such tool; write "none" there, never eslint or tsc.
Write generated agents to .claude/agents/{agent}.md.
An installed workflow-architect is unused. Until 3.7.0, /whip-init installed a
workflow-architect agent that wrote a harness for every task. /go now runs the shipped harness and
never dispatches it, and /whip-doctor reports the file as WARN unused-agent. If it is there, offer
to delete it (AskUserQuestion), and delete it only on a yes:
f=.claude/agents/workflow-architect.md
if [ -f "$f" ]; then
echo "NOTE: $f is unused since acf-whip 3.7.0 (/go runs the shipped harness without an architect)."
fi
# On a yes only. git rm stages the deletion of a tracked copy; an untracked one is simply removed.
# git ls-files --error-unmatch "$f" >/dev/null 2>&1 && git rm -q "$f" || rm -f "$f"
On a no, leave the file. It does no harm, and the doctor keeps naming it.
A role skill is .claude/skills/<role>/SKILL.md, with frontmatter name, description and
user-invocable: false. A task's Assigned Agent names its role. /go runs the task on whippet,
which loads that skill before it starts. An installed agent of the same name
(.claude/agents/<role>.md) wins over the skill, so a project with specialist agents keeps running
them until it converts them with /whip-add-skills --migrate. This step never writes an agent file.
Two kinds of role skill come from here:
create_devops=true (Step 2), whatever the flag.--with-specialists.Check if --with-specialists flag is present:
if [[ "$*" == *"--with-specialists"* ]]; then
echo "🚀 --with-specialists flag detected - writing role skills for the detected stack..."
with_specialists=true
else
echo "📋 No stack role skills (use --with-specialists, or run /whip-add-skills later)"
with_specialists=false
fi
Which roles to write. Never overwrite an existing role skill, and never write one whose name is an installed agent: the agent would win at dispatch and the skill would never load.
roles=()
[ "$create_devops" = true ] && roles+=(devops)
if [ "$with_specialists" = true ]; then
[ -n "$backend" ] && roles+=("${backend}-engineer")
[ -n "$frontend" ] && roles+=("${frontend}-engineer")
{ [ "$has_docker" = true ] || [ "$has_k8s" = true ]; } && roles+=("infrastructure-engineer")
fi
created_roles=()
for r in ${roles[@]+"${roles[@]}"}; do
if [ -f ".claude/agents/$r.md" ]; then
echo "NOTE: .claude/agents/$r.md is installed and runs $r tasks; no skill written. /whip-add-skills --migrate converts it."
continue
fi
if [ -f ".claude/skills/$r/SKILL.md" ]; then
echo "✓ .claude/skills/$r/SKILL.md exists, left as is"
continue
fi
created_roles+=("$r")
done
echo "Role skills to write: ${created_roles[*]:-none}"
DevOps Role Skill (if create_devops=true):
| Role | Template | Output |
|---|---|---|
| devops | ${CLAUDE_PLUGIN_ROOT}/content/skill-patterns/devops-skill-pattern.md | .claude/skills/devops/SKILL.md |
Its variables are {LOCAL_ORCHESTRATION}, {DEPLOYMENT_TARGET}, {CI_TOOL}, {MONITORING_STACK},
{CLOUD_PROVIDER}, {HAS_K8S} and {PROJECT_NAME}, from Steps 1 and 5.5 (e.g. docker-compose,
kubernetes, github-actions, prometheus-grafana, gke). {ORCHESTRATION_RESPONSIBILITY} and
{K8S_DELEGATION_SECTION} come from the pattern's own "Pattern Replacements" section.
If with_specialists=true, write role skills based on Step 1 tech stack detection:
Backend Role Mapping:
| Detection | Role | Template | Output |
|---|---|---|---|
backend="python" | python-engineer | ${CLAUDE_PLUGIN_ROOT}/content/skill-patterns/backend-skill-pattern.md | .claude/skills/python-engineer/SKILL.md |
backend="go" | go-engineer | ${CLAUDE_PLUGIN_ROOT}/content/skill-patterns/backend-skill-pattern.md | .claude/skills/go-engineer/SKILL.md |
backend="nodejs" | nodejs-engineer | ${CLAUDE_PLUGIN_ROOT}/content/skill-patterns/backend-skill-pattern.md | .claude/skills/nodejs-engineer/SKILL.md |
Frontend Role Mapping:
| Detection | Role | Template | Output |
|---|---|---|---|
frontend="nextjs" | nextjs-engineer | ${CLAUDE_PLUGIN_ROOT}/content/skill-patterns/frontend-skill-pattern.md | .claude/skills/nextjs-engineer/SKILL.md |
frontend="react" | react-engineer | ${CLAUDE_PLUGIN_ROOT}/content/skill-patterns/frontend-skill-pattern.md | .claude/skills/react-engineer/SKILL.md |
frontend="vue" | vue-engineer | ${CLAUDE_PLUGIN_ROOT}/content/skill-patterns/frontend-skill-pattern.md | .claude/skills/vue-engineer/SKILL.md |
Infrastructure Role Mapping:
| Detection | Role | Template | Output |
|---|---|---|---|
has_k8s=true OR has_docker=true | infrastructure-engineer | ${CLAUDE_PLUGIN_ROOT}/content/skill-patterns/infrastructure-skill-pattern.md | .claude/skills/infrastructure-engineer/SKILL.md |
The detector reports no data stack, so this step writes no data role skill. For one (data-engineer,
from content/skill-patterns/data-skill-pattern.md), run /whip-add-skills with its --data= flag.
Template Variable Replacements:
For backend role skills (python/go/nodejs):
{stack} → detected backend value ("python", "go", "nodejs"){language}, {Language} → language name ("Python", "Go", "Node.js"){database} → Step 5.5's database ("PostgreSQL", "MongoDB"); drop it from the description when there is none{framework} → framework examples:
node_framework: "Express", "Fastify", "NestJS", or for none "none (plain Node.js,
standard library)"{linter} → linter tools:
node_lint_cmd{formatter} → formatter tools:
node_format_cmd{test-runner} → test frameworks:
node_test_cmd (runner: node_test_runner, e.g. npm test running node --test){type-checker} → type checking tools:
node_typecheck_cmd (TypeScript projects only){build} → build step:
node_build_cmdNode.js: an empty node_*_cmd drops that slot. Remove its line from the command block and its
term from the one-liner. A plain Node.js project (node_framework='none', "test": "node --test")
ends up with npm test alone. Never write eslint, prettier or tsc into a project that does not
have them: the worker can then only fail that gate or skip it.
For frontend role skills (nextjs/react/vue):
{stack} → detected frontend value ("nextjs", "react", "vue"){language}, {Language} → "TypeScript" when node_typescript=true, else "JavaScript"{framework} → framework name ("Next.js", "React", "Vue.js"){build} → node_build_cmd (empty: drop the slot){linter} → node_lint_cmd (empty: drop the slot){formatter} → node_format_cmd (empty: drop the slot){type-checker} → node_typecheck_cmd (empty: drop the slot){test-runner} → node_test_cmd (empty: drop the slot)For the infrastructure role skill:
infrastructure-engineer; it has no {stack} slot{language}, {Language} → the backend's values; {framework} → the platform it configures
(Kubernetes when has_k8s=true, else Docker Compose); {database} → the backend'sGeneration Process:
${CLAUDE_PLUGIN_ROOT}/content/skill-patterns/{type}-skill-pattern.md
and take the fenced block under ## Skill Template.claude/skills/{role}/SKILL.md (create the directory), only for a role in
created_roles[]created_roles[] for Step 7 manifest generationecho "✅ Wrote ${#created_roles[@]} role skills: ${created_roles[*]:-none}"
Result: 0-4 role skills (devops, plus 1-3 for the detected stack with the flag). Step 7 writes their manifests.
If docs/README.md exists, use it as the documentation index: read it to find the project's docs.
Otherwise Step 7 scans the standard directories.
# Check if project has a documentation index
has_docs_index=false
if [ -f "docs/README.md" ]; then
echo "📋 Found docs/README.md - using as documentation index"
echo " Claude will read this file to discover available documentation"
has_docs_index=true
else
echo "📂 No docs/README.md found - will scan directories for documentation"
fi
Create docs/agents/, then generate the manifests from the patterns, each with the Priority 1/2/3
structure:
Process: Read pattern → Extract agent section → Apply customizations → Write to docs/agents/{agent}.md
Documentation discovery: the docs/README.md index if Step 6.75 found one, otherwise a scan of
the standard directories.
Generate 6 universal manifests, one per universal agent except whippet, which has none of its
own: it reads the manifest of the role skill it loads.
Template: ${CLAUDE_PLUGIN_ROOT}/content/agent-patterns/manifests/universal-manifest-pattern.md
| Manifest | Customizations |
|---|---|
| All | Replace {stack} with detected stacks, update quality gates paths to the files Step 4 wrote: docs/development/quality-gates-{gate_stack}.md, plus docs/development/quality-gates-{frontend_gate_stack}.md when a frontend exists and it is a different file (quality-reviewer and precommit check both sides) |
| task-engineer | Update Priority 1 docs, match project structure |
| quality-reviewer | Coverage thresholds from Step 2, quality gates for detected stacks, backend/frontend sections |
| lean-architect | Priority 2 docs from project, add microservices/event-driven if detected |
| precommit | Reference .pre-commit-config.yaml from Step 4 |
| retro | SLA compliance metrics if 5-level priorities |
| research-agent | Project name |
Each role skill Step 6.5 wrote (created_roles[]) points at its manifest, docs/agents/{role}.md.
Generate one per role, and leave an existing manifest as it is:
Process: For each role in created_roles[]:
${CLAUDE_PLUGIN_ROOT}/content/agent-patterns/manifests/devops-manifest-pattern.md${CLAUDE_PLUGIN_ROOT}/content/agent-patterns/manifests/backend-manifest-pattern.md${CLAUDE_PLUGIN_ROOT}/content/agent-patterns/manifests/frontend-manifest-pattern.md${CLAUDE_PLUGIN_ROOT}/content/agent-patterns/manifests/infrastructure-manifest-pattern.mddocs/agents/{role}.mdRole Manifest Templates:
| Role | Template | Variables Replaced |
|---|---|---|
| devops | devops-manifest-pattern.md | {CONDITIONAL_DOCS_P1} from docs/operations/ scan (deployment.md, monitoring.md, environment.md, troubleshooting.md), {CONDITIONAL_DOCS_P2} from docs/operations/ci-cd.md + docs/architecture/service-architecture.md + docs/development/local-development.md, {CONDITIONAL_QUALITY_GATES} based on detected_orchestration (docker-compose/k8s validation), infrastructure values from Step 5.5, {CURRENT_DATE} |
| python-engineer | backend-manifest-pattern.md | {stack}=python, {language}=Python, {framework}=FastAPI/Django/Flask, {linter}=ruff, {test_runner}=pytest, {type_checker}=mypy, quality gates path |
| go-engineer | backend-manifest-pattern.md | {stack}=go, {language}=Go, {framework}=Gin/Echo/Chi, {linter}=golangci-lint, {test_runner}=go test, {type_checker}=built-in, quality gates path |
| nodejs-engineer | backend-manifest-pattern.md | {stack}=nodejs, {language}=Node.js, {framework}=node_framework (none: plain Node.js), {linter}=node_lint_cmd, {test_runner}=node_test_cmd, {type_checker}=node_typecheck_cmd, {build}=node_build_cmd (an empty one drops that slot), quality gates path |
| nextjs-engineer | frontend-manifest-pattern.md | {stack}=nextjs, {framework}=Next.js, {build_tool}=next build, {linter}, {formatter}, {test_runner} from the node_*_cmd values (an empty one drops that slot), quality gates path |
| react-engineer | frontend-manifest-pattern.md | {stack}=react, {framework}=React, {build_tool}=vite, {linter}, {formatter}, {test_runner} from the node_*_cmd values (an empty one drops that slot), quality gates path |
| vue-engineer | frontend-manifest-pattern.md | {stack}=vue, {framework}=Vue.js, {build_tool}=vite, {linter}, {formatter}, {test_runner} from the node_*_cmd values (an empty one drops that slot), quality gates path |
| infrastructure-engineer | infrastructure-manifest-pattern.md | {orchestration}, {deployment_target}, {cloud_provider}, {ci_tool}, {monitoring_stack} from Step 5.5, quality gates path |
Additional customizations for the stack roles' manifests:
docs/development/quality-gates-{gate_stack}.md. A frontend role reads
docs/development/quality-gates-{frontend_gate_stack}.md (quality-gates-nodejs.md), even when the
backend is Go or Python: a react-engineer sent to ruff, mypy and pytest can pass none of them. The
infrastructure role reads the backend's.Tracking:
echo "✅ Generated ${#created_roles[@]} role manifests: ${created_roles[*]:-none}"
Result: 6 universal manifests plus one manifest per role skill Step 6.5 wrote (devops when chosen, 1-3 stack roles with the flag). Each uses the Priority 1/2/3 structure (58-74% token reduction) and points at this project's own docs and stack.
Generate .backlog/README.md from the template, listing the project's roles:
# Roles: the role skills in .claude/skills/*/SKILL.md, plus any installed agent in .claude/agents/
# that is not one of acf-whip's universal agents (a specialist agent still runs its tasks)
# Replaces {{IMPLEMENTER_AGENTS}} in template
# Writes customized .backlog/README.md — ONLY when .backlog/README.md does not already exist
Never overwrite an existing .backlog/README.md. Re-running /whip-init on a live project must
not replace the team's gate commands, coverage thresholds and evidence rules with the sample's
defaults. If it exists, update the roster line in place exactly as /whip-add-skills does, and
leave the rest of the document alone.
Steps 8.5 and 9 append to CLAUDE.md, so make sure it exists first.
Detection:
if [ -f "CLAUDE.md" ]; then
echo "✓ CLAUDE.md found - will enhance with ACF workflow sections"
claude_md_created=false
else
echo "📝 CLAUDE.md not found - creating minimal AI instructions file"
claude_md_created=true
fi
If CLAUDE.md is missing, create it from the minimal template below:
Implementation:
project_name=$(basename $(pwd))CLAUDE.md using Write toolMinimal CLAUDE.md template:
# {PROJECT_NAME} - AI Assistant Instructions
## Agentic Continuous Flow (ACF)
**ACF is software development for a world where intelligence exists in silicon as well as carbon.** Humans shift from writing code to governing intelligent agent swarms. Knowledge (ontologies, policies, constraints) becomes the product; code is ephemeral output regenerated on demand. Work flows through multi-dimensional risk evaluation - low-risk tasks execute autonomously, high-risk tasks trigger human review. Systems emerge from agent interactions within knowledge boundaries rather than being engineered top-down. The fundamental inversion: humans govern, agents execute.
---
Template variables:
{PROJECT_NAME}: Directory basename ($(basename $(pwd)))The template holds a project header, the ACF definition (verbatim from the distribution CLAUDE.md)
and a --- separator for the sections Steps 8.5 and 9 add. It leaves out repository metadata,
license and contact info; the user can add those later.
Output:
✓ Created CLAUDE.md with minimal AI instructions✓ CLAUDE.md found - will enhance with ACF workflow sectionsCheck if "## Pure Delegation Architecture" section exists:
if grep -q "## Pure Delegation Architecture" CLAUDE.md; then
echo "✓ Pure Delegation section already exists - skipping"
else
echo "📝 Adding Pure Delegation Architecture section to CLAUDE.md..."
fi
If section is missing, append:
---
## Pure Delegation Architecture
**CRITICAL**: General-purpose agent does ORCHESTRATION ONLY (never implements code).
**General agent role**: Task decomposition, coordination, status tracking, quality enforcement
**General agent CANNOT**: Write/modify/fix/refactor code
### Role skills
A task's `Assigned Agent` names its role. `/go` runs the task on the installed agent of that name
(`.claude/agents/<role>.md`) when there is one; otherwise on `whippet`, which loads the role skill
`.claude/skills/<role>/SKILL.md` first. An installed agent wins over a role skill of the same name.
| Domain | Role | Responsibilities |
|--------|------|------------------|
{ROLE_ROWS}
### Delegation Protocol
1. Receive request → Analyze domain
2. Select the role → Choose from the Role skills table
3. Delegate with context → WHAT/WHY only, docs refs, quality criteria
4. Coordinate → Track progress, enforce gates
5. Never bypass → Use `/whip-add-skills` if no role fits
**Enforcement**: `/go` runs each code task on its role, in the task's own worktree, and auto-rejects work that never entered one (no clean-checkout token, no worktree branch).
**Speedup**: 3x+ through parallel execution, eliminates context pollution.
Generate {ROLE_ROWS} from the roles the project has:
Role skills and specialist agents:
# DevOps/devops: {detected_orchestration}, CI/CD ({detected_ci_tool}), monitoring (if create_devops=true)
# If with_specialists=true:
# - Backend/{backend_stack}-engineer (from created_roles[])
# - Frontend/{frontend_stack}-engineer (from created_roles[])
# - Infrastructure/infrastructure-engineer (from created_roles[] if has_docker or has_k8s)
# If with_specialists=false:
# - Backend/{backend_stack}-engineer (TBD via /whip-add-skills)
# - Frontend/{frontend_stack}-engineer (TBD via /whip-add-skills)
# A role Step 6.5 skipped because a specialist agent of that name is installed: its row, marked "(agent)"
# Work no role fits: whippet
The other universal agents (task-engineer, quality-reviewer, lean-architect, precommit, retro, research-agent) are listed in the Backlog Workflow section (Step 9), not in this table.
Table generation logic:
created_roles[] with a "✓" prefix (devops among them when create_devops=true), and an "(agent)" row for each role Step 6.5 skipped because a specialist agent of that name is installedwith_specialists=false: Add the stack's rows with a "(TBD via /whip-add-skills)" suffixwhippet row, for work no role fitswith_specialists=true: "Never bypass → Every detected stack has a role; use the matching one"with_specialists=false: "Never bypass → Use /whip-add-skills if no role fits"Check if "## Backlog Workflow" section exists:
if grep -q "## Backlog Workflow" CLAUDE.md; then
echo "✓ Backlog Workflow section already exists - skipping"
else
echo "📝 Adding Backlog Workflow section to CLAUDE.md..."
fi
If section is missing, append:
## Backlog Workflow
ACF Whip active. State machine: `pending → in-progress → completed → in-review → [accepted|rejected]` (blocked/retry paths exist).
**Commands**: `/whip` (where you are and the one command to run next; `/whip "<goal>"` starts work; `/whip --auto "<goal>"` runs the whole cycle until a judge finds the goal met), `/task` (decompose), `/go` (execute your tasks), `/whip-doctor` (backlog integrity check; `--fix` auto-repairs), `/retro` (close a cycle, record lessons), `/whip-add-skills` (write role skills; `--migrate` converts specialist agents into role skills)
**Core Docs**: `docs/acf/backlog/workflow.md`, `docs/acf/backlog/recovery-runbook.md`, `docs/acf/backlog/task-template.md`, `docs/acf/style/task-descriptions.md`, `.backlog/README.md`
**Universal Agents**: task-engineer (WHAT/WHY only), quality-reviewer (accept/reject), lean-architect (design, max 2-3 line snippets), retro (root cause analysis; proposes, never edits), precommit, research-agent (Perplexity/Context7), whippet (runs one task end to end; loads the task's role skill)
**Quality Gates**: `docs/development/quality-gates-{gate_stack}.md`{IF frontend_gate_stack differs}, frontend: `docs/development/quality-gates-{frontend_gate_stack}.md`{ENDIF} | **Zero Bypass Tolerance**: No `--no-verify`, no skipping.
**Next Steps**: `/whip` shows where you are and the one command to run next (`/whip "<goal>"` → `/task` → `/go` → `/retro`). `/retro` records one-rule lessons in `docs/acf/lessons/`, relevant when changing an area a lesson names.
The Next Steps line is one informational pointer: it names where lessons live and loads none of
them. /whip, /retro and acfw-cycle never write to CLAUDE.md; only this skill does.
On a re-run, replace the old Next Steps line. Releases before 3.5.0 shipped exactly one variant of it. Replace that line only when it is byte-identical (a CRLF copy counts), and touch nothing else: an edited line is the team's, and it stays.
OLD='**Next Steps**: 1) `/whip-add-agents` for specialists, 2) `/task` to decompose scope, 3) `/go` for execution'
NEW='**Next Steps**: `/whip` shows where you are and the one command to run next (`/whip "<goal>"` → `/task` → `/go` → `/retro`). `/retro` records one-rule lessons in `docs/acf/lessons/`, relevant when changing an area a lesson names.'
if [ -f CLAUDE.md ]; then
T=$(mktemp "${TMPDIR:-/tmp}/acfw-claude-md.XXXXXX") || exit 1
# awk exits 0 only when it replaced something, so an unchanged file is never rewritten.
# `cat >` rather than `mv` keeps CLAUDE.md's own mode and inode (mktemp files are 0600).
if awk -v old="$OLD" -v new="$NEW" '
$(0) == old { print new; hit = 1; next }
$(0) == old "\r" { print new "\r"; hit = 1; next }
{ print }
END { exit hit ? 0 : 1 }' CLAUDE.md > "$T"; then
cat "$T" > CLAUDE.md && echo "✓ Replaced the old Next Steps line in CLAUDE.md"
fi
rm -f "$T"
fi
Compare expected state (Steps 1-9) with actual state on disk:
# 1. Check Universal Agents: expected_agents=(task-engineer quality-reviewer lean-architect precommit retro research-agent whippet) → missing_agents=[]
# 2. Check Role Skills: .claude/skills/devops/SKILL.md (if create_devops=true), .claude/skills/{role}/SKILL.md for each role in created_roles[] → missing_role_skills=[]
# 3. Check Manifests: docs/agents/{agent}.md for the 6 universal agents with a manifest, docs/agents/{role}.md for each role skill → missing_manifests=[]
# 4. Check Core Docs: docs/acf/style/task-descriptions.md, docs/acf/backlog/task-template.md, docs/acf/backlog/workflow.md, docs/acf/backlog/recovery-runbook.md → missing_docs=[]
# 5. Check Quality Gates: .pre-commit-config.yaml, docs/development/quality-gates-{gate_stack}.md, docs/development/quality-gates-{frontend_gate_stack}.md (when a frontend exists) → missing_quality_gates=[]
# 6. Check CLAUDE.md Sections (if exists): "## Pure Delegation Architecture", "## Backlog Workflow", devops in the Role skills table (if create_devops=true) → missing_claude_sections=[]
# A section written by an earlier release that still names workflow-architect, /whip-add-agents or a
# "Specialist Agent Matrix" is outdated: report it, never rewrite it (it may carry the team's edits) → outdated_claude_sections=[]
# 7. Check Unused Agents: .claude/agents/workflow-architect.md kept after Step 6 asked → unused_agents=[]
Generate gap report (if gaps found):
⚠️ Gap Analysis: Missing ACF Artifacts
🤖 Missing Universal Agents: {LIST} → Re-run /whip-init or generate from ${CLAUDE_PLUGIN_ROOT}/content/agent-patterns/universal/
🧩 Missing Role Skills: {LIST} → Re-run /whip-init --with-specialists or run /whip-add-skills
📚 Missing Agent Manifests: {LIST} → Re-run /whip-init or /whip-add-skills (58-74% token reduction)
📖 Missing Core Documentation: {LIST} → Copy from ${CLAUDE_PLUGIN_ROOT}/content/
🎯 Missing Quality Gates: {LIST} → Install from ${CLAUDE_PLUGIN_ROOT}/content/pre-commit-configs/
📋 Missing CLAUDE.md Sections: {LIST} → Re-run /whip-init
🔄 Outdated CLAUDE.md Content: {LIST} → Update the section by hand (Step 8.5 shows the current Role skills text)
🗑️ Unused Agents: {LIST} → git rm .claude/agents/workflow-architect.md
If no gaps: ✅ No gaps detected - ACF Whip fully integrated
Print this report. A line or span marked {IF ...} appears only when its condition holds.
✅ ACF Whip Initialized Successfully
📁 .backlog/: 9 state folders (draft, pending, in-progress, completed, in-review, blocked, rejected, accepted, archive)
📋 Core Docs: ✓ task-descriptions.md, ✓ research-documents.md, ✓ research-protocol.md, ✓ task-template.md, ✓ workflow.md, ✓ recovery-runbook.md, ✓ .backlog/README.md
👥 Universal Agents (customized for {stack}):
✓ task-engineer, quality-reviewer, lean-architect, retro, precommit, research-agent, whippet
{IF workflow_architect_deleted} ✓ removed .claude/agents/workflow-architect.md (unused since 3.7.0)
{IF workflow_architect_kept} ⚠️ kept .claude/agents/workflow-architect.md: unused since 3.7.0; /whip-doctor reports it
{IF created_roles}🎯 Role Skills (.claude/skills/, run on whippet):
{IF create_devops} ✓ devops ({detected_orchestration}, {detected_ci_tool}, {detected_monitoring}, {detected_cloud}, {deployment_target})
{IF with_specialists} ✓ {stack roles in created_roles[]} ({backend_stack}, {frontend_stack}, {infrastructure})
{IF created_roles}
📊 Manifests (Priority 1/2/3, 58-74% token reduction): ✓ docs/agents/{6 universal + N roles}.md
{IF has_docs_index}📋 Documentation Hub: docs/README.md found → Agents will use it for discovery. Keep it updated.
{IF NOT has_docs_index}📂 Documentation: Scanning standard directories. 💡 Create docs/README.md to help agents discover ALL docs.
🎯 Quality Gates: ✓ .pre-commit-config.yaml ({gate_stack}), ✓ docs/development/quality-gates-{gate_stack}.md ({gates_doc}){IF frontend_gate_stack differs}, ✓ docs/development/quality-gates-{frontend_gate_stack}.md ({frontend_gates_doc}, frontend){ENDIF} | Coverage: {threshold}%, Max retries: {attempts}
{IF new_project}🔀 Integration mode: pinned ACFW_INTEGRATION_MODE=default (new project; accepted work lands on your local trunk, never pushed)
{IF NOT new_project}🔀 Integration mode: left as found ({pinned value, or "unpinned: /whip will ask you to pin it"})
📋 CLAUDE.md: {created|enhanced} with ✓ ACF definition{if_created}, ✓ Pure Delegation Architecture, ✓ Role skills table ({total_roles} roles), ✓ Backlog Workflow, ✓ Enforcement: code tasks run in their own worktree
{IF NOT with_specialists}⚠️ Note: No role skills for the stack yet. Until there are some, /task can only assign code work to whippet, with no role skill to load.
{IF NOT with_specialists} Role skills (python-engineer, react-engineer, etc.) are written by /whip-add-skills.
{IF NOT with_specialists}
{IF NOT with_specialists}🚀 NEXT: Run /whip-add-skills to write {backend_stack}-engineer{IF frontend_stack}, {frontend_stack}-engineer{ENDIF}
{IF NOT with_specialists}
{IF specialist_agents_installed}💡 Specialist agents in .claude/agents/ still run their tasks. /whip-add-skills --migrate converts them into role skills.
🚀 Next Steps:
{IF NOT with_specialists}1. /whip-add-skills (role skills for {stack})
{IF with_specialists}1. Review the role skills in .claude/skills/ and their manifests in docs/agents/
2. /whip "<goal>" (small work goes straight to /task; risky work gets a plan you approve with one "yes")
3. /go (execute), then /retro once a planned cycle is done
Any time: /whip shows where you are and the one command to run next
📚 Quick Reference: docs/acf/backlog/workflow.md, docs/acf/backlog/recovery-runbook.md, docs/acf/style/task-descriptions.md, docs/acf/backlog/task-template.md, .backlog/README.md, docs/agents/
💡 Key Features: Pattern-based generation (YOUR stack) | Deep manifest customization | Gap analysis on re-init | Pure Delegation (3x+ speedup){IF create_devops} | DevOps role skill (infrastructure-aware){IF with_specialists} | Role skills for the detected stack (--with-specialists)
All flags are optional. A scripted run might use:
/whip-init --priority=5-level --coverage=95 --strict
Flags:
--priority=3-level|5-level - Skip priority system question--coverage=60|80|95 - Skip coverage threshold question--strict - Use aggressive quality gates (5 retry attempts)--standard - Use standard quality gates (10 retry attempts)--with-specialists - Write role skills in .claude/skills/ for the detected stack (backend/frontend/infrastructure). The name predates 3.7.0; it writes no agent files.--backend=go|python|nodejs|<stack>, --frontend=nextjs|react|vue|<stack> - Override detection for that slot (Steps 1 and 4 pass them to the detector as FLAGS). A stack with no shipped gates doc gets no pre-commit config and no gates doc; /whip-add-skills writes its doc from a template.Before finishing, check that:
.backlog/ folders exist (files store only; Step 2.5 skips them on the others)CLAUDE.md exists (created or enhanced).claude/agents/, whippet among them, filled in for this project.claude/agents/workflow-architect.md is gone, or the user chose to keep itdocs/agents/, with the Priority 1/2/3 structurecreate_devops=true: .claude/skills/devops/SKILL.md and docs/agents/devops.md exist--with-specialists was used:
.claude/skills/<role>/SKILL.md, each with
user-invocable: false, except a role whose name is an installed agent; no agent file was writtendocs/agents/CLAUDE.md Role skills table lists them, not "TBD"docs/acf/.backlog/README.md was generatedGenerated files should carry this project's values, not generic template text.
If .backlog/ already exists:
Warning: .backlog/ directory already exists.
Continue and overwrite? [y/N]
If CLAUDE.md sections already exist:
Note: CLAUDE.md sections already present. Skipping duplicate additions.
Re-running /whip-init is safe and idempotent.
If tech stack not detected:
Warning: Could not auto-detect tech stack.
Please specify manually: --backend=go|python|nodejs --frontend=react|nextjs
.backlog/ structure created with 9 folders (files store)CLAUDE.md created or enhancedwhippet included)--with-specialists was used).backlog/README.md generatedWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub fib7/acf-tools --plugin acf-whip13 skills in this plugin
/clean-checkout-before-taskMandatory 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./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.