Zotero Enhanced
by @guoxh
Manages the Zotero library. Supports adding new PDF documents with automatic metadata fetching (Crossref/arXiv), searching for existing items, reading attach...
clawhub install zotero-enhanced📖 About This Skill
name: zotero-enhanced description: Manages the Zotero library. Supports adding new PDF documents with automatic metadata fetching (Crossref/arXiv), searching for existing items, reading attached files, and managing notes. Works with both Zotero cloud storage and WebDAV. metadata: { "openclaw": { "emoji": "📚", "homepage": "https://www.zotero.org", "requires": { "bins": ["curl", "jq", "pdftotext", "zip", "unzip"], "env": ["ZOTERO_USER_ID", "ZOTERO_API_KEY"], "anyBins": ["md5sum", "md5"] }, "primaryEnv": "ZOTERO_API_KEY", "externalServices": { "Crossref API": "https://api.crossref.org/", "arXiv API": "https://export.arxiv.org/api/", "Zotero API": "https://api.zotero.org/", "WebDAV server": "user-supplied URL" } }, }
Zotero Enhanced Library Manager
This skill provides a suite of scripts to interact with a Zotero library, covering the full document lifecycle: adding, searching, and reading. Includes enhanced metadata fetching for PDFs with DOI or arXiv IDs.
Storage Modes
The skill supports two storage configurations:
1. Zotero Cloud Storage (Default)
ZOTERO_USER_ID, ZOTERO_API_KEY2. WebDAV Storage
imported_file (stored directly) and imported_url (referenced via WebDAV URL) attachment typesZOTERO_USER_ID, ZOTERO_API_KEY, WEBDAV_URL, WEBDAV_USER, WEBDAV_PASSAuthentication
All scripts require Zotero API credentials. Get your API key from: https://www.zotero.org/settings/keys
1. Searching for Documents
Use scripts/search.sh to find items in the library by keyword.
Usage
# Ensure the script is executable
chmod +x scripts/search.shRun the search
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/search.sh "your search query"
The script outputs a formatted list of matching items with their Key, needed for reading.2. Reading a Document
Option A: Universal Reader (Recommended)
Usescripts/read_universal.sh to read documents from either storage mode.#### Usage
chmod +x scripts/read_universal.shFor Zotero cloud storage:
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/read_universal.sh "ITEM_KEY"For WebDAV storage (add WebDAV variables):
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
WEBDAV_URL="" \
WEBDAV_USER="" \
WEBDAV_PASS="" \
bash scripts/read_universal.sh "ITEM_KEY"
Option B: WebDAV-only Reader
Usescripts/read.sh for WebDAV storage only (legacy).3. Managing Notes
The skill now supports creating, reading, updating, and deleting notes in your Zotero library. Notes can be standalone or attached to parent items (documents).
Creating a Note
Use scripts/create_note.sh to create a new note with plain text content.
#### Usage
chmod +x scripts/create_note.shCreate a standalone note:
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/create_note.sh "My important research notes"Create a note attached to a document:
bash scripts/create_note.sh --parent "ITEM_KEY" "Meeting notes about this paper"Create a note with tags:
bash scripts/create_note.sh --tag research --tag to-read "Follow up on this paper"
#### Options
--parent KEY: Attach note to a parent item (document key)--tag TAG: Add a tag (can be used multiple times)--dry-run: Show steps without creating the noteThe script automatically converts plain text to HTML for Zotero storage.
Reading a Note
Use scripts/read_note.sh to read a note and convert HTML back to plain text.
#### Usage
chmod +x scripts/read_note.shRead as plain text (default):
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/read_note.sh "NOTE_KEY"Read as HTML:
bash scripts/read_note.sh --format html "NOTE_KEY"Read as JSON (full item data):
bash scripts/read_note.sh --format json "NOTE_KEY"
#### Output Formats
plain (default): Human-readable plain texthtml: Raw HTML contentjson: Full JSON item dataUpdating a Note
Use scripts/update_note.sh to update existing notes with new content or tags.
#### Usage
chmod +x scripts/update_note.shReplace note content:
echo "New content" | \
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/update_note.sh --replace "NOTE_KEY"Append to existing content:
echo "Additional notes" | \
bash scripts/update_note.sh --append "NOTE_KEY"Add tags:
bash scripts/update_note.sh --tag important --tag to-read "NOTE_KEY"Remove tags:
bash scripts/update_note.sh --remove-tag obsolete "NOTE_KEY"
#### Options
--replace: Replace note content (default)--append: Append new content to existing note--tag TAG: Add a tag (can be used multiple times)--remove-tag TAG: Remove a tag (can be used multiple times)--dry-run: Show steps without updatingThe script includes version checking to prevent update conflicts.
Deleting a Note
Use scripts/delete_note.sh to delete notes safely with confirmation and backup options.
#### Usage
chmod +x scripts/delete_note.shDelete with confirmation:
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/delete_note.sh "NOTE_KEY"Delete without confirmation (use with caution):
bash scripts/delete_note.sh --no-confirm "NOTE_KEY"Backup before deleting:
bash scripts/delete_note.sh --backup "NOTE_KEY"Dry-run to see what would be deleted:
bash scripts/delete_note.sh --dry-run "NOTE_KEY"
#### Safety Features
--no-confirm is used~/.zotero-backup/ before deletion4. Adding a New Document
Option A: Universal Upload with Metadata Fetching (Recommended)
Usescripts/add_to_zotero_universal.sh for full metadata fetching and flexible storage.#### Features
--dry-run to see what would be uploaded without making changes#### Usage
chmod +x scripts/add_to_zotero_universal.shZotero cloud storage (no WebDAV needed):
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/add_to_zotero_universal.sh "/path/to/paper.pdf"WebDAV storage:
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
WEBDAV_URL="" \
WEBDAV_USER="" \
WEBDAV_PASS="" \
bash scripts/add_to_zotero_universal.sh "/path/to/paper.pdf"
#### Example: Adding a Paper with DOI
The universal script will:
1. Extract DOI 10.1126/science.aec8352 from PDF
2. Query Crossref API for metadata (authors, journal, date, abstract, etc.)
3. Create Zotero item with complete metadata
4. Upload PDF via Zotero API (cloud) or WebDAV (if configured)
Option B: Enhanced Upload (Flexible Storage)
Usescripts/add_to_zotero_enhanced.sh for flexible storage with metadata fetching. Supports both Zotero cloud and WebDAV storage.Option C: Basic Upload (Flexible Storage)
Usescripts/add_to_zotero.sh for flexible storage with title-only extraction. Supports both Zotero cloud and WebDAV storage.5. Requirements
Core Dependencies
curl: HTTP requestsjq: JSON processing (for enhanced/universal scripts)pdftotext: PDF text extraction (from poppler-utils)zip: File compression (for WebDAV mode)Platform Support
All scripts are cross‑platform compatible (Linux and macOS). The universal scripts automatically detect platform‑specific commands (md5sum/md5, stat options).Installation (Debian/Ubuntu)
sudo apt-get update
sudo apt-get install -y curl jq poppler-utils zip
Installation (macOS)
brew install curl jq poppler zip
Quick Start
1. Get Zotero API credentials from your Zotero settings 2. Install dependencies as shown above 3. Check dependencies (optional but recommended):
bash scripts/check_deps.sh
4. Test search functionality:
ZOTERO_USER_ID="1234567" \
ZOTERO_API_KEY="abc123def456" \
bash scripts/search.sh "artificial intelligence"
5. Add your first paper:
ZOTERO_USER_ID="1234567" \
ZOTERO_API_KEY="abc123def456" \
bash scripts/add_to_zotero_universal.sh "~/Downloads/paper.pdf"
Changelog
v1.3.5 (2026‑04‑27)
add_to_zotero_universal.sh (get_filesize function)create_note.sh HTML conversion: handles bold, bullet lists (-, *, numbered), and inline line breaks (
)read_note.sh HTML→plaintext conversion: decodes
, , , /
, and HTML entitiesv1.3.2 (2026‑03‑31)
v1.3.1 (2026‑03‑30)
v1.3.0 (2026‑03‑30)
create_note.sh: Create notes (plain text → HTML, optional parent, tags)
- read_note.sh: Read notes (HTML → text, with format options)
- update_note.sh: Update notes (append/replace, tag management, version checking)
- delete_note.sh: Delete notes (with confirmation, backup option)
v1.2.2 (2026‑03‑30)
check_attachments.sh, find_duplicates.sh, analyze_tags.sh) per user request.v1.2.1 (2026‑03‑30)
imported_url support in read_universal.sh for WebDAV‑stored PDFs.--dry‑run mode for add_to_zotero_universal.sh.v1.2.0 (2026‑03‑30)
md5sum/md5 and stat variants.check_deps.sh).--help/--version flags.Troubleshooting
"No PDF attachment found"
linkMode: "imported_file" (stored directly) or linkMode: "imported_url" (referenced via WebDAV)read_universal.sh script will search for both types automatically"WebDAV authentication failed"
curl -u user:pass "https://your.webdav.server/""Crossref API failed"
curl "https://api.crossref.org/works/10.1126/science.aec8352""File too large for Zotero API"
WEBDAV_URL, WEBDAV_USER, WEBDAV_PASS variables💡 Examples
# Ensure the script is executable
chmod +x scripts/search.shRun the search
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/search.sh "your search query"
The script outputs a formatted list of matching items with their Key, needed for reading.⚙️ Configuration
--parent KEY: Attach note to a parent item (document key)--tag TAG: Add a tag (can be used multiple times)--dry-run: Show steps without creating the noteThe script automatically converts plain text to HTML for Zotero storage.
Reading a Note
Use scripts/read_note.sh to read a note and convert HTML back to plain text.
#### Usage
chmod +x scripts/read_note.shRead as plain text (default):
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/read_note.sh "NOTE_KEY"Read as HTML:
bash scripts/read_note.sh --format html "NOTE_KEY"Read as JSON (full item data):
bash scripts/read_note.sh --format json "NOTE_KEY"
#### Output Formats
plain (default): Human-readable plain texthtml: Raw HTML contentjson: Full JSON item dataUpdating a Note
Use scripts/update_note.sh to update existing notes with new content or tags.
#### Usage
chmod +x scripts/update_note.shReplace note content:
echo "New content" | \
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/update_note.sh --replace "NOTE_KEY"Append to existing content:
echo "Additional notes" | \
bash scripts/update_note.sh --append "NOTE_KEY"Add tags:
bash scripts/update_note.sh --tag important --tag to-read "NOTE_KEY"Remove tags:
bash scripts/update_note.sh --remove-tag obsolete "NOTE_KEY"
#### Options
--replace: Replace note content (default)--append: Append new content to existing note--tag TAG: Add a tag (can be used multiple times)--remove-tag TAG: Remove a tag (can be used multiple times)--dry-run: Show steps without updatingThe script includes version checking to prevent update conflicts.
Deleting a Note
Use scripts/delete_note.sh to delete notes safely with confirmation and backup options.
#### Usage
chmod +x scripts/delete_note.shDelete with confirmation:
ZOTERO_USER_ID="" \
ZOTERO_API_KEY="" \
bash scripts/delete_note.sh "NOTE_KEY"Delete without confirmation (use with caution):
bash scripts/delete_note.sh --no-confirm "NOTE_KEY"Backup before deleting:
bash scripts/delete_note.sh --backup "NOTE_KEY"Dry-run to see what would be deleted:
bash scripts/delete_note.sh --dry-run "NOTE_KEY"
#### Safety Features
--no-confirm is used~/.zotero-backup/ before deletion📋 Tips & Best Practices
"No PDF attachment found"
linkMode: "imported_file" (stored directly) or linkMode: "imported_url" (referenced via WebDAV)read_universal.sh script will search for both types automatically"WebDAV authentication failed"
curl -u user:pass "https://your.webdav.server/""Crossref API failed"
curl "https://api.crossref.org/works/10.1126/science.aec8352""File too large for Zotero API"
WEBDAV_URL, WEBDAV_USER, WEBDAV_PASS variables