cadsketch · codex plugin

CADSketch in Codex: a sketch the agent edits with you

2026-10-01 · punkfab/cadsketch · plugin 0.3.1 · cadsketch.ai

CADSketch is our sketch-first CAD editor: draw a rough shape and it snaps to clean, constrained, dimensioned geometry, then extrudes to a part. It ships on the App Store and runs in the browser. As of today it is also a plugin for Codex and the ChatGPT desktop app.

The plugin does three things. It puts the editor in the app's sidebar. It opens .cadsketch and .dxf files from your workspace in that editor. And it gives the agent 18 tools that act on the sketch you have open, so "make it 95 mm wide and add a hole in each corner" changes the part in front of you, one undo step at a time.

The CADSketch editor with bracket.cadsketch open. On the left a 3D wireframe of an L-shaped bracket with three holes. On the right the same part as a 2D sketch with its dimensions, 60, 45, 30 and 15 mm, and small H and V markers on the edges showing horizontal and vertical constraints.

Install

You need Node.js 18 or later and a recent Codex. Node is there because the app runs the plugin's server on your own machine. We tested with Codex 0.157 and the ChatGPT desktop app, which is available for macOS and Windows and in preview for Linux.

codex plugin marketplace add punkfab/cadsketch
codex plugin add cadsketch@cadsketch

Restart the desktop app. CADSketch appears in the sidebar. There is nothing to build and no account to create: the plugin's server is one bundled file that the app starts on your machine.

Three things to try:

What you get

WhereWhat
Sidebarthe editor as a full tab, next to a conversation
Threadthe editor as a panel beside the conversation you are in
Files.cadsketch and .dxf open in the editor instead of as text
Agent18 tools on the open sketch, a drawing tool, a headless checker, and a skill that teaches the workflow

The file

A .cadsketch file is the part as plain JSON. Millimetres, X right, Y up. The outline closes itself, and a hole is a centre and a radius.

{
  "cadsketch": 1,
  "units": "mm",
  "parts": [
    { "name": "bracket", "depth": 5,
      "profile": [[0,0],[60,0],[60,30],[45,30],[45,15],[0,15]],
      "holes": [[10,7.5,2.25],[35,7.5,2.25],[52.5,22,2.25]] }
  ]
}

The agent writes this with its ordinary file tools. While the file is open in the editor, the two stay in step:

The agent works in the sketch you have open

The first version could only draw: the agent described a part and the editor showed it. Asking for a small change meant redrawing everything, which threw away any dimensions and constraints you had set. So the editor now publishes its own tools while it is open.

Take a plate and the request "make it 95 mm wide and add an M4 hole 8 mm in from each corner." The two pictures below come from our test host making the calls that request turns into, against the real editor.

The editor with plate.cadsketch open: a plain 80 by 40 mm rectangle, 4 mm thick, with no holes. The sketch shows the dimensions 80 and 40 and H and V constraint markers on its edges.

That is six calls: get_sketch to read the part and find which edge is the 80 mm one, set_dimension to drive that edge to 95, and add_hole four times.

The same plate after the six tool calls. It is now 95 mm wide, shown as a bold 95.0 on the bottom edge to mark a driving dimension, and has a hole near each corner. The title bar reads plate.cadsketch, saved.

The bold 95.0 is a driving dimension. It keeps holding through later edits, by you or by the agent. The bar at the top says saved: the change is already in the file.

ToTools
readget_sketch, screenshot
change geometryadd_hole, move_hole, remove_hole, move_vertex, set_depth
state intentset_dimension, add_constraint, remove_constraint
manage partsadd_part, select_part, delete_part, replace_parts
step backundo, redo, fit_view
make a fileexport_stl

Each call runs through the same code a tap or a drag does. That makes it one step on the editor's undo stack, and you can undo the agent's edit with the same button you would use for your own. screenshot returns a picture of the editor, for when you say "this corner" and the agent needs to see which one. A wrong index comes back as an instruction, such as vertex must be an index from 0 to 3, so the agent can correct itself.

How it is built

The plugin is an MCP server plus a page the app renders. The page is small. It frames the same web build that runs at cadsketch.ai/app and relays messages to it. There is no second editor, and the phone and browser versions are untouched: the bridge inside the app switches on only when it is opened as a plugin.

The sidebar entry, the thread panel and the file viewer are OpenAI's plugin extensions, three entries of metadata on the server's tools. The editing tools use the open MCP Apps standard, in which a mounted app publishes tools of its own. No AI key ships with the plugin and the server calls no model. The app's own model does the thinking.

What the checks caught

The desktop app's interface does not run in CI, so we wrote a stand-in host that speaks the same protocol and drove the real editor with it. It runs 30 checks. Four problems turned up that reading the code had not:

Limits

What's not new

OpenAI's sample plugin, Bits & Bolts, opens STL and STEP files in a 3D viewer and was our reference for how a plugin is put together. Jake Fitzgerald showed a CAD viewer running as a Codex extension the day extensions shipped, on top of his text-to-cad skills, which generate CAD by writing and running scripts. What we are adding is an editor in place of a viewer: a sketch with constraints and dimensions that you and the agent both change, with the agent's edits landing as ordinary undo steps.

Who did what

We decided what the plugin should do and tried it in the app. Claude read the extension specification, wrote the server, the bridge and the tests, ran them, and found and fixed the four problems above.

The source is public at punkfab/cadsketch, and mcp/README.md covers the tools and the file format in full. Have a part that should be editable by you and your agent at the same time? Start a project →