Gemini Deep Research → Notion
Execution Mode
Run ALL steps in the MAIN SESSION. Do NOT spawn a subagent.
The browser tool (OpenClaw managed profile) is only available in the main session.
Subagents cannot access the browser, so all browser automation must happen here.
Reply first: "🔬 Deep Research starting for: [topic]. This takes ~25 min. I'll update you when done."
Then execute all phases below sequentially.
Instructions
Complete ALL steps below in the main session.
Phase 1: Trigger Deep Research
- 1. INLINECODE0
- Snapshot, find the text input, type the research query. Always prepend "请用中文回答。" to the query so the research output is in Chinese.
- Click "工具" (Tools) button (has
page_info icon) → click "Deep Research" in the menu - Click Send to submit the query
- Wait for research plan to appear (~10s), then click "Start research" / "开始研究" button
- If snapshot-click doesn't work, use JS:
(() => { var btn = Array.from(document.querySelectorAll('button')).find(b => /Start research|开始研究/.test(b.textContent.trim())); if (btn) { btn.click(); return 'clicked'; } return 'not found'; })()
- 6. Verify research started: button should be disabled, status shows "Researching X websites..." or "正在研究..."
- Save the conversation URL from the browser
Phase 2: Wait for Completion
- 1. Run
exec("sleep 1200") (20 minutes) + INLINECODE4 - After waking, check status via JS: INLINECODE5
- Look for completion signals: "I've completed your research" or "已完成"
- If still running, sleep another 600s and check again (max 2 retries)
- If failed/stuck after retries, announce the failure and exit
Phase 3: Extract Report
- 1. Count message-content elements: INLINECODE6
- The research report is in the LAST
message-content element (usually index 2) - Get total length: INLINECODE8
- Extract in 8000-char chunks using substring: INLINECODE9
- Concatenate all chunks into the full report text
- Save to a temp file: write full report to INLINECODE10
Phase 4: Export to Notion
Parent page ID: 31a4cfb5-c92b-809f-9d8a-dd451718a017 (Deep Research Database)
- 1. Read the Notion API key: INLINECODE12
- Parse the report into Notion blocks:
- Lines starting with
# → heading
2/heading3 blocks
- Bullet points → bulleted
listitem blocks
- Regular text → paragraph blocks
- Add a callout at top: "🔬 Generated by Gemini Deep Research on YYYY-MM-DD"
- Split rich_text at 2000 chars
- 3. Create the page via Notion API:
curl -s -X POST "https://api.notion.com/v1/pages" \
-H "Authorization: Bearer $NOTION_KEY" \
-H "Notion-Version: 2025-09-03" \
-H "Content-Type: application/json" \
-d '{"parent":{"page_id":"31a4cfb5-c92b-809f-9d8a-dd451718a017"},"icon":{"type":"emoji","emoji":"🔬"},"properties":{"title":{"title":[{"text":{"content":"TOPIC"}}]}},"children":[BLOCKS]}'
- 4. If >100 blocks, append remaining via PATCH to INLINECODE14
- Rate limit: wait 0.5s between batch requests
Phase 5: Announce
Report back with:
- - Research topic
- Brief summary (2-3 key findings)
- Notion page URL: INLINECODE15
Notes
- - Always use
profile="openclaw" for browser - Deep Research is under "工具" (Tools) menu, NOT the model selector
- If Gemini needs login, announce failure — user must log in manually
- The full pipeline should complete in ~25-30 min total
Gemini Deep Research → Notion
执行模式
在主会话中执行所有步骤。不要生成子代理。
浏览器工具(OpenClaw 管理配置文件)仅在主会话中可用。
子代理无法访问浏览器,因此所有浏览器自动化操作必须在此处完成。
首先回复:🔬 正在开始深度研究:[主题]。大约需要 25 分钟。完成后我会通知您。
然后按顺序执行以下所有阶段。
说明
在主会话中完成以下所有步骤。
阶段 1:触发深度研究
- 1. browser action=open profile=openclaw targetUrl=https://gemini.google.com/app
- 截图,找到文本输入框,输入研究查询。始终在查询前添加请用中文回答。,以便研究输出为中文。
- 点击工具按钮(带有 page_info 图标)→ 在菜单中点击Deep Research
- 点击发送提交查询
- 等待研究计划出现(约 10 秒),然后点击开始研究按钮
- 如果截图点击无效,使用 JS:(() => { var btn = Array.from(document.querySelectorAll(button)).find(b => /Start research|开始研究/.test(b.textContent.trim())); if (btn) { btn.click(); return clicked; } return not found; })()
- 6. 确认研究已开始:按钮应变为禁用状态,状态显示正在研究 X 个网站...或正在研究...
- 从浏览器保存对话 URL
阶段 2:等待完成
- 1. 运行 exec(sleep 1200)(20 分钟)+ process(poll, timeout=1200000)
- 唤醒后,通过 JS 检查状态:(() => { var el = document.querySelectorAll(message-content)[1]; return el ? el.innerText.substring(0, 200) : NOT_FOUND; })()
- 寻找完成信号:Ive completed your research或已完成
- 如果仍在运行,再休眠 600 秒并重新检查(最多重试 2 次)
- 如果重试后失败/卡住,宣布失败并退出
阶段 3:提取报告
- 1. 统计 message-content 元素数量:document.querySelectorAll(message-content).length
- 研究报告位于最后一个 message-content 元素中(通常索引为 2)
- 获取总长度:document.querySelectorAll(message-content)[2]?.innerText?.length
- 使用 substring 以 8000 字符为块提取:document.querySelectorAll(message-content)[N]?.innerText?.substring(START, END)
- 将所有块拼接成完整报告文本
- 保存到临时文件:将完整报告写入 /tmp/deepresearch.md
阶段 4:导出到 Notion
父页面 ID: 31a4cfb5-c92b-809f-9d8a-dd451718a017(深度研究数据库)
- 1. 读取 Notion API 密钥:cat ~/.config/notion/api_key
- 将报告解析为 Notion 块:
- 以 # 开头的行 → heading
2/heading3 块
- 项目符号 → bulleted
listitem 块
- 普通文本 → paragraph 块
- 在顶部添加标注:🔬 由 Gemini Deep Research 于 YYYY-MM-DD 生成
- 在 2000 字符处拆分 rich_text
- 3. 通过 Notion API 创建页面:
bash
curl -s -X POST https://api.notion.com/v1/pages \
-H Authorization: Bearer $NOTION_KEY \
-H Notion-Version: 2025-09-03 \
-H Content-Type: application/json \
-d {parent:{page_id:31a4cfb5-c92b-809f-9d8a-dd451718a017},icon:{type:emoji,emoji:🔬},properties:{title:{title:[{text:{content:TOPIC}}]}},children:[BLOCKS]}
- 4. 如果超过 100 个块,通过 PATCH 将剩余块追加到 /v1/blocks/{page_id}/children
- 速率限制:批次请求之间等待 0.5 秒
阶段 5:宣布
报告以下内容:
- - 研究主题
- 简要摘要(2-3 个关键发现)
- Notion 页面 URL:https://www.notion.so/idwithout_dashes>
注意事项
- - 浏览器始终使用 profile=openclaw
- Deep Research 位于工具菜单下,而非模型选择器
- 如果 Gemini 需要登录,宣布失败——用户必须手动登录
- 整个流程应在约 25-30 分钟内完成