WordCraft: The Rust Rewrite That Treats Microsoft Word Like a Data Structure

A clean-room word processor with .docx ambitions, copy-on-write editing, GPU rendering, and an agent-friendly control plane.

9 min read • View on GitHub • More from storytold

A wide editorial scene shows a dense office document being rebuilt on a drafting desk. On one side sits a heavy stack of paper pages, ribbon tabs, and correction marks. On the other is a precise mechanical blueprint made of nested blocks, paths, and object slots, with a Rust wrench and a GPU-lit lamp nearby. The image explains that WordCraft is not copying Word’s surface, but reconstructing it as an engineered system.
WordCraft treats document editing like systems design: persistent structure, predictable updates, and a rendering stack built for control.
Key Takeaways

The document is not a UI. It is a tree of snapshots.

WordCraft starts with a premise most editors avoid: the document should be a durable structure first, and a screen second. In crates/doc, content lives in an Arc-backed tree, edits use copy-on-write mutation, and navigation happens through explicit paths instead of ad hoc widget state.

That matters because it makes the document safe to freeze. A render pass can hold onto one snapshot while the user keeps typing into the next one, and the model still stays coherent. Undo becomes a property of the structure, not a separate pile of patches.

One edit moves through commands, snapshots, revisions, and layout invalidation instead of forcing a full document rebuild.

DimensionWordCraftTraditional desktop editor
Document modelPersistent tree with copy-on-write editsMostly mutable UI state plus internal caches
AddressingExplicit paths into nested contentOften implicit selection and widget coordinates
Undo and snapshotsCheap because prior states remain shareableUsually backed by a separate command history
RenderingReads from frozen snapshots while edits continueOften coupled more tightly to live UI state
Agent controlCommands are first-class and addressableAutomation is usually bolted on later

Why paragraphs are strings with hidden object slots

One of the cleanest ideas in the repo is the paragraph model. A paragraph is mostly text, but embedded objects such as images, bookmarks, and fields are represented by slots tied to the Unicode object replacement character, U+FFFC. The string keeps the reading order, and the object list keeps the non-text payloads.

A close-up shows a single paragraph rendered like a ledger strip. Text runs left to right, but several replacement placeholders appear as numbered sockets embedded in the line. Small image, field, and bookmark components plug into those sockets with precision, showing how text and inline objects share one layout path.
WordCraft keeps inline objects inside the paragraph flow without turning the paragraph into a zoo of special cases.

That trick does two jobs at once. It simplifies traversal, because the text flow still reads like text. It also gives the layout engine a stable coordinate system for inline objects, which is exactly what a word processor needs if it wants predictable pagination.

The layout engine only recomputes what changed

WordCraft tracks revision state so layout can invalidate locally instead of repainting everything on every keystroke. That makes the editor feel like a system that preserves identity. A paragraph can change without forcing the whole document to forget what it already knows.

pub fn next_rev() -> u64 {
    REVISION.fetch_add(1, Ordering::SeqCst) + 1
}

// Layout caches can key off revision IDs
// and only recompute affected paragraphs.

The practical payoff is simple. Editing a document is not treated as a global event. It is treated as a bounded mutation that can be shaped, measured, and redrawn with as little collateral damage as possible.

Word compatibility without inheriting Word’s codebase

The clean-room strategy is the point. WordCraft wants the behaviors users expect from Word, especially around .docx, styles, and layout fidelity, without importing Microsoft’s implementation history. That is a much harder path than building a Markdown editor, but it is also the only path that can plausibly reach office-suite territory.

TargetWhat it offersWhat WordCraft is trying to do differently
Microsoft WordDeep compatibility and a familiar workflowMatch the workflow without the proprietary stack
LibreOfficeOpen-source suite breadthUse a smaller Rust codebase with modern rendering choices
OnlyOfficeStrong .docx handling in a web-tech packageAim for native performance and a lighter runtime
Block editorsFlexible knowledge captureKeep the paginated document as the primary mental model

Paragraph layout is cached, so typing in a 188-page document re-lays it out in about 1.4 ms; pages render on demand.

ArtCraft Team, Project Organization · WordCraft README

That quote matters because it defines the performance story better than any benchmark graph could. WordCraft is not promising magical speed in the abstract. It is promising that the document model is structured enough for the fast path to exist at all.

The agent-first editor

WordCraft’s most unusual feature is not that it can be automated. It is that automation is built into the shape of the app. Commands have IDs, the control surface can be reached through JSON, and the same actions can be driven from the CLI or through MCP.

WorkflowHuman-first editorsWordCraft
Input modelClick or type directlyCommands can come from UI, CLI, or agent protocols
AutomationExtra scripting layerCore actions are addressable by ID
State changesOften hidden inside the appExplicit enough to trace and replay
Best fitSingle-user editingHuman and agent collaboration

Rust is the constraint, and the advantage

Rust is doing more than providing syntax here. It is shaping the architecture. The repo’s zero-unsafe posture, persistent data structures, and GPU-backed rendering stack all fit together because the language pushes the project toward explicit ownership and clear boundaries.

That matters in a desktop app that has to juggle text shaping, layout, input latency, and graphics drivers. WordCraft uses egui for the UI and wgpu plus vello for rendering, which keeps the app native without drifting into Electron-style abstraction debt.

Generating illustration...

The stack is a series of narrow components, not a monolith, which is why the app can stay native and still aim for office-grade fidelity.

The result is a rare combination. It is a system app with the safety profile of Rust, but it is still trying to solve one of the oldest and most user-hostile software categories on earth.

The hard part is not writing. It is matching expectations.

This is where WordCraft runs into the real competition. It is not just fighting Microsoft Word. It is fighting muscle memory, formatting trust, and the assumption that documents should survive round trips through enterprise workflows without surprises.

ProjectStrengthWhere WordCraft is different
Microsoft WordDefault standard for document workflowsWordCraft tries to reach compatibility without the proprietary core
LibreOfficeBroad open-source office coverageWordCraft narrows focus to a modern word processor stack
OnlyOfficeStrong document interoperabilityWordCraft emphasizes native Rust and agent control
AppFlowy / AnytypeFlexible block-based organizationWordCraft keeps pagination and traditional document structure first

What WordCraft is really building

WordCraft is not merely a better editor. It is a proof that a modern systems-language stack can attack a category usually left to giant incumbents and legacy codebases. If it works, the deeper achievement is not only .docx compatibility or faster redraws. It is the idea that a document app can be both human-friendly and machine-addressable without collapsing into a toy.