DEV Community

Cover image for WordCraft Collab 1.0: An Open-Source Word Processor Where Humans and AI Agents Work Together
Hossam Taha
Hossam Taha

Posted on

WordCraft Collab 1.0: An Open-Source Word Processor Where Humans and AI Agents Work Together

What if multiple people and AI agents could edit the same Word document simultaneously, directly inside your application?

That is what I set out to build with WordCraft Collab.

WordCraft Collab 1.0 is an open-source, Word-style document editor built with Rust and WebAssembly. It brings real-time collaborative editing, comprehensive document capabilities, native Arabic and RTL support, and AI agent participation into one application.

It can run as a desktop application, command-line tool, or browser-based editor. It can also be embedded into existing websites using its companion integration package.

GitHub: https://github.com/hossamTahaHussein/wordcraft-collab

The idea behind the project

Document editing is a fundamental capability in many enterprise applications, content management systems, business platforms, and collaboration tools.

However, building a complete word processor is a significant engineering challenge.

I wanted to explore a different approach: a reusable, full-featured document editor that developers can integrate into their own applications, with collaboration built into the editing experience.

I also wanted AI agents to become actual participants in document workflows rather than simply external chat assistants.

1. Real-time collaborative editing

Multiple users can edit the same DOCX document simultaneously.

Every user's changes are reflected across connected browsers, with a collaboration mechanism designed to keep document replicas consistent.

Key capabilities include:

  • Live cursors and participant names
  • Real-time presence indicators
  • Automatic document saving
  • Saving and synchronization status
  • Shared undo and redo, while preserving individual edit ownership
  • Per-user suggesting mode
  • Edit, suggest, comment, and view permissions
  • Version history with preview and restore
  • Offline protection with read-only fallback and Save My Copy

A collaborator's suggested rewrite shown in magenta with the old sentence struck through, and a comment balloon in the margin

How collaboration works

Every edit is represented as a WordCraft command.

Each browser applies its own edits immediately. A lightweight relay server orders incoming edits, and each connected replica replays the ordered operations while rebasing its own unconfirmed changes.

This architecture allows multiple users to work concurrently without requiring every keystroke to wait for a server response.

The collaboration implementation includes replica management, rebasing, position mapping, selective undo, and protocol handling.

2. Arabic and RTL support

Arabic support was a major consideration in this project.

Rather than treating RTL as a simple text-direction setting, the implementation covers the editor interface, document structure, formatting, and exported files.

The Arabic interface: the ribbon, rulers and status bar mirrored, with an Arabic document and a collaborator's caret labelled in Arabic

Interface support:

  • Fully translated Arabic interface
  • Mirrored ribbon, menus, dialogs, panes, rulers, and status bar
  • Arabic interface through ?lang=ar or system language detection

Document support:

  • Right-to-left paragraphs, tables, and sections
  • Mixed Arabic and English text
  • Correct text ordering
  • Kashida justification
  • Arabic spell checking

File support:

  • RTL preservation in DOCX, HTML, ODT, and RTF
  • Searchable and selectable Arabic text in exported PDFs
  • Noto Sans Arabic font bundled with the application
  • Ayaspell Arabic dictionary bundled for spelling support

Arabic is not an additional plugin or an external dependency. It is part of the editor itself.

3. AI agents as document collaborators

One of the most interesting capabilities is integrating AI agents directly into collaborative documents.

Using the Model Context Protocol (MCP), an AI agent can join a shared document as a named participant:

wordcraft-cli collab-mcp
Enter fullscreen mode Exit fullscreen mode

Agents can:

  • Execute document editing commands
  • Insert and modify content
  • Suggest changes
  • Comment on document sections
  • Reply to comments
  • Identify other participants
  • Wait for document changes
  • Inspect document structure and content

Agents operate in suggesting mode by default, allowing human users to review and accept or reject proposed changes.

This creates a different interaction model: instead of copying content between a chatbot and a document, the AI agent works within the document collaboration workflow.

4. Developer integration

WordCraft Collab is designed to be embedded into other applications.

The companion wordcraft-embed project provides the JavaScript SDK, collaboration relay server, and server-side API.

JavaScript SDK

The SDK provides access to the editor's 649 commands through a unified interface:

run(command, params)
Enter fullscreen mode Exit fullscreen mode

It also exposes operations including:

  • getText
  • getDocument(format)
  • inspect
  • insertText
  • select
  • setReadOnly
  • change events
  • selectionchange events
  • presence events
  • comment events

Server-side integration

The collaboration relay exposes an HTTP API for:

  • Retrieving document information
  • Exporting documents as DOCX, PDF, or text
  • Sending commands as live document edits
  • Removing participants
  • Closing documents

It also supports HMAC-signed webhooks for events including:

  • joined
  • left
  • saved
  • edited
  • commented
  • restored

This allows host applications to integrate document collaboration into their existing business workflows.

5. A complete word-processing experience

WordCraft Collab is not just a collaborative text editor.

It includes a broad range of document creation, formatting, layout, review, and publishing capabilities.

The Review tab with Track Changes on and comment balloons joined to the text by dashed leader lines

Writing and formatting

  • Smart quotes and AutoCorrect
  • Lists and automatic list formatting
  • Clipboard operations with formatting
  • Find and replace with regular expressions
  • Font families, sizes, colors, and character spacing
  • Bold, italic, underline, strikethrough
  • Superscript and subscript
  • Format Painter and Change Case

Paragraphs and styles

  • Alignment and indentation
  • Line and paragraph spacing
  • Tabs, leaders, borders, and shading
  • Built-in styles and custom styles
  • Style galleries and themes
  • Widow and orphan control

The Design tab with style-set previews, a serif theme with plum headings and a pale DRAFT watermark

Tables and pages

  • Table insertion, merging, and splitting
  • Table styles and repeated header rows
  • Table sorting and formulas
  • Page margins, orientation, and sizes
  • Multiple columns and section breaks
  • Headers, footers, and page numbers
  • Watermarks and page borders

The Layout tab: a drop cap, text wrapping around a shape, automatic hyphenation, line numbers and a page border

Images and objects

  • Image insertion, cropping, resizing, and rotation
  • Brightness and contrast adjustments
  • Transparency and background removal
  • Shapes and text boxes
  • Floating objects and text wrapping

References and review

  • Tables of contents
  • Footnotes and endnotes
  • Citations and bibliographies
  • APA, MLA, Chicago, and IEEE styles
  • Captions and cross-references
  • Index and table of authorities
  • Spelling and grammar suggestions
  • Comments and track changes
  • Accept and reject changes
  • Document comparison
  • Accessibility checking and document inspection

The References tab: a table of contents with dotted leaders on page one, and a styled table, numbered list and hyperlink on page two

Mailings

  • Mail merge from CSV
  • Merge fields
  • Address blocks and greeting lines
  • Preview and document generation
  • Envelopes and labels

Viewing

  • Print layout, web layout, and draft mode
  • Read mode and focus mode
  • Zoom and multiple-page views
  • Navigation pane and rulers
  • Gridlines and dark mode

WordCraft in dark mode with the Insert tab open and formatting marks shown

6. Multiple document formats

The editor supports reading and writing DOCX files, including importing legacy Word 97–2003 DOC files.

Other supported formats include:

  • PDF export
  • ODT
  • RTF
  • HTML
  • Markdown
  • LaTeX
  • Plain text
  • Page images

The objective is to make document creation and conversion available through the same underlying document engine.

7. Desktop, browser, and command line

The project is not limited to a browser-based editor.

It provides three application entry points:

Desktop application

A full desktop word processor with a sample document and support for opening existing documents.

The File tab start page with templates and a list of recent documents

Browser application

A WebAssembly-powered editor that runs in the browser and supports real-time collaboration.

Command-line interface

The CLI enables document conversion, text extraction, inspection, and automated document editing.

For example:

wordcraft-cli convert report.docx report.pdf
wordcraft-cli text report.docx
wordcraft-cli inspect report.docx
Enter fullscreen mode Exit fullscreen mode

You can also execute document operations through command sequences or JSON scripts.

8. Architecture and technology

The project is built around a layered Rust architecture.

Layer Components
L0 Geometry and measurements
L1 Document model, fonts, spelling and grammar
L2 Layout, pagination, DOCX and other formats
L3 Rendering and PDF generation
L4 Editing engine, sessions, undo/redo, 649 commands
L5 MCP server and collaboration engine
L6 UI built with egui
Applications Desktop, CLI and WebAssembly browser application

The browser application uses Rust compiled to WebAssembly.

The architecture separates document modeling, editing, rendering, collaboration, and user interface responsibilities.

This makes it possible to expose the same underlying document capabilities through different application interfaces.

9. Testing and reliability

Collaborative editing requires more than verifying that two users can type simultaneously.

The project includes:

  • Randomized multi-user convergence tests
  • Undo and redo collaboration tests
  • Unit tests
  • End-to-end tests with three browser instances
  • Relay restart testing
  • AI agent integration testing against the actual collaboration relay

The CI workflow runs formatting checks, Clippy, approximately 800 tests, asset attribution checks, architecture layering checks, and the WebAssembly build.

10. Getting started

Clone the repository:

git clone https://github.com/hossamTahaHussein/wordcraft-collab
cd wordcraft-collab
Enter fullscreen mode Exit fullscreen mode

Run the desktop application:

cargo run --release -p wordcraft -- --sample
Enter fullscreen mode Exit fullscreen mode

Open an existing document:

cargo run --release -p wordcraft -- report.docx
Enter fullscreen mode Exit fullscreen mode

Run the browser version:

cd apps/wordcraft-web
trunk serve
Enter fullscreen mode Exit fullscreen mode

Open http://127.0.0.1:8771/?sample

For the browser collaboration setup and embedding instructions, see the companion repository. A prebuilt web build is attached to the v1.0.0 release.

Open source and contributions

WordCraft Collab is dual-licensed under MIT or Apache-2.0, at your option.

The project is based on WordCraft by the ArtCraft team and its contributors. WordCraft Collab is an independent modified project and is not sponsored, affiliated with, or endorsed by the ArtCraft team.

The collaboration engine, Arabic and RTL improvements, integrations, and AI agent capabilities are part of WordCraft Collab.

Explore the repositories:

What's next?

Version 1.0 establishes the foundation for a different approach to document collaboration.

Coming in the next release: spreadsheet and presentation apps. WordCraft Collab will grow beyond documents, with a spreadsheet editor and a presentation editor joining the word processor.

I am particularly interested in expanding the possibilities around AI agents, document automation, and embedding collaborative editing into enterprise applications.

Imagine contracts, reports, proposals, and business documents where people and AI agents can work together, with changes visible, reviewable, and tracked.

That is the direction I want to explore.

I'd like to hear from developers:

What would you build if you could embed a complete word processor into your application and allow AI agents to collaborate directly with your users?

Contributions, feedback, and GitHub stars are welcome.

Website: https://hossamtaha.me

Top comments (0)