Small script to auto-summarize new papers in the Zotero library.
The script works by looking at tags of top-level items ( see Config Values) and then sending the PDF to Claude and asking for a summary in the style of the prompt. After getting a response, it attaches the summary as a note to the top-level item and then updates the tags.
- Edit the prompt from
prompt.txt - Edit the config (
config.example.ini) and rename it toconfig.ini - Build the docker container (
docker build -t Athena) - Run the container (
docker run -d -p 5000:5000 -v /mnt/your/local/path/to/zotero/attachments:/app/zotero)
[claude]api_keyis your Anthropic API key[zotero]user_idis the user ID of your Zotero Account[zotero]file_pathis the path to your Zotero attachments[zotero]api_keyis the API key of the Zotero Web API. Needs both read + write access[zotero]todo_tag_nameis the name of the tag to add summaries to. Works great together with zotero-tag to add tags automatically. Alternatively, use the/add_missing_tags/endpoint[zotero]summarized_tag_name,[zotero]error_tag_nameget automatically added after an (un)successful summary occured[zotero]deny_tag_namehas to be set manually for items (in Zotero) which should not be summarized (e.g. own, unpublished papers)
The Docker container exposes a web server with the following services:
GET /add_missing_tags/: Adds[zotero]todo_tag_nameto items which have no Athena-related tags (i.e. those in theconfig.ini). Can be used instead of using zotero-tag.GET /summarize/: Starts the summarization of all papers with[zotero]todo_tag_name. The endpoint immediately returns a response and continues in the background as the summarization may take a long time.
- Items which have no attachments will not be summarized
- Items with PDFs which are too small (<5 pages) or too large (>60 pages) will not be summarized
- If the PDF has text which is hard to extract (i.e. old papers/books) will result in bad summaries
- Sometimes, Claude wants to summarize the prompt. In my tests, this usually happens if the text is hard to extract
- Images in PDFs cannot be summarized