NotebookLM Studio
by @jasontsaicc
Import sources (URLs, YouTube, files, text) into Google NotebookLM and generate user-selected artifacts: podcast, video, report, quiz, flashcards, mind map,...
clawhub install notebooklm-studio๐ About This Skill
name: notebooklm-studio description: > Import sources (URLs, YouTube, files, text) into Google NotebookLM and generate user-selected artifacts: podcast, video, report, quiz, flashcards, mind map, slides, infographic, data table. Use when the user sends content and asks to generate learning materials, podcasts, videos, or study packages. version: 2.1.2 metadata: openclaw: requires: bins: [notebooklm, ffmpeg] emoji: "๐๏ธ"
NotebookLM Studio
Import sources into NotebookLM, generate user-selected artifacts via CLI, download results locally.
Inputs
Collect from user message (ask only for missing fields):
audio (podcast), video, report, quiz, flashcards, mind-map, slide-deck, infographic, data-table
zh_Hant): applied via notebooklm language setreferences/artifact-options.md for all options per artifact type.
See references/source-types.md for source type detection rules.
See references/artifacts.md for all 9 artifact types and CLI options.
Workflow
Steps are sequential gates โ do NOT skip or combine steps. Each numbered step must complete before the next begins. In particular:
0. Auth precheck โ Verify the session is valid before doing any work:
notebooklm auth check --test --json
- "status": "ok" โ proceed to step 1.
- "status": "error" โ stop immediately. Tell the user:
> NotebookLM ็ปๅ
ฅๅทฒ้ๆ๏ผ่ซๅ
้ๆฐ็ปๅ
ฅ๏ผnotebooklm login๏ผ๏ผๅฎๆๅพๅ่จดๆ๏ผๆๅ็นผ็บใ
- Command itself fails (network error, CLI not found, etc.) โ also stop and report the error.
- --test is required โ without it, only local checks run, which can pass even with an expired session.
- When the user confirms re-login, re-run this check before continuing.1. Parse input & configure artifacts โ
1a. Select artifacts โ Detect source types from user message (URLs, files, text). Confirm which artifacts to generate.
1b. Discuss options โ Before generating, confirm key options for each selected artifact.
Refer to references/artifact-options.md for priority levels:
- ASK options: must ask the user
- OFFER options: state the default, let user decide whether to change
- SILENT options: use defaults without asking
- Options already specified by the user โ skip
- Present all questions in a single message (batch, not one-by-one)
If user says "use defaults" โ skip all questions, proceed with default values immediately.
Example agent message (audio + video + report + quiz + flashcards + slides + infographic selected):
> Before generating, a few options to confirm:
> - Podcast: deep-dive / brief / critique / debate?
> - Video: explainer / brief / cinematic? (cinematic uses Veo 3, takes 30-40 min)
> - Report: briefing-doc / study-guide / blog-post / custom?
> - Slides: detailed / presenter?
> - Quiz & Flashcards: difficulty medium, quantity standard โ adjust?
> - Infographic: style auto, or prefer a specific style (sketch-note, professional, bento-grid...)?
> - Language: zh_Hant, OK?
>
> Or just say "use defaults" to start immediately.
2. Derive slug โ Based on the sources and user message, generate a short kebab-case slug (2-4 words) that captures the core topic. This slug is used for both the notebook name and the output directory.
- Examples: react-server-components, feynman-technique, taiwan-semiconductor-q4
- Keep it concise, lowercase, ASCII-only (transliterate non-ASCII if needed)
- If the user provides a topic or title, prefer that as the basis
3. Create notebook โ
notebooklm create " "
# โ {"notebook_id": "xyz789", ...} โ capture notebook_id
notebooklm use
mkdir -p ./output/
4. Set language โ
notebooklm language set
Use the language confirmed in step 1b. โ ๏ธ GLOBAL setting โ always set explicitly to avoid residual from previous runs.5. Add sources โ For each source:
# URL, YouTube, or file path
notebooklm source add "" # Google Drive
notebooklm source add-drive ""
For plain text โ save to a .txt file first, then source add "./temp_text.txt".6. Generate artifacts โ Two-tier strategy for timeout safety:
โ ๏ธ Deduplication gate (Tier 2 only) โ Before generating Tier 2 artifacts, call artifact list once and check all requested types in that single response:
notebooklm artifact list --json
# โ [{"task_id": "abc123", "type": "slide-deck", "status": "processing"}, ...]
For each Tier 2 artifact you are about to generate, look for entries where type matches (e.g., slide-deck, audio, video). If multiple entries match the same type, the non-terminal status takes priority (processing/pending > completed > failed):
- processing / pending โ do NOT generate again. Take the existing task_id, go to step 9 (wait + deliver).
- completed โ do NOT generate again. Skip the wait โ go directly to download + deliver in step 9.
- failed โ safe to re-generate.
- No matching entry โ proceed with generation. If artifact list itself fails or returns an error, proceed with generation โ the dedup check is a safety net, not a hard gate.
Duplicate generation wastes resources and causes confusion โ this gate prevents the most common operational error.
Tier 1 โ Immediate (use --wait, completes within timeout):
# Sync (instant)
notebooklm generate mind-map # Fast async (1-2 min) โ use options confirmed in step 1b
notebooklm generate report --format --wait
notebooklm generate quiz --difficulty --quantity --wait
notebooklm generate flashcards --difficulty --quantity --wait
notebooklm generate data-table "" --wait
# Medium async (2-5 min, borderline โ if timeout, retry or move to Tier 2)
notebooklm generate infographic --style --orientation --wait
Tier 2 โ Deferred (use --json without --wait, capture task_id for step 9):
# Slow async โ use options confirmed in step 1b
# Parse JSON output to extract task_id for polling
notebooklm generate slide-deck --format --json
# โ {"task_id": "abc123", "status": "pending"} โ save task_id notebooklm generate video --format --style --json
# โ {"task_id": "def456", "status": "pending"} โ save task_id
# Note: if cinematic, omit --style (ignored by Veo 3)
notebooklm generate audio "" --format --length --json
# โ {"task_id": "ghi789", "status": "pending"} โ save task_id
Options accepted as defaults in step 1b can be omitted (CLI uses its own defaults).
Parse each JSON response and save the task_id โ you will need it in step 9.
Only generate the artifacts the user requested. Skip the rest.
See references/artifacts.md โ "Deferred Generation" for Tier 2 details. Write delivery status โ Immediately after all Tier 2 generates are dispatched, write ./output/ so the recovery script can pick up if the agent times out:
{
"slug": "",
"notebook_id": "",
"created_at": "",
"artifacts": [
{"type": "slide-deck", "task_id": "", "status": "pending", "output_path": "./output//slides.pdf"},
{"type": "audio", "task_id": "", "status": "pending", "output_path": "./output//podcast.mp3"}
]
}
Update each artifact's status to completed or failed as step 9 progresses.
This file is the handoff contract between the agent and scripts/recover_tier2_delivery.sh.
Telegram delivery is agent-only (requires OpenClaw message tool); the recovery script handles download + status tracking only.7. Download Tier 1 โ Each successful Tier 1 artifact into ./output/:
notebooklm download mind-map ./output//mindmap.json
notebooklm download report ./output//report.md
notebooklm download quiz --format json ./output//quiz.json
notebooklm download flashcards --format json ./output//flashcards.json
notebooklm download data-table ./output//data.csv
notebooklm download infographic ./output//infographic.png
8. Report + Deliver Tier 1 โ Present completed Tier 1 artifacts to user. If Tier 2 artifacts are pending, include a status note: > "Slides/Audio/Video are still generating, I'll send them when ready."
Telegram delivery (OpenClaw only) โ If message tool is available:
1. Text summary with Tier 2 pending status (always first)
2. Report โ Quiz โ Flashcards โ Mind Map โ Infographic โ Data Table
See references/telegram-delivery.md for delivery contract.
Skip Telegram delivery if running outside OpenClaw (e.g. Claude Code, Codex).
9. Poll + Deliver Tier 2 โ Wait for each deferred artifact in order of expected speed (fastest first), then download and deliver as each completes:
# Wait by expected completion order: slide-deck (fastest) โ video โ audio (slowest)
# Uses --interval 5 (not default 2) since Tier 2 artifacts take minutes, not seconds
notebooklm artifact wait --timeout 1800 --interval 5 --json
# โ {"status": "completed", ...} โ task_id from generate is used as artifact_id here
notebooklm download slide-deck ./output//slides.pdf
# โ deliver to Telegram immediately notebooklm artifact wait --timeout 1800 --interval 5 --json
# Note: if cinematic, use --timeout 2400 (generation takes 30-40 min)
notebooklm download video ./output//video.mp4
# โ deliver to Telegram immediately
notebooklm artifact wait --timeout 1800 --interval 5 --json
notebooklm download audio ./output//podcast.mp3
bash scripts/compress_audio.sh ./output//podcast.mp3 ./output//podcast_compressed.mp3
# โ deliver to Telegram immediately
- Order matters: wait for fastest artifact first (slide-deck โ video โ audio) to minimize idle time
- On completion: download โ post-process โ deliver to Telegram โ update delivery-status.json status to completed
- On failure: update status to failed with reason, notify user, continue to next artifact
- On timeout: see timeout recovery below
- Max wait: 30 minutes per artifact (covers worst-case audio/video)
- If agent is about to exit with any artifact still pending, tell the user:
> "Tier 2 ่ฃ้ๆจกๅผๅทฒๅๅ๏ผrecovery script ๆๆฏ 5 ๅ้ๆชขๆฅไธฆ่ชๅ้้ใ" โ ๏ธ Timeout recovery โ If artifact wait returns status: "timeout", the artifact is likely still generating. NEVER re-generate. Instead:
1. Re-check status: notebooklm artifact poll
2. If processing โ re-wait: notebooklm artifact wait
3. If completed โ download and deliver
4. If failed โ notify user with error, move to next artifact
5. If re-wait also times out (2+ total timeouts, ~60 min elapsed) โ give up, notify user, suggest downloading from NotebookLM directly
A timeout means the wait expired, not that generation failed. The task continues server-side. Re-generating creates duplicates and wastes time.
Error handling
Delivery confirmation gate
Before reporting "complete" to the user, ALL of the following must be true:
1. Every requested artifact is either successfully delivered or reported as failed with reason
2. For Telegram delivery (OpenClaw): each message tool call (OpenClaw's built-in messaging tool) returned a success response with a messageId
- If a send fails, retry once. If still failing, report the failure to the user โ do NOT silently skip
3. No artifact is still in processing or pending status without being tracked
Never say "done" while any artifact is still pending delivery. If Tier 2 artifacts are still generating, say so explicitly and continue waiting. The task is not complete until everything is delivered or accounted for.
Quality gate
Before delivery, verify:
See references/output-contracts.md for format specifications.
Delivery template
1. Selection rationale (<=3 bullets) 2. Artifact list with paths/status (all 9 types if applicable) 3. Key takeaways (3-5 bullets) 4. Failures + fallback note (if any) 5. One discussion question
Changelog
v2.1.0
auth check --test --json before any work; expired sessions fail fast instead of blowing up mid-generation.artifact list before Tier 2 generation to prevent duplicate artifacts when agent retries or resumes.artifact wait timeout no longer triggers re-generation; polls status and re-waits, giving up only after 2 consecutive timeouts (~60 min).delivery-status.json after Tier 2 dispatch; step 9 updates it as artifacts complete. Enables cron-based recovery via scripts/recover_tier2_delivery.sh when agent times out.