**Working directory:** `{{workingDirectory}}`. All file reads, writes, and shell commands MUST operate relative to this directory. Do NOT `cd` to any other directory. For `.sf` files in this prompt, use absolute paths rooted at `{{workingDirectory}}` instead of discovering them with `Glob`.

Configure project workflow preferences. This stage runs ONCE per project, early in deep-mode bootstrap, before `discuss-project`. It applies a small set of recommended workflow defaults and persists them to `.sf/preferences.yaml` (the same file the runtime reads its preferences from).

This is a **default-writing** stage — do NOT ask the user questions. Write the recommended defaults, then end. No follow-ups, no research, no opinion.

---

## Stage Banner

Print this banner verbatim in chat as your first action:

• WORKFLOW PREFERENCES

Then say: "Quick setup — applying recommended workflow defaults."

---

## Default Set

Use these recommended defaults without asking:

- `commit_policy: per-task` — atomic commit after every task; finest granularity, easiest to revert
- `branch_model: single` — all work on current branch
- `uat_dispatch: true` — verification runs automatically; failures pause execution
- `models.executor_class: balanced` — sensible cost/quality default
- `research: skip` — deterministic default; the dedicated research-decision stage can later switch to `research`

---

## Output

Apply the defaults:

1. Read `{{workingDirectory}}/.sf/preferences.yaml` if it exists (pure YAML, no `---` markers). Also check `.sf/PREFERENCES.md` as a legacy fallback. Parse the existing YAML so you can preserve unrelated keys (e.g. `planning_depth`).
2. Merge the defaults into the YAML under these keys, preserving any existing explicit value:
   - top-level `commit_policy: per-task`
   - top-level `branch_model: single`
   - top-level `uat_dispatch: true`
   - top-level `research: skip`
   - nested `models.executor_class: balanced`
3. Also set top-level `workflow_prefs_captured: true` — this is the single explicit marker the dispatch layer uses to know the wizard has run.
4. Write `{{workingDirectory}}/.sf/preferences.yaml` back as plain YAML (no `---` frontmatter delimiters, no Markdown body). If the source was a legacy `.md` file, still write the new output to `preferences.yaml`.
5. Pre-seed the research decision so the standalone `research-decision` stage is a no-op if the user already answered here:
   - Ensure `{{workingDirectory}}/.sf/runtime/` exists.
   - Write `{{workingDirectory}}/.sf/runtime/research-decision.json`:
     ```json
     {
       "decision": "skip",
       "decided_at": "<ISO 8601 timestamp>",
       "source": "workflow-preferences",
       "reason": "deterministic-default"
     }
     ```
   Use `"skip"` unless an existing valid `{{workingDirectory}}/.sf/runtime/research-decision.json` explicitly says `"research"` with `"source": "research-decision"` or `"source": "user"`.
6. Print a concise summary in chat: each key on its own line, format `key: value`. Include `commit_policy`, `branch_model`, `uat_dispatch`, `models.executor_class`, and `research` (matching the preserved or pre-seeded runtime research decision).
7. Say exactly: `"Workflow preferences saved."` — nothing else.

Do NOT write to `.sf/config.json`; runtime preferences load from `preferences.yaml`.

---

## Critical rules

- Do NOT ask any questions. Defaults only, write file, done.
- Do NOT call `ask_user_questions`, `AskUserQuestion`, or any other interactive user-input tool in this stage.
- Do NOT change any keys other than the YAML keys specified plus `workflow_prefs_captured`. Research is persisted to `.sf/runtime/research-decision.json`, NOT to `phases.skip_research`.
- Preserve existing explicit values for `commit_policy`, `branch_model`, `uat_dispatch`, and `models.executor_class`; only fill missing values with defaults.
