# Zotero Agent Zotero Agent is an AI chat panel inside Zotero, on the right of the library and of every reader tab. It talks to your own AI agent (Claude Code, Codex, pi or OpenCode), tells it what you have open (the selected item, the page you are on, the text or area you selected), and lets it work your library through [`zotero-cli`](cli.md) and its skill. Answers cite papers with real `zotero://` links, so a click opens the PDF at that page. The agent is not restricted by the panel: it can search the web, run shell commands and read files, as it would in a terminal. Permission requests show up as cards in the chat, and a mode setting chooses between asking every time and allowing everything. ## Install You need Zotero 7 or newer (developed and tested on Zotero 10), [`zotero-cli`](cli.md) on your PATH (`uv tool install zotero-mcp-server`), and Node.js. The plugin ships inside the `zotero-mcp-server` wheel: ```bash zotero-cli plugin # where the .xpi is, and how to install it zotero-cli plugin --path # just the path, for scripts zotero-cli plugin --reveal # also show the file in your file manager ``` In Zotero: **Tools > Plugins**, click the gear, **Install Plugin From File**, and choose that file. The plugin updates itself from `plugin/updates.json` in this repository. You can also download `zotero-agent.xpi` from the [GitHub release](https://github.com/54yyyu/zotero-mcp/releases/latest). ### Let your agent do it Paste this to Claude Code, Codex, pi, OpenCode or any other agent that has a shell: ```text Install the Zotero Agent plugin for me. Make sure zotero-cli is installed (`uv tool install zotero-mcp-server`, or `pipx install zotero-mcp-server`), then run `zotero-cli plugin --reveal`: it prints the path of zotero-agent.xpi and shows it in my file manager. If it says the file is missing, download https://github.com/54yyyu/zotero-mcp/releases/latest/download/zotero-agent.xpi instead. Zotero cannot install a plugin from the command line, so finish by telling me the one step I do myself: in Zotero, Tools > Plugins, the gear, Install Plugin From File, and choose that file. ``` The agent does everything except the last click: Zotero offers no supported way to install a plugin from outside (opening the file with Zotero offers to import it as a library, and a plugin dropped into the profile folder arrives switched off), so the file picker stays a human step. From a source checkout there is no packaged copy; build it with `npm ci && npm run build` in `plugin/`, which writes `plugin/dist/zotero-agent.xpi`. `zotero-cli plugin` finds that one too. ## First run Open the panel from the toolbar button. The first time, a short welcome has you choose your agent (Claude Code, Codex, pi or OpenCode, each marked ready or not), then runs a check that lists what is missing and, where it can, offers a one-click fix. "Skip setup" leaves it for later; the dot at the top of the panel always shows what is missing. The check covers: - Zotero's local API is reachable. In Zotero's settings, turn on "Allow other applications on this computer to communicate with Zotero". - Writes are authorized (Zotero 10 or newer). Run `zotero-mcp authorize-local` once and choose "Always Allow". - `zotero-cli` is installed. - Node.js is installed. - An agent is installed and signed in. The panel installs the agent's ACP bridge once into its own data folder with `npm install`, so the first run needs network access. After that, chats start without it. OpenCode needs no bridge: it speaks ACP itself. ## Agents and sign-in | Agent | Bridge | |---|---| | Claude Code | `@agentclientprotocol/claude-agent-acp` | | Codex | `@agentclientprotocol/codex-acp` | | pi | `pi-acp` | | OpenCode | none: the panel runs `opencode acp` | Claude Code and Codex each run in one of two ways, chosen per agent in the settings (pi and OpenCode have no subscription: they run on the providers you have configured in them): - **Subscription.** The agent uses the login it already has on this machine (sign in once in a terminal with `claude`, `codex` or `pi`). The panel shows the account the bridge reports, for example "Claude Max". No key is involved. - **API key.** You paste a key; the plugin stores it in Zotero's login manager, never in preferences, and hands it to the bridge as an environment variable (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, ...). The plugin never runs a model itself. ### OpenCode Install OpenCode (`npm i -g opencode-ai`, or any of the ways its site lists) and choose **OpenCode**. With no provider set up it chats on OpenCode Zen's free models; `opencode auth login` adds your own, and the model list shows whatever OpenCode offers (effort levels appear for a model that has them). Its two modes are OpenCode's own agents: **build** edits files and runs commands as OpenCode's permission settings allow, which by default means without asking, so no permission cards appear; **plan** reads and plans and changes nothing. The panel has no login to check for OpenCode, so "ready" means the `opencode` command was found. Summarise now is not offered: OpenCode does not advertise a `/compact` command over ACP. ### Custom ACP agents To use Zotero from a WorkBuddy chat, configure the [WorkBuddy MCP connector](getting-started.md#integrating-with-tencent-workbuddy) in WorkBuddy. In **Settings > Agent**, choose **Custom**. Enter a display name, the executable command, arguments as a JSON array of strings, and optional extra environment variables as a JSON object of strings. Press **Save custom agent**. For example, [Qoder's documented ACP command](https://docs.qoder.com/zh/cli/acp) is: - Name: `Qoder CLI` - Command: `qoder` (or the full path to the executable) - Arguments: `["--acp"]` - Environment: `{}` **Windows:** Prefer the agent's `.exe` when available (use its full path if needed). A `.cmd` or `.bat` launcher that is not handled as an npm shim runs through `cmd.exe`, so arguments containing spaces, quotes or `&` may not arrive unchanged. Install the agent and sign in through its own CLI first. The plugin starts the command directly over stdio, without installing an npm bridge. A command must be on the login PATH or be an absolute path; enter arguments as separate array entries, not as a shell command. The agent inherits your login environment plus the extra variables. Extras are saved in Zotero preferences, **not** the keychain; prefer the agent's own credential storage for secrets. **Show Custom's options** starts a short session to read the agent's advertised models, effort levels and modes. Missing options stay hidden. A mode's name and description come from the agent; custom modes are not assumed to have the same permission behavior as the built-in agents. Changing the command takes effect in new chats and clears the custom model/mode/effort choices. An existing chat keeps its running process. Custom support is best-effort ACP, not a vendor compatibility certification. It uses the existing client's capabilities and does not add filesystem or terminal RPC services. Saved custom chats remain readable locally, but continuing them, a terminal resume command, Summarise now and Translate are unavailable. In particular, the plugin cannot assume an arbitrary agent implements the verified tool restrictions required by Translate. ## Settings Open them from the gear in the panel, or in Zotero's own Settings window under **Zotero Agent** (the same cards; a change in either shows in the other at once). They are a stack of cards, and everything is per agent where it can differ between agents. - **Agent.** Which agent new chats use, how it signs in (subscription or API key, per agent; see below), and for each one its default model, reasoning effort (Claude's effort, Codex's low to max, pi's thinking level) and permission mode. The lists come from the agent itself, so they show what your account really offers. The button under the message box (the model name, with the effort level beside it) opens one menu to switch the agent (a chat that already has messages asks first, since another agent starts a new chat), pick a model, and set the effort on a slider. **Default** marks the model the agent itself uses when you have not chosen one (pi's own default, Claude's, Codex's); choosing it again clears your choice, here and in the settings, where it is the Default option. A short list shows the first four models and the rest under More models. A long one (pi lists every OpenRouter model) has a search field: just start typing (or press /), every word must match the name or id, Down moves into the results, Enter picks the first match, Esc clears the search and then closes. Your current model and the default come first, then the providers you set up yourself, then the big cloud lists, each under its provider's name. - **Appearance.** Glass (frosted, translucent cards and menus; on by default, off is the flat look), the accent colour (Mono, black and white, by default; red and five more swatches, or any colour from the picker or as a hex code; text on it stays readable), a background (Plain by default, a soft Glow, five gradients, or a picture of your own, with its visibility and blur), text size, and density. Changes show as you make them. A picture is shrunk to 1600 px and kept in your Zotero profile as `zotero-chat/background.jpg`; it is never synced, and Remove deletes it. - **Context.** Whether the panel follows what you are reading, whether selected text is attached automatically, and whether a selected area is attached as an image. An image is sent to the agent's provider and costs tokens. - **Chat.** Whether Enter sends (otherwise Cmd/Ctrl+Enter does), whether the agent's thinking is shown, whether tool steps start expanded, and whether the panel is open when Zotero starts (off by default, so Zotero starts exactly as before). - **Skills and prompts.** Your skills and saved prompts in one list: pin, turn off, edit, delete, add. See below. - **Chat folder.** Where new chats run, with Choose, Use default and Open. See below. - **Data.** Clear all history, and reset settings (which keeps your API keys and chats). - **About.** The version and the keyboard shortcuts. The panel opens and closes from the toolbar button, or with Cmd+Option+L (Ctrl+Alt+L elsewhere). You can drag items from the library list, or annotations from the reader's sidebar, onto the composer to attach them. ## Skills and prompts A **prompt** is a message you send often ("Summarize this paper in five sentences"). A **skill** is a longer set of instructions your agent follows step by step, for example how you like a paper annotated: a folder with a `SKILL.md` of plain Markdown (a name, a one-line description, then the steps), see [skills/](skills/README.md) for an example. - Type `/` at the start of the message box for a menu of your skills and prompts (type to filter, arrows, Enter or Tab). A skill goes in as `/name `: add a sentence if you like ("/annotate-paper only the figures"), then send. A prompt puts its text in the box to send or edit. Once a chat is under way, **Summarise now** is listed too where the agent offers it. - Pin up to four (a skill or a prompt): a new chat lists them under "Start with" (click one to run it), and they run from anywhere in Zotero with Cmd+Ctrl+1 to 4 (Ctrl+Alt+1 to 4 elsewhere). - Every agent gets a skill the same way: the panel copies it into the chat folder (`.agents/skills` and `.claude/skills`) and tells the agent in plain words to read that file and follow it, with what you have open attached as usual. - Settings > **Skills and prompts** lists them all. **Add skill…** takes a skill's `SKILL.md` (its folder comes along) or any `.md` file (it becomes a new skill; you give it a name and a line). Before anything is copied you see the full text and every file that is copied or left out: scripts, programs, links and hidden files are left out, and scripts are copied only if you tick that you have read them. **Create with the agent** starts a chat in which your agent asks a few questions and writes the skill for you (or tells you it is better as a prompt). - Your skills live in your Zotero profile, `zotero-chat/skills//SKILL.md` (**Reveal** opens the folder). They work in every chat folder. Copies the panel puts in a folder you chose are marked, and a skill of the same name that you put there yourself is never replaced. Skills tell your agent what to do, and it acts with your permissions: only add skills you trust or wrote. The panel never downloads one. ## While the agent works One small indicator says what the agent is doing: Thinking (in the thinking row, which you can open to read along), Searching your library (or the web), Reading page 7, Working, Writing the answer, or Waiting for your OK when a permission card needs you. A grid of dots in your accent colour moves in a different pattern for each. The line changes at most every 0.4 s, so it never flickers, and it is gone when the turn ends. With your system's "reduce motion" setting the dots stand still. ## Diagrams Ask the agent to draw something (a pipeline, a 2x2, a causal graph) and it answers with a figure in the chat. The agent writes plain SVG; the panel draws it in your theme's colours, so it follows light and dark mode and your accent colour. Hover a figure for its toolbar: show the SVG source, copy it as an image, or save it as PNG (on white, 1400 px wide) or SVG. Anything in a drawing that is not a shape or text, such as scripts, links or external images, is removed before it is shown. **Add to a note** saves the figure as a Zotero note on the item you are looking at, the drawing embedded as an image. Agents often answer with a ```` ```mermaid ```` block instead. The panel draws the common kinds itself, flowcharts (`graph` / `flowchart`, any direction, with subgraphs and `style`/`classDef` colours mapped to your theme) and sequence diagrams (participants, messages, notes, `loop`/`alt`/`opt`/`par` blocks, `autonumber`), with the same card, toolbar, theme and note export; Source shows the Mermaid text. Other Mermaid types (class, state, Gantt, pie, ...) and anything it cannot read stay a code block you can copy. A Mermaid diagram appears once its block is complete; while it streams, the card says it is drawing. ## Notes, math and formatting Under each answer, **Save as note** turns it into a Zotero note on the paper you are reading (or the selected item; with nothing selected, a standalone note in the current collection). The note keeps headings, lists, tables, code, links (citation links still open the page), math (Zotero's note editor typesets it) and drawings as images; **Open** selects it. On the last answer, the bulb asks the agent to explain again, intuition first. Answers and notes share a little formatting beyond Markdown: underline, strikethrough, sub- and superscript, and Zotero's text and highlight colours. The agent knows it, and `zotero-cli notes create/update` take the same text, so it can also write formatted notes directly. Hover a display formula for **Copy TeX**. A formula too wide for the panel shrinks a little, then scrolls sideways. While an answer streams, half-written formulas and tables wait until they are complete. Text you select in the reader goes into the composer as a **Text Selection** chip by itself (remove the chip if you do not want it sent); in the composer's **+** menu, **This page** attaches the page you are on as an image. ## Translate Select a word, a sentence or a paragraph in a PDF and press **Translate** in Zotero's selection popup: the translation appears in the same popup, under the buttons, as it is written. **Copy** copies it; the language under it translates this selection into another language without changing your setting; Esc, a click elsewhere or a new selection closes it, as always. In the settings (the **Translate** card, also in Zotero's Settings pane) you can hide the button, choose the language (by default Zotero's own), and the model: **Fastest available** picks the model your agent itself describes as fast (Claude's Haiku, Codex's Luna; for pi and OpenCode, your chat model), or choose any of the agent's models. It uses the agent you chat with, in a session of its own: it is told only to translate (and never to follow instructions found in the text), it gets no tools, none of your chats, and none of your agent's settings or skills; Codex runs read-only, OpenCode keeps only its read and search tools, inside an empty folder of its own, and any request to use a tool is refused. The session starts when the selection popup appears (it costs no tokens until you press Translate) and stays ready for about five minutes, so with Claude a translation usually starts appearing within a second. ## How full the chat is Once the agent reports it, a small ring beside the permission mode shows how much of the agent's context window this chat uses (amber from 70%, red from 85%). Hover it for the number; click it for details: tokens used, messages, the last turn's tokens (and cost, if "Show tokens and cost" is on), how often the agent summarised older parts, and what context your last message sent. From there, New chat starts fresh, and with Claude, Summarise now asks the agent to summarise the conversation so far and keep going. ## The chat folder, and continuing a chat in a terminal Every chat is a normal agent session that runs in a folder, by default `~/Documents/Zotero-Agent`. The panel installs the `zotero-cli` skill there (under `.claude/skills` and `.agents/skills`, plus a marked block in `AGENTS.md`; it only changes what it marked, so if you pick a folder you already use, the rest of your files are left alone). Change the folder in the settings; it applies to new chats. Each chat remembers the folder it started in, so changing the setting never breaks an old one. Because the agent keeps the session itself, you can continue a chat from a terminal. In the history list, **Copy terminal command** gives you the right command for that chat, for example: ```bash cd '/Users/you/Documents/Zotero-Agent' && claude --resume ``` Codex uses `codex resume `, pi uses `pi --session ` and OpenCode uses `opencode --session `. Two things to know: do not run the same chat in the panel and in a terminal at the same time, and what you add in the terminal does not show up in the panel's history list (the panel keeps its own copy of the conversation; the agent's context has it). **The `papers` folder.** When you start writing about a PDF (the one open in the reader, or the one item selected in the library), the panel has Zotero extract its text into `papers/` in the default chat folder, one file per PDF, for example `papers/3QW3D95Y-callaway-2021.txt`, with a line like `[p.7]` where each page starts. The agent searches that file instead of fetching the paper page by page, and the context block names it once per chat. The text is made locally, from the PDF already on your disk, and nothing is sent anywhere by the panel; the agent reads from the file like any other file in its folder. A file is made again when its PDF changes, and files unused for 60 days, then the oldest beyond 200 MB, are deleted. If you chose a chat folder of your own, nothing is written into it: the files go into your Zotero profile, under `zotero-chat/papers/`. ## Privacy The plugin has no server and sends nothing itself. What leaves your machine is whatever the agent you chose sends to its own provider: your messages, the context block the panel adds to them (the open item, page and selection, and the paper's metadata: authors, venue, DOI, abstract, tags, collections), and anything the agent reads or fetches while working, such as PDF text. The panel's chat history is stored locally in your Zotero profile, under `zotero-chat/sessions/`. The agent keeps its own record of each session as well (for Claude Code under `~/.claude/projects`, for Codex under `~/.codex/sessions`, for pi under `~/.pi/agent/sessions`, for OpenCode in its database under `~/.local/share/opencode`); that is what makes terminal resume work, and it follows that agent's own settings and retention. Translate sends the selected text (up to 6,000 characters) to the same provider; Claude and pi keep no record of those sessions, Codex and OpenCode keep their usual one. ## Troubleshooting - **The panel says Zotero's local API is not responding.** A Zotero that has been running for days can stop serving its local API (port 23119) while the window looks fine. Restart Zotero. If it is a fresh start, check the "Allow other applications" setting above. - **The panel reports that writes are not authorized.** Run `zotero-mcp authorize-local` and choose "Always Allow". Zotero 9 and older cannot take local writes; see [Local library limitations](troubleshooting.md#local-library-limitations). - **`zotero-cli` or `node` is reported missing although your terminal has it.** Zotero started from the Dock or Start menu has a short PATH. The plugin looks them up through your login shell; if yours does not put them on PATH (check `$SHELL -lc 'command -v node'`), fix that in your shell profile and restart Zotero. - **A chat answers with nothing, or the panel says the agent finished without answering.** The model or its reasoning effort was probably refused (some servers reject a high reasoning level). Pick a lower effort or another model for that agent in the settings. - **An OpenCode answer never finishes.** When its provider refuses a request (for example "Free usage limit reached" on a free model), OpenCode logs the error but never ends the turn. Press Stop, then pick another model or add a provider with `opencode auth login`. - **The agent is not signed in.** Run `claude`, `codex` or `pi` once in a terminal and log in, or switch that agent to API-key mode. - **`zotero-cli plugin` says the xpi is not built.** You are running from a source checkout: build it as above, or download it from the release page. ## License The plugin is AGPL-3.0-or-later (`plugin/LICENSE`), like Zotero itself; the rest of zotero-mcp is MIT. By sending a change to `plugin/`, you agree that it may also be released by the maintainer under other licence terms, including commercial ones.