From cwf
Sets up CWF environment: selects hook groups, detects external tools, bootstraps setup-contract and project config, enables optional Agent Teams, Codex integration, git hooks, capability and repo indexes.
npx claudepluginhub corca-ai/claude-plugins --plugin cwfThis skill uses the workspace's default tool permissions.
Standardize hooks, tool contracts, and project/runtime config wiring once so later workflow runs stay reproducible. Includes interactive hook toggles, external tool detection, setup-contract bootstrap for repo-adaptive suggestions, project config bootstrap, optional Agent Team mode setup, optional Codex integration, optional git hook gate installation, optional CWF capability index generation, ...
README.mdassets/githooks/pre-commit.template.shassets/githooks/pre-push.template.shreferences/codex-scope-integration.mdreferences/runtime-and-index-phases.mdreferences/setup-contract.mdreferences/tool-detection-and-deps.mdscripts/bootstrap-gate-contract.shscripts/bootstrap-project-config.shscripts/bootstrap-setup-contract.shscripts/check-configure-git-hooks-runtime.shscripts/check-index-coverage.shscripts/check-setup-contract-runtime.shscripts/configure-agent-teams.shscripts/configure-git-hooks.shscripts/configure-run-mode.shscripts/install-tooling-deps.shscripts/sync-hook-state.shCreates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Standardize hooks, tool contracts, and project/runtime config wiring once so later workflow runs stay reproducible. Includes interactive hook toggles, external tool detection, setup-contract bootstrap for repo-adaptive suggestions, project config bootstrap, optional Agent Team mode setup, optional Codex integration, optional git hook gate installation, optional CWF capability index generation, and optional repository index generation.
cwf:setup # Full setup (hooks + tools + config + Agent Team + optional Codex/repo-index prompts)
cwf:setup --hooks # Hook group selection only
cwf:setup --tools # External tool detection only
cwf:setup --env # Project config bootstrap + runtime priority guidance only
cwf:setup --agent-teams # Agent Team mode setup only
cwf:setup --run-mode # Configure default cwf:run ambiguity mode only
cwf:setup --codex # Codex integration-only rerun (scope-aware skills/references sync)
cwf:setup --codex-wrapper # Codex wrapper-only rerun (scope-aware wrapper setup)
cwf:setup --git-hooks both --gate-profile balanced # Install repo git hooks and set gate depth
cwf:setup --git-hooks pre-commit --gate-profile fast # Lightweight local-only git gate
cwf:setup --git-hooks none # Remove repo-managed git hooks
cwf:setup --cap-index # Generate/refresh CWF capability index only
cwf:setup --repo-index # Generate/refresh repository index (explicit)
cwf:setup --repo-index --target agents # AGENTS.md managed block target
cwf:setup --repo-index --target file # Standalone index file target
cwf:setup --repo-index --target both # AGENTS block + standalone index file
Operational note:
cwf:setup first; it is the default entrypoint and asks for optional integrations when relevant.--codex / --codex-wrapper when reapplying only Codex-related integration pieces.Parse input flags and run only the relevant phases:
| Input | Phases |
|---|---|
cwf:setup | 1 → 2 → 2.8 → 2.9 → 2.10 → 2.4 (if codex available) → 2.7 (always ask) → 4 (opt-in) → 5 |
cwf:setup --hooks | 1 → 5 |
cwf:setup --tools | 2 → 2.8 → 2.9 → 2.10 → 5 |
cwf:setup --env | 2.8 → 2.10 → 5 |
cwf:setup --agent-teams | 2.9 → 5 |
cwf:setup --run-mode | 2.10 → 5 |
cwf:setup --codex | 2.5 → 5 |
cwf:setup --codex-wrapper | 2.6 → 5 |
cwf:setup --git-hooks <none|pre-commit|pre-push|both> [--gate-profile <fast|balanced|strict>] | 2.7 → 5 |
cwf:setup --cap-index | 3 → 5 |
cwf:setup --repo-index [--target <agents|file|both>] | 4 → 5 |
When mode is full setup and Codex CLI is available, do not silently skip Codex integration; always run Phase 2.4 and ask the user which integration level to apply.
When mode is full setup, do not expect users to supply optional flags manually. Always ask for git hook installation mode and gate profile in Phase 2.7.
When mode is full setup or tools-only setup, always run Phase 2.8 so project config files are bootstrapped with explicit user choice.
When mode is full setup or tools-only setup, always run Phase 2.9 so Agent Team mode is explicitly aligned with CWF's multi-agent workflow assumptions.
When mode is full setup, tools-only setup, env-only setup, or run-mode-only setup, always run Phase 2.10 so cwf:run default ambiguity policy is explicit and reproducible.
If user input contains the token cwf:setup anywhere (start, middle, or end), keep execution strictly in this CWF setup skill.
cwf:setup (with optional flags/arguments after it), not loose cwf substrings.WAIT_INPUT for the first unresolved setup phase instead of switching skill families.When AskUserQuestion is unavailable or blocked, do not wait silently and do not end with empty output.
Mandatory behavior:
1.2).WAIT_INPUT response with phase id, options, and a direct reply instruction.Standard response header:
WAIT_INPUT: setup requires user selection at phase <phase-id>.
Examples:
2.8 (project config bootstrap):
--force)2.10 (run ambiguity mode):
defer-blocking (recommended)strictdefer-reversibleexplore-worktreesAlways include:
Please reply with your choice.
Configure which hook groups are active. Default: all enabled (hooks work without running cwf:setup).
Read cwf-state.yaml hooks: section for current toggle state.
Use AskUserQuestion with multiSelect: true. Present 9 hook groups with descriptions:
| Group | Description |
|---|---|
attention | Slack notifications on idle/waiting |
log | Auto-log turns + auto-commit transcripts |
read | File-size aware reading guard |
lint_markdown | Markdown validation after Write/Edit |
lint_shell | ShellCheck validation after Write/Edit |
deletion_safety | Blocks risky file deletions and requires policy-compliant justification |
workflow_gate | Enforces workflow stage/branch safety rules before edits and commands |
websearch_redirect | Redirect WebSearch to cwf:gather |
compact_recovery | Inject live session state after auto-compact and guard session↔worktree binding on prompts |
Pre-select groups that are currently enabled in cwf-state.yaml.
Apply selected hook groups with deterministic sync script:
bash {SKILL_DIR}/scripts/sync-hook-state.sh --enable "<comma-separated selected groups>"
This command writes ~/.claude/cwf-hooks-enabled.sh with:
# Generated by cwf:setup
export HOOK_ATTENTION_ENABLED="true"
export HOOK_LOG_ENABLED="true"
export HOOK_READ_ENABLED="true"
export HOOK_LINT_MARKDOWN_ENABLED="false"
export HOOK_LINT_SHELL_ENABLED="true"
export HOOK_DELETION_SAFETY_ENABLED="true"
export HOOK_WORKFLOW_GATE_ENABLED="true"
export HOOK_WEBSEARCH_REDIRECT_ENABLED="true"
export HOOK_COMPACT_RECOVERY_ENABLED="true"
export HOOK_{GROUP}_ENABLED line per group (uppercased)"true" or "false" (quoted strings)cwf-hook-gate.shThe same command updates cwf-state.yaml hooks: to mirror selections:
hooks:
attention: true
log: true
read: true
lint_markdown: false
lint_shell: true
deletion_safety: true
workflow_gate: true
websearch_redirect: true
compact_recovery: true
Before moving on, verify parity:
bash {SKILL_DIR}/scripts/sync-hook-state.sh --check
Detect availability of external AI/search tools and local runtime dependencies used by CWF checks/skills.
Run external tool checks (codex, gemini, agent-browser, API keys) and local dependency checks (shellcheck, jq, gh, node, python3, lychee, markdownlint-cli2) as defined in tool-detection-and-deps.md.
Rewrite cwf-state.yaml tools: section with the detection results.
Report detection groups:
If missing dependencies exist, ask install strategy (Install missing now, Show commands only, Skip for now) and execute the matching branch from tool-detection-and-deps.md.
After install attempts, re-run dependency check and explicitly report unresolved tools before continue/stop decision.
cwf-state.yaml Rewrite (Required)When Install missing now was selected, re-run 2.1 -> 2.2 -> 2.3 in full so cwf-state.yaml stays SSOT. This is mandatory even when unresolved dependencies remain.
Bootstrap setup contract draft (.cwf/setup-contract.yaml by default), report contract status (created|existing|updated|fallback), and ask whether to apply repo-specific tool suggestions now. If bootstrap returns fallback, stop setup immediately and resolve bootstrap failure first.
If Phase 2 reports agent-browser: unavailable, ask whether to install browser-debug capability now.
Detailed checks, prompts, and commands: tool-detection-and-deps.md.
Use this phase when:
cwf:setup)codex: availableResolve scope using detect-plugin-scope.sh and parse key-value output without eval (safe parser examples are in codex-scope-integration.md).
Mandatory behavior:
none, do not silently default to user; ask user to choose target scope explicitly.project or local and root is empty, resolve fallback root using git top-level (or current cwd).Use AskUserQuestion prompts exactly as defined in codex-scope-integration.md:
Skills + wrapper, Skills only, Skip)Safety guard:
user, require a second explicit confirmation before mutation.Run command matrix from codex-scope-integration.md:
Skills + wrapper: run sync-skills.sh, then install-wrapper.sh --enable (add PATH only in user scope), then wrapper status.Skills only: run sync-skills.sh.Skip for now: no mutation.When wrapper installation was selected, always report:
install-wrapper.sh --statustype -a codexDetailed rollback/report templates are in codex-scope-integration.md, including alias boundary notes for absolute-path aliases/functions.
Use this phase when:
cwf:setup --codexReuse Phase 2.4.1. Prompt/override details are in codex-scope-integration.md.
Run sync-skills.sh with selected scope and optional --project-root exactly as defined in codex-scope-integration.md.
Report checklist and verification commands are in codex-scope-integration.md.
Use this phase when:
cwf:setup --codex-wrapperReuse Phase 2.4.1. Prompt/override details are in codex-scope-integration.md.
Use AskUserQuestion prompt text from codex-scope-integration.md. If user declines, skip this phase.
Run wrapper install command matrix from codex-scope-integration.md:
--add-path--project-rootStatus, rollback, PATH notes, and post-run tuning options are documented in codex-scope-integration.md.
Use this phase when:
cwf:setup)cwf:setup --git-hooks ...Mandatory execution order:
Resolve hook install mode (--git-hooks or AskUserQuestion).
Resolve gate profile (fast|balanced|strict) unless mode is none.
Bootstrap run gate contract:
bash {SKILL_DIR}/scripts/bootstrap-gate-contract.sh --json
If contract status is fallback, stop setup (fail-safe) and request path/permission fix.
Report effective hook state + contract policy summary (auto -> portable, explicit authoring path only for maintainer flows).
Detailed prompts, command matrix, and reporting checklist: runtime-and-index-phases.md.
Use this phase when:
cwf:setup)cwf:setup --toolscwf:setup --envMandatory behavior:
--force only for overwrite)..cwf-config.local.yaml > .cwf-config.yaml > process env > shell exports).WAIT_INPUT and stop this run.Detailed prompts, command templates, and reporting checklist: runtime-and-index-phases.md.
Use this phase when:
cwf:setup)cwf:setup --toolscwf:setup --agent-teamsMandatory behavior:
enable, keep, disable).--enable, --status, or --disable.Detailed prompts, command templates, and reporting checklist: runtime-and-index-phases.md.
Use this phase when:
cwf:setup)cwf:setup --toolscwf:setup --envcwf:setup --run-modeMandatory behavior:
CWF_RUN_AMBIGUITY_MODE (default fallback: defer-blocking).defer-blocking|strict|defer-reversible|explore-worktrees).shared|local).--ambiguity-mode flag > local config > shared config > env/shell > built-in default).WAIT_INPUT and stop this run.Detailed prompts, command templates, and reporting checklist: runtime-and-index-phases.md.
This phase runs only when --cap-index is explicitly requested.
Mandatory behavior:
check-index-coverage.sh --profile capDetailed generation and validation checklist: runtime-and-index-phases.md.
Generate repository index when explicitly requested or approved in full setup.
Mandatory behavior:
--target or repository-context detection (agents, file, both)check-index-coverage.sh --profile repoDetailed generation and validation checklist: runtime-and-index-phases.md.
Ask for learnings and append lessons.md with the standard Expected/Actual/Takeaway format when provided.
Add setup to cwf-state.yaml current session's stage_checkpoints list.
Detailed lessons/checkpoint format: runtime-and-index-phases.md.
cwf-state.yaml (do not overwrite wholesale), and keep reruns safe/idempotent across all phases.cwf:setup) must execute the integrated optional decision flow for Codex, hooks, setup-contract proposal, config bootstrap, agent-teams, and run-mode phases in one run.--cap-index; repository index runs via --repo-index with target resolution (agents, file, both) from CLI or repository context.none, require explicit user scope selection before any Codex mutation.created|existing|updated|fallback status. fallback is fail-safe and must halt setup.{artifact_root}/gate-contract.yaml)configure-git-hooks.shconfigure-git-hooks.sh.gitignore sync~/.claude/settings.jsoncwf:run ambiguity mode into project config.cwf/setup-contract.yaml) from core baseline + repo scancreated|existing|updated|fallback, with fail-safe fallback)