papi

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Paper Reference Assistant (CLI)

论文参考助手(CLI)

Entry point skill. Use
papi
CLI first; MCP RAG tools only when CLI is insufficient.
For specialized workflows, invoke dedicated skills:
  • /papi-ask
    — RAG queries requiring synthesis
  • /papi-verify
    — verify code against paper
  • /papi-compare
    — compare papers for decision
  • /papi-ground
    — ground responses with citations
  • /papi-curate
    — create project notes
入口Skill。优先使用
papi
CLI;仅当CLI功能不足时才使用MCP RAG工具。
针对特定工作流,调用专用Skill:
  • /papi-ask
    —— 需要综合分析的RAG查询
  • /papi-verify
    —— 验证代码与论文的一致性
  • /papi-compare
    —— 对比论文以辅助决策
  • /papi-ground
    —— 基于引用生成可靠回复
  • /papi-curate
    —— 创建项目笔记

Setup

设置

bash
papi path   # DB location (default ~/.paperpipe/; override via PAPER_DB_PATH)
papi list   # available papers
papi list | grep -i "keyword"  # check if paper exists before searching
bash
papi path   # 数据库位置(默认~/.paperpipe/;可通过PAPER_DB_PATH环境变量覆盖)
papi list   # 查看可用论文
papi list | grep -i "keyword"  # 搜索前先检查论文是否存在

When NOT to Use MCP RAG

何时不使用MCP RAG

  • Paper name known →
    papi show <paper> -l summary
  • Exact term search →
    papi search --rg "term"
  • Checking equations →
    papi show <paper> -l eq
  • Only use RAG when above methods fail or semantic matching required
  • 已知论文名称 →
    papi show <paper> -l summary
  • 精确术语搜索 →
    papi search --rg "term"
  • 查看公式 →
    papi show <paper> -l eq
  • 仅当上述方法失效或需要语义匹配时才使用RAG

Decision Tree

决策树

QuestionTool
"What does paper X say about Y?"
papi show X -l summary
, then
papi search --rg "Y"
"Does my code match the paper?"
/papi-verify
skill
"Which paper mentions X?"
papi search --rg "X"
first, then
leann_search()
if no hits
"Compare approaches across papers"
/papi-compare
skill or
papi ask
"Need citable quote with page number"
retrieve_chunks()
(PQA MCP)
"Cross-paper synthesis"
papi ask "..."
问题工具
“论文X关于Y说了什么?”
papi show X -l summary
,之后使用
papi search --rg "Y"
“我的代码是否与论文匹配?”
/papi-verify
Skill
“哪篇论文提到了X?”先使用
papi search --rg "X"
,若无结果再使用
leann_search()
“对比多篇论文的方法”
/papi-compare
Skill或
papi ask
“需要带页码的可引用引文”
retrieve_chunks()
(PQA MCP)
“跨论文综合分析”
papi ask "..."

Search Commands

搜索命令

bash
papi search --rg "query"              # literal text match (fast, no LLM) — NOT regex by default!
papi search --rg --regex "pattern"    # regex patterns (add --regex explicitly)
papi search "query"                   # ranked BM25
papi search --hybrid "query"          # ranked + exact boost
papi search "query" -p paper1,paper2  # limit search to specific papers
papi ask "question"                   # PaperQA2 RAG
papi ask "question" --backend leann   # LEANN RAG
papi notes {name}                     # open/print implementation notes
bash
papi search --rg "query"              # 字面文本匹配(快速,无需LLM)—— 默认不是正则表达式!
papi search --rg --regex "pattern"    # 正则表达式匹配(需显式添加--regex参数)
papi search "query"                   # BM25排序搜索
papi search --hybrid "query"          # 排序+精确匹配增强
papi search "query" -p paper1,paper2  # 限制搜索特定论文
papi ask "question"                   # PaperQA2 RAG
papi ask "question" --backend leann   # LEANN RAG
papi notes {name}                     # 打开/打印实现笔记

Search Escalation (cheapest first)

搜索升级策略(成本从低到高)

  1. papi search --rg "X"
    — exact text, fast, no LLM
  2. papi search "X"
    — ranked BM25 (requires
    papi index --backend search
    first)
  3. papi search --hybrid "X"
    — ranked + exact boost
  4. leann_search()
    — semantic search, returns file paths for follow-up
  5. retrieve_chunks()
    — formal citations (DOI, page numbers)
  6. papi ask "..."
    — full RAG synthesis
  1. papi search --rg "X"
    —— 精确文本匹配,快速,无需LLM
  2. papi search "X"
    —— BM25排序搜索(需先执行
    papi index --backend search
  3. papi search --hybrid "X"
    —— 排序+精确匹配增强
  4. leann_search()
    —— 语义搜索,返回文件路径以便后续操作
  5. retrieve_chunks()
    —— 规范引文(DOI、页码)
  6. papi ask "..."
    —— 完整RAG综合分析

MCP Tool Selection (when papi CLI insufficient)

MCP工具选择(当papi CLI功能不足时)

ToolSpeedOutputBest For
leann_search(index_name, query, top_k)
FastSnippets + file pathsExploration, finding which paper to dig into
retrieve_chunks(query, index_name, k)
SlowerChunks + formal citationsVerification, citing specific claims
papi ask "..."
SlowestSynthesized answerCross-paper questions, "what does literature say"
  • Check available indexes:
    leann_list()
    or
    list_pqa_indexes()
  • Embedding priority: Voyage AI → Google/Gemini → OpenAI → Ollama
工具速度输出最佳适用场景
leann_search(index_name, query, top_k)
片段+文件路径探索研究,确定需深入研究的论文
retrieve_chunks(query, index_name, k)
较慢文本块+规范引文验证内容,引用特定论点
papi ask "..."
最慢综合分析结果跨论文问题,“文献对此有何论述”
  • 查看可用索引:
    leann_list()
    list_pqa_indexes()
  • 嵌入模型优先级:Voyage AI → Google/Gemini → OpenAI → Ollama

Adding Papers

添加论文

bash
papi add 2303.13476                   # arXiv ID
papi add https://arxiv.org/abs/...    # URL
papi add 2303.13476 1706.03762 "Attention Is All You Need"  # multiple at once (mixed sources OK)
papi add --pdf /path/to.pdf           # local PDF
papi add --pdf "https://..."          # PDF from URL
papi add --from-file papers.bib       # bulk import
bash
papi add 2303.13476                   # arXiv ID
papi add https://arxiv.org/abs/...    # URL
papi add 2303.13476 1706.03762 "Attention Is All You Need"  # 批量添加(支持混合来源)
papi add --pdf /path/to.pdf           # 本地PDF文件
papi add --pdf "https://..."          # 在线PDF文件
papi add --from-file papers.bib       # 从文件批量导入

Per-Paper Files

单论文文件

Located at
{db}/papers/{name}/
:
equations.md
,
summary.md
,
source.tex
,
notes.md
,
paper.pdf
,
figures/
.
If agent can't read
~/.paperpipe/
, export to repo:
papi export <papers...> --level equations --to ./paper-context/
Use
--figures
to include extracted figures in export.
See
references/commands.md
for full command reference and per-file details.
存储位置为
{db}/papers/{name}/
:包含
equations.md
summary.md
source.tex
notes.md
paper.pdf
figures/
若Agent无法读取
~/.paperpipe/
,可导出至仓库:
papi export <papers...> --level equations --to ./paper-context/
使用
--figures
参数可在导出时包含提取的图表。
完整命令参考及文件详情请查看
references/commands.md