notebooklm-sync
Keep Wiki/Libraries/{slug}.md in sync with the underlying NotebookLM notebook. Three things happen each run:
- Source-list reconciliation — confirm every source in the wiki Sources table is in the notebook (and vice versa). Surface drift.
- Cached summary refresh — ask NotebookLM "what is this notebook about? summarize the key themes" and write the answer into
## Cached summary. Lets agents read fast context without live queries for routine questions. - Source-count update — rewrite
source_countin frontmatter to match.
Pre-flight checks
- If
library_slugprovided:Wiki/Libraries/{library_slug}.mdexists. - NotebookLM session valid (Phase 2+). If unavailable: log + skip with
synced: []; don't error out other operations.
Procedure
1. Resolve the library set
- If
library_slugprovided: just that one. - Else: walk
Wiki/Libraries/*.md, filterstatus: active.
2. For each library
a. Pull the source list from NotebookLM (Phase 2+).
b. Compare against the Sources table in the wiki node:
- In NLM but not in wiki: add a row to the Sources table (NLM-side authority for source_id).
- In wiki but not in NLM: flag as drift in drift_report — likely means source was deleted in NLM UI directly. Don't auto-remove; ask Adam.
- In both: OK.
c. Update source_count in frontmatter.
d. Send a fixed prompt to NotebookLM: "What is this notebook about? Summarize the most important themes in 5–8 bullet points."
e. Replace the body content under ## Cached summary with the response. Add a small footer: _Last summarized: {today}_.
f. Update frontmatter: last_synced: {today}, last_summarized: {today}.
3. Append Log entry per library
- input:
library={slug} - output:
sources_added={N}, drift={N}, cached_summary_chars={N} - artifacts:
<a class="wikilink wikilink-broken" href="#">Wiki/Libraries/{slug}</a> - notes: any drift warnings
4. Aggregate drift report
Return a single-string drift_report summarizing any libraries that have drift.
Cadence
- Manual:
/library syncor/library sync {slug}. - Recommended: weekly cron (Phase 4) — same cadence as
lint-wiki. - Auto-trigger: after any
/library add-sourceor/library deep-research.
Hard rules
- Never delete a wiki Sources row automatically — drift is reported, not auto-resolved.
- Never overwrite the wiki node body sections OTHER than
## Cached summary— the rest is human-curated. - If a library hasn't been synced in 30+ days, flag in
lint-wikias MEDIUM severity stale.
Failure modes
- NotebookLM rate-limited mid-sync — partial completion is OK; record
synced: [...]with what succeeded and surface the failures. - Library has zero sources — skip the summary step (NotebookLM has nothing to summarize); just update
last_syncedand note in Log.