name: notebooklm-orchestration
description: >
Orchestrate NotebookLM operations for UA with a hybrid MCP-first and CLI-fallback
execution model, backed by Infisical-injected auth seed and VPS-safe guardrails.
Use whenever the user mentions NotebookLM/notebooklm/nlm, notebooks, NotebookLM
source ingestion, NotebookLM research, podcast/audio overview generation, report/quiz
creation, flashcards, slide decks, infographics, downloads, sharing, or NotebookLM
automation workflows. Route execution to notebooklm-operator by default.
NotebookLM Orchestration
Use this skill whenever the user intends to operate NotebookLM via UA.
Routing Contract
- Detect NotebookLM intent.
- Delegate to sub-agent by default:
Task(subagent_type='notebooklm-operator', ...)
- Keep primary-agent behavior concise: gather intent, request confirmation when needed, then delegate.
- Pass the full pipeline to the operator in a single delegation. Do NOT micro-manage individual NLM MCP calls from the primary agent.
Runtime Model
Use hybrid execution:
- MCP first when NotebookLM MCP tools are available.
- CLI fallback (
nlm) when MCP is unavailable, needs recovery, or user explicitly requests CLI. - Auth/profile setup and recovery may use CLI even when MCP is available.
Auth Recovery (MCP-First)
Follow this exact sequence before any NotebookLM MCP operation:
Try
refresh_authfirst (fast path):mcp__notebooklm-mcp__refresh_auth()If status is "ok" or "success", proceed to operations.
If refresh fails, inject cookies from environment:
echo "$NOTEBOOKLM_AUTH_COOKIE_HEADER" | head -c 100If set, call:
save_auth_tokens(cookies=<value>)then retryrefresh_auth.CLI fallback (only if MCP tools are completely unavailable):
nlm login --manual --file <(echo "$NOTEBOOKLM_AUTH_COOKIE_HEADER") --profile "${UA_NOTEBOOKLM_PROFILE:-vps}"NEVER run
uv run python scripts/notebooklm_auth_preflight.pyornlm loginwithout--manual.
Confirm-Before-Action Guardrails
Require explicit user confirmation before:
- Notebook/source/studio delete actions.
- Drive sync actions that mutate source state.
- Public sharing toggles.
- Share invite actions.
⚠️ Critical MCP Parameter Rules
List/array parameters MUST be actual JSON arrays, NOT stringified arrays.
- ✅ Correct:
source_indices: [0, 1, 2] - ❌ Wrong:
source_indices: "[0, 1, 2]"
Performance Guidelines (Pass to Operator)
When delegating to the operator, include these hints in your prompt:
Adaptive polling — do NOT use fixed
sleep 15:- Fast research:
sleep 5(max 6 polls) - Deep research:
sleep 20(max 20 polls) - Studio artifacts:
sleep 10(max 30 polls) - Audio/video:
sleep 20(max 20 polls)
- Fast research:
Parallel artifact generation — fire ALL
studio_createcalls first, THEN pollstudio_statusonce for all of them. Do NOT wait between individual create calls.Default to
mode="fast"for research — only use deep when user says "comprehensive/thorough/exhaustive."
CLI Fallback Patterns
Use these only when MCP is unavailable:
nlm login --check --profile "$UA_NOTEBOOKLM_PROFILE"
nlm notebook list --json --profile "$UA_NOTEBOOKLM_PROFILE"
nlm source add <notebook> --url "https://..." --wait --profile "$UA_NOTEBOOKLM_PROFILE"
nlm studio status <notebook> --profile "$UA_NOTEBOOKLM_PROFILE"
Output Expectations
The delegated sub-agent should return a compact contract with:
statuspath_used(mcp|cli|hybrid)operation_summaryartifactswarningsnext_step_if_blocked