@hecer/yoke 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/.claude-plugin/plugin.json +13 -13
  2. package/.codex-plugin/plugin.json +7 -7
  3. package/CHANGELOG.md +294 -288
  4. package/README.md +874 -874
  5. package/TODOS.md +5 -5
  6. package/agents/docs.toml +6 -6
  7. package/agents/implementer.toml +6 -6
  8. package/agents/reviewer.toml +6 -6
  9. package/agents/security.toml +6 -6
  10. package/bench/README.md +86 -86
  11. package/bench/RESULTS.md +35 -35
  12. package/bench/output-compaction.mjs +65 -65
  13. package/bench/result-schema.mjs +12 -12
  14. package/bench/results/claude-2026-07-27T18-03-26.json +50 -50
  15. package/bench/results/codex-unavailable-1785175418318.json +15 -15
  16. package/bench/results/gemini-2026-07-27T18-03-44.json +46 -46
  17. package/bench/run-matrix.mjs +26 -26
  18. package/bench/run.mjs +106 -106
  19. package/canon/AGENTS.md +30 -30
  20. package/canon/context/DECISIONS.md +4 -4
  21. package/canon/context/GLOSSARY.md +11 -11
  22. package/canon/context/KNOWLEDGE.md +4 -4
  23. package/canon/context/PROJECT.md +15 -15
  24. package/canon/loop/loop-spec.md +65 -65
  25. package/canon/loop/prd.schema.md +43 -43
  26. package/canon/manifest.yaml +59 -59
  27. package/canon/policy/gates.md +7 -7
  28. package/canon/policy/roles.md +9 -9
  29. package/canon/skills/ATTRIBUTION.md +99 -99
  30. package/canon/skills/authoring-prd/SKILL.md +58 -58
  31. package/canon/skills/brainstorming/SKILL.md +164 -164
  32. package/canon/skills/codebase-design/DEEPENING.md +15 -15
  33. package/canon/skills/codebase-design/DESIGN-IT-TWICE.md +12 -12
  34. package/canon/skills/codebase-design/SKILL.md +39 -39
  35. package/canon/skills/dispatching-parallel-agents/SKILL.md +182 -182
  36. package/canon/skills/document-release/SKILL.md +302 -302
  37. package/canon/skills/domain-modeling/ADR-FORMAT.md +19 -19
  38. package/canon/skills/domain-modeling/CONTEXT-FORMAT.md +39 -39
  39. package/canon/skills/domain-modeling/SKILL.md +35 -35
  40. package/canon/skills/executing-plans/SKILL.md +70 -70
  41. package/canon/skills/finishing-a-development-branch/SKILL.md +200 -200
  42. package/canon/skills/health/SKILL.md +177 -177
  43. package/canon/skills/maintaining-context/SKILL.md +34 -34
  44. package/canon/skills/minimal-code/SKILL.md +21 -21
  45. package/canon/skills/no-ai-slop/SKILL.md +103 -103
  46. package/canon/skills/no-ai-slop/eval.md +43 -43
  47. package/canon/skills/plan-ceo-review/SKILL.md +541 -541
  48. package/canon/skills/plan-eng-review/SKILL.md +362 -362
  49. package/canon/skills/receiving-code-review/SKILL.md +213 -213
  50. package/canon/skills/requesting-code-review/SKILL.md +105 -105
  51. package/canon/skills/resolving-merge-conflicts/SKILL.md +18 -18
  52. package/canon/skills/retro/SKILL.md +397 -397
  53. package/canon/skills/review/SKILL.md +246 -246
  54. package/canon/skills/ship/SKILL.md +691 -691
  55. package/canon/skills/subagent-driven-development/SKILL.md +277 -277
  56. package/canon/skills/systematic-debugging/SKILL.md +296 -296
  57. package/canon/skills/tdd/SKILL.md +371 -371
  58. package/canon/skills/unslop-ui/SKILL.md +34 -34
  59. package/canon/skills/using-git-worktrees/SKILL.md +218 -218
  60. package/canon/skills/verification-before-completion/SKILL.md +139 -139
  61. package/canon/skills/visual-verification/SKILL.md +54 -54
  62. package/canon/skills/workflow/SKILL.md +22 -22
  63. package/canon/skills/writing-for-agents/SKILL-MECHANICS.md +27 -27
  64. package/canon/skills/writing-for-agents/SKILL.md +42 -42
  65. package/canon/skills/writing-plans/SKILL.md +152 -152
  66. package/canon/skills/writing-skills/SKILL.md +655 -655
  67. package/canon/skills/yoke-retrofit/SKILL.md +26 -26
  68. package/canon/skills/yoke-workflow/SKILL.md +20 -20
  69. package/canon/tools/codex-rtk-hook.mjs +35 -35
  70. package/canon/tools/graphify.md +3 -3
  71. package/canon/tools/playwright-mcp.md +3 -3
  72. package/canon/tools/rtk.md +7 -7
  73. package/canon/tools/serena.md +6 -6
  74. package/dist/agents/process.js +3 -0
  75. package/dist/loop/watchdog.js +1 -1
  76. package/dist/prd/command.js +17 -17
  77. package/dist/retrofit/planners/claude.js +14 -14
  78. package/dist/retrofit/preserve.js +2 -2
  79. package/docs/MIGRATING-TO-1.0.md +33 -33
  80. package/docs/MIGRATING-TO-1.1.md +27 -27
  81. package/docs/MIGRATING-TO-1.4.md +70 -70
  82. package/docs/PUBLISHING.md +91 -91
  83. package/docs/superpowers/plans/2026-06-28-baustein-e-context-layer.md +981 -981
  84. package/docs/superpowers/plans/2026-06-29-baustein-f-routing.md +258 -258
  85. package/docs/superpowers/plans/2026-06-29-baustein-g-loop-observability.md +1006 -1006
  86. package/docs/superpowers/plans/2026-06-29-baustein-h-loop-robustness.md +374 -374
  87. package/docs/superpowers/plans/2026-06-30-baustein-i-visual-design-verification.md +450 -450
  88. package/docs/superpowers/plans/2026-07-02-baustein-k-zero-to-100-bootstrap.md +1024 -1024
  89. package/docs/superpowers/plans/2026-07-02-baustein-m-flow-smoke-proofs.md +574 -574
  90. package/docs/superpowers/plans/2026-08-13-gauntlet-quality-loop.md +537 -537
  91. package/docs/superpowers/plans/2026-08-16-artifact-backed-output-compaction.md +329 -329
  92. package/docs/superpowers/specs/2026-06-28-baustein-e-context-layer-design.md +146 -146
  93. package/docs/superpowers/specs/2026-06-29-baustein-f-routing-design.md +106 -106
  94. package/docs/superpowers/specs/2026-06-29-baustein-g-loop-observability-design.md +186 -186
  95. package/docs/superpowers/specs/2026-06-29-baustein-h-loop-robustness-design.md +113 -113
  96. package/docs/superpowers/specs/2026-06-30-baustein-i-visual-design-verification-design.md +98 -98
  97. package/docs/superpowers/specs/2026-07-02-baustein-k-zero-to-100-bootstrap-design.md +200 -200
  98. package/docs/superpowers/specs/2026-07-02-baustein-m-flow-smoke-proofs-design.md +155 -155
  99. package/docs/superpowers/specs/2026-08-13-gauntlet-quality-loop-design.md +422 -422
  100. package/docs/superpowers/specs/2026-08-16-artifact-backed-output-compaction-design.md +166 -166
  101. package/gemini-extension.json +6 -6
  102. package/hooks/hooks.json +19 -19
  103. package/package.json +87 -87
@@ -1,98 +1,98 @@
1
- # Baustein I — Visual & Design Verification
2
-
3
- **Status:** Design approved 2026-06-30 (autonomous)
4
- **Component:** Yoke (🐂)
5
- **Relates to:** [[harness-build-progress]], [[readme-always-update]]
6
- **Inspired by:** [vibecoded-design-tells](https://github.com/JCarterJohnson/vibecoded-design-tells) (MIT © 2026 Carter Johnson) — a data-ranked study of the visual "tells" of AI-generated UIs. Yoke implements the *idea* natively in TypeScript and credits the research; no code or data is copied.
7
-
8
- ## Problem & Goal
9
-
10
- Yoke's verify gate is **code-only** (`tsc` + unit/component tests). It does not check that the UI is **visually sound** (free of generic AI-slop design) or that **user flows actually work end-to-end**. Evidence: in the real NewMarket run, integration/visual bugs (unwired auth pages, a seed id-collision, an old "purple #6c5ce7 dark theme" — itself a classic AI-slop tell) slipped past the unit-test gate and were only caught by a later manual QA sweep.
11
-
12
- **Goal:** add a **visual & design verification layer** that plugs into the existing verify model (so it's gated, not advisory) and is honest about cost:
13
- 1. **Mechanical:** a static **design-slop scanner** (`yoke design-scan`) that flags the high-signal AI-slop tells and gates on exit code.
14
- 2. **Methodology:** two canon skills — `unslop-ui` (the design rubric) and `visual-verification` (compose a verify pipeline: types + unit + design-scan + a Playwright flow-smoke; capture video only on failure).
15
-
16
- Both integrate through one idea: **the project's `verify.command` becomes a pipeline**, and Baustein-H's verify-as-truth makes those gates authoritative.
17
-
18
- ## Key Decisions (locked)
19
-
20
- | Decision | Choice |
21
- |---|---|
22
- | Design-slop detection | A **TS-native** scanner built into the `yoke` CLI (`yoke design-scan`), not a port of the upstream Python; high-precision static heuristics |
23
- | Gate model | Exit non-zero when the weighted tell-score exceeds `--max` (default **4**); `--report` lists without failing |
24
- | Flow / video | **Methodology, not CLI** — the agent drives the wired Playwright MCP per the `visual-verification` skill. Yoke gates + guides; it does not embed a browser. Video capture is **opt-in, on failure only** (token-aware). |
25
- | Skills | `unslop-ui` (rubric) + `visual-verification` (pipeline + flow-smoke + video-on-failure) → all 3 agents |
26
- | Attribution | Credit vibecoded-design-tells (MIT) in `ATTRIBUTION.md` + README + the skill |
27
- | Canon count | 24 → **26** skills |
28
- | Out of scope (YAGNI) | Embedding Playwright/a browser in the Yoke CLI; structural-layout detection ("centered hero + 3 cards") — left to the rubric + agent eye; auto-fixing slop (the agent fixes, guided by the skill) |
29
-
30
- ## Architecture
31
-
32
- ### 1. `src/scan/design.ts` (new) — the static scanner
33
- Pure + unit-testable. Walks the project's source and scores AI-slop tells.
34
-
35
- ```ts
36
- export interface Tell { name: string; weight: number; test: (line: string) => boolean; hint: string }
37
- export interface Finding { file: string; line: number; tell: string; hint: string; text: string }
38
- export interface ScanResult { findings: Finding[]; score: number }
39
-
40
- export const TELLS: Tell[] // the curated tell set (below)
41
- export function scanText(text: string, tells?: Tell[]): { line: number; tell: Tell; text: string }[]
42
- export function scanDir(dir: string, tells?: Tell[]): ScanResult // walks files, aggregates
43
- ```
44
-
45
- **Curated high-precision tells** (each match adds `weight` to the score):
46
-
47
- | Tell | weight | matches (case-insensitive) | hint |
48
- |---|---|---|---|
49
- | `ai-purple` | 2 | hex `#6c5ce7\|#7c3aed\|#8b5cf6\|#a855f7\|#9333ea`, or Tailwind `(from\|via\|to)-(purple\|violet\|fuchsia)-(4\|5\|6\|7)00` | AI-purple is the #1 vibecoded tell — choose a real brand color |
50
- | `gradient-clip-text` | 2 | a line containing both `bg-clip-text` and `text-transparent`, or CSS `-webkit-background-clip:\s*text` near a gradient | gradient hero text reads as AI-slop — solid color + weight instead |
51
- | `neon-glow` | 2 | Tailwind `(shadow\|drop-shadow)-\[0_0_`, or CSS `box-shadow:[^;]*0\s+0\s+\d{2,}px` with a color | neon glow is a tell — use subtle, neutral elevation |
52
- | `gradient-overload` | 1 | `bg-gradient-to-` or CSS `linear-gradient(` | gradients everywhere flatten hierarchy — use them sparingly |
53
- | `emoji-icon` | 1 | an emoji (unicode pictographic) inside a `.tsx/.jsx` line that also contains `<button`, `<a `, `aria-hidden`, or a JSX `>…<` icon slot | emoji-as-icons is a tell — use a real icon set |
54
-
55
- File walk: extensions `.css .scss .tsx .jsx .ts .js .html .vue .svelte .astro`; skip `node_modules`, `dist`, `.next`, `build`, `.yoke`, `coverage`, `.git`. The tell set is the default but injectable (for tests). Heuristic by design — documented as high-signal, not exhaustive.
56
-
57
- ### 2. `src/cli.ts` — `yoke design-scan [dir] [--max=N] [--report]`
58
- - Runs `scanDir(dir)`, prints findings grouped by tell as `file:line <tell> — <hint>`.
59
- - `--report`: print + summary, **always exit 0** (advisory).
60
- - default (gate): print + summary; **exit 1 if `score > max`** (default `max=4`), else 0. So a couple incidental matches pass; pervasive slop fails. Designed to sit in a verify pipeline.
61
- - A small body extracted to `runDesignScan(dir, { max, report }): number` for testability.
62
-
63
- ### 3. `canon/skills/unslop-ui/SKILL.md` (new) — the rubric
64
- Agent-facing. Lists the ranked tells (AI-purple gradients, gradient hero text, neon glow, emoji-as-icons, shadcn defaults left unchanged, "centered hero + three cards", homogeneous spacing) and how to fix each. Instructs: before finishing UI work, run `yoke design-scan .` and resolve findings; also apply the structural items the scanner can't see. Credits the research.
65
-
66
- ### 4. `canon/skills/visual-verification/SKILL.md` (new) — ties it together
67
- Methodology for UI projects:
68
- - **Compose the verify pipeline** so the loop gate covers more than units: `verify.command` chains types → unit tests → `yoke design-scan .` → a Playwright flow-smoke. (Baustein-H makes these authoritative.)
69
- - **Flow-smoke via the wired Playwright MCP:** load the key routes against the dev server, assert they render and the console has **no errors**, screenshot each. This catches the "unwired page / runtime crash" bugs unit tests miss.
70
- - **Video only when necessary:** capture a video of a flow **only on failure** (or when explicitly debugging a UX issue), then analyse it — keeps tokens down. Never record every run.
71
-
72
- ### 5. Wiring
73
- - `canon/manifest.yaml`: add `unslop-ui` + `visual-verification` (kind: methodology).
74
- - `canon/skills/ATTRIBUTION.md`: credit vibecoded-design-tells (MIT © Carter Johnson).
75
- - `README.md` (**mandatory**): a "Visual & design verification" section (the scanner + the two skills + the pipeline idea), the catalog updated (24 → 26, methodology group +2), and the test-count badge synced.
76
-
77
- ## Data flow (gate)
78
- ```
79
- verify.command = tsc --noEmit && vitest run && yoke design-scan . && <playwright flow-smoke>
80
- │ exit 1 if slop-score > max
81
- loop verify (Baustein H: verify is the source of truth) ──► block on any red step
82
- ```
83
-
84
- ## Testing (subagent-driven TDD)
85
- - **design.ts:** `scanText` flags each tell with correct line + weight; clean text → no findings; `scanDir` walks + skips ignored dirs + aggregates score; injected tell-set works; emoji/purple/clip/glow/gradient cases each covered; a known-clean snippet scores 0.
86
- - **cli:** `runDesignScan` exits 1 when score > max, 0 when ≤ max, 0 always in `--report`; `--max` parsed; bad `--max` rejected.
87
- - **canon:** `unslop-ui` + `visual-verification` registered; `validateCanon` stays zero-error; real-canon asserts both present.
88
- - Full suite green; `tsc` clean.
89
-
90
- ## What this would have caught
91
- - NewMarket's old **purple `#6c5ce7` dark theme** → `ai-purple` tell, scored, flagged before it shipped.
92
- - **Unwired auth pages / runtime crashes** → the flow-smoke (render + no console errors) gate, not the unit tests.
93
-
94
- ## Non-goals (YAGNI)
95
- - No browser embedded in the Yoke CLI (Playwright MCP is the agent's tool).
96
- - No always-on video (opt-in, on failure).
97
- - No auto-rewrite of slop (the agent fixes via the rubric).
98
- - No structural-layout static detection (rubric + agent eye).
1
+ # Baustein I — Visual & Design Verification
2
+
3
+ **Status:** Design approved 2026-06-30 (autonomous)
4
+ **Component:** Yoke (🐂)
5
+ **Relates to:** [[harness-build-progress]], [[readme-always-update]]
6
+ **Inspired by:** [vibecoded-design-tells](https://github.com/JCarterJohnson/vibecoded-design-tells) (MIT © 2026 Carter Johnson) — a data-ranked study of the visual "tells" of AI-generated UIs. Yoke implements the *idea* natively in TypeScript and credits the research; no code or data is copied.
7
+
8
+ ## Problem & Goal
9
+
10
+ Yoke's verify gate is **code-only** (`tsc` + unit/component tests). It does not check that the UI is **visually sound** (free of generic AI-slop design) or that **user flows actually work end-to-end**. Evidence: in the real NewMarket run, integration/visual bugs (unwired auth pages, a seed id-collision, an old "purple #6c5ce7 dark theme" — itself a classic AI-slop tell) slipped past the unit-test gate and were only caught by a later manual QA sweep.
11
+
12
+ **Goal:** add a **visual & design verification layer** that plugs into the existing verify model (so it's gated, not advisory) and is honest about cost:
13
+ 1. **Mechanical:** a static **design-slop scanner** (`yoke design-scan`) that flags the high-signal AI-slop tells and gates on exit code.
14
+ 2. **Methodology:** two canon skills — `unslop-ui` (the design rubric) and `visual-verification` (compose a verify pipeline: types + unit + design-scan + a Playwright flow-smoke; capture video only on failure).
15
+
16
+ Both integrate through one idea: **the project's `verify.command` becomes a pipeline**, and Baustein-H's verify-as-truth makes those gates authoritative.
17
+
18
+ ## Key Decisions (locked)
19
+
20
+ | Decision | Choice |
21
+ |---|---|
22
+ | Design-slop detection | A **TS-native** scanner built into the `yoke` CLI (`yoke design-scan`), not a port of the upstream Python; high-precision static heuristics |
23
+ | Gate model | Exit non-zero when the weighted tell-score exceeds `--max` (default **4**); `--report` lists without failing |
24
+ | Flow / video | **Methodology, not CLI** — the agent drives the wired Playwright MCP per the `visual-verification` skill. Yoke gates + guides; it does not embed a browser. Video capture is **opt-in, on failure only** (token-aware). |
25
+ | Skills | `unslop-ui` (rubric) + `visual-verification` (pipeline + flow-smoke + video-on-failure) → all 3 agents |
26
+ | Attribution | Credit vibecoded-design-tells (MIT) in `ATTRIBUTION.md` + README + the skill |
27
+ | Canon count | 24 → **26** skills |
28
+ | Out of scope (YAGNI) | Embedding Playwright/a browser in the Yoke CLI; structural-layout detection ("centered hero + 3 cards") — left to the rubric + agent eye; auto-fixing slop (the agent fixes, guided by the skill) |
29
+
30
+ ## Architecture
31
+
32
+ ### 1. `src/scan/design.ts` (new) — the static scanner
33
+ Pure + unit-testable. Walks the project's source and scores AI-slop tells.
34
+
35
+ ```ts
36
+ export interface Tell { name: string; weight: number; test: (line: string) => boolean; hint: string }
37
+ export interface Finding { file: string; line: number; tell: string; hint: string; text: string }
38
+ export interface ScanResult { findings: Finding[]; score: number }
39
+
40
+ export const TELLS: Tell[] // the curated tell set (below)
41
+ export function scanText(text: string, tells?: Tell[]): { line: number; tell: Tell; text: string }[]
42
+ export function scanDir(dir: string, tells?: Tell[]): ScanResult // walks files, aggregates
43
+ ```
44
+
45
+ **Curated high-precision tells** (each match adds `weight` to the score):
46
+
47
+ | Tell | weight | matches (case-insensitive) | hint |
48
+ |---|---|---|---|
49
+ | `ai-purple` | 2 | hex `#6c5ce7\|#7c3aed\|#8b5cf6\|#a855f7\|#9333ea`, or Tailwind `(from\|via\|to)-(purple\|violet\|fuchsia)-(4\|5\|6\|7)00` | AI-purple is the #1 vibecoded tell — choose a real brand color |
50
+ | `gradient-clip-text` | 2 | a line containing both `bg-clip-text` and `text-transparent`, or CSS `-webkit-background-clip:\s*text` near a gradient | gradient hero text reads as AI-slop — solid color + weight instead |
51
+ | `neon-glow` | 2 | Tailwind `(shadow\|drop-shadow)-\[0_0_`, or CSS `box-shadow:[^;]*0\s+0\s+\d{2,}px` with a color | neon glow is a tell — use subtle, neutral elevation |
52
+ | `gradient-overload` | 1 | `bg-gradient-to-` or CSS `linear-gradient(` | gradients everywhere flatten hierarchy — use them sparingly |
53
+ | `emoji-icon` | 1 | an emoji (unicode pictographic) inside a `.tsx/.jsx` line that also contains `<button`, `<a `, `aria-hidden`, or a JSX `>…<` icon slot | emoji-as-icons is a tell — use a real icon set |
54
+
55
+ File walk: extensions `.css .scss .tsx .jsx .ts .js .html .vue .svelte .astro`; skip `node_modules`, `dist`, `.next`, `build`, `.yoke`, `coverage`, `.git`. The tell set is the default but injectable (for tests). Heuristic by design — documented as high-signal, not exhaustive.
56
+
57
+ ### 2. `src/cli.ts` — `yoke design-scan [dir] [--max=N] [--report]`
58
+ - Runs `scanDir(dir)`, prints findings grouped by tell as `file:line <tell> — <hint>`.
59
+ - `--report`: print + summary, **always exit 0** (advisory).
60
+ - default (gate): print + summary; **exit 1 if `score > max`** (default `max=4`), else 0. So a couple incidental matches pass; pervasive slop fails. Designed to sit in a verify pipeline.
61
+ - A small body extracted to `runDesignScan(dir, { max, report }): number` for testability.
62
+
63
+ ### 3. `canon/skills/unslop-ui/SKILL.md` (new) — the rubric
64
+ Agent-facing. Lists the ranked tells (AI-purple gradients, gradient hero text, neon glow, emoji-as-icons, shadcn defaults left unchanged, "centered hero + three cards", homogeneous spacing) and how to fix each. Instructs: before finishing UI work, run `yoke design-scan .` and resolve findings; also apply the structural items the scanner can't see. Credits the research.
65
+
66
+ ### 4. `canon/skills/visual-verification/SKILL.md` (new) — ties it together
67
+ Methodology for UI projects:
68
+ - **Compose the verify pipeline** so the loop gate covers more than units: `verify.command` chains types → unit tests → `yoke design-scan .` → a Playwright flow-smoke. (Baustein-H makes these authoritative.)
69
+ - **Flow-smoke via the wired Playwright MCP:** load the key routes against the dev server, assert they render and the console has **no errors**, screenshot each. This catches the "unwired page / runtime crash" bugs unit tests miss.
70
+ - **Video only when necessary:** capture a video of a flow **only on failure** (or when explicitly debugging a UX issue), then analyse it — keeps tokens down. Never record every run.
71
+
72
+ ### 5. Wiring
73
+ - `canon/manifest.yaml`: add `unslop-ui` + `visual-verification` (kind: methodology).
74
+ - `canon/skills/ATTRIBUTION.md`: credit vibecoded-design-tells (MIT © Carter Johnson).
75
+ - `README.md` (**mandatory**): a "Visual & design verification" section (the scanner + the two skills + the pipeline idea), the catalog updated (24 → 26, methodology group +2), and the test-count badge synced.
76
+
77
+ ## Data flow (gate)
78
+ ```
79
+ verify.command = tsc --noEmit && vitest run && yoke design-scan . && <playwright flow-smoke>
80
+ │ exit 1 if slop-score > max
81
+ loop verify (Baustein H: verify is the source of truth) ──► block on any red step
82
+ ```
83
+
84
+ ## Testing (subagent-driven TDD)
85
+ - **design.ts:** `scanText` flags each tell with correct line + weight; clean text → no findings; `scanDir` walks + skips ignored dirs + aggregates score; injected tell-set works; emoji/purple/clip/glow/gradient cases each covered; a known-clean snippet scores 0.
86
+ - **cli:** `runDesignScan` exits 1 when score > max, 0 when ≤ max, 0 always in `--report`; `--max` parsed; bad `--max` rejected.
87
+ - **canon:** `unslop-ui` + `visual-verification` registered; `validateCanon` stays zero-error; real-canon asserts both present.
88
+ - Full suite green; `tsc` clean.
89
+
90
+ ## What this would have caught
91
+ - NewMarket's old **purple `#6c5ce7` dark theme** → `ai-purple` tell, scored, flagged before it shipped.
92
+ - **Unwired auth pages / runtime crashes** → the flow-smoke (render + no console errors) gate, not the unit tests.
93
+
94
+ ## Non-goals (YAGNI)
95
+ - No browser embedded in the Yoke CLI (Playwright MCP is the agent's tool).
96
+ - No always-on video (opt-in, on failure).
97
+ - No auto-rewrite of slop (the agent fixes via the rubric).
98
+ - No structural-layout static detection (rubric + agent eye).
@@ -1,200 +1,200 @@
1
- # Baustein K — Zero-to-100 Bootstrap: `yoke new`, PRD draft/check, loop cleanup, loop lock
2
-
3
- Date: 2026-07-02
4
- Status: approved (design delegated by user; scope approved in conversation: "ok setze es um wie du es geplant hast, gleich nach K")
5
-
6
- ## Problem
7
-
8
- Yoke's core claim is "zero to 100% autonomous development", but today the zero side is missing:
9
- the loop requires a hand-written `.yoke/prd.yaml` in an already-existing git repo. Greenfield
10
- start is undocumented agent work. Two robustness gaps compound this: a crashed loop leaves
11
- orphaned worktrees behind (manual `git worktree remove`), and two concurrent `yoke loop run`
12
- invocations race on the PRD and status files.
13
-
14
- ## Goal
15
-
16
- One command from idea to loop-ready project, plus loop robustness:
17
-
18
- ```
19
- yoke new my-app --idea="CLI tool that ..." # scaffold + retrofit + context + drafted PRD, committed
20
- yoke loop on my-app && yoke loop run my-app --isolate
21
- ```
22
-
23
- ## Part 1: `yoke new <dir> [--idea="..."] [--agent=...] [--runner=<agent>] [--loop]`
24
-
25
- Module: `src/new/command.ts`, export `runNew(dir: string, opts: RunNewOptions): number`.
26
-
27
- Behavior, in order:
28
-
29
- 1. `<dir>` is required (usage + exit 1 if missing). If the directory exists **and is non-empty**,
30
- refuse with exit 1 (`yoke new` is greenfield-only; retrofit exists for brownfield). An existing
31
- empty directory is fine.
32
- 2. Create the directory (recursive) and `git init` it.
33
- 3. Minimal scaffold (language-agnostic — the PRD's first story scaffolds the real project):
34
- - `README.md`: `# <basename>` plus the idea text as a paragraph when `--idea` is given.
35
- - `.gitignore`: `node_modules/`, `dist/`, `.env` (one per line).
36
- 4. Run the existing retrofit (`runRetrofit(dir, { loop: opts.loop, agents })`). Agents resolve like
37
- the `retrofit` CLI case: `--agent=` list or default; in an empty dir detection finds nothing, so
38
- the default is `['claude']`.
39
- 5. Run `runContextInit(dir)`. When `--idea` is given, append `\n## Idea\n\n<idea>\n` to
40
- `.yoke/context/PROJECT.md` so every loop iteration sees the north star.
41
- 6. Write the PRD **template** to `.yoke/prd.yaml` (see Part 2a below): an empty story array `[]`
42
- preceded by comment lines showing a fully-formed example story. Comments survive because we
43
- write the file verbatim; `loadPrd` still parses it (empty array is schema-valid).
44
- 7. Initial commit: `git add -A` + commit `chore: bootstrap <basename> with yoke`
45
- (`-c commit.gpgsign=false`, same as `realGitOps.commitAll`). This makes `--isolate` work from
46
- iteration 1 (worktrees check out committed HEAD).
47
- 8. When `--idea` is given: run the PRD draft (Part 2) with `--runner` resolution, then commit the
48
- drafted PRD as a second commit `docs: draft PRD from idea`. If the draft fails (agent error or
49
- invalid YAML), keep the template, print
50
- `PRD draft failed (<reason>). Project is ready; retry with: yoke prd draft <dir> --idea="..."`
51
- and return **1** (the scaffold succeeded, but the user's idea→PRD ask did not — signal it).
52
- 9. Print next steps: edit/inspect `.yoke/prd.yaml`, set `verify.command` in `.yoke/config.yaml`,
53
- `yoke loop on <dir>`, `yoke loop run <dir> --isolate`.
54
-
55
- Exit codes: 0 success; 1 usage / non-empty dir / draft failure; 2 requested draft agent unavailable.
56
-
57
- Injectable seams for tests: `git?: (args: string[], cwd: string) => void` (default execFileSync
58
- wrapper) and the Part-2 seams passed through (`isAvailable`, `run`).
59
-
60
- ## Part 2: `yoke prd draft [dir] --idea="..." [--runner=<agent>] [--force] [--timeout=<minutes>]`
61
-
62
- Module: `src/prd/command.ts`, export `runPrdDraft(targetDir: string, opts: PrdDraftOptions): number`.
63
-
64
- - `--idea` is required (exit 1 with usage if missing/empty).
65
- - Overwrite guard: if `.yoke/prd.yaml` exists and parses to **> 0 stories**, refuse with exit 1
66
- (`PRD already has N stories — use --force to overwrite`) unless `--force`. The Part-1 template
67
- (0 stories) never triggers the guard.
68
- - Agent resolution mirrors the loop: `--runner` ?? `config.agents[0]` ?? `'claude'`; must pass
69
- `isAgentAvailable`, else exit 2 with install hint. (No cross-model preference here — drafting is
70
- not adversarial review.)
71
- - Prompt builder `buildPrdDraftPrompt(idea: string): string` in `src/prd/command.ts`:
72
- - You are drafting a PRD for the Yoke loop.
73
- - Break the idea into 5–12 small, independently shippable stories; each must fit one loop
74
- iteration.
75
- - Each story: `id` (STORY-1…), `title` (imperative), `priority` (dense from 1, lower = first),
76
- `acceptance` (2–5 testable, behavioral criteria — outcomes, not implementation), `passes: false`.
77
- - If the project has no source code yet, STORY-1 must scaffold the project skeleton including a
78
- runnable test suite, and its acceptance must include that the verify command
79
- (`.yoke/config.yaml` → `verify.command`) runs green.
80
- - Write ONLY the file `.yoke/prd.yaml` as a YAML array matching this schema (schema inlined).
81
- Do not modify other files. Do not commit.
82
- - Execution reuses the Baustein-J plumbing: `agentInvocation` → default runner
83
- `runAgent(buildWatchdogInvocation(inv, idleMs))` with `resolveIdleMs(opts.timeoutMinutes, undefined)`;
84
- injectable `isAvailable` / `run` seams exactly like `src/review/command.ts`.
85
- - Post-validation: `loadPrd(prdPath)` — on parse/schema failure exit 1 with the zod message; on
86
- success print `Drafted N stories → .yoke/prd.yaml` and exit 0. 0 drafted stories is a failure
87
- (exit 1, `agent produced an empty PRD`).
88
-
89
- ### Part 2a: PRD template
90
-
91
- Exported const `PRD_TEMPLATE` (in `src/prd/command.ts`), written by `yoke new`:
92
-
93
- ```yaml
94
- # Yoke PRD — the loop picks the lowest-priority open story each iteration.
95
- # Story format (see canon/loop/prd.schema.md):
96
- # - id: STORY-1
97
- # title: scaffold the project with a runnable test suite
98
- # priority: 1
99
- # acceptance:
100
- # - "the verify command exits 0"
101
- # - "a placeholder test exists and passes"
102
- # passes: false
103
- []
104
- ```
105
-
106
- ## Part 3: `yoke prd check [dir]`
107
-
108
- Same module, export `runPrdCheck(targetDir: string): number`.
109
-
110
- - Missing file → exit 1 (`No PRD at .yoke/prd.yaml — run yoke prd draft or yoke new`).
111
- - Schema violation (zod) → print message, exit 1.
112
- - Lints beyond the schema, each an error (exit 1): duplicate story ids; any story with an **empty
113
- `acceptance` array** (the schema allows `[]`, but the loop's stop-the-line gate will block it —
114
- fail fast here); zero stories (`PRD has no stories`).
115
- - Success: print `✓ PRD valid — N stories, M pass` and exit 0. Chainable pre-loop gate.
116
-
117
- ## Part 4: `yoke loop cleanup [dir]`
118
-
119
- Module: `src/loop/cleanup.ts`, export `runLoopCleanup(targetDir: string, opts?): number`.
120
-
121
- - Scans `.yoke/worktrees/` only (yoke-created paths; never touches user worktrees). Missing/empty
122
- → `Nothing to clean.`, exit 0.
123
- - For each entry: `git worktree remove --force <path>` from the repo root; collect failures and
124
- fall through. Afterwards run `git worktree prune`.
125
- - Also removes a **stale** `.yoke/loop.lock` (holder pid not alive — see Part 5). A live lock is
126
- reported and left alone.
127
- - Report `Removed N worktree(s).` (+ failures). Exit 0 when everything cleaned, 1 if any removal
128
- failed.
129
- - Injectable seam: `git?: (args: string[], cwd: string) => void`.
130
- - Registered under the existing `loop` CLI case as sub-command `cleanup`.
131
-
132
- ## Part 5: Loop lock (single-flight guard)
133
-
134
- Module: `src/loop/lock.ts`:
135
-
136
- - `lockPath(targetDir)` → `.yoke/loop.lock`; contents JSON `{ "pid": number, "startedAt": ISO }`.
137
- - `isPidAlive(pid: number): boolean` — `process.kill(pid, 0)` in try/catch (works on Windows);
138
- `EPERM` counts as alive.
139
- - `acquireLock(targetDir, pid?): { acquired: boolean; holderPid?: number }` — no file or unreadable/
140
- corrupt file → take it (mkdir `.yoke` if needed); holder alive → `{ acquired: false, holderPid }`;
141
- holder dead → warn-and-take (caller prints the warning; the function returns
142
- `{ acquired: true, stalePid }` — include `stalePid?: number` in the result).
143
- - `releaseLock(targetDir)` — best-effort unlink, never throws.
144
-
145
- Wiring in `runLoopCommand` (src/loop/run-command.ts): after the existing pre-checks (loop enabled,
146
- PRD exists, verify resolved, agent available) and before `runLoop`, acquire the lock; on
147
- `acquired: false` print
148
- `Another loop is already running (pid <holderPid>). If that is wrong, run: yoke loop cleanup` and
149
- return 2. On stale takeover print a warning. Release in `finally`.
150
-
151
- Gitignore: add `.yoke/loop.lock` to `YOKE_IGNORE_LINES` (src/retrofit/gitignore.ts) so the
152
- pre-dispatch clean-tree gate is not broken by the lock file itself. Note: `ensureGitignore` is
153
- idempotent and appends only missing lines, so existing retrofitted projects pick the new line up
154
- on their next retrofit.
155
-
156
- ## Part 6: Canon skill `authoring-prd`
157
-
158
- `canon/skills/authoring-prd/SKILL.md` (kind: methodology), registered in `canon/manifest.yaml`.
159
- Content: how to slice a product idea into loop-ready stories — small and independently shippable
160
- (one loop iteration each); acceptance criteria are testable behavioral outcomes, never
161
- implementation steps; dense priorities; greenfield STORY-1 scaffolds project + test runner and
162
- wires `verify.command`; full `prd.yaml` example. This gives interactive sessions (all three
163
- agents, via retrofit) the same discipline `yoke prd draft` encodes.
164
-
165
- Canon count moves 26 → 27; the real-canon test that asserts the skill count must be updated.
166
-
167
- ## CLI usage line
168
-
169
- `yoke new <dir> [--idea="..."] [--agent=...] [--runner=<agent>] [--loop] | prd <draft|check> [dir] [--idea="..."] [--runner=<agent>] [--force] | loop <on|off|status|run|cleanup> | ...`
170
-
171
- ## Testing
172
-
173
- - `tests/prd/command.test.ts`: draft — runner receives resolved agent invocation (seam), `--runner`
174
- honored, unavailable → 2, overwrite guard (>0 stories blocks, `--force` passes, template `[]`
175
- passes), post-validation failure → 1, empty result → 1, success prints count; prompt builder —
176
- contains idea, schema, story-count band, STORY-1 scaffold rule, "Write ONLY"; check — valid PRD
177
- 0, duplicate ids 1, empty acceptance 1, no stories 1, missing file 1.
178
- - `tests/new/command.test.ts`: non-empty dir refused; scaffold files + git init + initial commit
179
- (seam-recorded git calls); retrofit artifacts present (real canon); PROJECT.md gets idea section;
180
- template PRD written and schema-parses to `[]`; `--idea` triggers draft via injected run seam and
181
- second commit; draft failure → exit 1 + template intact.
182
- - `tests/loop/cleanup.test.ts`: removes listed worktrees via git seam + prune called; nothing to
183
- clean; failure → exit 1; stale lock removed, live lock kept.
184
- - `tests/loop/lock.test.ts`: acquire on empty; blocked by live pid (use `process.pid`); stale
185
- takeover (dead pid, e.g. a just-exited child or an absurd pid); corrupt file → take; release
186
- best-effort; `runLoopCommand` returns 2 when locked (existing run-command tests gain one case,
187
- using the real lock with `process.pid`).
188
- - `tests/retrofit/gitignore.test.ts`: extend for `.yoke/loop.lock`.
189
- - Real-canon tests: 27 skills, `authoring-prd` frontmatter valid.
190
-
191
- ## Non-goals
192
-
193
- - No language/framework project templates (STORY-1 scaffolds; keeps `yoke new` universal).
194
- - No parallel loop, no CI triggers, no PRD estimation/dependencies.
195
- - No cross-model preference for drafting (that's review's job).
196
-
197
- ## Attribution
198
-
199
- PRD-driven Ralph loop: Geoffrey Huntley's Ralph technique; story-slicing discipline informed by
200
- superpowers `writing-plans`. No external code.
1
+ # Baustein K — Zero-to-100 Bootstrap: `yoke new`, PRD draft/check, loop cleanup, loop lock
2
+
3
+ Date: 2026-07-02
4
+ Status: approved (design delegated by user; scope approved in conversation: "ok setze es um wie du es geplant hast, gleich nach K")
5
+
6
+ ## Problem
7
+
8
+ Yoke's core claim is "zero to 100% autonomous development", but today the zero side is missing:
9
+ the loop requires a hand-written `.yoke/prd.yaml` in an already-existing git repo. Greenfield
10
+ start is undocumented agent work. Two robustness gaps compound this: a crashed loop leaves
11
+ orphaned worktrees behind (manual `git worktree remove`), and two concurrent `yoke loop run`
12
+ invocations race on the PRD and status files.
13
+
14
+ ## Goal
15
+
16
+ One command from idea to loop-ready project, plus loop robustness:
17
+
18
+ ```
19
+ yoke new my-app --idea="CLI tool that ..." # scaffold + retrofit + context + drafted PRD, committed
20
+ yoke loop on my-app && yoke loop run my-app --isolate
21
+ ```
22
+
23
+ ## Part 1: `yoke new <dir> [--idea="..."] [--agent=...] [--runner=<agent>] [--loop]`
24
+
25
+ Module: `src/new/command.ts`, export `runNew(dir: string, opts: RunNewOptions): number`.
26
+
27
+ Behavior, in order:
28
+
29
+ 1. `<dir>` is required (usage + exit 1 if missing). If the directory exists **and is non-empty**,
30
+ refuse with exit 1 (`yoke new` is greenfield-only; retrofit exists for brownfield). An existing
31
+ empty directory is fine.
32
+ 2. Create the directory (recursive) and `git init` it.
33
+ 3. Minimal scaffold (language-agnostic — the PRD's first story scaffolds the real project):
34
+ - `README.md`: `# <basename>` plus the idea text as a paragraph when `--idea` is given.
35
+ - `.gitignore`: `node_modules/`, `dist/`, `.env` (one per line).
36
+ 4. Run the existing retrofit (`runRetrofit(dir, { loop: opts.loop, agents })`). Agents resolve like
37
+ the `retrofit` CLI case: `--agent=` list or default; in an empty dir detection finds nothing, so
38
+ the default is `['claude']`.
39
+ 5. Run `runContextInit(dir)`. When `--idea` is given, append `\n## Idea\n\n<idea>\n` to
40
+ `.yoke/context/PROJECT.md` so every loop iteration sees the north star.
41
+ 6. Write the PRD **template** to `.yoke/prd.yaml` (see Part 2a below): an empty story array `[]`
42
+ preceded by comment lines showing a fully-formed example story. Comments survive because we
43
+ write the file verbatim; `loadPrd` still parses it (empty array is schema-valid).
44
+ 7. Initial commit: `git add -A` + commit `chore: bootstrap <basename> with yoke`
45
+ (`-c commit.gpgsign=false`, same as `realGitOps.commitAll`). This makes `--isolate` work from
46
+ iteration 1 (worktrees check out committed HEAD).
47
+ 8. When `--idea` is given: run the PRD draft (Part 2) with `--runner` resolution, then commit the
48
+ drafted PRD as a second commit `docs: draft PRD from idea`. If the draft fails (agent error or
49
+ invalid YAML), keep the template, print
50
+ `PRD draft failed (<reason>). Project is ready; retry with: yoke prd draft <dir> --idea="..."`
51
+ and return **1** (the scaffold succeeded, but the user's idea→PRD ask did not — signal it).
52
+ 9. Print next steps: edit/inspect `.yoke/prd.yaml`, set `verify.command` in `.yoke/config.yaml`,
53
+ `yoke loop on <dir>`, `yoke loop run <dir> --isolate`.
54
+
55
+ Exit codes: 0 success; 1 usage / non-empty dir / draft failure; 2 requested draft agent unavailable.
56
+
57
+ Injectable seams for tests: `git?: (args: string[], cwd: string) => void` (default execFileSync
58
+ wrapper) and the Part-2 seams passed through (`isAvailable`, `run`).
59
+
60
+ ## Part 2: `yoke prd draft [dir] --idea="..." [--runner=<agent>] [--force] [--timeout=<minutes>]`
61
+
62
+ Module: `src/prd/command.ts`, export `runPrdDraft(targetDir: string, opts: PrdDraftOptions): number`.
63
+
64
+ - `--idea` is required (exit 1 with usage if missing/empty).
65
+ - Overwrite guard: if `.yoke/prd.yaml` exists and parses to **> 0 stories**, refuse with exit 1
66
+ (`PRD already has N stories — use --force to overwrite`) unless `--force`. The Part-1 template
67
+ (0 stories) never triggers the guard.
68
+ - Agent resolution mirrors the loop: `--runner` ?? `config.agents[0]` ?? `'claude'`; must pass
69
+ `isAgentAvailable`, else exit 2 with install hint. (No cross-model preference here — drafting is
70
+ not adversarial review.)
71
+ - Prompt builder `buildPrdDraftPrompt(idea: string): string` in `src/prd/command.ts`:
72
+ - You are drafting a PRD for the Yoke loop.
73
+ - Break the idea into 5–12 small, independently shippable stories; each must fit one loop
74
+ iteration.
75
+ - Each story: `id` (STORY-1…), `title` (imperative), `priority` (dense from 1, lower = first),
76
+ `acceptance` (2–5 testable, behavioral criteria — outcomes, not implementation), `passes: false`.
77
+ - If the project has no source code yet, STORY-1 must scaffold the project skeleton including a
78
+ runnable test suite, and its acceptance must include that the verify command
79
+ (`.yoke/config.yaml` → `verify.command`) runs green.
80
+ - Write ONLY the file `.yoke/prd.yaml` as a YAML array matching this schema (schema inlined).
81
+ Do not modify other files. Do not commit.
82
+ - Execution reuses the Baustein-J plumbing: `agentInvocation` → default runner
83
+ `runAgent(buildWatchdogInvocation(inv, idleMs))` with `resolveIdleMs(opts.timeoutMinutes, undefined)`;
84
+ injectable `isAvailable` / `run` seams exactly like `src/review/command.ts`.
85
+ - Post-validation: `loadPrd(prdPath)` — on parse/schema failure exit 1 with the zod message; on
86
+ success print `Drafted N stories → .yoke/prd.yaml` and exit 0. 0 drafted stories is a failure
87
+ (exit 1, `agent produced an empty PRD`).
88
+
89
+ ### Part 2a: PRD template
90
+
91
+ Exported const `PRD_TEMPLATE` (in `src/prd/command.ts`), written by `yoke new`:
92
+
93
+ ```yaml
94
+ # Yoke PRD — the loop picks the lowest-priority open story each iteration.
95
+ # Story format (see canon/loop/prd.schema.md):
96
+ # - id: STORY-1
97
+ # title: scaffold the project with a runnable test suite
98
+ # priority: 1
99
+ # acceptance:
100
+ # - "the verify command exits 0"
101
+ # - "a placeholder test exists and passes"
102
+ # passes: false
103
+ []
104
+ ```
105
+
106
+ ## Part 3: `yoke prd check [dir]`
107
+
108
+ Same module, export `runPrdCheck(targetDir: string): number`.
109
+
110
+ - Missing file → exit 1 (`No PRD at .yoke/prd.yaml — run yoke prd draft or yoke new`).
111
+ - Schema violation (zod) → print message, exit 1.
112
+ - Lints beyond the schema, each an error (exit 1): duplicate story ids; any story with an **empty
113
+ `acceptance` array** (the schema allows `[]`, but the loop's stop-the-line gate will block it —
114
+ fail fast here); zero stories (`PRD has no stories`).
115
+ - Success: print `✓ PRD valid — N stories, M pass` and exit 0. Chainable pre-loop gate.
116
+
117
+ ## Part 4: `yoke loop cleanup [dir]`
118
+
119
+ Module: `src/loop/cleanup.ts`, export `runLoopCleanup(targetDir: string, opts?): number`.
120
+
121
+ - Scans `.yoke/worktrees/` only (yoke-created paths; never touches user worktrees). Missing/empty
122
+ → `Nothing to clean.`, exit 0.
123
+ - For each entry: `git worktree remove --force <path>` from the repo root; collect failures and
124
+ fall through. Afterwards run `git worktree prune`.
125
+ - Also removes a **stale** `.yoke/loop.lock` (holder pid not alive — see Part 5). A live lock is
126
+ reported and left alone.
127
+ - Report `Removed N worktree(s).` (+ failures). Exit 0 when everything cleaned, 1 if any removal
128
+ failed.
129
+ - Injectable seam: `git?: (args: string[], cwd: string) => void`.
130
+ - Registered under the existing `loop` CLI case as sub-command `cleanup`.
131
+
132
+ ## Part 5: Loop lock (single-flight guard)
133
+
134
+ Module: `src/loop/lock.ts`:
135
+
136
+ - `lockPath(targetDir)` → `.yoke/loop.lock`; contents JSON `{ "pid": number, "startedAt": ISO }`.
137
+ - `isPidAlive(pid: number): boolean` — `process.kill(pid, 0)` in try/catch (works on Windows);
138
+ `EPERM` counts as alive.
139
+ - `acquireLock(targetDir, pid?): { acquired: boolean; holderPid?: number }` — no file or unreadable/
140
+ corrupt file → take it (mkdir `.yoke` if needed); holder alive → `{ acquired: false, holderPid }`;
141
+ holder dead → warn-and-take (caller prints the warning; the function returns
142
+ `{ acquired: true, stalePid }` — include `stalePid?: number` in the result).
143
+ - `releaseLock(targetDir)` — best-effort unlink, never throws.
144
+
145
+ Wiring in `runLoopCommand` (src/loop/run-command.ts): after the existing pre-checks (loop enabled,
146
+ PRD exists, verify resolved, agent available) and before `runLoop`, acquire the lock; on
147
+ `acquired: false` print
148
+ `Another loop is already running (pid <holderPid>). If that is wrong, run: yoke loop cleanup` and
149
+ return 2. On stale takeover print a warning. Release in `finally`.
150
+
151
+ Gitignore: add `.yoke/loop.lock` to `YOKE_IGNORE_LINES` (src/retrofit/gitignore.ts) so the
152
+ pre-dispatch clean-tree gate is not broken by the lock file itself. Note: `ensureGitignore` is
153
+ idempotent and appends only missing lines, so existing retrofitted projects pick the new line up
154
+ on their next retrofit.
155
+
156
+ ## Part 6: Canon skill `authoring-prd`
157
+
158
+ `canon/skills/authoring-prd/SKILL.md` (kind: methodology), registered in `canon/manifest.yaml`.
159
+ Content: how to slice a product idea into loop-ready stories — small and independently shippable
160
+ (one loop iteration each); acceptance criteria are testable behavioral outcomes, never
161
+ implementation steps; dense priorities; greenfield STORY-1 scaffolds project + test runner and
162
+ wires `verify.command`; full `prd.yaml` example. This gives interactive sessions (all three
163
+ agents, via retrofit) the same discipline `yoke prd draft` encodes.
164
+
165
+ Canon count moves 26 → 27; the real-canon test that asserts the skill count must be updated.
166
+
167
+ ## CLI usage line
168
+
169
+ `yoke new <dir> [--idea="..."] [--agent=...] [--runner=<agent>] [--loop] | prd <draft|check> [dir] [--idea="..."] [--runner=<agent>] [--force] | loop <on|off|status|run|cleanup> | ...`
170
+
171
+ ## Testing
172
+
173
+ - `tests/prd/command.test.ts`: draft — runner receives resolved agent invocation (seam), `--runner`
174
+ honored, unavailable → 2, overwrite guard (>0 stories blocks, `--force` passes, template `[]`
175
+ passes), post-validation failure → 1, empty result → 1, success prints count; prompt builder —
176
+ contains idea, schema, story-count band, STORY-1 scaffold rule, "Write ONLY"; check — valid PRD
177
+ 0, duplicate ids 1, empty acceptance 1, no stories 1, missing file 1.
178
+ - `tests/new/command.test.ts`: non-empty dir refused; scaffold files + git init + initial commit
179
+ (seam-recorded git calls); retrofit artifacts present (real canon); PROJECT.md gets idea section;
180
+ template PRD written and schema-parses to `[]`; `--idea` triggers draft via injected run seam and
181
+ second commit; draft failure → exit 1 + template intact.
182
+ - `tests/loop/cleanup.test.ts`: removes listed worktrees via git seam + prune called; nothing to
183
+ clean; failure → exit 1; stale lock removed, live lock kept.
184
+ - `tests/loop/lock.test.ts`: acquire on empty; blocked by live pid (use `process.pid`); stale
185
+ takeover (dead pid, e.g. a just-exited child or an absurd pid); corrupt file → take; release
186
+ best-effort; `runLoopCommand` returns 2 when locked (existing run-command tests gain one case,
187
+ using the real lock with `process.pid`).
188
+ - `tests/retrofit/gitignore.test.ts`: extend for `.yoke/loop.lock`.
189
+ - Real-canon tests: 27 skills, `authoring-prd` frontmatter valid.
190
+
191
+ ## Non-goals
192
+
193
+ - No language/framework project templates (STORY-1 scaffolds; keeps `yoke new` universal).
194
+ - No parallel loop, no CI triggers, no PRD estimation/dependencies.
195
+ - No cross-model preference for drafting (that's review's job).
196
+
197
+ ## Attribution
198
+
199
+ PRD-driven Ralph loop: Geoffrey Huntley's Ralph technique; story-slicing discipline informed by
200
+ superpowers `writing-plans`. No external code.