zotero配置
无头文献工作流程:Zotero Cloud API到citar兼容BibTeX
没有Zotero图形用户界面。没有更好的BibTeX插件。只有API、脚本和Emacs。
AI代理技能: pi技能/bibcli -代理的技能文档由pi-skills报告管理。

______________________________________________________________________
这有什么作用
通过Cloud API获取整个Zotero库,生成按类型拆分的citar兼容BibTeX文件,并将新的引用密钥写回Zotero Cloud。
./run.sh bib full # Full sync: 5,893 items → 7 BibTeX files (~90s)
./run.sh bib sync # Incremental sync (delta only, seconds)
./run.sh bib status # Show sync state
./run.sh starred # GitHub starred repos → github-starred.bib
# default account: junghan0611
./run.sh save # Save URL → Translation Server → Zotero Cloud
./run.sh save --sync --json # Save → bib sync → citation key recovery
./run.sh server start # Start Translation Server (localhost:1969)
./run.sh build # Build bibcli (search CLI for AI agents)______________________________________________________________________
管道
run.sh bib full|sync
│
├── 1. Fetch items from Zotero Cloud API (JSON, paginated)
│ └── /users/{id}/items/top?format=json&limit=100
│
├── 2. Generate citation keys (gen-bibtex.py)
│ ├── Existing citationKey → keep as-is
│ ├── book + ISBN → DATA4LIBRARY API → KDC classification
│ │ └── e.g. "802.041-김74ㄴ" (KDC-AuthorCode)
│ └── Others → BBT-style rules
│ └── e.g. "web-perplexity", "blog-AiVampire26"
│
├── 3. Write type-based BibTeX files
│ ├── Book.bib (1,463 entries) ← book
│ ├── Online.bib (2,610 entries) ← webpage, blogPost, forumPost
│ ├── Software.bib (1,082 entries) ← computerProgram
│ ├── Reference.bib (365 entries) ← encyclopediaArticle, dictionaryEntry
│ ├── Video.bib (239 entries) ← videoRecording, film, tvBroadcast
│ ├── Article.bib (69 entries) ← journalArticle
│ └── Misc.bib (62 entries) ← everything else
│
├── 4. Writeback new citationKeys → Zotero Cloud API (PATCH)
│
└── 5. Save state (.sync/last-version, items.json)
run.sh starred
│
└── GitHub starred repos → github-starred.bib (2,140 entries)
├── default account: junghan0611
├── if active gh account differs: gh auth switch --user
└── gh api --paginate user/starred → jq → @software{} entries______________________________________________________________________
引文关键模式
| 类型 | 英语 | 韩语(KDC) |
|---|---|---|
| 书籍 | HowTakeSmart17 | 802.041-김74ㄴ |
| 书籍 | CLRSIntroductionAlgorithms09 | 005-포14ㅋ |
| 网页 | web-perplexity | — |
| 博客文章 | blog-AiVampire26 | — |
| 软件 | 200okchorganice24 | — |
具有ISBN的韩国书籍通过以下方式获得KDC分类号+4字符作者代码 data4库 API
______________________________________________________________________
目录结构
zotero-config/
├── run.sh # Main entry point
├── scripts/
│ ├── zotero-to-bib.sh # Zotero API fetcher (bash + curl + jq)
│ ├── gen-bibtex.py # BibTeX engine (Python, citar-compatible)
│ ├── writeback-keys.sh # citationKey → Zotero Cloud (PATCH)
│ ├── gh-starred-to-bib.sh # GitHub starred → BibTeX (gh + jq)
│ ├── run.sh # Translation Server manager
│ └── zotero-save-url.sh # URL saver via Translation Server
├── bibcli/ # BibTeX search CLI for AI agents (Go)
│ ├── main.go # CLI: search/show/list/lookup/stats
│ ├── parser.go # BibTeX parser (8,000 entries in 18ms)
│ ├── search.go # Case-insensitive multi-field AND search
│ ├── lookup.go # data4library 서지검색 (ISBN/제목)
│ └── SKILL.md # Claude Code skill definition
├── output/ # Generated BibTeX files (symlinked from ~/org/resources/)
│ ├── Book.bib
│ ├── Online.bib
│ ├── Software.bib
│ ├── Reference.bib
│ ├── Video.bib
│ ├── Article.bib
│ ├── Misc.bib
│ └── github-starred.bib
├── config/ # BBT preferences (reference only)
├── plugins/ # Zotero plugin XPIs (archive)
└── .sync/ # Sync state (gitignored)
├── items.json # Cached Zotero items
├── last-version # API version for incremental sync
└── new-keys.json # Pending citationKey writebacks______________________________________________________________________
设置
需求
curl,jq,python3(不需要pip包)- 具有API访问权限的Zotero帐户
- (可选) DATA4LIBRARY API键 韩国KDC
环境
创建 .envrc 在项目根目录中:
export ZOTERO_API_KEY="your-key"
export ZOTERO_USER_ID="your-user-id"
export DATA4LIBRARY_API_KEY="your-key" # optional, for KDC lookup
export GH_STARRED_ACCOUNT="junghan0611" # optional override for ./run.sh starred首次运行
git clone https://github.com/junghan0611/zotero-config.git
cd zotero-config
# Create .envrc with your API keys
./run.sh bib full # Full sync (~90 seconds for ~6000 items)Emacs集成
BibTeX文件在 output/ 符号链接到 ~/org/resources/:
ln -s /path/to/zotero-config/output/Book.bib ~/org/resources/Book.bib
# ... repeat for each .bib file然后配置citar:
(setq citar-bibliography
'("~/org/resources/Book.bib"
"~/org/resources/Online.bib"
"~/org/resources/Software.bib"
"~/org/resources/Reference.bib"
"~/org/resources/Video.bib"
"~/org/resources/Article.bib"
"~/org/resources/Misc.bib"
"~/org/resources/github-starred.bib"))______________________________________________________________________
bibcli--BibTeX搜索命令行界面
转到AI代理的CLI以搜索/查看完整的参考书目(8030个条目)。仅JSON输出,仅stdlib,单个静态二进制文件。
./run.sh build # Build + install to ~/.local/bin
bibcli search "emacs" --max 5 # Full-text search
bibcli search "한국" --type Book # Korean + type filter
bibcli show "165.84-박82ㅅ" # Full entry by citation key
bibcli lookup 9791192300283 # ISBN → KDC, 저자, 출판사, 연도
bibcli lookup "슈바이처" --max 3 # 제목 검색 (data4library)
bibcli stats # Per-file counts看 bibcli/SKILL.md 完全使用。
______________________________________________________________________
翻译服务器
无需GUI即可将URL直接保存到Zotero Cloud:
./run.sh server start # Start localhost:1969
./run.sh save "https://example.com" # Save URL to Zotero
./run.sh save --sync --json "https://example.com"
# => { saved:[...], resolved:[{zoteroKey,citationKey,title,...}] }
./run.sh server stop用途 Zotero翻译服务器 (克隆到 ~/repos/3rd/translation-server).
______________________________________________________________________
链接
- 数字花园: notes.junghanacs.com
- Zotero集团图书馆: @junghanacs
______________________________________________________________________
作者: @junghanacs 哲学人生是一本书。每个人都是作家。
