Enrich Zotero Abstracts
Overview
Find Zotero items with empty or short abstracts in the configured libraries, web-search for plausible abstract content, present each candidate to the user for approval, and write back to Zotero with version-conflict protection. Items updated this way receive a claude-enriched-YYYY-MM-DD tag for traceability.
When to Use
- User says "fix abstracts", "fill missing abstracts", "/zotero-context:enrich-zotero-abstracts"
- User wants to make a library more useful for downstream search
Prerequisites
/zotero-context:setup-zotero-referenceshas been run in this repo (.zotero-context/config.jsonexists).ZOTERO_API_KEYwith write scope is set in.env— the local Zotero API is read-only for item modification.
Workflow
Step 1: List candidates
.zotero-context/bin/search_items.py --no-abstract --limit 50 --output summary
This returns items where abstractNote is missing or shorter than 50 characters, as a JSON summary with title, creators, year, DOI, url, abstract, and tags fields.
Step 2: For each candidate (one at a time)
Show the user:
Title: <title>
Authors: <creators>
Year: <year>
DOI/URL: <doi or url>
Current abstract: <abstractNote, "(empty)" if blank>
Search the web for an abstract? [y/n/skip-rest]
If yes, web-search using DOI > URL > "title authors year" as the anchor. Quote a candidate abstract back to the user (clearly attributed to the source).
Proposed abstract (from <source URL>):
<text>
Apply this to the Zotero item? [y/edit/n]
If edit, let the user revise inline. If y, proceed to Step 3.
Step 3: Apply
.zotero-context/bin/enrich_abstract.py \
--key <key> \
--abstract "<text>" \
--lib <library id> \
--type {user|group}
Watch for the result:
{"status":"ok",...}— success.{"status":"conflict",...}— the item changed in Zotero between scan and PATCH. Refetch and ask the user whether to retry with the latest data.
Step 4: Report
After all candidates, summarize: N attempted, M enriched, C conflicts, S skipped. List the keys that received the claude-enriched-YYYY-MM-DD tag.
Common Mistakes
- Inventing abstracts from training data instead of web-searching for sourced text. Every proposed abstract must be attributable to a URL.
- Running with
--dry-runfor production usage. Dry-run is for verifying the payload only. - Bulk-applying without per-item user approval. The user must consent to each enrichment.
- Forgetting that
ZOTERO_API_KEYneeds write scope; a read-scope key fails on PATCH.
Verification After Run
After enrichment, the user should see in Zotero (web or desktop):
- Updated
abstractNotefield on each enriched item. - New tag
claude-enriched-YYYY-MM-DDon each enriched item. - No changes to other fields.