Search arXiv for academic papers and save results. Use when the user says "search papers", "find papers", "arxiv search", "搜索论文", "找论文", or wants to discover papers on a topic within a research domain.
Domain: $ARGUMENTS (first token)
Query: $ARGUMENTS (remaining text in quotes)
workspace/. Override with AUTO_RESEARCH_WORKSPACE.--max N.--download flag is present.Override examples:
/search-papers machine_learning "attention mechanism" --max 20/search-papers nlp "BERT" --download/search-papers machine_learning "survey" --max 5
Parse $ARGUMENTS:
machine_learning)--max N: set MAX_RESULTS to N--download: set DOWNLOAD_PDF to trueResolve papers directory:
WORKSPACE="${AUTO_RESEARCH_WORKSPACE:-workspace}"
PAPERS_DIR="$WORKSPACE/DOMAIN/papers"
If $PAPERS_DIR does not exist, stop and print:
❌ Papers directory not found:
PAPERS_DIR
Run/init-domain DOMAINfirst.
Run an inline Python search (no external dependencies required):
python3 - <<'PYEOF'
import json, sys, urllib.parse, urllib.request, xml.etree.ElementTree as ET
QUERY = "SEARCH_QUERY"
MAX = MAX_RESULTS
NS = "http://www.w3.org/2005/Atom"
q = urllib.parse.quote(QUERY)
url = (f"https://export.arxiv.org/api/query"
f"?search_query=all:{q}&start=0&max_results={MAX}"
f"&sortBy=relevance&sortOrder=descending")