Lineage Skill
Turn course materials into reusable, source-grounded AI Skills.
Core method: Capture -> Cite -> Compress -> Connect -> Codify -> Evaluate.
Use this as an evidence-first workflow: preserve source material before summarizing, cite sources before synthesizing, and mark unsupported gaps.
Read When Needed
- Runtime reference: references/runtime.md
Trigger Conditions
Use this skill when the user asks to:
- Distill a course, lecture series, workshop, training program, curriculum, or long-form class.
- Convert videos, audio, PDFs, slides, screenshots, notes, transcripts, OCR output, or course summaries into structured course knowledge.
- Generate or update a course-backed Skill.
- Build a course mentor, expert, consultant, practitioner, or custom course-backed Skill.
- Package existing
transcripts/, analysis/, documents/, lesson_summaries.json, course_distillation_*.md/json, or course_package.json.
Capabilities
This Skill owns the course-distillation pipeline. Do not describe transcription, visual analysis, screenshot extraction, OCR collection, distillation, packaging, or generated-Skill creation as work the user must perform manually when suitable source files and configured providers are available.
Supported capabilities:
- Extract audio from
.mp4 course videos and transcribe it through an OpenAI-compatible /audio/transcriptions endpoint.
- Directly transcribe standalone
.mp3, .wav, .m4a, .aac, .flac, .ogg, and .opus course audio files.
- Split long audio into segments before transcription.
- Analyze video content through a vision-capable model, including PPT, board writing, software screens, diagrams, tables, demonstrations, and other visual teaching material.
- Compress and chunk large videos before visual analysis.
- Parse vision-model
[SCREENSHOT MM:SS] markers, extract key frames from the original video, and de-duplicate similar screenshots.
- Collect MinerU/OCR Markdown outputs from PDFs or document directories.
- Distill transcripts, visual analyses, screenshots, OCR documents, and user notes into structured course notes.
- Build
course_package.json, evidence_map.json, and lesson_index.json.
- Merge multiple
course_package.json files into one combined multi-course workspace.
- Generate source-grounded course Skills in the requested role.
- Record durable pipeline progress in
lineage_progress.json.
- Build a multi-course workspace catalog with
scripts/build_course_catalog.py.
Provider Requirements
Capability is separate from configuration. If a provider is missing, report the missing configuration and the smallest viable fallback; do not imply the Skill lacks the capability.
- Audio transcription requires
AUDIO_TRANSCRIBE_API_KEY, AUDIO_TRANSCRIBE_BASE_URL, and AUDIO_TRANSCRIBE_MODEL.
- Chinese courses can use SenseVoiceSmall/FunASR-compatible transcription services.
- English or multilingual courses can use Whisper-compatible or OpenAI transcription models when the endpoint supports them.
- Vision analysis requires
LINEAGE_VISION_API_KEY, LINEAGE_VISION_BASE_URL, and LINEAGE_VISION_MODEL.
- Prefer strong video/vision models for long videos, slides, boards, screenshots, diagrams, and software screens.
- Gemini-class video models are appropriate when exposed through a compatible endpoint or adapter.
- Text distillation requires
LINEAGE_TEXT_API_KEY, LINEAGE_TEXT_BASE_URL, and LINEAGE_TEXT_MODEL when DISTILL_USE_LLM=1.
- Prefer long-context models with stable structured output and good support for the course language.
- PDF/OCR submission requires
MINERU_API_TOKEN unless reusing existing MinerU output with --skip-submit.
- Local media handling requires installed
ffmpeg and ffprobe.
When configuration is absent:
- If transcripts, OCR, notes, or previous distillation files already exist, skip the missing capture stage and continue with the smallest viable workflow.
- If raw audio or videos need transcription and ASR is missing, stop before transcription and tell the user exactly which variables or tools are missing.
- If raw videos need visual analysis and vision configuration is missing, stop before visual analysis or skip it only when the user accepts transcript-only processing.
- If PDFs are present but MinerU is not configured, continue with non-PDF sources and explain that scanned/image PDF evidence was not included unless existing OCR output is available.
Standalone audio files are transcribed by the capture stage, but they do not produce visual analysis or screenshots.
Decision Flow
- Identify source state:
- Videos/audio only: run the full pipeline.
- Videos plus PDFs: run the full pipeline with document OCR if configured.
- Existing transcripts/OCR/notes: skip capture; build package and Skill.
- Existing CoursePackage: skip distillation; build or update Skill.
- Choose role:
- Default:
mentor.
- Use
expert when the user specifically wants narrow course Q&A, concept explanation, or lesson lookup.
- Use
consultant when the user wants private consulting, diagnosis, or advice based on the course methods.
- Use
practitioner when the user wants checklists, playbooks, templates, workflows, or concrete work outputs.
- Use
custom when the user describes a specific role or workflow that does not fit the defaults.
- Treat single-course, multi-course, and fused/domain packages as scope metadata, not role names.
- Treat strict citation as an evidence strategy, not a role name.
- Treat learning progress and daily study planning as a progress strategy, usually attached to
mentor, not a separate role.
- Preserve evidence before summarizing.
- Before rerunning expensive stages, check existing outputs and resume from the smallest viable stage.
- Generate outputs.
- Verify expected files exist and report paths.
Workflows
Default paths:
- Use
.lineage/courses/<course-name>/ for course build state unless the user provides --base-dir or a target directory.
- Use
dist/<skill-name>/ for generated Skills unless the user provides --output-dir.
- Keep one source course per course workspace.
- If the user does not provide
--skill-name, use the builder default:
<course-slug>-mentor-lineage for mentor.
<course-slug>-expert-lineage for expert.
<course-slug>-consultant-lineage for consultant.
<course-slug>-practitioner-lineage for practitioner.
<course-slug>-custom-lineage for custom.
Full Course Pipeline
Use when raw course videos and/or audio files need transcription, visual analysis where video exists, distillation, packaging, and Skill generation.
python scripts/run_course_pipeline.py \
--input-dir <course-media-dir> \
--course-name <course-name> \
--skill-name <skill-name> \
--mode mentor \
--scope auto \
--progress auto \
--output-dir ./dist
With PDFs/OCR:
python scripts/run_course_pipeline.py \
--input-dir <course-media-dir> \
--documents-input <pdf-or-pdf-dir> \
--course-name <course-name> \
--skill-name <skill-name> \
--mode mentor,practitioner \
--scope auto \
--progress tracked \
--output-dir ./dist
Before using PDFs, check MINERU_API_TOKEN. If it is missing, read references/runtime.md and explain the fallback.
Existing Materials
Use when the user already has transcripts, OCR, notes, summaries, or distillation outputs.
python scripts/build_course_package.py \
--course-name <course-name> \
--source-dir <course-dir>
python scripts/build_course_skill.py \
--course-name <course-name> \
--skill-name <skill-name> \
--mode <mode> \
--scope auto \
--source-dir <course-dir> \
--output-dir ./dist
Existing CoursePackage
If <course-dir>/course_package.json already exists, run only build_course_skill.py unless the user asks to rebuild the package.
Multi-Course Skill
Use when the user wants one generated Skill from multiple distilled courses.
First merge course packages:
python scripts/build_multi_course_package.py \
--course <course-a-dir-or-package> \
--course <course-b-dir-or-package> \
--combined-name <combined-course-name> \
--output-dir .lineage/courses/<combined-course-slug>
Then build one Skill:
python scripts/build_course_skill.py \
--course-name <combined-course-name> \
--source-dir .lineage/courses/<combined-course-slug> \
--mode expert \
--scope multi-course \
--output-dir ./dist
Use mentor, expert, consultant, practitioner, or custom according to the user's goal. Preserve source-course distinctions when courses disagree.
Validation Loop
After generation, verify:
<generated-skill>/
├── SKILL.md
├── agents/
├── references/
├── scripts/search_course_notes.py
└── lineage_manifest.json
Check:
lineage_manifest.json exists and includes generated_by.id: lineage-skill.
lineage_manifest.json includes roles, scope, evidence_strategy, and progress_strategy.
references/course_package.json exists.
references/evidence_map.json exists.
references/lesson_index.json exists.
- Role-specific reference files exist for requested roles.
scripts/search_course_notes.py is executable.
<course-dir>/lineage_progress.json exists after a full pipeline run.
<base-dir>/course_catalog.json is updated after a full pipeline run.
If validation fails, fix the missing artifact and rerun the smallest necessary command.
Response Rules
- State which source state was detected and which workflow you used.
- Prefer the smallest pipeline that fits the user's materials.
- Name the generated Skill path and important reference files.
- Distinguish direct course content, course-grounded synthesis, and your own inference.
- If support is missing, say what evidence is missing.
- Never write real API keys into repository files or commit
.env.
- Do not commit private transcripts, screenshots, OCR output, or course distillation artifacts unless the user explicitly wants to publish them.
- For medical, legal, financial, investment, or other high-stakes courses, keep answers educational and source-bounded.
1---2name: lineage-skill3description: Distills course materials into source-grounded AI agent skills. Use when the user wants to convert videos, audio, PDFs, slides, transcripts, OCR output, notes, or existing course distillation files into a CoursePackage and generated mentor, expert, consultant, practitioner, or custom Skill.4---56# Lineage Skill78Turn course materials into reusable, source-grounded AI Skills.910Core method: **Capture -> Cite -> Compress -> Connect -> Codify -> Evaluate**.11Use this as an evidence-first workflow: preserve source material before summarizing, cite sources before synthesizing, and mark unsupported gaps.1213## Read When Needed1415- Runtime reference: [references/runtime.md](references/runtime.md)1617## Trigger Conditions1819Use this skill when the user asks to:2021- Distill a course, lecture series, workshop, training program, curriculum, or long-form class.22- Convert videos, audio, PDFs, slides, screenshots, notes, transcripts, OCR output, or course summaries into structured course knowledge.23- Generate or update a course-backed Skill.24- Build a course mentor, expert, consultant, practitioner, or custom course-backed Skill.25- Package existing `transcripts/`, `analysis/`, `documents/`, `lesson_summaries.json`, `course_distillation_*.md/json`, or `course_package.json`.2627## Capabilities2829This Skill owns the course-distillation pipeline. Do not describe transcription, visual analysis, screenshot extraction, OCR collection, distillation, packaging, or generated-Skill creation as work the user must perform manually when suitable source files and configured providers are available.3031Supported capabilities:3233- Extract audio from `.mp4` course videos and transcribe it through an OpenAI-compatible `/audio/transcriptions` endpoint.34- Directly transcribe standalone `.mp3`, `.wav`, `.m4a`, `.aac`, `.flac`, `.ogg`, and `.opus` course audio files.35- Split long audio into segments before transcription.36- Analyze video content through a vision-capable model, including PPT, board writing, software screens, diagrams, tables, demonstrations, and other visual teaching material.37- Compress and chunk large videos before visual analysis.38- Parse vision-model `[SCREENSHOT MM:SS]` markers, extract key frames from the original video, and de-duplicate similar screenshots.39- Collect MinerU/OCR Markdown outputs from PDFs or document directories.40- Distill transcripts, visual analyses, screenshots, OCR documents, and user notes into structured course notes.41- Build `course_package.json`, `evidence_map.json`, and `lesson_index.json`.42- Merge multiple `course_package.json` files into one combined multi-course workspace.43- Generate source-grounded course Skills in the requested role.44- Record durable pipeline progress in `lineage_progress.json`.45- Build a multi-course workspace catalog with `scripts/build_course_catalog.py`.4647## Provider Requirements4849Capability is separate from configuration. If a provider is missing, report the missing configuration and the smallest viable fallback; do not imply the Skill lacks the capability.5051- Audio transcription requires `AUDIO_TRANSCRIBE_API_KEY`, `AUDIO_TRANSCRIBE_BASE_URL`, and `AUDIO_TRANSCRIBE_MODEL`.52 - Chinese courses can use SenseVoiceSmall/FunASR-compatible transcription services.53 - English or multilingual courses can use Whisper-compatible or OpenAI transcription models when the endpoint supports them.54- Vision analysis requires `LINEAGE_VISION_API_KEY`, `LINEAGE_VISION_BASE_URL`, and `LINEAGE_VISION_MODEL`.55 - Prefer strong video/vision models for long videos, slides, boards, screenshots, diagrams, and software screens.56 - Gemini-class video models are appropriate when exposed through a compatible endpoint or adapter.57- Text distillation requires `LINEAGE_TEXT_API_KEY`, `LINEAGE_TEXT_BASE_URL`, and `LINEAGE_TEXT_MODEL` when `DISTILL_USE_LLM=1`.58 - Prefer long-context models with stable structured output and good support for the course language.59- PDF/OCR submission requires `MINERU_API_TOKEN` unless reusing existing MinerU output with `--skip-submit`.60- Local media handling requires installed `ffmpeg` and `ffprobe`.6162When configuration is absent:6364- If transcripts, OCR, notes, or previous distillation files already exist, skip the missing capture stage and continue with the smallest viable workflow.65- If raw audio or videos need transcription and ASR is missing, stop before transcription and tell the user exactly which variables or tools are missing.66- If raw videos need visual analysis and vision configuration is missing, stop before visual analysis or skip it only when the user accepts transcript-only processing.67- If PDFs are present but MinerU is not configured, continue with non-PDF sources and explain that scanned/image PDF evidence was not included unless existing OCR output is available.6869Standalone audio files are transcribed by the capture stage, but they do not produce visual analysis or screenshots.7071## Decision Flow72731. Identify source state:74 - **Videos/audio only**: run the full pipeline.75 - **Videos plus PDFs**: run the full pipeline with document OCR if configured.76 - **Existing transcripts/OCR/notes**: skip capture; build package and Skill.77 - **Existing CoursePackage**: skip distillation; build or update Skill.782. Choose role:79 - Default: `mentor`.80 - Use `expert` when the user specifically wants narrow course Q&A, concept explanation, or lesson lookup.81 - Use `consultant` when the user wants private consulting, diagnosis, or advice based on the course methods.82 - Use `practitioner` when the user wants checklists, playbooks, templates, workflows, or concrete work outputs.83 - Use `custom` when the user describes a specific role or workflow that does not fit the defaults.84 - Treat single-course, multi-course, and fused/domain packages as scope metadata, not role names.85 - Treat strict citation as an evidence strategy, not a role name.86 - Treat learning progress and daily study planning as a progress strategy, usually attached to `mentor`, not a separate role.873. Preserve evidence before summarizing.884. Before rerunning expensive stages, check existing outputs and resume from the smallest viable stage.895. Generate outputs.906. Verify expected files exist and report paths.9192## Workflows9394Default paths:9596- Use `.lineage/courses/<course-name>/` for course build state unless the user provides `--base-dir` or a target directory.97- Use `dist/<skill-name>/` for generated Skills unless the user provides `--output-dir`.98- Keep one source course per course workspace.99- If the user does not provide `--skill-name`, use the builder default:100 - `<course-slug>-mentor-lineage` for `mentor`.101 - `<course-slug>-expert-lineage` for `expert`.102 - `<course-slug>-consultant-lineage` for `consultant`.103 - `<course-slug>-practitioner-lineage` for `practitioner`.104 - `<course-slug>-custom-lineage` for `custom`.105106### Full Course Pipeline107108Use when raw course videos and/or audio files need transcription, visual analysis where video exists, distillation, packaging, and Skill generation.109110```bash111python scripts/run_course_pipeline.py \112 --input-dir <course-media-dir> \113 --course-name <course-name> \114 --skill-name <skill-name> \115 --mode mentor \116 --scope auto \117 --progress auto \118 --output-dir ./dist119```120121With PDFs/OCR:122123```bash124python scripts/run_course_pipeline.py \125 --input-dir <course-media-dir> \126 --documents-input <pdf-or-pdf-dir> \127 --course-name <course-name> \128 --skill-name <skill-name> \129 --mode mentor,practitioner \130 --scope auto \131 --progress tracked \132 --output-dir ./dist133```134135Before using PDFs, check `MINERU_API_TOKEN`. If it is missing, read [references/runtime.md](references/runtime.md) and explain the fallback.136137### Existing Materials138139Use when the user already has transcripts, OCR, notes, summaries, or distillation outputs.140141```bash142python scripts/build_course_package.py \143 --course-name <course-name> \144 --source-dir <course-dir>145146python scripts/build_course_skill.py \147 --course-name <course-name> \148 --skill-name <skill-name> \149 --mode <mode> \150 --scope auto \151 --source-dir <course-dir> \152 --output-dir ./dist153```154155### Existing CoursePackage156157If `<course-dir>/course_package.json` already exists, run only `build_course_skill.py` unless the user asks to rebuild the package.158159### Multi-Course Skill160161Use when the user wants one generated Skill from multiple distilled courses.162163First merge course packages:164165```bash166python scripts/build_multi_course_package.py \167 --course <course-a-dir-or-package> \168 --course <course-b-dir-or-package> \169 --combined-name <combined-course-name> \170 --output-dir .lineage/courses/<combined-course-slug>171```172173Then build one Skill:174175```bash176python scripts/build_course_skill.py \177 --course-name <combined-course-name> \178 --source-dir .lineage/courses/<combined-course-slug> \179 --mode expert \180 --scope multi-course \181 --output-dir ./dist182```183184Use `mentor`, `expert`, `consultant`, `practitioner`, or `custom` according to the user's goal. Preserve source-course distinctions when courses disagree.185186## Validation Loop187188After generation, verify:189190```text191<generated-skill>/192├── SKILL.md193├── agents/194├── references/195├── scripts/search_course_notes.py196└── lineage_manifest.json197```198199Check:200201- `lineage_manifest.json` exists and includes `generated_by.id: lineage-skill`.202- `lineage_manifest.json` includes `roles`, `scope`, `evidence_strategy`, and `progress_strategy`.203- `references/course_package.json` exists.204- `references/evidence_map.json` exists.205- `references/lesson_index.json` exists.206- Role-specific reference files exist for requested roles.207- `scripts/search_course_notes.py` is executable.208- `<course-dir>/lineage_progress.json` exists after a full pipeline run.209- `<base-dir>/course_catalog.json` is updated after a full pipeline run.210211If validation fails, fix the missing artifact and rerun the smallest necessary command.212213## Response Rules214215- State which source state was detected and which workflow you used.216- Prefer the smallest pipeline that fits the user's materials.217- Name the generated Skill path and important reference files.218- Distinguish direct course content, course-grounded synthesis, and your own inference.219- If support is missing, say what evidence is missing.220- Never write real API keys into repository files or commit `.env`.221- Do not commit private transcripts, screenshots, OCR output, or course distillation artifacts unless the user explicitly wants to publish them.222- For medical, legal, financial, investment, or other high-stakes courses, keep answers educational and source-bounded.