canvas-to-code-extractor

canvas-to-code-extractor is an agent for coding agents from opensesh/canvas-to-code. It costs 67 tokens per session (1,492 once invoked), scanned A, original, MIT.

A deterministic extractor that turns exported design HTML into a flat JSX or HTML reference file, or uses already extracted JSX from an iteration folder. JSX is a JavaScript-based format commonly used to describe web interfaces.

In plain words
What is it for?
Preparing Claude Design, Figma, V0, Lovable, Webflow, or generic HTML exports for conversion into code, while skipping repeated parsing when clean JSX already exists.
Why use it?
It separates the structure of a design from styling decisions, giving later tools a consistent representation to follow.

Agent

Part of the canvas-to-code plugin — 4 commands, 7 agents shipped together

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 agents/opensesh/canvas-to-code/canvas-to-code-extractor
Clone the repo
git clone --depth 1 https://github.com/opensesh/canvas-to-code

Or install canvas-to-code, the plugin that ships this one along with the rest of its 4 commands, 7 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for canvas-to-code-extractor

README.md
[![agentmods](https://agentmods.dev/badge/agents/opensesh/canvas-to-code/canvas-to-code-extractor.svg)](https://agentmods.dev/agents/opensesh/canvas-to-code/canvas-to-code-extractor)
Your own site
<a href="https://agentmods.dev/agents/opensesh/canvas-to-code/canvas-to-code-extractor"><img src="https://agentmods.dev/badge/agents/opensesh/canvas-to-code/canvas-to-code-extractor.svg" alt="Measured on agentmods" height="20"></a>
Per session 67 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,492 The whole file, excluding the scripts and references it only reads on demand.
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.00067 $0.01492
Opus 5 $0.00034 $0.00746
Sonnet 5 $0.00013 $0.00298
Haiku 4.5 $0.00007 $0.00149

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

Security

Grade A, and why

canvas-to-code-extractor 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 4d 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/canvas-to-code-extractor.md · 140 lines

How it starts

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

Canvas-to-Code Extractor

You decode design exports into a flat, structured reference the mapper can walk. Deterministic — same input, same output. No interpretation, no styling decisions; just structural extraction.

Inputs

  • .canvas-to-code/state/<feature>/status.json — the PM has written sourceShape (iter or flat) here. Branch on it first.
  • For sourceShape === "iter": .canvas-to-code/state/<feature>/source-snapshot/jsx/*.tsx — pre-extracted JSX snapshotted at Gate 1.
  • For sourceShape === "flat": .claude-design/<feature>/review.html — the export.
  • .claude-design/<feature>/source-meta.yaml — declared source (overrides auto-detection if present).

Output

/tmp/<feature>-template.tsx — a flat JSX file containing the structural intent of the design.

Gate 5a — iter short-circuit (sourceShape === "iter")

Skip all HTML parsing. The iter folder's producer (e.g. the paper-design skill) already emitted clean structural JSX at Gate 1. Steps:

  1. Read .canvas-to-code/state/<feature>/status.json → confirm sourceShape === "iter".
  2. Glob .canvas-to-code/state/<feature>/source-snapshot/jsx/*.tsx — expect exactly one file (the iter's jsxPath).
  3. Copy that file to /tmp/<feature>-template.tsx.
  4. Prepend a single-line provenance comment:
    // canvas-to-code-extractor — <feature> · source: <exportType> · shape: iter · jsx: source-snapshot/jsx/<basename>
    
  5. Log: Iter source — skipped HTML extraction, using pre-extracted JSX.

Failure modes: zero matching .tsx files under source-snapshot/jsx/ → fail with a pointer to the Gate 1 snapshot step (something went wrong upstream; do not regenerate).

When sourceShape === "flat", run the source-detection + per-source decoder flow below.

// canvas-to-code-extractor — <feature> · source: claude-design
// Generated: <ISO>

export const Template = () => (
  <div className="…">
    <Header />
    <Tabs>…</Tabs>
    <OverviewBlock>…</OverviewBlock>
    <PillarGrid>{/* 8 cards */}</PillarGrid>
  </div>
);

Read the full file on GitHub · 140 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. 4d ago First seen · 140 lines · 67 tokens per session scan A 5bfc62156996

Subscribe to this mod's changes

canvas-to-code-extractor is an agent published in the GitHub repository opensesh/canvas-to-code (6 stars, last pushed 2mo ago), licensed MIT. It adds 67 tokens to every session and 1,492 once invoked, about $0.0003 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-31.

Related

Other agents, from other repositories