Documents go back out as files.
In October we taught loomcycle to read a pile of files; in November we taught it to hand back a finished document a person can send.
1. Half of a loop
In October we wrote about the way in. A Word file, a PDF, a scanned page, a recording of a meeting: loomcycle can now take each of them and turn it into a Document. A Document in loomcycle is not a file. It is a tree of chunks stored in the runtime: a title at the root, sections under it, paragraphs, tables and pictures under those. Agents can read it a section at a time, edit one paragraph without touching the rest, and keep a history of every change.
That shape is good for agents. It is not something you can attach to an email.
We felt this gap while working on a document-based reference system we are building. Material came in from everywhere and ended up as clean, linked Documents. Then someone asked for "the version I can send to the committee", and the answer was to copy text out by hand. The runtime knew everything about the document and still could not give a person a file.
Between November 16 and November 27 we closed that loop. This post walks through what we built, in the order we built it.
2. One new verb: render
The File tool already had import, which reads a file and makes a Document. In v1.155.0 it gained the reverse: render. You name a document, pick a format, and the runtime writes the file.
The first four formats were Markdown, HTML, Word and PDF:
- Markdown is clean text, with the pictures written as files in a folder beside it.
- HTML is one self-contained page with the pictures inside it.
- Word uses Word's own heading styles, so the outline pane and the table of contents in Word just work. Lists, tables, pictures and links come along, and the document's status goes into the file's properties.
- PDF is typeset pages, with page numbers, an optional table of contents with page numbers, internal links and pictures.
Here is a call taken from the tool's help, asking for a printable PDF of a set of board minutes on letter paper, with a table of contents:
{"op": "render", "doc_path": "/board/2026/minutes", "scope": "tenant", "format": "pdf", "toc": true, "page_size": "letter"}
One thing about this is easy to miss. The agent that makes this call never sees the document's text or the file's bytes. The runtime reads the document, writes the file, and hands back a reference: where the file is, its format, size and checksum, and a short report of what went in. The report counts sections, pictures and tables, and it says what was left out, for example a picture in a format the file cannot hold.
The render goes through the same gates as reading the document. If you cannot read it, you cannot render it. A link to another part of the same document becomes a link inside the file. A link to another document becomes its Web UI address when the server has a public address and the reader may open it, and plain text otherwise. Text in the document never becomes markup or script in the file. In a PDF, every piece of text goes into the typesetter as a string, never as instructions. We use Typst for the typesetting, and the source we hand it reads no file beyond its pictures and touches no network.
A document marked draft or review gets a small Draft or Review label beside its title, so nobody mistakes a working copy for the final one.
3. Every render leaves a note on the document
Each document now keeps a render log. Asking for a document shows the newest render per format, and its history can list all of them. This answers a question that comes up the moment files start leaving the system: which version did we send?
The log also makes renders cheap to repeat. If an earlier render of the same content with the same options is still sitting unchanged in its volume, loomcycle reuses it instead of writing it again.
4. A download button for people
An agent writing a file into a volume is useful. A person in front of the Web UI wants a button.
In v1.156.0 the document toolbar's two separate export buttons became one download menu: PDF, Word, HTML, Markdown and Canvas. Behind it is a plain HTTP route, GET /v1/_document/export/{id}, that takes the format and the same options as the tool. The file arrives named after the document's title. For programs, the TypeScript client gained exportDocument, which returns the file and its name.
For people who work from an editor, there is MCP file op=render without a run. Before this, every File tool call over MCP needed a run to belong to. Now render can write a document from your own scopes into a read-write volume of your tenant, under the same rules as keeping a file. The first version of this was refused by an over-careful check; v1.157.0 fixed that, so it works as it was meant to.
Every download through the route is audited and gets its own row in the document's render log. If the audit record cannot be written, the file is not served.
5. Two more formats: OpenDocument and EPUB
In v1.158.0 we added two formats people kept asking about:
- OpenDocument (.odt), the same content written with LibreOffice's own style names, so it opens as a native file there.
- EPUB, an e-book with a page per top-level section, a contents list and the pictures inside it.
Both are in the tool, the download menu, the route and the TS client. Our test pipeline opens every ODT in LibreOffice and runs the standard EPUB checker on every e-book.
6. A file that remembers where it came from
This is the part we like most.
A rendered file normally carries no ids. A file you send to someone outside should be just a file. But sometimes the file is the working copy: you send a Word file to a colleague, they fix three paragraphs and move a section, and they send it back. Without help, importing that file makes a brand new Document, and the link to the original is lost.
So a render can now take metadata: embed. The file then carries loomcycle's record of the document: its id, each chunk's id, type, status, tags and fields, and the relations inside the document. It never carries the document's provenance, and it carries no text beyond what the file already shows. Each format has its own hiding place for this record, for example a custom XML part in Word and a small JSON file inside ODT, EPUB and PDF.
In v1.159.0 the other half arrived. File op=import with reimport and the document's id reads such a file and matches its parts by those ids. A part that did not change stays as it is. A part that moved, moves. A part that was edited is superseded, so the old wording stays in the history. A PDF has no anchors on its headings, so there the parts are matched by their text. An import without reimport still makes a new document, but its provenance records which document it was rendered from.
A file can now leave loomcycle, be edited by someone who has never heard of it, and come back onto the same document without losing its history.
7. The house style
Every organisation that sends documents has a look: a font, a colour for headings, a logo, a footer that says "Confidential". In v1.159.0 a tenant can describe that look once.
A house style is itself a Document in the tenant's tree. Its text is a small JSON object, and its first picture becomes the logo above the title. It sets the font, the size, the heading scale, colours, page size and margins, a header and footer line, page numbers and the logo width. If a style exists at /render/styles/default, every render in that tenant uses it, unless the caller asks for another style or for none. Markdown is never styled.
We made one firm choice here. A style with an unknown key or a value out of range refuses the render and names the key. It never quietly falls back to the built-in look: a file sent out in the wrong style is a mistake nobody notices until the reader does.
8. Diagrams become pictures, and the operator picks the tools
Many of our documents hold Mermaid diagrams: small text blocks that describe a flowchart or a sequence. In a file meant for a person, the text of a diagram is useless. Since v1.160.0, when the server has a diagram renderer, each Mermaid block is drawn as a picture at twice its size so it stays sharp. The diagram's source becomes the picture's alt text. Markdown keeps the source, since that is what Markdown readers expect.
A diagram the renderer cannot draw stays a code block and the render goes on. The report counts how many were drawn and how many stayed code, and says so when the server has no renderer at all.
The same release lets an operator choose the PDF typesetter and the diagram renderer with two settings, instead of relying on whatever is on the server's path. It also lets you render an HTML file, and a Markdown file whose pictures were written by an earlier extract, so a file that came in can go straight back out in another format.
9. The last mile of typography
The final week went into the details that make a file look like it came from a real office rather than a program.
- Page text with counters (v1.170.0). A header or footer can be one line or three slots, left, centre and right, with
{page},{pages},{title}and{date}. "Page 3 of 12" works in PDF, Word and ODT. A single render can override the style's header and footer withpage_text, and a style can be passed inline as JSON without a style document at all. - Heading looks (v1.171.0). Each heading level can have a rule under it, be shown in capitals, and have its own weight.
- Four house fonts (v1.172.0). Besides the built-in sans and serif, a style can ask for Inter, Calibri, Arial or Times. A PDF uses a free twin with the same letter widths for the last three, so lines and pages break where they would in the real font. A Word or ODT file names the real font.
- A photo beside the title (v1.172.0). A picture can sit to the left or right of the title, or above it, square or round. It can come from the render call or from the document's own first picture.
That last one sounds small, but it turns a rendered document into a one-page profile with a face on it.
When we started the import work in October, a file going into loomcycle was the end of its story. Now it is the middle. A pile of scans, recordings and Word files goes in, agents work on the Documents they become, and a finished file goes out in the house style, with a log of what was sent and a way back in if someone edits it.
If you run loomcycle, the place to start is the File tool's render help topic and the "Getting a file out" section of the documents guide. Try one document in each format and read the report: if something is left out, it will say so, and we would like to hear about it.