# Source-ingest
<!--
ref: @knowledge/fetch
tags: [knowledge, source, ingest]
aliases: [fetch, transcript, episode]
version: 1
updated_at: 2026-01-24T19:24:17.297Z
-->
Fetch content from queue, save to raw, generate summaries.
## Tooling
**YouTube sources**: Use the TypeScript integration tools in protocol-shared:
```bash
# Get protocol-shared location from CLI
PROTOCOL_SHARED=$(protocol config get directories.shared)
# Full ingestion (transcript + chunked summarization)
node $PROTOCOL_SHARED/integration/_yt/ingest-episode.mjs <video-id> <source> --title="Title"
# Transcript only (no summarization)
node $PROTOCOL_SHARED/integration/_yt/fetch-transcript.mjs <url-or-video-id>
```
**Environment**: Requires `.env` at workspace root with:
- `OPENAI_API_KEY` - For chunk summarization (gpt-4o-mini/gpt-4o)
**Tech stack**: TypeScript/Node.js only. No Python dependencies.
## Process
1. Pick item from Pending → move to Processing
2. Fetch content using appropriate integration tool (see Tooling above)
3. Save to `raw/{YYYY-MM-DD}-{video-id}-{slug}.md`
4. **Chunk-summarize** using sub-agents (see below)
5. Generate episode summary → `summaries/episodes/`
6. Identify themes → mark relevant `summaries/themes/*.md` stale
7. Mark `summaries/master.md` stale
8. Move to Completed
## Chunk Summarization (Large Sources)
For sources >5k tokens, use hierarchical summarization:
```
Raw transcript (e.g., 25k tokens)
↓ split into ~5k token chunks
[Chunk 1] [Chunk 2] [Chunk 3] [Chunk 4] [Chunk 5]
↓ sub-agent summarizes each chunk (~1k tokens each)
[Sum 1] [Sum 2] [Sum 3] [Sum 4] [Sum 5]
↓ combine and summarize again
[Episode Summary] (~2k tokens)
```
**Sub-agent pattern**: Spawn parallel agents, each receives one chunk:
- "Summarize this transcript chunk. Extract: key insights, quotes, actionable items."
- Return compressed summary with source line references
- Parent combines chunk summaries into final episode summary
This is the **default mode** for all large content. Never attempt to read/summarize a large file in one pass.
## File Naming Convention
All raw and summary files use date prefix for chronological sorting:
```
{YYYY-MM-DD}-{video-id}-{slug}.md
```
- **Date**: Publish date of content (preferred) or import date (fallback)
- **Video ID**: YouTube video ID for reference
- **Slug**: Slugified title (max 50 chars)
Example: `2025-12-04-P7Y-fynYsgE-stuart-russell-ai-warning.md`
## Episode Summary Format
```markdown
---
source: doac
episode: P7Y-fynYsgE
title: "Naval Ravikant on Wealth"
guest: Naval Ravikant
date: 2024-01-15
duration: 1:23:45
topics: [wealth, happiness, startups]
generated: 2024-12-18T16:00:00Z
sources:
- raw/2024-01-15-P7Y-fynYsgE-naval-ravikant.md
---
# Naval Ravikant on Wealth
## Key Insights
- Point 1 (raw/filename.md:45)
- Point 2 (raw/filename.md:123)
## Actionable Takeaways
- ...
## Notable Quotes
> "Quote here" (raw/filename.md:89)
```
---
*Related: `@protocol/compound-learnings` · `@skills/slack-gif-creator` · `@knowledge/taxonomy-decisions` · `@knowledge/refresh` · `@knowledge/ask`*
---
*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*
*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*