/notebooklm-py
Install, authenticate, troubleshoot, and operate Gemini Notebook through the notebooklm-py CLI or typed async Python API. Use for notebook and source management, grounded chat and research, and artifact generation or download when the user mentions Gemini Notebook,
$ npx -y skills add teng-lin/notebooklm-py --skill notebooklm-py --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/notebooklm-py
Context preview
The summary Claude sees to decide when to auto-load this skill.
Install, authenticate, troubleshoot, and operate Gemini Notebook through the notebooklm-py CLI or typed async Python API. Use for notebook and source management, grounded chat and research, and artifact generation or download when the user mentions Gemini Notebook,
SKILL.md
notebooklm-py.SKILL.mdname: notebooklm
description: Install, authenticate, troubleshoot, and operate Gemini Notebook through the notebooklm-py CLI or typed async Python API. Use for notebook and source management, grounded chat and research, and artifact generation or download when the user mentions Gemini Notebook, notebooklm-py, the notebooklm CLI, or its Python API. Do not use for the generic Gemini API or unrelated content creation.
Gemini Notebook Automation
Use the `notebooklm` CLI for agent workflows. Prefer `--json` and explicit IDs so every operation is inspectable and safe under concurrency. Use the typed async Python API only when the user requests application code or the CLI cannot express the workflow. The readiness, identity, authorization, and credential-handling rules below apply to both interfaces.
Setup and Authentication
Requires Python 3.10+. Install the package in the user's existing environment; do not create a separate environment unless requested:
pip install "notebooklm-py[browser]"
pip install "notebooklm-py[cookies]" # optional browser-cookie extraction
If system `pip` reports `externally-managed-environment`, do not use `--break-system-packages`. For CLI-only use, offer `uv tool install "notebooklm-py[browser]"` or the equivalent `pipx` command; for application code, use the user's active project environment.
For unattended or headless work, prefer durable profile-backed master-token auth over a copied cookie snapshot. Install `pip install "notebooklm-py[headless]"`; the one-time automatic OAuth capture also needs `[browser]`. On a trusted workstation run `notebooklm login --master-token --account <email>`, then deploy `master_token.json`, not `storage_state.json`, to the selected profile. `NOTEBOOKLM_HOME` selects the private base directory and `NOTEBOOKLM_PROFILE` selects its profile; defaults resolve to `~/.notebooklm/profiles/default/master_token.json`.
In CI, `NOTEBOOKLM_MASTER_TOKEN_JSON` is a secret-transport convention, not an environment variable the package reads directly. Write its exact value to the selected profile's `master_token.json` with mode `0600`, unset it, then run `notebooklm auth refresh` to mint `storage_state.json`. A sibling master token can automatically re-mint expired file-backed cookies. Inline `NOTEBOOKLM_AUTH_JSON` is only a short-lived fallback; it bypasses this recovery path.
Use PyPI or a release tag, not an unreleased `main` checkout. When available, consult the [installation guide](https://github.com/teng-lin/notebooklm-py/blob/main/docs/installation.md).
Before a workflow, verify real authentication rather than merely parsing the cookie file:
notebooklm auth check --test --json
Require `.status == "ok"` and `.checks.token_fetch == true`. If validation fails:
- With a display, run `notebooklm login` and validate again.
- In a headless environment, install `[cookies]` and use
`notebooklm login --browser-cookies <browser>`. Use `notebooklm auth inspect --browser <browser>` first when account selection is unclear.
- If previously valid cookies became stale, try `notebooklm auth refresh`; use
`notebooklm auth refresh --browser-cookies <browser>` after signing back into the browser.
The normal `--test` preflight may heal and persist refreshed cookies. Add `--passive` when the check must be strictly read-only, including the failure-diagnosis workflow below.
`notebooklm status` reports selected-notebook context, not authentication.
Treat both auth files as bearer credentials: never print, log, or commit them. A master token is a durable full-account credential that survives password changes; use a dedicated account, protect it in a secret store and as `0600` on disk, and explicitly revoke it if exposed.
Operating Invariants
1. Use `--json` for discovery and mutations, then retain the returned full UUIDs. Important envelopes are `.notebook.id` from `create`, `.source.id` from `source add`, and `.task_id` from asynchronous generators. `generate mind-map` instead returns `mind_map`, `note_id`, and `kind`; both kinds return a finished result with no task ID or separate `artifact wait` step. 2. Pass `-n/--notebook <id>` on every notebook-scoped command in automation or concurrent work. Do not rely on `notebooklm use`. For every concurrent run, also set a unique `NOTEBOOKLM_PROFILE=agent-<id>` so context and profile writes are isolated. A new profile has no credentials: put a `master_token.json` copy in that profile and mint its storage before use. Never share one writable `storage_state.json` across agents. 3. After adding sources, retain every `.source.id`, then run `source wait` for each before chat or generation. The add envelope has no status. Require wait exit 0 and `status == "ready"`; let the waiter handle media-specific transient `error` rows. 4. After an asynchronous generator returns a task/artifact ID, pass it positionally to `artifact wait` with `-n <notebook_id>`. Download that exact artifact with `-a <artifact_id> -n <notebook_id>`; never select the latest visible artifact. Mind-map generation returns its completed result directly and does not need `artifact wait`. 5. For overlapping research runs, always pass `--run-id <research_run_id>`. 6. Use a host's background facility only when it actually exists. Keep wait and dependent download commands in one sequential job, and download only after the wait exits 0. Otherwise run in the foreground or return exact ID-pinned commands to the user.
Authorization Boundaries
Safe inspection and explicitly requested creation, source addition, chat, and prompt suggestion can run directly. Diagnose failures with read-only commands before attempting recovery.
Obtain confirmation immediately before an action when it was not already clearly authorized:
- destructive commands such as notebook/source/note/artifact/label/profile deletion, sharing
removal, logout, clear, research cancellation, and `ask
Read more
name: notebooklm description: Install, authenticate, troubleshoot, and operate Gemini Notebook through the notebooklm-py CLI or typed async Python API. Use for notebook and source management, grounded chat and research, and artifact generation or download when the user mentions Gemini Notebook, notebooklm-py, the notebooklm CLI, or its Python API. Do not use for the generic Gemini API or unrelated content creation.
Gemini Notebook Automation
Use the `notebooklm` CLI for agent workflows. Prefer `--json` and explicit IDs so every operation is inspectable and safe under concurrency. Use the typed async Python API only when the user requests application code or the CLI cannot express the workflow. The readiness, identity, authorization, and credential-handling rules below apply to both interfaces.
Setup and Authentication
Requires Python 3.10+. Install the package in the user's existing environment; do not create a separate environment unless requested:
pip install "notebooklm-py[browser]" pip install "notebooklm-py[cookies]" # optional browser-cookie extraction
If system `pip` reports `externally-managed-environment`, do not use `--break-system-packages`. For CLI-only use, offer `uv tool install "notebooklm-py[browser]"` or the equivalent `pipx` command; for application code, use the user's active project environment.
For unattended or headless work, prefer durable profile-backed master-token auth over a copied cookie snapshot. Install `pip install "notebooklm-py[headless]"`; the one-time automatic OAuth capture also needs `[browser]`. On a trusted workstation run `notebooklm login --master-token --account <email>`, then deploy `master_token.json`, not `storage_state.json`, to the selected profile. `NOTEBOOKLM_HOME` selects the private base directory and `NOTEBOOKLM_PROFILE` selects its profile; defaults resolve to `~/.notebooklm/profiles/default/master_token.json`.
In CI, `NOTEBOOKLM_MASTER_TOKEN_JSON` is a secret-transport convention, not an environment variable the package reads directly. Write its exact value to the selected profile's `master_token.json` with mode `0600`, unset it, then run `notebooklm auth refresh` to mint `storage_state.json`. A sibling master token can automatically re-mint expired file-backed cookies. Inline `NOTEBOOKLM_AUTH_JSON` is only a short-lived fallback; it bypasses this recovery path.
Use PyPI or a release tag, not an unreleased `main` checkout. When available, consult the [installation guide](https://github.com/teng-lin/notebooklm-py/blob/main/docs/installation.md).
Before a workflow, verify real authentication rather than merely parsing the cookie file:
notebooklm auth check --test --json
Require `.status == "ok"` and `.checks.token_fetch == true`. If validation fails:
- With a display, run `notebooklm login` and validate again.
- In a headless environment, install `[cookies]` and use
`notebooklm login --browser-cookies <browser>`. Use `notebooklm auth inspect --browser <browser>` first when account selection is unclear.
- If previously valid cookies became stale, try `notebooklm auth refresh`; use
`notebooklm auth refresh --browser-cookies <browser>` after signing back into the browser.
The normal `--test` preflight may heal and persist refreshed cookies. Add `--passive` when the check must be strictly read-only, including the failure-diagnosis workflow below.
`notebooklm status` reports selected-notebook context, not authentication.
Treat both auth files as bearer credentials: never print, log, or commit them. A master token is a durable full-account credential that survives password changes; use a dedicated account, protect it in a secret store and as `0600` on disk, and explicitly revoke it if exposed.
Operating Invariants
1. Use `--json` for discovery and mutations, then retain the returned full UUIDs. Important envelopes are `.notebook.id` from `create`, `.source.id` from `source add`, and `.task_id` from asynchronous generators. `generate mind-map` instead returns `mind_map`, `note_id`, and `kind`; both kinds return a finished result with no task ID or separate `artifact wait` step. 2. Pass `-n/--notebook <id>` on every notebook-scoped command in automation or concurrent work. Do not rely on `notebooklm use`. For every concurrent run, also set a unique `NOTEBOOKLM_PROFILE=agent-<id>` so context and profile writes are isolated. A new profile has no credentials: put a `master_token.json` copy in that profile and mint its storage before use. Never share one writable `storage_state.json` across agents. 3. After adding sources, retain every `.source.id`, then run `source wait` for each before chat or generation. The add envelope has no status. Require wait exit 0 and `status == "ready"`; let the waiter handle media-specific transient `error` rows. 4. After an asynchronous generator returns a task/artifact ID, pass it positionally to `artifact wait` with `-n <notebook_id>`. Download that exact artifact with `-a <artifact_id> -n <notebook_id>`; never select the latest visible artifact. Mind-map generation returns its completed result directly and does not need `artifact wait`. 5. For overlapping research runs, always pass `--run-id <research_run_id>`. 6. Use a host's background facility only when it actually exists. Keep wait and dependent download commands in one sequential job, and download only after the wait exits 0. Otherwise run in the foreground or return exact ID-pinned commands to the user.
Authorization Boundaries
Safe inspection and explicitly requested creation, source addition, chat, and prompt suggestion can run directly. Diagnose failures with read-only commands before attempting recovery.
Obtain confirmation immediately before an action when it was not already clearly authorized:
- destructive commands such as notebook/source/note/artifact/label/profile deletion, sharing
removal, logout, clear, research cancellation, and `ask
A Comprehensive Google Gemini Notebook Skill & Unofficial Python API. Full programmatic access to NotebookLM's features—including capabilities the web UI doesn't expose—via Python, CLI, and AI agents like Claude Code, Codex, and OpenClaw.

