Textbook Chapter Production Pipeline

AI Textbook Production Agent Team

← Back to Team Overview

Textbook Chapter Production Pipeline

Orchestrate a 36-agent team to produce a publication-quality, self-contained HTML textbook

chapter from a syllabus module definition.

Pipeline Overview

The pipeline runs in 13 phases:

Phase 0:  SETUP           Chapter Lead reads syllabus, sets scope
Phase 1:  PLANNING        Curriculum + Deep Explanation + Teaching Flow agents
Phase 2:  BUILDING        Example + Code + Visual + Exercise agents
Phase 3:  STRUCTURE       Structural Refactoring Architect reviews book-level organization
Phase 4:  SELF-CONTAIN    Self-Containment Verifier checks all prerequisites are available
Phase 5:  ENGAGE          Title/Hook Architect + First-Page Converter + Aha-Moment Engineer
                          + Project Catalyst + Demo/Simulation Designer + Memorability Designer
Phase 6:  CLARITY         Plain-Language Rewriter + Sentence Flow Smoother + Jargon Gatekeeper
                          + Micro-Chunking Editor + Reader Fatigue Detector
Phase 7:  REVIEW          Student Advocate + Cognitive Load + Misconception + Research Scientist agents
Phase 8:  INTEGRITY       Fact Checker + Terminology + Cross-Reference agents
Phase 9:  VISUAL ID       Visual Identity Director ensures brand consistency
Phase 10: POLISH          Narrative + Style + Engagement + Senior Editor agents
Phase 10b: EPIGRAPH       Epigraph Writer crafts humorous chapter-opening quote
Phase 11: FRONTIER        Research Frontier Mapper + Content Update Scout
Phase 12: CHALLENGE       Skeptical Reader Agent challenges distinctiveness and quality
Phase 13: INTEGRATION     Chapter Lead merges all feedback, produces final

How to Execute

Step 1: Identify the target module

Read the syllabus from the project's syllabus.html to extract the module definition

(module number, title, lessons, topics, tags). Also read any existing chapter files

for context on style, terminology, and cross-references.

Step 2: Run Phase 0 (Chapter Lead Setup)

Load agents/00-chapter-lead.md and execute the setup phase:

Write the outline to {module-folder}/chapter-plan.md.

Step 3: Run Phase 1 (Planning Agents) in PARALLEL

Launch three agents simultaneously, each reading the chapter plan:

  1. Curriculum Alignment Reviewer (agents/01-curriculum-alignment.md)
  1. Deep Explanation Designer (agents/02-deep-explanation.md)
  1. Teaching Flow Reviewer (agents/03-teaching-flow.md)

Collect all three reports. The Chapter Lead merges them into a revised plan.

Step 4: Run Phase 2 (Content Building Agents)

These can run in parallel since they produce independent assets:

  1. Example and Analogy Designer (agents/06-example-analogy.md)
  2. Code Pedagogy Engineer (agents/08-code-pedagogy.md)
  3. Visual Learning Designer (agents/09-visual-learning.md)
  4. Exercise Designer (agents/07-exercise-designer.md)

The Chapter Lead writes the first full draft incorporating all assets.

Step 5: Run Phase 3 (Learning Quality Review) in PARALLEL

These review the draft:

  1. Student Advocate (agents/08-student-advocate.md)
  2. Cognitive Load Optimizer (agents/09-cognitive-load.md)
  3. Misconception Analyst (agents/10-misconception-analyst.md)
  4. Teaching Flow Reviewer (second pass, agents/03-teaching-flow.md)
  5. Research Scientist (agents/18-research-scientist.md)

Chapter Lead applies revisions.

Step 6: Run Phase 4 (Integrity Check) in PARALLEL

  1. Fact Integrity Reviewer (agents/11-fact-integrity.md)
  2. Terminology and Notation Keeper (agents/12-terminology-keeper.md)
  3. Cross-Reference Architect (agents/13-cross-reference.md)

Chapter Lead applies corrections.

Step 7: Run Phase 5 (Final Polish) in PARALLEL

  1. Narrative Continuity Editor (agents/14-narrative-continuity.md)
  2. Style and Voice Editor (agents/15-style-voice.md)
  3. Engagement Designer (agents/16-engagement.md)
  4. Senior Developmental Editor (agents/17-senior-editor.md)

Step 8: Run Phase 6 (Structural Review)

  1. Structural Refactoring Architect (agents/19-structural-architect.md)

This agent runs after building because it needs to see the drafted chapter in the

context of the full book. Its recommendations may trigger structural changes that

the Chapter Lead applies before the review phases.

Step 9: Run Phase 4 (Self-Containment Verification)

  1. Self-Containment Verifier (agents/21-self-containment-verifier.md)

This agent runs after structural review and before learning quality review. It ensures

the chapter can stand on its own within the book's ecosystem. The Chapter Lead addresses

blocking and important gaps before proceeding to the review phases.

Step 10: Run Phase 5 (Engagement & Memorability) in PARALLEL

These six agents make the chapter compelling, memorable, and action-oriented:

  1. Title and Hook Architect (agents/22-title-hook-architect.md)
  1. First-Page Converter (agents/25-first-page-converter.md)
  1. Aha-Moment Engineer (agents/24-aha-moment-engineer.md)
  1. Project Catalyst Designer (agents/23-project-catalyst.md)
  1. Demo and Simulation Designer (agents/28-demo-simulation-designer.md)
  1. Memorability Designer (agents/29-memorability-designer.md)

Chapter Lead integrates engagement improvements before the clarity pass.

Step 11: Run Phase 6 (Writing Clarity) in PARALLEL

These five agents ensure the prose is clear, readable, and fatigue-resistant:

  1. Plain-Language Rewriter (agents/31-plain-language-rewriter.md)
  1. Sentence Flow Smoother (agents/32-sentence-flow-smoother.md)
  1. Jargon Gatekeeper (agents/33-jargon-gatekeeper.md)
  1. Micro-Chunking Editor (agents/34-micro-chunking-editor.md)
  1. Reader Fatigue Detector (agents/35-reader-fatigue-detector.md)

Chapter Lead applies clarity improvements before the learning quality review.

Step 12: Run Phase 9 (Visual Identity)

  1. Visual Identity Director (agents/26-visual-identity-director.md)

Step 12a: Run Phase 10b (Epigraph)

  1. Epigraph Writer (agents/37-epigraph-writer.md)

Epigraph style guidelines:

Attribution examples:

HTML format for epigraphs:

    <blockquote class="epigraph">
      <p>"If you think you understand tokenization on your first try, you have
      not been paying attention. Which, ironically, is the topic of Module 03."</p>
      <cite>A Tokenizer Who Has Seen Things</cite>
    </blockquote>

Required CSS (add to chapter stylesheet if not present):

    .epigraph {
      max-width: 600px;
      margin: 2rem auto 2.5rem;
      padding: 1.2rem 1.5rem;
      border-left: 4px solid var(--highlight, #e94560);
      background: linear-gradient(135deg, rgba(233,69,96,0.04), rgba(15,52,96,0.04));
      border-radius: 0 8px 8px 0;
      font-style: italic;
      font-size: 1.05rem;
      line-height: 1.6;
      color: var(--text, #1a1a2e);
    }
    .epigraph p {
      margin: 0 0 0.5rem 0;
    }
    .epigraph cite {
      display: block;
      text-align: right;
      font-style: normal;
      font-size: 0.9rem;
      color: var(--highlight, #e94560);
      font-weight: 600;
    }
    .epigraph cite::before {
      content: "\2014\00a0";
    }

Example epigraphs by chapter theme:

thought an emoji was four separate tokens. It was, technically, correct."

A Tokenizer Who Has Seen Things

none of which agree with each other."

An Attention Head With Existential Questions

customer support transcripts and now I cannot stop being helpful."

A Reluctantly Aligned Language Model

asking 'will it work?' and start asking 'can we afford the electricity bill?'"

A Mildly Concerned Cluster Administrator

An Unusually Honest Neural Network

got stuck in an infinite loop. Just like the humans, really."

A Self-Aware ReAct Agent

Place the epigraph immediately after the

block

and before the first

or section content.

Step 12b: Run Phase 11 (Frontier & Currency) in PARALLEL

  1. Research Frontier Mapper (agents/27-research-frontier-mapper.md)
  • Adds "where this leads next" sections connecting to active research and open problems
  • Makes the material feel alive rather than settled
  1. Content Update Scout (agents/20-content-update-scout.md)
  • Searches externally for missing topics, outdated content, and competitive gaps
  • Classifies recommendations by priority (essential now, useful soon, trend watch)

Step 13: Run Phase 11 (Quality Challenge)

  1. Skeptical Reader Agent (agents/30-skeptical-reader.md)
  • Challenges whether the chapter is genuinely impressive and distinctive
  • Flags generic, flat, predictable, or forgettable content
  • Pushes for sharper differentiation from other textbooks
  • Runs last (before integration) so it can assess the near-final product

Step 14: Final Integration

  1. Content Update Scout (agents/20-content-update-scout.md)
  • Searches the internet for important missing topics, tools, and trends
  • Reviews similar recent courses, syllabi, and books for competitive gaps
  • Flags outdated examples, libraries, and terminology
  • Classifies recommendations: essential now, useful soon, or trend watch
  • Does NOT automatically expand the book; filters and prioritizes

This agent ensures the chapter reflects the current state of the field. Its

recommendations are reviewed by the Chapter Lead, who decides which updates

to integrate immediately vs. defer to a future revision.

Step 11: Final Integration

Chapter Lead consolidates ALL reports into a MASTER-IMPROVEMENT-PLAN.md with

TIER 1 (BLOCKING), TIER 2 (HIGH), and TIER 3 (MEDIUM) fixes.

CRITICAL: Apply ALL fixes, not just quick wins. The integration phase MUST:

  1. Apply ALL BLOCKING and HIGH fixes directly to the HTML files. This includes:
  • Missing content blocks (new subsections, callouts, definitions)
  • New SVG diagrams for concepts that need visual explanation
  • Gemini-generated illustrations for analogies (use the gemini-imagegen skill)
  • Code examples with output blocks
  • Quiz additions and exercise redistribution
  • CSS consistency fixes
  • Section splits where sections are too long
  • Cross-reference additions
  • "Modify and observe" exercises
  • Paper Spotlight and Open Problem sidebars
  • Opening paragraph rewrites for engagement
  1. Apply MEDIUM fixes where effort is reasonable (callouts, bridges, analogies).
  1. Only defer LARGE structural changes (full section rewrites, major reorganizations)

to a separate pass, with clear documentation of what remains.

  1. Generate all recommended visual assets:
  • SVG diagrams: create inline in the HTML for technical concepts
  • Gemini illustrations: use the gemini-imagegen skill to generate 5-7 illustrations

per chapter following the educational illustration guidelines:

  • 1 chapter opener (humorous scene capturing the big idea)
  • 1-2 algorithm-as-scene illustrations (mental model builders for key algorithms)
  • 1 architecture-as-building or system-as-ecosystem illustration
  • 1-2 analogy/concept-as-character illustrations (visual metaphors)
  • 1 "what could go wrong" illustration (humorous failure mode)

Save images to {module-folder}/images/ and embed with

tags.

Every illustration must have alt text and a detailed caption that maps the

visual metaphor to the technical concept.

  • The book should feel fun to read AND build lasting mental models. Humor makes

concepts memorable; visual metaphors make abstract ideas tangible. Keep

illustrations tasteful, inclusive, and pedagogically useful.

  1. Produce a REMAINING-WORK.md listing only items that could not be applied in

this pass, with justification for each deferral.

The goal is that after integration, the chapter is publication-ready with zero

BLOCKING items and zero HIGH items remaining.

Output Format

The final chapter is a self-contained HTML file with:

  • Book-like formatting (justified text, drop caps, Georgia serif font)
  • Syntax-highlighted code blocks with language labels
  • Inline SVG diagrams for technical concepts
  • Gemini-generated illustrations for analogies and humor
  • Callout boxes: Key Insight (green), Big Picture (purple), Note (blue), Warning (yellow)
  • Interactive pop quizzes with expandable answers
  • Chapter roadmap, key takeaways per section, "What You Built" summary
  • Exercises section (conceptual + coding + challenge)
  • Further reading table
  • Navigation links to previous/next chapters

Global Style Rules

These rules apply to ALL generated content:

  • NEVER use em dashes or double dashes. Use commas, semicolons, colons, or parentheses.
  • Text must be justified with auto-hyphens
  • All claims must have intuitive or formal justification (no unjustified statements)
  • Every concept must answer: what is it, why does it matter, how does it work, when to use it
  • Code examples must be runnable, use current libraries, and include expected output
  • Diagrams must have captions and alt text

Agent Feedback Format

Every agent returns feedback in this structure:

## [Agent Name] Report

### Top Issues (priority-ordered)
1. [Issue description]
   - Why it matters: [impact on learning]
   - Concrete fix: [specific revision]
   - Priority: HIGH / MEDIUM / LOW
   - Action: APPLY DIRECTLY / SEND FOR REVIEW
   - Potential conflicts: [with which other agents]

### Summary
[2-3 sentence overall assessment]

Compact Mode

If the user requests "compact mode" or "quick chapter", use only the 13 essential agents:

Chapter Lead, Curriculum Alignment, Deep Explanation, Code Pedagogy, Visual Learning,

Exercise Designer, Student Advocate, Cognitive Load, Fact Integrity, Terminology Keeper,

Cross-Reference, Style and Voice, Senior Editor.

This skips: Teaching Flow, Example/Analogy, Misconception Analyst, Narrative Continuity,

Engagement Designer, Research Scientist, Structural Architect, Self-Containment Verifier,

Content Update Scout, Title/Hook Architect, First-Page Converter, Aha-Moment Engineer,

Project Catalyst, Demo/Simulation Designer, Memorability Designer, Visual Identity Director,

Research Frontier Mapper, Skeptical Reader, Plain-Language Rewriter, Sentence Flow Smoother,

Jargon Gatekeeper, Micro-Chunking Editor, and Reader Fatigue Detector.

If the user requests "research mode" or "deep chapter", add the Research Scientist agent

to every review phase for maximum scientific depth.

Structural Review Mode

If the user requests "structural review" or "architecture review", run only the

Structural Refactoring Architect across multiple chapters or the full book.

This is useful after a batch of chapters is complete to check overall coherence.

Content Update Mode

If the user requests "content update scan" or "currency check", run only the

Content Update Scout against the current book content. This is useful for

periodic freshness checks or before a new edition.