@clearlysh/beehaven 0.8.32 → 0.8.34

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.
@@ -5,14 +5,30 @@ description: Needs a terminal with the beehaven CLI (Claude Code, Codex, Gemini
5
5
 
6
6
  # clearly-agent — who you are, and what that makes your work
7
7
 
8
- ## Select the workspace, then sign in once
8
+ ## Sign in once — this session is then you, in one workspace
9
9
 
10
10
  ```bash
11
- beehaven env
12
- beehaven connect home
13
- beehaven agent login <name> --label "what I am here to do" --client cli
11
+ beehaven env # staging or prod: the session remembers it
12
+ beehaven agent login <name> --label "what I am here to do" --client cli [--workspace <ws>]
14
13
  ```
15
14
 
15
+ After login **every** `beehaven` command in this session runs as `<name>`, in its workspace — no
16
+ `--agent`, no export, nothing per call. The login prints the session, the agent, the workspace (by
17
+ name) and the env. `--workspace` takes `home`, `workspace/<id>`, `team/<id>` or a bare 64-character
18
+ id (`beehaven workspaces` lists them); without it a session starts where this identity last worked.
19
+
20
+ **One session = one identity + one workspace + one env (AWO-394).** A session is a Claude/Codex/
21
+ Gemini conversation, or a terminal tab. Each has its own:
22
+ - workspace — `beehaven connect <ws>` moves THIS session only (and moves its work session there);
23
+ another agent, or another conversation signed in as the same name, stays where it is;
24
+ - work session — a second login under the same name no longer ends the first one's;
25
+ - env — if someone switches the daemon (`beehaven env prod`), calls from a staging session are
26
+ refused with the fix instead of landing in the other environment.
27
+
28
+ Typed verbs (`ticket`, `sheet`, `slides`, `design`, `mention`, `trash`) follow the session's
29
+ workspace exactly like `call` (AWO-393). A Shopify store is an operator target:
30
+ `beehaven admin do shopifyStore/<id> <action> '<json>'` (platform admins).
31
+
16
32
  ## Personal workspace means a private layer, not another DO
17
33
 
18
34
  Every human and every agent in the selected workspace has a **personal workspace layer**: its own
@@ -38,13 +54,14 @@ steps. CI gets a real identity for one command: `beehaven agent login ci`.
38
54
  | 2 | `BEEHAVEN_AGENT=<name>` | a script, or another terminal |
39
55
  | 3 | the **scope binding** from `agent login` | this session, no flag needed |
40
56
 
41
- ⚠ **The binding needs no cooperation.** `agent login` records the calling process's scope —
42
- `claude-<sessionId>`, `codex-…`, `gemini-…`, or `pid-<ppid>` for a non-TTY — on the identity. So
43
- two harness sessions are two agents concurrently with no env var, and **two agents on one scope is
44
- refused rather than guessed** (that can only happen if you logged in twice from one session).
57
+ ⚠ **The binding needs no cooperation.** `agent login` writes `~/.beehaven/sessions/<scope>.json` for
58
+ the calling process's scope — `claude-<sessionId>`, `codex-…`, `gemini-…`, `term-<tab>` for a
59
+ terminal tab that says which tab it is (macOS Terminal, iTerm2, Windows Terminal, tmux, kitty,
60
+ WezTerm), or `pid-<ppid>` for a non-TTY. Two harness sessions or two tabs are two agents
61
+ concurrently with no env var; logging in twice from one session means the second login.
45
62
 
46
- ⚠ The workspace **cursor** is scoped the same way, so two identities can be `connect`ed to
47
- different workspaces at once. What is NOT concurrent: one daemon, one relay, one `beehaven env`.
63
+ ⚠ What is still machine-wide: one daemon, one relay, one `beehaven env` (sessions refuse a mismatch
64
+ rather than follow it). `agent logout` ends this session only.
48
65
 
49
66
  ## Identity ≠ session
50
67
 
@@ -216,6 +233,11 @@ governance. Each resource's delete cell is `none`, `own`, or `all`; `own` means
216
233
  `created_by: agent:<your-id>`. Missing or legacy author data is not yours. Permanent deletion is
217
234
  human-only; agent deletes use a recoverable archive, tombstone, or checkpoint.
218
235
 
236
+ Removing canvas layers is an **update**, including `canvas.delete`, block removal, and placed
237
+ design layers. You may remove layers from any visible canvas within your edit scope, regardless
238
+ of its author. The server requires an undo checkpoint first. Deleting or archiving the whole
239
+ canvas still follows delete-own/delete-all (CAN2-128).
240
+
219
241
  Only agents whose owner is currently a workspace owner or admin can use admin or delete-all. The
220
242
  server checks this on every call: if your owner is demoted, your scope drops to write/delete-own.
221
243
  After an owner is promoted again, a human must explicitly re-grant the higher scope.
@@ -228,15 +250,17 @@ owner/admin-owned agent can be granted it. Check yours before a destructive step
228
250
  beehaven call agent-capabilities-get '{}' # { scope, matrix, summary }
229
251
  ```
230
252
 
231
- ⚠ `permission_scope: 'write'` lets you delete only your own work. A refusal on another author's
232
- item is the contract working, not a bug. ⚠ You cannot change permissions — yours or another agent's;
253
+ ⚠ `permission_scope: 'write'` lets you archive/remove only your own workspace items; editing layers
254
+ inside an editable canvas follows the update rule above. A permission refusal is the contract
255
+ working, not a bug. ⚠ You cannot change permissions — yours or another agent's;
233
256
  ask the owner.
234
257
 
235
258
  ## Traps that cost real time
236
259
 
237
260
  - ⚠ **`beehaven env` first.** `prod` and `staging` are different databases and `--env` does not
238
261
  exist on `call` — the daemon *is* the env. Every number is meaningless if you are on the wrong one.
239
- - ⚠ **A deploy does not reach a resident DO.** `beehaven stop && sleep 15 && beehaven start --headless`.
262
+ - ⚠ **Verify a deploy by the response's runtime version.** Allow propagation and retry read-only
263
+ checks; do not restart the user's daemon to force a resident DO onto a new version.
240
264
  - ⚠⚠ **Check the `as <agent>` on your first call.** An identity archived in this workspace still
241
265
  mints (identities are account-level), but the workspace refuses its session. Current CLIs say so
242
266
  (`⚠ Signed in, but this workspace refused …`, exit 1) and then refuse every call as that
@@ -20,6 +20,13 @@ The deliverable is a composition that communicates a specific idea at its intend
20
20
  viewing size, with editable, well-named layers. Successful RPCs prove that nodes were
21
21
  stored. A rendered image you have inspected is the evidence for visual quality.
22
22
 
23
+ Use the same working method as a designer in Figma: artboards, named editable layers,
24
+ text styles, reusable components, auto-layout and constraints; explicit responsive states;
25
+ then inspect the pixels and refine. Read `authoring.md` and discover the current catalog
26
+ before assuming an operation is missing. Typography defaults to Auto; use `140%` or `24px`
27
+ for explicit line heights. Keep unsupported capabilities and unverified rendering visible
28
+ in the handoff; a familiar workflow does not prove every Figma feature is implemented.
29
+
23
30
  For a small correction, keep the existing direction and make the smallest useful edit.
24
31
  For a new composition or substantial redesign, use the workflow below.
25
32
 
@@ -33,7 +40,7 @@ Load **`design-craft`** before any new visual work: grid, type scale, colour rol
33
40
  spacing, optical correction, the studio pass. It ships beside this skill; `layout-systems`
34
41
  covers multi-artboard grids. This skill covers the canvas mechanics.
35
42
 
36
- A composition is done when every requested artboard meets all four conditions:
43
+ A composition is done when every requested artboard meets all five conditions:
37
44
 
38
45
  1. **`canvas.review` verdict is `clean` or `look`.** `fix` means a probable defect
39
46
  remains: text colliding or covered, contrast under WCAG (4.5:1 body, 3:1 display),
@@ -48,6 +55,12 @@ A composition is done when every requested artboard meets all four conditions:
48
55
  one accent, orphans, consistency.
49
56
  4. **The first read works at delivery size.** At thumbnail size, the thing that should
50
57
  win does win.
58
+ 5. **The document behaves as a design.** Inspect its frame tree: sections and UI containers
59
+ own their contents and background fills; rows, stacks and grids use live auto layout
60
+ with deliberate Hug/Fill/Fixed sizing. Resize a representative container and lengthen
61
+ its copy on a duplicate, then verify reflow and containment. Keep intentional artwork
62
+ positioned inside named artwork frames. Record these checks separately from visual QA;
63
+ `canvas.review` does not prove hierarchy or reflow.
51
64
 
52
65
  A new composition almost always needs at least one revision after its first render. If
53
66
  the pass finds nothing, look again at the thumbnail. If there is still nothing, say what
@@ -10,8 +10,8 @@ Use a local builder and pass JSON through `@file` or stdin. Do not interpolate c
10
10
  SVG or code into shell strings. Here is a minimal native-node pattern; replace its
11
11
  visual decisions with the brief's system:
12
12
 
13
- For a complete editable three-artboard example, inspect [example.mjs](example.mjs).
14
- It demonstrates tokens, reusable helpers and varied compositions; it writes a payload
13
+ For desktop, mobile and dark examples, inspect [example.mjs](example.mjs).
14
+ It demonstrates nested flow containers, Hug/Fill sizing and framed artwork; it writes a payload
15
15
  without making remote calls. Run `node <skill-directory>/example.mjs <composition-id>`.
16
16
  Use its construction approach, not its fictional brand or aesthetic, for other briefs.
17
17
 
@@ -21,18 +21,22 @@ const compositionId = process.argv[2];
21
21
  const grid = { w: 1440, h: 900, margin: 88, gap: 24 };
22
22
  const color = { paper: '#F3F0E8', ink: '#172824', accent: '#CB482F' };
23
23
  const type = {
24
- display: { family: 'Inter', size: 88, fontWeight: 700, lineHeight: 1.05, letterSpacing: -2 },
25
- body: { family: 'Inter', size: 24, fontWeight: 400, lineHeight: 1.4 },
24
+ display: { family: 'Inter', size: 88, fontWeight: 700, lineHeight: '105%', letterSpacing: -2 },
25
+ body: { family: 'Inter', size: 24, fontWeight: 400, lineHeight: '140%' },
26
26
  };
27
27
  const batch = [];
28
28
  const add = (action, args) => batch.push({ action, args });
29
29
  add('frame.create', { name: '01-opening', x: 0, y: 0, w: grid.w, h: grid.h, fill: color.paper });
30
- const text = (name, copy, x, y, w, role) => add('canvas.create-node', {
31
- name, type: 'text', parentId: '01-opening', x, y, w,
30
+ add('frame.create', { name: 'hero-copy', parentId: '01-opening', w: 740, h: 400, fill: 'transparent' });
31
+ const text = (name, copy, role) => add('canvas.create-node', {
32
+ name, type: 'text', parentId: 'hero-copy', w: 740,
32
33
  text: copy, fill: color.ink, ...type[role],
33
34
  });
34
- text('opening-title', 'Ideas take\nshape here.', grid.margin, 120, 740, 'display');
35
- text('opening-deck', 'An editable visual system for the next chapter.', grid.margin, 360, 580, 'body');
35
+ text('opening-title', 'Ideas take shape here.', 'display');
36
+ text('opening-deck', 'An editable visual system for the next chapter.', 'body');
37
+ add('canvas.update-nodes', { ids: ['opening-title', 'opening-deck'], patch: { layoutSizingH: 'fill' } });
38
+ add('canvas.auto-layout', { id: 'hero-copy', direction: 'v', gap: 24, sizingH: 'fixed', sizingV: 'hug' });
39
+ add('canvas.auto-layout', { id: '01-opening', direction: 'v', gap: 64, padding: grid.margin, sizingH: 'fixed', sizingV: 'hug' });
36
40
  // Continue with the brief's central visual, supporting evidence and footer.
37
41
  writeFileSync('/tmp/canvas-build.json', JSON.stringify({ compositionId, batch }));
38
42
  ```
@@ -57,6 +61,13 @@ Keep executed payloads and returned-ID manifests separate from regenerated plans
57
61
 
58
62
  ## Node shape and coordinates
59
63
 
64
+ Choose ownership before coordinates: page → section → row/stack/grid → content. Put
65
+ the container's background, border and radius on its frame. Auto layout owns positions
66
+ in content flow; use Hug for content height and Fill for flexible width. Keep deliberate
67
+ overlays and illustrations inside artwork frames. A native editable layer alone does
68
+ not establish a usable document structure. Frames also make scoped perception cheaper:
69
+ read the outline and the section you are editing instead of a full scene dump.
70
+
60
71
  Fields are flat: `{name,type,x,y,w,h,text,size,family,fontWeight,fill,...}`.
61
72
  Use `text` for copy, `size` for type size, numeric `fontWeight`, and `w`/`h` for bounds.
62
73
  Create normalizes hex colours; raw stored scenes use RGBA arrays in 0..1.
@@ -90,6 +101,14 @@ not a missing node. Replacing `svg` clears and rebuilds its reference automatica
90
101
 
91
102
  ## Typography
92
103
 
104
+ Line height defaults to **Auto**, from the font itself. Use `lineHeight:"140%"` for a
105
+ percentage of font size or `lineHeight:"24px"` for fixed leading. Numeric values in old
106
+ scenes remain multipliers (`1.4` = `140%`); new designs should carry explicit units.
107
+ Changing font size scales % leading and leaves px leading fixed. Paragraph spacing is
108
+ `paragraphSpacing` in px after a hard newline, never a soft wrap. In a fixed-height
109
+ box, `vAlign:"middle"` centers the line boxes; `"bottom"` anchors their bottom. Do not
110
+ compensate with spaces, empty lines or hand-tuned y offsets.
111
+
93
112
  For prose, set `w` and omit `h` to enable auto-height. Omit both axes only for short
94
113
  single-line labels whose width should hug content. A fixed box sets that axis explicitly;
95
114
  it does not guarantee text will clip safely. Headless auto-height is an estimate from
@@ -99,7 +118,7 @@ then inspect the rendered result in the editor.
99
118
  ```json
100
119
  {"compositionId":"<id>","action":"canvas.measure-text","args":{
101
120
  "text":"Ideas take shape here.","family":"Inter","size":88,"fontWeight":700,
102
- "letterSpacing":-2,"lineHeight":1.05,"maxWidth":740}}
121
+ "letterSpacing":-2,"lineHeight":"105%","maxWidth":740}}
103
122
  ```
104
123
 
105
124
  Use measured `height`/`lineCount` to place the next block. Measure the exact copy, font,
@@ -121,12 +140,21 @@ deliverable requires them, with content order and hierarchy reconsidered for the
121
140
 
122
141
  ## Technique
123
142
 
143
+ - CONTAINERS: page sections, cards, sidebars and toolbars are named frames that own their content and background fill. Use live auto-layout for content rows, stacks and grids, with explicit Hug/Fill/Fixed sizing; position overlays and artwork deliberately within their owning frames. A rectangle behind sibling text is not a container. Verify the frame tree, resize a representative container and lengthen its copy on a duplicate before completion; record reflow checks separately from pixel review.
144
+ - FIGMA WORKFLOW: approach this canvas as a designer working in Figma. Read the brand and component library; compose artboards from named editable frames, text, shapes and component instances; use auto-layout, constraints, styles and variables; create deliberate desktop/mobile and light/dark states; inspect at delivery size, iterate, then review the final edit. Discover the current canvas-catalog before assuming a familiar Figma operation is unavailable. Its headlessActions identify what runs without an open editor; live-only actions need an editor. Report an unsupported capability accurately rather than inventing an operation or claiming universal feature parity.
145
+
146
+ - TYPOGRAPHY: lineHeight defaults to "auto", using the resolved font metrics. Author percentages as "140%" and absolute leading as "24px"; legacy numeric 1.4 still means 140%. Percentage leading follows font size; px leading stays fixed until the Scale tool scales the artwork. paragraphSpacing is px between hard-newline paragraphs, never soft wraps. For Auto width omit w/h; for Auto height set w and omit h; for a fixed box set w/h. Explicit layoutSizingH/V "fixed" or "fill" overrides legacy autoWidth/autoHeight. align is left|center|right|justify; vAlign is top|middle|bottom and applies to fixed-height boxes. Measure exact copy/font/weight/width using canvas.measure-text, then inspect the pixels; do not center text with spaces or arbitrary y offsets.
147
+
124
148
  The same rules the in-app assistant works to (canvas-catalog returns them as `technique`).
125
149
 
126
- - AUTO-LAYOUT: rows and stacks (nav links, button groups, card rows, form fields) are a frame whose children you create in reading order, then canvas.auto-layout { id, direction, gap, padding, align, justify, hug }. hug:false keeps the frame size, which a full-width bar needs with justify:"space-between"; set a child to layoutSizingH/V "fill" | "hug" | "fixed" with canvas.update-nodes. The frame stays live: create more children into it (parentId) and they flow in; layoutPositioning:"absolute" takes one out of the flow.
150
+ - AUTO-LAYOUT: build every row, stack, card and grid AS an auto-layout frame from the start: frame.create (or canvas.create-node type "frame") { name, parentId, autoLayout: { direction: "h" | "v" | "grid", gap, padding, align, justify, hug } }, then create its children with parentId and NO x/y; they flow in creation order and the frame stays live. canvas.auto-layout { id, … } changes the settings; with only { id } it converts a hand-positioned frame, reading direction, gap and padding off the children so nothing moves, and review reports any stack left positioned by hand. hug:false keeps the frame size; justify "space-between" | "space-around" | "space-evenly" are the Auto gaps; align:"baseline" lines up text in a row. Grids take columns, rows, columnGap, rowGap, columnSizes / rowSizes ("fill", "2fr", "hug", px). wrap:true flows into new rows; give Fill cards a minW so they wrap where you mean. Child settings go on the child via canvas.update-nodes: layoutSizingH/V "fill" | "hug" | "fixed", minW / maxW / minH / maxH, gridColumn / gridRow / gridColumnSpan, layoutPositioning:"absolute".
151
+ - VARIABLES: use the brand by name, not by value: in canvas.create-node and frame.create write fill: "brand/accent", stroke: "brand/line", radius: "brand/radius", autoLayout: { gap: "brand/spacing", padding: "brand/spacing" }, and on text textStyle: "brand/heading" (or "brand/body"), which sets family, weight, size, line height and letter spacing together from the brand's type role. Each binds, so the layer follows the canvas brand and a switch of brand; "var/<name>" reaches a workspace variable (text: "var/product/name", visible: "var/flags/promo"). A dark version of a frame is variableModes: { brand: "dark" } on it, not new colours. canvas.variable binds existing layers (op "bind", "apply-style", "set-mode"); op "list" shows every variable and style. A typed value detaches.
127
152
  - GRADIENTS: gradient { kind, angle, stops: [{ offset, color }] } replaces the solid fill. angle is the direction the colour travels: 0 = left to right, 90 = top to bottom, 45 = top-left to bottom-right (not CSS degrees). Use two or three stops from the brand palette, and keep text off a busy gradient or check its contrast in canvas.review.
128
153
  - SHADOWS AND BLUR: effects on any node. A soft card shadow is { type: "drop-shadow", x: 0, y: 4, blur: 16, spread: 0, color: "#0000001F" }; frosted glass is { type: "background-blur", blur: 16 }. Never fake a shadow with an extra rectangle.
129
- - DRAWING: build every mark, icon, illustration and diagram shape from native layers, as a designer does in Figma, never as one generated SVG file. Primitives are canvas.create-node rect and ellipse; curves are pen paths, vector.create { name, parentId, points: [{ x, y, hIn?: { x, y }, hOut?: { x, y } }], closed, fill or stroke, strokeWidth }, where hIn/hOut are absolute control points: use few anchors with smooth handles, and refine with vector.read, vector.vertex.move and vector.handle.set. Round caps and joins: canvas.update-nodes patch { strokeCap: "round", strokeJoin: "round" }. Work back to front: ground, big silhouettes in flat brand colours, then features, then details and highlights; check the silhouette in canvas.review before detailing. Name layers by part ("fox/ear-left"), group each figure with canvas.group { ids, name } and set overlap with canvas.order { ids, op }. Make a cut-out by layering a ground-colour shape on top; vector.boolean { op } on selected paths needs an open editor. Keep one stroke weight per drawing. Photographic or painterly imagery is a placed raster. Raw SVG stays supported but is never the default: when an SVG is asked for, write the markup yourself as an svg node, canvas.create-node { type: "svg", name, w, h, svg } with <svg viewBox="0 0 W H"> matching w and h, or import existing markup the same way; never an SVG generation pipeline.
154
+ - DRAWING: build every mark, icon, illustration and diagram shape from native layers, as a designer does in Figma, never as one generated SVG file. Primitives are canvas.create-node rect and ellipse; curves are pen paths, vector.create { name, parentId, d, fill or stroke, strokeWidth }: write d as SVG path data (M, C, Z), native editable points in far fewer tokens than points: [{ x, y, hIn?, hOut? }] (hIn/hOut are absolute control points); few anchors, smooth curves. It also takes shape: petal|circle|polygon|star|arc|spiral with cx, cy and sizes; strokeCap/strokeJoin apply. Reshape in place with canvas.update-nodes { ids, patch: { points | d | shape } }. Draw a repeated part once: canvas.repeat { id, count, around | cx, cy } turns one petal into a flower; canvas.rotate { ids, angle, cx, cy }; canvas.boolean { ids, op: "union" | "subtract" | "intersect" | "exclude" } (exact, editable operands). Work back to front: ground, big silhouettes in flat brand colours, then features, then details and highlights; check the silhouette in canvas.review before detailing. Name layers by part ("fox/ear-left"), group each figure with canvas.group { ids, name } and set overlap with canvas.order { ids, op }. Keep one stroke weight per drawing. Photographic or painterly imagery is a placed raster. Raw SVG stays supported but is never the default: when an SVG is asked for, write the markup yourself as an svg node, canvas.create-node { type: "svg", name, w, h, svg } with <svg viewBox="0 0 W H"> matching w and h, or import existing markup the same way; never an SVG generation pipeline.
155
+ - COMPUTED GEOMETRY: shapes from math (radial petals, spirals, grids) are computed and drawn in ONE call: canvas-act { compositionId, script } runs JavaScript with geo.petal/circle/arc/star/polygon/spiral/smooth/rotate/radial/grid/bounds (degrees, 0 = 3 o'clock, clockwise) and a read-only scene list, then applies the { action, args } steps it returns. Never copy numbers from one tool result into another call. A new top-level artboard goes beside or below what scene already holds (or leave out both x and y), never at 0,0 over an existing one.
156
+ - SHEETS: several concepts or variants go on canvas.sheet { name, title, subtitle, cards or count, cols, cardW, cardH }: a live wrap grid of card frames that own their captions, so rows never overlap. Draw into a card with parentId = its id.
157
+ - MEASURE: answer spacing, overlap and alignment questions with canvas.measure { frame } or { ids } and quote its numbers, never from memory or a preview.
130
158
  - PLACEHOLDERS: until real imagery exists, draw a native placeholder at the final size in a muted brand tone, never a flat accent block: a rect with the slot radius plus a simple motif (an ellipse sun, a vector.create mountain), grouped with canvas.group and named "<section> image placeholder", with any label in its own text node.
131
159
  - SECTIONS: one frame per page section, named exactly as its ticket says, inside the page artboard. Build a section in one canvas-act batch that ends with canvas.review of the artboard and carries ticket: { id: "<its key>", status: "done", resolution: "<what changed>" }. The ticket moves only when that review is clean or look; result.ticket says whether it did. Then start the next section.
132
160
 
@@ -1,78 +1,81 @@
1
1
  #!/usr/bin/env node
2
- /** Example of a reusable native-node builder. Writes JSON only; it never calls a workspace. */
2
+ /** Three editable page states. Writes JSON only; it never calls a workspace. */
3
3
  import { writeFileSync } from 'node:fs';
4
4
 
5
5
  const [compositionId, output = '/tmp/fieldwork-build.json'] = process.argv.slice(2);
6
6
  if (!compositionId) throw new Error('Usage: node example.mjs <composition-id> [output.json]');
7
- const grid = { w: 1440, h: 900, margin: 88, gutter: 80 };
8
- const ink = '#172824', paper = '#F2F0E7', orange = '#C84A2E', muted = '#58685E';
9
7
  const batch = [];
10
8
  const op = (action, args) => batch.push({ action, args });
11
- const frame = (name, index, fill) => op('frame.create', {
12
- id: name, name, x: index * (grid.w + grid.gutter), y: 0, w: grid.w, h: grid.h, fill,
13
- });
14
- const node = (parentId, name, type, x, y, w, h, props) => op('canvas.create-node', {
15
- id: `${parentId}-${name}`, name: `${parentId}-${name}`, parentId, type, x, y, w, h, ...props,
16
- });
17
- const text = (p, name, copy, x, y, w, size = 24, fill = ink, weight = 400, extra = {}) =>
18
- node(p, name, 'text', x, y, w, undefined, { text: copy, size, family: 'Inter', fontWeight: weight,
19
- lineHeight: 1.12, fill, ...extra });
20
- const rect = (p, name, x, y, w, h, fill, extra = {}) => node(p, name, 'rect', x, y, w, h, { fill, ...extra });
21
- const circle = (p, name, x, y, d, fill, extra = {}) => node(p, name, 'ellipse', x, y, d, d, { fill, ...extra });
22
- const rule = (p, y, color) => rect(p, `rule-${y}`, grid.margin, y, grid.w - grid.margin * 2, 1, color);
23
- const masthead = (p, index, color) => {
24
- text(p, 'brand', 'FIELDWORK', grid.margin, 52, 400, 20, color, 700, { letterSpacing: 2 });
25
- text(p, 'series', 'DESIGN NOTES / VOL. 01', 912, 54, 440, 14, color, 400, { letterSpacing: 1 });
26
- text(p, 'folio', 'STUDIO PRACTICE', grid.margin, 828, 900, 14, color, 400, { letterSpacing: 1 });
27
- text(p, 'page', String(index).padStart(2, '0'), 1304, 828, 48, 14, color, 400, { align: 'right' });
28
- };
29
-
30
- // Brief: show how one simple visual idea becomes a coherent editorial system.
31
- // Hierarchy: statement → geometric proof → compact practical explanation.
32
- // Motif: two fields meet to make a third; repeated with a different function on each slide.
33
- const cover = 'fieldwork-01';
34
- frame(cover, 0, paper); masthead(cover, 1, ink); rule(cover, 104, ink);
35
- text(cover, 'eyebrow', 'A NOTE ON MAKING', 88, 168, 560, 16, orange, 700, { letterSpacing: 2 });
36
- text(cover, 'title', 'Make room\nfor the idea.', 80, 228, 810, 108, ink, 700, { letterSpacing: -4, lineHeight: 1.02 });
37
- text(cover, 'intro', 'Good design begins with a point of view.\nThe system gives it room to grow.', 88, 538, 740, 25, muted);
38
- circle(cover, 'disc', 977, 233, 350, orange);
39
- rect(cover, 'field', 916, 385, 270, 270, ink);
40
- rect(cover, 'intersection', 977, 385, 209, 198, paper, { radius: 0 });
41
- text(cover, 'motif-caption', '01 / TWO FIELDS, ONE IDEA', 920, 696, 420, 14, muted, 400, { letterSpacing: 1 });
42
- rule(cover, 782, ink);
43
-
44
- const method = 'fieldwork-02';
45
- frame(method, 1, ink); masthead(method, 2, paper); rule(method, 104, '#607369');
46
- text(method, 'title', 'One idea.\nMany expressions.', 80, 164, 1120, 92, paper, 700, { letterSpacing: -3, lineHeight: 1.04 });
47
- text(method, 'intro', 'Keep the visual logic.\nChange what the content needs.', 952, 380, 400, 24, '#C7CFC4');
48
- const concepts = [
49
- { x: 88, title: '01 / EMPHASIS', body: 'Let one thing lead.', kind: 0 },
50
- { x: 520, title: '02 / RELATIONSHIP', body: 'Make the connection visible.', kind: 1 },
51
- { x: 952, title: '03 / RHYTHM', body: 'Repeat with a reason.', kind: 2 },
52
- ];
53
- for (const c of concepts) {
54
- const y = 518;
55
- if (c.kind === 0) { circle(method, 'emphasis', c.x, y, 152, orange); circle(method, 'quiet', c.x + 192, y + 92, 60, paper); }
56
- if (c.kind === 1) { rect(method, 'relation-field', c.x, y + 20, 148, 120, paper); circle(method, 'relation-disc', c.x + 80, y, 152, orange); }
57
- if (c.kind === 2) for (let i = 0; i < 4; i++) rect(method, `rhythm-${i}`, c.x + i * 78, y + i * 20, 48, 152 - i * 20, i === 3 ? orange : paper);
58
- text(method, `label-${c.kind}`, c.title, c.x, 714, 380, 16, paper, 700, { letterSpacing: 1 });
59
- text(method, `body-${c.kind}`, c.body, c.x, 748, 380, 20, '#C7CFC4');
9
+ const fillWidth = id => op('canvas.update-nodes', { ids: [id], patch: { layoutSizingH: 'fill' } });
10
+ // Page, section, row, card and button share this container contract.
11
+ function flow(id, parentId, box, layout, children) {
12
+ // Enable flow before adding children so reading order is creation order.
13
+ op('frame.create', { id, name: id, parentId, fill: 'transparent', ...box,
14
+ autoLayout: { direction: 'v', gap: 24, padding: 0, ...layout },
15
+ layoutSizingH: layout.sizingH ?? 'fixed', layoutSizingV: layout.sizingV ?? 'hug' });
16
+ children(id);
17
+ op('canvas.auto-layout', { id, direction: 'v', gap: 24, padding: 0,
18
+ sizingH: 'fixed', sizingV: 'hug', ...layout });
19
+ return id;
60
20
  }
61
-
62
- const detail = 'fieldwork-03';
63
- frame(detail, 2, orange); masthead(detail, 3, paper); rule(detail, 104, paper);
64
- text(detail, 'title', 'The work is\nin the details.', 80, 168, 1100, 106, paper, 700, { letterSpacing: -4, lineHeight: 1.03 });
65
- text(detail, 'intro', 'A composition is finished when the details\nserve the idea — at every scale.', 88, 436, 850, 28, paper);
66
- rule(detail, 566, paper);
67
- const details = [
68
- ['TYPE', 'Measure the words.\nGive them a voice.'],
69
- ['SPACE', 'Group what belongs.\nLet the rest breathe.'],
70
- ['REVIEW', 'Look at the result.\nMake the next decision.'],
71
- ];
72
- details.forEach(([label, body], i) => {
73
- const x = grid.margin + i * 432;
74
- text(detail, `label-${i}`, label, x, 610, 380, 16, paper, 700, { letterSpacing: 2 });
75
- text(detail, `body-${i}`, body, x, 662, 390, 28, paper);
76
- });
21
+ function text(parentId, name, copy, w, size, fill, extra = {}) {
22
+ const id = parentId + '/' + name;
23
+ op('canvas.create-node', { id, name, parentId, type: 'text', w, text: copy,
24
+ size, family: 'Inter', fill, lineHeight: 'auto', ...extra });
25
+ fillWidth(id);
26
+ return id;
27
+ }
28
+ function page(id, x, mobile = false, dark = false) {
29
+ const w = mobile ? 390 : 1440, pad = mobile ? 24 : 80, inner = w - pad * 2;
30
+ const ink = dark ? '#F2F0E7' : '#172824', ground = dark ? '#172824' : '#F2F0E7';
31
+ flow(id, undefined, { x, y: 0, w, h: 1000, fill: ground }, { gap: 64, padding: pad }, p => {
32
+ flow(p + '/navigation', p, { w: inner, h: 48 }, { direction: 'h', align: 'center', justify: 'space-between' }, nav => {
33
+ text(nav, 'brand', 'FIELDWORK', inner - 140, 20, ink, { fontWeight: 700 });
34
+ text(nav, 'edition', 'STUDIO NOTES', 140, 14, ink);
35
+ op('canvas.update-nodes', { ids: [nav + '/edition'], patch: { layoutSizingH: 'fixed' } });
36
+ });
37
+ fillWidth(p + '/navigation');
38
+ flow(p + '/hero', p, { w: inner, h: 420 }, { direction: mobile ? 'v' : 'h', gap: 48 }, hero => {
39
+ const copyWidth = mobile ? inner : 740;
40
+ flow(hero + '/copy', hero, { w: copyWidth, h: 400 }, { gap: 24 }, copy => {
41
+ text(copy, 'eyebrow', 'A NOTE ON MAKING', copyWidth, 14, ink, { letterSpacing: 1.5 });
42
+ text(copy, 'title', 'Make room for the idea.', copyWidth, mobile ? 48 : 88, ink,
43
+ { fontWeight: 700, letterSpacing: -2, lineHeight: '105%' });
44
+ text(copy, 'description', 'A shared direction. An editable system. Room for the next idea.', copyWidth, 22, ink, { lineHeight: '145%' });
45
+ flow(copy + '/action', copy, { w: 240, h: 56, fill: ink, radius: 8 },
46
+ { direction: 'h', padding: 16, align: 'center' }, button => {
47
+ text(button, 'label', 'Explore the studio', 208, 16, ground, { align: 'center' });
48
+ });
49
+ });
50
+ fillWidth(hero + '/copy');
51
+ // Art-directed coordinates belong inside an owning artwork frame.
52
+ const art = hero + '/artwork', aw = mobile ? inner : 400;
53
+ op('frame.create', { id: art, name: 'Artwork / two fields', parentId: hero, w: aw, h: 320, fill: '#C84A2E' });
54
+ op('canvas.create-node', { id: art + '/disc', name: 'Disc', type: 'ellipse', parentId: art, x: 24, y: 24, w: 220, h: 220, fill: '#F2F0E7' });
55
+ op('canvas.create-node', { id: art + '/field', name: 'Field', type: 'rect', parentId: art, x: 116, y: 136, w: 196, h: 160, fill: '#172824' });
56
+ });
57
+ fillWidth(p + '/hero');
58
+ flow(p + '/features', p, { w: inner, h: 220 }, { direction: 'grid', columns: mobile ? 1 : 3,
59
+ rows: mobile ? 3 : 1, rowSizes: mobile ? ['hug', 'hug', 'hug'] : ['hug'], gap: 24, rowGap: 24 }, grid => {
60
+ for (const [name, title, body] of [
61
+ ['type', 'Give ideas a voice.', 'Type scales and wraps with the available space.'],
62
+ ['space', 'Keep room to grow.', 'Content owns its height. Related layers move together.'],
63
+ ['review', 'Make the next edit.', 'Resize a card and extend its copy to check the system.'],
64
+ ]) {
65
+ const card = grid + '/' + name, cw = mobile ? inner : (inner - 48) / 3;
66
+ flow(card, grid, { w: cw, h: 180, fill: dark ? '#294337' : '#FFFFFF', radius: 12 }, { gap: 16, padding: 24 }, c => {
67
+ text(c, 'title', title, cw - 48, 24, ink, { fontWeight: 600 });
68
+ text(c, 'body', body, cw - 48, 18, ink, { lineHeight: '145%' });
69
+ });
70
+ fillWidth(card);
71
+ }
72
+ });
73
+ fillWidth(p + '/features');
74
+ text(p, 'footer', 'FIELDWORK / A SYSTEM READY FOR CHANGE', inner, 14, ink, { letterSpacing: 1 });
75
+ });
76
+ }
77
+ page('01-desktop', 0);
78
+ page('02-mobile', 1520, true);
79
+ page('03-dark', 1990, false, true);
77
80
  writeFileSync(output, JSON.stringify({ compositionId, batch }, null, 2) + '\n');
78
- process.stdout.write(`${output}: ${batch.length} operations\n`);
81
+ process.stdout.write(output + ': ' + batch.length + ' operations\n');
@@ -114,8 +114,9 @@ divided by the ratio. Sizes that share a ratio look related; sizes picked by han
114
114
  make them obviously different in class (a grotesque with a serif), never two neighbours.
115
115
  - **Measure: 45–75 characters.** At 16px in a normal grotesque that is roughly **360–600px**.
116
116
  Set the text node's `w` to hold that, not to fill the column.
117
- - **Line height moves INVERSELY to size.** Body 1.4–1.6. Subheads 1.25–1.35. Display
118
- **0.95–1.05** — big type needs tight leading or it falls apart into stripes.
117
+ - **Line height defaults to Auto**, using the font's metrics. When tuning it deliberately,
118
+ use **140–160%** for body, **125–135%** for subheads, and **95–105%** for display type.
119
+ Author explicit units (`lineHeight:"140%"` or `"24px"`); percentage leading follows font size.
119
120
  - ⚠⚠ **TRACK DISPLAY TYPE NEGATIVE.** Type designed at 16px is far too loose at 120px.
120
121
  Above ~40px use `letterSpacing: -1` to `-4`; above ~120px, −3 to −6. **Uppercase and small
121
122
  labels go the other way: +1 to +3.** This one adjustment does more for perceived quality
@@ -250,8 +251,8 @@ only to show that a review happened.
250
251
 
251
252
  **A 1080×1350 social post**
252
253
  ```
253
- margin 72 · display 96–140 (weight 800, tracking −3, lineHeight 1.0)
254
- body 20–24 (weight 500, lineHeight 1.5, w ≤ 560)
254
+ margin 72 · display 96–140 (weight 800, tracking −3, lineHeight "100%")
255
+ body 20–24 (weight 500, lineHeight "150%", w ≤ 560)
255
256
  caption 16 (weight 600, tracking +1.5, uppercase)
256
257
  rule 2–3px accent · footer block bottom-aligned at 1350 − 72 − blockHeight
257
258
  ```
@@ -265,7 +266,7 @@ Content column ≤ 1200 wide even though the slide is 1920 — full width is unr
265
266
 
266
267
  **A 1440 web hero**
267
268
  ```
268
- margin 96 · content max 1200 · headline 64–88 (tracking −2, lineHeight 1.05)
269
+ margin 96 · content max 1200 · headline 64–88 (tracking −2, lineHeight "105%")
269
270
  sub 20–24 (muted ink, w ≤ 640) · CTA 48–56 tall, 24–32 horizontal padding, radius 8 or full
270
271
  ```
271
272
 
@@ -273,7 +274,9 @@ sub 20–24 (muted ink, w ≤ 640) · CTA 48–56 tall, 24–32 horizontal paddi
273
274
  ```
274
275
  padding 24–32 · radius 10–16 · gap between cards ≥ 2× padding
275
276
  title 20–24/600 · body 15–16/400 muted · one accent element maximum
276
- Background first, THEN the label — later nodes draw over earlier ones.
277
+ Use a filled frame that owns the card's contents. Apply auto layout with this padding
278
+ and a deliberate content gap; let text hug its height. Rectangles serve artwork,
279
+ swatches and rules. A background rectangle with sibling text does not form a card.
277
280
  ```
278
281
 
279
282
  ---
package/skills/index.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "project-plans.md",
18
18
  "review.mjs"
19
19
  ],
20
- "sha": "41327744a8cc0fe1"
20
+ "sha": "e23e25bd46b02d9c"
21
21
  },
22
22
  {
23
23
  "name": "agent-home",
@@ -39,14 +39,14 @@
39
39
  "SKILL.md",
40
40
  "references.md"
41
41
  ],
42
- "sha": "bf2f4fac6f57ea46"
42
+ "sha": "d11f0c45c93c9dea"
43
43
  },
44
44
  {
45
45
  "name": "layout-systems",
46
46
  "files": [
47
47
  "SKILL.md"
48
48
  ],
49
- "sha": "8de89b7b7c86f81f"
49
+ "sha": "27151a50e3bdb27a"
50
50
  },
51
51
  {
52
52
  "name": "brand-identity",
@@ -82,7 +82,7 @@
82
82
  "files": [
83
83
  "SKILL.md"
84
84
  ],
85
- "sha": "1c6425a2143e7901"
85
+ "sha": "11505106cb1dd287"
86
86
  },
87
87
  {
88
88
  "name": "visualize",
@@ -47,7 +47,7 @@ that lost one. If you have four items, ask whether one is really a different thi
47
47
  ```
48
48
  margin 8–10% of the short edge (1080 → 88–108; A3 → 280–350)
49
49
  display 12–20% of the HEIGHT (1350 → 160–270px), weight 700–900, tracking −3 to −6,
50
- lineHeight 0.92–1.0
50
+ lineHeight "92%"–"100%"
51
51
  supporting 2–3% of height credits, date, venue — deliberately small
52
52
  ```
53
53
 
@@ -105,7 +105,7 @@ content column ≤ 1200 even though the slide is 1920
105
105
  ## Landing page / hero — 1440 wide (design), content max 1200
106
106
 
107
107
  ```
108
- margin 96 · headline 64–88 (tracking −2, lineHeight 1.05) · sub 20–24 muted, w ≤ 640
108
+ margin 96 · headline 64–88 (tracking −2, lineHeight "105%") · sub 20–24 muted, w ≤ 640
109
109
  CTA 48–56 tall, 24–32 horizontal padding · section spacing 96–160 vertical
110
110
  ```
111
111
 
@@ -124,7 +124,7 @@ CTA 48–56 tall, 24–32 horizontal padding · section spacing 96–160 vertica
124
124
 
125
125
  ```
126
126
  margin: outer 10%, inner (gutter side) 12–14% — asymmetric, because the binding eats it
127
- columns 2–3 for A4 body · measure 45–75ch · body 10–11pt (≈42–46px at 300dpi), lineHeight 1.45
127
+ columns 2–3 for A4 body · measure 45–75ch · body 10–11pt (≈42–46px at 300dpi), lineHeight "145%"
128
128
  ```
129
129
 
130
130
  - **Asymmetric margins are the mark of real editorial.** Equal margins all round read as a
@@ -141,9 +141,9 @@ columns 2–3 for A4 body · measure 45–75ch · body 10–11pt (≈42–46px a
141
141
  ## Cards, tables and dense UI
142
142
 
143
143
  - **Card padding 24–32, radius 10–16, gap between cards ≥ 2× padding.**
144
- - ⚠⚠ **BACKGROUND FIRST, LABEL SECOND.** Later nodes draw over earlier ones — create the
145
- card rect, THEN its text. Reversed, the opaque fill hides the label and you get the classic
146
- "grid of cards with no text".
144
+ - **Cards are filled frames.** Parent labels, icons and controls to the card; use auto
145
+ layout for its content. Build rows and grids from these cards, with deliberate
146
+ Hug/Fill/Fixed sizing. Reserve rectangles for decorative shapes, swatches and rules.
147
147
  - **In tables, align numbers RIGHT and use tabular figures.** Left-aligned numbers of
148
148
  different lengths cannot be compared, which is the only reason the table exists.
149
149
  - **Zebra striping OR rules, never both.** Ideally neither — space is enough at ≥12px row padding.
@@ -153,10 +153,13 @@ columns 2–3 for A4 body · measure 45–75ch · body 10–11pt (≈42–46px a
153
153
  ## Building it on the canvas
154
154
 
155
155
  ```jsonc
156
- // ONE batch. Frames first, then children with parentId (x/y RELATIVE to the frame).
157
- {"action":"frame.create","args":{"name":"poster","x":200,"y":300,"w":1080,"h":1350,"fill":"#111111"}}
158
- {"action":"canvas.create-node","args":{"name":"headline","type":"text","parentId":"poster",
159
- "x":88,"y":900,"w":904,"text":"…","size":180,"fontWeight":800,"letterSpacing":-5,"lineHeight":0.95}}
156
+ // ONE batch. A content stack owns its fill and children; the layout computes positions.
157
+ {"action":"frame.create","args":{"id":"card","name":"Feature card","w":360,"h":200,"fill":"#FFFFFF"}}
158
+ {"action":"canvas.create-node","args":{"name":"Feature title","type":"text","parentId":"card",
159
+ "w":312,"text":"Make room for the idea","size":28,"fontWeight":600,"lineHeight":"auto"}}
160
+ {"action":"canvas.create-node","args":{"name":"Feature detail","type":"text","parentId":"card",
161
+ "w":312,"text":"Keep every layer ready for the next edit.","size":16,"lineHeight":"145%"}}
162
+ {"action":"canvas.auto-layout","args":{"id":"card","direction":"v","gap":16,"padding":24,"sizingH":"fixed","sizingV":"hug"}}
160
163
  ```
161
164
 
162
165
  - ⚠ **Omit `h` on text** — it hugs its wrapped content. Pin `h` only when a later element's
@@ -180,5 +183,5 @@ columns 2–3 for A4 body · measure 45–75ch · body 10–11pt (≈42–46px a
180
183
  | Deck | too many words; title states the topic instead of the argument; full-width text |
181
184
  | Landing | subhead runs full width; two competing CTAs; sections evenly spaced |
182
185
  | Editorial | symmetric margins; no baseline grid; unbroken columns |
183
- | Cards | text created before its background; gaps equal to padding so groups do not read |
186
+ | Cards | background and contents lack a shared frame; layout breaks when copy grows |
184
187
  | **All** | **an exact 50/50 split, and four type sizes where three would do** |