Skip to content
Back to skills

Cadcraft

ASecurity

CADCraft is an open-source, clean-room AutoCAD-style 2D CAD app (pure Rust, egui) for macOS, Windows, Linux, FreeBSD and the browser: DXF/DWG read and write, clipped block and xref references, attached raster images, SHX shape fonts, editable MTEXT, PDF import, and agent control over MCP, a JSON control channel, a browser page API and a headless CLI. Trigger this skill whenever the user mentions CADCraft (or "the CAD app"), asks what it can or cannot do, which file formats it opens or writes,...

  • 122 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 16, 2026
ai-agentsrustgoshellreactangularnodeexpressawstestinggit

Works with

  • cursor
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add midasmatterhorn/artcraft-skills --skill cadcraft --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cadcraft?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cadcraft
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/midasmatterhorn-cadcraft/badge)](https://www.skillsdirectory.com/skills/midasmatterhorn-cadcraft)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cadcraft
description: >-
  CADCraft is an open-source, clean-room AutoCAD-style 2D CAD app (pure Rust, egui) for
  macOS, Windows, Linux, FreeBSD and the browser: DXF/DWG read and write, clipped block and xref
  references, attached raster images, SHX shape fonts, editable MTEXT, PDF import, and agent control
  over MCP, a JSON control channel, a browser page API and a headless CLI. Trigger this skill
  whenever the user mentions CADCraft (or "the CAD app"), asks what it can or cannot do, which file
  formats it opens or writes, its shortcuts or commands, wants to draw, edit, dimension, hatch,
  block, xref, clip, attach an image, make a 2D UCS, import a PDF, plot or export a drawing,
  convert/inspect/verify/round-trip a DXF or DWG, script or automate drafting (AutoLISP, .scr,
  .pgp, MCP, control channel, cadcraft-cli), or troubleshoot it — and when they describe the job
  without naming the app ("draw a floor plan", "edit this DXF", "convert this DWG to PDF/PNG").
---

# CADCraft

**Audit basis.** Refreshed 2026-12-03 against tag **v0.21.0**, commit **`8c0f7658a3cadea9c9b303bd1cc80b5108328bc6`** — `git rev-parse HEAD` in the pinned checkout confirms it, and the installed 0.21.0 bundle (id `ai.storyteller.cadcraft`) prints `cadcraft 0.21.0 (8c0f7658a3cadea9c9b303bd1cc80b5108328bc6)`. The previous release this skill described was v0.20.1 (`7526dc62c14e71b3c8d46e73bbf1fa29ef506af1`).

**v0.20.1 → v0.21.0 delta** (measured with `git diff v0.20.1..HEAD`: **799 files, +99,422/−14,414**; 216 added, 566 modified, 17 deleted). **The engine registry grew from 457 to 483 commands** (+26 ids, none removed): `ucs`, `ucs.world`, `ucs.origin`, `ucs.3point`, `ucs.view`, `ucs.z`, `ucsicon`, `qleader`, `extrim`, `pdfimport`, `pastetable`, `properties.describe`, `hatchgenerateboundary`, `layout.newarea`, `blocklibrary`, `blocklibraries`, `blocklibimport`, `blockspalette`, `dimstyle.overrides`, `dimstyle.saveas`, `dimoverride.clear`, `-dimstyle`, `-pan`, `menubar`, `toolbar`, `wblockpick`. `UI_COMMANDS` went **60 → 61** (`ui.toggle.ucsicon.origin`), so the app-level catalog is **544**. **MCP stayed 15 tools / 2 resources** (`find_text` gained `query` as an alias of `contains`) and **control stayed 27 app / 12 headless methods**, but its authentication now caps an unauthenticated request line at 64 KiB and parses `params` only after the token check. **CLI stayed 8 verbs**, but `mcp` gained `--automation-read-root`/`--automation-write-root` (headless only) and `info`/`convert`/`run` now accept a PDF whose first page opens as editable vector content. **Languages 19 → 21** (Polish and Tamil). Hatch patterns (23), object snaps (14), drawing formats read/written (4/6), raster formats (4) and the MCP/control method sets are unchanged. **Crate layout changed:** the in-repo DWG and DXF crates were deleted, and the bridge now comes from `storytold/craft-libs` (`craft-dwg`, `craft-dxf`, plus `craft-svg`, `craft-shx`, `craft-image-codecs`, `craft-mcp`, `craft-jsonrpc`), all pinned at one revision, `8fa4db64a9bb943520259ea95331a303ba788f21`.

**Verify against your installed version** — the ArtCraft Launcher auto-updates, so a newer build may differ; every count quoted here was re-measured at this tag, and code paths that moved were re-cited. The measurement method for each count is in `evidence.md`. There is no `references/` directory: all detail is here with repo-relative evidence paths.

## Overview

CADCraft is an open-source (MIT OR Apache-2.0) 2D CAD and drafting application written in Rust (egui/eframe 0.37, wgpu) for macOS, Windows, Linux, FreeBSD and the web (WebAssembly); source is GitHub `storytold/cadcraft`. It is a clean-room reimplementation of Autodesk AutoCAD targeting AutoCAD 2027, 2D drafting first (`AGENTS.md` clean-room rules, `docs/target-app-parity.md`). Stage: **pre-alpha** — `ROADMAP.md` (revised 2026-11-19/2026-11-25) says five of the six alpha-gate rows fail (startup on older graphics hardware, large/foreign DWGs, layout units, lost clicks, hidden menus/panels); dynamic-block authoring, in-place xref editing and exact ellipse/spline geometry moved to the beta list. The roadmap is direction, not a per-release status, so do not quote its row text as current.

The differentiator: every user-visible action is a command. The engine registry holds **483 commands** at this tag — 465 unique literal `CommandSpec::new("<id>")` ids plus the 18 ids the `gc!`/`dc!` constraint macros expand to, with no duplicate ids (467 `CommandSpec::new(` sites: 465 literal + 2 macro bodies). The desktop app's catalog adds **61** UI-only entries (`crates/ui-egui/src/menus.rs`), so the app-level catalog is 544. Re-derive before quoting: `cadcraft-cli commands | jq length` (the app bundle does not install the CLI).

The repo's generated checklist (`docs/parity-checklist.md`, regenerated 2026-11-27) says **482 registered commands** and menu breadth 306/491 — one command short of this tag's 483, because the file was generated the day before v0.21.0. Treat it as a dated snapshot, not this tag.

## Capabilities (verified)

Everything below is implemented and wired to a command/CLI/MCP/control surface unless marked **partial** or **claimed**; `evidence.md` gives the per-claim tier.

### Drawing, editing and precision

- **Draw:** LINE, PLINE (arcs, widths), CIRCLE (center/radius/diameter, 2P, 3P), ARC, RECTANG (fillet/chamfer), POLYGON, ELLIPSE (+arcs), SPLINE, POINT, XLINE, RAY, DONUT, TEXT, MTEXT, plus MLINE, REGION and HELIX (`crates/engine/src/cmd/draw.rs`, `crates/engine/src/cmd/draw2.rs`).
- **Modify:** ERASE, MOVE, COPY, ROTATE, SCALE, MIRROR, STRETCH, OFFSET, TRIM, EXTEND, FILLET, CHAMFER, BREAK, JOIN, EXPLODE, rectangular/polar ARRAY (associative, ARRAYEDIT, and a live **Array window** that edits the running ARRAYRECT/ARRAYPOLAR counts, spacing, fill, rotation and centre), draw order, OVERKILL, LENGTHEN, ALIGN, REVERSE, FLATTEN, CHSPACE, **EXTRIM** (Extended Trim against a chosen edge and side); NCOPY (Modify ▸ Copy Nested Objects); BREAKLINE, TXT2MTXT, BURST and MOCORO under **Tools ▸ Additional Tools** (the old "Express Tools" label is gone). **BREAK and TRIM keep the object's handle**; **EXPLODE of a reference with different X and Y scales gives ellipses, not circles**; **EXTEND runs a polyline's arc end segment round its circle** (`crates/engine/src/cmd/modify/trim.rs`, `crates/engine/src/cmd/modify/explode.rs`, `crates/engine/src/cmd/modify/extrim.rs`, `crates/engine/src/array_live.rs`, `crates/ui-egui/src/arraydlg.rs`).
- **Precision:** 14 object snaps with deferred tangent/perpendicular (`crates/engine/src/snap.rs` — `ALL` has 14 entries: endpoint, midpoint, center, geometric center, node, quadrant, intersection, extension, insertion, perpendicular, tangent, nearest, apparent intersection, parallel); **Tab cycles every snap candidate within the aperture** (specific snaps nearest first, then deferred, then Nearest); object snap tracking; polar tracking; ortho; grid snap; direct distance entry; `@dx,dy`, `@d<a`, `#x,y`; point modifiers FROM/M2P/TK and point filters (`crates/engine/src/pointmod.rs`); typed snap overrides.
- **UCS (drawing plane only):** `ucs`, `ucs.world`, `ucs.origin`, `ucs.3point`, `ucs.view`, `ucs.z` and `ucsicon` set/restore/save/delete/list named UCSs, keep the current one in the drawing header (`UCSORG`, `UCSXDIR`, `UCSYDIR`, `UCSNAME`) and per layout, and show the icon. A UCS whose XY plane is the world XY plane (any origin, any rotation about Z) is used in full; a tilted UCS is kept and saved but points are read in the World UCS. **This is not 3D** (`crates/engine/src/ucs.rs`, `crates/engine/src/cmd/ucs.rs`).
- **Command line and grips:** prompts with clickable keywords, history (F2), AutoComplete, aliases (`.pgp` + ALIASEDIT/REINIT), transparent commands, `.scr` scripts; **typing on a Greek keyboard layout works** — ΛΙΝΕ is read as LINE and prompt keywords resolve the same way (`crates/engine/src/keyboard.rs`); hot grips cycle Stretch/Move/Rotate/Scale/Mirror. **Aliases survive restarts** on the desktop and web (the headless CLI has no profile), and a `.pgp` load replaces the user alias set (`crates/engine/src/cmd/file/pgp.rs`). **Tools ▸ Customize ▸ Keyboard Shortcuts...** (`ui.shortcuts`) lets any command take a shortcut; the user's choice wins over the built-in one, a command that loses a key is named, and the clipboard keys, Delete and Cmd+Q are fixed (`crates/ui-egui/src/keys.rs`).
- **Layers and properties:** Layers palette and Layer Properties Manager, layer tools, saved layer states, Properties palette, linetypes, lineweights, ACI/true colour, transparency, OPTIONS dialog with persisted profiles and **File ▸ Default Save Format** (`saveVersion`, 2000–2018, default 2018). `properties.describe` returns the palette's rows for a selection (key, value or `varies`, display text, editable, note, options) and `properties.set` changes them; a dimension style variable set there becomes a per-dimension override. `properties.set` leaves objects on locked layers alone and says how many (`crates/engine/src/properties.rs`, `crates/engine/src/cmd/props.rs`, `crates/engine/src/cmd/props/set.rs`).
- **Annotation:** the DIM* family (linear, aligned, angular, arc, diameter, radius, ordinate, jogged, continue, baseline, QDIM, DIMEDIT/DIMTEDIT, DIMBREAK, DIMINSPECT, DIMSTYLE, DIMREASSOCIATE, DIMTFILL/DIMTFILLCLR) plus the **Dimension Style Manager** (preview, Set Current, New, Modify, Override, Compare, Rename, Delete across AutoCAD's seven tabs) and the `-DIMSTYLE` command-line form (`crates/ui-egui/src/managers/dimstyle.rs`, `crates/engine/src/cmd/dimstyle_cli.rs`, `crates/engine/src/cmd/dimstyles.rs`); **QLEADER**; MLEADER family; **PASTETABLE** (tab-separated text to a table); TABLE with formulas, cell styles, TABLEDIT/TABLEEXPORT, table breaking and CSV data links; TOLERANCE; annotative scaling; on-canvas MTEXT editor; Edit Text window; QuickCalc; COMPARE/COMPAREEXPORT. **A dimension kept as read draws from its `*D` block, and a save keeps that block.** **TEXTEDIT and a double-click edit existing TEXT, MTEXT, attribute definitions and dimension text in an in-place box**, while MTEXT keeps its formatting; text too long for the MTEXT editor (over 100,000 characters, 20,000 paragraphs or 1,000 kept codes) is refused and sent to the command line (`crates/ui-egui/src/line_editor.rs`, `crates/engine/src/mtext_edit.rs`, `crates/engine/src/cmd/modify2/textedit.rs`, `crates/ui-egui/src/mtext_editor.rs`, `crates/doc/src/entity/dim.rs`, `crates/io/src/dxf_write/blocks.rs`).
- **Hatch, blocks, xrefs:** pick-point HATCH with islands, HATCHEDIT, **23 built-in patterns including SOLID** (`crates/doc/src/library.rs`), solid and gradient fills, user `.pat` files, **HATCHGENERATEBOUNDARY** (closed polylines around a hatch's loops); BLOCK/INSERT/**MINSERT**/ATTDEF, **Edit Attributes dialog at ATTDIA 1**, BATTMAN, ATTSYNC, ATTEDIT, DATAEXTRACTION/EATTEXT, nested blocks, groups, WBLOCK (with a **Write Block dialog**), PURGE; a **Blocks palette** with current-drawing previews, user block libraries (folders or one drawing file, kept in a settings list) and placement via INSERT (`blocklibrary`, `blocklibraries`, `blocklibimport`, `blockspalette`) (`crates/ui-egui/src/blocks_palette.rs`, `crates/engine/src/cmd/blocks/library.rs`, `crates/ui-egui/src/attentry.rs`, `crates/ui-egui/src/wblock.rs`); xrefs (XATTACH, -XREF, XBIND, XOPEN, overlays, relative paths); **XCLIP/XCLIPFRAME** clip block and xref references (rectangular, polygonal and closed-polyline boundaries, Invert clip, ON/OFF/Delete/generate Polyline, a frame mode per drawing), boundary stored per reference and kept through DXF/DWG; Block Editor for static blocks (BEDIT/BSAVE/BSAVEAS/BCLOSE); REFEDIT/REFSET/REFCLOSE; dynamic-block references read from other files **apply visibility, lookup, distance (linear/polar/XY), angle, position and flip changes, driving stretch, move, rotate, flip, scale and array actions** (`crates/doc/src/dynblock/apply.rs`).
- **Layouts and plotting:** paper-space layouts plus **LAYOUT NEWAREA** (a layout and viewport from a model area), polygonal/object/clipped viewports (VPCLIP, VPLAYER), MSPACE/PSPACE, page setups, PLOT dialog, Plot Preview, EXPORTPDF, PUBLISH, PDFBOOK, plot styles (CTB/STB) and plotter devices, Named Viewports dialog, LAYOUT SAveas to a drawing template. **PLOT picks PNG/SVG/PDF from the path's extension and refuses a path whose extension names no format; PNG and SVG hold one sheet only** (`crates/engine/src/cmd/plotters.rs`); a landscape media's size order and rotation survive DXF/DWG, and model-space PDF plots apply the device paper's printable-area margins (`crates/io/src/pdf.rs`, `docs/plotters.md`).
- **Inquiry:** AREA and DIST measure arc segments with the Arc option; AREA refuses values past f64's range; long engineering-unit distances fall back to decimal; `shapes` (with `selfCheck`), `usage`, `loops`, `countlist`/`counttable`/`count`, `properties`, `describe`, `list`, `dist`, `id`.
- **Parametric:** geometric and dimensional constraints, AUTOCONSTRAIN, CONSTRAINTBAR, DELCONSTRAINT, PARAMETERS with expressions, re-solve after edits, `constraints.inspect`/`constraints.dof` (`crates/constraints/src/lib.rs`).
- **AutoLISP:** `.lsp` via APPLOAD (with a `.lsp` file browser), `(load)`, drag-and-drop, or the `lisp`/`appload` commands; `(defun c:NAME)`; startup files; `command`, `entget/entmake/entmod`, `ssget` filters, `get…` input, `vl-*` functions, `tblsearch/tblnext/tblobjname`, `namedobjdict/dictsearch/dictnext`, `handent`, `entnext/entlast`, live `HANDSEED`, `findfile` for folders, point-list system variables (`crates/engine/src/lisp.rs`, `crates/engine/src/lisp/objects.rs`). No Visual LISP ActiveX, DCL dialogs, reactors or Startup Suite.
- **Raster images:** IMAGEATTACH (`iat`) with `{path, data?, at?, scale?|width?, rotation?, name?}` — a relative path is relative to the drawing's folder; IMAGE (`im`) lists every image with status Loaded / Not Found / Not loaded. Limits 1,000 image files, 256 MiB per file and 2 GiB of decoded pixels per drawing; a missing file stays a crossed-out frame. Drawn on screen and in PNG output with rotation, fade and a clip boundary read from the file; brightness and contrast are kept but not applied (`crates/engine/src/cmd/image.rs`, `crates/io/src/raster.rs`).
- **Fonts:** TrueType/OpenType/collection fonts by family or file name, `FONTALT`/`FONTFALLBACK`, `CADCRAFT_CAP_HEIGHT` cap-height overrides for metric-compatible substitutes, and SHX shape fonts, big fonts and unifonts through the shared `craft-shx` (searched beside the drawing, in `CADCRAFT_SHXPATH`, through a font map, or registered by the web app; never inside another CAD program's folder). Text widths and extents follow the SHX pen's own metrics (`crates/fonts/src/shx/mod.rs`, `crates/fonts/src/ttf.rs`). MTEXT/bidi fixes keep paragraph direction across isolates, honour an inline `\W…x` width factor, and keep text after an unterminated code (`crates/fonts/src/bidi.rs`, `crates/fonts/src/mtext.rs`).

### Files and formats (exact, from code)

- **Open/read:** DXF ASCII R12–2018 and binary R13+; pre-2007 files decode from `$DWGCODEPAGE`. DWG by content magic through the **`craft-dwg`** bridge on acadrust **0.6.6** (MPL-2.0, unmodified; R13/R14 untested, pre-R13 not read) in a child process; DWG read notes carry proxy-conversion failures. SVG and gzipped SVGZ (shapes, paths, groups, Inkscape layers; no CSS, `use`, fills/gradients/patterns, text, images). **PDF** as an import source: `open`, `import` and `pdfimport` read a page's vector content into editable LINE/LWPOLYLINE, solid HATCH and TEXT objects (`crates/doc/src/format.rs`, `crates/io/src/lib.rs`, `crates/io/src/pdf_read.rs`, `crates/engine/src/cmd/file.rs`, `crates/engine/src/cmd/exchange.rs`). **Raster image files** PNG, JPEG, BMP and TIFF are decoded for IMAGE entities; the format comes from the content, not the name (`crates/io/src/raster.rs`). The DXF reader and writer come from `craft-dxf`; the in-repo reader still bounds what it maps, and a hostile-DXF no-panic test lives in `crates/io/src/tests.rs`.
- **Save/native:** DXF is the native path — ASCII or binary, versions 2000–2018; **new drawings carry `$ACADVER` AC1032 and save as 2018 by default**, an opened drawing keeps its supported version (older maps to 2000, newer to 2018), and SAVEAS `version` overrides it and is remembered. DWG writes 2000–2018 (at least 2004 unless 2000 is asked; 2018 by default). `.dwt` templates save via SAVEAS; NEW/QNEW accept `.dwt`/`.dxf` templates; LAYOUT SAveas writes a layout as a template. **4 drawing formats read / 6 written** (plus the 4 raster image formats). Oversized files fail loudly: a drawing opened directly is capped at 512 MiB (`crates/doc/src/header.rs`, `crates/io/src/lib.rs`, `crates/engine/src/cmd/file.rs`; the DWG cap lives in `craft-dwg`).
- **Unmodelled content:** DXF writes back unknown entities/objects, foreign xdata, extension dictionaries, reactors, layer states and colour books; proxy objects keep their class with group 91 renumbered, and a proxy with no class is dropped. Proxy graphics read from DXF are **drawn** as read-only entities (PROXYSHOW 1). Through **DWG**, acadrust still drops custom-class entities/objects, xdata on table records and blocks, entity colour books and reactors; SAVE/SAVEAS report what the target cannot hold in a `notSaved` field, and a QSAVE keeps the previous file as `.bak` (`crates/io/src/dxf_raw.rs`, `crates/io/src/dxf_write/proxy.rs`, `crates/doc/src/entity/proxy.rs`, `crates/io/src/dxf_read/entities.rs`, `crates/engine/src/cmd/file.rs`, `docs/gaps.md`).
- **Import:** another DXF/DWG's objects via `import`; a PDF page via `pdfimport`/`import`; user `.lin`, `.pat` and `.pgp` files. SVG/SVGZ is read by `open`. Raster images are attached by IMAGEATTACH, not imported as geometry.
- **Export:** SVG; PNG 2400×1600; vector PDF with embedded TrueType text subsets, OCG layers, multi-sheet output, hyperlinks and plotted transparency. EXPORT, EXPORTPDF, PUBLISH, PDFBOOK, PLOT, PREVIEW and `cadcraft-cli convert`; they return base64 `data` when no path is given. CLI image/PDF export always renders **model space**. Raster images appear in PNG output; PDF and SVG output draw only the image frame.

### Automation surfaces (all over the same command registry)

- **Command catalog.** `engine.commands` / `cadcraft-cli commands` return id, label, menu path, shortcut, aliases, parameter docs and enabled state. Headless/CLI catalog = the engine registry (**483 at this tag**); the desktop app adds **61** `UI_COMMANDS` entries (`crates/ui-egui/src/menus.rs`), so the app catalog is 544. Ids are AutoCAD command names lower-cased.
- **MCP server (stdio).** `cadcraft-cli mcp` (headless) or `cadcraft-cli mcp --connect 127.0.0.1:PORT [--lazy] [--launch]`. **15 tools** — 12 headless, plus 3 only when connected: `command_line`, `script`, `execute`, `list_commands`, `inspect_drawing`, `query_entities`, `render`, `find_text`, `new_drawing`, `open`, `save`, `cancel`, and app-only `screenshot`, `ui_inspect`, `ui_click` (`crates/mcp/src/tools.rs`). `render` takes `background`/`plot_style`; `find_text` takes `contains` (or `query`). **Headless automation roots:** `--automation-read-root DIR` and `--automation-write-root DIR` confine every file a command reads or writes; a read must lie under either root, a write only under the write root and never at the root itself, and a command not in the classified list is refused outright (`crates/engine/src/file_access.rs`, `crates/engine/src/file_access/commands.rs`, `apps/cadcraft-cli/src/args.rs`). Resources: `cadcraft://drawing` and `cadcraft://commands` (`crates/mcp/src/server.rs`).
- **JSON control channel.** Desktop app with `--control PORT`; one JSON object per line over `127.0.0.1:PORT`. **Every request must carry `"token": "<session token>"`** — the server starts with a fresh session token in an owner-only file, `cadcraft-control-<port>.token`, in `$XDG_RUNTIME_DIR` (else `~/.cache`; `%LOCALAPPDATA%` on Windows), and logs its path at startup; the MCP bridge reads it automatically only when the connected peer is exactly `127.0.0.1:<port>`, and sends a short `ping` first when a request is longer than the unauthenticated limit (`crates/mcp/src/control_token.rs`, `crates/mcp/src/backend.rs`). **Until a request on a connection has carried the token, a line may be at most 64 KiB**; `params` are not decoded and `id` is capped at 4,096 bytes before the check, so an unauthenticated peer cannot make the app build values (`apps/cadcraft/src/control_server.rs`). The bridge (Unix) refuses a token file that is a symlink, not a plain file, or readable by other users; if neither a runtime dir nor `HOME` exists it refuses rather than using the shared temp dir. **27 top-level methods** in the app, **12** in headless mode: `cmdline.input/script/key/state`, `engine.execute` (alias `command`), `engine.commands`, `drawing.inspect`, `ui.inspect`, `ui.elements`, `ui.menu.list`/`invoke`, `ui.pointer`, `ui.click`, `ui.move`, `ui.drag`, `ui.key`, `ui.text`, `ui.set`, `ui.resize`, `ui.focus`, `ui.screenshot`, `ui.render` (with `window`, `background`, `plot_style`), `app.open`/`save`/`quit`, `control.methods`, `ping`. Limits: 16 connections, 64 queued requests, 256 MiB per line after authentication, 512 MiB buffered across connections, 60 s reply timeout (`state: not-run` = safe to resend, `may-have-run` = inspect first), 10 min idle, 30 s blocked-write timeout; a client that gives up cancels a request the app has not started (`apps/cadcraft/src/control_server.rs`, `crates/ui-egui/src/control.rs`).
- **CLI `cadcraft-cli`** (separate zip; arguments parsed with clap following RFC-0012): **8 verbs** — `info`, `convert`, `run`, `commands`, `mcp`, `perf`, `sample`, `roundtrip` — plus `--version`/`--help`.

| Command | What it does |
|---|---|
| `info FILE` | Print `drawing.inspect` JSON (add `--compact` for one line); a PDF's first page opens as vector content. |
| `convert IN OUT` | Conversion or image export; OUT's extension picks the format (dxf, dwg, dwt, svg, png, pdf); PNG 2400×1600; model space only; a PDF IN imports its first page; `--window x0,y0,x1,y1` or `--view extents\|current`; `--in-place` allows replacing an input. |
| `run [FILE…] [--sample] [--metric] [--script TEXT] [--script-file F.scr] [--cmd 'id {json}']… [--save OUT] [--export OUT]` | Headless edit session over one or more drawings (the last is current); staged writes; framing flags need an image export. |
| `commands [FILTER]` | JSON command catalog (`--compact` for one line). |
| `mcp [--connect HOST:PORT [--lazy] [--launch]] [--automation-read-root DIR] [--automation-write-root DIR]` | MCP server on stdio; the roots confine a headless server and are refused with `--connect`. |
| `perf [N \| FILE]` | Timing table (synthetic N entities, or a drawing). |
| `sample (bracket\|floorplan) OUT` | Built-in sample drawing in any writable format. |
| `roundtrip [FILE\|FOLDER] [--out DIR] [--keep-saved] [--same-format] [--no-census] [--tolerance T]` | Open → save → reopen and diff; writes a Markdown and a JSON report; FOLDER defaults to `CADCRAFT_CORPUS_DIR`; `CADCRAFT_CORPUS_STRICT=1` makes any open/save/reopen failure or lost record fail the run. |

  `--cmd` chaining: `"{last}"` becomes the last object handle an earlier `--cmd` returned.
- **Browser page API (web build only).** `window.cadcraft` is installed by `apps/cadcraft-web/src/api.rs` over the app's control channel: `request(method, params)`, `execute(command, params)`, `commands()`, `docInspect(params)`, `uiInspect(params)` and `screenshot(params)`, each a promise that resolves with the control method's `result` or rejects with an `Error` carrying `error`; an existing `window.cadcraft` keeps its own functions. A page call that times out drops its pending reply, which cancels a request the app has not started. The page API is web-only; the desktop build uses the control channel instead.
- **Scripting and import automation:** `.scr` via SCRIPT or `run --script-file`; AutoLISP via `lisp` / `appload`; `.pgp` via `aliasedit`/`reinit`; `.lin`/`.pat` loading; `document.bytes {format, version, binary, portableFonts?}` returns base64 without touching a file.
- **Read-back commands for agents:** `drawing.inspect` (+`skipped{count,sections}`, `readNotes`), `entities`, `texts`, `shapes` (with `selfCheck`), `usage`, `loops`, `countlist`/`counttable`/`count`, `properties.describe`, `list`, `dist`, `id`, `area`, and `image` for attached rasters.

### Platform notes

- Native macOS universal app (signed, notarized DMG; CLI in a separate signed zip, `cadcraft-cli-<ver>-macos-universal.zip`, `packaging/macos/package.sh`). **macOS file events are handled**: a Finder double-click, Open With, Dock drop and `open -a CADCraft plan.dxf` open the drawing as a tab when the app runs, and the bundle claims AutoCAD's and LibreOffice's DWG/DXF UTIs so Finder offers it (`apps/cadcraft/src/apple_events.rs`, `packaging/macos/Info.plist.in`); the landing PR records no run on a Mac, and the window is not brought forward. **Windows**: single-instance — a file opened while CADCraft runs opens as a tab in the running window; MSI per-user-or-machine, and since v0.18.0 **no 32-bit x86 build**; a portable ZIP with `portable.txt` beside `cadcraft.exe` keeps settings/logs/autosaves in `CADCraftData` (`apps/cadcraft/src/single_instance.rs`, `apps/cadcraft/src/portable.rs`, `packaging/windows/cadcraft.wxs`). **Linux**: AppImage, deb, rpm, Arch `.pkg.tar.zst` and Flatpak (both manifests allow `org.freedesktop.Flatpak` for updates), x86_64/aarch64/riscv64. **FreeBSD**: x86_64 and aarch64 tar. A **nightly channel** builds its own bundle identity and a separate launcher-owned profile root (`apps/cadcraft/src/launch_profile.rs`, `apps/cadcraft/src/build_channel.rs`); the stable bundle is what the launcher installs. macOS file dialogs are **sheets** shown without blocking the window (the #1527 crash), one at a time, and the answer lands on the drawing that asked (`apps/cadcraft/src/sheet.rs`).
- WebAssembly build runs the same UI (`?webgl`, `?cpu`, `?sample`) and a **page-host mode** (`?host=parent` in an iframe, or `data-host="page"` on the canvas) where the host page opens drawings and receives saves as `postMessage`/`DOM CustomEvent`s instead of downloads (`apps/cadcraft-web/src/host.rs`). **No DWG**, no autosave, saves are browser downloads without a host. The web build also exposes `window.cadcraft` (above), and `ui.screenshot` returns an inline PNG because there is no file system.
- **21 interface languages** (`LANGUAGES` in `crates/ui-egui/src/i18n.rs`: English plus 20 translations; Polish and Tamil joined at v0.21.0); live switching via `ui.language`, `CADCRAFT_LOCALE` and the `ta` code. CJK/Arabic/Hangul/Tamil need an installed matching font; Georgian and Tamil can use the craft-fonts faces.
- Accessibility: system-cursor restore, animation-effects setting; in-place text editing accepts IME composition and commit.
- 3Dconnexion SpaceMouse support is compiled for Windows/Linux only (`hidapi` target dependencies in `apps/cadcraft/Cargo.toml`); `docs/gaps.md` claims 2D pan/zoom through raw HID there, with no 3D navigation and no macOS/web support — claimed, not verified here.

## Known limitations and not-implemented

Read `docs/gaps.md` before promising anything; it is the maintained list and it is newer than `ROADMAP.md`. The checklist's menu breadth (**306/491, 62 %**) is the 2026-11-27 snapshot. The high-impact limits for an agent:

- **Saving DWG is still lossy.** Through DWG, acadrust drops custom-class entities/objects, xdata on table records and blocks, entity colour books and reactors; records it cannot split are named in the read notes. DXF keeps unknown objects and proxy classes, and proxy graphics draw; that does not make a DWG round trip lossless. Always check `readNotes` after opening and the `notSaved` report on every DWG save; QSAVE keeps the previous file as `.bak` (`docs/gaps.md` FF1, `crates/engine/src/cmd/file.rs`). The DWG worker process has no memory limit of its own, so a crafted file can use a lot of memory before that one open or save dies (`SECURITY.md` known limits).
- **No shipped real-file corpus and no AutoCAD sign-off.** `cadcraft-cli roundtrip` and `cargo xtask corpus` exist, but the corpus lives in a separate repo; `docs/gaps.md` still lists a black-box AutoCAD check as a gap, and its own note says the in-repo file tests use synthetic data. Do not tell a user their CADCraft file is AutoCAD-clean.
- **No 3D.** No 3D views, orbit, solids, surfaces, meshes, sections, visual styles, materials, lights or rendering. The UCS commands work **in the drawing plane only** (origin and Z rotation; a tilted UCS is stored but input falls back to World). `3DORBIT` and `SHARE` are registered only to refuse, and ATTACH refuses PDF/DWF/DGN underlays while attaching PNG/JPEG/BMP/TIFF; DVIEW's 3D options (CAmera, TArget, Distance, POints, CLip, Hide) print "not available yet" — TWist, PAn, Zoom, Off and Undo work on 2D views. README's tagline still says "2D and 3D".
- **Curve geometry is tessellated.** Ellipse/spline intersections, offsets, trims, closest points and snaps are approximations; polyline offsets recompute arc bulges but have no loop cleanup; tolerances are absolute.
- **Xrefs cannot be edited in place** (REFEDIT edits block references only) and there is no dynamic-block authoring (parameters/actions); dynamic-block *references* can be edited (visibility, lookups, distances, angles, positions, flips). XCLIP exists, so do not repeat the old "no XCLIP" claim.
- **PDF import is a plot-reading approximation.** PDFIMPORT maps one page's stroked paths, fills and recoverable text to lines, polylines, solid hatches and TEXT; scanned pages get no vectors (no OCR, no raster tracing), gradient/pattern paints and white background fills can be omitted, transparency and dash patterns can differ, the PDF's layers are not imported, text fonts may change, and a page with viewports at different scales needs per-viewport calibration (`docs/pdf-import.md`, `crates/io/src/pdf_read.rs`).
- **SHX text is only as good as the font files present.** No bundled SHX font; without the file the style falls back to `FONTALT`/the stroke font and widths differ. No Options entry for the search path or font map, no desktop drag-and-drop of `.shx`, the big-font code page is guessed from the file name, vertical text is not justified along its column, and extended big-font box scaling is unverified against real files (`docs/gaps.md` FF8).
- **Raster images are display-and-PNG only.** No PDF/SVG image output, no prompts/dialog/menu row, no `-IMAGE` options (detach, reload, unload, path), no IMAGECLIP, IMAGEADJUST or IMAGEFRAME, brightness/contrast not applied, images lie under all other objects on screen whatever their draw order, size is not taken from the file's resolution, and pixels are never stored in the drawing — move the drawing without its image files and the pictures are gone. No PDF underlays (PDFATTACH), no DWF/DGN/WMF/EPS/ACIS/STL exchange, no DWS standards, no system printers.
- **Binary plot files are unread.** `.ctb`/`.stb`/`.pc3`/`.pmp` must be recreated in CADCraft's JSON formats.
- **MTEXT editing has limits.** The in-place editor keeps formatting and relative heights but refuses text past 100,000 characters, 20,000 paragraphs or 1,000 kept codes and falls back to the command line; there are no fields, no spell check, and stacked fractions show as placeholders.
- **No autosave in the web build.** Desktop autosave writes DXF `.sv$` files, holds a lock per settings folder, shows a failure notice and offers recovery at the next start; a UI panic autosaves and writes a crash report. The web build has none of this, and a panic aborts there.
- **SETVAR covers ~150 of ~1,000 variables**; no Sheet Set Manager, eTransmit, Traces, Markup Import, CUI(x) or workspaces.
- **Some commands are engine-level only.** `imageattach` is JSON only (ATTACH takes the same JSON for an image path) — there is no attach dialog or menu row. `pdfimport` now has File ▸ Import PDF... and a dialog; `find`/`textedit`/`xclip` have UI entries.
- **No plug-in API.** ObjectARX/.NET plug-ins cannot load. What an agent can extend today is AutoLISP, `.scr` scripts, `.pgp` aliases, `.lin` linetypes and `.pat` patterns.
- **Web PLOT may show raw PDF bytes (#134)**; Windows/Linux get little runtime testing. macOS Finder opening landed but was not run on a Mac by its PR, and the window is not brought forward; the control channel, MCP, scripts and LISP still open a second copy.
- **Docs that lag the code (code wins):** `README.md` still says SHX fonts "aren't read yet", advertises "2D and 3D", lists 18 translations without Polish, and lists only five CLI verbs; `docs/parity-checklist.md` says 482 commands (2026-11-27, one behind); `docs/file-format-parity.md` still cites the removed DXF crate's version module; the CLI's `--view current` help still says "extents plus a 10% margin" although `crates/engine/src/session/files.rs` opens on the saved view.
- **Claimed but unverified here (static reading only):** the interactive feel of AutoComplete and right-click repeat, associative-dimension behaviour, MTEXT bidi/OpenType shaping for Arabic-script text, per-language font availability, SpaceMouse behaviour on Windows/Linux, the browser page API under a real page, proxy preservation on a real third-party DWG, the macOS Apple-event path on a real Mac, nightly packaging end to end, and Flatpak self-update in an installed Flatpak.

## How to operate

**Launch (macOS).** The GUI binary is the installed CADCraft.app's `Contents/MacOS/CADCraft`; launch with `open -a "CADCraft"`. Start flags (verified with the installed binary's `--help`): `--control <port>` (also read from `CADCRAFT_CONTROL_PORT`), `--sample`, `--new-window` (Windows: open files in a new window even if CADCraft runs), `--version`/`-V`/`-h`, and positional drawing paths; an unknown flag is a usage error (exit 2); `--dwg-worker` is internal (a copy of the binary started to read or write one DWG — never call it yourself). CADCraft's own MCP `--launch` runs `open -a CADCraft --args --control PORT`. CADCraft does not have to be running for `cadcraft-cli` or headless MCP.

Environment variables that matter: `CADCRAFT_CONTROL_PORT`, `CADCRAFT_CONFIG_DIR` (empty means no settings folder), `CADCRAFT_LOCALE`, `CADCRAFT_SYSTEM_CURSOR=1`, `CADCRAFT_STENCIL=0` (old drivers that show a black window), `CADCRAFT_FONTALT`/`CADCRAFT_FONTFALLBACK`, `CADCRAFT_CAP_HEIGHT`, `CADCRAFT_SHXPATH` (SHX search path), `CADCRAFT_MAX_DXF_TAGS` (raise the DXF group-code limit), `CADCRAFT_VSYNC`, `CADCRAFT_NO_NATIVE_MENU`, `CADCRAFT_WAYLAND=1`, `WGPU_BACKEND`, `RUST_LOG`. CLI-only: `CADCRAFT_CORPUS_DIR` and `CADCRAFT_CORPUS_STRICT=1` for `roundtrip`.

**Settings/state (macOS).** `~/Library/Application Support/CADCraft/` holds `logs/cadcraft.log` (rotated, 16 MiB cap), `autosave/` (`.sv$` DXF copies plus a per-instance `.lock`), `support/` (AutoLISP startup files), `crash-reports/`, and `workspace.json` (panels, command line). The user profile — profile variables, **ALIASEDIT aliases and the alias file**, right-click settings, colours, interface scale, **block-library list** and **`saveVersion`** — is the `cadcraft.profile` entry; the interface prefs, including **keyboard shortcuts under `shortcuts`**, are `cadcraft.prefs`. A portable Windows copy keeps these in `CADCraftData`; the control token file lives outside them (see the control-channel bullet).

**Document model.** One window, many drawings: each open drawing is a document with its own file tab and model/paper spaces; `document.switch {index}` switches, `close {index}`/`closeall` close them. Tool Sets, Layers, Properties and External References dock and float; QuickCalc opens as a floating palette (Cmd+8); layout tabs stay stable when Tool Sets toggle.

**Keyboard shortcuts (from source — do not invent others).** Engine `.key()` values and the built-in table (`crates/ui-egui/src/menus.rs` `builtin_shortcuts`): Cmd+N new, Cmd+O open, Cmd+S save, Cmd+Shift+S save as, Cmd+W close, Cmd+P plot, Cmd+Z/Cmd+Shift+Z undo/redo, Cmd+Y redo, Cmd+C/V/X clipboard, Cmd+Shift+C copy with base point, Cmd+Shift+V paste as block, Cmd+A select all, Cmd+Shift+A PICKSTYLE, Delete clear selection, F3 osnap, F5 (or Cmd+E) isoplane, F7 grid, F8 ortho, F9 snap, F10 polar, F11 object snap tracking, F12 dynamic input. UI-only: Cmd+1 Properties, Cmd+3 Tool Sets, Cmd+8 QuickCalc, Cmd+9 command line, Cmd+F Find and Replace, F1 command reference, F2 command history, Cmd+Q quit. **Tools ▸ Customize ▸ Keyboard Shortcuts...** edits the map: any command can take one, a user shortcut wins over the built-in one, conflicts are reassigned and reported, the clipboard keys/Delete/Cmd+Q are fixed, and the JSON form is `engine.execute {"command":"ui.shortcuts","params":{"set":{"line":"Cmd+L"}}}` (in the running app, desktop or web; not a headless session; `reset` clears the user map).

**Right-click.** While a command runs, a quick right-click is Enter and holding it (default 250 ms) opens the shortcut menu; Options ▸ User Preferences ▸ **Right-Click Customization** sets the hold time (100–2000 ms) and the Default/Edit/Command modes. Profile keys: `rightClickDuration`, `rightClickDefault`, `rightClickEdit`, `rightClickCommand` (values `menu`, `repeat`, `enter`, `menuWithOptions`). Options ▸ **Reset** restores the whole interface arrangement.

**Open/save/export flow.** The Open dialog filters DWG/DXF/DWT, SVG/SVGZ **and PDF** (a PDF's first page becomes a new drawing); Save offers DXF, DWG, DWT, SVG, PNG, PDF. On macOS these dialogs are **sheets**: the answer arrives in a later frame, one dialog at a time (a second request is refused), and it applies to the drawing that asked (or is refused with a status message if that drawing was closed). QSAVE/SAVE writes the drawing's own format/version and first keeps the previous file as a `.bak`; SAVEAS `{path, version?, binary?, portableFonts?}` (`portableFonts` writes a Windows font for Linux families that have one and reports the styles still missing on Windows in `nonPortableFonts`); the macOS save panel cannot pick a version per file. `document.bytes {format, version, binary, portableFonts?}` returns base64 without touching a file. EXPORT writes dxf|dwg|svg|png|pdf; **PLOT takes the format from the path extension** and refuses an unknown one, and PNG/SVG hold a single sheet; EXPORTPDF always writes PDF; PUBLISH one PDF per sheet; PDFBOOK builds ISO A-series books from frame polylines. In the web build, saves are downloads unless a host page is attached.

### Getting the CLI (the launcher installs the app, not the CLI)

The ArtCraft Launcher installs `CADCraft.app`; it does not put `cadcraft-cli` on your `PATH`.
It ships **no** CLI binary inside the bundle — the bundle holds only `CADCraft` — so a
launcher-only install has no `cadcraft-cli` at all. The CLI is published on the app's GitHub
release, `cadcraft-cli-0.21.0-macos-universal.zip` (**68.5 MB**, 71,861,325 bytes, SHA-256
`18419d96cc384c04c1939c35e3e73fd1958f195440a36d67004469122ff4b202`) at
`https://github.com/storytold/cadcraft/releases/download/v0.21.0/cadcraft-cli-0.21.0-macos-universal.zip`,
so `cadcraft-cli` answering *command not found* means "not installed yet", not "not supported".

Find it, in this order:

1. **On `PATH`** — `command -v cadcraft-cli`. If it answers, `cadcraft-cli --version` must report
   the version this skill was written against (0.21.0). A different version means the CLI and the
   app have drifted: re-read *Verify against your installed version* before trusting ids.
2. **Bundle copy** — Skip it: `find "/Applications/CADCraft.app" -name 'cadcraft-cli'` finds
   nothing (verified), so go to step 3.
3. **Install it from the release** — user-local, no `sudo`:

```sh
APP_VER=0.21.0
REL="https://github.com/storytold/cadcraft/releases/download/v$APP_VER"
ASSET="cadcraft-cli-$APP_VER-macos-universal.zip"
mkdir -p "$HOME/.local/bin" "$HOME/Downloads/cadcraft-cli" && cd "$HOME/Downloads/cadcraft-cli"
curl -fLO "$REL/$ASSET" && curl -fLO "$REL/SHA256SUMS.txt"
expected=$(grep -F "$ASSET" SHA256SUMS.txt | awk '{print $1}')
actual=$(shasum -a 256 "$ASSET" | awk '{print $1}')
[ "$expected" = "$actual" ] && echo "checksum OK" || { echo "checksum MISMATCH — stop"; exit 1; }
unzip -oq "$ASSET" -d unpacked
bin=$(find unpacked -type f -name cadcraft-cli | head -n 1)
install -m 0755 "$bin" "$HOME/.local/bin/cadcraft-cli"
"$HOME/.local/bin/cadcraft-cli" --version
```

`~/.local/bin` must be on `PATH` for the shell that runs the skill:
`export PATH="$HOME/.local/bin:$PATH"` (put it in your shell profile to keep it).

Rules: never `sudo` into `/usr/local`, never unzip into `/Applications`, and never replace an
existing `cadcraft-cli` of a different version without telling the user. macOS is what this recipe
verifies; on Linux/Windows the CLI ships inside the app package (not verified in this round).

**Headless CLI (what an agent will use most).**
```sh
cadcraft-cli info drawing.dxf                       # JSON summary: counts, extents, layers, styles, skipped, readNotes…
cadcraft-cli convert drawing.dxf out.svg            # dxf|dwg|dwt|svg|png|pdf; PNG is 2400×1600
cadcraft-cli convert plan.pdf plan.dxf              # a PDF's first page becomes editable geometry
cadcraft-cli convert drawing.dwg detail.png --window 0,0,20000,15000   # frame a rectangle
cadcraft-cli run --sample --script 'CIRCLE 22,3 1\n' --save out.dxf --export out.png
cadcraft-cli run drawing.dxf --script-file setup.scr --save out.dxf
cadcraft-cli run drawing.dxf --cmd 'circle {"center":[10,10],"radius":4}' --cmd 'zoom {"mode":"extents"}' --export sel.png
cadcraft-cli run drawing.dxf --cmd 'pdfimport {"path":"plan.pdf","page":2,"scale":50}' --save plan.dxf
cadcraft-cli run drawing.dxf --cmd 'properties.describe {"handles":["2F"]}'
cadcraft-cli run drawing.dxf --cmd 'imageattach {"path":"site.png","at":[0,0],"width":120}'
cadcraft-cli run drawing.dxf --cmd 'xclip {"handle":"2A","option":"new","rectangle":[[0,0],[100,80]]}'
cadcraft-cli commands dim                           # command catalog (JSON), filtered
cadcraft-cli sample floorplan out.dxf               # built-in sample drawings
cadcraft-cli roundtrip drawings/ --out reports/     # open → save → reopen loss report
cadcraft-cli roundtrip drawings/ --same-format --keep-saved --tolerance 1e-6
cadcraft-cli mcp --connect 127.0.0.1:7979           # bridge MCP to the running app
cadcraft-cli mcp --automation-read-root "$PWD/work" --automation-write-root "$PWD/work/out"
```
Framing rules: `convert` fits model-space extents; `run --export` uses the current view only if a command changed it; `--window x0,y0,x1,y1` shows exactly that rectangle. `--view current` follows the session view, and an opened drawing's view is the one stored in the file (when it has a usable `$VIEWCTR`/`$VIEWSIZE`), not the extents — the CLI's own help text still says "extents plus a 10% margin", which is stale. CLI PNG/SVG/PDF always render **model space**. The CLI installs the same raster decoder and PDF reader as the app, so IMAGEATTACH and PDF import work headlessly.

**Browser page API (web build).**
```js
await window.cadcraft.execute("circle", {center: [0, 0], radius: 5});
const catalog = await window.cadcraft.commands();
const drawing = await window.cadcraft.docInspect({});
const png = await window.cadcraft.screenshot({});   // inline pngBase64 on the web
await window.cadcraft.request("engine.execute", {command: "zoom", params: {mode: "extents"}});
```
Each call is a promise; a rejection carries the control channel's `error`. `docInspect` maps to `document.inspect`, `uiInspect` to `ui.inspect`, `screenshot` to `ui.screenshot`. The page API reaches the same app control methods as the desktop control channel, but only from the web page that hosts the drawing.

**Command-first workflow.** Anything the UI can do is a command: `engine.execute {command, params}` runs the JSON form with no dialogs; typing (`cmdline.input`) drives the interactive prompt machines exactly like a user. A refused command-line line still replies `ok: true` — check the `error` field. Errors inside a command never take the app down (panic guard); a panic in the interface itself autosaves every unsaved drawing and reports it. UI commands exist only in the app catalog; headless returns "unknown command" for them.

## Working with an AI agent

Legitimate and reliable:

- **Prefer the headless surfaces**: `cadcraft-cli` for one-shot work and verification, MCP (headless or bridged) for interactive sessions, the control channel when a human is watching the same window, and `window.cadcraft` only in the browser build. Do not drive the GUI blindly; `ui.screenshot` needs a presented frame.
- **Confine a headless MCP server when the agent is untrusted.** Pass `--automation-read-root`/`--automation-write-root` (both existing folders; the write root is never written itself). Reads may lie under either root; a command that is not classified is refused; `drawingrecovery` and `blocklibraries` are refused under roots because they use the server's own folders. A refused path in `command_line` comes back in the reply's `error`/`output`, not as an MCP tool error. The roots apply to the headless server only (`crates/engine/src/file_access.rs`, `docs/mcp.md`).
- **Talk to the control port correctly.** Read `cadcraft-control-<port>.token` (`$XDG_RUNTIME_DIR`, else `~/.cache`; `%LOCALAPPDATA%` on Windows) and send `"token"` in every request line, or use the MCP bridge which does it for you. **Send a short `ping` with the token first if your next request is longer than 64 KiB**, then reuse the connection; the bridge does this automatically. Pass the bridge `127.0.0.1:PORT`, not `localhost:PORT`: the bridge sends the token only when the connected peer is exactly `127.0.0.1:<port>`. Never assume a local connection is authorized, and do not fight the token-file checks (symlinks and group/world-readable files are refused by design).
- **Measure what a save loses before you promise a round trip.** `cadcraft-cli roundtrip FOLDER` is the strongest tool: it opens, saves as DXF and DWG, reopens and lists every lost/added/changed entity, table record, header variable and opaque record, with `--same-format` for a single format and `--keep-saved` to inspect the files. Compare the report before and after your edits. For a DWG, also read `readNotes`/`warnings`: proxy-conversion failures are named there, not silently dropped. A QSAVE keeps the previous file as `.bak`, so a bad save is recoverable but not harmless.
- **Author drawings programmatically**: `engine.execute` per entity, or a `.scr` script / `cadcraft-cli run --script-file`, is far more reliable than pointer simulation. Read back with `drawing.inspect`/`entities`, `texts`, `image`, `shapes`, `usage` before purging, `loops`, and eyeball with `render` (with `background`/`plot_style`, so the PNG can look like the plot).
- **Change properties the palette's way.** `properties.describe {handles}` lists the rows and the `properties.set` key for each; `properties.set {handles, key: value}` applies it and returns `ignored` for keys no object took. On a dimension, a style variable becomes a per-dimension override. This is the reliable replacement for guessing at individual edit commands.
- **Prepare/convert inputs**: `convert` turns DXF/DWG/SVG/PDF to DXF/DWG/DWT/SVG/PNG/PDF (PDF input: first page only); for another page run `pdfimport {"path":"plan.pdf","page":N}` in a session, then save. SVG imports as paths/groups in millimetres, page top-left at the origin, Y up. Check `info`'s JSON before assuming contents.
- **Import PDFs with calibrated expectations**: `pdfimport` brings vectors, solid fills and recoverable text; scanned pages have nothing to import, and the result's `warnings` and the command history name approximations. Check a known dimension after importing, especially from a page with multi-scale viewports.
- **Edit text deliberately**: TEXTEDIT `{handle, text}` works on TEXT, MTEXT, attribute definitions, dimension text and multileader text (a block-content multileader has none); a locked layer is refused. In the desktop app, TEXTEDIT/double-click opens an in-place box for TEXT, MTEXT, an attribute definition or a dimension's text; MTEXT keeps formatting and text past the editor's caps (100,000 chars, 20,000 paragraphs, 1,000 codes) is refused there and falls back to the command line. An empty answer in the in-place MTEXT editor keeps the existing text (the JSON form with an empty `text` writes an empty text).
- **Set aliases and shortcuts knowingly.** `aliasedit {"file": "..."}` **replaces** the user alias set (built-ins stay); use `set`/`remove`/`clear` for incremental changes, and `reinit` to re-read the last file. Aliases persist in the user profile on desktop/web but not in a headless run. `ui.shortcuts {"set": {...}}` is app-only (desktop or web, not headless) and stored with the preferences; a command that loses a key is returned in `replaced`.
- **Use the UCS in 2D only.** `ucs {"option":"world"}` / `{"option":"origin","origin":[x,y]}` / `{"option":"z","angle":30}` change how typed points are read and shown; geometry stays in world coordinates. A tilted UCS is stored, but do not promise 3D drawing.
- **Attach images deliberately**: IMAGEATTACH stores a path in the drawing and caches pixels in memory, so the image file must travel with the DXF; a relative path is relative to the drawing's folder. PNG output shows the picture, PDF/SVG do not.
- **Keep fonts with the drawing**: SHX text metrics depend on the named `.shx` being beside the drawing or on `CADCRAFT_SHXPATH`; without it the text falls back and widths/extents change.
- **Interpret and repair project files**: DXF is a documented text format; CADCraft-specific data travels under the `CADCRAFT` xdata app name and `CADCRAFT_*` dictionary entries. For damaged drawings use AUDIT/RECOVER; crash autosaves are `.sv$` DXF files listed by DRAWINGRECOVERY, and a left-behind `.sv$` plus its `.lock` file is the recovery candidate after a crash.
- **Verify exports before reporting success**: re-open the saved file, compare entity counts/extents/layers, check `open`'s `warnings`, `drawing.inspect.skipped.count`, `readNotes`, and the `notSaved` report (CLI prints it on stderr for `.dwg`/`.dwt`). Render to PNG and look at it. CLI writes and plot output report "undrawn" notes (for example dashes past a limit drawn continuous); a silent export is not a verified export.
- **Report commands with their exact ids** from `engine.commands`/`cadcraft-cli commands`; ids are AutoCAD command names lower-cased. The app catalog's `ui.*` entries are not engine commands.
- **Counts to expect at v0.21.0**: 483 engine commands (465 literal ids + 18 `gc!`/`dc!` macro ids); 61 UI-only commands (app catalog 544); 15 MCP tools (12 headless + 3 app-only); 27 control methods app / 12 headless; 8 CLI verbs; 21 interface languages; 23 built-in hatch patterns; 14 object snaps; 4 drawing formats read / 6 written plus 4 raster image formats; PDF is an import source, not a drawing format. Re-derive with `cadcraft-cli commands | jq length` rather than trusting any number, including these.

What an agent must NOT do:

- Assume DWG saves round-trip losslessly, or that AutoCAD will open CADCraft output cleanly — no real-file AutoCAD check exists. Keep an untouched copy of every received file; prefer DXF when the user's tooling allows it, and always read `readNotes`/`notSaved`.
- Assume 3D/UCS in space, PDF underlays, dynamic-block authoring, xref in-place editing, Visual LISP/DCL/reactors, fields, spell check, sheet sets, eTransmit, Traces or CUI exist. Check `docs/gaps.md` first.
- Assume an attached raster image is inside the drawing, that PDF import recovers a CAD model (it recovers a plotted page's vectors only), or that SHX text will look the same without its font file.
- Invent shortcuts, menu paths, flags or format names: only what is in `CommandSpec`, `UI_COMMANDS` and the CLI usage string exists. IMAGEATTACH has no dialog or menu row; it is a JSON command. A user shortcut is a user setting, not an app default.
- Edit `.dwg` bytes or expect a CADCraft-proprietary project format — there is none; the drawing *is* the DXF/DWG.
- Send UI-only commands (including `ui.shortcuts`) to a headless MCP/CLI session, or rely on `screenshot` without a presented frame. In the browser, `screenshot` is inline only; do not expect a file path.
- Call `app.quit` before saving: it quits without the unsaved-changes prompt.
- Assume a macOS file dialog has answered when the command returns; dialogs are sheets now. Use the JSON path forms (`open`, `save`, `convert`, `run`) when an agent needs a definite result.
- Trust it for production/concurrent work: pre-alpha, synthetic-only file tests in-repo, and open correctness gaps.

## Verification protocol

1. Work throwaway-first: `cadcraft-cli sample bracket scratch/t.dxf` (or `run --metric`), draw, save to a scratch path, re-open, inspect, delete. Never test on the only copy of a real drawing.
2. After every save, assert on the result: the `notSaved` field / the stderr warning must be absent. After reading, `drawing.inspect.skipped.count` must be 0 for DXF, `open`'s `warnings` must be empty for DWG/SVG, and `readNotes` must not name a proxy-conversion failure unless you accept that loss. A silent export is not a verified export.
3. Round-trip discipline: new → edit → save → close → reopen → compare counts/extents/layers; then export to PNG/SVG/PDF and look at it. For a folder of real files, run `cadcraft-cli roundtrip FOLDER` and read the report before and after your work. When the user has AutoCAD or another viewer, open the file there too — a systematic AutoCAD check is still outstanding (`docs/gaps.md`).
4. PDF import check: import a page, compare a known dimension or a named room, read the result's `warnings`, and render the drawing to PNG; a scanned PDF has no vectors, so a "successful" import can still be nearly empty.
5. For the web build, verify the page API in the page console: `await window.cadcraft.commands()` returns the catalog, `await window.cadcraft.docInspect({})` returns the drawing summary, and `await window.cadcraft.screenshot({})` resolves with `pngBase64`; a rejected promise carries the control error. Remember the web build has no DWG and no autosave.
6. Version and back up: keep each session's output under a new name or in version control; the desktop app has SAVETIME autosave, Drawing Recovery, AUDIT and RECOVER, and saves keep a `.bak`, but the web build has none and DWG saves can still drop unmodelled content. If autosave shows a failure notice, treat unsaved work as unprotected until you save.
7. Update CADCraft only between projects (launcher auto-updates), and re-check this skill's claims when the version moves — this skill describes v0.21.0.

## Sources & evidence

- Repo: https://github.com/storytold/cadcraft (clean-room, MIT OR Apache-2.0).
- Inspected at tag `v0.21.0`, commit `8c0f7658a3cadea9c9b303bd1cc80b5108328bc6` ("Release: CADCraft v0.21.0 (main 66931918cb)", 2026-11-28), on 2026-12-03; the v0.20.1 ref (`7526dc62c14e71b3c8d46e73bbf1fa29ef506af1`) was used for the delta and count cross-checks. The installed GUI bundle `/Applications/CADCraft.app` is version 0.21.0, bundle id `ai.storyteller.cadcraft`, and its binary printed `cadcraft 0.21.0 (8c0f7658a3cadea9c9b303bd1cc80b5108328bc6)`; its `--help` output is the start-flag and environment list in How to operate. `Contents/MacOS/` holds no CLI, and no `cadcraft-cli` is installed on this machine, so every count was derived from source. The launcher auto-updates, so **verify against your installed version**.
- Key files read: `README.md`, `ROADMAP.md`, `SECURITY.md`, `Cargo.toml`, `docs/{gaps,parity-checklist,target-app-parity,file-format-parity,control-protocol,mcp,cli,customization,localization,plotters,pdf-import,ui-parity}.md`; `apps/cadcraft/src/{main.rs,launch_args.rs,control_server.rs,env.rs,workspace.rs,sheet.rs,apple_events.rs,single_instance.rs,portable.rs,launch_profile.rs,build_channel.rs}`, `apps/cadcraft-cli/src/{args.rs,lib.rs,roundtrip.rs,mcp.rs,run.rs,output.rs}`, `apps/cadcraft-web/src/{main.rs,host.rs,api.rs}`; `crates/engine/src/cmd.rs` and `crates/engine/src/cmd/{ucs.rs,annotate.rs,annotate/qleader.rs,interface.rs,exchange.rs,hatch.rs,hatch/edit.rs,layout.rs,table.rs,table/paste.rs,modify/extrim.rs,blocks.rs,blocks/library.rs,dimstyle_cli.rs,dimstyles.rs,props.rs,props/set.rs,file.rs,file/pgp.rs,plotters.rs}`, `crates/engine/src/{snap.rs,pointmod.rs,ucs.rs,keyboard.rs,array_live.rs,properties.rs,file_access.rs,file_access/commands.rs,autosave.rs,render_look.rs,lisp.rs,lisp/objects.rs,settings_dir.rs,mtext_edit.rs}`; `crates/io/src/{lib.rs,raster.rs,svg.rs,roundtrip.rs,dxf_clip.rs,dxf_raw.rs,dxf_read.rs,dxf_read/entities.rs,dxf_write.rs,dxf_write/proxy.rs,dxf_write/blocks.rs,pdf.rs,pdf_read.rs,plotter.rs}`, `crates/doc/src/{format.rs,library.rs,header.rs,entity/layout.rs,entity/proxy.rs,entity/dim.rs,dynblock/apply.rs,xclip.rs,raster.rs}`, `crates/fonts/src/{shx/mod.rs,ttf.rs,bidi.rs,mtext.rs}`, `crates/render/src/{raster.rs,linetype_text.rs}`, `crates/mcp/src/{tools.rs,server.rs,backend.rs,control_token.rs}`, `crates/ui-egui/src/{menus.rs,control.rs,i18n.rs,i18n/pl.tsv,i18n/ta.tsv,finddlg.rs,textdlg.rs,line_editor.rs,fault.rs,autosave.rs,canvas/images.rs,keys.rs,aliasdlg.rs,options.rs,options/dialog.rs,context_menu.rs,mtext_editor.rs,palettes.rs,blocks_palette.rs,managers/dimstyle.rs,arraydlg.rs,wblock.rs,attentry.rs}`, `xtask/src/{main.rs,parity.rs}`, `packaging/macos/{package.sh,Info.plist.in}`, `packaging/windows/cadcraft.wxs`, `packaging/linux/flatpak/ai.storyteller.cadcraft.yml`, `packaging/linux/flatpak/ai.storyteller.cadcraft.bundle.yml`; tests `crates/engine/tests/{panic_hunt.rs,it/mleader_text_edit.rs,it/extrim.rs,it/hatch_generate_boundary.rs}`, `crates/io/src/tests.rs`, `crates/io/tests/it/pdf_import.rs`, `crates/io/tests/{registered_proxy.rs,hard_owned_objects_kept.rs}`, `crates/ui-egui/tests/{alias_persistence.rs,it/options_right_click.rs,it/shortcuts_checked.rs,flatpak_updates.rs,it/pdf_import_dialog.rs}`, `apps/cadcraft-cli/tests/{mcp_roots.rs,mcp_roots_walk.rs}`.
- Shared libraries: all `storytold/craft-libs` crates pinned at `8fa4db64a9bb943520259ea95331a303ba788f21` (`craft-dxf`, `craft-dwg`, `craft-shx`, `craft-svg`, `craft-image-codecs`, `craft-mcp`, `craft-jsonrpc`, `craft-pdf`, `craft-docpath`, `craft-csv`, `craft-font-catalog`, `craft-update`, `craft-quit`, `craft-web-api`, `craft-web-host`); the DWG bridge is acadrust 0.6.6 through `craft-dwg` (MPL-2.0). Consulted read-only at that pin, not vendored.
- Read-only inspection: no build, no GUI launch, no drawing modified, no test run. The app binary was only run with `--version` and `--help`. Cross-check `evidence.md` for claim-by-claim tiering.

Files in this skill

  • SKILL.md18.6 KB
  • agents/openai.yaml145 B
  • evidence.md7.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.