Clean 500 items
The problem
Section titled “The problem”You imported a few hundred references and the metadata is a mess: inconsistent
dates, missing publishers, TITLE IN ALL CAPS, junk left over from a PDF
scrape. Editing them one at a time in the Zotero UI is hopeless, and true
batch editing of metadata for multiple items is one of the longest-standing
Zotero feature requests — open on the forums since 2016.
zotero-agent does it locally, and undoably.
Via an AI agent
Section titled “Via an AI agent”“In collection Imports 2024, normalize titles to sentence case, set any missing publisher on the book items to the value I gave you, and tag everything
#cleaned. Dry-run first, show me a sample of before/after, then apply.”
The agent reads the collection, proposes the JSONL edit, previews it, and applies it with a snapshot so you can undo. You approve the values; the CLI does the writing.
Via the CLI
Section titled “Via the CLI”The batch primitive is zot apply, fed a JSONL file — one edit per line:
{"key":"ABCD1234","set":{"title":"Digitalization and society","date":"2021"},"addTags":["cleaned"]}{"key":"EFGH5678","set":{"publisher":"MIT Press"},"addTags":["cleaned"]}{"key":"IJKL9012","set":{"date":"2019"},"addTags":["cleaned"],"removeTags":["raw-import"]}Each line may carry set, addTags, removeTags, addToCollection, and
trash. Then:
zot apply edits.jsonl --dry-run # preview every change, no writeszot apply edits.jsonl # apply — snapshots affected items firstTo build edits.jsonl at scale, export the collection, decide the values
(by hand, a script, or an agent), and emit one line per item:
zot export "Imports 2024" --format json --out imports.json# ... produce edits.jsonl from imports.json ...Safety net
Section titled “Safety net”zot backup # snapshot zotero.sqlite before a big runzot apply edits.jsonl --dry-run # confirm the diffzot apply edits.jsonl # snapshots automaticallyzot undo last # full rollback if anything looks wrongzot apply snapshots the affected items before writing, so zot undo last
restores them exactly. Disable auto-sync during the run so a mistake doesn’t
propagate to zotero.org.