CLI Tools2026年5月14日·1 分钟阅读

ast-index — Fast Code Search for Agents

ast-index builds an AST index for fast code search and integrates with Claude/Codex/Cursor; verified 347★ and installs via Homebrew.

介绍

ast-index 通过 AST 索引实现高速代码搜索,可接入 Claude/Codex/Cursor 与 MCP;已验证 347★,README 标注 46+ 命令,支持 Homebrew 快速安装(产物约 44MB)。

Best for: 大型仓库:grep 太慢/太吵,需要 agent 精准查符号、调用方与引用位置

Works with: macOS Homebrew(快速安装)+ 可调用 CLI/MCP 的各类 agent

Setup time: 8-18 minutes

Key facts (verified)

  • GitHub:347 stars · 29 forks;最近更新 2026-05-13。
  • 许可证:MIT;作者头像与仓库链接均已通过 GitHub API 复核。
  • README 中可对照的入口命令:ast-index rebuild

Main

  • 先建索引再持续使用:第一次用 rebuild,日常改动优先用增量 update

  • 给 agent 写硬规则:读 500+ 行文件前先跑 outlinesymbol/usages,减少 token 消耗。

  • 单仓多项目建议开启 walk-up,让子目录复用根索引,避免每个子项目重复建库。

Source-backed notes

  • README 提供 Homebrew 安装(brew tap defendend/ast-indexbrew install ast-index),并列出 46+ 命令。
  • README 描述与 Claude/Codex/Cursor 的集成方式(含 ast-index install-codex-mcp)。
  • README 提到构建产物体积提示(CLI 二进制约 ~44MB)。

FAQ

  • 每次改代码都要重建索引吗?:不需要。日常用增量 update,只有索引不同步时再 rebuild
  • 这是某一种语言专用吗?:它支持多种符号查询;具体语言支持以 README 为准。
  • agent 能通过 MCP 用它吗?:可以。README 描述了 MCP server wrapper,可向 MCP 客户端暴露工具。
🙏

来源与感谢

Source: https://github.com/defendend/Claude-ast-index-search > License: MIT > GitHub stars: 347 · forks: 29

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产