NotebookLM Distiller
Automated knowledge extraction pipeline: search NotebookLM notebooks by keyword → generate deep questions or structured summaries → write linked Obsidian markdown notes.
Five subcommands:
- -
distill — extract knowledge from existing notebooks (qa / summary / glossary) - INLINECODE1 — generate quiz questions as JSON for Discord-based interactive sessions
- INLINECODE2 — evaluate a user's answer against notebook sources (JSON output)
- INLINECODE3 — start a web research session inside NotebookLM on any topic
- INLINECODE4 — write any markdown content directly into the Obsidian vault
When to use (trigger phrases)
Trigger distill subcommand when:
- - User types
/notebooklm-distill or INLINECODE7 - User says "蒸馏", "提取知识", "distill notebooks", "extract from notebook"
- User wants NotebookLM content structured into Obsidian notes
Trigger research subcommand when:
- - User says "研究一下 ", "做网络调研", "research this topic in NotebookLM"
- User wants NotebookLM to gather web sources on a topic without providing URLs
Trigger quiz + evaluate subcommands when:
- - User says "quiz me on X", "考考我", "出题测试我", "测验"
- User wants an interactive Q&A session in Discord on a NotebookLM topic
- Orchestration flow (Discord):
1. Call
quiz --keywords X → get JSON with
notebook_id +
notebook_name +
questions[]
2.
MUST announce source before Q1:
来,N 道题(来源:{notebook_name} · ID: {notebook_id[:8]})
3. Send Q1 to Discord, wait for user reply
4. Call
evaluate --notebook-id X --question Q1 --answer <reply> → get JSON feedback
5. Post feedback to Discord, proceed to Q2
6. Repeat until all questions done or user says stop
- - CRITICAL: Always show notebook source so user can verify questions came from NLM, not agent knowledge
Trigger persist subcommand when:
- - User says "存到 Obsidian", "把这段内容写入知识库", "persist this to vault"
- User wants to archive discussion output or raw notes into the vault
CRITICAL: Do NOT answer from internal knowledge. Do NOT ask for clarification. Execute the appropriate subcommand immediately.
Prerequisites
- - NotebookLM CLI: INLINECODE18
- Authentication:
notebooklm login (creates ~/.book_client_session) - Python 3.10+ (standard library only — no extra pip packages needed for distill.py)
- Obsidian vault directory accessible on the local filesystem
Subcommand: distill
Extract knowledge from one or more NotebookLM notebooks matching keywords.
Agent orchestration
Scenario A — URL provided (needs ingestion first)
- 1. Check if
deepreader is installed (~/.openclaw/skills/deepreader/run.sh). - If yes: run DeepReader to ingest the URL into NotebookLM.
- Capture the notebook title from DeepReader output.
- Use that title as
--keywords for distill.
Scenario B — notebook already exists
- 1. Use notebook name from context, or list notebooks with
notebooklm list. - Determine mode from intent: "总结" →
summary, "术语/概念" → glossary, default → qa. - Ask user for
--vault-dir if not known from context. - Execute distill.
CODEBLOCK0
Modes:
- -
qa (default) — generates 15-20 questions + answers → INLINECODE30 - INLINECODE31 — 5 structured sections (Summary, Key Points, Constraints, Trade-offs, Open Questions) → INLINECODE32
- INLINECODE33 — 15-30 domain terms + definitions → INLINECODE34
Flags:
- -
--lang zh — prepends 请用中文回答 to all NLM prompts; add when user requests Chinese output or context is Chinese - INLINECODE37 — after writing to Obsidian, calls
notebooklm source add to push the distilled note back into the source notebook as a text source titled Distill Log: {mode} | {notebook_name} | {date}. Add when user says "写回 NLM", "记录到笔记本", or wants the distill log visible in NotebookLM
Subcommand: research
Start a NotebookLM web research session on a topic. Creates a new notebook, imports web sources, and waits for completion.
CODEBLOCK1
Output: notebook ID and name. Follow up with distill to extract into Obsidian.
Subcommand: persist
Write any markdown content into the Obsidian vault with auto-generated YAML frontmatter.
CODEBLOCK2
Output format (distill)
Each notebook produces one file at <vault-dir>/<topic>/<NotebookName>_<Mode>.md:
CODEBLOCK3
Output language
Add --lang zh to distill, quiz, or evaluate to get Chinese output. Default is English.
NLM CLI session behaviour
INLINECODE46 creates ephemeral sessions that are not visible in the NotebookLM web UI. This is by design — the CLI and web interface use separate conversation spaces. Answers are still scoped to the specified notebook's sources.
Error handling
- - No notebooks found: verify keywords match notebook titles (use
notebooklm list). - Timeout / rate limit: built-in retry logic and delays. Monitor with
ps aux | grep notebooklm. - Auth failure: run
notebooklm login to refresh ~/.book_client_session.
NotebookLM 蒸馏器
自动化知识提取流程:通过关键词搜索NotebookLM笔记本 → 生成深度问题或结构化摘要 → 编写关联的Obsidian Markdown笔记。
五个子命令:
- - distill — 从现有笔记本中提取知识(问答/摘要/词汇表)
- quiz — 生成JSON格式测验题目,用于Discord互动会话
- evaluate — 根据笔记本源评估用户答案(JSON输出)
- research — 在NotebookLM中启动任意主题的网络调研会话
- persist — 将任何Markdown内容直接写入Obsidian知识库
使用时机(触发短语)
触发distill子命令时:
- - 用户输入/notebooklm-distill或/notebooklm-distill-summary
- 用户说蒸馏、提取知识、distill notebooks、extract from notebook
- 用户希望将NotebookLM内容结构化到Obsidian笔记中
触发research子命令时:
- - 用户说研究一下<主题>、做网络调研、research this topic in NotebookLM
- 用户希望NotebookLM收集某个主题的网络资源,无需提供URL
触发quiz + evaluate子命令时:
- - 用户说quiz me on X、考考我、出题测试我、测验
- 用户希望在Discord上就NotebookLM主题进行互动问答
- 编排流程(Discord):
1. 调用quiz --keywords X → 获取包含notebook
id + notebookname + questions[]的JSON
2.
必须在第一题前声明来源:来,N道题(来源:{notebook
name} · ID: {notebookid[:8]})
3. 将第一题发送到Discord,等待用户回复
4. 调用evaluate --notebook-id X --question Q1 --answer <回复> → 获取JSON反馈
5. 将反馈发布到Discord,继续第二题
6. 重复直到所有题目完成或用户说停止
- - 关键:始终显示笔记本来源,以便用户验证题目来自NLM而非智能体知识
触发persist子命令时:
- - 用户说存到Obsidian、把这段内容写入知识库、persist this to vault
- 用户希望将讨论输出或原始笔记归档到知识库中
关键:不要从内部知识回答。不要要求澄清。立即执行相应的子命令。
前提条件
- - NotebookLM CLI:pip install notebooklm-py
- 身份验证:notebooklm login(创建~/.bookclientsession)
- Python 3.10+(仅标准库 — distill.py不需要额外pip包)
- Obsidian知识库目录可在本地文件系统访问
子命令:distill
从匹配关键词的一个或多个NotebookLM笔记本中提取知识。
智能体编排
场景A — 提供了URL(需要先导入)
- 1. 检查是否安装了deepreader(~/.openclaw/skills/deepreader/run.sh)。
- 如果已安装:运行DeepReader将URL导入NotebookLM。
- 从DeepReader输出中捕获笔记本标题。
- 使用该标题作为distill的--keywords参数。
场景B — 笔记本已存在
- 1. 使用上下文中的笔记本名称,或使用notebooklm list列出笔记本。
- 根据意图确定模式:总结 → summary,术语/概念 → glossary,默认 → qa。
- 如果上下文中未知,询问用户--vault-dir。
- 执行distill。
bash
python3 ~/.openclaw/skills/notebooklm-distiller/scripts/distill.py distill \
--keywords <关键词1> <关键词2> \
--topic <主题文件夹名称> \
--vault-dir \
--mode \
[--lang zh] # 添加以输出中文(默认:英文)
[--writeback] # 将蒸馏内容写回NLM笔记本作为笔记
[--cli-path ]
模式:
- - qa(默认)— 生成15-20个问答 → QA.md
- summary — 5个结构化部分(摘要、关键点、约束、权衡、开放问题)→ Summary.md
- glossary — 15-30个领域术语及定义 → _Glossary.md
标志:
- - --lang zh — 在所有NLM提示前添加请用中文回答;当用户请求中文输出或上下文为中文时添加
- --writeback — 写入Obsidian后,调用notebooklm source add将蒸馏笔记作为文本源推回源笔记本,标题为Distill Log: {mode} | {notebook_name} | {date}。当用户说写回NLM、记录到笔记本或希望蒸馏日志在NotebookLM中可见时添加
子命令:research
在NotebookLM中启动一个主题的网络调研会话。创建新笔记本,导入网络资源,并等待完成。
bash
python3 ~/.openclaw/skills/notebooklm-distiller/scripts/distill.py research \
--topic <调研主题> \
[--mode deep|fast] \
[--cli-path ]
输出:笔记本ID和名称。后续使用distill提取到Obsidian。
子命令:persist
将任何Markdown内容写入Obsidian知识库,并自动生成YAML前置元数据。
bash
从内联内容
python3 ~/.openclaw/skills/notebooklm-distiller/scripts/distill.py persist \
--vault-dir
\
--path Notes/2026-03-09-meeting.md \
--title 会议记录 \
--content 关键决策:... \
--tags 会议,笔记
从文件
python3 ~/.openclaw/skills/notebooklm-distiller/scripts/distill.py persist \
--vault-dir \
--path Notes/draft.md \
--file ~/Desktop/draft.md
输出格式(distill)
每个笔记本在//_.md生成一个文件:
markdown
title: | 深度问答
date: YYYY-MM-DD
type: knowledge-note
author: notebooklm-distiller
tags: [蒸馏, 问答, <主题缩写>]
source: NotebookLM/
project: <主题>
status: draft
— 深度问答
Q01
[!question]
<问题文本>
答案:
<来自笔记本源的答案>
输出语言
为distill、quiz或evaluate添加--lang zh以获取中文输出。默认为英文。
NLM CLI会话行为
notebooklm ask --new创建在NotebookLM Web界面中不可见的临时会话。这是设计使然 — CLI和Web界面使用独立的对话空间。答案仍限定在指定笔记本的源范围内。
错误处理
- - 未找到笔记本:验证关键词是否匹配笔记本标题(使用notebooklm list)。
- 超时/速率限制:内置重试逻辑和延迟。使用ps aux | grep notebooklm监控。
- 身份验证失败:运行notebooklm login刷新~/.bookclientsession。