mcpField
E
exa-search

exa-search

github.com/wanshuiyin生产力18.3k455 次安装1 天前更新
代码仓库

关于 exa-search

exa-search 是一项面向广泛网络检索的技能,可同时提取页面要点、全文或摘要。它适合需要搜索学术数据库之外内容的研究者等用户,并支持按类别、域名和日期筛选。

主要功能

  1. 01广泛网络搜索
  2. 02提取要点、全文或摘要
  3. 03按类别、域名和日期筛选
  4. 04查找与指定 URL 相似的页面
  5. 05获取已知 URL 的内容

适用场景

  1. 01搜索新闻、文档和公司网站
  2. 02查找学术数据库之外的研究论文
  3. 03获取选定网页的全文

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/wanshuiyin/auto-claude-code-research-in-sleep --skill exa-search

安装后在 Claude Code 中输入/exa-search确认已加载。

详细介绍

Exa AI 驱动的网页搜索

搜索查询:$ARGUMENTS

角色与定位

Exa 是带有内置内容提取功能的广泛网页搜索来源:

技能最适用场景
/arxiv直接搜索预印本并下载 PDF
/semantic-scholar已发表的会议论文(IEEE、ACM、Springer)、引用次数
/deepxiv分层阅读:搜索、简介、章节地图、章节阅读
/exa-search广泛的网页搜索:博客、文档、新闻、公司、研究论文——并提取内容

当你需要搜索学术数据库之外的结果,或希望在搜索结果中一并提取内容(重点摘要、全文、摘要)时,请使用 Exa。

常量

  • EXA_FETCHER — 标准名称为 exa_search.py,解析方式遵循 shared-references/integration-contract.md §2 (Policy D1 — 独立的 /exa-search 没有已记录的回退方案, 因此若辅助脚本无法解析,则以明确错误终止)。
  • MAX_RESULTS = 10 — 默认返回结果数。

覆盖选项(追加到参数中):

  • /exa-search "RAG pipelines" — max: 5 — 返回前 5 个结果
  • /exa-search "diffusion models" — category: research paper — 仅限研究论文
  • /exa-search "startup funding" — category: news, start date: 2025-01-01 — 最新新闻
  • /exa-search "transformer" — content: text, max chars: 8000 — 全文模式
  • /exa-search "transformer" — content: summary — LLM 生成的摘要
  • /exa-search "transformer" — domains: arxiv.org,huggingface.co — 域名筛选
  • /exa-search "https://arxiv.org/abs/2301.07041" — similar — 查找相似页面

设置

Exa 需要 exa-py SDK 和 API 密钥:

pip install exa-py

设置你的 API 密钥:

export EXA_API_KEY=your-key-here

在 exa.ai 获取密钥。

工作流

步骤 1:解析参数

解析 $ARGUMENTS,提取:

  • query:搜索查询(必填)或 URL(用于 find-similar 模式)
  • similar:如果存在,则使用 find-similar 模式,而不是搜索
  • max:覆盖 MAX_RESULTS
  • category:research paper、news、company、personal site、financial report、people
  • content:highlights(默认)、text、summary、none
  • max chars:内容提取的最大字符数
  • type:搜索类型——auto(默认)、neural、fast、instant
  • domains:以逗号分隔的包含域名列表
  • exclude domains:以逗号分隔的排除域名列表
  • include text:必须出现在结果中的短语
  • exclude text:要从结果中排除的短语
  • start date:ISO 8601 日期——仅返回此日期之后的结果
  • end date:ISO 8601 日期——仅返回此日期之前的结果
  • location:两位字母的 ISO 国家代码
步骤 2:定位脚本

通过标准的严格安全链解析 $EXA_FETCHER(参见 shared-references/integration-contract.md §2)。 Policy D1 级联:Exa 没有原生内联回退方案 (检索需要 exa-py SDK 和 API 密钥,这些由 fetcher 提供), 因此,如果无法解析辅助脚本,SKILL 就无法生成其 主要输出——应明确说明解决方法后失败。

cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" || exit 1
if [ -z "${ARIS_REPO:-}" ] && [ -f .aris/installed-skills.txt ]; then
    ARIS_REPO=$(awk -F'\t' '$1=="repo_root"{print $2; exit}' .aris/installed-skills.txt 2>/dev/null) || true
fi
if [ -z "${ARIS_REPO:-}" ] && [ -f "$HOME/.aris/repo" ]; then
    ARIS_REPO=$(cat "$HOME/.aris/repo" 2>/dev/null) || true
fi
EXA_FETCHER=".aris/tools/exa_search.py"
[ -f "$EXA_FETCHER" ] || EXA_FETCHER="tools/exa_search.py"
[ -f "$EXA_FETCHER" ] || { [ -n "${ARIS_REPO:-}" ] && EXA_FETCHER="$ARIS_REPO/tools/exa_search.py"; }
[ -f "$EXA_FETCHER" ] || {
  echo "ERROR: exa_search.py not resolved at .aris/tools/, tools/, \$ARIS_REPO/tools/, or via ~/.aris/repo." >&2
  echo "       Fix: rerun bash tools/install_aris.sh or smart_update.sh (refreshes ~/.aris/repo), export ARIS_REPO, or copy the helper to tools/." >&2
  echo "       Also ensure 'exa-py' is installed: pip install exa-py" >&2
  exit 1
}
步骤 3:执行搜索

标准搜索:

python3 "$EXA_FETCHER" search "QUERY" --max 10 --content highlights

带筛选条件:

python3 "$EXA_FETCHER" search "QUERY" --max 10 \
  --category "research paper" \
  --start-date 2025-01-01 \
  --content text --max-chars 8000

查找相似页面:

python3 "$EXA_FETCHER" find-similar "URL" --max 5 --content highlights

获取已知 URL 的内容:

python3 "$EXA_FETCHER" get-contents "URL1" "URL2" --content text
步骤 4:呈现结果

将结果格式化为结构化表格:

| # | Title | Authors | Venue/Publisher | URL | Date | Key Content |
|---|-------|---------|-----------------|-----|------|-------------|

对于每条结果:

  • 显示标题和 URL
  • 如有,显示发布日期
  • 根据内容模式显示重点摘要、文本摘录或摘要
  • 标记特别相关的结果
  • 仅针对 category: "research paper" 命中结果——还要记录作者 (从 Exa 的 author/authors 字段获取,或回退方案:从 结果摘要中解析)以及会议/出版方(从 publisher、source 或 托管论文的域名获取)。步骤 6 的 wiki 钩子需要这些信息; 如果某条命中结果缺少其中任一信息,则跳过该结果的 wiki 导入, 并记录备注。
第 5 步:提供后续选项

呈现结果后,建议用户:

  • 深入了解:“我可以获取这些结果中任意一项的全文”
  • 查找相似内容:“我可以查找与任意结果相似的页面”
  • 缩小范围:“我可以使用域名/日期/文本筛选条件重新搜索”
第 6 步:更新研究 Wiki(如果已启用,且仅限研究论文结果)

当 research-wiki/ 存在且搜索返回了 category: "research paper" 的结果时,必须执行此步骤;否则静默跳过。 普通网页结果(博客文章、文档、新闻)不会被导入—— 该 Wiki 仅用于论文。

满足上述条件时,按照规范链解析 $WIKI_SCRIPT: shared-references/wiki-helper-resolution.md (变体 B——警告并跳过)。对于每篇研究论文结果,尝试从 URL 中提取 arXiv ID(arxiv.org/abs/<id>);若存在, 使用 --arxiv-id。否则回退到手动填写元数据:

if [ -d research-wiki/ ] and query category was "research paper":
    cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" || exit 1
    ARIS_REPO="${ARIS_REPO:-$(awk -F'\t' '$1=="repo_root"{print $2; exit}' .aris/installed-skills.txt 2>/dev/null)}"
    if [ -z "${ARIS_REPO:-}" ] && [ -f "$HOME/.aris/repo" ]; then
      ARIS_REPO=$(cat "$HOME/.aris/repo" 2>/dev/null) || true
    fi
    WIKI_SCRIPT=".aris/tools/research_wiki.py"
    [ -f "$WIKI_SCRIPT" ] || WIKI_SCRIPT="tools/research_wiki.py"
    [ -f "$WIKI_SCRIPT" ] || { [ -n "${ARIS_REPO:-}" ] && WIKI_SCRIPT="$ARIS_REPO/tools/research_wiki.py"; }
    [ -f "$WIKI_SCRIPT" ] || {
      echo "WARN: research_wiki.py not found; exa-search results delivered, wiki ingest skipped. Fix: bash tools/install_aris.sh or smart_update.sh (refreshes ~/.aris/repo), export ARIS_REPO, or cp <ARIS-repo>/tools/research_wiki.py tools/." >&2
      WIKI_SCRIPT=""
    }
    [ -n "$WIKI_SCRIPT" ] && for each research-paper hit in results:
        if URL matches arxiv.org/abs/<id>:
            python3 "$WIKI_SCRIPT" ingest_paper research-wiki/ \
                --arxiv-id "<id>"
        else:
            python3 "$WIKI_SCRIPT" ingest_paper research-wiki/ \
                --title "<title>" --authors "<authors joined by , >" \
                --year <year> --venue "<venue or publisher>"

辅助脚本会处理 slug/去重/页面/索引/日志——不要 手动编写 papers/<slug>.md。请参阅 shared-references/integration-contract.md。

关键规则

  • 搜索前始终检查是否已设置 EXA_API_KEY
  • 默认使用 highlights 内容模式,在速度和上下文之间取得良好平衡
  • 当用户明确查找学术内容时,使用 category: "research paper"
  • 当用户需要完整页面内容时,使用 text 内容模式
  • 结合 /arxiv 或 /semantic-scholar,全面覆盖文献

评论

支持 Markdown