Skip to content

morpho: make, layout in words, kits, motion recipes, check --fix - #22

Merged
srivtx merged 1 commit into
mainfrom
agent-make
Oct 24, 2026
Merged

srivtx merged 1 commit into
mainfrom
agent-make

Conversation

@srivtx

@srivtx srivtx commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Step 1 of the next morpho round: an AI can now make a good design in about 3 calls and 1–2 images, where it used to take about 12 calls and 3–4 images.

What's new

  • morpho make spec.json [-o f.morpho]: a whole design from one JSON spec (canvas, background, kit, style, clock, layers bottom first: text, shapes, lines, paths, groups, modifiers, settings, layout, motion). One call builds it, resolves its layout against the engine's build boxes, applies the mechanical fixes (--no-fix skips them), runs check and draws one PNG: the design at rest, or rest plus three moments when it moves. Re-running on an edited spec rebuilds everything. No YAML, because there's no parser among the dependencies.

  • Layout in words (place.ts), measure then place:

    • fitWidth / fitHeight as % of the canvas;
    • place at top, centre, bottom, top third, bottom third, left, right or a corner, with margin in px or %;
    • stack / row with gap, align and a spot for the whole block;
    • centre by ink, contain, offset.
      These work in specs, on add (--fit-width 80 --place "top third") and on set ('Title.place=top third', --stack A,B --gap 12). align now runs on the same code and can move groups.
  • 8 style kits (kits.ts): chrome-night, neon-club, riso-zine, brutal-pop, puff-sky, editorial, holo-y2k, arcade. Each has a background, a palette, a font pairing and a look for headline, accent and body. They're listed in catalog (catalog kits, catalog riso-zine) and applied with --kit on new / make or in the spec; add picks up a design's kit. A layer's color (hex or a palette name) tints its look's main colour (fill, neon glow or ink) instead of throwing the look away.

  • Motion recipes (moves.ts): cascade, pop, type-on, slide-in, drop, drift and breathe, or --enter rise --stagger 0.15 --feel Snappy, --loop float --spread 0.25 over several layers at once, through morpho motion or in the spec. On a looping clock, everything that enters also leaves before the clock ends, so loops join. This stays within today's motion model: state/motion.ts, tracks.ts and the Timeline are only imported, not edited.

  • check --fix (fix.ts) applies the mechanical fixes:

    • text cut off: shrunk and moved inside the margins;
    • nearly centred: centred by ink;
    • an entrance replaying at the loop seam: a way out added before the end, and the entrance brought forward if it couldn't otherwise hold still;
    • a move the clock cuts off: started earlier, then its stagger tightened, then made quicker.

    The rest comes back as ready-to-run commands (align … --edge right, set … contain=true, a fill for low contrast, arrange … top). Plain check marks fixable findings [--fix] and lists the same commands.

  • set --check prints only the findings that appeared (+), went away (−) or changed (~). Each version's findings are kept by file content in test-results/morpho/.checks/, so it only checks the new version (0.6–1.1 s).

  • --style poster|logo|abstract, stored in the project as project.agent.style. With abstract, rules of taste (near-misses, centring, clear lead, crowding, hue count) become notes; mistakes stay warnings.

  • Next-step hints: every command ends with next: ….

  • Two check fixes found while dogfooding:

    • Text contrast is now measured on the best-separated quarter of its pixels. Outlined, hard-shadowed or extruded type (brutal-pop, arcade) no longer reads as low contrast.
    • A pop now needs small steps on both sides. The first frame of a fast move from rest (the pop recipe) was flagged before.
  • Docs:

    • docs/AGENT-TOOLS.md is rewritten around make → check (--fix) → vary → video, with the spec format, layout words, kits and recipes.
    • New skill: .claude/skills/morpho-design/SKILL.md. The local .git/info/exclude ignores /.claude/, so this one file was force-added.
    • The design section of CLAUDE.md is now a pointer.

The spec format suits explore and logo rounds: specs are plain data, fromSpec is pure, and kits and recipes are named, so variations can be generated as specs.

Dogfood: calls and images

Old "Night Drive" from-scratch flow in the docs: about 12 calls (new, 4× add, modifier, set, check, set, align, check, video) and 3–4 images.

New, with make (calls are morpho commands; writing the spec file is one more tool call each time):

Poster Calls Images looked at
Last Light (neon-club, 4 layers, stack, cascade) 3: make → make → video, plus one optional catalog ring lookup 2
Glasshouse (riso-zine, 4 layers, stack, pop) 3: make → make → video 2 (the second wasn't needed: the text said 0 warnings)
  • Last Light: the first make had no problems and no warnings. The picture showed my color had replaced the neon look with a flat disc. I made color tint the kit's look instead; with that change, the first spec gives a neon ring. The second make only thinned the ring, a matter of taste.
  • Glasshouse: the first make left three near-miss edges and a busy palette, each with a ready command. I edited the spec instead and the second make came back with 0 warnings.

With serve running, make takes 0.8–1.2 s (3.6 s when the machine was under heavy load).

Tests

  • npx vitest run: 149 passed. New ui/src/agent/make.test.ts covers layout resolution (spots, fit, place, stack and row, groups, contain, align, layout assignments), kits (everything they name exists, role looks, palette colours, tinting, catalog), spec building and spec errors, motion recipes (stagger, exits inside the clock, letters, loops out of step), --fix (retime, the loop seam after other fixes, the plan and its commands, abstract style, the new pop rule) and the findings diff.
  • npm run typecheck: passes.
  • npm run build && npm run test:e2e:
    • The build passed.
    • In the first e2e run, the agent section passed, including three new checks: make from a spec, the title fitted to 70% on the top-third line, and --fix mending cut-off text and the loop seam.
    • That run had one failure in an existing check: my new make step replaced the design before describe() ran at the end. That's fixed (describe now runs first), but not yet confirmed by a full rerun.
    • Reruns time out on the first screenshot, before any agent code runs. The machine's disk is 99–100% full and the load average is 35–45 from other work.
  • cargo test couldn't build: "No space left on device". This PR changes no Rust.

🤖 Generated with Claude Code

A whole design from one spec file in one call: `morpho make spec.json`
builds it (canvas, kit, layers, groups, modifiers, motion), resolves its
layout against the engine's real build boxes, applies the mechanical
fixes, checks it and draws one PNG.

- Layout in words (place.ts): fitWidth/fitHeight as % of the canvas,
  place at top/centre/bottom/thirds/corners with margins, stack and row
  with a gap and alignment, centre by ink, contain. In specs, as add
  options and as set assignments (Title.place=top third, --stack A,B).
  align now uses the same code and moves groups too.
- Style kits (kits.ts): 8 kits of background, palette, fonts and a look
  per role, from bundled fonts and presets; in catalog; --kit on new and
  make. A layer's color tints its look's main colour (fill, glow, ink).
- Motion recipes (moves.ts): cascade, pop, type-on, slide-in, drop,
  drift, breathe, or enter/stagger/feel/loop by hand over several layers
  (`morpho motion`); on a looping clock, exits are timed to end before it.
- check --fix (fix.ts): cut-off text, near-centring, loop seams and
  moves the clock cuts off; everything else as ready-to-run commands.
  set --check prints only the findings that appeared, went or changed.
- --style poster|logo|abstract, kept in the project: abstract turns
  rules of taste into notes.
- Every command ends with the likely next command.
- check: text contrast is measured on the best-separated quarter of the
  pixels (outlines and hard shadows count), and a pop needs small steps
  on both sides (a move from rest isn't one).
- Docs rewritten around make → check (--fix) → vary → video; a
  morpho-design skill; CLAUDE.md points to them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
morphotype Ready Ready Preview Oct 24, 2026 12:22am UTC

@srivtx
srivtx merged commit 7e7b662 into main Oct 24, 2026
7 checks passed
@srivtx srivtx mentioned this pull request Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant