Skip to content

morpho: design from the command line, for AI agents - #20

Merged
srivtx merged 2 commits into
mainfrom
ai-tools
Oct 23, 2026
Merged

srivtx merged 2 commits into
mainfrom
ai-tools

Conversation

@srivtx

@srivtx srivtx commented Oct 23, 2026

Copy link
Copy Markdown
Owner

Adds npm run morpho, a command-line way to use the app that answers in short text or a single PNG. An agent (or a script) can now learn what exists, read a design, edit it and judge it without reading source files or taking a pile of screenshots.

Commands

Command Gives back
catalog [query] A one-screen index. Any section or name (chrome, glitch, star, motion, keyframes, layers…) gives every setting with its range, default and label. It's generated from the Inspector's own registries, so it can't drift from the app.
describe <scene> The design as a text tree, top layer first, showing only settings that differ from the defaults. The 14-layer Y2K scene fits on one screen.
scene / set scene saves a template as a .morpho file. set edits it with Layer.setting=value: bare keys find the material param, shape field or modifier, values are range-checked, and errors list the names that would work.
render <scene> A frame, or one captioned filmstrip with --at 0,1,2 / --frames 8.
vary <scene> A grid of variations in one image (--vary a=1,2,3, multiplied; --variant 'a=1; b=2').
check <scene> Problems in words; see below.
compare <scene> <image> Colour, pixel and layout scores against a reference, plus one reference | design | difference image.
serve Keeps a browser warm, so drawing commands take under a second.

What check reports:

  • engine errors
  • layers entirely or partly off the canvas
  • layers that can't be seen (each layer is hidden in turn and the image compared, scaled to the layer's size)
  • text with low contrast against what's actually behind it
  • out-of-range values and dead keyframes
  • blank designs
  • jumps in the motion, and loop seams that jump

Speed

Drawing runs headless on the GPU, falling back to SwiftShader, or always with --cpu. The live preview is held still while a job runs. Times with serve up, on a 14-layer animated poster:

Command Time
render 0.2 s
six-frame filmstrip 0.3 s
six-cell vary 0.8 s
full check 1.9 s
cold check (includes starting Vite and the browser) about 4 s

catalog, describe and set run in Node through Vite's SSR loader in about 0.3 s, with no browser.

Files

Path What's in it
ui/src/agent/ catalog, describe, edit and check (pure, unit-tested); page.ts for the in-app side, on await window.morphotype.agent() in its own chunk; node.ts for the no-browser commands
scripts/morpho.mjs the CLI and the serve daemon
docs/AGENT-TOOLS.md the guide
CLAUDE.md points future agent sessions at morpho first

Tests

  • 20 new unit tests. One fails if the layer-format notes miss a field the layer factories create; it already caught group.open.
  • New end-to-end checks drive the agent handle in the production build.
  • npx tsc --noEmit -p ui, npx vitest run (114) and npm run build && npm run test:e2e (109 checks) pass locally. I ran the e2e test with CHROMIUM_PATH set to Chrome, because Playwright's bundled browser isn't installed on this machine.
  • I didn't run cargo test; no Rust changed.

🤖 Generated with Claude Code

srivtx and others added 2 commits October 24, 2026 01:19
Designing in the app as an agent meant reading effect and template
sources to learn what exists, and judging work through screenshot after
screenshot. morpho answers in short text or one PNG instead:

- catalog: every material, modifier, shape, preset, recipe, motion and
  keyframe option with ranges and defaults, generated from the
  Inspector's own registries
- describe: a design as a text tree, settings changed from defaults only
- scene / set: templates as .morpho files, edited by Layer.setting=value
  with range checks and errors that list what would work
- render: a frame, or a captioned filmstrip with --at / --frames
- vary: a grid of variations in one image
- check: problems in words (engine errors, off canvas, unseen layers,
  low-contrast text, blank frames, motion jumps, loop seams)
- compare: scores and a difference image against a reference
- serve: a warm browser, so drawing commands take under a second

Catalog, describe and set run in Node through Vite's SSR loader; drawing
runs the app headless on the GPU (SwiftShader with --cpu or as a
fallback), with the live preview held still while a job runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/AGENT-TOOLS.md covers every command, the edit syntax, what check
looks for and the timings. CLAUDE.md points agents at morpho before the
sources or screenshots. The end-to-end test drives the agent handle in
the production build: edit, still, filmstrip, grid and check.

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

vercel Bot commented Oct 23, 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 23, 2026 7:49pm UTC

@srivtx
srivtx merged commit 5482a34 into main Oct 23, 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