← All craftbooks

Word Document from Content or Research

Knowledge and researchevalv1.2.4released 2026-09-07workflow: build-loop

Turn supplied content or a researched question into a real Word document (.docx, plus PDF on request) with DocBlocks. The workflow inventories sources, writes the reviewed source as Markdown, then converts, previews, and saves the finished file without hand-built document XML or an HTML intermediary.

Steps

Entry step: scope. Each step names the specialist role it wants; the full working prompt is expandable.

  1. Scope the documentplannerentry

    Lock audience, source boundary, structure, requested formats, and acceptance criteria.

    Show working prompt
    Scope the document before writing. 1. State the audience, purpose, and decision/takeaway. 2. Inventory the supplied content and named workspace files. Decide whether the user asked for new research; if not, explicitly prohibit adding outside facts. 3. Lock the section order, citation style when relevant, and whether the durable output is DOCX only or DOCX plus PDF. 4. Identify tables, figures, and existing media assets that must survive conversion. 5. Write acceptance criteria covering source fidelity, section coverage, citations when needed, readable page layout, and real saved binary files in artifacts. Write {{workPath}}/scope.md and call write_task_note with the source boundary, section count, and target formats.
    
    Store `{{workPath}}/scope.md` in the artifacts drawer with `write_artifact`, then verify it with `read_artifact`; do not write this working file to the workspace.
    
    Read an exact workspace DOCX, PPTX, PDF, or XLSX source with `read_doc_as_markdown`; use `read_file` for text or Markdown. Keep the original file path in citations. Never interpret binary bytes as text or substitute a similarly named file.
  2. Prepare the source logresearcher

    Record supplied sources and gather new evidence only when research was requested.

    Show working prompt
    Prepare {{workPath}}/sources.md to the boundary in {{workPath}}/scope.md. If the user supplied the content and did not ask for research, list each supplied file or message section and the facts it contributes; do not browse or add outside claims. If new research was requested, gather credible sources, record title/publisher/date/URL or workspace path, extract only the facts relevant to the outline, and cross-check consequential claims. Assign stable citation keys when citations are required. Mark unsupported gaps rather than guessing. Call write_task_note with the source count and unresolved gaps.
    
    Open `{{workPath}}/scope.md`, `{{workPath}}/sources.md` from the artifacts drawer with `read_artifact` before working.
    
    Read an exact workspace DOCX, PPTX, PDF, or XLSX source with `read_doc_as_markdown`; use `read_file` for text or Markdown. Keep the original file path in citations. Never interpret binary bytes as text or substitute a similarly named file.
    
    Store `{{workPath}}/sources.md` with `write_artifact` and verify it with `read_artifact` before advancing.
  3. Write the Markdown documentcopywriter

    Write the complete {{sourceOutputPath}} source from the locked outline and source log.

    Show working prompt
    Write {{sourceOutputPath}} as the complete document source. 1. Follow {{workPath}}/scope.md section order exactly, starting with one H1 title and a concise opening summary. 2. Use clear H2/H3 sections and real prose grounded only in {{workPath}}/sources.md. 3. Use Markdown tables for structured comparisons and existing workspace images only when the scope calls for them; add meaningful alt text, captions, and in-prose references. 4. Cite claims with the locked style and include references when research was requested. 5. End with the requested conclusion, recommendation, or next steps. 6. Check every content criterion before advancing. Do not create DOCX XML, HTML, or base64. Call write_task_note with the path, word count, and section count.
    
    Open `{{workPath}}/scope.md`, `{{workPath}}/sources.md` from the artifacts drawer with `read_artifact` before working.
  4. Publish the Word documentcopywriter

    Convert the approved source, inspect and preview it, and save the real binary deliverables with review evidence.

    Show working prompt
    Publish the approved Markdown as real binary files. 1. Call `list_roots` to identify the read-enabled workspace root and write-enabled artifacts root. If no write root exists, record the blocker. Read `{{workPath}}/scope.md` from the artifacts drawer with `read_artifact` and the approved `{{sourceOutputPath}}` from the workspace with `read_file`. 2. Call `convert_document` with source `{ "kind": "file", "rootId": <workspace root id>, "path": "{{sourceOutputPath}}" }` and `autoTemplates: true`. Use a DOCX target with `fidelity: "editable-native"` and the document title. Include a PDF target in the same call only when scope.md requests it, then preview and save that PDF too at `{{workPath}}/report.pdf`. Ordinary Markdown works with defaults; use discovery only to answer a specific style requirement. 3. Use each returned artifact URI with `inspect_document` and `preview_document`, passing source `{ "kind": "artifact", "uri": <returned URI> }`. Review content, tables, and any reported diagnostics; request at most four preview items at a time and paginate. Interpret `previewBasis` accurately. Office/PDF `reconstructed-import` previews show normalized content sections, not native pagination, fonts, clipping, or page breaks. Review all available sections with pagination and record this native-layout limit. Do not call these native page images or invent a native page count. An accurately disclosed preview limit alone does not fail content and saved-file checks. If content or source structure fails, write precise gaps to task notes and call `advance_task_step` with next `"write"`; do not edit the source during this publishing step. 4. Call `save_artifact` for `{{workPath}}/report.docx` using the artifacts root and `ifExists: "error"`. For an existing output, inspect that saved file and use its `sourceSha256` as `expectedSha256` with `ifExists: "replace"`. Use only URIs returned by this session; reopen earlier saved binaries through file sources. Finally, write a task note with saved paths, hashes, available counts, diagnostics, preview basis, and review limits, then advance to evaluate. Never substitute HTML, renamed Markdown, or hand-written XML for the requested binary files.
  5. Evaluatereviewer

    Review saved-file integrity and content fidelity; document the limits of reconstructed or first-frame previews.

    Show working prompt
    Read `{{workPath}}/scope.md` from the artifacts drawer with `read_artifact` and the approved `{{sourceOutputPath}}` from the workspace with `read_file`. Read prior review/publishing evidence with `read_task_notes`. Call `list_roots` and reopen each saved binary in `{{workPath}}/report.docx` with `inspect_document` and `preview_document`, using source `{ "kind": "file", "rootId": <artifacts root id>, "path": <saved path> }`. Artifact URIs from another session are not reusable. Confirm the binary opens, the supplied facts and requested content are preserved, section order and tables follow the approved source, and citations/next actions remain present. Check `{{workPath}}/report.pdf` too when scope.md requests PDF. Interpret `previewBasis` accurately. Office/PDF `reconstructed-import` previews show normalized content sections, not native pagination, fonts, clipping, or page breaks. Review all available sections with pagination and record this native-layout limit. Do not call these native page images or invent a native page count. An accurately disclosed preview limit alone does not fail content and saved-file checks. Write PASS/FAIL per verifiable content and saved-file criterion, name exact gaps, and state any native-layout or playback property that remains unverified. If these checks pass, route to `finish`; for content/structure failures route to `write`; for conversion/save/copy failures with the source still approved route to `publish`. Never claim an unmet criterion passed. After three unproductive loops, record DONE_WITH_CONCERNS and the remaining gaps. On PASS, call `advance_task_step` with next: "finish". Use next: "write" only for an identified source-content failure, or next: "publish" for an identified conversion/save failure.
  6. Finishcopywriter

    Deliver the saved files with the recorded review evidence and limits.

    Show working prompt
    Read the review evidence with `read_task_notes`. Write a concise DONE summary naming the editable Markdown source `{{sourceOutputPath}}` and the saved deliverables `{{workPath}}/report.docx`. Include available native counts and the preview basis, and carry forward any native-layout or playback properties that remain unverified. Do not open binary files with `read_artifact` or claim an unavailable check passed.

Triggers

Phrases that suggest this craftbook to a crew.

Toolsets

Source

View this craftbook on GitHub · MIT license