Skip to content

Desperado1001/notebooklm-obsidian-loop

Repository files navigation

notebooklm-obsidian-loop

A Claude Code skill for a NotebookLM ↔ Obsidian research loop, now powered by the official Obsidian CLI.

🎯 What's New (v2.0)

  • Official Obsidian CLI Integration - Uses Obsidian 1.12.4+ built-in CLI
  • Safe Operations - All operations go through Obsidian's runtime (preserves links!)
  • Chinese Language Support - Auto-detection, pinyin filenames, localized templates
  • NotebookLM References - Citations automatically included in notes
  • Daily Reports - New command to generate daily summaries

🔄 Workflow

┌─────────────────┐         ┌──────────────┐         ┌─────────────────┐
│  NotebookLM     │ ────→   │   Obsidian    │ ────→   │  NotebookLM     │
│  (研究引擎)      │  ①提问   │  (长期记忆)   │  ③导出   │  (积累知识)     │
│                 │ ←───  │              │ ←───  │                 │
│                 │  ②笔记  │              │  ④迭代   │                 │
└─────────────────┘         └──────────────┘         └─────────────────┘

📋 Prerequisites

  1. Obsidian 1.12.4+ - Desktop app with built-in CLI
  2. Enable CLI - Settings → General → Command line interface → Register CLI
  3. Python 3.10+ with packages:
    • notebooklm-py[browser]
    • pypinyin (for Chinese filenames)
  4. NotebookLM login - notebooklm login

🚀 Quick Install

# Windows
.\install.ps1 -VaultPath "D:\path\to\Obsidian" -DefaultNotebook "Research" -InstallDeps

📖 Usage

1. Preflight Check

python scripts/obsidian_loop.py preflight

2. Ask & Save Note

python scripts/obsidian_loop.py ask-and-save `
  --notebook "My Research" `
  --question "What are the key principles of PARA method?" `
  --note-type concept `
  --title "PARA Method Overview"

3. Daily Report (NEW!)

python scripts/obsidian_loop.py daily-report

4. Search Vault (NEW!)

python scripts/obsidian_loop.py search "PKM"
python scripts/obsidian_loop.py search "[tag:urgent]" --format json

🌟 Features

Official CLI Commands Used

Operation CLI Command
Create note obsidian create name="Title" content="..."
Read note obsidian read file="Note"
Append to daily obsidian daily:append content="..."
Search obsidian search query="term"
List files obsidian files total
Get tags obsidian tags sort=count
Move note obsidian move file="Note" to=Archive/

Chinese Support

  • Auto-detection: Content >30% Chinese → use Chinese templates
  • Pinyin filenames: "项目约束" → xiang-mu-yue-shu.md
  • Localized templates: Separate English/Chinese note templates

📂 Obsidian CLI Complete Reference

Files & Folders

obsidian files                    # List all files
obsidian files folder=Projects/    # Files in folder
obsidian files total               # Count notes
obsidian folders                  # List folders (tree view)

obsidian read file="Note"          # Read note content
obsidian create name="New"          # Create note
obsidian create name="Note" content="# Heading" template="Template"

obsidian append file="Note" content="Text"
obsidian prepend file="Note" content="Text"

obsidian move file="Draft" to=Archive/    # Move (updates links!)
obsidian delete file="Old"            # Move to trash

Search

obsidian search query="topic"                    # Full-text search
obsidian search query="[tag:publish]"              # Tag search
obsidian search query="[status:active]"            # Property search
obsidian search query="topic" format=json           # JSON output

Daily Notes

obsidian daily                                     # Open today's note
obsidian daily:read                                 # Read content
obsidian daily:append content="- [ ] Task"      # Append
obsidian daily:prepend content="## Heading"     # Prepend
obsidian daily:date=2026-03-13                    # Specific date

Properties

obsidian properties file="Note"                     # Read properties
obsidian properties:set file="Note" status=active
obsidian properties:set file="Note" tags=pkm,obsidian type=tags

Tags & Links

obsidian tags                                        # All tags
obsidian tags sort=count                             # By frequency
obsidian tag tagname=pkm                             # Notes with tag
obsidian tags:rename old=meeting new=meetings     # Bulk rename

obsidian links file="Note"                            # Outgoing links
obsidian backlinks file="Note"                        # Incoming links
obsidian unresolved                                  # Broken links
obsidian orphans                                     # Unlinked notes

Tasks

obsidian tasks                                        # All tasks
obsidian tasks format=json                           # JSON output
obsidian task:create content="Write report"

🔧 Environment Variables

$env:OBSIDIAN_VAULT_PATH = "D:\path\to\Obsidian"
$env:NOTEBOOKLM_DEFAULT_NOTEBOOK = "Research"
$env:OBSIDIAN_CONCEPTS_FOLDER = "Concepts"
$env:OBSIDIAN_PROJECTS_FOLDER = "Projects"
$env:OBSIDIAN_DAILY_FOLDER = "Daily"

📝 Note Templates

Concept Note (Chinese)

---
type: concept
title: $title
created: $created
notebook: $notebook
question: $question
source: notebooklm
language: zh
---

# $title

## 核心要点

$answer

$references

## 为什么重要

## 后续问题

- [!add]

## 相关笔记

- [!add]

Project Note (English)

---
type: project
title: $title
created: $created
notebook: $notebook
question: $question
source: notebooklm
language: en
---

# $title

## Summary

$answer

$references

## Constraints

- [!add]

## Decisions

- [!add]

## Next Actions

- [!add]

🚀 Claude Code Integration

This skill integrates seamlessly with Claude Code. Example prompts:

向我的 "Research" 笔记本询问 PARA 方法的主要原则,
并保存为概念笔记。
生成今日报告,包括未完成任务数量和热门标签。
搜索我 vault 中所有标记为 #urgent 的笔记。

🔗 Links


⚠️ Troubleshooting

"command not found: obsidian"

  1. Ensure Obsidian 1.12.4+ is installed
  2. Enable CLI in Settings → General → Command line interface
  3. Restart terminal for PATH to take effect

"Obsidian must be running"

The official CLI requires the Obsidian app to be running in the background.

Chinese characters in filenames

Install pypinyin for proper Chinese filename handling:

pip install pypinyin

🧪 Testing & Verification

Run Unit Tests

cd C:\Users\Administrator\.claude\skills\notebooklm-obsidian-loop
python -m pytest tests/ -v

Current test coverage: 28 tests covering all utility functions

Cold Start Verification

# Automated verification
python verify_installation.py

# Or use the manual checklist
cat VERIFICATION_CHECKLIST.md

🌐 Platform Support

Platform Status Notes
Windows 10/11 ✅ Primary PowerShell install script available
macOS 13+ Requires Xcode Command Line Tools
Linux Major distributions supported

⚠️ Current Limitations

  • Requires NotebookLM access and notebooklm-py properly installed
  • Large file imports may be subject to system command line length limits
  • notebooklm-py is a community-maintained third-party library, may not always align with NotebookLM official updates
  • Chinese filenames require pypinyin dependency

📋 Known Issues

Migration Notes

If upgrading from v1.x:

  • Ensure environment variables are properly configured
  • Re-run install.ps1 to update configuration
  • Test CLI commands after upgrade

Test Status

  • ✅ Core utility functions: 28/28 tests passing
  • ⚠️ Integration tests require live NotebookLM access

📂 Project Structure

notebooklm-obsidian-loop/
├── scripts/
│   ├── obsidian_loop.py      # Main entry point
│   ├── obsidian_cli.py        # Obsidian CLI wrapper
│   ├── bridge.py              # NotebookLM interface
│   └── utils.py               # Shared utilities
├── tests/
│   ├── test_utils.py          # Utility function tests
│   └── __init__.py
├── templates/
│   ├── concept_note.md        # English concept template
│   ├── concept_note_zh.md     # Chinese concept template
│   ├── project_note.md        # English project template
│   └── project_note_zh.md     # Chinese project template
├── data/                       # Local data storage
├── pyproject.toml             # Python project configuration
├── verify_installation.py     # Automated verification script
├── VERIFICATION_CHECKLIST.md  # Manual verification checklist
├── install.ps1                # Windows installer
└── install.sh                 # Unix installer