From cwf
Orchestrates full CWF pipeline auto-chaining (gather→clarify→plan→review(plan)→impl→review(code)→refactor→retro→ship) for end-to-end task delegation. Triggers: cwf:run
How this skill is triggered — by the user, by Claude, or both
Slash command
/cwf:runThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Delegate end-to-end workflow orchestration when users do not want to manually sequence each skill.
Delegate end-to-end workflow orchestration when users do not want to manually sequence each skill.
cwf:run <task description> # Full pipeline from scratch
cwf:run --from impl # Resume from impl stage
cwf:run --skip ship # Full pipeline, skip ship
cwf:run --skip review-plan,retro # Skip specific stages
cwf:run --ambiguity-mode strict # Override T3 handling policy for this run
Operational note:
cwf:run chain is: gather → clarify → plan → review(plan) → impl → review(code) → refactor → retro → ship.refactor runs before retro/ship to catch cross-skill and docs drift as part of the default delivery quality loop.If user input contains the token cwf:run anywhere, keep execution strictly in this CWF run skill.
cwf:run (with optional flags/arguments), not loose cwf substrings.WAIT_INPUT instead of switching skill families.When interactive confirmation is unavailable, do not continue with inferred defaults for setup/readiness gates.
Mandatory behavior:
Standard response header:
WAIT_INPUT: run requires setup readiness before pipeline initialization.
Always include:
Run `cwf:setup` first, then retry `cwf:run`.
Before initializing pipeline state, validate that repository setup prerequisites exist.
Run deterministic readiness check:
bash {CWF_PLUGIN_DIR}/scripts/check-setup-readiness.sh --base-dir . --summary
If check fails, do not initialize live state and do not create run artifacts.
Return deterministic waiting output:
WAIT_INPUT: run requires setup readiness before pipeline initialization.
Missing setup prerequisites were detected.
Run `cwf:setup` first, then retry `cwf:run`.
Parse task description and flags (--from, --skip, --ambiguity-mode)
Resolve base branch (for branch/ship policy):
resolved_base_branch="$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||')"
if [[ -z "$resolved_base_branch" ]]; then
if git show-ref --verify --quiet refs/heads/main; then
resolved_base_branch="main"
elif git show-ref --verify --quiet refs/heads/master; then
resolved_base_branch="master"
else
echo "WAIT_INPUT: base branch could not be resolved (tried origin/HEAD, main, master)."
exit 1
fi
fi
Enforce run-start branch policy:
current_branch="$(git branch --show-current)"
if [[ "$current_branch" == "$resolved_base_branch" ]]; then
session_slug="{sanitized-title}"
run_branch="feat/${session_slug}"
if git show-ref --verify --quiet "refs/heads/$run_branch"; then
run_branch="feat/${session_slug}-$(date +%H%M%S)"
fi
git checkout -b "$run_branch"
current_branch="$run_branch"
fi
main), create and switch to a dedicated feature branch before stage writes.Resolve ambiguity mode (--ambiguity-mode or config default):
source {CWF_PLUGIN_DIR}/hooks/scripts/env-loader.sh
cwf_env_load_vars CWF_RUN_AMBIGUITY_MODE
# precedence: CLI flag > config/env > built-in default
resolved_mode="{--ambiguity-mode flag value if provided}"
if [[ -z "$resolved_mode" ]]; then
resolved_mode="${CWF_RUN_AMBIGUITY_MODE:-defer-blocking}"
fi
case "$resolved_mode" in
strict|defer-blocking|defer-reversible|explore-worktrees) ;;
*)
echo "Invalid ambiguity mode: $resolved_mode (fallback: defer-blocking)"
resolved_mode="defer-blocking"
;;
esac
Bootstrap session directory via {CWF_PLUGIN_DIR}/scripts/next-prompt-dir.sh --bootstrap <sanitized-title>
plan.md/lessons.md if missing, and pre-registers the session in cwf-state.yaml sessions when state exists.Initialize live state (session-first write path):
bash {CWF_PLUGIN_DIR}/scripts/cwf-live-state.sh set . \
session_id="{next session ID}" \
dir="{session directory}" \
branch="{current branch}" \
worktree_root="{current git worktree root (absolute path)}" \
worktree_branch="{current branch}" \
phase="gather" \
task="{task description}" \
active_pipeline="cwf:run" \
user_directive="{original user directive}" \
ambiguity_mode="{resolved_mode}" \
blocking_decisions_pending="false" \
ambiguity_decisions_file="{session directory}/run-ambiguity-decisions.md" \
stage_provenance_file="{session directory}/run-stage-provenance.md" \
pipeline_override_reason="" \
state_version="1"
planned_closing_gates="{comma-separated subset of review-code,refactor,retro,ship after applying --from/--skip filters}"
bash {CWF_PLUGIN_DIR}/scripts/cwf-live-state.sh list-set . \
remaining_gates="$planned_closing_gates"
Initialize ambiguity ledger file (all modes):
cat > "{session directory}/run-ambiguity-decisions.md" <<'EOF'
# Run Ambiguity Decisions
mode: {resolved_mode}
open_blocking_count: 0
open_non_blocking_count: 0
updated_at: {ISO-8601 UTC}
| Decision ID | Stage | Question | Chosen Option | Blocking | Reversible | Follow-up |
|---|---|---|---|---|---|---|
EOF
Initialize stage provenance log file:
stage_provenance_file="{session directory}/run-stage-provenance.md"
if [[ ! -f "$stage_provenance_file" ]]; then
cat > "$stage_provenance_file" <<'EOF'
# Run Stage Provenance
| Stage | Skill | Args | Started At (UTC) | Finished At (UTC) | Duration (s) | Artifacts | Gate Outcome |
|---|---|---|---|---|---|---|---|
EOF
elif ! grep -Fqx '| Stage | Skill | Args | Started At (UTC) | Finished At (UTC) | Duration (s) | Artifacts | Gate Outcome |' "$stage_provenance_file"; then
printf '\n| Stage | Skill | Args | Started At (UTC) | Finished At (UTC) | Duration (s) | Artifacts | Gate Outcome |\n|---|---|---|---|---|---|---|---|\n' >> "$stage_provenance_file"
fi
Report initialization:
Pipeline initialized: {session_dir}
Ambiguity mode: {resolved_mode}
Stages: {list of stages to execute, with skipped ones marked}
Execute stages in order. Each stage invokes the corresponding CWF skill via the Skill tool.
| # | Stage | Skill Invocation | Gate | Auto |
|---|---|---|---|---|
| 1 | gather | cwf:gather | — | false |
| 2 | clarify | cwf:clarify | T3 policy depends on ambiguity mode | false |
| 3 | plan | cwf:plan | User approves plan | false |
| 4 | review-plan | cwf:review --mode plan | Verdict-based | true |
| 5 | impl | cwf:impl --skip-clarify | — | true |
| 6 | review-code | cwf:review --mode code | Verdict-based | true |
| 7 | refactor | cwf:refactor | — | true |
| 8 | retro | cwf:retro --from-run | — | true |
| 9 | ship | cwf:ship issue → cwf:ship pr (non-base branch) | User confirms PR | false |
Use live.ambiguity_mode (resolved in Phase 1).
| Mode | Clarify T3 handling | Merge policy |
|---|---|---|
strict | Stop and ask user for every T3 decision | no extra blocking by mode |
defer-blocking | Decide autonomously, but persist unresolved decision debt | unresolved decision debt is merge-blocking at ship |
defer-reversible | Decide autonomously with reversible structure (flags/adapters/switch points) | track debt, non-blocking by default |
explore-worktrees | Implement alternatives in separate worktrees, then pick baseline | blocking depends on final unresolved debt |
When mode is not strict, create/update {session_dir}/run-ambiguity-decisions.md whenever T3 debt exists using this minimum file contract:
# Run Ambiguity Decisions
mode: {mode}
open_blocking_count: {integer}
open_non_blocking_count: {integer}
updated_at: {ISO-8601 UTC}
| Decision ID | Stage | Question | Chosen Option | Blocking | Reversible | Follow-up |
|---|---|---|---|---|---|---|
| ... | clarify | ... | ... | yes/no | yes/no | issue/pr ref or TODO |
explore-worktrees operational flowUse the deterministic worktree creation/validation/reconcile flow from references/stage-operations.md.
For each stage (respecting --from and --skip), execute deterministic loop from references/stage-operations.md, including:
review-code|retro|shipcheck-run-gate-artifacts.sh --strict)Use deterministic Revise/Fail handling from references/stage-operations.md. Invariant: max 1 auto-fix attempt for Revise; Fail always hard-stops and requires explicit user decision.
Follow deterministic precheck path in references/stage-operations.md. check-run-from-prereqs.sh output is authoritative for prerequisite pass/fail.
Follow deterministic skip behavior in references/stage-operations.md.
After all stages complete (or the pipeline is halted):
Run session completeness check:
bash {CWF_PLUGIN_DIR}/scripts/check-session.sh --impl
session_dir=$(bash {CWF_PLUGIN_DIR}/scripts/cwf-live-state.sh get . dir)
stage_provenance_file=$(bash {CWF_PLUGIN_DIR}/scripts/cwf-live-state.sh get . stage_provenance_file)
gate_args=()
for closing_stage in review-code refactor retro ship; do
if awk -F'|' -v stage="$closing_stage" '
BEGIN { found=0 }
/^\|/ {
s=$2; outcome=$9
gsub(/^[[:space:]]+|[[:space:]]+$/, "", s)
gsub(/^[[:space:]]+|[[:space:]]+$/, "", outcome)
if (s == stage && outcome != "Skipped") {
found=1
}
}
END { exit(found ? 0 : 1) }
' "$stage_provenance_file"; then
gate_args+=(--stage "$closing_stage")
fi
done
if [[ "${#gate_args[@]}" -gt 0 ]]; then
bash {CWF_PLUGIN_DIR}/scripts/check-run-gate-artifacts.sh \
--session-dir "$session_dir" \
"${gate_args[@]}" \
--strict \
--record-lessons
else
echo "No run-closing stages were executed; skip final run-closing artifact gate."
fi
If any FAIL items are reported, fix them before proceeding; this is a forced function and the pipeline is not complete until all checks pass. If gate output includes Retro soft-gate omissions (PERSISTENCE_GATE=SOFT_CONTINUE), copy those items into the final pipeline summary under Retro Gate Follow-ups (do not compress into a generic warning).
Update state:
bash {CWF_PLUGIN_DIR}/scripts/cwf-live-state.sh list-set . remaining_gates=""bash {CWF_PLUGIN_DIR}/scripts/cwf-live-state.sh set . phase="done" active_pipeline="" user_directive="" pipeline_override_reason="" blocking_decisions_pending="false"cwf-state.yaml stays consistent with final artifacts/summary (registration is initialized during Phase 1 bootstrap)Report pipeline summary:
## Pipeline Complete
### Stages Executed
| Stage | Status | Notes |
|-------|--------|-------|
| gather | completed | — |
| clarify | completed | — |
| plan | completed | — |
| review-plan | Pass | — |
| impl | completed | 3 commits |
| review-code | Conditional Pass | 1 concern addressed |
| refactor | completed | docs/skills drift check |
| retro | completed | — |
| ship | skipped | --skip flag |
### Artifacts
- Plan: {path to plan.md}
- Lessons: {path to lessons.md}
- Retro: {path to retro.md}
- Stage provenance: {session_dir}/run-stage-provenance.md
- Session dir: {session_dir}
### Retro Gate Follow-ups
- {none | each retro soft-gate omission from check-run-gate-artifacts output}
cwf-live-state.sh set and list-set at every stage transition so session-local live state stays current while root summary remains synchronized.cwf:run orchestrates but does not micromanage.--from impl --skip retro is valid. Apply both filters.cwf:run must not pass --skip-branch to cwf:impl unless the user explicitly requests bypass.cwf-state.yaml, session artifacts, and handoff docs before invoking downstream skills.live.worktree_root, stop immediately and request explicit user decision before any write/edit/ship action.active_pipeline="cwf:run" and remaining_gates includes review-code, ship/push/commit intents must be blocked unless pipeline_override_reason is explicitly set.review-code, refactor, retro, and ship are not complete unless check-run-gate-artifacts.sh --strict passes for that stage.cwf:run must execute check-setup-readiness.sh and halt with WAIT_INPUT when prerequisites are missing.--ambiguity-mode flag overrides config. Config (CWF_RUN_AMBIGUITY_MODE) overrides built-in default (defer-blocking).strict T3 carry-over must be recorded in {session_dir}/run-ambiguity-decisions.md and synchronized to live.blocking_decisions_pending via sync-ambiguity-debt.sh.Proceed/Revise/Fail/Skipped/User Stop) must append a provenance row, including early-stop paths before halt/return.Fail is not Revise: Fail halts automation immediately and requires explicit user direction before any downstream stage.cwf:run starts on the resolved base branch, create/switch to a dedicated feature branch before editing.cwf:run--from prerequisite gate for stage resume safetynpx claudepluginhub corca-ai/claude-plugins --plugin cwfOrchestrates an adversarial plan-implement-review pipeline by spawning agents with separate context windows. Use after intake skills produce a starting document.
Orchestrates development pipeline by classifying tasks, coordinating skill execution order, adapting flow to context, and ensuring no critical steps are skipped.