Case study
Giving coding agents semantic design context
Let coding agents understand a design's hierarchy, content, and visual language instead of inferring everything from pixels.
My contribution
My contributions focused on semantic design export and the Visily MCP server; I also helped start client-plugin distribution before teammates carried it forward.
Reasoning
A semantic representation became the bridge between a canvas document and an agent; MCP exposed that context through concise tools with OAuth-based access and explicit failures.
Outcome
Coding agents can discover Visily designs and consume semantic context and themes while generating implementation code.
Lessons I carry forward
- Design context for the consumer
- Keep agent tools concise
- Security and errors are part of the interface
The problem
A screenshot shows an agent how a design looks but not what it is. The agent must guess hierarchy, copy, spacing, and reusable patterns. Visily’s canvas document contains that meaning, but its internal representation is not an appropriate external contract.
Developers working inside AI coding tools needed a way to find the relevant design and use it as a source of truth without manually re-describing every screen. The solution had to work for multiple clients, protect workspace access, fit within a limited model context window, and provide output useful for implementation rather than only visual reference.
Why it was difficult
Canvas geometry and browser layout follow different rules. A useful export must preserve visual intent while producing structure familiar to coding tools. The agent interface also has finite context, unknown clients, authentication requirements, and no human available to reinterpret ambiguous errors.
The system crossed several boundaries at once:
- Visily elements needed a representation outside the canvas runtime.
- Server-side requests needed consistent design export without duplicating editor behavior.
- Long-lived protocol sessions needed to survive horizontal service scaling.
- Unknown MCP clients needed registration, consent, and revocation.
- Tool responses needed enough semantic detail without overwhelming the agent.
Each layer could be correct in isolation and still fail at the seam. A valid semantic export could still be poor context. A valid OAuth token could belong to a client the user could not inspect. A streaming session could work locally and fail when later traffic reached another instance.
My contribution within the team
I worked with teammates to build Visily’s semantic design exporter and contributed the element identity needed for downstream editing. I later contributed across the MCP server, connected structured design output to its tool surface, and helped start client distribution before teammates carried that part forward.
My main exporter contributions were its early architecture, much of the element vocabulary, context handling, and fidelity work. A close collaborator contributed substantially to the exporter, another engineer built much of the supporting infrastructure, and other teammates shaped the product behavior around it.
For MCP, I contributed substantially to protocol endpoints, design-context formats, OAuth dynamic client registration, consent and client management, authorization behavior, stream coordination, rate limiting, and the first-version test cases. I initialized client-plugin distribution and wrote setup material for several clients before teammates expanded and prepared the public release.
The key decision
We gave agents a representation designed around their needs:
Visily design → semantic design context → MCP tools → coding agent
Structured design context instead of visual guessing
The exporter produced a semantic representation containing hierarchy, text, fonts, ordering, geometry, and relevant styles. It balanced visual fidelity with usefulness to coding tools without exposing Visily’s private document model.
Elements also carried stable identity where modification needed to address a selected target. This made structured export useful not only for code generation but for reading and modifying an existing design.
Focused retrieval instead of a document dump
The tool flow favored minimal discovery followed by one focused design-context request. Theme data and screenshots remained optional supporting evidence. This treated the model’s context as a budget: more data is not automatically more understanding.
OAuth instead of distributed API keys
Dynamic client registration allowed compatible MCP clients to establish identity without manual provisioning for every tool. Users received a consent surface and a client manager where connections could be reviewed and revoked. Explicit authorization failures told agents when access was not available and retrying would not change it.
Test cases before release
Expected MCP scenarios were documented and tested before the feature shipped. Defining the expected behavior first, rather than describing it afterwards, was a deliberate change in how I approached this boundary.
The tools favor targeted discovery and context retrieval over dumping an entire document. OAuth-based access avoids distributing long-lived API keys, while explicit authorization failures tell an agent when retrying will not help.
Trade-offs
A pixel-oriented representation may resemble a canvas but communicate little intent; a highly abstract representation can lose fidelity. The exporter balances those goals and preserves enough identity for selected elements to be addressed. Tool responses make a similar trade-off between completeness and context-window cost.
Security and openness also pull in different directions. Supporting many clients is valuable, but static credentials or implicit trust would make access difficult to understand and revoke. OAuth adds flow complexity in exchange for visible consent and lifecycle management.
Streaming introduced a deployment trade-off. Protocol sessions maintain state over time, while horizontally scaled services prefer stateless routing. Those two assumptions do not reconcile themselves, so session state has to be coordinated deliberately for a deployment to match what the protocol expects.
There were also clear collaboration boundaries in the output itself. My exporter work supported responsive code generation, while other teammates worked on generation guidance. I helped start distribution, while others broadened platform coverage and prepared the public repository. The final capability depended on all of those contributions.
Outcome
Coding agents can find a design and retrieve semantic design context and themes while generating code. Only publicly documented MCP behavior is described here; private implementation details and unreleased capabilities are excluded.
The result links design and implementation without requiring a developer to leave the coding environment or reduce the design to a screenshot. Agents can use semantic structure, visual evidence, and design-system context together, choosing only the information relevant to the task.
The exporter also became shared infrastructure for AI modification and code-oriented workflows. One representation supported multiple consumers because it described the design in a language outside systems could use.
No adoption or quality metric is included. This case study describes only the publicly documented behavior of the released capability.
What changed in my approach
I learned to design an API for a non-human consumer: schemas must guide action, error semantics must prevent useless retries, and security belongs in the first version. Writing test cases before release marked a shift from proving a feature works to defining how it should behave.
I would add context-size telemetry, protocol-level traces, and task-oriented quality evaluation from the first release. Endpoint correctness cannot show whether the retrieved context actually helps an agent produce a better implementation.
I would also formalize consistency fixtures between semantic export and editable import. Comparing both directions can catch mapping disagreements, while separate semantic and visual tests can prevent round-trip fidelity from becoming the only definition of useful output.
The main lesson is that agent interfaces are still software interfaces. The consumer may be probabilistic, but identity, consent, schemas, state, errors, observability, and tests require deliberate deterministic engineering.