@synap-core/workspace-templates 0.70.0 → 0.71.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synap-core/workspace-templates",
3
- "version": "0.70.0",
3
+ "version": "0.71.0",
4
4
  "type": "module",
5
5
  "description": "Canonical workspace definitions — YAML source + typed exports for browser, backend, CLI, and marketplace",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",
package/src/builder.yaml CHANGED
@@ -2097,9 +2097,14 @@ playbooks:
2097
2097
  # nothing is implemented from a design a person has not approved; a
2098
2098
  # rejection loops to Generate. Verify's check gate and Done's human gate both
2099
2099
  # send rework to Implement.
2100
- # The worker is MANUAL: Generate creates the sibling variants as ui-designs,
2101
- # and an `on: created` worker would propose a run for each of them (the
2102
- # activator grammar has no filter to tell a request from a variant).
2100
+ # Two workers (plan 48854969 §10.4, founder: the automatic start is back
2101
+ # on). MANUAL, and CREATED → PROPOSE a run on the new design; it replaces
2102
+ # the archived pod automation 34d335f9 (entity.create.completed, ui-design).
2103
+ # Generate creates the sibling variants as ui-designs that already carry
2104
+ # the request's `variant-group`; `unless: variant-group present` leaves them
2105
+ # out, so only a request (created without a group) proposes a run. A person
2106
+ # who creates a design with a variant-group already set starts it by hand.
2107
+ # Never `run`: a person approves each start.
2103
2108
  - name: Design to implementation
2104
2109
  description: Take a UI design request from three variants built only of real Storybook components, through a rubric critique and a person's review on the canvas, to a pull request verified by the gates, a before/after compare and a walk in the running app.
2105
2110
  goalTemplate: >-
@@ -2126,13 +2131,29 @@ playbooks:
2126
2131
  guards are green, the implemented story was captured and compared with
2127
2132
  the design and the current story, and the screen was walked in the
2128
2133
  running app. Move the design's status only through its lifecycle
2129
- (update_entity with expectedStatus); never invent a status.
2134
+ (update_entity with expectedStatus); never invent a status. PINS: the
2135
+ person annotates the design on the board; each pin is an open comment
2136
+ thread on this design. Read them with synap_get_thread_context
2137
+ {object: {type: entity, id: <the design>}, state: open}: each thread's
2138
+ anchor.locator names the frame (frameId, blockId), the viewport, the
2139
+ point and the contentVersion the person saw. A pin whose contentVersion
2140
+ is not the design's current updatedAt (the entity's own timestamp, in
2141
+ the same ISO form) is stale: say so in its thread and do not apply it
2142
+ blindly. Any write that bumps updatedAt (a save, your own write) makes
2143
+ older pins read stale, so read them before you write the design. Apply every current pin in the next variants and reply
2144
+ in its thread (synap_post_message, comment.replyTo the thread id) with
2145
+ what changed; never resolve a pin: the person resolves it at Review
2146
+ (agents propose, people resolve). A pod run of this playbook has no
2147
+ comment tool: an agent with the MCP doors works these steps.
2130
2148
  subjectProfile:
2131
2149
  profileSlug: ui-design
2132
2150
  # No stage owns these: `approved` and `archived` are a person's call
2133
2151
  # (humanOnly on the lifecycle).
2134
2152
  activators:
2135
2153
  - { on: manual, mode: propose }
2154
+ - on: created
2155
+ mode: propose
2156
+ unless: { property: variant-group, present: true }
2136
2157
  params:
2137
2158
  - { name: design, type: entity, label: UI design, required: true }
2138
2159
  - { name: surface, type: text, label: Target surface }
@@ -2143,7 +2164,7 @@ playbooks:
2143
2164
  name: Generate
2144
2165
  category: planned
2145
2166
  subjectStatus: draft
2146
- goal: Write three variants as Puck JSON as a canvas of frames, one per screen (one frame for a single screen) — this design and two siblings in its variant-group — from components the Storybook manifest lists, with their declared props, tokens and named motion presets only, each with every state the screen has.
2167
+ goal: First read the design's open pins (synap_get_thread_context with object the design, state open) and mark each stale one (its locator.contentVersion is not the design's current updatedAt), before writing anything to the design. Write three variants as Puck JSON as a canvas of frames, one per screen (one frame for a single screen) — this design and two siblings in its variant-group — from components the Storybook manifest lists, with their declared props, tokens and named motion presets only, each with every state the screen has, applying every current pin. Reply in each pin's thread (synap_post_message, comment.replyTo) with what changed, or why it was stale or not applied; never resolve a pin.
2147
2168
  expectedOutputs:
2148
2169
  - kind: ui-design
2149
2170
  label: Sibling variants (same variant-group)
@@ -2182,7 +2203,7 @@ playbooks:
2182
2203
  name: Review
2183
2204
  category: started
2184
2205
  subjectStatus: in-review
2185
- goal: A person compares the variants and their critiques on the canvas and approves one, or sends the design back with what to change. A sibling chosen over this design is written into it first, so the run carries the chosen variant.
2206
+ goal: A person compares the variants and their critiques on the canvas and approves one, or sends the design back with what to change. The person resolves the pins the variants answered and pins what is still wrong; sending it back returns the run to Generate, which reads the open pins again. A sibling chosen over this design is written into it first, so the run carries the chosen variant.
2186
2207
  # The commitment: implementation starts only from an approved design.
2187
2208
  gate: { kind: human }
2188
2209
  onFail: { toStage: generate }
@@ -3578,7 +3599,19 @@ playbooks:
3578
3599
  an agent pushing main by hand. DONE: reviewed-hash = source-hash and
3579
3600
  review-state fresh. Code facts of the record (name, props, stories,
3580
3601
  source, composition) belong to the Storybook sync: never edit them on
3581
- the pod.
3602
+ the pod. PINS: the person may pin the component's stories on the board;
3603
+ each pin is an open comment thread on the component. Read them with
3604
+ synap_get_thread_context {object: {type: entity, id: <the component>},
3605
+ state: open}: each thread's anchor.locator names the story (storyId),
3606
+ the viewport, the point and the contentVersion the person saw. A pin
3607
+ whose contentVersion is not the component's current source-hash is
3608
+ stale: say so in its thread and do not apply it blindly. Every current
3609
+ pin is a finding of the critique; reply in its thread
3610
+ (synap_post_message, comment.replyTo the thread id) with the verdict
3611
+ and, for a fix, what changed; never resolve a pin: the person resolves
3612
+ it at Approve (agents propose, people resolve). A pod run of this
3613
+ playbook has no comment tool: an agent with the MCP doors works these
3614
+ steps.
3582
3615
  scope: session
3583
3616
  subjectProfile:
3584
3617
  profileSlug: ui-component
@@ -3599,7 +3632,7 @@ playbooks:
3599
3632
  - key: critique
3600
3633
  name: Critique
3601
3634
  category: started
3602
- goal: Set the component's review-state to in-review, then judge each of its stories with the design-critique rubric and write the findings (rule id, tier, severity, confidence, region, evidence) into the critique document.
3635
+ goal: "Set the component's review-state to in-review, then judge each of its stories with the design-critique rubric and write the findings (rule id, tier, severity, confidence, region, evidence) into the critique document. Read the component's open pins too (synap_get_thread_context with object the component, state open): each current pin (its locator.contentVersion equals the component's source-hash) is a finding, with its thread as the evidence; a stale one is listed as stale and not judged."
3603
3636
  expectedOutputs:
3604
3637
  - kind: document
3605
3638
  label: Component critique (findings by story, tier and rule id)
@@ -3611,6 +3644,9 @@ playbooks:
3611
3644
  - key: critique-every-story
3612
3645
  statement: Every story id of the component (story-ids) is critiqued or named as skipped with why.
3613
3646
  check: { kind: judge }
3647
+ - key: critique-pins-read
3648
+ statement: Every pin open on the component when the review started is in the critique, as a finding (its contentVersion equals the component's source-hash) or as stale, and has a reply in its thread from this run; no pin was resolved by the agent.
3649
+ check: { kind: judge }
3614
3650
  - key: verdict
3615
3651
  name: Verdict
3616
3652
  category: started
@@ -3637,7 +3673,7 @@ playbooks:
3637
3673
  - key: implement
3638
3674
  name: Implement
3639
3675
  category: started
3640
- goal: Build the enhanced version in the component's source with the real components, on a branch of the project's repo, with its story updated, and capture the story before and after. Nothing reaches main here. Record the branch and its full head sha on the session.
3676
+ goal: Build the enhanced version in the component's source with the real components, on a branch of the project's repo, with its story updated, and capture the story before and after; apply each current pin the verdict kept and reply in its thread with what changed. Nothing reaches main here. Record the branch and its full head sha on the session.
3641
3677
  criteria:
3642
3678
  - key: implement-matches-design
3643
3679
  statement: The change builds the enhanced version and nothing else, with no invented component and no hard-coded colour, and its before/after captures are on the session.
@@ -3662,7 +3698,7 @@ playbooks:
3662
3698
  - key: approve
3663
3699
  name: Approve
3664
3700
  category: started
3665
- goal: "The card shows the before/after capture of the story, the diff summary and the green devbox run at the full head sha. Approving it releases land, publish and done; no later stage asks again. A change touching auth, keys, vault, billing or a migration, or publishing to anyone but this pod, files its own approval instead of riding this one."
3701
+ goal: "The card shows the before/after capture of the story, the diff summary and the green devbox run at the full head sha, and the replies in the pins' threads. Approving it releases land, publish and done; no later stage asks again. The person resolves the pins the fix answered. A change touching auth, keys, vault, billing or a migration, or publishing to anyone but this pod, files its own approval instead of riding this one."
3666
3702
  gate: { kind: human }
3667
3703
  onFail: { toStage: implement }
3668
3704
  expectedOutputs:
@@ -0,0 +1,143 @@
1
+ /**
2
+ * The board's pins in the design playbooks (plan 48854969 §10.3): "Design to
3
+ * implementation" and "Review a UI component" read the open pins on their
4
+ * subject, treat a stale one as stale, reply in each pin's thread, and never
5
+ * resolve one (agents propose, people resolve: backend comments.ts refuses an
6
+ * agent's resolve).
7
+ *
8
+ * What this guards:
9
+ * 1. each playbook's run text reads the pins through the agent read door,
10
+ * `synap_get_thread_context` with `object` + `state: open` (backend#1316),
11
+ * and replies through `synap_post_message` with `comment.replyTo`;
12
+ * 2. the door it names takes those arguments: read from the backend's MCP
13
+ * tool manifest when synap-backend is a sibling checkout (skipped
14
+ * otherwise, and said so);
15
+ * 3. the stale rule compares `locator.contentVersion` with the value the
16
+ * board stamps (lane pins-app, apps/ui-gallery pinModel.ts isStale): the
17
+ * component's `source-hash` property (checked to exist on the kind), the
18
+ * design entity's own `updatedAt` (an entity column, not a property, so
19
+ * only the text is checked);
20
+ * 4. no text tells the agent to resolve a pin, and the person's gate says
21
+ * the person resolves them;
22
+ * 5. the stage that reads the pins owes a reply to every open pin: a
23
+ * criterion on Review a UI component; on Design to implementation, which
24
+ * sits at the pod's 12-criteria cap (build.mjs refuses a 13th), the
25
+ * stage goal says it.
26
+ *
27
+ * Not covered: whether the pod run can call the doors (it cannot: the run has
28
+ * no comment tool, a known gap in run-tools.guard), and the board's stamping.
29
+ */
30
+ import { existsSync, readFileSync } from "node:fs";
31
+ import { dirname, join } from "node:path";
32
+ import { fileURLToPath } from "node:url";
33
+ import { describe, expect, it } from "vitest";
34
+ import { getWorkspaceTemplate } from "./templates.js";
35
+
36
+ const builder = getWorkspaceTemplate("builder-workspace")!;
37
+ type Stage = { key: string; goal?: string; criteria?: { key: string }[] };
38
+ type Pb = { name: string; goalTemplate: string; stages: Stage[] };
39
+ const playbook = (name: string) => (builder.playbooks as unknown as Pb[]).find((p) => p.name === name)!;
40
+ const props = (slug: string) => new Set(builder.profiles.find((p) => p.slug === slug)!.properties.map((p) => p.slug));
41
+ const textOf = (p: Pb) => [p.goalTemplate, ...p.stages.map((s) => s.goal ?? "")].join("\n");
42
+
43
+ /**
44
+ * What the board stamps into a pin's contentVersion: the ui-design entity's
45
+ * `updatedAt` (ISO), a component record's `source-hash` property.
46
+ */
47
+ const CASES = [
48
+ { name: "Design to implementation", subject: "ui-design", version: "updatedAt", isProperty: false, readStage: "generate", criterion: null, gate: "review" },
49
+ { name: "Review a UI component", subject: "ui-component", version: "source-hash", isProperty: true, readStage: "critique", criterion: "critique-pins-read", gate: "approve" },
50
+ ] as const;
51
+
52
+ describe("design playbooks read the board's pins", () => {
53
+ for (const c of CASES) {
54
+ describe(c.name, () => {
55
+ const p = playbook(c.name);
56
+
57
+ it("reads the open pins through the agent read door and replies in each thread", () => {
58
+ expect(p, c.name).toBeDefined();
59
+ expect(p.goalTemplate).toMatch(/synap_get_thread_context\s*\{object: \{type: entity, id: <the [a-z]+>\},\s*state: open\}/);
60
+ expect(p.goalTemplate).toContain("anchor.locator");
61
+ expect(textOf(p)).toMatch(/synap_post_message, comment\.replyTo/);
62
+ });
63
+
64
+ it("calls a pin stale against the value the board stamps", () => {
65
+ if (c.isProperty) expect(props(c.subject).has(c.version), `${c.subject}.${c.version}`).toBe(true);
66
+ else expect(props(c.subject).has(c.version), `${c.version} is an entity column, never a property`).toBe(false);
67
+ const rule = p.goalTemplate.match(/contentVersion\s+is not ([^.]*)\./);
68
+ expect(rule, "the goal states the stale rule").not.toBeNull();
69
+ expect(rule![1]).toContain(c.version);
70
+ const stage = p.stages.find((s) => s.key === c.readStage)!;
71
+ expect(stage.goal).toContain(c.version);
72
+ });
73
+
74
+ it("never has the agent resolve a pin; the person does at the gate", () => {
75
+ const text = textOf(p);
76
+ expect(text).not.toMatch(/(?<!never )\bresolve (?:each|every|the|a) pin/i);
77
+ expect(text).toMatch(/never resolve a pin/);
78
+ const gate = p.stages.find((s) => s.key === c.gate)!;
79
+ expect(gate.goal).toMatch(/person resolves? (?:it|them|the pins)/i);
80
+ });
81
+
82
+ it("the reading stage owes a reply to every open pin", () => {
83
+ const stage = p.stages.find((s) => s.key === c.readStage)!;
84
+ expect(stage.goal).toContain("synap_get_thread_context");
85
+ if (c.criterion) expect((stage.criteria ?? []).map((k) => k.key)).toContain(c.criterion);
86
+ else expect(stage.goal).toMatch(/Reply in each pin's thread/);
87
+ });
88
+ });
89
+ }
90
+
91
+ it("self-check: the resolve scan catches an imperative and spares the refusal", () => {
92
+ const re = /(?<!never )\bresolve (?:each|every|the|a) pin/i;
93
+ expect(re.test("Apply it, then resolve each pin you applied.")).toBe(true);
94
+ expect(re.test("never resolve a pin: the person does")).toBe(false);
95
+ });
96
+ });
97
+
98
+ const MANIFEST = join(
99
+ dirname(fileURLToPath(import.meta.url)),
100
+ "../../../../synap-backend/packages/api/src/routers/mcp/tools/mcp-tools.manifest.json"
101
+ );
102
+
103
+ describe.skipIf(!existsSync(MANIFEST))("the doors the stages name take those arguments (backend MCP manifest)", () => {
104
+ const raw = existsSync(MANIFEST) ? JSON.parse(readFileSync(MANIFEST, "utf8")) : [];
105
+ const tools = (Array.isArray(raw) ? raw : raw.tools) as { name: string; inputSchema?: { properties?: Record<string, { type?: string; enum?: string[]; properties?: Record<string, unknown> }> } }[];
106
+ const tool = (name: string) => tools.find((t) => t.name === name);
107
+
108
+ it("synap_get_thread_context reads an object's threads by state", () => {
109
+ // The manifest declares `object` as an object and spells its {type, id}
110
+ // in the description (backend#1316), so the keys are not checked here.
111
+ const schema = tool("synap_get_thread_context")?.inputSchema?.properties ?? {};
112
+ expect(schema.object?.type).toBe("object");
113
+ expect(schema.state?.enum).toEqual(expect.arrayContaining(["open", "resolved"]));
114
+ });
115
+
116
+ it("synap_post_message replies in a comment thread", () => {
117
+ const schema = tool("synap_post_message")?.inputSchema?.properties ?? {};
118
+ expect(Object.keys(schema.comment?.properties ?? {})).toContain("replyTo");
119
+ });
120
+ });
121
+
122
+ /**
123
+ * Plan §10.4 (founder: the automatic start is back on): a new ui-design
124
+ * PROPOSES a run of Design to implementation, never runs one, and the
125
+ * variants Generate creates (they carry the request's variant-group) do not.
126
+ * Not covered: the pod honouring `unless` on a created worker (backend
127
+ * jobs playbook-run.ts skippedByUnless, read, not run here).
128
+ */
129
+ describe("Design to implementation starts itself on a new design, as a proposal", () => {
130
+ type Activator = { on: string; mode?: string; unless?: { property: string; present: boolean } };
131
+ const p = playbook("Design to implementation") as unknown as Pb & { activators?: Activator[] };
132
+
133
+ it("declares a created activator in propose mode that skips the variants", () => {
134
+ const created = (p.activators ?? []).filter((a) => a.on === "created");
135
+ expect(created).toEqual([{ on: "created", mode: "propose", unless: { property: "variant-group", present: true } }]);
136
+ expect(props("ui-design").has("variant-group")).toBe(true);
137
+ });
138
+
139
+ it("no activator of it runs without a person", () => {
140
+ expect((p.activators ?? []).length).toBeGreaterThanOrEqual(2);
141
+ for (const a of p.activators ?? []) expect(a.mode, a.on).toBe("propose");
142
+ });
143
+ });
@@ -81,7 +81,15 @@ describe("Design to implementation — the design loop", () => {
81
81
  expect(critique.onFail).toEqual({ toStage: "generate" });
82
82
  });
83
83
 
84
- it("no process that produces its own subject kind starts on `created` (corpus-wide)", () => {
84
+ // A process that creates things of its own subject kind and starts on
85
+ // `created` would start itself on each of them. It may start on `created`
86
+ // only with an `unless` on a property every thing it creates already
87
+ // carries (Design to implementation: its variants carry the request's
88
+ // variant-group, plan §10.4). What is checked: the property is named in
89
+ // the process beyond the filter itself (a name check: it does not prove
90
+ // the process writes the property onto what it creates). An activator with
91
+ // no `unless`, or one on a property the process never names, fails.
92
+ it("no process that produces its own subject kind starts on `created` unfiltered (corpus-wide)", () => {
85
93
  const selfProducing: string[] = [];
86
94
  const offenders: string[] = [];
87
95
  for (const t of Object.values(WORKSPACE_TEMPLATES))
@@ -95,8 +103,13 @@ describe("Design to implementation — the design loop", () => {
95
103
  ];
96
104
  if (!subject || !outs.some((o) => o.kind === subject)) continue;
97
105
  selfProducing.push(`${t.meta.slug}:${p.name}`);
98
- if ((p.activators ?? []).some((a) => a.on === "created"))
99
- offenders.push(`${t.meta.slug}:${p.name}`);
106
+ const text = JSON.stringify(p);
107
+ for (const a of (p.activators ?? []) as { on: string; unless?: { property: string } }[]) {
108
+ if (a.on !== "created") continue;
109
+ const prop = a.unless?.property;
110
+ const stamped = !!prop && (text.match(new RegExp(`\\b${prop}\\b`, "g")) ?? []).length >= 2;
111
+ if (!stamped) offenders.push(`${t.meta.slug}:${p.name}`);
112
+ }
100
113
  }
101
114
  expect(selfProducing).toContain(
102
115
  "builder-workspace:Design to implementation"
package/src/templates.ts CHANGED
@@ -6793,7 +6793,7 @@ const DATA = {
6793
6793
  {
6794
6794
  "name": "Design to implementation",
6795
6795
  "description": "Take a UI design request from three variants built only of real Storybook components, through a rubric critique and a person's review on the canvas, to a pull request verified by the gates, a before/after compare and a walk in the running app.",
6796
- "goalTemplate": "Take this UI design ({design}) for {surface} from draft to implemented. Load the designing-with-real-components skill first, and design-critique for the Critique stage. GENERATE: read the Storybook component manifest (/manifests/components.json, or the Storybook MCP), the design's goal and scope and the entities it references, and write THREE variants as Puck JSON as a canvas of frames, one per screen (one frame for a single screen) — this design and two sibling ui-designs sharing its variant-group — using ONLY components the manifest lists, with props each one declares, design tokens and named motion presets only; each variant lays out every state the screen has (empty, loading, failed, full, long content); fill components-used from the JSON (across every frame of a canvas) and set schema-version (always 3: a canvas of frames, one per screen; never 1 or 2). CRITIQUE: judge each variant with the design-critique rubric and write the findings into its critique; a checked or pattern blocker sends the run back to Generate; opinions are never applied. REVIEW: a person compares the variants on the canvas and approves one; nothing is implemented from an unapproved design, and only a person sets approved. IMPLEMENT: read design-json and the Storybook MCP, build the screen from those same real components, open a pull request and record its URL in implementation-pr and the built screen's story in implemented-story-id (a single-frame design) or, for a design of several frames, each frame's stories in frame-stories ({ frameId: [storyId, ...] }). VERIFY: typecheck, story coverage, interaction and accessibility tests, visual regression and the token guards are green, the implemented story was captured and compared with the design and the current story, and the screen was walked in the running app. Move the design's status only through its lifecycle (update_entity with expectedStatus); never invent a status.",
6796
+ "goalTemplate": "Take this UI design ({design}) for {surface} from draft to implemented. Load the designing-with-real-components skill first, and design-critique for the Critique stage. GENERATE: read the Storybook component manifest (/manifests/components.json, or the Storybook MCP), the design's goal and scope and the entities it references, and write THREE variants as Puck JSON as a canvas of frames, one per screen (one frame for a single screen) — this design and two sibling ui-designs sharing its variant-group — using ONLY components the manifest lists, with props each one declares, design tokens and named motion presets only; each variant lays out every state the screen has (empty, loading, failed, full, long content); fill components-used from the JSON (across every frame of a canvas) and set schema-version (always 3: a canvas of frames, one per screen; never 1 or 2). CRITIQUE: judge each variant with the design-critique rubric and write the findings into its critique; a checked or pattern blocker sends the run back to Generate; opinions are never applied. REVIEW: a person compares the variants on the canvas and approves one; nothing is implemented from an unapproved design, and only a person sets approved. IMPLEMENT: read design-json and the Storybook MCP, build the screen from those same real components, open a pull request and record its URL in implementation-pr and the built screen's story in implemented-story-id (a single-frame design) or, for a design of several frames, each frame's stories in frame-stories ({ frameId: [storyId, ...] }). VERIFY: typecheck, story coverage, interaction and accessibility tests, visual regression and the token guards are green, the implemented story was captured and compared with the design and the current story, and the screen was walked in the running app. Move the design's status only through its lifecycle (update_entity with expectedStatus); never invent a status. PINS: the person annotates the design on the board; each pin is an open comment thread on this design. Read them with synap_get_thread_context {object: {type: entity, id: <the design>}, state: open}: each thread's anchor.locator names the frame (frameId, blockId), the viewport, the point and the contentVersion the person saw. A pin whose contentVersion is not the design's current updatedAt (the entity's own timestamp, in the same ISO form) is stale: say so in its thread and do not apply it blindly. Any write that bumps updatedAt (a save, your own write) makes older pins read stale, so read them before you write the design. Apply every current pin in the next variants and reply in its thread (synap_post_message, comment.replyTo the thread id) with what changed; never resolve a pin: the person resolves it at Review (agents propose, people resolve). A pod run of this playbook has no comment tool: an agent with the MCP doors works these steps.",
6797
6797
  "subjectProfile": {
6798
6798
  "profileSlug": "ui-design"
6799
6799
  },
@@ -6801,6 +6801,14 @@ const DATA = {
6801
6801
  {
6802
6802
  "on": "manual",
6803
6803
  "mode": "propose"
6804
+ },
6805
+ {
6806
+ "on": "created",
6807
+ "mode": "propose",
6808
+ "unless": {
6809
+ "property": "variant-group",
6810
+ "present": true
6811
+ }
6804
6812
  }
6805
6813
  ],
6806
6814
  "params": [
@@ -6824,7 +6832,7 @@ const DATA = {
6824
6832
  "name": "Generate",
6825
6833
  "category": "planned",
6826
6834
  "subjectStatus": "draft",
6827
- "goal": "Write three variants as Puck JSON as a canvas of frames, one per screen (one frame for a single screen) — this design and two siblings in its variant-group — from components the Storybook manifest lists, with their declared props, tokens and named motion presets only, each with every state the screen has.",
6835
+ "goal": "First read the design's open pins (synap_get_thread_context with object the design, state open) and mark each stale one (its locator.contentVersion is not the design's current updatedAt), before writing anything to the design. Write three variants as Puck JSON as a canvas of frames, one per screen (one frame for a single screen) — this design and two siblings in its variant-group — from components the Storybook manifest lists, with their declared props, tokens and named motion presets only, each with every state the screen has, applying every current pin. Reply in each pin's thread (synap_post_message, comment.replyTo) with what changed, or why it was stale or not applied; never resolve a pin.",
6828
6836
  "expectedOutputs": [
6829
6837
  {
6830
6838
  "kind": "ui-design",
@@ -6905,7 +6913,7 @@ const DATA = {
6905
6913
  "name": "Review",
6906
6914
  "category": "started",
6907
6915
  "subjectStatus": "in-review",
6908
- "goal": "A person compares the variants and their critiques on the canvas and approves one, or sends the design back with what to change. A sibling chosen over this design is written into it first, so the run carries the chosen variant.",
6916
+ "goal": "A person compares the variants and their critiques on the canvas and approves one, or sends the design back with what to change. The person resolves the pins the variants answered and pins what is still wrong; sending it back returns the run to Generate, which reads the open pins again. A sibling chosen over this design is written into it first, so the run carries the chosen variant.",
6909
6917
  "gate": {
6910
6918
  "kind": "human"
6911
6919
  },
@@ -8835,7 +8843,7 @@ const DATA = {
8835
8843
  {
8836
8844
  "name": "Review a UI component",
8837
8845
  "description": "Review one UI component of an app's Storybook against the design-critique rubric and decide what to do with it: nothing (fine, the run ends), a rewrite plan (the founder decides on it, nothing is built), or a small fix, built and gated on a branch and shown to the founder. Approving `approve` releases land, publish and done; no later stage asks the person again. Ends with the component marked reviewed at its current source.",
8838
- "goalTemplate": "Review the UI component {component} and decide what to do with it. Load the design-critique skill first (and designing-with-real-components for a fix). Read the component record: its stories, screenshot, props, composition (composed_of), variants (extends), the pages that use it, its family in the inventory, and its source file at the synced sha; read what the pod already knows about it (recall first). Set review-state to in-review when you start. CRITIQUE: judge each of its stories with the rubric (each finding with its rule id, tier, severity and region); opinions are never applied. VERDICT, which branches before any code: fine ends the run (reviewed-hash = source-hash, review-state fresh, no build); rewrite writes a plan document and stops on the founder's ask, nothing is built; only a small fix goes on. IMPLEMENT and GATE the fix on a branch of the project's repo (nothing reaches main before Approve). APPROVE: the founder sees the before/after of the story, the diff summary and the green gate at the full head sha, and approves once; that releases LAND, PUBLISH and DONE, run through the project's ship actions, never by an agent pushing main by hand. DONE: reviewed-hash = source-hash and review-state fresh. Code facts of the record (name, props, stories, source, composition) belong to the Storybook sync: never edit them on the pod.",
8846
+ "goalTemplate": "Review the UI component {component} and decide what to do with it. Load the design-critique skill first (and designing-with-real-components for a fix). Read the component record: its stories, screenshot, props, composition (composed_of), variants (extends), the pages that use it, its family in the inventory, and its source file at the synced sha; read what the pod already knows about it (recall first). Set review-state to in-review when you start. CRITIQUE: judge each of its stories with the rubric (each finding with its rule id, tier, severity and region); opinions are never applied. VERDICT, which branches before any code: fine ends the run (reviewed-hash = source-hash, review-state fresh, no build); rewrite writes a plan document and stops on the founder's ask, nothing is built; only a small fix goes on. IMPLEMENT and GATE the fix on a branch of the project's repo (nothing reaches main before Approve). APPROVE: the founder sees the before/after of the story, the diff summary and the green gate at the full head sha, and approves once; that releases LAND, PUBLISH and DONE, run through the project's ship actions, never by an agent pushing main by hand. DONE: reviewed-hash = source-hash and review-state fresh. Code facts of the record (name, props, stories, source, composition) belong to the Storybook sync: never edit them on the pod. PINS: the person may pin the component's stories on the board; each pin is an open comment thread on the component. Read them with synap_get_thread_context {object: {type: entity, id: <the component>}, state: open}: each thread's anchor.locator names the story (storyId), the viewport, the point and the contentVersion the person saw. A pin whose contentVersion is not the component's current source-hash is stale: say so in its thread and do not apply it blindly. Every current pin is a finding of the critique; reply in its thread (synap_post_message, comment.replyTo the thread id) with the verdict and, for a fix, what changed; never resolve a pin: the person resolves it at Approve (agents propose, people resolve). A pod run of this playbook has no comment tool: an agent with the MCP doors works these steps.",
8839
8847
  "scope": "session",
8840
8848
  "subjectProfile": {
8841
8849
  "profileSlug": "ui-component"
@@ -8875,7 +8883,7 @@ const DATA = {
8875
8883
  "key": "critique",
8876
8884
  "name": "Critique",
8877
8885
  "category": "started",
8878
- "goal": "Set the component's review-state to in-review, then judge each of its stories with the design-critique rubric and write the findings (rule id, tier, severity, confidence, region, evidence) into the critique document.",
8886
+ "goal": "Set the component's review-state to in-review, then judge each of its stories with the design-critique rubric and write the findings (rule id, tier, severity, confidence, region, evidence) into the critique document. Read the component's open pins too (synap_get_thread_context with object the component, state open): each current pin (its locator.contentVersion equals the component's source-hash) is a finding, with its thread as the evidence; a stale one is listed as stale and not judged.",
8879
8887
  "expectedOutputs": [
8880
8888
  {
8881
8889
  "kind": "document",
@@ -8897,6 +8905,13 @@ const DATA = {
8897
8905
  "check": {
8898
8906
  "kind": "judge"
8899
8907
  }
8908
+ },
8909
+ {
8910
+ "key": "critique-pins-read",
8911
+ "statement": "Every pin open on the component when the review started is in the critique, as a finding (its contentVersion equals the component's source-hash) or as stale, and has a reply in its thread from this run; no pin was resolved by the agent.",
8912
+ "check": {
8913
+ "kind": "judge"
8914
+ }
8900
8915
  }
8901
8916
  ]
8902
8917
  },
@@ -8945,7 +8960,7 @@ const DATA = {
8945
8960
  "key": "implement",
8946
8961
  "name": "Implement",
8947
8962
  "category": "started",
8948
- "goal": "Build the enhanced version in the component's source with the real components, on a branch of the project's repo, with its story updated, and capture the story before and after. Nothing reaches main here. Record the branch and its full head sha on the session.",
8963
+ "goal": "Build the enhanced version in the component's source with the real components, on a branch of the project's repo, with its story updated, and capture the story before and after; apply each current pin the verdict kept and reply in its thread with what changed. Nothing reaches main here. Record the branch and its full head sha on the session.",
8949
8964
  "criteria": [
8950
8965
  {
8951
8966
  "key": "implement-matches-design",
@@ -8988,7 +9003,7 @@ const DATA = {
8988
9003
  "key": "approve",
8989
9004
  "name": "Approve",
8990
9005
  "category": "started",
8991
- "goal": "The card shows the before/after capture of the story, the diff summary and the green devbox run at the full head sha. Approving it releases land, publish and done; no later stage asks again. A change touching auth, keys, vault, billing or a migration, or publishing to anyone but this pod, files its own approval instead of riding this one.",
9006
+ "goal": "The card shows the before/after capture of the story, the diff summary and the green devbox run at the full head sha, and the replies in the pins' threads. Approving it releases land, publish and done; no later stage asks again. The person resolves the pins the fix answered. A change touching auth, keys, vault, billing or a migration, or publishing to anyone but this pod, files its own approval instead of riding this one.",
8992
9007
  "gate": {
8993
9008
  "kind": "human"
8994
9009
  },