Used to write a business topic into an independent, high-quality, publicly shareable Chinese short book or white paper. It inherits tech-book 's engineered book-writing skeleton, but the output goal shifts from technical publishing to universal business cognition and action assets.
Core boundaries
- The main text must stand on its own: readers can benefit fully without purchasing any product.
- Hard CTAs are prohibited in the main text: do not write conversion language such as "add our WeCom," "claim the materials," "buy the course," or "consult me."
- The main text is not tied to Dapeng's avatar system, courses, customization, or corporate training.
- Outside the book, you may generate
distribution-note.mdandprivate-domain-pack.md, but they must not enter the formal PDF. - The first edition defaults to a 30-50 page Chinese short book, not a 200-page tome.
- The Core pipeline depends only on the Python standard library and can complete scaffolding, chapter synchronization, Markdown export, and quality checks.
- General mode defaults to using the public Web; Xiaohongshu, WeChat Official Account collection, Nowledge, Obsidian, and Vault are all optional Providers, and their absence must not block book completion.
- The formal PDF may optionally use
$kami's Chineselong-doc.htmlstyle: warm paper background, ink-blue, restrained editorial typography. - For main-text illustrations, prioritize Kami infographics: structure, process, comparison, formula, checklist.
$imagegenis mainly used for covers, chapter title pages, and out-of-book distribution images.
Quick start
When creating a new book, run the scaffold first:
LEADBOOK_SKILL_DIR="/path/to/installed/leadbook"
python3 "$LEADBOOK_SKILL_DIR/scripts/scaffold_leadbook.py" \
"/path/to/books/超级个体商业操作系统" \
--title "超级个体商业操作系统" \
--content-profile methodology-book \
--voice-profile product-architect \
--author "大鹏"
The scaffold will copy assets/repo-template/, automatically synchronize chapters, and generate a standard book repo with safety markers.--force may only replace existing Leadbook projects marked with .leadbook-project.json . Afterward, work by phase; do not write the full text scattered directly in chat.
Completing a full book is a durable task. After each Phase is completed, run python3 scripts/leadbook-stage.py mark <phase>to write a recoverable checkpoint into .leadbook-run.json. When resuming, first run python3 scripts/leadbook-stage.py nextand continue from the first incomplete phase. For specific rules, see Execution checkpoints。
Before running, read as needed Runtime and privacy boundaries. Kami, Xiaohongshu, and WeChat Official Account collection are all optional Providers and do not block the Core pipeline.
Workflow
Phase 1:Book Brief
First write clearly why this book exists. Produce and maintain:
BOOK_BRIEF.md: title, subtitle, goals, boundaries, completion criteria.READER_PROFILE.md: who the readers are, their situation, pain points, and motivation to read.POSITIONING.md: core thesis, counterintuitive judgments, competitive perspective.book-state.yaml: chapter status, evidence status, output status, and delivery maturity.VISUAL_PLAN.md: main-text infographics, cover visuals, chapter title pages, and output paths.IMAGEGEN_BRIEF.md: used only for$imagegenbitmap visuals, not for main-text infographics.src/INTRODUCTION.md: the reader-visible opening. During formal writing, delete template markers and write in the real situation, problem redefinition, and reading path.
If the user provides only a book title, first draft a version of the brief based on the title, then point out the gaps. Do not fill gaps by imagining them as facts.
BOOK_BRIEF.md Must clearly state content_profile、voice_profile and voice_anchor. The book type determines the structure, the expert voice determines the reader's sense of "who is speaking," and the celebrity anchor is responsible for quickly pulling the Agent into a specific thinking posture. Without a voice profile and voice anchor, the book degenerates into a compilation of materials.
BOOK_BRIEF.md Must also clearly state the opening contract and chapter rhythm. A business book is not a chapter template repeated 6 times; it must first bring the reader into a real situation, misjudgment, or counterintuitive tension, then explain how the book will advance the judgment. Without an opening contract, the main text can easily read like a workshop manual from the first page.
The Agent advances autonomously by default: when only given a book title, it first generates a v0 brief, v0 evidence plan, and v0 outline, and marks assumptions in the files. Do not hand reversible judgments to the user. Stop to confirm only when the author's real experiences, private cases, business commitments, identity endorsements, or irreversible positioning would significantly change the factual boundaries.
Phase 2:Research & Evidence
Materials first. Before formal writing, first read references/research-stack.md, and build the evidence chain using the minimal strongest toolset. Maintain before writing:
SOURCE_MAP.md: Research source map, recording source tiers, tools, keywords, purposes, and weights.AUTHORITY_ACCOUNTS.md: Map of authoritative public accounts/authors/institutions in the field; first confirm which accounts are worth scraping, then scrape articles.CLAIM_LEDGER.md: Key facts, data, judgments, sources, and credibility.CASE_LIBRARY.md: Cases, counterexamples, scenarios, and degree of public disclosure.BEHAVIOR_SEED_PLAN.md: Automatically derive behavior-layer collection targets from brief / reader / positioning / outline.BEHAVIOR_LEDGER.md: Behavioral signals such as hiring, events, public projects, and partnership announcements.TRANSACTION_LEDGER.md: Transaction signals such as pricing pages, product pages, registration pages, delivery boundaries, and purchase objections.bibliography.md: Reference sources.- Each chapter
src/chapter-xx/refs.mdandcases.md。
By default, complete the four evidence layers L1, L3, L4, and L5 from the public Web. Only when the user explicitly needs it and the environment is genuinely available, add Xiaohongshu, public account, or local content Providers. Public sources must record specific URLs that can be opened directly; search keywords, website names, platform homepages, and "public case pages" do not count as evidence.
Use the current year and the past three years for search years; do not hard-code years. Market data, platform rules, and industry facts must go into CLAIM_LEDGER.md. For data that cannot be verified, write the order of magnitude or mark the gap.
Default evidence tiers:
L1-fact: High-weight factual sources, used for industry data, platform rules, policies, company information, and reports.L2-demand: Xiaohongshu, public comments, Q&A, used for users' exact pain-point wording, title hooks, comment objections, and save/comment/share signals.L3-behavior: Job descriptions, event agendas, public projects, partnership announcements, used to judge real market actions and organizational resource allocation.L4-transaction: Pricing pages, product pages, registration pages, delivery boundaries, purchase objections, used to judge willingness to pay and lead magnet positioning.L5-discourse: Public accounts, blogs, interviews, benchmark authors, used for viewpoint lineages, case materials, and narrative structures.L6-owned: Nowledge / Obsidian / Vault, used for low-weight internal context, own cases, historical projects, users' exact wording, or scenario supplements.
Nowledge/Obsidian are not treated as high-weight information sources. They must not be used alone to support market facts, industry judgments, platform rules, or high-confidence data; if they are indeed used, prioritize writing them into CASE_LIBRARY.md, and mark them as own cases, historical experience, or scenarios.
Xiaohongshu research uses the local REST fallback. Currently xiaohongshu-mcp 's MCP search_feeds The tool may time out; when search is unstable, run directly:
python3 scripts/xhs-research.py \
"个人IP打造" "内容获客" "中小企业AI落地" \
--limit 20 \
--details 5
The script generates research/xhs/*.md and research/xhs/*.json. Write the platform facts and high-frequency questions from them into CLAIM_LEDGER.md, and write reusable cases, counterexamples, and reader scenarios into CASE_LIBRARY.md. Xiaohongshu material can only serve as demand-side and content-side evidence; when it involves industry facts, market size, or policy rules, it must be cross-verified with authoritative sources.
WeChat Official Account research must first do AUTHORITY_ACCOUNTS.md. First use general Web search or $wechat-article-search to discover experts, institutions, media, operators, and opposing voices, then use $wxmp-article-harvester to batch-archive confirmed accounts. For business, operations, platform, and AI-related topics, by default scrape articles from the most recent 365 days; classic theories may be supplemented with earlier articles, but they must be marked as evergreen。
The correct process is: keyword discovery → confirm accounts → batch archive → local keyword filtering. Web pages and single WeChat Official Account links are saved using general web scraping tools. All materials must be backfilled into SOURCE_MAP.md; only facts that are actually cited enter CLAIM_LEDGER.md, to avoid mistaking an accumulation of materials for completed research.
The formal main text must de-backstage the evidence: do not write "demand-side samples," "WeChat Official Account metadata," "leads," or "article pool" for readers. Backstage materials must be translated into specific sources, specific scenarios, specific judgments, and boundaries. See the rules in references/research-stack.md。
Completing Phase 2 does not equal "having a lot of materials." The minimum standard for a truly closed evidence loop is:
bibliography.mdA reader-visible reference page has been formed, not just a few placeholder lists.- Each chapter written into
book-state.yamlhas itsrefs/casescount already backfilled into the correspondingsrc/chapter-xx/refs.mdandcases.md。 outputs.referencesOnly after both the reader-visible reference page and the chapter mapping are closed can it be markedtrue。SOURCE_MAP.mdall have specific URLs.CLAIM_LEDGER.mdThe fact,BEHAVIOR_LEDGER.mdandTRANSACTION_LEDGER.mdcan all be traced back to specific URLs.
The behavioral layer and transactional layer are automatically inferred by the Agent, and the user is not required by default to provide a company name or keywords. The Agent generates collection directions from BOOK_BRIEF.md、READER_PROFILE.md、POSITIONING.md、OUTLINE.md、SOURCE_MAP.md . The user intervenes only when industry orientation, competitor scope, or irreversible positioning would change the book's stance.
Phase 3:Framework & Outline
Choose content_profileaccording to the book type, choose voice_profileaccording to the author's stance, then use voice_anchor to specify the most typical celebrity anchor. For detailed rules, see references/profiles.md。
When generating OUTLINE.md :
- Use
##to indicate formal chapters. - Chapter paths are unified as
chapter-01、chapter-02; do not generate paths using Chinese titles. - Each chapter must clearly state: this chapter's task within the whole book. Whether it is redefinition, argumentation, modeling, cases, steps, boundaries, or closure.
- Each chapter must clearly state: conclusions or judgments, reader questions, evidence or sources, cases or counterexamples, action outputs, and author judgments.
- Each chapter must clearly state: at least 1 visualization opportunity. If there is none, also explain why text is clearer.
- The table of contents must reflect the reader's path, not merely list concept names. Organize by Part / stage when needed.
The whole book by default must have a reader-facing opening block, placed before the formal main-text chapters. It must answer at least four things:
- What real scenario or misjudgment the reader is currently in.
- What problem this book is actually trying to redefine.
- What new judgments and action framework the reader will gain after reading.
- How this book will progress is not a simple listing of the table of contents.
Run:
python3 scripts/sync-summary.py
This will generate src/SUMMARY.md, create the chapter directory, and sync book-state.yamlvia merge, preserving existing research, outputs, and chapter progress.
Phase 4:Chapter Writing
Each chapter serves as an independent writing checkpoint. Load only:
OUTLINE.mdBOOK_SUMMARY.md- Current chapter
refs.md - Current chapter
cases.md glossary.mdCLAIM_LEDGER.mdrelated entries
Chapters are no longer forced to use the same heading skeleton. A uniform heading structure would flatten white papers, research reports, and playbooks into course manuals. Each chapter must satisfy the chapter contract, but the presentation structure adjusts according to content_profile and the chapter task.
Each chapter must include these contents, and may change headings, merge paragraphs, or reorder:
- Conclusion or judgment: what judgment this chapter directly provides.
- Reader problem: in what specific scenario the reader needs this chapter.
- Evidence or sources: where facts, cases, behavioral signals, trading signals, or demand materials come from.
- Cases or counterexamples: public cases, own cases, behavioral signals, trading signals, or hypothetical cases, with boundaries marked.
- Action output: what judgment, steps, checklist, template, self-test, or roadmap the reader gets after reading.
- Author judgment: reflects
voice_profilethe trade-offs, boundaries, and positions.
The main text is not equal to a workbook. Fill-in tasks that can go into dist/worksheets/, appendices, or end-of-chapter toolboxes should not occupy the main text structure by default. Only playbook and course-manual should frequently use exercises, self-tests, and template blocks;methodology-book、whitepaper、business-report prioritize ensuring argument progression, rhythm changes, and author judgment.
Recommended structure selected by book type:
methodology-book: problem definition → old framework fails → system model → cases/counterexamples → action principles.whitepaper: factual background → trend judgment → evidence chain → risk boundaries → impact on readers.playbook: scenario → wrong practices → steps → templates/checklists → stop conditions.course-manual: learning objectives → explanation → examples → exercises → checking standards.research-analyst: data assertions → trend judgment → second-order impacts → opposing evidence → boundary conditions.
The whole book needs enough toolbook elements: comparison tables, steps, callout boxes, error lists, template blocks, self-test questions, case boxes, infographics. But do not compress every chapter into a worksheet just to hit a count. Generally 1-2 high-value elements per chapter is enough;playbook and course-manual can increase density,methodology-book、whitepaper、business-report prioritize judgment progression and reading rhythm.
After each chapter is completed, update BOOK_SUMMARY.md and book-state.yaml. If the summary and status are not updated, it is not complete.
Tasks with six or more chapters or requiring PDF must not compress research, whole-book writing, building, and visual QA into one unrecoverable long turn. Write a checkpoint at least after research、outline、writing、build、visual-qa ; if the background session ends early, continue from .leadbook-run.json , without redoing research or rewriting completed chapters.
Initial chapter files carry a <!-- leadbook-template: chapter --> marker. Delete this marker during formal writing; Markdown export automatically skips unwritten chapters that are still templates, making draft suitable for chapter-by-chapter WIP.
When updating status,book-state.yaml the refs / cases must be consistent with the corresponding refs.md / cases.md real valid records. It is not enough to write "this chapter has 3 refs" only in the status table while the chapter evidence file still remains at the template placeholder.
Phase 5:Review & Quality Gate
Read before formal merge references/quality-gates.md. First merge the body, then run the body baseline check:
python3 scripts/export-markdown.py
python3 scripts/check-leadbook.py --target draft dist/book.md
leadbook There are three completion tiers, and they must not be mixed up:
draft: the body is readable and suitable for continuing writing and internal revisions; evidence, visuals, and attachments are allowed to remain unresolved.review-ready: the main book is complete, and Markdown / HTML / PDF can be reviewed; reference materials, evidence tables, infographics, fonts, and status tables are all in place.publish-ready: the complete public distribution package is complete; WeChat public account/authoritative sources meet the topic requirements, and worksheets, reference pages, out-of-book distribution instructions, and private-domain intake packages are all complete.
When only the body has been written, report at most review-ready. Without passing the publish-ready check, do not say "publicly releasable" or "can be delivered as a complete lead-generation package".
draft Check focus:
- Whether the body stands on its own.
- Whether hard CTAs or product tie-ins appear.
- Whether key facts can be traced back to
CLAIM_LEDGER.md。 - Whether the body translates backstage evidence language into reader language.
voice_profileandvoice_anchorWhether they form an expert voice rather than a compilation of materials.- Whether there are vague business terms.
- Whether each chapter has a conclusion, questions, a model, cases, and action recommendations.
book-state.yamlWhether evidence, outputs, and delivery status are accurately recorded.- If
outputs.references=trueorquality.reference_page=true, there must already be a decent reader reference page, and chapterrefs.md/cases.mdmust not be an empty template. - If
wxmp_packis stillpartial, it can only be marked asdraftorreview-ready, and cannot be marked aspublish-ready。
draft Run before build, allowing SVG / section images whose Output Path has already been registered in VISUAL_PLAN.md to not yet be generated; the checker only gives a warning. After entering review-ready , all required visual assets must actually exist.
Phase 6:Build & Kami Output
Merge body:
python3 scripts/export-markdown.py
Generate or update the Kami infographic:
python3 scripts/generate-kami-diagrams.py
The Leadbook infographic must use the current $kami diagram primitive logic: the image is SVG structural material embedded in the body, not a large card with a border, watermark, and internal main title. The generator must preserve:
- When Kami is installed, use the current mainline Skill, default path
~/.agents/skills/kami; when not installed, retain Core Markdown capability and use the built-in basic HTML template. - Do not write
Kami information diagram, template names, watermarks, or irrelevant notes. - Do not repeat the main title inside the image; leave the title and explanation to body paragraphs and captions.
- SVG is output at body width in HTML/PDF, and the visible graphic area must also stay close to body width; do not only widen the transparent canvas.
- Chinese text inside nodes must be centered, readable, and not overflow; shorten long labels first, then wrap.
- Arrows, nodes, and divider lines must land on a fixed grid; there must be no visibly floating arrows, misalignment, or occlusion.
If a cover or chapter title page visual is needed, use $imagegen to generate a bitmap, copy it to assets/images/, and fill back IMAGEGEN_BRIEF.md. For explanatory body illustrations, do not use $imagegenby default; use Kami SVG infographics.
Generate Kami HTML:
python3 scripts/export-kami-html.py dist/book.md dist/book.html
Render PDF:
python3 scripts/render-pdf.py dist/book.html dist/book.pdf
Generate the page-by-page visual QA checklist and page images:
python3 scripts/prepare-pdf-visual-audit.py
You must actually inspect dist/qa/contact-sheet.png and the page-by-page PNGs, fill in each page's Checked、Issues、Fix Status and chart ID, and change audit_state to passed. Automatic rendering only prepares the checklist; it does not mean visual approval.
The output stage reads references/kami-output.md. The PDF contains only the formal book body and necessary appendices.distribution-note.md、private-domain-pack.md is saved only as out-of-book operational material.
Must be run before main book review:
python3 scripts/check-leadbook.py --target review-ready --update-state dist/book.md
Must be run before public release:
python3 scripts/check-leadbook.py --target publish-ready --update-state dist/book.md
Only a checker with --update-state that returns 0 can upgrade maturity and write into dist/qa/gates/ a receipt bound to the current Markdown, HTML, PDF, visual audit, and reference summary. After the body, HTML, PDF, or references change, the old receipt automatically becomes invalid; manually changing review_ready / publish_ready to true is prohibited.
publish-ready checks the entire project, not just the body:book-state.yaml, WeChat official account/authoritative account status, reference pages,dist/worksheets/、distribution-note.md、private-domain-pack.md, HTML/PDF, and visual assets all enter the hard gate. If a topic clearly does not need WeChat official account evidence, it must be explained in the report and --allow-partial-wxmpmust be used explicitly; skipping by default is not allowed.
review-ready and publish-ready both check the chapter evidence mapping: if book-state.yaml declares that a chapter already has refs or cases, but the corresponding src/chapter-xx/refs.md / cases.md is still an empty template, the check must fail. The entire book cannot just pile up backend material in CLAIM_LEDGER.md and CASE_LIBRARY.md .
publish-ready also checks the behavioral layer and transactional layer by default:BEHAVIOR_LEDGER.md at least 3 valid behavioral signals,TRANSACTION_LEDGER.md at least 3 valid transactional signals, and book-state.yaml marks the closed loop. If a topic clearly does not need one of these layers, it must be explained in the report and --allow-missing-behavior or --allow-missing-transaction。
Automatic check passing does not equal visual approval. Before claiming review-ready or publish-ready , the PDF must be rendered into page images, and at least all pages containing images must be checked page by page: body width, text within images, captions, pagination, cover, and table of contents. The check results must be written into dist/qa/pdf-visual-audit.md. Without a page-level visual QA audit file, the book must not be described as deliverable.
Out-of-book operational material
When the user explicitly asks "how to introduce this book at the end of an article" or "how to handle private domain conversion," generate:
dist/distribution-note.md: book positioning, suitable readers, what readers can gain after reading, end-of-article introduction, and distribution boundaries; not written into the PDF.dist/private-domain-pack.md: welcome message, tag questions, reader segmentation, follow-up content, and boundary explanation; not written into the PDF.dist/worksheets/: at least one worksheet that readers can fill in or execute, and it must directly correspond to the core model of the main book.
These materials serve distribution and do not change the book's body.
Resource description
scripts/scaffold_leadbook.py: create a new leadbook repo.assets/repo-template/scripts/xhs-research.py: collect Xiaohongshu search, note details, and comment samples through the localxiaohongshu-mcpREST API as a research evidence package.assets/repo-template/scripts/generate-kami-diagrams.py: generate a new version of the Kami SVG primitive infographic based onVISUAL_PLAN.md.assets/repo-template/scripts/prepare-pdf-visual-audit.py: render all PDF pages, generate a contact sheet, and produce a page-by-page visual QA checklist.assets/repo-template/scripts/leadbook-stage.py: record and verify recoverable stage checkpoints.assets/repo-template/: templates and scripts for each book project.assets/repo-template/BEHAVIOR_SEED_PLAN.md: behavioral layer automatic derivation plan template.assets/repo-template/BEHAVIOR_LEDGER.md: behavioral layer signal ledger template.assets/repo-template/TRANSACTION_LEDGER.md: transactional layer signal ledger template.assets/repo-template/dist/qa/pdf-visual-audit.md: PDF page-level visual QA audit template.references/research-stack.md: minimal and most rigorous research toolset, authoritative account map, evidence hierarchy, and source weighting rules.references/profiles.md: Content profile and expert voice profile.references/quality-gates.md: Body quality gates and prohibited areas.references/kami-output.md: Kami typesetting output rules.references/runtime-and-privacy.md: Core/Optional Provider, dependencies, credentials, and privacy boundaries.references/execution-checkpoints.md: Long-task phase gates, recovery methods, and completion state transactions.tests/test_leadbook.py: Core, security, state, visual, and privacy regression tests.evals/evals.json: Representative invocations and expected behavior.