zotero-agent: Instructions file for Codex

AGENTS.md

zotero-agent AGENTS.md is an instructions file for Codex, OpenCode from psiQAQ/zotero-agent. It costs 3,307 tokens per session, scanned A, original, MIT.

A development guide for Zotero Agent, a Zotero plug-in with an MCP server that lets local AI tools connect to Zotero’s libraries and data.

In plain words
What is it for?
Use it when developing, building, deploying, or testing the Zotero Agent plug-in.
Why use it?
It explains the plug-in’s architecture, local connection details, repository layout, build process, deployment, and tests.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md; mentions Codex.

This is psiQAQ/zotero-agent's own configuration. It tells Codex and OpenCode how to work on zotero-agent itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything zotero-agent configures →

Reuse

Borrowing it

Nothing to install: this file belongs to psiQAQ/zotero-agent. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/psiQAQ/zotero-agent/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/psiQAQ/zotero-agent

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for zotero-agent AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/psiqaq/zotero-agent/agents-md/github.svg)](https://agentmods.dev/instructions/psiqaq/zotero-agent/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/psiqaq/zotero-agent/agents-md"><img src="https://agentmods.dev/badge/instructions/psiqaq/zotero-agent/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for zotero-agent AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/psiqaq/zotero-agent/agents-md"><img src="https://agentmods.dev/badge/instructions/psiqaq/zotero-agent/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,307 This file is loaded in full into every session.
When invoked 3,307 The same file — it is already loaded in full.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.03307 $0.03307
Opus 5.5 $0.01323 $0.01323
Sonnet 5.5 $0.00661 $0.00661
Haiku 4.5 $0.00331 $0.00331

Measured 2mo ago against content hash 168f37d8efa9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

zotero-agent AGENTS.md scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- 验证官方读通路:`curl -sD - http://127.0.0.1:23119/api/users/<library-id>/items?limit=1` → 200
AGENTS.md · 126 lines

How it starts

The opening of the file, as written. The whole thing — 126 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

本仓库 = Zotero Agent(zotero-agent):从 cookjohn/zotero-mcp fork 二次开发后独立的发布仓库,插件目录即仓库根。完整变更史见 CHANGELOG.md(从上游 v1.5.0 起)。本文件是给未来会话的开发 / 发布上下文。


1. 架构

  • 本插件 = 一个内嵌 MCP server 的 Zotero 插件:插件在 Zotero 进程内起 HTTP server(手写 nsIServerSocket),端口 23120,只绑 127.0.0.1
  • 常规用法:插件装在本地 Zotero,AI 客户端(Codex 等)本地直连 http://127.0.0.1:23120/mcp,用 Authorization: Bearer <PSK> 认证
  • 读还可走 Zotero 官方只读 API(127.0.0.1:23119,仅服务浏览器 Connector 的读请求)
  • 关键区别:Zotero 进程内 Zotero.Libraries.userLibraryID = 1,与 web 账号那个数字 library ID 不同;写 run_javascript 时用进程内的 1,调官方 API 路径 /api/users/<library-id>/ 时才用 web library ID

2. 仓库结构(插件为根)

  • src/ addon/ — 插件 TS 源码 + 资源(manifest / locale / 偏好 UI)
  • test/ — 纯函数单测(*.test.cjs,node 直跑)
  • scripts/ — deploy-live.mjs(本地 xpi → 目标 Zotero 部署)、prepare-release.js(生成 update.json)、unit-test.mjs
  • .github/workflows/ — release CI(在根,GitHub 才会触发)
  • refs/ — 17 个调研参考 submodule,声明保留、内容按需:用哪个再 git submodule update --init refs/<path>
  • CHANGELOG.md — 变更史(人写、提交);update.json — 更新清单(机器生成、不提交,见 §4)

3. 开发循环(build + 部署)

改代码 → npm run build(zotero-plugin build + tsc --noEmit,产物 .scaffold/build/zotero-agent.xpi)→ node scripts/deploy-live.mjs(xpi base64 经 run_javascript 写入 Zotero 端临时路径 + 自升级,~5s 断连后即新版)。

  • deploy-live.mjs 也能装任意 xpi:node scripts/deploy-live.mjs 路径/xxx.xpi(如使用者下载的 xpi)。它依赖 zotero MCP 通道(PSK),是"已装本插件后换版 / 升级"的工具;首次裸装仍需手动把 xpi 拖进 Zotero

测试

  • 本地单测:npm run test:unit —— test/*.test.cjs 纯函数单测(node 直跑,无框架,runner scripts/unit-test.mjs),覆盖 auth / eval / HTTP 字节读取 / MCP 协议 / 元数据合并 / PDF 识别与解析器 / 标题相似度 / hybrid search 等模块
  • 部署后全栈回归:src/modules/selfTest.ts,startup 时挂载为 Zotero.ZoteroAgentSelfTest。约 32 场景:协议层(initialize 版本协商、401/403、-32601/-32602、isError 语义)+ 工具层(import 幂等、WoS 工具显隐、批量导入 dry-run、preprint 升级、DOI repair、伴生插件桥接、写类工具 dry-run 默认、搜索降级级联、CJK mojibake 回归、pdf resolvers 往返等)。版本更新部署后跑:run_javascript 里 return await Zotero.ZoteroAgentSelfTest.run('protocol');.list() 列可用套件

Read the full file on GitHub · 126 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 126 lines · 3,307 tokens per session scan A 168f37d8efa9

Subscribe to this mod's changes

zotero-agent AGENTS.md is an instructions file published in the GitHub repository psiQAQ/zotero-agent (8 stars, last pushed 3mo ago), licensed MIT. It adds 3,307 tokens to every session, about $0.0132 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

zotero-agent AGENTS.md compared with instructions from other repositories

zotero-agent AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
zotero-agent AGENTS.mdpsiQAQ/zotero-agentInstructions file83mo agoMITA3,307Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file275k2d agoMITA4,313Codex, OpenCode