← Về thư mục
📄 / / root / .hermes / skills / research / notebooklm-research / SKILL.md

name: notebooklm-research version: 2.0.0 description: > Use NotebookLM CLI (nlm) as the primary tool for academic/policy research. Summarise sources, query with RAG, cross-query notebooks, and generate reports using Google's NotebookLM AI — no external LLM tokens wasted. Replaces the deprecated notebook-master-sync (absorbed). trigger: - "User says 'sync notebook' / 'notebooklm sync' / 'đồng bộ notebook'" - "User asks to summarise / compare / research sources" - "Need to extract structured info (chapter-by-chapter) from a document" - "Pipeline task involving source ingestion, analysis, or reporting"


📞 Telegram Command

NotebookLM Research Skill

Core Principle

NotebookLM-First. Before calling any external LLM (9router, etc.) for summarisation or extraction, use NotebookLM CLI — it's free, RAG-native, and produces citations.

🔄 Sync Flow (notebooklm sync)

When triggered, the agent runs python3 scripts/notebooklm_sync.py which executes 4 steps:

Step 1 — Source List Discovery

  1. Auth check via nlm doctor; auto-refresh if expired
  2. Fetch real source list: nlm source list <notebook> --json
  3. Fuzzy-match sources against master file entries by normalized title
  4. If source listing fails after refresh, retry the source-list call directly before treating the run as blocked

See references/sync-debug-notes.md for a real auth-refresh and ID-drift example. See references/legal-doc-analysis-pattern.md for the correct sequence when analysing legal/regulatory documents (Luật, Thông tư) against an external framework (ILO, OECD, etc.). See references/ilo-lmis-vietnam-domain.md for condensed ILO LMIS framework knowledge and Vietnam-specific labour market context (informal economy stats, ASEAN gap analysis, proxy indicators).

Step 2 — Gap Analysis

Step 3 — RAG Summarisation

For each flagged source: 1. nlm notebook query --source-ids "<id>" "<notebook>" "<prompt>" → 5,000+ char VN summary with citations 2. nlm source describe --json <id> → EN summary + keywords (0 token cost) 3. 3-second delay between calls to avoid rate limiting

Step 4 — Write & Validate

  1. Replace old summary block or append new entry at file end
  2. Run dash scan: reject if - found in VN prose
  3. Report summary via Telegram

🔀 Multi-Task Kanban Orchestration Patterns

When building recurring deep-research loops (e.g. 7-pillar institutional benchmarking), construct multi-task pipelines programmatically: - Task 1 (r-and-d): Scoping & Data Sync (Process batch of 10 sources, run up to 10 nested search/explorations using Vision/OCR if external files are found). - Task 2 (r-and-d): RAG Analysis & Deep Finding (Extract details to policy documents). - Task 3 (grill-qa): Critique (Review findings, check for dashes, enforce logic & 7 pillars). - Task 4 (r-and-d): Synthesis & Reporting. - Task 5 (grill-qa): Master Update & QA Gate. Chain these tasks with --parent dependencies on creation so they execute sequentially. Each cron/orchestrator run must dispatch a dedicated chain per target.

Phase 2 Policy Coherence Test: Bổ sung bước kiểm định định lượng và định tính về tính tương thích chính sách và agenda overload trong các văn bản chiến lược. • Anti-Dash Enforcement: Trong mọi query prompt tiếng Việt, bắt buộc chèn đoạn: "Tuyệt đối không dùng dấu gạch nối trong văn xuôi tiếng Việt." • Batching Strategy: Thực hiện batch 10 nguồn mỗi loop, lưu trạng thái processed_ids và last_batch vào processed_sources_vn.json. • QA Integration: Tích hợp kiểm tra tính nhất quán dữ liệu (Glossary, citations, APA 7) vào Phase 5. • Handoff Logic: Mỗi phase phải tự chủ động cập nhật trạng thái task và đẩy sang Phase kế tiếp trong Kanban.

Pipeline Advancement Rule (CRITICAL)

Output File Discipline

Cron Agent Discipline

Available CLI Commands

Quality Standard for Government/Policy Sources: - Summaries must be highly detailed, structured chapter-by-chapter or section-by-section as the original document is organized. - If the document explicitly identifies bottlenecks/challenges, faithfully report what it says. If it does NOT mention them, explicitly note their absence in the summary — never fabricate or invent. - Automated background batching (multiple calls via LLM loop) of critical policy documents consistently produces generic, shallow summaries that violate quality standards. Foreground or batch-with-notify supervision is preferred for high-stakes deliverables. - Zero-Token Summarization (NotebookLM-First): Instead of fetching raw content and summarising via external LLM (9router), use NotebookLM's own AI: 1. nlm source describe <source-id> --json for EN summary + keywords (free). 2. nlm notebook query --source-ids <id> <notebook> "VN prompt" for chapter-level VN summary. - NEVER fabricate bottlenecks, targets, or recommendations. If absent from source, say so.

Model Governance Rules

CLI Command Reference & Scripting Patterns

Authentication

nlm login                          # Browser-based login
nlm login --check                  # Check auth status
nlm login switch <profile>         # Switch profile
nlm doctor                         # Run diagnostics

Source Management

nlm source list <notebook> --json                 # List all sources with real UUIDs
nlm source describe <source-id>                   # AI summary + keywords (0 token cost)
nlm source describe <source-id> --json            # JSON output
nlm source get <source-id>                        # Raw content

Query (RAG Extraction)

# Single source (targeted)
nlm notebook query --source-ids "<id>" "<notebook>" "Your question"

# Multi-source
nlm notebook query --source-ids "id1,id2" "<notebook>" "Compare..."

# Cross-notebook
nlm cross query "Question" --notebooks "id1,id2"
nlm cross query "Question" --all

Research Automation

nlm research start "query" --notebook-id <id> --mode deep --auto-import
nlm research status <notebook> --max-wait 300
nlm research import <notebook> <task-id> --cited-only

Report & Artifact Generation

nlm report create <notebook> --format "Briefing Doc" --confirm
nlm audio create <notebook> --format deep_dive --confirm
nlm slides create <notebook> --confirm
nlm download report <notebook> <artifact> --output report.md

Batch & Pipeline

nlm batch query "Question" --notebooks "id1,id2"
nlm batch query "Question" --all
nlm pipeline run research-and-report --notebook <id>
nlm tag add <notebook> --tags "tag1,tag2"

Agent Rules (enforce in all subagent tasks)

Rule 1 — NotebookLM-First

Rule 2 — Real IDs Only

Rule 3 — No Dash Injection

Rule 4 — Auth Recovery

Rule 5 — Background for Batches

Pipeline Workflow (Research Mastery)

1. INGEST → nlm source add <notebook> --url/file/youtube (--wait)
2. AUTH  → nlm doctor (verify before batch)
3. FETCH UUIDs → nlm source list <notebook> --json
4. SURVEY → nlm source describe <id> --json  (ALL sources, batches of 3)
5. TARGETED QUERY → nlm notebook query --source-ids <1-3 IDs> "VN question"
6. MERGE → write combined EN+VN summary to research file
7. VERIFY → scan for dashes in VN prose
8. REPORT → nlm report create <notebook> --format "Briefing Doc"
9. ARCHIVE → nlm download report <notebook> <artifact> --output report.md

New Notebook / Context Mapping Workflow

When user shares a notebook for the first time and asks to "understand the sources" or build a knowledge base:

  1. nlm source list <notebook-id> --json → inventory all sources with IDs
  2. nlm source describe <id> --json for EVERY source (3 per terminal call, sleep 3s between)
  3. Write a context_map.md in the project folder: source inventory table, each source's role, key themes
  4. Run targeted notebook query per analytical cluster (≤3 IDs per call)
  5. Write kb_strategy.md: knowledge domain map, tiered source list to acquire, research argument, roadmap
  6. Only THEN proceed to gap analysis or pipeline launch

Pitfall: Do NOT skip straight to multi-source cross-query after listing sources. source describe is free and gives enough signal to cluster sources intelligently before spending query budget.

NotebookLM Master Sync Flow

An automated sync script is bundled at scripts/notebooklm_sync.py (resolves to ~/.hermes/skills/research/notebooklm-research/scripts/notebooklm_sync.py). It orchestrates a 4-phase sync: Note: copy is also at /opt/ai-os/products/ceo/scripts/notebooklm_sync.py for direct invocations from the CEO project directory.

Phase 1: Discovery

Phase 2: Fuzzy Matching & ID Repair

Phase 3: RAG Summary Generation

Phase 4: New Source Import

Caution: The script modifies the master file directly. Always run from a terminal background session with --notify-on-complete for batches over 10 sources, and review the diff before pushing to git.

Pitfalls