figwright AGENTS.md

Repository instructions for Figwright, an open-source tool that connects an AI coding agent to Figma through a local WebSocket connection so it can read designs and write changes back to the canvas.

In plain words
What is it for?
Use them when developing or debugging Figma-to-code grounding, design reads and writes, the local relay, or the MCP server and plugin packages.
Why use it?
They explain the two-part architecture—the MCP server and the Figma plugin—so contributors know where tools, relay logic, and Figma API work belong.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/awdr74100/figwright/agents-md
Clone the repo
git clone --depth 1 https://github.com/awdr74100/figwright

Made for: Codex, OpenCode.

Per session 5,203 This file is loaded in full into every session.
When invoked 5,203 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.05203 $0.05203
Opus 5 $0.02601 $0.02601
Sonnet 5 $0.01041 $0.01041
Haiku 4.5 $0.00520 $0.00520

Measured 2d ago against content hash f89cf1267b0e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

figwright AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

Figwright is an open-source, bidirectional Figma agent for MCP clients (Claude Code and others). It connects an MCP server to a Figma plugin over a local WebSocket relay, letting an AI agent both read designs with high-fidelity grounding and write back to the canvas — no Figma paid tier required.

This file is the canonical guide for AI agents and contributors working in this repo. (CLAUDE.md points here.)

Architecture

Two halves talk over a local WebSocket relay:

  • MCP server (packages/mcp, published as @figwright/mcp) — the Node process an MCP client launches. It exposes 112 tools — reads, writes, and higher-level grounding tools that join Figma data with the user's codebase (component / token / icon maps) — plus a codegen prompt. It owns the relay, leader/follower election (multiple MCP servers can share one plugin; newest build wins — a leader on an older build abdicates to a newer one at the next idle moment), and request idempotency.
  • Figma plugin (packages/plugin) — a Vue 3 + Vite UI plus a sandbox that runs inside Figma and performs the actual Figma API calls. It connects out to the server's WebSocket.
  • Shared (packages/shared) — types, Zod schemas, the msgpack wire codec, and the plugin↔server protocol. It is bundled into the server at build time (not published on its own).

Design stance: provider-first. Rather than a fixed compiler pipeline, the tools surface faithful, de-duplicated design context and let the LLM generate code that matches the user's actual stack (detected framework / styling system). The figma-codegen skill and the MCP figma_to_code prompt encode this approach.

Layout

packages/
  shared/   # types, Zod schemas, msgpack codec, plugin↔server protocol (bundled into mcp)
  mcp/      # the MCP server — @figwright/mcp (Node, ESM): relay, election, tools, joins
  plugin/   # Figma plugin — Vue 3 + Vite + Tailwind v4 (UI) + sandbox (Figma API)
skills/     # agent skills that orchestrate the tools (figma-codegen, figma-build) — installable via `npx skills add`
test/       # cross-package integration tests (e.g. server tool registry ↔ plugin handlers)

Read the full file on GitHub · 100 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 100 lines · 5,203 tokens per session scan A f89cf1267b0e

Subscribe to this mod's changes

figwright AGENTS.md is an instructions file published in the GitHub repository awdr74100/figwright (633 stars, last pushed 3d ago), licensed MIT. It adds 5,203 tokens to every session, about $0.0260 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.