Tools and files
Five skills live in .claude/skills/; the main one, video-script-production, holds 12 scripts, 2 data files (rules.json, voice-patterns.json) and 26 reference files. Research code is in src/ (33 ecosystem stages, series analysis, topic research). Per-video work is in research/<topic>/. The authoritative registry of tools is .claude/skills/video-script-production/references/tools.md, which must be updated in the same session as any tool is created or changed. transcripts/, reports/, data/ and .env are gitignored and local.
- One command to remember:
check.js. - Rule: before building a script, check
tools.md; it exists to stop the same scratch script being built twice. - Kinds: D deterministic (same input, same output, no model), L uses a model (results vary), H a procedure for the agent to follow.
Skills
| Skill | Kind | What it does | Used at |
|---|---|---|---|
video-script-production | D + H | Writes and checks a script to the v6 bar: lessons A to M, linter, damage test, gate runner, ledger check, scaffold, retime, calibration, session log, Hinglish parity, TTS builder. Entry SKILL.md, procedure references/runbook.md. | S0, S3 to S11 |
winning-video-teardown | L (Sonnet analysts) + D | Takes winning videos, finds each mechanism and quotes the moment, counts which recur. Taxonomy of script, packaging and thumbnail mechanisms. | S2; series study |
script-cohort-analysis | L (Haiku raters via script-rater) + D | Blind, pre-registered statistical test of which script rules predict performance in a cohort. Rubric v3: 45 checks, 11 dimensions. | Series study; once enough comparable scripts exist |
within-channel-study | D + H | What separates a channel's best, median and worst videos. | Channel and topic evidence |
ecosystem-rater | D | Rates niches on demand, room, evergreen value, upload pressure, monetization. | Niche selection |
Agent: .claude/agents/script-rater.md, the blind rater for the cohort skill (reads one task file, writes validated JSON).
Scripts in video-script-production/scripts/
| Script | Kind | Input to output | When |
|---|---|---|---|
check.js | D | --dir --version [--prev] [--fix] [--no-selftest] to every gate, STATUS-vN.md, lint/; BAR MET or what to do next. Exit 1 on a hard gate. | End of every stage; session start |
lint.js | D | --script --chain [--label --out] to lint-<label>.json/.md; exit 1 on FAIL. 70 rules. | S8 |
selftest.js | D | --script --chain to a damage test (56 mutations on v7). | S8; whenever a rule changes |
ledger-check.js | D | --script [--chain --facts --strict]: every spoken digit figure is in the ledger; sections exist. | S8 |
retime.js | D | --script [--write --check]: heading time ranges from word counts. | S8 |
extract-vo.js | D | --script [--mode timed|blind|plain --out]: the spoken text, numbered. | S9, S10; TTS copy-paste |
calibrate.js | D | --dir <winner transcripts> [--script] [--out]: voice, rhythm, comparison, admission, "you" and name measures with medians. | When thresholds are set or new winners arrive |
session-log.js | D | [--jsonl --since --until --prompts --user --out]: every search, fetch and subagent of a Claude Code session as Markdown. | S11 |
compare.js | D | --a --b --sa --sb --out: side-by-side text-level measures. | S8 |
scaffold.js | D | --dir --version [--beats --title] [--from vP]: blank script, chain, FACTS, hand-off, or the next version copied from the last. | S0 |
hinglish-parity.js | D | --english --hinglish [--allow --max-ratio]: beats, paragraphs, digits, question marks, quotes, names and graphics match; length ratio per beat. | After writing a Hinglish version |
tts-gemini.js | D | --script --spec --out --name: per-beat Gemini TTS prompts for 3.1 and 3.8, refusing to write unless the words match. | Voice stage |
rules.json | data | Every threshold with its reason; the bar block. Read, never edited to pass. | |
voice-patterns.json | data | Regexes for negation pivots, run-ups, stock phrases, comparison markers, stock figures, verdict words, viewer address. | Read by lint.js |
Repo code used upstream
| Tool | Kind | What it does |
|---|---|---|
src/topic-research/cli.js "<topic>" --entity= --max= --also= --refresh | L | Search, transcripts, extraction, synthesis, research/<slug>/report.md and synthesis.json. Cached. See page 05. |
src/topic-research/export-csv.js, export-cohort.js | D (network) | Every video seen with channel subscriber counts; transcripts in the teardown layout. |
src/series-analysis/* (npm run series -- <cmd> --series=<id>) | D + L | Find, enrich, rank and cohort videos for a series. See page 03. |
src/series-analysis/topic-study.js --series=fall-of-x | D | Which subjects draw views. See page 04. |
src/series-viewer/server.js | D | Local viewer on port 3100 for series results, with single-video teardown generation. |
src/stages/01-*.js to 33-*.js | D + L | Ecosystem intelligence. See page 02. |
src/llm.js, src/gemini.js | L | Language-model client: Gemma 4 on the Gemini API, falling back to Ollama. |
src/transcript-fetch.js, src/video-info-fetch.js | D | Caption and metadata fetch. |
Video stage (research/the-fall-of-moser-baer/video/tools/)
| Tool | Kind | Input to output |
|---|---|---|
beat_text.py | D | TTS prompt (3.1) to reference-words.json |
whisper_words.py | L (Whisper decoding) | Beat WAVs to raw/B#.whisper.json |
align_words.py | D | Reference words, Whisper words, WAVs and the script to B#.json, words.json, align-report.md |
split_whisper.py | D | Helper (not described in the registry) |
Folder map
ecosystem-generic/
CLAUDE.md standing instructions, loaded automatically
README.md, README-SERIES-ANALYSIS.md, README-WITHIN-CHANNEL-ANALYSIS.md, QUEUE-DEFINITIONS.md
SCIENCE-ECOSYSTEM-RUNBOOK.md, catalogue-crawl-investigation-v1.md
config.js, config-*.js one niche definition each (config.js = the active one: crochet)
package.json npm scripts (discover ... series, series:viewer, test:all)
docs/ these pages, plus older Markdown (SCRIPT-PIPELINE.md, PROMPT-cafe-coffee-day.md)
series/ why-x-died.json, fall-of-x.json (series specs)
seeds/ topics.json, discovery-v2.json, human-reference-channels.json
src/
stages/ 01 to 33, the ecosystem pipeline
analysis/, discovery/ scoring, queues, within-channel statistics
series-analysis/ cli, cohorts, scoring, signals, store, topic-study, report
series-viewer/ local web viewer
topic-research/ cli, extract, synthesize, report, export-*, sources/
llm.js, gemini.js, db.js ...
tests/ 16 test files (npm run test:all)
ecosystem-ratings/ scorecard.md and one folder per niche (probe queries, metrics)
research/
the-fall-of-moser-baer/ report.md, synthesis.json, search.json, transcripts/, extractions/,
teardown/ (SYNTHESIS.md, cohort-*, run/), script/ (SCRIPT-v3..v7, chain-v4..v7,
HANDOFF, STATUS, lint/, tts/, audio/), video/ (tools, timing, PRODUCTION-PLAN.md)
the-fall-of-cafe-coffee-day/ same shape; script/ has FACTS.md, SCRIPT-v1.md, PROGRESS.md, RESEARCH-LOG-v1.md
.claude/
skills/ the five skills
agents/script-rater.md
data/ (gitignored) SQLite databases, ai-mode-poc/
reports/ (gitignored) queue, qualification, series-analysis, topic-study reports
transcripts/ (gitignored) per-channel samples (_study/), series-analysis/ cohorts and teardowns, _script_ledger.json
Inside video-script-production/
| Path | Holds |
|---|---|
SKILL.md | Entry point: lessons table, the steps, the reference index. |
references/runbook.md, quality-bar.md | The eleven stages, defaults, maturity ladder; what "finished" means. Read first. |
references/history.md, research-log.md, research-log-round7.md | How v3 became v7; every search and fetch behind it. |
references/s1-rival-brief.md, s2-teardown.md, research-protocol.md | The research stages in full. |
references/principles.md, texture.md, implicit-pull.md, voice.md, stakes-and-load.md, beat-contract.md, opening-protocol.md | The reasoning and evidence behind the lessons. |
references/chain-schema.md, lint-fixes.md | The file formats and every rule's usual cause and fix. |
references/read-aloud-checklist.md, reader-prompts.md, handoff-template.md | The judgement gates and the final message. |
references/lesson-protocol.md, review-round-7.md | How a review comment becomes a rule; the 35-note trace. |
references/hinglish-adaptation.md | Hinglish rules, parity, TTS. |
references/launch-prompt.md | The prompt that makes a fresh session run the whole pipeline for one topic. |
references/tools.md, learnings.md | The tools registry; what each script taught. |
examples/moser-baer-v6/, moser-baer-v7/ | Frozen copies of the approved script, chain, gate report and a map of the form. |
Command cheat sheet
# where does a script stand?
node .claude/skills/video-script-production/scripts/check.js --dir research/the-fall-of-moser-baer/script --version v7 --no-selftest
# new topic
node .claude/skills/video-script-production/scripts/scaffold.js --dir research/<slug>/script --version v1 --beats 13 --title "<title>"
node src/topic-research/cli.js "the fall of <x>" --entity="<X>" --max=8 # run in the background; 20 to 25 min
node .claude/skills/video-script-production/scripts/check.js --dir research/<slug>/script --version v1 --fix
# next version of an existing script
node .claude/skills/video-script-production/scripts/scaffold.js --dir research/<slug>/script --version v2 --from v1
# spoken text for reading, readers or TTS
node .claude/skills/video-script-production/scripts/extract-vo.js --script research/<slug>/script/SCRIPT-vN.md --mode plain
# Hinglish checks and TTS prompts
node .claude/skills/video-script-production/scripts/hinglish-parity.js --english SCRIPT-vN.md --hinglish SCRIPT-vN-hinglish.md
node .claude/skills/video-script-production/scripts/tts-gemini.js --script SCRIPT-vN-hinglish.md --spec tts/spec-vN-hinglish.json --out tts --name vN-hinglish
# series and topic studies
npm run series:all
npm run series -- cohorts --series=why-x-died
node src/series-analysis/topic-study.js --series=fall-of-x
# research record at the end of a run
node .claude/skills/video-script-production/scripts/session-log.js --since <iso time> --out research/<slug>/script/RESEARCH-LOG-vN.md
# tests
npm run test:all
Use the full paths from the repo root. Write code and regexes with the Write or Edit tool, not shell heredocs.
Git and what is tracked
- Branch
research/moser-baer; main ismain. The last commit is156897f(Moser Baer v4, 2026-10-25 00:29 IST). About 76 paths show as modified or untracked, including every reference file added after v4,examples/, all of v5 to v7, the Cafe Coffee Day folder and the video stage. Nothing has been pushed. - Gitignored:
node_modules/,data/,reports/,transcripts/,*.db,.env,project-dump.txt. This means the series study, topic study and within-channel studies exist only on this machine. - Do not commit or push unless the user asks.
Memory notes
Notes for this project are in the Claude memory folder (C:\Users\nnjha\.claude\projects\C--Users-nnjha-OneDrive-Desktop-ecosystem-generic\memory\), indexed by MEMORY.md: the series study, the lessons A to M and the user's preferences, the Moser Baer script state, the pipeline docs pointer, the Hinglish and TTS state, and the video timing pipeline. They are background context and may be out of date; verify against the files.
Known gaps (candidates for the next tools)
- Cohort rubric v4 for the E to M checks, so
script-cohort-analysiscan test them blind once there are enough comparable scripts. - A terms-per-30-seconds density rule and a calibration of the K3 budget on winners (K3, K4 and M1 are a partial answer).
- A check that a script's [CHECK] rows are the same set as its open items (today only the words are checked).
- A speech-timing check with a real text-to-speech pass. Partly answered by the beat WAVs; the headings still use 150 wpm.
- A packaging check (title and thumbnail) in the linter; today the title tension is a judgement written in the hand-off.
- A second-topic validation run of the whole runbook with the K, L, M rules.
Scratch tools that were promoted (so you do not rebuild them)
The calibration scripts became calibrate.js; the transcript-mining scripts became session-log.js; the blind-file maker became extract-vo.js --mode blind; manual timecode edits became retime.js; the lost Gemini prompt generator became tts-gemini.js; the throwaway parity check became hinglish-parity.js. A scratch script that is done twice should be promoted the same way, with a row in tools.md.
Written 2026-10-27 from the repository files and the project memory notes. If a page and a file disagree, the file is right: fix the page.