The Pipeline

Lugh’s pipeline is a linear chain of prompts. Each stage reads from the previous stage’s output and produces structured artifacts that feed the next stage. Refinement happens by passing through more stages, not by looping within a stage.

Every stage is a single prompt. No agents, no frameworks, no internal loops. If a stage’s output isn’t good enough, the next stage catches it.

Stage 0a — Topic discovery (breadth-first research)

Input: Topic string (“Understanding Design Patterns”) Output: Topic map with identified sources, key concepts, subtopics, and scope boundaries

The user provides nothing but a topic name. The agent does breadth-first research to:

  • Map the territory (what are the major subtopics? what are the boundaries?)
  • Identify authoritative sources (books, documentation, papers, well-regarded sites)
  • Note where sources disagree or where the topic is contested
  • Build enough understanding to scope a curriculum

This is the foundation of everything downstream. Source quality here determines output quality everywhere.

Optional override: Users who want to provide their own source materials (PDFs, Obsidian notes, links) can do so, replacing this stage with ingestion.

Stage 0b — Curriculum design

Input: Topic map from 0a + Learning Depths selection Output: Scoped curriculum with episode list, per-episode learning objectives, tier structure, and source assignments per episode

The system designs a learning arc scoped to the selected depth. Each episode gets:

  • Specific learning objectives
  • Assigned source materials from 0a
  • Notes on common misconceptions to address
  • Prerequisite dependencies (which episodes must come before)

This is the shareable syllabus — a standalone artifact even before any content is generated.

Stage 1 — Pre-assessment

Input: Curriculum from 0b + learner conversation Output: Adjusted curriculum with per-objective categorization (solid / shaky / blank)

See Pre-Assessment for details. The pre-assessment adapts its approach based on the learner — recognition tasks for those who struggle with recall, meta-assessment for learning style and background.

The per-episode loop

Each episode in the curriculum runs through a modality cascade. The cheapest content does the heaviest lifting. Each modality has its own assessment gate, and later modalities integrate the results of earlier ones. The learner can exit the cascade at any point — if the article gets them to Solid, they never need the podcast.

This follows the productive failure model (see Impasse-Driven Remediation): the learner attempts to engage with the material, gets assessed, and the system uses the specific impasse points to shape what comes next.

Stage 2 — Depth-first research for Episode N

Input: Episode N’s learning objectives + sources assigned in 0b Output: Structured knowledge document with citations

Deep research into the specific slice this episode covers. The agent goes deeper into the sources identified in 0a, pulls out the relevant information, and structures it against the episode’s learning objectives.

Only generates one episode’s research at a time. The gate determines whether the next episode is needed.

Stage 3a — Article generation

Input: Knowledge document from Stage 2 Output: Blog-style article with optional TTS narration header

The first content modality. A well-structured article covering the episode’s learning objectives in full detail. Text allows greater depth than audio — the learner can re-read, skim, and absorb at their own pace.

The article can include an optional audio narration at the top (TTS read of the article text), giving learners who prefer audio a way in without requiring the full podcast production pipeline.

This is where the bulk of the teaching happens. The article runs through the same research, validation, self-check, and rubric extraction pipeline as the podcast — the only difference is that it presents the knowledge directly instead of wrapping it in a conversational script format. Less artifice, less lossy, and the natural first representation of the source material.

Stage 3a-review — Accuracy review and citation validation

Input: Article from Stage 3a + sources from Stage 2 Output: Reviewed article with validated citations, flagged unsupported claims

The next prompt in the chain reviews the article against the source material. Every factual claim should trace back to a source. Claims that can’t be supported get flagged for removal or revision.

This is refinement by pipeline position, not by internal loop.

Stage 3a-selfcheck — Self-check Feynman

Input: Reviewed article from 3a-review + episode learning objectives Output: Self-assessment results + identified gaps

The system runs the Feynman Tutor Prompt protocol against its own article. “Based on this article alone, could a learner meet these learning objectives?” If the article doesn’t contain enough information to pass its own gate, it identifies what’s missing.

Stage 3a-rubric — Rubric extraction

Input: Self-check results from 3a-selfcheck + learning objectives from prior episodes Output: Tutor session rubric (concept questions, connection questions, expected answers, edge cases to probe)

The self-check produces the exact questions and expected answers that the assessment will use. The rubric isn’t written separately — it emerges from the content.

The rubric contains two types of questions:

Concept questions test the current episode’s material: “Explain the Decorator pattern.” These emerge directly from the self-check.

Connection questions ask the learner to relate new material to prior episodes: “How does the Decorator pattern relate to the Strategy pattern from Episode 2?” These are generated from the prerequisite dependencies mapped in Stage 0b. The learner must retrieve prior concepts, hold them alongside new ones, and articulate a relationship — producing retrieval, elaboration, and transfer simultaneously.

Connection questions serve multiple purposes. They provide natural spaced retrieval of earlier material without artificially injecting old quiz questions. They build the learner’s mental model of the domain as an interconnected whole rather than isolated episodes. And they produce richer Akashic Records entries — cross-concept insights that help future learners see relationships they might otherwise miss.

Stage 4a — Article assessment gate

Input: Rubric from 3a-rubric + learner conversation Output: Assessment results (per-objective: solid / shaky / missed) + identified impasses

Feynman tutor session against the article’s rubric. See The Gate for the assessment protocol.

If the learner passes (0-1 shaky, 0 missed): advance to the next episode. The article did its job — the podcast is never generated.

If gaps remain: the impasse points feed into podcast generation.

Stage 3b — Podcast script generation

Input: Knowledge document from Stage 2 + article assessment results from 4a + episode format template + any pending Listener Questions Output: Audio-ready script in conversational format, with citations

The podcast is the second modality — generated only when the article didn’t fully land. Critically, the podcast integrates the learner’s assessment results:

  • The host mirrors the learner’s specific confusions, giving them the experience of hearing their own struggle articulated and resolved
  • Call-in segments can surface the learner’s actual questions from the article assessment as “listener questions”
  • Concepts the learner already demonstrated as Solid get lighter treatment; the podcast spends its time on the gaps

This makes the podcast a genuinely different experience from the article, not just the same content read aloud. See Episode Anatomy for the format.

Stage 3b-review — Podcast accuracy review

Input: Script from 3b + sources from Stage 2 Output: Reviewed script with validated citations, flagged unsupported claims

Same validation as the article review, applied to the podcast script.

Stage 3b-render — Text-to-speech

Input: Final script Output: Audio file(s)

Local TTS generation. Not an LLM task — just rendering. Single narrator or dual-voice depending on configuration.

Stage 5b — Learner listens

The system is idle. The learner listens on their own time and can submit Listener Questions.

Stage 4b — Podcast assessment gate

Input: Updated rubric (focused on remaining gaps from 4a) + learner conversation Output: Assessment results (per-objective: solid / shaky / missed) + identified impasses

Second Feynman tutor session, focused on the impasses that were still unresolved after the article.

If the learner passes: advance to the next episode.

If gaps remain: the remaining impasses feed into shorts generation.

Stage 3c — Shorts generation

Input: Impasses from 4b + episode source material Output: Video flashcard shorts (see Shorts Mode)

The third modality. Each short targets exactly one impasse — the precise breakdown point from the podcast assessment. Visual/spatial encoding for concepts that benefit from it.

The hook format (“Did you know…”, or whatever the effective pattern turns out to be) gives these a viral-friendly structure, but their primary purpose is remediation, not distribution.

Stage 4c — Shorts assessment gate

Input: Impasse-focused rubric + learner conversation Output: Assessment results

Final assessment pass. If gaps still remain after three modalities, the system can generate a targeted remediation episode (the most expensive option) or the learner can choose to advance with noted gaps.

Stage 7 — The gate (episode-level)

Input: Assessment results from whichever gate the learner exited through (4a, 4b, or 4c) Output: One of three paths:

  1. Advance — generate Episode N+1 (return to Stage 2)
  2. Deep dive — generate a targeted remediation episode addressing specific gaps (return to Stage 3a with modified objectives)
  3. Complete — the series is done

The gate recommends but doesn’t force. The learner can skip assessments entirely, advance despite gaps, or request a deep dive even when the system says they’re ready. It’s their compute, their tokens, their time.

The principle

Every stage is one prompt. Refinement happens by moving forward through the chain, not by looping. Each stage validates the previous one as a side effect of doing its own job. The pipeline is linear, each step is simple, and quality emerges from the sequence.

The modality cascade means the most direct content (text) does the bulk of the teaching. Both article and podcast run through the same research, validation, and rubric pipeline — the difference is that the article presents the knowledge directly while the podcast wraps it in a conversational format informed by the learner’s actual gaps. More expensive modalities are only generated when cheaper ones demonstrably didn’t land, and each one integrates the assessment results from the previous, making it a genuinely different learning experience that targets the specific impasses that were identified.