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.
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 3 — Script generation
Input: Knowledge document from Stage 2 + episode format template + any pending Listener Questions Output: Audio-ready script in conversational format, with citations
Converts the structured knowledge into a narrative script. See Episode Anatomy for the format. Incorporates listener call-in segments where relevant.
Stage 3b — Accuracy review and citation validation
Input: Script from Stage 3 + sources from Stage 2 Output: Reviewed script with validated citations, flagged unsupported claims
The next prompt in the chain reviews the script 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 3c — Self-check Feynman
Input: Reviewed script from 3b + episode learning objectives Output: Self-assessment results + identified gaps
The system runs the Feynman Tutor Prompt protocol against its own script. “Based on this script alone, could a learner meet these learning objectives?” If the script doesn’t contain enough information to pass its own gate, it identifies what’s missing.
Stage 3d — Rubric extraction
Input: Self-check results from 3c Output: Tutor session rubric (questions, expected answers, edge cases to probe)
The self-check produces the exact questions and expected answers that the real tutor session will use later. The rubric isn’t written separately — it emerges from the content.
Stage 4 — 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 5 — Learner listens
The system is idle. The learner listens on their own time and can submit Listener Questions.
Stage 6 — Feynman tutor session
Input: Rubric from 3d + learner conversation Output: Assessment results (per-objective: solid / shaky / blank)
See The Gate for the decision logic that follows. The tutor uses the rubric generated in 3d but adapts conversationally to the learner.
Stage 7 — The gate
Input: Assessment results from Stage 6 Output: One of three paths:
- Advance — generate Episode N+1 (return to Stage 2)
- Deep dive — generate a targeted episode addressing specific gaps (return to Stage 3 with modified objectives)
- 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.