Documents with Scientific Intelligence
Stencila is a platform for creating and publishing, dynamic, data-driven content. Our aim is to lower the barriers for creating truly programmable documents, and to make it easier to publish them as beautiful, interactive, and semantically rich, articles and applications. Our roots are in scientific communication, but our tools are useful beyond.
This is v2 of Stencila, a rewrite in Rust focused on the synergies between three recent and impactful innovations and trends:
Conflict-free replicated data types (CRDTs) for de-centralized collaboration and version control.
Large language models (LLMs) for assisting in writing and editing, prose and code.
The blurring of the lines between documents and applications as seen in tools such as Notion and Coda.
We are embarking on a rewrite because CRDTs will now be the foundational synchronization and storage layer for Stencila documents. This requires fundamental changes to most other parts of the platform. Furthermore, a rewrite allow us to bake in, rather than bolt on, new modes of interaction between authors and LLM assistants and add mechanisms to mitigate the risks associated with using LLMs (e.g. by recording the actor, human or LLM, that made the change to a document). Much of the code in the v1 branch will be reused (after some tidy-ups and refactoring), so v2 is not a complete rewrite.
Our general strategy is to iterate horizontally across the feature set, rather than fully developing features sequentially. This will better enable early user testing of workflows and reduce the risk of finding ourselves painted into an architectural corner. So expect initial iterations to have limited functionality and be buggy.
We'll be making alpha and beta releases of v2 early and often across all products (e.g. CLI, desktop, SDKs). We're aiming for a 2.0.0 release by the end of Q3 2024.
Stable • Beta • ⚠️ Alpha • Under development • Experimental • Planned • ❔ Maybe
The Stencila Schema is the data model for Stencila documents (definition here, generated reference documentation here). Most of the schema is well defined but some document node types are still marked as under development. A summary by category:
| Category | Description | Status |
|---|---|---|
| Works | Types of creative works (e.g. Article, Figure, Review) |
Stable (mostly based on schema.org) |
| Prose | Types used in prose (e.g. Paragraph, List, Heading) |
Stable (mostly based on HTML, JATS, Pandoc etc) |
| Code | Types for executable (e.g. CodeChunk) and non-executable code (e.g. CodeBlock) |
Beta (may change) |
| Math | Types for math symbols and equations (e.g. MathBlock) |
Beta (may change) |
| Data | Fundamental data types (e.g. Number) and validators (e.g. NumberValidator) |
Beta (may change) |
| Flow | Types for control flow within a document (e.g. If, For, Call) |
Beta (may change) |
| Style | Types for styling parts of a documents (Span and Division) |
Beta (may change) |
| Edits | Types related to editing a documents (e.g. InstructionBlock) |
Beta (may change) |
In v2, documents can be stored as binary Automerge CRDT files, branched and merged, and with the ability to import and export the document in various formats. Collaboration, including real-time, is made possible by exchanging fine-grained changes to the CRDT over the network. In addition, we want to enable interoperability with a Git-based workflow.
| Functionality | Description | Status |
|---|---|---|
| Documents read/write-able | Able to write a Stencila document to an Automerge binary file and read it back in | ⚠️ Alpha |
| Documents import/export-able | Able to import or export document as alternative formats, using tree diffing to generate CRDT changes | ⚠️ Alpha |
| Documents fork/merge-able | Able to create a fork of a document in another file and then later merge with the original | Planned |
| Documents diff-able | Able to view a diff, in any of the supported formats, between versions of a document and between a document and another file | Planned |
| Git merge driver | CLI can act as a custom Git merge driver | Planned |
| Relay server | Documents can be synchronized by exchanging changes via a relay server | Planned |
| Rendezvous server | Documents can be synchronized by exchanging changes peer-to-peer using TCP or UDP hole punching | ❔ Maybe |
Interoperability with existing formats has always been a key feature of Stencila. We are bringing over codecs (a.k.a. converters) from the v1 branch and porting other functionality from encoda to Rust.
| Format | Encoding | Decoding | Coverage | Notes |
|---|---|---|---|---|
| JSON | ||||
| JSON5 | ||||
| JSON-LD | ||||
| CBOR | ||||
| CBOR+Zstandard | ||||
| YAML |
No open issues yet, or sync has not completed.