overview:Add a research workflow that turns a learner or teacher goal into a reviewable YouTube-backed learning path, using video discovery, transcript or segment analysis, coverage scoring, and existing ClassroomIO course publishing primitives.
todos:
- id:prd-review
content:Finalize naming, transcript policy, source limits, pricing gates, and YouTube API quota assumptions
status:pending
- id:research-model
content:Add persistent research run, candidate video, transcript, segment, and coverage data model
status:pending
- id:discovery
content:Implement YouTube search, metadata enrichment, deduplication, and cheap candidate ranking
status:pending
- id:transcript-ingestion
content:Implement pluggable transcript ingestion with explicit provider policy and fallback states
status:pending
- id:ai-analysis
content:Implement goal decomposition, chunk analysis, coverage scoring, gap detection, and sequence planning
status:pending
- id:review-ui
content:Build dashboard review UI for candidate videos, selected timestamps, coverage, and teacher edits
status:pending
- id:publish
content:Publish approved YouTube learning paths into existing course sections, lessons, and exercises
status:pending
- id:learner-experience
content:Render embedded YouTube lessons with timestamps, objectives, progress, and optional checks
status:pending
- id:observability
content:Track API quota, model token usage, transcript cost, cache hit rate, and run quality metrics
status:pending
isProject:false
---
# YouTube Research Courses PRD
## Status
- Draft
## Date
- July 13, 2026
## Purpose
Add a **YouTube research workflow** that lets a teacher or creator describe a learning goal, discovers relevant YouTube videos, analyzes their usefulness, and produces a sequential, reviewable training path that can be published into ClassroomIO.
The product should answer questions like:
- "I want to learn React Server Components from scratch."
- "Build a beginner-friendly training path for data analysis with Python."
- "Find YouTube videos that teach SOC 2 basics to non-technical employees."
- "Use the best parts of these videos to create a short course."
The output is not just a list of links. The system should produce a structured learning path with:
- course title and description
- prerequisites and target learner level
- ordered lessons or modules
- selected videos and timestamp ranges
- rationale for why each video or segment is included
- coverage map against the original learning goal
- optional generated checkpoints or quizzes
- teacher review before publishing
## Problem Statement
Teachers and learners already use YouTube as a large informal knowledge base, but turning search results into a coherent learning sequence is manual and unreliable.
Current gaps:
- YouTube search results are not the same as a curriculum.
- Good videos often contain only some useful segments, not a clean lesson boundary.
- Long videos need timestamp selection, not full-video assignment.
- A single video may not satisfy the whole goal.
- Multiple videos can overlap, conflict, or assume different prerequisites.
- ClassroomIO can embed YouTube videos today, but it does not inspect them, score coverage, or build a path from them.
- Existing transcription in the product is for uploaded videos, not third-party YouTube videos.
- Existing Study from Source work explicitly excludes video and YouTube ingestion, so this feature needs a separate product and engineering scope.
## Executive Summary
**YouTube Research Courses** introduces a research pipeline that turns a broad learning goal into a timestamped, YouTube-backed course draft.
The workflow:
1. Teacher enters a goal, learner level, constraints, and optional seed videos or channels.
2. System decomposes the goal into learning objectives and search queries.
3. System discovers YouTube candidates and enriches them with metadata.
4. System cheaply ranks candidates using metadata before spending model tokens on transcripts.
5. System ingests transcripts where allowed and available.
6. System segments transcripts into timestamped chunks.
7. System scores chunk coverage against learning objectives.
8. System assembles a sequential learning path.
9. Teacher reviews, edits, excludes videos, adjusts timestamps, and approves.
10. System publishes the approved path into existing course sections, lessons, videos, and optional exercises.
The most important product constraint is transcript access. Official YouTube Data API search and metadata access are straightforward, but public caption text access is not a general-purpose unauthenticated API. The PRD therefore requires a pluggable transcript layer and explicit compliance review before any provider that downloads or derives third-party video transcripts is enabled in production.
## Product Positioning
### Primary Use Case: Course Research
The teacher wants ClassroomIO to find and structure external video content for a learning goal.
Example:
> "Create a 90-minute beginner course on SQL joins using YouTube videos."
Output:
- 4 to 6 lessons
- each lesson has one selected YouTube video or timestamp range
- each lesson has learning objectives
- optional short notes generated by ClassroomIO
- optional quiz questions grounded in selected segments
- coverage report showing which goal requirements are satisfied
### Secondary Use Case: Curate From Provided Videos
The teacher already has links and wants ClassroomIO to inspect and sequence them.
Example:
> "Use these 8 videos to build a training path for new support engineers."
Output:
- duplicate and overlap detection
- best segment selection
- recommended order
- gaps and missing prerequisites
- rejected videos with reasons
### Later Use Case: Learner-Led Research
A learner asks for a personal path from public YouTube content.
This is intentionally deferred until after teacher-led workflows because learner-led research needs additional safety, content quality, and plan-limit controls.
## Goals
1. Convert a plain-language learning goal into a structured YouTube-backed learning path.
2. Discover candidate videos through YouTube search and optional seed links.
3. Rank candidates cheaply before doing transcript-heavy AI analysis.
4. Analyze available transcript segments and map them to explicit learning objectives.
5. Support one-video, multi-video, and timestamped-segment learning paths.
7. Make the generated plan editable and reviewable before publishing.
8. Publish approved plans into existing ClassroomIO course sections, lessons, embedded YouTube videos, and exercises.
9. Track API quota, model token usage, transcript cost, run status, and cache hit rates.
10. Keep transcript acquisition compliant, provider-driven, observable, and replaceable.
## Non-Goals (v1)
- Downloading or redistributing YouTube video files.
- Cutting and hosting derivative clips from YouTube videos.
- Automatically publishing courses without teacher review.
- Guaranteeing transcript availability for every public YouTube video.
- Private, members-only, age-restricted, or login-required video ingestion.
- Full web research outside YouTube.
- Real-time collaborative editing of generated research plans.
- A public learner-facing YouTube search engine.
- Recommending harmful, adult, misleading, or policy-sensitive content without review.
- Replacing the existing AI course assistant execution pipeline.
## Product Decisions
1. The working feature name is **YouTube Research Courses**.
2. The v1 output is a reviewable **learning path**, not an automatically published course.
3. The first publish target is the existing self-paced course model.
4. YouTube videos remain embedded from YouTube; ClassroomIO stores metadata, transcript-derived analysis, and course structure.
5. Timestamp ranges are first-class. A lesson can point to an entire video or a segment.
6. Transcript ingestion must be pluggable and policy-controlled.
7. Research runs must be resumable, cancelable, and observable through the jobs system.
8. The system must fail gracefully when transcript access is unavailable: metadata-only candidates can be shown, but deep coverage confidence must be low.
9. Caching is required for all expensive video metadata, transcript, embedding, and analysis artifacts.
10. Teacher review is mandatory in v1 because external video quality and licensing are not fully controlled by ClassroomIO.
## Current-State Audit
| Capability | Current State | Notes |
| --- | --- | --- |
| YouTube lesson embeds | Exists | Lessons can already store YouTube links and render them through media player components. |
| YouTube transcript ingestion | Missing | Existing agent tools explicitly say embedded YouTube links return no transcript. Lesson-scoped fetch + cache is specified in [`prd/youtube-embed-transcripts`](../youtube-embed-transcripts/README.md); research runs should reuse that caption cache instead of a second transcript table. |
| AI course generation | Exists | Durable course-generation worker can create sections, lessons, exercises, and content. |
| Study from Source | Draft PRD | Covers documents, webpages, and pasted text but excludes YouTube/video ingestion in v1. |
| Asset model | Exists | Supports `youtube` provider for video links, but not research candidate scoring or segment coverage. |
| Job infrastructure | Exists | BullMQ media and agent jobs can be reused for long-running research runs. |
| Usage tracking | Exists | Token usage recording exists for AI assistant; extend for research runs. |
## External Constraints
### YouTube API
Verified against official YouTube Data API docs on July 13, 2026:
- Every YouTube Data API request costs at least one quota point.
-`search.list` has its own default daily quota bucket and costs 1 quota per call.
-`videos.list` costs 1 quota per call.
-`captions.list` costs 50 quota units and returns caption track metadata, not the caption text.
- Caption operations require OAuth authorization scopes. They are not a general way to fetch arbitrary public captions for videos ClassroomIO does not own.
Model and transcription prices change over time. The implementation must not hardcode pricing assumptions in prompts or business logic. Use centralized provider pricing configuration and persist actual usage per run:
- input tokens
- cached input tokens where available
- output tokens
- embedding tokens
- transcription minutes or tokens
- provider model IDs
- estimated cost at run time
Reference:
- https://platform.openai.com/docs/pricing
## User Personas
### Teacher
Wants to quickly assemble a credible YouTube-based course without manually watching dozens of videos.
### Training Operator
Wants low-cost internal training that uses public expert videos while preserving a clear course structure, quizzes, and completion tracking.
### Course Creator
Wants to research a topic and produce an editable course draft with external videos, notes, and assessments.
### Learner
Wants a path that feels coherent and avoids random playlist hopping.
## Jobs To Be Done
1. Enter a learning goal and get a structured video learning path.
2. Provide seed videos and have ClassroomIO select useful segments.
3. Understand which videos were rejected and why.
4. Review coverage before publishing.
5. Turn approved videos into lessons with objectives and optional quizzes.
6. Track learner progress through video lessons.
7. Control AI spend and prevent runaway research jobs.
## User Experience
### Entry Points
V1 should expose the workflow from the teacher dashboard:
- Course creation flow: "Create from YouTube research"
Published lessons should reuse existing lesson and video UI patterns:
- YouTube embedded player
- lesson title and objectives
- selected timestamp range, if any
- optional lesson notes
- optional generated exercise
- progress tracking based on current video progress infrastructure where possible
If a timestamp range is selected, the player should start at the segment start time and display the intended range in the lesson metadata. Hard enforcement of end-time stopping is not required in v1.
## Functional Requirements
### 1. Goal Decomposition
The system must convert the prompt into a structured research brief:
-`youtube_authorized`: For videos owned by the connected YouTube account or content owner where OAuth scopes permit caption access.
-`manual_upload`: Teacher uploads or pastes a transcript for a video.
-`third_party`: Optional provider only if approved after legal/product review.
-`audio_transcription`: Optional provider only if approved after legal/product review and platform terms review.
-`unavailable`: No transcript is available; video can only be metadata-ranked.
The system must persist transcript provider, acquisition timestamp, language, source hash, and policy flags. If the transcript provider is not approved for the current environment, the run must skip transcript ingestion and continue with a warning.
### 5. Segmenting
Transcript text must be split into timestamped segments suitable for scoring.
Segment shape:
```json
{
"videoId":"abc123",
"startSeconds":240,
"endSeconds":510,
"text":"Segment transcript text...",
"summary":"Explains the difference between server and client components.",
- Do not send all candidate full transcripts to a large model.
- Do not include raw transcript text in final synthesis if segment summaries and coverage records are sufficient.
- Use structured outputs for every internal scoring/planning step.
- Persist prompt inputs and outputs only according to privacy and retention policy.
## Cost Controls
Required controls:
- Per-run max YouTube search calls.
- Per-run max transcript minutes.
- Per-run max candidate videos for deep analysis.
- Per-run max input and output tokens.
- Per-org monthly research budget.
- Plan-tier gates for number of runs and deep analysis depth.
- Cache by video ID, transcript source hash, segment hash, and objective hash.
- Stop early when coverage is already sufficient.
- Warn teacher before expensive follow-up research.
Default MVP budget target:
| Item | Target |
| --- | --- |
| Candidate discovery | Up to 50 videos |
| Transcript ingestion | Up to 12 videos |
| Deep analysis | Up to 8 videos |
| Selected output | 3 to 10 lessons |
| Run time | Under 5 minutes for common topics |
| Manual review | Required before publish |
## Permissions and Security
- Only org members with course creation or course editing permission can create research runs.
- Publishing into an existing course requires course team-member permission.
- Research data must be scoped by `organizationId`.
- Candidate and transcript caches shared across orgs need explicit privacy review; v1 should default to org-scoped caches unless a safe global cache policy is approved.
- OAuth tokens for YouTube caption access, if added, must be stored as secrets and scoped to authorized channels only.
- Generated content must be marked as AI-generated where the existing product requires it.
## Compliance and Content Policy
Before production launch, resolve:
- Whether ClassroomIO may retrieve, store, and analyze third-party YouTube transcripts from any chosen provider.
- Whether transcripts are stored long-term, temporarily, or only as derived summaries.
- Whether audio transcription of third-party YouTube videos is allowed.
- How to handle creator attribution.
- How to respond to removed, private, or non-embeddable videos after publish.
- Whether generated lesson notes can quote transcript text and what quote limits apply.
V1 policy recommendation:
- Embed videos from YouTube instead of copying video content.
- Store video metadata and teacher-approved course structure.
- Store transcript-derived summaries and coverage records.
- Store raw third-party transcripts only when provider policy and legal review approve it.
- Provide clear attribution to video title and channel in lesson metadata.
## Observability
Track per run:
- stage timings
- YouTube API calls and quota usage
- candidate count per query
- transcript availability rate
- transcript provider
- transcript minutes processed
- model IDs
- input/output/embedding tokens
- estimated cost
- cache hit rate
- number of warnings
- publish result
Track product quality:
- teacher approval rate
- average edits before publish
- videos rejected by teacher
- coverage gaps per run
- published course completion rate
- learner quiz performance
- learner drop-off by lesson
## Failure States
| Failure | User-Facing Behavior |
| --- | --- |
| YouTube API quota exhausted | Run pauses with retry guidance and partial candidates. |
| No videos found | Show search queries and let teacher edit goal. |
| Transcripts unavailable | Continue with metadata-only candidates and low confidence. |
| Video not embeddable | Exclude from default plan unless teacher explicitly keeps it as an external link. |
| AI budget exceeded | Stop at current stage and show partial results. |
| Provider error | Retry with backoff, then mark stage warning. |
| Course publish failure | Keep approved plan and allow retry. |
## MVP Scope
MVP should ship the smallest useful version:
1. Teacher starts a YouTube research run from a goal.
2. System discovers and enriches YouTube candidates.
3. System does metadata ranking and transcript analysis only where an approved transcript provider is available.
4. System produces a reviewable path with selected videos or timestamp ranges.
5. Teacher can edit the path.
6. Teacher can publish to a new self-paced course.
7. System tracks cost, warnings, and transcript availability.