Skills / Skills / Notebooklm Query
All skills

/ skill

notebooklm-query

Skills/notebooklm-query.md

Ask a question against one or more libraries; return cited answers from NotebookLM's RAG.

Open as raw file

Run this skill

Runs with bypassPermissions — local dev only.

notebooklm-query

Run a question against one or more libraries. Returns the answer plus citations into the original sources. The Decision-Engine agents (Steelman, Devils-Advocate, Synthesizer) can call this during reasoning to ground their arguments in Adam's curated corpus.

Pre-flight checks

  1. Each library_slug in libraries resolves to an existing Wiki/Libraries/{slug}.md.
  2. NotebookLM session valid (Phase 2+). Phase 1 fallback: read each library's ## Cached summary body section and return that text as answer, with cached: true and citations: []. Mark this clearly in the answer so the caller knows it's not live.

Procedure

1. Decide live vs. cached

  • If mode == "fast" AND every involved library has last_summarized within the last 7 days AND the question is broad ("what does this library cover?"), prefer cached: read the ## Cached summary body section of each library node and synthesize.
  • For specific questions, novel topics, or mode == "deep": live query NotebookLM.

2. Live query (Phase 2+)

  • For a single library: invoke notebooklm-py chat against that notebook with question.
  • For multiple libraries: query each in parallel, then merge — synthesize the per-library answers into one with each citation tagged by library slug.

3. Format the response

Return a structured object the caller can use:

answer: |
  <synthesized prose answer>
citations:
  - source_id: <id>
    source_title: <title>
    library: <library_slug>
    snippet: <relevant excerpt>
    timestamp_or_page: <e.g., "12:34" for video, "p. 42" for PDF>
cached: false

4. Log entry

  • input: libraries={libraries}, question="{question[:80]}...", mode={mode}
  • output: answer_preview="{answer[:100]}...", citations={count}, cached={cached}
  • notes: notebooklm-query (so it's filterable in Log)

Caller patterns

Decision-Engine

# In dialectic-cycle, after Steelman builds initial cases:
notebooklm-query:
  libraries: [adam-consumption, leadership]
  question: "How have similar decisions played out historically? What patterns predict failure?"
  mode: deep
  → answer fed to Devils-Advocate as additional ammunition

learn-from-source

# When a podcast URL is being synthesized:
notebooklm-query:
  libraries: [adam-consumption]
  question: "What other sources in this library cover similar themes?"
  mode: fast
  → returned related-source list becomes outbound wikilinks

Ad-hoc

  • /library query — Adam asks anything against any library.

Failure modes

  • Session expired / 401 — surface to Adam, ask to run notebooklm login again. Fall back to cached summary if available.
  • Rate-limited — back off; retry once after 30 seconds; on second failure, fall back to cached + flag in Log.
  • Library has zero sources — return answer: "Library is empty — add sources via /library add-source first." with cached: false, citations: [].
  • Question is too broad (returns nothing useful) — surface and suggest narrowing.

Hard rules

  • Never pass Context/MI.md or sensitive vault content as part of the question prompt unless explicitly authorized for that query — the question goes to Google.
  • Never store the answer text from NotebookLM verbatim in long-term wiki nodes without paraphrasing — wiki nodes are yours; the citation pattern is enough provenance.
  • Always log query usage so rate limits / costs are visible.