$npx -y skills add armelhbobdad/bmad-module-skill-forge --skill skf-setupInitialize forge environment, detect tools, and set capability tier (Quick/Forge/Forge+/Deep). Use when the user requests to "set up" or "initialize the forge".
| 1 | # Setup Forge |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Initializes the forge environment by detecting available tools, determining the capability tier (Quick/Forge/Forge+/Deep), and writing persistent configuration to `{project-root}/_bmad/_memory/forger-sidecar/`. When `ccc` (cocoindex-code) is available, also augments `.cocoindex_code/settings.yml` with SKF exclusion patterns and creates or refreshes the project's semantic-search index. On Deep tier, reconciles the QMD collection registry; whenever ccc is available, reconciles the CCC index registry as well. |
| 6 | |
| 7 | ## Conventions |
| 8 | |
| 9 | - Bare paths (e.g. `references/<name>.md`) resolve from the skill root. |
| 10 | - `references/` holds prompt content carved out of SKILL.md — workflow stages chained via frontmatter `nextStepFile`, plus static reference docs. |
| 11 | - Deterministic work is delegated to shared Python helpers under `src/shared/scripts/` (installed as `_bmad/skf/shared/scripts/`). Each step's frontmatter declares a `*ProbeOrder` array for the helpers it needs: run the first path in the array that exists, and halt if none resolve — the script owns that logic, with no prose fallback. |
| 12 | - `{skill-root}` resolves to this skill's installed directory (where `customize.toml` lives, if present). |
| 13 | - `{project-root}`-prefixed paths resolve from the project working directory. |
| 14 | - `{skill-name}` resolves to the skill directory's basename. |
| 15 | |
| 16 | ## Role |
| 17 | |
| 18 | You are a system executor performing environment resolution. Run each step in sequence, write configuration files, and report results at completion. |
| 19 | |
| 20 | ## Workflow Rules |
| 21 | |
| 22 | - Only load one step file at a time — never preload future steps. |
| 23 | - Communicate in `{communication_language}`. |
| 24 | - If `{headless_mode}` is true, or if `{orphan_action}` is non-null, auto-resolve the step 3 orphan-removal gate non-interactively and log the decision. |
| 25 | |
| 26 | ## Stages |
| 27 | |
| 28 | | # | Step | File | |
| 29 | |---|------|------| |
| 30 | | 1 | Detect Tools & Set Tier | references/detect-and-tier.md | |
| 31 | | 1b | CCC Index (only when ccc is available) | references/ccc-index.md | |
| 32 | | 2 | Write Config | references/write-config.md | |
| 33 | | 3 | QMD + CCC Registry Hygiene | references/auto-index.md | |
| 34 | | 4 | Report | references/report.md | |
| 35 | | 5 | Workflow Health Check | references/health-check.md | |
| 36 | |
| 37 | ## Invocation Contract |
| 38 | |
| 39 | | Aspect | Detail | |
| 40 | |--------|--------| |
| 41 | | **Inputs** | (none) | |
| 42 | | **Flags** | `--headless` / `-H` (skip prompts, auto-resolve gates to defaults); `--require-tier=<Quick\|Forge\|Forge+\|Deep>` (halt with failure if calculated tier does not satisfy the requirement); `--orphan-action=<keep\|remove>` (resolve the orphan-removal gate non-interactively, even outside `--headless`); `--ccc-skip-index` (skip CCC indexing; envelope `ccc_index.status` becomes `"skipped"` — the fast re-probe lane for an expert re-running only to refresh the detected tier without paying the full ccc re-index cost); `--quiet` (suppress the human-readable FORGE STATUS banner — pipelines and expert re-runners get the envelope only) | |
| 43 | | **Gates** | One optional: orphaned QMD collection removal (step 3, Deep tier only; default: Keep, or whatever `--orphan-action` set) | |
| 44 | | **Outputs** | `forger-sidecar/forge-tier.yaml`, `forger-sidecar/preferences.yaml`, `{forge_data_folder}/`; when ccc is available, `.cocoindex_code/settings.yml` (exclusion patterns merged) and the project ccc index | |
| 45 | | **Headless** | All gates auto-resolve with default action when `{headless_mode}` is true. Under `--headless` or `--quiet`, step 4 emits a single-line `SKF_SETUP_RESULT_JSON: {…}` envelope as the only stdout line — the FORGE STATUS banner is suppressed. Branch on the envelope's top-level `status` field: `success`, `tier_failure` (require-tier miss), or `blocked` (any pre-report halt — the `error.phase` names the cause). `skf-emit-result-envelope.py` derives `status` from the payload, so pipelines never compose it from `require_tier_satisfied` + `error`. Schema in `references/report.md` §4. | |
| 46 | | **Failure modes** | `--require-tier` not satisfied → status `tier_failure`, the envelope sets `"require_tier_satisfied": false`, and the workflow halts before step 5 (interactive runs also print a "REQUIRED TIER NOT MET" block). A write failure (forge-tier.yaml or preferences.yaml could not be written) halts step 2 with a `blocked` envelope whose `error.phase` (`step 2:write-tools` or `step 2:init-prefs`) and `error` name the path and reason. | |
| 47 | |
| 48 | ## On Activation |
| 49 | |
| 50 | > **Halt contract for headless/quiet runs.** Any halt below must first emit a blocked envelope when `{headless_mode}` or `{quiet_mode}` is true, before printing the human diagnostic — a pipeline observer that sees no envelope treats the run as not-completed-cleanly. Pipe `{"phase":"<phase>","reason":"<reason>","path":"<path>"}` to `python3 <helper> emit-blocked` where `<helper>` is the first existing path of `{project-root}/_bmad/skf/sha |