### Clone and Install cc-llm4zotero-adapter Source: https://github.com/yilewang/llm-for-zotero/blob/main/README.md Clone the companion bridge repository, install its dependencies, build the project, and start the bridge server. ```bash git clone https://github.com/jianghao-zhang/cc-llm4zotero-adapter.git cd cc-llm4zotero-adapter npm install npm run build npm run serve:bridge ``` -------------------------------- ### Install macOS Background Daemon Source: https://github.com/yilewang/llm-for-zotero/blob/main/README.md Installs the LaunchAgent for running the bridge in the background on macOS. ```bash ./scripts/install-macos-daemon.sh ``` -------------------------------- ### Custom Filename Pattern Example 2 Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/write-note.md This example demonstrates another user-customizable filename pattern, incorporating year, first author, and notetitle. ```markdown ## Your customizations Filename pattern: `{year}-{firstauthor}-{notetitle}.md` Example: 2020-Buschman-figure-1.md ``` -------------------------------- ### Install Codex CLI Source: https://github.com/yilewang/llm-for-zotero/blob/main/README.md Install the Codex CLI globally using npm. For macOS, Homebrew is also an option. Ensure correct installation path for Windows users. ```bash npm install -g @openai/codex ``` ```bash brew install --cask codex ``` -------------------------------- ### Verify Claude Code CLI Installation Source: https://github.com/yilewang/llm-for-zotero/blob/main/README.md Run this command to ensure the Claude Code CLI is installed and accessible in your PATH. ```bash claude ``` -------------------------------- ### Custom Filename Pattern Example 1 Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/write-note.md Users can customize the filename pattern by adding a 'Your customizations' section to the skill file. This example shows a pattern using citekey and notetitle. ```markdown ## Your customizations Filename pattern: `{citekey}-{notetitle}.md` Example: Buschman2020-figure-1.md ``` -------------------------------- ### Embedding Images with Relative Paths Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/write-note.md This example demonstrates how to correctly format markdown for embedding images using relative paths. It shows the note path, image path, note folder, computed relative path, and the final markdown to be written. Ensure the relative path is correctly calculated to point from the note's directory to the image file. ```markdown Note path: {vault}/Logs/paper-notes/Nili2014.md Image path: {vault}/Logs/imgs/Nili2014/figure-2.jpg Note folder: {vault}/Logs/paper-notes/ Relative: ../imgs/Nili2014/figure-2.jpg Write: ![Figure 2. RSA toolbox schematic](../imgs/Nili2014/figure-2.jpg) ``` -------------------------------- ### Manage Bridge Daemon Commands Source: https://github.com/yilewang/llm-for-zotero/blob/main/README.md Useful commands for managing the bridge daemon's status, start, stop, restart, and uninstall operations. ```bash npm run daemon:status npm run daemon:start npm run daemon:stop npm run daemon:restart npm run daemon:uninstall ``` -------------------------------- ### Overview Paper Read Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/literature-review.md Use `paper_read` with `mode:'overview'` to get a general understanding of selected papers. This is a preliminary step before deeper reading. ```python paper_read({ mode:'overview', targets:[...] }) ``` -------------------------------- ### Write Note to File using file_io Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/write-note.md This snippet demonstrates the core logic for writing a note to a file. It constructs the file path and then calls the `file_io` action with the 'write' action type, the resolved file path, and the note content. Error handling for write failures is also included. ```markdown 1. Construct the file path: `{defaultTargetPath}/.md` unless the user explicitly specifies another folder, using the native path separator from the runtime platform section. 2. Call `file_io({ action:'write', filePath, content:noteContent })`. 3. If writing fails, report the error clearly with the attempted path. ``` -------------------------------- ### Template for General Notes Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/write-note.md Use this template for general notes, topic summaries, or free-form thoughts. It requires a title, creation date, and tags. ```markdown --- title: "{{noteTitle}}" created: {{created}} tags: [zotero] --- # {{noteTitle}} {{content}} --- Written by LLM-for-Zotero. ``` -------------------------------- ### Log in to Codex CLI Source: https://github.com/yilewang/llm-for-zotero/blob/main/README.md Log in to the Codex CLI to authenticate. Your credentials will be saved to a local JSON file. ```bash codex login ``` -------------------------------- ### Read Manifest File Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/analyze-figures.md Reads the manifest.json file from the MinerU cache directory to access metadata about figures and sections within a paper. ```javascript file_io({ action:'read', filePath:'{mineruCacheDir}/manifest.json' }) ``` -------------------------------- ### Import by Identifiers Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/import-cited-reference.md Directly imports papers using a list of identifiers (DOI, arXiv ID, ISBN, URL) without prior resolution. This is efficient when identifiers are readily available. ```javascript library_import({ kind:'identifiers', identifiers:[...] }) ``` -------------------------------- ### Aggregate Papers from Entire Library Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/literature-review.md Use `zotero_script` to aggregate candidate papers from the entire Zotero library for a literature review. This follows a similar pattern to `library-analysis`. ```python zotero_script({ mode:'read', description:'Summarize candidate papers for a literature review', script:'...' }) ``` -------------------------------- ### Search Zotero Collections Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/literature-review.md Use `library_search` to find a specific collection by name, then use `library_retrieve` to search within that collection for review papers. ```python library_search({ entity:'collections', mode:'search', text:'' }) ``` -------------------------------- ### Analyze Library Statistics with Zotero Script Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/library-analysis.md This JavaScript code snippet demonstrates how to aggregate statistics for a Zotero library. It iterates through all regular items, counting them by year, type, and tag, and logs the results as JSON. This is useful for generating overviews when the user requests counts or distributions. ```javascript const items = await Zotero.Items.getAll(env.libraryID, false, false, false); const byYear = {}; const byType = {}; const byTag = {}; let total = 0; for (const item of items) { if (!item.isRegularItem()) continue; total++; const year = String(item.getField("date") || "").slice(0, 4) || "unknown"; byYear[year] = (byYear[year] || 0) + 1; byType[item.itemType] = (byType[item.itemType] || 0) + 1; for (const tag of item.getTags()) { byTag[tag.tag] = (byTag[tag.tag] || 0) + 1; } } env.log(JSON.stringify({ total, byYear, byType, byTag }, null, 2)); ``` -------------------------------- ### Read References Section from MinerU Cache Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/import-cited-reference.md Reads the references section from a paper's MinerU cache. Requires the manifest.json to find character offsets and then reads the full.md file. ```javascript file_io({ action:'read', filePath:'{mineruCacheDir}/manifest.json' }) file_io({ action:'read', filePath:'{mineruCacheDir}/full.md', offset:, length: }) ``` -------------------------------- ### Import Multiple Papers by DOIs Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/import-cited-reference.md Imports multiple papers into the Zotero library by providing a list of their DOIs in a single call. This enables batch importing. ```javascript library_import({ kind:'identifiers', identifiers:['', '', ...] }) ``` -------------------------------- ### Including Figures in Zotero Notes Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/write-note.md This snippet shows how to embed figures within Zotero notes using a file path. The `note_write` tool automatically handles the import of these file-based images. ```markdown ![Caption](file:///{mineruCacheDir}/images/filename.png) ``` -------------------------------- ### Import Single Paper by DOI Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/import-cited-reference.md Imports a single paper into the Zotero library using its DOI. This is used when only one paper needs to be added. ```javascript library_import({ kind:'identifiers', identifiers:[''] }) ``` -------------------------------- ### Read Figure Image File Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/analyze-figures.md Reads a figure image file directly from the MinerU cache using its relative path. This allows visual models to analyze the image content. ```javascript file_io({ action:'read', filePath:'{mineruCacheDir}/' }) ``` -------------------------------- ### Import with Target Collection Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/import-cited-reference.md Imports papers into a specific Zotero collection by including the targetCollectionId. This allows for organized imports. ```javascript library_import({ kind:'identifiers', identifiers:['', '', ...], targetCollectionId:'' }) ``` -------------------------------- ### Search Zotero Library for Literature Review Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/literature-review.md Use `library_retrieve` to search Zotero metadata or indexed text for papers relevant to a given topic. This is useful for broad searches when translation or terminology variants might improve recall. Use `intent:'summarize'` for collection-grounded taxonomies. ```python library_retrieve({ query:'', queryVariants:[...], intent:'enumerate', depth:'metadata'|'evidence' }) ``` ```python library_retrieve({ scope:{ collectionIds:[] }, query:'', queryVariants:[...], intent:'enumerate', depth:'metadata'|'evidence' }) ``` ```python library_retrieve({ scope:{ collectionIds:[] }, query:'', queryVariants:[...], intent:'summarize' }) ``` -------------------------------- ### Template for Paper Notes Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/write-note.md Use this template for notes related to specific academic papers. It includes fields for citation, metadata, and references. ```markdown --- title: "{{paperTitle}}" created: {{created}} citekey: {{citekey}} doi: {{doi}} journal: {{journal}} year: {{year}} tags: [zotero] --- # {{paperTitle}} ## Summary Brief overview of the paper's main contribution and what problem it addresses. ## Key Findings - The most important results, conclusions, or contributions of the paper. ## Methodology Summary of the research methodology, experimental setup, or analytical approach. ## My Notes Personal thoughts, critiques, open questions, and connections to other work. ## References {{fullCitation}} --- Written by LLM-for-Zotero. ``` -------------------------------- ### Visual Paper Read Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/analyze-figures.md Uses the paper_read tool in visual mode to find pages containing a figure or table and retrieve its image for analysis when MinerU cache is unavailable. ```javascript paper_read({ mode:'visual', query:'
' }) ``` -------------------------------- ### Visual Paper Read Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/literature-review.md Use `paper_read` with `mode:'visual'` or MinerU `file_io` to read image data from papers when figures are directly relevant to the review's findings. ```python paper_read({ mode:'visual', query:'...' }) ``` -------------------------------- ### Read References Section Without MinerU Cache Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/import-cited-reference.md If MinerU cache is not available, this method reads the references section using a targeted paper read query. ```javascript paper_read({ mode:'targeted', query:'reference number or References section' }) ``` -------------------------------- ### Check Bridge Health Source: https://github.com/yilewang/llm-for-zotero/blob/main/README.md Verify that the Zotero Claude bridge is running and accessible by checking its health endpoint. ```bash curl -fsS http://127.0.0.1:19787/healthz ``` -------------------------------- ### Resolve DOI using Title and Author Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/import-cited-reference.md If resolving by title alone fails, this method attempts to resolve the DOI by including the first author's name along with the title. ```javascript literature_search({ workflow:'answer', mode:'metadata', title:'', author:'<first author>' }) ``` -------------------------------- ### Targeted Paper Read Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/analyze-figures.md Uses the paper_read tool in targeted mode to retrieve the text of a figure/table label and its surrounding discussion when MinerU cache is unavailable. ```javascript paper_read({ mode:'targeted', query:'<figure/table label and surrounding discussion>' }) ``` -------------------------------- ### Search for Vague Description Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/import-cited-reference.md Uses a literature search to find a paper based on a vague description, including title and author information. This is useful when direct identifiers are not provided. ```javascript literature_search({ workflow:'answer', mode:'search', query:'...', author:'...' }) ``` -------------------------------- ### Targeted Paper Read Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/literature-review.md Use `paper_read` with `mode:'targeted'` to find specific information or answer focused questions within selected papers. This is useful for extracting details about methods or key findings. ```python paper_read({ mode:'targeted', query:'...', targets:[...] }) ``` -------------------------------- ### Read Section Text from MinerU Cache Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/analyze-figures.md Reads a specific section's text from the MinerU cache using character offsets. This is useful for retrieving figure captions and surrounding discussion. ```javascript file_io({ action:'read', filePath:'{mineruCacheDir}/full.md', offset:<charStart>, length:<charEnd - charStart> }) ``` -------------------------------- ### Resolve DOI using Exact Title Source: https://github.com/yilewang/llm-for-zotero/blob/main/src/agent/skills/import-cited-reference.md Resolves a paper's DOI from CrossRef/Semantic Scholar using its exact title. This is the primary method for DOI resolution. ```javascript literature_search({ workflow:'answer', mode:'metadata', title:'<exact title>' }) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.