Write a Book (PDF)
Turn a topic into a structured, well-researched PDF — a short book or report — and
deliver it to the user as a file. This mirrors a clarify → plan → research → write →
edit → render pipeline.
When to use
The user wants a document, not a chat answer: "write me a book about…", "make a PDF
report on…", "出一本关于…的小册子". The deliverable is a PDF produced by the
render_pdf tool.
Method
- Scope it. If the topic is broad or ambiguous, ask 1–3 quick clarifying questions
(depth, audience, language, how many chapters). If the user said "use your best
judgment", skip and choose sensible defaults (6 chapters, ~800–1200 words each).
- Plan the outline. Decide a title, optional subtitle, and an ordered list of
chapters — each with a one-line intent and a rough word budget. Keep chapters in the
user's language.
- Research with
web_search then web_fetch on the most credible hits. Cross-check
key facts against a second source. If search yields little, fall back to your own
knowledge but don't fabricate specifics (names, numbers, dates).
- Write chapter by chapter, in order. Feed yourself the tail of the previous chapter
so voice and terminology stay consistent. For a long book you may spawn a
sub_agent
per chapter to draft in parallel, then stitch. Write real prose with Markdown
structure (## sub-headings, - lists, `code`) — the renderer understands it.
- Edit once for a single consistent voice, terminology, and no repetition.
- Render by calling
render_pdf (see below). Then tell the user what you produced
(title, chapter count) — the PDF is delivered as an attachment automatically.
Calling render_pdf
Pass a title (+ optional subtitle, author) and an ordered sections array. Each
section is one chapter: a heading and a body_markdown.
{
"title": "A Short History of the Quartz Watch",
"subtitle": "From lab curiosity to wrist ubiquity",
"author": "MicroClaw",
"sections": [
{"heading": "1. The Mechanical World Before Quartz", "body_markdown": "In the 1960s...\n\n- point\n- point"},
{"heading": "2. The Breakthrough", "body_markdown": "## The oscillator\n\nText..."}
]
}
- Put the chapter title in
heading; do not repeat it as an # heading inside the body.
level (1–3) controls heading size; default 1 for top-level chapters.
- A cover page and table of contents are generated automatically (
cover/toc default true).
Quality bar
- Aim for the page20 shape: ~6 chapters × ~1000 words for a full book; fewer/shorter for a
quick brief. State the target you chose.
- Concrete and sourced beats vague and padded. Lead each chapter with its point.
- For CJK output, the operator may need to set
media.book.font_path to a CJK font; if a
render fails with "no usable font", relay that hint.
1---2name: write-book3description: Research a topic and produce a polished multi-chapter PDF book/report. Use when the user asks to write a book, booklet, report, brief, guide, ebook, whitepaper, or 'turn X into a PDF document'. Runs a research → outline → write → render pipeline and calls the render_pdf tool to produce a downloadable PDF. Triggers on mentions of write a book, make a PDF, booklet, report, brief, guide, ebook, whitepaper, 写一本书, 写本书, 生成PDF, 做一本电子书, 写一份报告, 小册子, 出一本书, 制作PDF.4license: Proprietary. LICENSE.txt has complete terms5---67# Write a Book (PDF)89Turn a topic into a structured, well-researched PDF — a short book or report — and10deliver it to the user as a file. This mirrors a clarify → plan → research → write →11edit → render pipeline.1213## When to use1415The user wants a *document*, not a chat answer: "write me a book about…", "make a PDF16report on…", "出一本关于…的小册子". The deliverable is a PDF produced by the17`render_pdf` tool.1819## Method20211. **Scope it.** If the topic is broad or ambiguous, ask 1–3 quick clarifying questions22 (depth, audience, language, how many chapters). If the user said "use your best23 judgment", skip and choose sensible defaults (6 chapters, ~800–1200 words each).242. **Plan the outline.** Decide a title, optional subtitle, and an ordered list of25 chapters — each with a one-line intent and a rough word budget. Keep chapters in the26 user's language.273. **Research** with `web_search` then `web_fetch` on the most credible hits. Cross-check28 key facts against a second source. If search yields little, fall back to your own29 knowledge but don't fabricate specifics (names, numbers, dates).304. **Write chapter by chapter**, in order. Feed yourself the tail of the previous chapter31 so voice and terminology stay consistent. For a long book you may spawn a `sub_agent`32 per chapter to draft in parallel, then stitch. Write real prose with Markdown33 structure (`##` sub-headings, `-` lists, `` `code` ``) — the renderer understands it.345. **Edit once** for a single consistent voice, terminology, and no repetition.356. **Render** by calling `render_pdf` (see below). Then tell the user what you produced36 (title, chapter count) — the PDF is delivered as an attachment automatically.3738## Calling render_pdf3940Pass a `title` (+ optional `subtitle`, `author`) and an ordered `sections` array. Each41section is one chapter: a `heading` and a `body_markdown`.4243```json44{45 "title": "A Short History of the Quartz Watch",46 "subtitle": "From lab curiosity to wrist ubiquity",47 "author": "MicroClaw",48 "sections": [49 {"heading": "1. The Mechanical World Before Quartz", "body_markdown": "In the 1960s...\n\n- point\n- point"},50 {"heading": "2. The Breakthrough", "body_markdown": "## The oscillator\n\nText..."}51 ]52}53```5455- Put the chapter title in `heading`; do **not** repeat it as an `#` heading inside the body.56- `level` (1–3) controls heading size; default 1 for top-level chapters.57- A cover page and table of contents are generated automatically (`cover`/`toc` default true).5859## Quality bar6061- Aim for the page20 shape: ~6 chapters × ~1000 words for a full book; fewer/shorter for a62 quick brief. State the target you chose.63- Concrete and sourced beats vague and padded. Lead each chapter with its point.64- For CJK output, the operator may need to set `media.book.font_path` to a CJK font; if a65 render fails with "no usable font", relay that hint.