Skip to content

perf: let agents finish Figma tasks in fewer calls - #49

Merged
silships merged 1 commit into
mainfrom
perf/agent-efficiency
Sep 25, 2026
Merged

silships merged 1 commit into
mainfrom
perf/agent-efficiency

Conversation

@silships

@silships silships commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

What changes

Agents that drive figma-cli now finish a Figma task in fewer calls. Every call is a full agent turn so fewer calls means less time and fewer tokens for the user.

New in render and render-batch

  • --page "Name" renders on that page and creates it when missing
  • the output lists the structure that was built (sizes and layout and padding and bound variables and which component each instance uses) so the agent does not read it back
  • <Instance component="Button" variant="size=large" text="Save" /> finds a component on any page and picks the variant and relabels it
  • effectStyle on frames and textStyle on text
  • pt pr pb pl now work on the outermost frame too (they were ignored before)
  • render-batch --variant-set Button turns frames named prop=value, prop=value into one component set

New in eval

  • helpers $page $var $bind $style $component $instance $fontSafe $describe
  • output to a pipe is compact JSON and capped at 20,000 characters. A terminal still gets indented JSON

Missing fonts
Text in a component whose font is not installed could not be relabelled and Figma even refused to move the instance into a frame. Those fonts are now swapped to Inter automatically and reported as a note: line.

Agent rules
The rules init-agent writes live in src/lib/agent-rules.js inside a hashed marker block. connect refreshes an outdated copy in the project. Text the user wrote around the block stays untouched.

Fixes

  • instantiate bounds every lookup to 5 seconds so a library key that was never published no longer hangs the CLI
  • the roundtrip test builds on its own page and removes it so it no longer leaves fixtures in the connected file

Behaviour change

One visible behaviour change: piped eval output has no indentation anymore. JSON.parse reads it the same.

🤖 Generated with Claude Code

- eval helpers $page $var $bind $style $component $instance $fontSafe $describe shared with render
- fonts that are not installed are swapped to Inter so instances can be relabelled and moved
- render and render-batch take --page and print the structure they built
- <Instance component variant text> finds components on any page
- effectStyle and textStyle in JSX and per-side padding on root frames
- render-batch --variant-set builds a component set in one call
- piped eval output is compact JSON capped at 20k characters
- agent rules move to lib/agent-rules.js with a hashed marker and connect refreshes outdated copies
- instantiate bounds every lookup so an unpublished library key no longer hangs the CLI
- the roundtrip test builds on its own page and no longer leaves fixtures behind
- tests/live/regression.mjs covers the commands users already rely on

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@silships
silships merged commit 5a6349e into main Sep 25, 2026
3 checks passed
@silships
silships deleted the perf/agent-efficiency branch September 25, 2026 07:20
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