Episode pipeline
T="${CLAUDE_PLUGIN_ROOT}/tools"
W="${SHADOWCAST_HOME:-$HOME/Shadowcast}/<slug>"
Read these before starting:
W/channel.jsonW/STYLE.md${CLAUDE_PLUGIN_ROOT}/skills/episode/references/RULES.md${CLAUDE_PLUGIN_ROOT}/skills/episode/references/KIT.md
Then run python3 "$T/ep.py" list <slug>.
- If an episode ID is given, or one is unfinished, resume it at its status.
- Otherwise start a new one.
After each stage, record it with python3 "$T/ep.py" set <slug> <ID> <status> so a crash or a new session continues where it stopped.
1. planned → researched
- Pick the topic.
- If none was given, take the best unused idea from STYLE.md "Topics".
- Check it isn't a repeat: compare against the existing episode titles.
- Use WebSearch to check it's timely or evergreen.
- Create the episode. Run
python3 "$T/ep.py" new <slug> "<working title>". It prints{id, dir, src}. - Research.
- Use WebSearch/WebFetch on primary and reputable sources: court records, major outlets, official stats, the person's own statements.
- Record 2+ sources for any serious claim.
- Fill
dir/FACTSHEET.md. Every claim, its exact status, and its source; a "Never say" list; numbers with units; the Sources list (outlet, "headline", date, URL). - Set status
researched.
2. researched → scripted → awaiting_approval
- Write
dir/SCRIPT.mdfrom the template.- Sections are
##headings, and every voiced line starts with**VO:**. - Section names drive the rail:
- countdown:
COLD OPEN,#10 NAME…#1 NAME,OUTRO - chapters:
COLD OPEN,CHAPTER 1: TITLE…,OUTRO
- countdown:
- Length = minutes × wpm words.
- Sections are
- Self-check against FACTSHEET line by line. Every sentence must be supported; fix or cut anything that isn't.
- If
meta.feedbackexists, this is a rewrite: address every point, then clear it withpython3 "$T/ep.py" set <slug> <ID> scripted feedback=. - Approval gate. Set
awaiting_approval, then runpython3 "$T/notify.py" <slug> "Script ready: <ID>" "<title>. Approve with /shadowcast:approve <slug> <ID>". What happens next depends on the session:- Interactive session: show the user the title, a 5-line summary, the claim count and the path. Ask whether to approve now.
- Autopilot: stop work on this episode.
ep.py nextdecides when it may continue: after the approval window inoptionalmode; never automatically whenreal_peopleis true or mode isrequired.
- When approved: set
approved.
3. approved → voiced
python3 "$T/tts.py" "<dir>": one ElevenLabs request per section, with timestamps.- Add pronunciation fixes to
channel.json voice.respell(e.g.[["Nguyen","Win"]]).
- Add pronunciation fixes to
python3 "$T/tighten.py" "<dir>" <tempo>: caps pauses at 0.32 s, tempo fromvoice.tempo(default 1.1).- It writes
audio/vo_tight.wav,words_tight.jsonandsections_tight.json.
- It writes
- Listen-check by reading
words_tight.jsonaround tricky names. Check the total duration is within ±15% of the target. - Set
voiced.
4. voiced → built
- Photos. Start fetching people and backgrounds early. For each item, follow the RULES "Assets" section:
- Search:
python3 "$T/commons.py" search "<query>". - Fetch:
python3 "$T/commons.py" fetch "<dir>/assets/web" p_<name> "File:<title>". - Cut out:
python3 "$T/cutout.py" "<dir>/assets/web/p_<name>.jpg" "<dir>/assets/cut/<name>.png". - Look at every cut-out.
- Run several fetches in a background agent if it's slow. Build with stand-ins meanwhile.
- Search:
- Long video shots. Write
src/shots.tsx, splitting intoshots1.tsx/shots2.tsxpast ~40 shots.- One shot per beat, every 4-8 s, word-anchored with marks for each reveal.
- Vary the components and follow the STYLE visual grammar.
- Cold open:
TitleCard, or aLineup/Teasershook. Each countdown item opens withCountdown. Outro ends withChoicesthenEndCard.
- Shorts. Pick 2 sections (strongest hook; #1 or payoff) and write
short1.tsx/short2.tsxwith fresh 9:16 shots for that section. - Thumbnails. Write
thumbs.tsxwith ThumbA/B/C (see RULES). index.tsx. UsemakeEpisode({ words: W_, sections: S_, shots: SHOTS, rail, total })and the EpisodeEntry ids<ID>,<ID>Short1,<ID>Short2,<ID>ThumbA/B/C.railis"countdown"withtotal= item count, or"chapters".
- Register and typecheck. Run
python3 "$T/ep.py" register <slug> <ID>, thencd "$W/studio" && npx tsc --noEmit -p ., and fix every error. - Set
built.
5. built → audited (do not skip)
- Run
python3 "$T/audit_layout.py" "$W/studio" "<dir>" <ID>. - Open every sheet it prints with Read. Check each frame against the RULES "Layout" list.
- Fix, re-run, and look again until a full pass is clean.
- Also view the thumbnails:
npx remotion stilleach one into the scratchpad. - Set
audited.
6. audited → rendered
- Check the disk with
df -h ~. You need about 3 GB free. - Run
python3 "$T/render.py" episode <slug> <ID>. It writesout/long.mp4,short1.mp4,short2.mp4andthumb_A/B/C.jpg. A 10-minute video takes about 10-25 minutes. - Verify:
ffprobethe durations, extract and view about 6 frames from the long video and 3 per Short (ffmpeg -ss <t> -i <f> -frames:v 1 <scratch>.jpg), and view the thumbnails. - Set
rendered.
7. rendered → packaged
- Add a
"package"section todir/meta.json. The format is intools/package.py's docstring:- 3-4 title options (main first, under 70 characters, following the STYLE title formula)
- summary (2-3 sentences, keyword-rich, accurate), cta, 12-18 tags
- chapter_names if the section names need prettifying
- accuracy notes, the thumbnail letter
- the two shorts: role, title with
#shorts, hook, social caption, sources
- Run
python3 "$T/package.py" <slug> <ID>. - Set
packaged.
8. packaged → scheduled
Hand off to the publish skill (/shadowcast:publish <slug> <ID>), or follow its steps directly.