Compile Documents
compile_documentsMerge project documents into a single manuscript in text, markdown, or HTML format. Standard mode joins in binder order; intelligent mode applies AI optimization for specific targets.
Instructions
Compile the project's documents into a single continuous manuscript in the requested format and return the compiled text (large results are spooled to a file reference). In "standard" mode it joins documents in binder order; in "intelligent" mode it uses AI to optimize the output for a specific target such as an agent query or synopsis. To write a manuscript to disk in a publishing format (EPUB, etc.) use export_project instead. Requires an open project.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | "standard" (default) joins documents in order; "intelligent" applies AI optimization toward targetOptimization. | |
| format | No | Output format of the compiled manuscript. Default "text". | |
| separator | No | Text inserted between documents in the standard-mode fallback. Default "\n\n---\n\n". | |
| documentIds | No | Optional explicit list of document ids to compile, in order. Overrides rootFolderId when provided; most useful with mode "intelligent". | |
| hierarchical | No | Preserve the binder folder hierarchy as headings. Default false. | |
| includeNotes | No | Include each document's notes in the output. Default false. | |
| rootFolderId | No | Optional binder folder id to compile only its descendants. Omit to compile all text documents. | |
| includeSynopsis | No | Include each document's synopsis in the output. Default false. | |
| targetOptimization | No | For mode "intelligent": what to optimize the compiled output for. Default "general". |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | File reference the compiled text was spooled to. Present only when the result was too large to inline. | |
| text | No | The compiled manuscript text. Present for small results; large results spool to a file instead. | |
| format | Yes | Format the manuscript was compiled to (text, markdown, or html). | |
| sections | Yes | Number of documents compiled into the manuscript. | |
| charCount | Yes | Character count of the compiled manuscript. | |
| wordCount | Yes | Word count of the compiled manuscript. |