perplexity-notebooklm 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. perplexity_notebooklm-0.2.0/.claude/settings.local.json +10 -0
  2. perplexity_notebooklm-0.2.0/.claude-plugin/marketplace.json +18 -0
  3. perplexity_notebooklm-0.2.0/.claude-plugin/plugin.json +18 -0
  4. perplexity_notebooklm-0.2.0/.github/workflows/publish.yml +34 -0
  5. perplexity_notebooklm-0.2.0/.gitignore +13 -0
  6. perplexity_notebooklm-0.2.0/CHANGELOG.md +64 -0
  7. perplexity_notebooklm-0.2.0/CLAUDE.md +29 -0
  8. perplexity_notebooklm-0.2.0/LICENSE +21 -0
  9. perplexity_notebooklm-0.2.0/PKG-INFO +193 -0
  10. perplexity_notebooklm-0.2.0/README.md +166 -0
  11. perplexity_notebooklm-0.2.0/README.pt-BR.md +166 -0
  12. perplexity_notebooklm-0.2.0/auth/.env.example +16 -0
  13. perplexity_notebooklm-0.2.0/auth/extract_cookies.md +39 -0
  14. perplexity_notebooklm-0.2.0/commands/dual-research.md +22 -0
  15. perplexity_notebooklm-0.2.0/commands/notebook-enrich.md +18 -0
  16. perplexity_notebooklm-0.2.0/docs/BENCHMARK.md +69 -0
  17. perplexity_notebooklm-0.2.0/docs/INNOVATION.md +61 -0
  18. perplexity_notebooklm-0.2.0/docs/INSTALL.md +99 -0
  19. perplexity_notebooklm-0.2.0/docs/REFINAMENTO_github_study.md +39 -0
  20. perplexity_notebooklm-0.2.0/docs/assets/banner.svg +53 -0
  21. perplexity_notebooklm-0.2.0/docs/benchmark_perplexity_mcp_repos.md +64 -0
  22. perplexity_notebooklm-0.2.0/dual_flow.py +188 -0
  23. perplexity_notebooklm-0.2.0/evals/run.py +110 -0
  24. perplexity_notebooklm-0.2.0/evals/scenarios.jsonl +9 -0
  25. perplexity_notebooklm-0.2.0/evals/score.py +55 -0
  26. perplexity_notebooklm-0.2.0/hooks/hooks.json +14 -0
  27. perplexity_notebooklm-0.2.0/hooks/sessionstart.py +54 -0
  28. perplexity_notebooklm-0.2.0/notebooklm_write/__init__.py +1 -0
  29. perplexity_notebooklm-0.2.0/notebooklm_write/add_source.py +130 -0
  30. perplexity_notebooklm-0.2.0/notebooklm_write/browser.py +81 -0
  31. perplexity_notebooklm-0.2.0/notebooklm_write/embed.py +49 -0
  32. perplexity_notebooklm-0.2.0/notebooklm_write/ledger.py +184 -0
  33. perplexity_notebooklm-0.2.0/notebooklm_write/nlm_http.py +284 -0
  34. perplexity_notebooklm-0.2.0/perplexity_mcp/__init__.py +1 -0
  35. perplexity_notebooklm-0.2.0/perplexity_mcp/adapter.py +67 -0
  36. perplexity_notebooklm-0.2.0/perplexity_mcp/agentic.py +122 -0
  37. perplexity_notebooklm-0.2.0/perplexity_mcp/auth_login.py +99 -0
  38. perplexity_notebooklm-0.2.0/perplexity_mcp/backends/__init__.py +1 -0
  39. perplexity_notebooklm-0.2.0/perplexity_mcp/backends/helallao.py +153 -0
  40. perplexity_notebooklm-0.2.0/perplexity_mcp/cited_search.py +162 -0
  41. perplexity_notebooklm-0.2.0/perplexity_mcp/doctor.py +96 -0
  42. perplexity_notebooklm-0.2.0/perplexity_mcp/resilience.py +120 -0
  43. perplexity_notebooklm-0.2.0/perplexity_mcp/security.py +63 -0
  44. perplexity_notebooklm-0.2.0/perplexity_mcp/server.py +115 -0
  45. perplexity_notebooklm-0.2.0/perplexity_mcp/validate.py +33 -0
  46. perplexity_notebooklm-0.2.0/perplexity_mcp/verify_citations.py +138 -0
  47. perplexity_notebooklm-0.2.0/pyproject.toml +47 -0
  48. perplexity_notebooklm-0.2.0/rag.py +144 -0
  49. perplexity_notebooklm-0.2.0/scripts/confirm_sources_pwm.py +108 -0
  50. perplexity_notebooklm-0.2.0/skills/perplexity-notebooklm/SKILL.md +54 -0
  51. perplexity_notebooklm-0.2.0/uv.lock +2186 -0
  52. perplexity_notebooklm-0.2.0/watch.py +117 -0
@@ -0,0 +1,10 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(uv --version)",
5
+ "Bash(git --version)",
6
+ "Bash(claude --version)",
7
+ "Bash(pip show *)"
8
+ ]
9
+ }
10
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "perplexity-notebooklm-dev",
3
+ "description": "Marketplace de desenvolvimento para o plugin perplexity-notebooklm",
4
+ "owner": {
5
+ "name": "wgardim"
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "perplexity-notebooklm",
10
+ "description": "Integração dual Perplexity <-> NotebookLM (conta Pro, sem API key)",
11
+ "version": "0.2.0",
12
+ "source": "./",
13
+ "author": {
14
+ "name": "wgardim"
15
+ }
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "perplexity-notebooklm",
3
+ "version": "0.2.0",
4
+ "description": "Integração dual Perplexity <-> NotebookLM (conta Pro, sem API key): pesquisa citada vira fonte no notebook e vice-versa.",
5
+ "author": {
6
+ "name": "wgardim"
7
+ },
8
+ "homepage": "https://github.com/wgardim-hub/notebooklm2perplexity",
9
+ "repository": "https://github.com/wgardim-hub/notebooklm2perplexity",
10
+ "license": "MIT",
11
+ "keywords": ["perplexity", "notebooklm", "research", "mcp", "dual", "no-api-key"],
12
+ "mcpServers": {
13
+ "perplexity-pro": {
14
+ "command": "uv",
15
+ "args": ["run", "--directory", "${CLAUDE_PLUGIN_ROOT}", "perplexity-pro-mcp"]
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,34 @@
1
+ name: publish
2
+
3
+ # Publica no PyPI automaticamente quando uma Release é publicada (ou ao push de tag vX.Y.Z).
4
+ # Usa PyPI Trusted Publishing (OIDC) — NÃO precisa de token/secret no repo.
5
+ #
6
+ # Setup (uma vez, no pypi.org → Account → Publishing → Add a pending publisher):
7
+ # PyPI project name: perplexity-notebooklm
8
+ # Owner: wgardim-hub Repository: notebooklm2perplexity
9
+ # Workflow name: publish.yml Environment: pypi
10
+ # Depois: criar uma Release (ou `git tag vX.Y.Z && git push --tags`) → publica sozinho.
11
+
12
+ on:
13
+ release:
14
+ types: [published]
15
+ push:
16
+ tags: ["v*"]
17
+
18
+ permissions:
19
+ contents: read
20
+
21
+ jobs:
22
+ publish:
23
+ runs-on: ubuntu-latest
24
+ environment: pypi
25
+ permissions:
26
+ id-token: write # exigido pelo Trusted Publishing (OIDC)
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - name: Install uv
30
+ uses: astral-sh/setup-uv@v5
31
+ - name: Build (sdist + wheel)
32
+ run: uv build
33
+ - name: Publish to PyPI (trusted publishing)
34
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,13 @@
1
+ .env
2
+ .claude.local.md
3
+ .venv/
4
+ dist/
5
+ build/
6
+ __pycache__/
7
+ *.pyc
8
+ *.egg-info/
9
+ .pytest_cache/
10
+ perplexity.log
11
+ vendor/perplexity-ai/.git/
12
+ node_modules/
13
+ evals/results/
@@ -0,0 +1,64 @@
1
+ # Changelog
2
+
3
+ Formato: [Keep a Changelog](https://keepachangelog.com). Versionamento semântico.
4
+
5
+ ## [0.2.0] — 2026-06-27
6
+
7
+ ### Mudado
8
+ - **Publicável no PyPI / `uvx`**: removida a dependência do pacote `perplexity` (path-dep
9
+ vendorizado). O `cited_search.py` (curl_cffi, auto-contido) já move todos os modos, então
10
+ o backend não precisa mais do `Client` vendorizado. Deps agora: `curl_cffi`, `mcp`,
11
+ `python-dotenv`. Wheel verificado em env isolado (`uv build` + import isolado OK).
12
+
13
+ ### Adicionado (hardening de install — issue #1)
14
+ - `uv run` no `plugin.json`/hook → **cross-SO** (Win/Mac/Linux) + **auto-bootstrap** do venv.
15
+ - `perplexity-nlm-doctor` — valida deps/cookies/auth/Chrome/NotebookLM/driver.
16
+ - `perplexity-nlm-auth` — login guiado: extrai cookies do Chrome logado → `.env` (Perplexity)
17
+ + `storage_state` (NotebookLM). Sem copiar cookie à mão.
18
+ - `requires-python` travado `<3.14`; `docs/INSTALL.md` (caminho canônico único + FAQ).
19
+
20
+ ### Nota
21
+ - Publicação no PyPI: `uv build` (feito) + `uv publish` (requer token do mantenedor) → `uvx perplexity-notebooklm`.
22
+
23
+ ## [0.1.1] — 2026-06-27
24
+
25
+ ### Adicionado
26
+ - **Dedup semântico** (`notebooklm_write/embed.py`, model2vec local — sem API key/torch):
27
+ 4ª camada de dedup por embeddings (cosseno). Pega reescritas que o MinHash perde
28
+ (ex.: cos=0.90 onde MinHash dava 0.28). Gracioso: ausente → cai pro MinHash.
29
+ Extra opcional `[semantic]`. Ativado via `check_duplicate(..., semantic=True)`.
30
+
31
+ ## [0.1.0] — 2026-06-27
32
+
33
+ Primeira release: integração dual Perplexity ↔ NotebookLM, conta Pro, **sem API key**.
34
+
35
+ ### Adicionado
36
+ - **MCP Perplexity** (`perplexity-pro`): tools `ask`/`search`/`reason`/`research`; backend
37
+ plugável (`adapter.py` + `backends/helallao.py`), auth por cookies da conta Pro.
38
+ - **Citações** (`cited_search.py`): replica a recipe do pwm (warm GET + payload + double-parse SSE).
39
+ - **NotebookLM HTTP/RPC** (`nlm_http.py`, notebooklm-py) via **cookie-bridge** de Chrome logado:
40
+ `add_text`/`add_url`/`add_file`, `list_notebooks`, `read_summary`, `list_source_ids`,
41
+ `generate_artifact` (audio/video/mind_map); fallback Selenium (`add_source.py`).
42
+ - **Fluxo dual** (`dual_flow.py`): `research_to_notebook` (PPLX→NLM), `notebook_to_research`
43
+ (NLM→PPLX), `research_to_media` (research→fonte→artefato).
44
+ - **Robustez/segurança**: `resilience.py` (retry+jitter, rate-limit, single-flight),
45
+ `security.py` (redação de logs + perms), `validate.py` (input nas tools).
46
+ - **Verificação de citações** (`verify_citations.py`): heurística honesta + judge LLM opcional (adversarial).
47
+ - **Dedup em 3 camadas** (`ledger.py`): por query (pula antes do Pro call), por conteúdo
48
+ exato, e near-verbatim (MinHash).
49
+ - **Deep-research agêntico** (`agentic.py`): decompõe→multi-search→sintetiza, com cap de cota.
50
+ - **Watcher bidirecional** (`watch.py`): vigia source-ids (sinal estável) com guards de ToS
51
+ (interval mín, dry-run, kill-switch interrompível, max-iter).
52
+ - **RAG lexical cross-notebook** (`rag.py`): BM25 + cache auto-heal.
53
+ - **Plugin Claude Code**: manifest, comandos `/dual-research` e `/notebook-enrich`, skill,
54
+ hook SessionStart (healthcheck de auth + lembrete Chrome :9222).
55
+ - **Harness de eval** (`evals/`), **benchmark** do ecossistema (`docs/BENCHMARK.md`),
56
+ **roadmap** (`docs/INNOVATION.md`).
57
+
58
+ ### Notas
59
+ - Sem API key paga: Perplexity por cookies da conta Pro; NotebookLM por cookie-bridge.
60
+ - Validado ponta-a-ponta na conta real (dual flow, RAG 44 notebooks, dedup por query, watcher).
61
+
62
+ ### Limitações conhecidas
63
+ - Dedup semântico real (embeddings) ainda não — camadas atuais pegam idêntico/near-verbatim/query.
64
+ - Automação contínua (watcher/agêntico) tem risco inerente de ToS; usar com parcimônia.
@@ -0,0 +1,29 @@
1
+ # MCP Perplexity ↔ NotebookLM
2
+
3
+ Integração dual, SEM API key paga. Comandos via `.venv/Scripts/python.exe` (venv Python 3.13).
4
+
5
+ ## Arquitetura
6
+ - **Perplexity**: backend `perplexity_mcp/backends/helallao.py` (plugável via `adapter.py`), auth por cookies no `.env` (`PERPLEXITY_COOKIES`). O motor é `cited_search.py` — AUTO-CONTIDO (curl_cffi, NÃO depende do pacote `perplexity`): replica a recipe pwm (warm GET + payload search_focus/send_back_text + double-parse do SSE) → resposta + citações. Sem dep externa de Perplexity → wheel publicável (`vendor/perplexity-ai` é legado, não usado). Robustez em `resilience.py`, segurança em `security.py`, validação em `validate.py`.
7
+ - **NotebookLM**: `notebooklm_write/nlm_http.py` = HTTP/RPC (notebooklm-py), caminho preferido. `add_source.py` (Selenium) = fallback.
8
+ - **Auth NotebookLM = cookie-bridge**: Google bloqueia login automatizado → abrir Chrome real logado: `chrome.exe --remote-debugging-port=9222 --user-data-dir="D:\nlm-chrome"`; nlm_http extrai cookies → storage_state (~/.notebooklm/).
9
+ - **Inovações (v0.1.1)**: `dual_flow.py` (research_to_notebook/notebook_to_research/research_to_media), `verify_citations.py` (judge adversarial opcional), `ledger.py` (dedup 4 camadas), `agentic.py` (deep-research loop), `watch.py` (watcher), `rag.py` (BM25 cross-notebook). Plugin Claude Code em `.claude-plugin/`+`commands/`+`hooks/`.
10
+
11
+ ## Dedup + embeddings
12
+ - `ledger.py` = 4 camadas: query (`_query_key` ORDENADO, não bag-of-words → evita falso-skip) → hash exato → MinHash near-verbatim → semântico.
13
+ - Semântico = `embed.py`/model2vec LOCAL (extra `[semantic]`, sem API key/torch), lazy + GRACIOSO (ausente → cai pro MinHash). Reescrito cos~0.90 vs MinHash 0.28.
14
+
15
+ ## Gotchas NotebookLM (auth)
16
+ - **watch vigia `list_source_ids` (ESTÁVEL), nunca `read_summary`**: `get_summary` REGENERA o texto a cada chamada → hash muda → falso-positivo de "mudança". Source-ids só mudam ao add/remove fonte.
17
+ - Cookies obrigatórios do notebooklm-py: `SID` + `__Secure-1PSIDTS` (este ROTACIONA). Storage stale → `ValueError: Missing required cookies` → `nlm_http._needs_rebridge` reconhece "cookie"/"missing required" e re-bridge (não casa só "auth"/"expired").
18
+ - Teste live de NotebookLM exige Chrome :9222 ABERTO e logado; senão `SessionNotCreatedException`.
19
+ - notebooklm-py: accessors `client.sources/notebooks/artifacts`; `add_url` auto-detecta YouTube; `add_text/add_file/generate_artifact(audio|video|mind_map)`.
20
+
21
+ ## Comandos
22
+ - Eval: `.venv/Scripts/python.exe evals/run.py`
23
+ - Registrar MCP: `claude mcp add perplexity-pro --scope user -- ".venv/Scripts/perplexity-pro-mcp.exe"`
24
+ - Dual: `dual_flow.research_to_notebook` (PPLX→NLM), `notebook_to_research` (NLM→PPLX)
25
+ - Listar notebooks: `notebooklm_write.nlm_http.list_notebooks_sync()`
26
+
27
+ ## Convenções
28
+ - Commits em português, sem emoji.
29
+ - Segredos só no `.env` (gitignored). Nunca logar valores de cookie.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wgardim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,193 @@
1
+ Metadata-Version: 2.4
2
+ Name: perplexity-notebooklm
3
+ Version: 0.2.0
4
+ Summary: Integração dual NotebookLM <-> Perplexity (conta Pro, sem API key) via MCP + skill
5
+ Project-URL: Homepage, https://github.com/wgardim-hub/notebooklm2perplexity
6
+ Project-URL: Repository, https://github.com/wgardim-hub/notebooklm2perplexity
7
+ Author: wgardim
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: mcp,no-api-key,notebooklm,perplexity,research
11
+ Requires-Python: <3.14,>=3.10
12
+ Requires-Dist: curl-cffi>=0.5.7
13
+ Requires-Dist: mcp[cli]>=1.2.0
14
+ Requires-Dist: python-dotenv>=1.0.0
15
+ Provides-Extra: all
16
+ Requires-Dist: model2vec>=0.8.0; extra == 'all'
17
+ Requires-Dist: notebooklm-mcp>=2.0.11; extra == 'all'
18
+ Requires-Dist: notebooklm-py>=0.7.2; extra == 'all'
19
+ Requires-Dist: selenium>=4.0.0; extra == 'all'
20
+ Provides-Extra: notebooklm
21
+ Requires-Dist: notebooklm-mcp>=2.0.11; extra == 'notebooklm'
22
+ Requires-Dist: notebooklm-py>=0.7.2; extra == 'notebooklm'
23
+ Requires-Dist: selenium>=4.0.0; extra == 'notebooklm'
24
+ Provides-Extra: semantic
25
+ Requires-Dist: model2vec>=0.8.0; extra == 'semantic'
26
+ Description-Content-Type: text/markdown
27
+
28
+ <div align="center">
29
+
30
+ <img src="docs/assets/banner.svg" alt="Perplexity ⇄ NotebookLM" width="100%">
31
+
32
+ **English** · [Português 🇧🇷](README.pt-BR.md)
33
+
34
+ ### The missing bridge between **Perplexity's** web intelligence and **NotebookLM's** knowledge base — driven by Claude Code, with **zero paid API keys.**
35
+
36
+ [![version](https://img.shields.io/badge/version-0.2.0-blue)](https://github.com/wgardim-hub/notebooklm2perplexity/releases)
37
+ [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
38
+ [![python](https://img.shields.io/badge/python-3.13-3776ab)](pyproject.toml)
39
+ [![no API key](https://img.shields.io/badge/API%20key-not%20required-success)]()
40
+ [![Claude Code plugin](https://img.shields.io/badge/Claude%20Code-plugin-7c3aed)]()
41
+
42
+ </div>
43
+
44
+ ---
45
+
46
+ ## Why this exists
47
+
48
+ You research on **Perplexity**. You build knowledge on **NotebookLM**. Today they don't talk —
49
+ you copy-paste between tabs, lose citations, and re-research the same topics.
50
+
51
+ This project closes the loop. It's the **only** tool that wires Perplexity and NotebookLM
52
+ **both ways**, using your **Pro accounts** (cookies) instead of paid API keys — so it costs
53
+ you nothing beyond subscriptions you already pay for.
54
+
55
+ ```mermaid
56
+ flowchart LR
57
+ subgraph PPLX["🔎 Perplexity Pro"]
58
+ S[search / reason / deep research<br/>+ citations]
59
+ end
60
+ subgraph NLM["📓 NotebookLM"]
61
+ N[sources · summaries · audio/video/mind-map]
62
+ end
63
+ S -- "research → source (verified, deduped)" --> N
64
+ N -- "summary → enrich / fact-check" --> S
65
+ C[/"Claude Code<br/>orchestrator"/] -.drives.- S
66
+ C -.drives.- N
67
+ ```
68
+
69
+ ---
70
+
71
+ ## What you get
72
+
73
+ | | Capability |
74
+ |---|---|
75
+ | 🔁 | **Bidirectional dual flow** — research → notebook source, *and* notebook → enriched research. Nobody else does both. |
76
+ | 🔑 | **No paid API keys** — Perplexity via account cookies; NotebookLM via a one-time cookie-bridge. |
77
+ | 📎 | **Citations preserved** — replicates the SSE recipe that surfaces real web sources. |
78
+ | 🧹 | **4-layer dedup** — never ingest the same thing twice (query → exact → near-verbatim → **semantic embeddings**, all local). |
79
+ | 🛡️ | **Adversarial citation verification** — drops hallucinated/dead sources before they reach your notebook. |
80
+ | 🤖 | **Agentic deep-research** — decomposes a question, searches each angle, synthesizes a cited report. |
81
+ | 🎧 | **Media pipeline** — turn research into a NotebookLM audio overview, video, or mind-map in one call. |
82
+ | 👁️ | **Continuous watcher** — monitors notebooks for real changes (stable source-id signal) with hard ToS guards. |
83
+ | 🔌 | **Ships as a Claude Code plugin** — `/dual-research`, `/notebook-enrich`, MCP server, session hook. |
84
+
85
+ ---
86
+
87
+ ## Quickstart
88
+
89
+ > Prereqs: **[uv](https://docs.astral.sh/uv/)** on PATH + **Python 3.12/3.13** (not 3.14). uv handles the venv & deps. Full guide: [`docs/INSTALL.md`](docs/INSTALL.md).
90
+
91
+ ```bash
92
+ # 1. Install as a Claude Code plugin (brings MCP + commands + skill + hook).
93
+ # uv run auto-creates the venv on first launch — cross-OS, no hardcoded paths.
94
+ /plugin marketplace add wgardim-hub/notebooklm2perplexity
95
+ /plugin install perplexity-notebooklm@perplexity-notebooklm-dev # restart Claude Code
96
+
97
+ # 2. Guided login (pulls cookies from a logged-in Chrome — no manual paste).
98
+ # Open once: chrome --remote-debugging-port=9222 --user-data-dir="<profile>"
99
+ # logged into perplexity.ai AND NotebookLM, then:
100
+ uv run --directory <repo> perplexity-nlm-auth
101
+
102
+ # 3. Verify everything ("did I configure it right?")
103
+ uv run --directory <repo> perplexity-nlm-doctor
104
+ ```
105
+
106
+ > One canonical path. **Don't** also copy the skill into `~/.claude/skills/` — the plugin ships it.
107
+ > The package is self-contained (no vendored deps) — once published to PyPI, the MCP runs via
108
+ > `uvx perplexity-notebooklm`. Manual install & `python -m perplexity_mcp.server`: see [`docs/INSTALL.md`](docs/INSTALL.md).
109
+
110
+ ---
111
+
112
+ ## The two flows
113
+
114
+ ```python
115
+ from dual_flow import research_to_notebook, notebook_to_research, research_to_media
116
+
117
+ # Perplexity → NotebookLM (research becomes a verified, deduped source)
118
+ research_to_notebook("State of commercial fusion in 2026", NB, tool="research",
119
+ verify=True, dedup=True)
120
+
121
+ # NotebookLM → Perplexity (read the notebook, fact-check & update against the live web)
122
+ notebook_to_research(NB, tool="search")
123
+
124
+ # Research → media (source + audio / video / mind-map in one call)
125
+ research_to_media("AI in real estate 2026", NB, kind="mind_map")
126
+ ```
127
+
128
+ > **NotebookLM auth:** Google blocks automated logins, so the first run needs a real
129
+ > Chrome you control:
130
+ > `chrome.exe --remote-debugging-port=9222 --user-data-dir="D:\nlm-chrome"` (log in once).
131
+ > After that it's pure HTTP with automatic cookie re-bridge.
132
+
133
+ ---
134
+
135
+ ## Architecture
136
+
137
+ ```
138
+ perplexity_mcp/ MCP server · pluggable backend (helallao) · cited_search
139
+ resilience (retry/jitter/rate-limit) · security · validate
140
+ verify_citations (adversarial) · agentic (deep-research)
141
+ notebooklm_write/ nlm_http (notebooklm-py HTTP/RPC + cookie-bridge) · add_source (Selenium fallback)
142
+ ledger (4-layer dedup) · embed (local model2vec)
143
+ dual_flow.py the bidirectional orchestration
144
+ rag.py · watch.py cross-notebook BM25 retrieval · change watcher
145
+ evals/ · skills/ regression harness · Claude Code skill
146
+ .claude-plugin/ plugin manifest · commands · hooks
147
+ ```
148
+
149
+ **Design principles:** small, single-purpose modules · pluggable Perplexity backend
150
+ (swap providers without touching callers) · graceful degradation everywhere (no Chrome →
151
+ clean error; no embedder → falls back to MinHash; stale cookie → auto re-bridge) ·
152
+ eval harness as a regression gate · honest about limits.
153
+
154
+ ### Dedup, in 4 layers (cheapest first)
155
+
156
+ | Layer | Catches | Cost |
157
+ |-------|---------|------|
158
+ | **Query** | re-researching the same topic | free (skips *before* the Pro call) |
159
+ | **Exact hash** | identical content | free |
160
+ | **MinHash** | near-verbatim edits | free |
161
+ | **Semantic** | reworded / paraphrased (cosine ≈ 0.90) | local embedding, no API |
162
+
163
+ ---
164
+
165
+ ## Reliability & safety
166
+
167
+ - **Resilience:** exponential backoff + full jitter, rate limiting, single-flight auth refresh.
168
+ - **Your accounts, your cookies:** every user authenticates with **their own** Perplexity/NotebookLM. Credentials live only in your local `.env` + `~/.notebooklm/` (git-ignored, never committed, never shipped in the package). Nothing personal is bundled — a fresh install has zero cookies; you run `perplexity-nlm-auth` to pull your own.
169
+ - **Security:** secrets only in `.env` (git-ignored); cookie values never logged (redaction); file perms hardened.
170
+ - **ToS-aware automation:** the watcher defaults to dry-run, enforces a ≥10-min poll floor, an interruptible kill-switch, and writes only through an explicit callback with a human checkpoint.
171
+ - **Tested:** eval harness (`evals/run.py`) + end-to-end validation on real accounts (dual flow, 44-notebook RAG, dedup, watcher).
172
+
173
+ ---
174
+
175
+ ## Honest limitations
176
+
177
+ A senior project says what it *doesn't* do:
178
+
179
+ - Built on **unofficial** Perplexity/NotebookLM interfaces — they can change; expect occasional maintenance.
180
+ - Continuous automation against your accounts carries inherent **ToS risk** — use sparingly.
181
+ - Semantic dedup needs the optional local model; without it, dedup falls back to lexical.
182
+ - NotebookLM write/read needs a logged-in Chrome on the debug port (Google blocks headless login).
183
+
184
+ ---
185
+
186
+ ## Roadmap
187
+
188
+ See [`docs/INNOVATION.md`](docs/INNOVATION.md) for the full ranked roadmap, and
189
+ [`docs/BENCHMARK.md`](docs/BENCHMARK.md) for how this compares against 7 ecosystem projects.
190
+
191
+ ## License
192
+
193
+ MIT — see [`LICENSE`](LICENSE). Not affiliated with Perplexity AI or Google.
@@ -0,0 +1,166 @@
1
+ <div align="center">
2
+
3
+ <img src="docs/assets/banner.svg" alt="Perplexity ⇄ NotebookLM" width="100%">
4
+
5
+ **English** · [Português 🇧🇷](README.pt-BR.md)
6
+
7
+ ### The missing bridge between **Perplexity's** web intelligence and **NotebookLM's** knowledge base — driven by Claude Code, with **zero paid API keys.**
8
+
9
+ [![version](https://img.shields.io/badge/version-0.2.0-blue)](https://github.com/wgardim-hub/notebooklm2perplexity/releases)
10
+ [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
11
+ [![python](https://img.shields.io/badge/python-3.13-3776ab)](pyproject.toml)
12
+ [![no API key](https://img.shields.io/badge/API%20key-not%20required-success)]()
13
+ [![Claude Code plugin](https://img.shields.io/badge/Claude%20Code-plugin-7c3aed)]()
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## Why this exists
20
+
21
+ You research on **Perplexity**. You build knowledge on **NotebookLM**. Today they don't talk —
22
+ you copy-paste between tabs, lose citations, and re-research the same topics.
23
+
24
+ This project closes the loop. It's the **only** tool that wires Perplexity and NotebookLM
25
+ **both ways**, using your **Pro accounts** (cookies) instead of paid API keys — so it costs
26
+ you nothing beyond subscriptions you already pay for.
27
+
28
+ ```mermaid
29
+ flowchart LR
30
+ subgraph PPLX["🔎 Perplexity Pro"]
31
+ S[search / reason / deep research<br/>+ citations]
32
+ end
33
+ subgraph NLM["📓 NotebookLM"]
34
+ N[sources · summaries · audio/video/mind-map]
35
+ end
36
+ S -- "research → source (verified, deduped)" --> N
37
+ N -- "summary → enrich / fact-check" --> S
38
+ C[/"Claude Code<br/>orchestrator"/] -.drives.- S
39
+ C -.drives.- N
40
+ ```
41
+
42
+ ---
43
+
44
+ ## What you get
45
+
46
+ | | Capability |
47
+ |---|---|
48
+ | 🔁 | **Bidirectional dual flow** — research → notebook source, *and* notebook → enriched research. Nobody else does both. |
49
+ | 🔑 | **No paid API keys** — Perplexity via account cookies; NotebookLM via a one-time cookie-bridge. |
50
+ | 📎 | **Citations preserved** — replicates the SSE recipe that surfaces real web sources. |
51
+ | 🧹 | **4-layer dedup** — never ingest the same thing twice (query → exact → near-verbatim → **semantic embeddings**, all local). |
52
+ | 🛡️ | **Adversarial citation verification** — drops hallucinated/dead sources before they reach your notebook. |
53
+ | 🤖 | **Agentic deep-research** — decomposes a question, searches each angle, synthesizes a cited report. |
54
+ | 🎧 | **Media pipeline** — turn research into a NotebookLM audio overview, video, or mind-map in one call. |
55
+ | 👁️ | **Continuous watcher** — monitors notebooks for real changes (stable source-id signal) with hard ToS guards. |
56
+ | 🔌 | **Ships as a Claude Code plugin** — `/dual-research`, `/notebook-enrich`, MCP server, session hook. |
57
+
58
+ ---
59
+
60
+ ## Quickstart
61
+
62
+ > Prereqs: **[uv](https://docs.astral.sh/uv/)** on PATH + **Python 3.12/3.13** (not 3.14). uv handles the venv & deps. Full guide: [`docs/INSTALL.md`](docs/INSTALL.md).
63
+
64
+ ```bash
65
+ # 1. Install as a Claude Code plugin (brings MCP + commands + skill + hook).
66
+ # uv run auto-creates the venv on first launch — cross-OS, no hardcoded paths.
67
+ /plugin marketplace add wgardim-hub/notebooklm2perplexity
68
+ /plugin install perplexity-notebooklm@perplexity-notebooklm-dev # restart Claude Code
69
+
70
+ # 2. Guided login (pulls cookies from a logged-in Chrome — no manual paste).
71
+ # Open once: chrome --remote-debugging-port=9222 --user-data-dir="<profile>"
72
+ # logged into perplexity.ai AND NotebookLM, then:
73
+ uv run --directory <repo> perplexity-nlm-auth
74
+
75
+ # 3. Verify everything ("did I configure it right?")
76
+ uv run --directory <repo> perplexity-nlm-doctor
77
+ ```
78
+
79
+ > One canonical path. **Don't** also copy the skill into `~/.claude/skills/` — the plugin ships it.
80
+ > The package is self-contained (no vendored deps) — once published to PyPI, the MCP runs via
81
+ > `uvx perplexity-notebooklm`. Manual install & `python -m perplexity_mcp.server`: see [`docs/INSTALL.md`](docs/INSTALL.md).
82
+
83
+ ---
84
+
85
+ ## The two flows
86
+
87
+ ```python
88
+ from dual_flow import research_to_notebook, notebook_to_research, research_to_media
89
+
90
+ # Perplexity → NotebookLM (research becomes a verified, deduped source)
91
+ research_to_notebook("State of commercial fusion in 2026", NB, tool="research",
92
+ verify=True, dedup=True)
93
+
94
+ # NotebookLM → Perplexity (read the notebook, fact-check & update against the live web)
95
+ notebook_to_research(NB, tool="search")
96
+
97
+ # Research → media (source + audio / video / mind-map in one call)
98
+ research_to_media("AI in real estate 2026", NB, kind="mind_map")
99
+ ```
100
+
101
+ > **NotebookLM auth:** Google blocks automated logins, so the first run needs a real
102
+ > Chrome you control:
103
+ > `chrome.exe --remote-debugging-port=9222 --user-data-dir="D:\nlm-chrome"` (log in once).
104
+ > After that it's pure HTTP with automatic cookie re-bridge.
105
+
106
+ ---
107
+
108
+ ## Architecture
109
+
110
+ ```
111
+ perplexity_mcp/ MCP server · pluggable backend (helallao) · cited_search
112
+ resilience (retry/jitter/rate-limit) · security · validate
113
+ verify_citations (adversarial) · agentic (deep-research)
114
+ notebooklm_write/ nlm_http (notebooklm-py HTTP/RPC + cookie-bridge) · add_source (Selenium fallback)
115
+ ledger (4-layer dedup) · embed (local model2vec)
116
+ dual_flow.py the bidirectional orchestration
117
+ rag.py · watch.py cross-notebook BM25 retrieval · change watcher
118
+ evals/ · skills/ regression harness · Claude Code skill
119
+ .claude-plugin/ plugin manifest · commands · hooks
120
+ ```
121
+
122
+ **Design principles:** small, single-purpose modules · pluggable Perplexity backend
123
+ (swap providers without touching callers) · graceful degradation everywhere (no Chrome →
124
+ clean error; no embedder → falls back to MinHash; stale cookie → auto re-bridge) ·
125
+ eval harness as a regression gate · honest about limits.
126
+
127
+ ### Dedup, in 4 layers (cheapest first)
128
+
129
+ | Layer | Catches | Cost |
130
+ |-------|---------|------|
131
+ | **Query** | re-researching the same topic | free (skips *before* the Pro call) |
132
+ | **Exact hash** | identical content | free |
133
+ | **MinHash** | near-verbatim edits | free |
134
+ | **Semantic** | reworded / paraphrased (cosine ≈ 0.90) | local embedding, no API |
135
+
136
+ ---
137
+
138
+ ## Reliability & safety
139
+
140
+ - **Resilience:** exponential backoff + full jitter, rate limiting, single-flight auth refresh.
141
+ - **Your accounts, your cookies:** every user authenticates with **their own** Perplexity/NotebookLM. Credentials live only in your local `.env` + `~/.notebooklm/` (git-ignored, never committed, never shipped in the package). Nothing personal is bundled — a fresh install has zero cookies; you run `perplexity-nlm-auth` to pull your own.
142
+ - **Security:** secrets only in `.env` (git-ignored); cookie values never logged (redaction); file perms hardened.
143
+ - **ToS-aware automation:** the watcher defaults to dry-run, enforces a ≥10-min poll floor, an interruptible kill-switch, and writes only through an explicit callback with a human checkpoint.
144
+ - **Tested:** eval harness (`evals/run.py`) + end-to-end validation on real accounts (dual flow, 44-notebook RAG, dedup, watcher).
145
+
146
+ ---
147
+
148
+ ## Honest limitations
149
+
150
+ A senior project says what it *doesn't* do:
151
+
152
+ - Built on **unofficial** Perplexity/NotebookLM interfaces — they can change; expect occasional maintenance.
153
+ - Continuous automation against your accounts carries inherent **ToS risk** — use sparingly.
154
+ - Semantic dedup needs the optional local model; without it, dedup falls back to lexical.
155
+ - NotebookLM write/read needs a logged-in Chrome on the debug port (Google blocks headless login).
156
+
157
+ ---
158
+
159
+ ## Roadmap
160
+
161
+ See [`docs/INNOVATION.md`](docs/INNOVATION.md) for the full ranked roadmap, and
162
+ [`docs/BENCHMARK.md`](docs/BENCHMARK.md) for how this compares against 7 ecosystem projects.
163
+
164
+ ## License
165
+
166
+ MIT — see [`LICENSE`](LICENSE). Not affiliated with Perplexity AI or Google.