Leanpub Header

Skip to main content

ArtCraft: The Agentic Creative Studio in TypeScript

Headless Automation, MCP Servers, and Vision-Model Feedback for Photo, Video, Vector, and Publishing Workflows

ArtCraft: The Agentic Creative Studio in TypeScript
This book is 100% completeLast updated on 2026-11-11

Minimum price

$24.00

$24.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

EPUB
About

About

About the Book

ArtCraft — About the Book

About the Book

Most “AI creative” tools generate a picture and stop. The output is a flat image, a video file or a PDF, and every aesthetic decision is welded into pixels the moment the model finishes. Changing the hero’s colour, moving a logo, localising a banner or re-cutting a video means generating again, and a new generation is not an edit — it is a reroll. The composition shifts, the product silhouette drifts, the typography changes, and the art director loses the frame they approved.

ArtCraft: The Agentic Creative Studio in TypeScript is about the other path. It treats a creative document as a layered, non-destructive artefact — a stack of live layers, masks, adjustment parameters, text runs, keyframes and timeline events — and treats the agent as a program that edits that stack through a typed command interface. The rendered PNG, MP4 or PDF is disposable. The document is the source of truth.

Across twenty chapters, the book builds that idea from the command registry up to a complete creative studio. Every runnable listing is in a public repository, and every listing has a harness that executes it against the real ArtCraft engines and asserts on the artefacts those engines produced. Nothing in the book is proved by a mock.

Layered artefacts, not screenshots

The first power move is the one everything else depends on: the agent does not return an image, it returns a document. A PhotoCraft file keeps its layers, clipping masks, adjustment layers, smart-object links, history and layer comps. A VectorCraft file keeps editable paths and live booleans. A FilmCraft project keeps a sample-accurate timeline. A DesignCraft document keeps spreads, threaded frames and live typography. A WordCraft document keeps styles and fields. The agent can reopen any of them and change one decision without rebuilding the rest.

That is what makes automation safe. An agent that corrupts a layered document has damaged an artefact, not destroyed the knowledge that produced it. A pipeline that stores only a flat export has thrown that knowledge away.

Agents that drive real engines, not a demo API

The book connects TypeScript agents to the actual ArtCraft command-line tools over the Model Context Protocol. You will see how the engines expose more than five hundred commands through a self-describing registry, how the MCP bridge turns that registry into typed tools an LLM can call, and how the same commands are reachable over a high-speed JSON-lines TCP loopback channel when a local agent needs a sub-millisecond path into a running session.

The point is not “call a tool”. The point is that the agent’s tools are the engine’s operations: layer.newAdjustmentLayer.levels, object.pathfinder.unite, timeline.place, sequence_inspect, doc_save, doc_export. The book shows how to keep that surface typed, permissioned and auditable instead of letting a model invent tool names.

A feedback loop with eyes

Some of the most useful chapters close the loop between generation and judgement. An agent renders a frame or a banner, a vision model inspects it, and the agent corrects the document through the same command interface. You will see a multimodal loop that detects a clipped amount, a low-contrast total, an offscreen control or a layout overlap, then applies a deterministic adjustment rather than regenerating the whole composition.

The book is careful about what that loop can and cannot prove. A model judge has variance; a visual audit is a sample. The chapters on measurement, agreement and attribution show how to put an interval around the result and how to tell which part of the pipeline actually moved.

From raster to vector to time

The middle of the book moves through the media the studio actually ships.

  • Raster: layered PSD manipulation, clipping masks, OkLCh curves and a high-throughput RAW development pipeline with 32-bit float grading, culling and export tiers.
  • Vector: cubic Béziers, live blends, pathfinder booleans and a brand-mark generator that keeps every path editable.
  • Commerce: a banner factory that turns a JSON product feed into scaled, multi-layer, channel-specific graphics — the same recipe at 1080×1350, 1920×1080 and every size in between.
  • Time: FilmCraft’s integer timebase, exact conversion between 23.976, 25, 29.97 and 48 kHz, frame-accurate placement, ripple trimming and autonomous B-roll assembly.
  • Sound and colour: three-way Lumetri wheels, dialogue-aware ducking and loudness governance in one deterministic pass.
  • Motion: keyframed rigs, value graphs, expressions, shape layers, Lottie export and VP9 video with alpha.

Each of those chapters is a working project, not a survey. The harness proves the artefact: the EDL, the parity report, the MP4, the Lottie JSON, the layered PSD.

Publishing, money and governance

The last part takes the same discipline into documents and spreadsheets. DesignCraft builds editorial spreads with threaded frames and Knuth-Plass typography. WordCraft authors native DOCX files; PdfCraft adds metadata, watermarking, redaction, permission hardening and a PAdES signature, with an audit trail for every mutation. GridCraft builds multi-sheet financial models and audits them for broken references, circular dependencies and lineage gaps; DeckCraft turns the audited numbers into a board deck.

The final chapters treat the studio as a service. A single Studio Policy is transpiled into the native configuration of Cursor, Claude Code and OpenCode, so the same MCP servers, file sandboxes and permission envelope exist in every agent context. The capstone composes all of it: a brief enters, a layered artefact is built, a motion derivative is rendered, a publication is produced, and a vision audit decides whether the result is good enough to ship.

The repository is part of the book

The code is not a download of snippets. It is a working repository:

https://github.com/edgarmilvus/artcraft-book

It contains all twenty chapters, 154 harnesses, the engine installers, the Docker path and a snapshot of the artefacts from a verified full run. Every listing in the book is byte-identical to the file in the repository. Every harness prints the assertions it ran and writes a log next to the code it exercises.

One harness runs with nothing but Node and npm — no engines, no Docker — which is the fastest way to see the style of the book. The projects that drive the real engines need either macOS with the Apache-2.0 ArtCraft CLIs or the Docker image that carries the same binaries.

Who this book is for

It is for developers who have shipped something and want to know what breaks next: comfortable with TypeScript, unafraid of a log, and more interested in what the artefact does than in what the demo looked like.

It is also for creative technologists and pipeline engineers who know what a layer stack, a timeline or a press-ready PDF is, and want to automate them without giving up editability. And it is for technical leads who need a vocabulary for the failure modes: a flat export that cannot be revised, a model judge with variance, a command the engine does not have, a permission that leaked into the wrong agent.

Prerequisites

On the machine

  • Node.js 22.5 or later and npm.
  • Python 3.10+ for the native macOS path.
  • macOS 14+ if you want to run the ArtCraft engines natively; otherwise Docker.
  • About 4 GB of disk for the engine binaries, or the Docker image.
  • The repository clone is about 90 MB.
  • Model API keys are needed only for the chapters that call a language or vision model. The engine-backed harnesses do not need one, and every live path reads the same three variables, so one endpoint — a router, a vendor, a local server — covers the whole book. Each chapter README states what it needs.
  • No prior knowledge of MCP is required. The book introduces the protocol through the code that uses it.

What you should already be able to do

  • Write TypeScript at a working level. Generics, discriminated unions, async/await, structural typing, and the difference between a type and a runtime check. If you have shipped a Node service in TypeScript, you are ready. If you have only written JavaScript, you will be reading ahead on the types, and that is the hardest part of the book.
  • Read a stack trace and a log. A large share of the work here is reading what came back: an assertion from the harness, a JSON-RPC error frame, a failed count in a batch reply, a checksum that does not match. The book teaches the syntax of those messages; it assumes you are not frightened by them.
  • Use a terminal without help. npm ci, chmod +x, docker compose run, ./run_all.sh, and occasionally killing a hung process. No shell scripting expertise, but you should be comfortable in a shell.
  • Know one creative tool, or be willing to learn its vocabulary. Layers, masks, adjustment layers, blend modes, artboards, sequences, keyframes, bleed and crop marks. The book explains every term that carries a decision, but it is not a Photoshop or Premiere tutorial. A reader who has never opened a layered editor will spend the first chapters learning two things at once.
  • Read and write JSON comfortably. Command parameters, MCP payloads and document contracts are all JSON. You do not need to like it; you need to see when a shape is wrong.

What you do not need

  • Machine learning, linear algebra or transformer internals. The model is treated as a service with a contract. Where a chapter touches vision or scoring, it says exactly what is being measured and stops there.
  • Prior MCP experience. The protocol is introduced through the code that uses it.
  • Rust. The engines are binaries. Chapter 2 explains what they do, not how to compile them.
  • A design or film background. You need the vocabulary, not the diploma. Taste helps when judging output; the harness tells you whether the artefact is structurally right.
  • A Mac. The Docker path runs the same binaries, and the one zero-dependency harness runs anywhere Node runs.

What it asks of you

  • Time. Each chapter is a project, not a blog post: an evening to read, an evening to run and break. Twenty chapters is a season of work, not a weekend.
  • Disk and bandwidth. Roughly 4 GB of engines, 90 MB of clone, about 8 GB for the Docker image. The first engine install is the slowest step in the book and the one most likely to fail; the repository documents what to do when it does.
  • Patience with the first run. Nothing here is mocked, so the first run of a chapter does real work against a real binary. A cold start is slower than a warm one, and a chapter that exports a large document can exceed the default 60-second MCP timeout on a small machine — the fix is one environment variable, not a code change.
  • A habit of checking the artefact. Open the PNG, play the MP4, unzip the DOCX. The book argues throughout that the rendered file is disposable and the document is the truth, which only works if you look at both.
  • An optional model key. If you want the vision and language chapters end-to-end, you need access to a model provider. The engine chapters do not, and the book marks clearly which is which.

What it does not ask of you

You do not need a GPU, a cloud account, an Adobe subscription, or a licensed copy of any creative suite. The ArtCraft engines are Apache-2.0, and the whole book runs on a laptop.

How to read it

The chapters are written to be read in order, because the later projects reuse the earlier contracts: the tool surface from the first part returns in the MCP bridge, the recording and attribution ideas return in the evaluation chapters, and the governance layer returns in the capstone. But each chapter is also a self-contained project with its own README, its own harness and its own artefacts, so you can start with the problem that looks most like your own.

Read the code with the harness open. The prose explains the decision; the harness proves the artefact. If the two ever disagree, trust the harness.

Table of contents

  • Chapter 1: The Death of Flat Generative Pixels - Why Production Demands Layered, Non-Destructive Creative Engines
  • Chapter 2: Inside the ArtCraft Architecture - 256² Sparse Tiles, Dual Compositors, and 500+ Command Registries
  • Chapter 3: Headless CLI Orchestration - Scripting PhotoCraft and DesignCraft in Docker and CI/CD Pipelines
  • Chapter 4: The Loopback Control Channel - Wiring High-Speed JSON-Lines TCP Sockets and Auth Handshakes
  • Chapter 5: The Model Context Protocol (MCP) Bridge - Exposing Native Creative Tools to Autonomous Coding Agents
  • Chapter 6: Automated PSD Manipulation - Layers, Clipping Masks, and OkLCh Curves via PhotoCraft MCP
  • Chapter 7: Multimodal Visual Feedback Loops - Driving Vision LLMs to Audit and Auto-Correct Photo Edits via ui.screenshot
  • Chapter 8: Programmatic Vector Engineering - Cubic Béziers, Live Blends, and Pathfinder Booleans in VectorCraft
  • Chapter 9: High-Throughput RAW Photographic Development - 32-Bit Float Grading and Culling in LightCraft
  • Chapter 10: E-Commerce Graphics Factory - Generating Scaled Multi-Layer Product Banners from Dynamic JSON Feeds
  • Chapter 11: Inside the Integer Timebase - How FilmCraft Manages Sample-Accurate Timelines and Zero Drift
  • Chapter 12: Autonomous Video Assembly - Cutting B-Roll, Syncing Dialogue, and Ripple Trimming via Agent Commands
  • Chapter 13: Three-Way Color Wheels and Loudness Governance - Automated Audio Ducking and Lumetri Grading
  • Chapter 14: Programmatic Motion Graphics - Rigging Keyframes, Value Graphs, and Shapes in EffectCraft
  • Chapter 15: Cross-Platform Lottie & VP9 Pipelines - Rendering Native Video and Web Animations Headlessly
  • Chapter 16: Automated Editorial Publishing - Spreads, Threaded Frames, and Knuth-Plass Typography in DesignCraft
  • Chapter 17: Headless Office Pipelines - Programmatic DOCX Generation and PDF Governance with WordCraft & PdfCraft
  • Chapter 18: Financial Engineering at Scale - Managing Multi-Sheet Formulas and Audits in GridCraft and DeckCraft
  • Chapter 19: Full-Stack Studio Governance - Integrating Cursor (.cursor/mcp.json), Claude Code, and OpenCode
  • Chapter 20: Capstone Project - The Autonomous Creative Studio: An End-to-End Multimodal Marketing and Publishing Engine

If printed, this ebook would span over 800 pages. Each chapter is structured into theoretical foundations, an annotated basic example, an annotated advanced example, and five coding exercises based on real-world scenarios with complete solutions.

(Not affiliated with the ArtCraft team. This repository and the book are an independent project)

Author

About the Author

Edgar Milvus

A veteran software engineer with 20 years of experience, I have dedicated my career to the art of automation. My philosophy is simple: programming should eliminate repetitive chores to unlock human creativity. This journey began early on with the development of custom code-generation tools and has evolved into a deep mastery of LLMs and their APIs. Today, I specialize in architecting AI-driven solutions that handle everything from complex coding and security tasks to advanced knowledge retrieval, transforming the way we interact with technology

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub