@cohortapp/agent-sdk 2.12.0 → 2.14.0

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 (129) hide show
  1. package/bin/maestro.mjs +6 -2
  2. package/docs/guides/front-door-session.md +86 -0
  3. package/lib/cli/design.mjs +185 -0
  4. package/lib/cli/design.test.mjs +270 -0
  5. package/lib/cli/global-setup-extras.mjs +44 -0
  6. package/lib/cli/global-setup-extras.test.mjs +95 -0
  7. package/lib/cli/session.mjs +11 -1
  8. package/lib/cli/session.test.mjs +17 -6
  9. package/lib/collective/global-config.mjs +5 -0
  10. package/lib/collective/global-config.test.mjs +5 -0
  11. package/lib/collective/vendor-skills.mjs +305 -0
  12. package/lib/collective/vendor-skills.test.mjs +306 -0
  13. package/lib/design/design-md.mjs +793 -0
  14. package/lib/design/design-md.test.mjs +318 -0
  15. package/lib/design/fixtures/DESIGN.golden.md +238 -0
  16. package/lib/design/fixtures/PRODUCT.golden.md +67 -0
  17. package/lib/design/fixtures/foundation.json +133 -0
  18. package/lib/design/refresh-gate.mjs +154 -0
  19. package/lib/design/refresh-gate.test.mjs +144 -0
  20. package/lib/design/write.mjs +275 -0
  21. package/lib/design/write.test.mjs +241 -0
  22. package/lib/prompts/parallelism.mjs +79 -0
  23. package/lib/prompts/parallelism.test.mjs +177 -0
  24. package/lib/telemetry/collect.mjs +357 -5
  25. package/lib/telemetry/collect.test.mjs +285 -0
  26. package/package.json +1 -1
  27. package/plugins/maestro-skills/plugin.json +4 -0
  28. package/plugins/maestro-skills/skills/cohort-design.md +153 -0
  29. package/plugins/maestro-skills/vendor/emilkowalski/LICENSE +21 -0
  30. package/plugins/maestro-skills/vendor/emilkowalski/UPSTREAM.json +70 -0
  31. package/plugins/maestro-skills/vendor/emilkowalski/skills/animate/RECIPES.md +324 -0
  32. package/plugins/maestro-skills/vendor/emilkowalski/skills/animate/SKILL.md +199 -0
  33. package/plugins/maestro-skills/vendor/emilkowalski/skills/animation-vocabulary/SKILL.md +173 -0
  34. package/plugins/maestro-skills/vendor/emilkowalski/skills/apple-design/SKILL.md +282 -0
  35. package/plugins/maestro-skills/vendor/emilkowalski/skills/emil-design-eng/SKILL.md +674 -0
  36. package/plugins/maestro-skills/vendor/emilkowalski/skills/find-animation-opportunities/SKILL.md +132 -0
  37. package/plugins/maestro-skills/vendor/emilkowalski/skills/improve-animations/AUDIT.md +115 -0
  38. package/plugins/maestro-skills/vendor/emilkowalski/skills/improve-animations/PLAN-TEMPLATE.md +73 -0
  39. package/plugins/maestro-skills/vendor/emilkowalski/skills/improve-animations/SKILL.md +101 -0
  40. package/plugins/maestro-skills/vendor/emilkowalski/skills/prototype/PICKER.md +197 -0
  41. package/plugins/maestro-skills/vendor/emilkowalski/skills/prototype/SKILL.md +90 -0
  42. package/plugins/maestro-skills/vendor/emilkowalski/skills/review-animations/SKILL.md +112 -0
  43. package/plugins/maestro-skills/vendor/emilkowalski/skills/review-animations/STANDARDS.md +187 -0
  44. package/plugins/maestro-skills/vendor/impeccable/LICENSE +191 -0
  45. package/plugins/maestro-skills/vendor/impeccable/NOTICE.md +11 -0
  46. package/plugins/maestro-skills/vendor/impeccable/SKILL.md +86 -0
  47. package/plugins/maestro-skills/vendor/impeccable/UPSTREAM.json +201 -0
  48. package/plugins/maestro-skills/vendor/impeccable/agents/impeccable-asset-producer.md +42 -0
  49. package/plugins/maestro-skills/vendor/impeccable/agents/impeccable-documenter.md +29 -0
  50. package/plugins/maestro-skills/vendor/impeccable/agents/impeccable-finish-reviewer.md +43 -0
  51. package/plugins/maestro-skills/vendor/impeccable/agents/impeccable-manual-edit-applier.md +97 -0
  52. package/plugins/maestro-skills/vendor/impeccable/reference/adapt.md +312 -0
  53. package/plugins/maestro-skills/vendor/impeccable/reference/adapt.native.md +58 -0
  54. package/plugins/maestro-skills/vendor/impeccable/reference/android.md +46 -0
  55. package/plugins/maestro-skills/vendor/impeccable/reference/animate.md +89 -0
  56. package/plugins/maestro-skills/vendor/impeccable/reference/audit.md +136 -0
  57. package/plugins/maestro-skills/vendor/impeccable/reference/audit.native.md +139 -0
  58. package/plugins/maestro-skills/vendor/impeccable/reference/bolder.md +33 -0
  59. package/plugins/maestro-skills/vendor/impeccable/reference/clarify.md +94 -0
  60. package/plugins/maestro-skills/vendor/impeccable/reference/colorize.md +86 -0
  61. package/plugins/maestro-skills/vendor/impeccable/reference/craft-floor.md +44 -0
  62. package/plugins/maestro-skills/vendor/impeccable/reference/craft.md +5 -0
  63. package/plugins/maestro-skills/vendor/impeccable/reference/critique.md +806 -0
  64. package/plugins/maestro-skills/vendor/impeccable/reference/degraded/asset-producer.md +37 -0
  65. package/plugins/maestro-skills/vendor/impeccable/reference/degraded/documenter.md +24 -0
  66. package/plugins/maestro-skills/vendor/impeccable/reference/degraded/finish-reviewer.md +38 -0
  67. package/plugins/maestro-skills/vendor/impeccable/reference/degraded/manual-edit-applier.md +92 -0
  68. package/plugins/maestro-skills/vendor/impeccable/reference/delight.md +70 -0
  69. package/plugins/maestro-skills/vendor/impeccable/reference/distill.md +111 -0
  70. package/plugins/maestro-skills/vendor/impeccable/reference/doctor.md +54 -0
  71. package/plugins/maestro-skills/vendor/impeccable/reference/document.md +416 -0
  72. package/plugins/maestro-skills/vendor/impeccable/reference/extract.md +69 -0
  73. package/plugins/maestro-skills/vendor/impeccable/reference/harden.md +336 -0
  74. package/plugins/maestro-skills/vendor/impeccable/reference/hooks.md +111 -0
  75. package/plugins/maestro-skills/vendor/impeccable/reference/init.md +131 -0
  76. package/plugins/maestro-skills/vendor/impeccable/reference/ios.md +51 -0
  77. package/plugins/maestro-skills/vendor/impeccable/reference/layout.md +84 -0
  78. package/plugins/maestro-skills/vendor/impeccable/reference/live-setup.md +104 -0
  79. package/plugins/maestro-skills/vendor/impeccable/reference/live.md +325 -0
  80. package/plugins/maestro-skills/vendor/impeccable/reference/new-work.md +147 -0
  81. package/plugins/maestro-skills/vendor/impeccable/reference/onboard.md +234 -0
  82. package/plugins/maestro-skills/vendor/impeccable/reference/operate.md +61 -0
  83. package/plugins/maestro-skills/vendor/impeccable/reference/optimize.md +258 -0
  84. package/plugins/maestro-skills/vendor/impeccable/reference/overdrive.md +127 -0
  85. package/plugins/maestro-skills/vendor/impeccable/reference/polish.md +105 -0
  86. package/plugins/maestro-skills/vendor/impeccable/reference/quieter.md +99 -0
  87. package/plugins/maestro-skills/vendor/impeccable/reference/routing.md +24 -0
  88. package/plugins/maestro-skills/vendor/impeccable/reference/shape.md +59 -0
  89. package/plugins/maestro-skills/vendor/impeccable/reference/typeset.md +80 -0
  90. package/plugins/maestro-skills/vendor/impeccable/reference/visualize.md +46 -0
  91. package/plugins/maestro-skills/vendor/taste-skill/LICENSE +21 -0
  92. package/plugins/maestro-skills/vendor/taste-skill/UPSTREAM.json +37 -0
  93. package/plugins/maestro-skills/vendor/taste-skill/skills/minimalist-skill/SKILL.md +85 -0
  94. package/plugins/maestro-skills/vendor/taste-skill/skills/redesign-skill/SKILL.md +178 -0
  95. package/plugins/maestro-skills/vendor/taste-skill/skills/soft-skill/SKILL.md +98 -0
  96. package/plugins/maestro-skills/vendor/taste-skill/skills/taste-skill/SKILL.md +1206 -0
  97. package/plugins/maestro-skills/vendor/unlazy/LICENSE +21 -0
  98. package/plugins/maestro-skills/vendor/unlazy/SECURITY.md +72 -0
  99. package/plugins/maestro-skills/vendor/unlazy/SKILL.md +104 -0
  100. package/plugins/maestro-skills/vendor/unlazy/UPSTREAM.json +94 -0
  101. package/plugins/maestro-skills/vendor/unlazy/references/dispatch.md +82 -0
  102. package/plugins/maestro-skills/vendor/unlazy/references/gates.md +149 -0
  103. package/plugins/maestro-skills/vendor/unlazy/references/method.md +49 -0
  104. package/plugins/maestro-skills/vendor/unlazy/references/orchestration.md +107 -0
  105. package/plugins/maestro-skills/vendor/unlazy/references/parallel.md +133 -0
  106. package/plugins/maestro-skills/vendor/unlazy/references/token-economy.md +48 -0
  107. package/plugins/maestro-skills/vendor/unlazy/scripts/dispatch-check.mjs +139 -0
  108. package/plugins/maestro-skills/vendor/unlazy/scripts/gate-check.mjs +960 -0
  109. package/plugins/maestro-skills/vendor/unlazy/scripts/gate-lint.mjs +245 -0
  110. package/plugins/maestro-skills/vendor/unlazy/scripts/lib/check-supervisor.mjs +46 -0
  111. package/plugins/maestro-skills/vendor/unlazy/scripts/lib/dispatch.mjs +293 -0
  112. package/plugins/maestro-skills/vendor/unlazy/scripts/lib/gates.mjs +953 -0
  113. package/plugins/maestro-skills/vendor/unlazy/scripts/lib/process-tree.mjs +161 -0
  114. package/plugins/maestro-skills/vendor/unlazy/scripts/lib/regex-worker.mjs +9 -0
  115. package/plugins/maestro-skills/vendor/unlazy/templates/PLAN.md +116 -0
  116. package/plugins/maestro-skills/vendor/unlazy/templates/gates-leaf.md +51 -0
  117. package/plugins/maestro-skills/vendor/unlazy/templates/gates-node.md +51 -0
  118. package/scripts/ci/check-skill-packs.mjs +388 -0
  119. package/scripts/ci/check-skill-packs.test.mjs +495 -0
  120. package/scripts/ci/check.mjs +3 -0
  121. package/scripts/daemon/agent-daemon-design.test.mjs +238 -0
  122. package/scripts/daemon/agent-daemon.mjs +108 -0
  123. package/scripts/daemon/cadence-consumer-frontdoor.test.mjs +61 -2
  124. package/scripts/daemon/cadence-consumer.mjs +46 -22
  125. package/scripts/daemon/prompt-builder.mjs +19 -3
  126. package/scripts/local-triggers/autoupdate.test.mjs +33 -3
  127. package/scripts/vendor/skill-packs.mjs +354 -0
  128. package/scripts/vendor/sync-skill-packs.mjs +242 -0
  129. package/scripts/vendor/sync-skill-packs.test.mjs +103 -0
@@ -0,0 +1,318 @@
1
+ /**
2
+ * design-md.test.mjs — the foundation → DESIGN.md / PRODUCT.md renderer
3
+ * (WP-M7 mechanic 4).
4
+ *
5
+ * The centrepiece is a GOLDEN FILE pair rendered from a realistic foundation
6
+ * fixture. A golden is the right instrument here because the output is a
7
+ * contract with things this repo cannot import: the google-labs-code/design.md
8
+ * frontmatter shape that vendored design skills parse, and the `{colors.primary}`
9
+ * ref grammar they resolve. Assertions on a handful of substrings would let a
10
+ * reshuffle of the frontmatter — the one edit that actually breaks a consumer —
11
+ * pass green.
12
+ *
13
+ * Regenerate deliberately, never reflexively:
14
+ * node -e 'import("./lib/design/design-md.mjs").then(async m => {
15
+ * const { readFileSync, writeFileSync } = await import("node:fs");
16
+ * const f = JSON.parse(readFileSync("lib/design/fixtures/foundation.json","utf8"));
17
+ * const o = { name: "Northwind", generatedAt: "2026-09-08T12:00:00.000Z", versionId: "bv_01HQZ", versionLabel: "V2.7" };
18
+ * writeFileSync("lib/design/fixtures/DESIGN.golden.md", m.renderDesignMd(f, o));
19
+ * writeFileSync("lib/design/fixtures/PRODUCT.golden.md", m.renderProductMd(f, o));
20
+ * })'
21
+ * — and read the diff. A changed golden is a changed contract with every design
22
+ * skill on every seat.
23
+ *
24
+ * The rest of the file pins the properties a golden cannot state: purity,
25
+ * tolerance of unknown keys, and graceful degradation on an empty foundation.
26
+ */
27
+
28
+ import { test } from "node:test";
29
+ import assert from "node:assert/strict";
30
+ import { readFileSync } from "node:fs";
31
+ import { join, dirname } from "node:path";
32
+ import { fileURLToPath } from "node:url";
33
+
34
+ import {
35
+ renderDesignMd,
36
+ renderProductMd,
37
+ renderDesignBundle,
38
+ additionalTokens,
39
+ colorTokens,
40
+ scaleTokens,
41
+ typographyTokens,
42
+ componentRefs,
43
+ tokenRef,
44
+ slugToken,
45
+ KNOWN_FOUNDATION_KEYS,
46
+ KNOWN_SYSTEM_KEYS,
47
+ KNOWN_VISUAL_LANGUAGE_KEYS,
48
+ } from "./design-md.mjs";
49
+
50
+ const HERE = dirname(fileURLToPath(import.meta.url));
51
+ const FIXTURES = join(HERE, "fixtures");
52
+ const fixture = () => JSON.parse(readFileSync(join(FIXTURES, "foundation.json"), "utf8"));
53
+ const golden = (name) => readFileSync(join(FIXTURES, name), "utf8");
54
+
55
+ /** The injected options the goldens were rendered with. Nothing ambient. */
56
+ const OPTS = {
57
+ name: "Northwind",
58
+ generatedAt: "2026-09-08T12:00:00.000Z",
59
+ versionId: "bv_01HQZ",
60
+ versionLabel: "V2.7",
61
+ };
62
+
63
+ test("DESIGN.md matches the golden, byte for byte", () => {
64
+ assert.equal(renderDesignMd(fixture(), OPTS), golden("DESIGN.golden.md"));
65
+ });
66
+
67
+ test("PRODUCT.md matches the golden, byte for byte", () => {
68
+ assert.equal(renderProductMd(fixture(), OPTS), golden("PRODUCT.golden.md"));
69
+ });
70
+
71
+ test("renderDesignBundle is the two files, at their relative paths", () => {
72
+ const bundle = renderDesignBundle(fixture(), OPTS);
73
+ assert.deepEqual(bundle.map((f) => f.rel), ["DESIGN.md", "PRODUCT.md"]);
74
+ assert.equal(bundle[0].content, golden("DESIGN.golden.md"));
75
+ assert.equal(bundle[1].content, golden("PRODUCT.golden.md"));
76
+ });
77
+
78
+ test("the renderer is pure — same input, same bytes, and the input is not mutated", () => {
79
+ const f = fixture();
80
+ const snapshot = JSON.stringify(f);
81
+ const a = renderDesignMd(f, OPTS);
82
+ const b = renderDesignMd(f, OPTS);
83
+ assert.equal(a, b);
84
+ assert.equal(JSON.stringify(f), snapshot, "the foundation object is untouched");
85
+
86
+ // And nothing ambient leaks in: no timestamp appears unless one was injected.
87
+ const noStamp = renderDesignMd(f, { ...OPTS, generatedAt: undefined });
88
+ assert.ok(!noStamp.includes("generatedAt:"), "no clock is read when none is given");
89
+ assert.ok(!noStamp.includes("**Synced:**"));
90
+ });
91
+
92
+ test("frontmatter carries the design.md spec's blocks, with {group.key} component refs", () => {
93
+ const md = renderDesignMd(fixture(), OPTS);
94
+ const fm = md.slice(0, md.indexOf("\n---\n", 4) + 5);
95
+ for (const block of ["colors:", "typography:", "rounded:", "spacing:", "components:"]) {
96
+ assert.ok(fm.includes(`\n${block}`) || fm.startsWith(block), `frontmatter has ${block}`);
97
+ }
98
+ assert.match(fm, /button:\n {4}background: "\{colors\.primary\}"/);
99
+ assert.match(fm, /card:\n {4}background: "\{colors\.paper\}"/);
100
+ // Every component value is a ref, never a literal — that is what makes a
101
+ // token change propagate without rewriting the component block.
102
+ const componentBlock = fm.slice(fm.indexOf("components:"));
103
+ for (const line of componentBlock.split("\n").filter((l) => /^ {4}\w+: /.test(l))) {
104
+ assert.match(line, /"\{[a-z]+\.[a-z0-9-]+\}( \{[a-z]+\.[a-z0-9-]+\})?"$/, `component ref: ${line}`);
105
+ }
106
+ });
107
+
108
+ test("an unknown foundation key lands in Additional tokens rather than vanishing", () => {
109
+ const f = fixture();
110
+ f.blurRamp = { sm: "4px", lg: "24px" };
111
+ f.brandedNoiseSeed = "spruce-11";
112
+ const md = renderDesignMd(f, OPTS);
113
+
114
+ assert.match(md, /## Additional tokens/);
115
+ assert.match(md, /"blurRamp"/);
116
+ assert.match(md, /"brandedNoiseSeed": "spruce-11"/);
117
+ assert.match(md, /"lg": "24px"/, "the nested value survives, not just the key name");
118
+
119
+ // The property in one line: nothing the foundation carried is absent.
120
+ assert.deepEqual(
121
+ additionalTokens(f).map(([k]) => k),
122
+ ["blurRamp", "brandedNoiseSeed", "elevationCurve", "examples", "gridUnit"],
123
+ "unmodelled keys, sorted, all of them",
124
+ );
125
+ for (const key of Object.keys(f)) {
126
+ const modelled = KNOWN_FOUNDATION_KEYS.includes(key);
127
+ if (!modelled) assert.ok(md.includes(`"${key}"`), `${key} appears verbatim`);
128
+ }
129
+ });
130
+
131
+ test("a foundation with only modelled keys says so, instead of an empty section", () => {
132
+ const f = fixture();
133
+ delete f.elevationCurve;
134
+ delete f.gridUnit;
135
+ delete f.examples;
136
+ assert.deepEqual(additionalTokens(f), []);
137
+ assert.match(renderDesignMd(f, OPTS), /_None — every key in the foundation is modelled above\._/);
138
+ });
139
+
140
+ test("an empty / absent / malformed foundation renders a valid, honest file", () => {
141
+ for (const input of [{}, null, undefined, "not an object", 7, []]) {
142
+ const md = renderDesignMd(input, {});
143
+ assert.ok(md.startsWith("---\nname: \"Workspace\"\n"), "still valid frontmatter");
144
+ assert.equal(md.split("\n---\n").length, 2, "exactly one closing fence");
145
+ assert.match(md, /colors:\n {2}\{\}/, "an empty block is `{}`, not a dangling key");
146
+ assert.match(md, /_No palette in the foundation\._/);
147
+ assert.ok(md.endsWith("\n"), "ends with exactly one newline");
148
+ assert.ok(!md.endsWith("\n\n"));
149
+
150
+ const pm = renderProductMd(input, {});
151
+ assert.match(pm, /## Nothing set yet/);
152
+ assert.ok(pm.endsWith("\n"));
153
+ }
154
+ });
155
+
156
+ test("colour ROLE aliases resolve so {colors.primary} always points somewhere", () => {
157
+ // The palette names its shades ("Primary · Moss"); a component ref must still
158
+ // be able to say `{colors.primary}`.
159
+ const { light, dark } = colorTokens({ colors: [{ name: "Primary · Moss", value: "#2d5be3", dark: "#7ea0ff" }] });
160
+ assert.equal(light["primary-moss"], "#2d5be3");
161
+ assert.equal(light.primary, "#2d5be3", "aliased from the shade name");
162
+ assert.equal(dark.primary, "#7ea0ff");
163
+
164
+ // system.color.roles outranks nothing it would overwrite, but fills a gap.
165
+ const withRole = colorTokens({
166
+ colors: [{ name: "Ink", value: "#000" }],
167
+ system: { color: { roles: { primary: { value: "#123456" } } } },
168
+ });
169
+ assert.equal(withRole.light.primary, "#123456");
170
+ });
171
+
172
+ test("a semantic colour that collides with a palette name is kept under semantic-*", () => {
173
+ const { light } = colorTokens({
174
+ colors: [{ name: "Danger", value: "#ff0000" }],
175
+ system: { color: { semantic: { danger: "#a11d1d" } } },
176
+ });
177
+ assert.equal(light.danger, "#ff0000", "the palette wins the plain key");
178
+ assert.equal(light["semantic-danger"], "#a11d1d", "and the semantic token is still not lost");
179
+ });
180
+
181
+ test("tokenRef prefers a named key, falls back to the first, and returns null on empty", () => {
182
+ assert.equal(tokenRef("rounded", { chip: "8px", pill: "999px" }, ["pill"]), "{rounded.pill}");
183
+ assert.equal(tokenRef("rounded", { chip: "8px" }, ["pill"]), "{rounded.chip}");
184
+ assert.equal(tokenRef("rounded", {}, ["pill"]), null);
185
+ });
186
+
187
+ test("a component field whose group is empty is omitted, never emitted as a dead ref", () => {
188
+ const comps = componentRefs({ colors: { primary: "#000", paper: "#fff", ink: "#111" }, rounded: {}, spacing: {}, shadow: {}, border: {}, faces: {} });
189
+ const flat = comps.flatMap(([, fields]) => fields.map(([k]) => k));
190
+ assert.ok(flat.includes("background"));
191
+ assert.ok(!flat.includes("radius"), "no rounded tokens → no radius field");
192
+ assert.ok(!flat.includes("padding"), "no spacing tokens → no padding field");
193
+ for (const [, fields] of comps) for (const [, v] of fields) assert.ok(v && !v.includes("{undefined"), v);
194
+ });
195
+
196
+ test("scaleTokens turns numbers into px and passes strings through", () => {
197
+ assert.deepEqual(scaleTokens([{ name: "sm", value: 8 }, { name: "hairline", value: "1px solid #eee" }]), {
198
+ sm: "8px",
199
+ hairline: "1px solid #eee",
200
+ });
201
+ assert.deepEqual(scaleTokens(null), {});
202
+ assert.deepEqual(scaleTokens([null, 3, { name: "", value: 4 }, { name: "ok" }]), {});
203
+ });
204
+
205
+ test("typographyTokens falls back to system.typography.families for a face fonts lacks", () => {
206
+ const { faces, scale } = typographyTokens({
207
+ fonts: { body: "Inter" },
208
+ system: { typography: { families: { heading: { family: "Outfit" } } } },
209
+ type: [{ role: "Body", size: 14, weight: 400 }, { role: "Body", size: 99, weight: 100 }],
210
+ });
211
+ assert.deepEqual(faces, { body: "Inter", heading: "Outfit" });
212
+ assert.equal(scale.length, 1, "a duplicate role is taken once — first wins");
213
+ assert.equal(scale[0].size, "14px");
214
+ });
215
+
216
+ test("slugToken makes a YAML/ref-safe key out of anything", () => {
217
+ assert.equal(slugToken("Primary · Moss"), "primary-moss");
218
+ assert.equal(slugToken("2xl"), "2xl");
219
+ assert.equal(slugToken(" Café "), "cafe");
220
+ assert.equal(slugToken(""), "");
221
+ assert.equal(slugToken(null), "");
222
+ });
223
+
224
+ test("KNOWN_FOUNDATION_KEYS lists what the renderer EMITS, not what it recognises", () => {
225
+ // Kept in step by hand with src/lib/branding/foundation.ts#brandFoundationSchema
226
+ // in the hq repo. If hq gains a key, the renderer parks it in "Additional
227
+ // tokens" until someone models it — which is the tolerant behaviour, not a bug.
228
+ assert.deepEqual([...KNOWN_FOUNDATION_KEYS].sort(), [
229
+ "border", "colors", "fonts", "logos", "positioning", "radii",
230
+ "shadow", "space", "system", "taglines", "toneTraits", "type", "v",
231
+ "visualLanguage", "voice",
232
+ ]);
233
+ // `examples` is hq's (`z.any()`), and NOTHING here renders it — so it must
234
+ // not be on the list. A key listed as known that no renderer emits is
235
+ // dropped in silence, which is the one failure this module exists to prevent.
236
+ assert.ok(!KNOWN_FOUNDATION_KEYS.includes("examples"));
237
+ });
238
+
239
+ // ── the nested blocks: silence is the failure mode ──────────────────────────
240
+
241
+ test("`examples` is not modelled anywhere, so it lands in Additional tokens verbatim", () => {
242
+ const f = fixture();
243
+ f.examples = { hero: "zzz-hero-marker", cta: "zzz-cta-marker" };
244
+ const md = renderDesignMd(f, OPTS);
245
+ assert.match(md, /## Additional tokens/);
246
+ assert.match(md, /"zzz-hero-marker"/);
247
+ assert.match(md, /"zzz-cta-marker"/);
248
+ assert.deepEqual(additionalTokens(f).find(([k]) => k === "examples")[1], f.examples);
249
+ });
250
+
251
+ test("system.imagery is rendered — it is a different block from visualLanguage.imagery, and both appear", () => {
252
+ const md = renderDesignMd(fixture(), OPTS);
253
+ assert.match(md, /### Imagery\n/, "the art-direction block");
254
+ assert.match(md, /### Imagery \(brand system\)\n/, "and the brand system's own");
255
+ assert.match(md, /- \*\*Treatment:\*\* warm highlights, cool shadows/, "a field only system.imagery has");
256
+ assert.match(md, /- \*\*Avoid:\*\* stock handshakes, isolated laptops/);
257
+ // And the pair visualLanguage.imagery carries that nothing used to emit.
258
+ assert.match(md, /- \*\*Duotone:\*\* shadow #12213f · highlight #f3ede1/);
259
+ });
260
+
261
+ test("visualLanguage's generation seeds and provenance are emitted, not swallowed", () => {
262
+ const md = renderDesignMd(fixture(), OPTS);
263
+ assert.match(md, /- \*\*Prompt seed:\*\* quiet rooms, natural light, fine grain/);
264
+ assert.match(md, /- \*\*Seed locked:\*\* yes/);
265
+ assert.match(md, /- \*\*Negative seed:\*\* neon, lens flare/);
266
+ assert.match(md, /- \*\*References:\*\* moodboard\/2026-03/);
267
+ });
268
+
269
+ test("an unmodelled SUB-key of system / visualLanguage lands in Additional tokens too", () => {
270
+ const f = fixture();
271
+ f.system.holography = { medium: "zzz-system-marker" };
272
+ f.visualLanguage.parallax = "zzz-vl-marker";
273
+ const md = renderDesignMd(f, OPTS);
274
+ assert.deepEqual(
275
+ additionalTokens(f).map(([k]) => k),
276
+ ["elevationCurve", "examples", "gridUnit", "system.holography", "visualLanguage.parallax"],
277
+ "dotted paths, one level into the two blocks hq actually grows",
278
+ );
279
+ assert.match(md, /"zzz-system-marker"/);
280
+ assert.match(md, /"zzz-vl-marker"/);
281
+ });
282
+
283
+ test("every sub-key the fixture carries is claimed by a renderer, so nothing rides on the fold", () => {
284
+ // The fold is a safety net for an hq that grows a block. It must not be
285
+ // load-bearing for anything shipping today: if a sub-key of these two blocks
286
+ // shows up in "Additional tokens" for the realistic fixture, a renderer was
287
+ // meant to emit it and does not.
288
+ const f = fixture();
289
+ assert.deepEqual(additionalTokens(f).map(([k]) => k).filter((k) => k.includes(".")), []);
290
+ for (const k of Object.keys(f.system)) assert.ok(KNOWN_SYSTEM_KEYS.includes(k), `system.${k}`);
291
+ for (const k of Object.keys(f.visualLanguage)) assert.ok(KNOWN_VISUAL_LANGUAGE_KEYS.includes(k), `visualLanguage.${k}`);
292
+ });
293
+
294
+ test("leading and tracking come from system.typography.scale — foundation.type never carries them", () => {
295
+ // hq's typeRoleSchema is {role, size, weight}, full stop. Reading leading off
296
+ // it was dead code; the tuned values live in a different array keyed by the
297
+ // same role names.
298
+ const { scale } = typographyTokens({
299
+ type: [{ role: "Display", size: 76, weight: 600 }],
300
+ system: { typography: { scale: [{ role: "Display", size: 9, weight: 100, leading: 1.05, tracking: -0.02 }] } },
301
+ });
302
+ assert.deepEqual(scale, [{ key: "display", size: "76px", weight: "600", leading: "1.05", tracking: "-0.02" }]);
303
+
304
+ // A role only the system scale names is still rendered, not lost.
305
+ const { scale: extra } = typographyTokens({
306
+ type: [{ role: "Body", size: 14, weight: 400 }],
307
+ system: { typography: { scale: [{ role: "Caption", size: 11, weight: 500, leading: 1.4 }] } },
308
+ });
309
+ assert.deepEqual(extra.map((r) => r.key), ["body", "caption"]);
310
+ assert.equal(extra[1].leading, "1.4");
311
+
312
+ // And a value put on `type` where hq never puts one is ignored rather than
313
+ // quietly inventing a leading no surface can produce.
314
+ const { scale: bogus } = typographyTokens({ type: [{ role: "Body", size: 14, weight: 400, leading: 9 }] });
315
+ assert.equal(bogus[0].leading, "");
316
+
317
+ assert.match(renderDesignMd(fixture(), OPTS), /display: \{ size: "76px", weight: 600, leading: 1\.05, tracking: -0\.02 \}/);
318
+ });
@@ -0,0 +1,238 @@
1
+ ---
2
+ name: "Northwind"
3
+ version: "bv_01HQZ"
4
+ generatedAt: "2026-09-08T12:00:00.000Z"
5
+ source: "cohort · branding.getFoundation"
6
+ colors:
7
+ ink: "#0d0d0d"
8
+ paper: "#ffffff"
9
+ primary-moss: "#2d5be3"
10
+ muted: "#6b7280"
11
+ accent-amber: "#c9851f"
12
+ line: "#e7e5e4"
13
+ primary: "#2d5be3"
14
+ accent: "#c9851f"
15
+ success: "#177245"
16
+ warning: "#c9851f"
17
+ danger: "#a11d1d"
18
+ neutral-100: "#f5f5f4"
19
+ neutral-500: "#78716c"
20
+ neutral-900: "#1c1917"
21
+ colorsDark:
22
+ ink: "#f5f5f4"
23
+ paper: "#0b0b0c"
24
+ primary-moss: "#7ea0ff"
25
+ line: "#26262a"
26
+ primary: "#7ea0ff"
27
+ typography:
28
+ display: "Outfit"
29
+ body: "Inter"
30
+ mono: "JetBrains Mono"
31
+ heading: "Outfit"
32
+ scale:
33
+ display: { size: "76px", weight: 600, leading: 1.05, tracking: -0.02 }
34
+ heading: { size: "38px", weight: 600, leading: 1.15, tracking: -0.01 }
35
+ body: { size: "14px", weight: 400, leading: 1.5 }
36
+ small: { size: "11.5px", weight: 500 }
37
+ caption: { size: "11px", weight: 500, leading: 1.4, tracking: 0.04 }
38
+ rounded:
39
+ chip: "8px"
40
+ field: "9px"
41
+ card: "13px"
42
+ modal: "14px"
43
+ pill: "999px"
44
+ spacing:
45
+ xs: "4px"
46
+ sm: "8px"
47
+ md: "12px"
48
+ lg: "16px"
49
+ xl: "22px"
50
+ shadow:
51
+ sm: "0 1px 2px rgba(13,13,13,0.06)"
52
+ md: "0 18px 50px rgba(13,13,13,0.13)"
53
+ border:
54
+ hairline: "1px solid #e7e5e4"
55
+ strong: "1px solid #d6d3d1"
56
+ components:
57
+ button:
58
+ background: "{colors.primary}"
59
+ foreground: "{colors.paper}"
60
+ radius: "{rounded.pill}"
61
+ padding: "{spacing.sm} {spacing.lg}"
62
+ font: "{typography.body}"
63
+ card:
64
+ background: "{colors.paper}"
65
+ foreground: "{colors.ink}"
66
+ border: "{border.hairline}"
67
+ radius: "{rounded.card}"
68
+ padding: "{spacing.xl}"
69
+ shadow: "{shadow.md}"
70
+ input:
71
+ background: "{colors.paper}"
72
+ border: "{border.hairline}"
73
+ radius: "{rounded.field}"
74
+ padding: "{spacing.sm} {spacing.md}"
75
+ font: "{typography.body}"
76
+ surface:
77
+ background: "{colors.paper}"
78
+ foreground: "{colors.ink}"
79
+ muted: "{colors.muted}"
80
+ radius: "{rounded.modal}"
81
+ ---
82
+
83
+ # Northwind — design system
84
+
85
+ The frontmatter above is the token contract: it is generated from the workspace's
86
+ saved brand foundation and is the source of truth for colour, type, radius and
87
+ spacing. Read it before you pick a value. Component entries are written as
88
+ `{group.key}` refs, so changing a token changes every component that names it.
89
+
90
+ This file is GENERATED — edits here are overwritten on the next sync. To change
91
+ the foundation itself, propose the change (`design_propose_change`); a human
92
+ reviews and applies it, and the next sync brings it back down.
93
+
94
+ ## Palette
95
+
96
+ - `{colors.ink}` — #0d0d0d (dark #f5f5f4)
97
+ - `{colors.paper}` — #ffffff (dark #0b0b0c)
98
+ - `{colors.primary-moss}` — #2d5be3 (dark #7ea0ff)
99
+ - `{colors.muted}` — #6b7280
100
+ - `{colors.accent-amber}` — #c9851f
101
+ - `{colors.line}` — #e7e5e4 (dark #26262a)
102
+ - `{colors.primary}` — #2d5be3 (dark #7ea0ff)
103
+ - `{colors.accent}` — #c9851f
104
+ - `{colors.success}` — #177245
105
+ - `{colors.warning}` — #c9851f
106
+ - `{colors.danger}` — #a11d1d
107
+ - `{colors.neutral-100}` — #f5f5f4
108
+ - `{colors.neutral-500}` — #78716c
109
+ - `{colors.neutral-900}` — #1c1917
110
+
111
+ ## Typography
112
+
113
+ - **display:** Outfit
114
+ - **body:** Inter
115
+ - **mono:** JetBrains Mono
116
+ - **heading:** Outfit
117
+
118
+ - `{typography.scale.display}` — 76px · weight 600 · leading 1.05 · tracking -0.02
119
+ - `{typography.scale.heading}` — 38px · weight 600 · leading 1.15 · tracking -0.01
120
+ - `{typography.scale.body}` — 14px · weight 400 · leading 1.5
121
+ - `{typography.scale.small}` — 11.5px · weight 500
122
+ - `{typography.scale.caption}` — 11px · weight 500 · leading 1.4 · tracking 0.04
123
+
124
+ ### Type rules
125
+
126
+ One geometric face for structure, one humanist face for reading.
127
+
128
+ - Display only above 32px.
129
+ - Never set body copy below 13px.
130
+
131
+ ### Colour rules
132
+
133
+ - One primary per view.
134
+ - Semantic colour is for state, never decoration.
135
+
136
+ ## Visual language
137
+
138
+ ### Imagery
139
+
140
+ - **Uses imagery:** yes
141
+ - **Medium:** photography
142
+ - **Secondary media:** diagram
143
+ - **Grade:** natural
144
+ - **Grain:** fine
145
+ - **Crop:** wide
146
+ - **Aspect ratios:** 16/9, 1/1
147
+ - **Subjects:** hands at work, quiet rooms
148
+ - **Mood:** calm, considered
149
+ - **Composition:** off-centre, generous negative space
150
+ - **Duotone:** shadow #12213f · highlight #f3ede1
151
+
152
+ ### Imagery (brand system)
153
+
154
+ - **Medium:** documentary photography
155
+ - **Style:** unstaged
156
+ - **Treatment:** warm highlights, cool shadows
157
+ - **Mood:** assured
158
+ - **Subjects:** workshops, field crews
159
+ - **Avoid:** stock handshakes, isolated laptops
160
+
161
+ ### Iconography
162
+
163
+ - **Style:** line
164
+ - **Weight:** 1.5px
165
+ - **Corner:** rounded
166
+ - **Grid:** 24
167
+
168
+ ### Motion
169
+
170
+ - **Character:** settled
171
+ - **Easing:** cubic-bezier(0.2, 0, 0, 1)
172
+ - **Duration (ms):** 220
173
+ - **Principles:** Move once, arrive., Never animate what a person is reading.
174
+
175
+ ### Texture
176
+
177
+ - **Surfaces:** paper, frosted glass
178
+ - **Background:** flat
179
+ - **Notes:** No gradients behind text.
180
+
181
+ ### Guardrails
182
+
183
+ Do:
184
+
185
+ - Let type carry the page.
186
+ - Use one accent per view.
187
+
188
+ Do not:
189
+
190
+ - No stock handshakes.
191
+ - No drop shadows on text.
192
+
193
+ ### Generation seeds
194
+
195
+ - **Prompt seed:** quiet rooms, natural light, fine grain
196
+ - **Seed locked:** yes
197
+ - **Negative seed:** neon, lens flare
198
+ - **References:** moodboard/2026-03
199
+ - **Source:** generated
200
+ - **Schema version:** 2
201
+
202
+ ## Layout principles
203
+
204
+ - Left-align everything that reads.
205
+ - One idea per band.
206
+
207
+ ## Marks
208
+
209
+ - `brandIcon` — set
210
+ - `wordmark` — set
211
+
212
+ Fetch the bytes with `design_export_kit`; never inline them here.
213
+
214
+ ## Additional tokens
215
+
216
+ Keys the renderer does not model yet, carried through verbatim so nothing is
217
+ lost between an hq that added a token and an SDK that has not learned it.
218
+
219
+ ```json
220
+ {
221
+ "elevationCurve": {
222
+ "0": "none",
223
+ "1": "0 1px 2px rgba(0,0,0,0.05)"
224
+ },
225
+ "examples": {
226
+ "hero": "A crew at first light.",
227
+ "cta": "Start the walkthrough"
228
+ },
229
+ "gridUnit": 4
230
+ }
231
+ ```
232
+
233
+ ## Provenance
234
+
235
+ - **Version:** V2.7
236
+ - **Version id:** bv_01HQZ
237
+ - **Synced:** 2026-09-08T12:00:00.000Z
238
+ - **Source:** cohort · branding.getFoundation
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: "Northwind"
3
+ version: "bv_01HQZ"
4
+ generatedAt: "2026-09-08T12:00:00.000Z"
5
+ source: "cohort · branding.getFoundation"
6
+ ---
7
+
8
+ # Northwind — product voice
9
+
10
+ Generated from the workspace's saved brand foundation. It says how this
11
+ product sounds; `DESIGN.md` beside it says how it looks. Read both before
12
+ writing anything a customer sees. Edits here are overwritten on the next
13
+ sync — propose foundation changes with `design_propose_change`.
14
+
15
+ ## Positioning
16
+
17
+ The operating system for companies that run on agents as well as people.
18
+
19
+ ## Taglines
20
+
21
+ - Work that runs itself.
22
+ - One company, many hands.
23
+
24
+ ## Voice
25
+
26
+ Concise, specific, accountable. Write like a capable peer — no hype, no emoji, no hedging.
27
+
28
+ ## Tone
29
+
30
+ - Plain
31
+ - Exact
32
+ - Unhurried
33
+ - Direct
34
+
35
+ ## Lexicon
36
+
37
+ Say:
38
+
39
+ - decide
40
+ - ship
41
+ - owe
42
+
43
+ Avoid:
44
+
45
+ - leverage
46
+ - synergy
47
+ - unlock
48
+
49
+ ## In practice
50
+
51
+ Two invoices need a decision today. Both are under £5,000.
52
+
53
+ ## Motifs
54
+
55
+ - A single hairline rule.
56
+ - Numbers set in the mono face.
57
+
58
+ ## Iconography
59
+
60
+ Line icons on a 24px grid, 1.5px stroke.
61
+
62
+ ## Provenance
63
+
64
+ - **Version:** V2.7
65
+ - **Version id:** bv_01HQZ
66
+ - **Synced:** 2026-09-08T12:00:00.000Z
67
+ - **Source:** cohort · branding.getFoundation