tldraw-offline

Drive tldraw offline canvases and write embedded document scripts via its local HTTP API.

Updated Sep 10, 2026
One-click install
npx skills add https://github.com/loteiron/ZeusAgent --skill tldraw-offline-loteiron
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tldraw-offline
Source: https://github.com/loteiron/ZeusAgent/tree/main/optional-skills/creative/tldraw-offline
Command: npx skills add https://github.com/loteiron/ZeusAgent --skill tldraw-offline-loteiron

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tldraw/tlschema, and includes scripts (resource) components.

What problem does it solve? Editing tldraw offline canvases by hand-placing shapes is slow and error-prone for an agent, and adding durable interactive behavior to a drawing requires knowing the app's document-script contract and local control API. This Skill teaches the agent to read and modify the open canvas through the app's localhost HTTP API and to write JavaScript document scripts that persist inside the .tldraw file. ## Core Features & Use Cases - Live canvas edits via /exec: Generate shapes, arrows, and layouts on the focused document using curl calls against the local API with the bearer token from server.json. - Durable document scripts: Edit script/main.js so reactive, animated, or clickable behavior (like a counter with MINUS/RESET/PLUS buttons) survives reloads and ships inside the .tldraw file. - Schema validation: Run scripts/validate_shapes.mjs to verify raw note/text/frame records against the real tldraw SDK v5 schema before building file snapshots. - Use Case: Ask the agent to turn an open tldraw document into an interactive wireframe with working buttons; it writes an idempotent document script, confirms script-status shows applied, and verifies clicks by dispatching pointer events. ## Quick Start Open tldraw offline with a document, then ask the agent to build a labeled architecture diagram with connected nodes on the current canvas.

Frequently Asked Questions about tldraw-offline

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I edit a tldraw offline canvas from an agent or script?▼

Use the app's local HTTP API: read the port and bearer token from server.json in the tldraw config directory, find the focused document via /api/search, then POST JavaScript code to /api/doc/:id/exec. The code runs with the live editor and helpers in scope.

How do I add interactive buttons to a tldraw canvas?▼

Write a document script in script/main.js that creates button shapes tagged with meta.action, then hit-test pointer_down events in page coordinates via editor.on('event'). Store state in a shape's meta and detach the listener on the AbortSignal so re-saves do not double-fire clicks.

Does tldraw offline work without an account or network?▼

Yes, local editing needs no account or network. The desktop app runs a localhost API (default port 7236) and only requires the bearer token from server.json; every request except GET / needs Authorization: Bearer <token>.

Why does my tldraw document script not run after saving?▼

The script only runs once the app's file watcher applies it; check GET /api/doc/:id/script-status for state applied. On Linux an exhausted fs.inotify.max_user_instances limit leaves it in not-watching state, which is a host limit rather than a script bug.

Why do I get 401 errors calling the tldraw local API?▼

Each terminal call is a fresh shell, so an exported token does not persist and an empty token returns 401. Re-read port and token inline from server.json at the top of every shell call instead of exporting once.

How do I make a scripted .tldraw file run without the consent dialog?▼

Add a script manifest with a sha256 digest to metadata.json, computed over each sorted script path and its content hash. Then pre-trust that digest in ~/.tldraw/script-trust.json so the app skips the Run Script consent prompt.