{
  "schemaVersion": "1",
  "revision": "22ce5d34dbcb5a78",
  "id": "codex-variation-workflows-practice",
  "slug": "variation-workflows-practice",
  "title": "Controlled variation workflows: practice drills",
  "summary": "Fourteen exercises covering variation suitability, single-variable matrices, run artifacts, saved prompt seeds, repository checkpoints, candidate isolation and overrides, uniform verification, comparison, selection, convergence, failure recovery, and final…",
  "category": "Planning",
  "tags": [
    "variations",
    "verification",
    "comparison",
    "practice"
  ],
  "sources": [
    {
      "label": "Portable Codex workflow resources",
      "url": "https://lapis-fossil-vsbc.here.now/downloads/codex-power-user-workshop-2026-06-27.bundle"
    }
  ],
  "sourceUnits": [
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 1: Decide Whether Variations Are Appropriate",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 2: Find The Variable",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 3: Write A Variation Matrix",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 4: Create The Run Folder",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 5: Save The Section 5 Seed",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 6: Checkpoint Repo State",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 7: Choose Isolation",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 8: Build Candidate Prompts",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 9: Run The Same Verification",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 10: Build A Comparison File",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 11: Pick The Decision Outcome",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 12: Save The Decision And Convergence Prompt",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 13: Failure Path Drill",
    "downloads/codex-power-user-workshop-2026-06-27.bundle!/exercises/06-code-is-free-generate-variations.md#Exercises: 06. Code Is Free / Generate Variations/Exercise 14: Final Check",
    "downloads/codex-power-user-workshop-2026-06-27.bundle"
  ],
  "collection": "codex",
  "categoryId": "planning",
  "wordCount": 2018,
  "url": "/topics/codex-variation-workflows-practice/",
  "markdownUrl": "/markdown/codex-variation-workflows-practice.md?raw=1&v=22ce5d34dbcb5a78",
  "jsonUrl": "/api/v1/documents/codex-variation-workflows-practice.json",
  "headings": [
    {
      "id": "exercise-1-decide-whether-variations-are-appropriate",
      "text": "Exercise 1: Decide Whether Variations Are Appropriate",
      "level": 2
    },
    {
      "id": "exercise-2-find-the-variable",
      "text": "Exercise 2: Find The Variable",
      "level": 2
    },
    {
      "id": "exercise-3-write-a-variation-matrix",
      "text": "Exercise 3: Write A Variation Matrix",
      "level": 2
    },
    {
      "id": "exercise-4-create-the-run-folder",
      "text": "Exercise 4: Create The Run Folder",
      "level": 2
    },
    {
      "id": "exercise-5-save-the-section-5-seed",
      "text": "Exercise 5: Save The Section 5 Seed",
      "level": 2
    },
    {
      "id": "exercise-6-checkpoint-repo-state",
      "text": "Exercise 6: Checkpoint Repo State",
      "level": 2
    },
    {
      "id": "exercise-7-choose-isolation",
      "text": "Exercise 7: Choose Isolation",
      "level": 2
    },
    {
      "id": "exercise-8-build-candidate-prompts",
      "text": "Exercise 8: Build Candidate Prompts",
      "level": 2
    },
    {
      "id": "exercise-9-run-the-same-verification",
      "text": "Exercise 9: Run The Same Verification",
      "level": 2
    },
    {
      "id": "exercise-10-build-a-comparison-file",
      "text": "Exercise 10: Build A Comparison File",
      "level": 2
    },
    {
      "id": "exercise-11-pick-the-decision-outcome",
      "text": "Exercise 11: Pick The Decision Outcome",
      "level": 2
    },
    {
      "id": "exercise-12-save-the-decision-and-convergence-prompt",
      "text": "Exercise 12: Save The Decision And Convergence Prompt",
      "level": 2
    },
    {
      "id": "exercise-13-failure-path-drill",
      "text": "Exercise 13: Failure Path Drill",
      "level": 2
    },
    {
      "id": "exercise-14-final-check",
      "text": "Exercise 14: Final Check",
      "level": 2
    },
    {
      "id": "related-resources",
      "text": "Related resources",
      "level": 2
    }
  ],
  "markdown": "# Controlled variation workflows: practice drills\n\nThese exercises practice turning one deliberate prompt into controlled, verified candidates.\n\nUse a real software project when possible. Keep each exercise small. The goal is not to generate the most candidates; the goal is to compare useful options without losing control.\n\n## Exercise 1: Decide Whether Variations Are Appropriate\n\nFor each task, choose `use variations` or `skip variations`.\n\n| Task | Use / Skip | Why |\n| --- | --- | --- |\n| Add saved payment methods to checkout, with several plausible UI entry points | | |\n| Fix a one-character typo in a route name | | |\n| Stop duplicate billing webhook processing, with multiple plausible idempotency strategies | | |\n| Apply a strict framework migration with exact steps | | |\n| Compare auth/session architecture before refresh-token rotation | | |\n| Implement an exact requested API shape | | |\n| Choose the right test boundary for a regression | | |\n| Repo is dirty and there is no saved state | | |\n| No verification command exists for the candidates | | |\n\nWrite:\n\n```markdown\n# Variation Decision\n\n- task:\n- decision:\n- why:\n- verification available:\n- state safe for fan-out:\n```\n\n## Exercise 2: Find The Variable\n\nPick one request and identify the single variable under test.\n\n| Request | Possible Variable |\n| --- | --- |\n| Checkout saved payment methods could be integrated several ways. | UI integration strategy |\n| Billing webhooks sometimes process the same invoice twice. | idempotency strategy |\n| Auth/session code is becoming hard to reason about. | architecture boundary |\n| This regression needs better coverage. | test boundary |\n| The agent keeps producing broad implementation plans. | prompt framing |\n| The docs are technically correct but hard to use. | documentation organization |\n\nFill out:\n\n```markdown\n# Variable Notes\n\n- request:\n- chosen variable:\n- why this variable matters:\n- invariants:\n  -\n  -\n  -\n- out of scope:\n  -\n  -\n  -\n- candidate count:\n- review question:\n```\n\nRule:\n\n```text\nIf you cannot finish \"we are comparing candidates that differ only by ___,\" stop and narrow.\n```\n\n## Exercise 3: Write A Variation Matrix\n\nUse one of these scenarios:\n\n```text\ncheckout saved payment methods\nbilling webhook duplicate-processing\nauth/session architecture\ntest strategy for a regression\n```\n\nTemplate:\n\n```markdown\n# Variation Matrix\n\n## Goal\n\n## Invariants\n\n- same repo state:\n- same base prompt:\n- same target feature or bug:\n- same constraints:\n- same verification command:\n- same review criteria:\n\n## Variable Under Test\n\n- variable:\n- why this matters:\n- what is out of scope:\n\n## Candidate Count\n\n- count:\n- ids:\n\n## Candidates\n\n| ID | Variable setting | Output location | Verification command | Notes |\n| --- | --- | --- | --- | --- |\n| v1 | | | | |\n| v2 | | | | |\n| v3 | | | | |\n\n## Review Criteria\n\n1.\n2.\n3.\n4.\n5.\n```\n\nCheck it:\n\n```bash\nrg -n \"Goal|Invariants|Variable Under Test|Candidate Count|Review Criteria\" matrix.md\n```\n\n## Exercise 4: Create The Run Folder\n\nCreate a run root under `artifacts/variations`.\n\n```bash\nRUN_ID=\"exercise-$(date +%Y%m%d-%H%M%S)\"\nROOT=\"artifacts/variations/$RUN_ID\"\nmkdir -p \"$ROOT\"/{prompts,launch,logs,review,decisions}\nmkdir -p \"$ROOT\"/candidates/{v1,v2,v3}\nfind \"$ROOT\" -maxdepth 3 -type d | sort\n```\n\nFill out:\n\n```markdown\n# Run Folder Notes\n\n- run id:\n- root:\n- prompt folder:\n- launch folder:\n- candidate folders:\n- logs folder:\n- review folder:\n- decisions folder:\n```\n\n## Exercise 5: Save The Section 5 Seed\n\nUse Prompt Builder to save the base prompt and launch JSON.\n\nCheckout example:\n\n```bash\nPROMPT='Generate three controlled implementations for saved payment methods in checkout. Keep the database contract and provider API fixed. Vary only the UI integration strategy. Each option must include files to edit, tests to run, risks, and rollback notes.'\n\np --print-prompt \"$PROMPT\" \\\n  > \"$ROOT/prompts/base.prompt.md\"\n\np --print-launch-json \"$PROMPT\" \\\n  > \"$ROOT/launch/base.launch.json\"\n\ntest -s \"$ROOT/prompts/base.prompt.md\" && echo \"base-prompt:OK\"\njq '.mode, .prompt' \"$ROOT/launch/base.launch.json\"\n```\n\nBilling example:\n\n```bash\nPROMPT='Generate three controlled fixes for duplicate billing webhook processing. Keep the provider contract and database schema fixed. Vary only the idempotency strategy. Each option must name files, tests, risks, and rollback notes.'\n\np --print-prompt \"$PROMPT\" \\\n  > \"$ROOT/prompts/base.prompt.md\"\n\np --print-launch-json \"$PROMPT\" \\\n  > \"$ROOT/launch/base.launch.json\"\n```\n\nFill out:\n\n```markdown\n# Seed Notes\n\n- base prompt path:\n- launch JSON path:\n- software goal:\n- invariant 1:\n- invariant 2:\n- variable:\n- candidate count:\n- verification command:\n- seed ready? yes/no\n- one improvement before fan-out:\n```\n\n## Exercise 6: Checkpoint Repo State\n\nBefore fan-out, save the current repo state.\n\n```bash\ngit status --short | tee \"$ROOT/review/git-status-before.txt\"\ngit diff > \"$ROOT/review/dirty-before.patch\"\ngit diff --staged > \"$ROOT/review/staged-before.patch\"\n```\n\nFill out:\n\n```markdown\n# Repo State Before Fan-Out\n\n- status file:\n- unstaged patch file:\n- staged patch file:\n- repo clean? yes/no\n- if dirty, what is the dirty work:\n- safe next move:\n```\n\nChoose one safe next move:\n\n| Situation | Move |\n| --- | --- |\n| repo clean | continue |\n| intentional local work | commit or stash |\n| unrelated local work | move it out of the candidate path |\n| generated noise | clean or move under `artifacts/` |\n| unsure | inspect before launching |\n\n## Exercise 7: Choose Isolation\n\nPick the isolation level for your variation set.\n\n| Candidate Type | Best Isolation | Why |\n| --- | --- | --- |\n| prompt rewrites only | copied prompt/output folders | |\n| implementation candidates editing same files | git worktrees | |\n| small sequential experiments | branches | |\n| UI variants that can coexist | feature flags | |\n| services that need ports | unique process state | |\n| generated docs | output directories | |\n\nWrite:\n\n```markdown\n# Isolation Plan\n\n- chosen isolation:\n- why:\n- what could collide:\n- how collisions are prevented:\n- where outputs go:\n- where logs go:\n- how to clean up:\n```\n\n## Exercise 8: Build Candidate Prompts\n\nCopy the base prompt, then append one candidate setting.\n\n```bash\nfor id in v1 v2 v3; do\n  cp \"$ROOT/prompts/base.prompt.md\" \"$ROOT/prompts/$id.prompt.md\"\ndone\n```\n\nCheckout UI integration example:\n\n```bash\ncat >> \"$ROOT/prompts/v1.prompt.md\" <<'EOF'\nCandidate override:\n- candidate id: v1\n- variable: UI integration strategy\n- setting: inline payment method selector in the checkout form\n- do not change any other dimension\nEOF\n\ncat >> \"$ROOT/prompts/v2.prompt.md\" <<'EOF'\nCandidate override:\n- candidate id: v2\n- variable: UI integration strategy\n- setting: account drawer payment method selector\n- do not change any other dimension\nEOF\n\ncat >> \"$ROOT/prompts/v3.prompt.md\" <<'EOF'\nCandidate override:\n- candidate id: v3\n- variable: UI integration strategy\n- setting: review-step payment method selector\n- do not change any other dimension\nEOF\n```\n\nConfirm:\n\n```bash\nfor id in v1 v2 v3; do\n  echo \"== $id ==\"\n  rg -n \"Candidate override|variable:|setting:|do not change\" \"$ROOT/prompts/$id.prompt.md\"\ndone\n```\n\nFill out:\n\n```markdown\n# Candidate Prompt Notes\n\n| Candidate | Variable setting | Same base prompt? | Same invariants? |\n| --- | --- | --- | --- |\n| v1 | | | |\n| v2 | | | |\n| v3 | | | |\n```\n\n## Exercise 9: Run The Same Verification\n\nPick one verification command for every candidate.\n\nExamples:\n\n```bash\nVERIFY='pnpm test checkout -- --runInBand && pnpm build'\nVERIFY='pnpm test billing-webhook -- --runInBand && pnpm build'\nVERIFY='pnpm test auth -- --runInBand && pnpm build'\nVERIFY='pnpm test -- --runInBand'\n```\n\nRun:\n\n```bash\n: > \"$ROOT/review/verification.tsv\"\n\nfor id in v1 v2 v3; do\n  (\n    cd \"$PARENT/$id\"\n    bash -lc \"$VERIFY\"\n  ) > \"$ROOT/logs/$id.verify.log\" 2>&1\n  status=$?\n  printf '%s\\t%s\\t%s\\n' \"$id\" \"$status\" \"$VERIFY\" \\\n    >> \"$ROOT/review/verification.tsv\"\ndone\n\ncolumn -t -s $'\\t' \"$ROOT/review/verification.tsv\"\n```\n\nFill out:\n\n```markdown\n# Verification Notes\n\n- verification command:\n- v1 status:\n- v1 log:\n- v2 status:\n- v2 log:\n- v3 status:\n- v3 log:\n- candidates excluded from review because they failed:\n- candidates allowed into review:\n```\n\n## Exercise 10: Build A Comparison File\n\nCreate a simple review surface.\n\n```bash\ncat > \"$ROOT/review/comparison.md\" <<EOF\n# Variation Comparison\n\n## Goal\n\n## Variable Under Test\n\n## Verification\n\n| Candidate | Status | Log |\n| --- | --- | --- |\n| v1 | see \\`verification.tsv\\` | \\`$ROOT/logs/v1.verify.log\\` |\n| v2 | see \\`verification.tsv\\` | \\`$ROOT/logs/v2.verify.log\\` |\n| v3 | see \\`verification.tsv\\` | \\`$ROOT/logs/v3.verify.log\\` |\n\n## Review Criteria\n\n1.\n2.\n3.\n4.\n5.\n\n## Notes\n\n| Candidate | Strengths | Risks | Keep / Drop |\n| --- | --- | --- | --- |\n| v1 | | | |\n| v2 | | | |\n| v3 | | | |\nEOF\n```\n\nConfirm:\n\n```bash\ntest -s \"$ROOT/review/comparison.md\" && echo \"comparison:OK\"\n```\n\n## Exercise 11: Pick The Decision Outcome\n\nChoose one outcome.\n\n| Outcome | Use When |\n| --- | --- |\n| Pick | one candidate wins as-is |\n| Combine | one primary candidate wins, but named pieces from others should be merged |\n| Refine | one candidate wins but needs specific improvements |\n| Expand | the round was useful, but a new dimension needs another round |\n| Reject | the set is not worth continuing |\n\nFill out:\n\n```markdown\n# Decision Outcome\n\n- outcome:\n- primary candidate:\n- secondary candidate ids:\n- why:\n- rejected candidates:\n- what to keep:\n- what to drop:\n- required final verification command:\n```\n\n## Exercise 12: Save The Decision And Convergence Prompt\n\nWrite the saved decision file.\n\n```bash\ncat > \"$ROOT/decisions/selection.md\" <<'EOF'\n# Saved Decision\n\n- outcome:\n- primary candidate:\n- secondary candidate ids:\n- decision:\n- why:\n- rejected candidates:\n- required follow-up:\n- final verification command:\n\n## Review Notes\n\n- v1:\n- v2:\n- v3:\n\n## Continue Prompt\n\nContinue from this saved decision.\nDo not reopen the entire search.\nPreserve the selected candidate.\nApply only the named feedback.\nRun final verification and save the result.\nEOF\n```\n\nCreate the convergence prompt:\n\n```bash\ncat \"$ROOT/decisions/selection.md\" \\\n  | p --stdin --print-prompt \\\n  \"Use this saved decision to converge the variation set. Keep scope narrow and run the required verification.\" \\\n  > \"$ROOT/prompts/converge.prompt.md\"\n\ntest -s \"$ROOT/decisions/selection.md\" && echo \"decision:OK\"\ntest -s \"$ROOT/prompts/converge.prompt.md\" && echo \"converge-prompt:OK\"\n```\n\n## Exercise 13: Failure Path Drill\n\nFor each failure, choose the recovery.\n\n| Failure | Recovery |\n| --- | --- |\n| candidates changed multiple variables | |\n| verification command was different for every candidate | |\n| repo was dirty and unrelated changes leaked into diffs | |\n| v1 passed but merge into the main branch conflicts | |\n| best idea is split between v1 and v3 | |\n| all candidates fail verification | |\n| review notes say “I like parts of all of them” | |\n| candidate output folders overwrote each other | |\n| UI candidates have no screenshots | |\n| Expand round changes the previous decision | |\n\nRecovery options:\n\n```text\nrewrite matrix\nregenerate candidates\ndefine verification first\ncheckpoint repo state\nuse worktrees or separate directories\npick a primary candidate\nuse Combine with named parts\nuse Reject\nuse Expand with a new matrix\nsave screenshots\nrerun final verification\n```\n\nFill out:\n\n```markdown\n# Failure Recovery Notes\n\n- failure:\n- likely cause:\n- recovery:\n- command or file to inspect:\n- how to know recovery worked:\n```\n\n## Exercise 14: Final Check\n\nRun these checks on your variation run.\n\n```bash\ntest -s \"$ROOT/matrix.md\" && echo \"matrix:OK\"\ntest -s \"$ROOT/prompts/base.prompt.md\" && echo \"base-prompt:OK\"\ntest -s \"$ROOT/launch/base.launch.json\" && echo \"launch-json:OK\"\nfind \"$ROOT/prompts\" -type f | sort\nfind \"$ROOT/logs\" -type f | sort\ntest -s \"$ROOT/review/comparison.md\" && echo \"comparison:OK\"\ntest -s \"$ROOT/decisions/selection.md\" && echo \"decision:OK\"\n```\n\nFill out:\n\n```markdown\n# Final Variation Run Check\n\n- every candidate had the same base prompt? yes/no\n- every candidate changed one variable? yes/no\n- every candidate was isolated? yes/no\n- every candidate used the same verification command? yes/no\n- verification logs saved? yes/no\n- comparison notes saved? yes/no\n- decision saved? yes/no\n- convergence prompt saved? yes/no\n- ready to implement selected path? yes/no\n```\n\n## Related resources\n\n- [Companion reference](https://lapis-fossil-vsbc.here.now/downloads/codex-power-user-workshop-2026-06-27.bundle)\n- [Resource directory and portable download](/topics/codex-resources/)"
}
