symdex-code-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SymDex Code Search

SymDex 代码搜索

Use SymDex before broad file browsing. Use it to save tokens by retrieving the exact code the agent needs instead of scanning whole files. SymDex currently covers 16 language surfaces, including Python, Go, Kotlin, Dart, Swift, and Vue script blocks.
在进行大范围文件浏览前先使用SymDex。 通过获取Agent所需的精确代码而非扫描整个文件来节省token。 SymDex目前支持16种语言场景,包括Python、Go、Kotlin、Dart、Swift和Vue脚本块。

Start Here

入门指南

  1. If the SymDex CLI reports a newer release, prefer upgrading before long sessions.
  2. Confirm the repo id.
  3. If the repo id is already known, pass
    repo
    on every scoped tool call.
  4. If the repo id is unknown, call
    list_repos
    and match the current worktree.
  5. Check freshness with
    get_index_status(repo)
    .
  6. If the current worktree is not indexed, call
    index_folder(path=".")
    .
  7. If the workspace already has
    .symdex
    , treat it as the intended local SymDex state and reuse it.
  8. Reuse the returned
    repo
    id for the rest of the task.
If SymDex is unavailable or indexing fails, say so clearly and fall back to normal file reads only as needed.
  1. 如果SymDex CLI提示有新版本,建议在长时间会话前先升级。
  2. 确认仓库ID。
  3. 如果已知仓库ID,在每次限定范围的工具调用中传入
    repo
    参数。
  4. 如果未知仓库ID,调用
    list_repos
    并匹配当前工作树。
  5. 使用
    get_index_status(repo)
    检查索引新鲜度。
  6. 如果当前工作树未被索引,调用
    index_folder(path=".")
  7. 如果工作区已有
    .symdex
    ,将其视为目标本地SymDex状态并复用。
  8. 在后续任务中复用返回的
    repo
    ID。
如果SymDex不可用或索引失败,请明确说明,仅在必要时回退到常规文件读取方式。

Core Rules

核心规则

  • Search first.
  • Pass
    repo
    whenever you know it.
  • Prefer
    get_symbol
    or
    get_file_outline
    over full-file reads.
  • Use call graph and route tools before manual tracing.
  • Re-check
    get_index_status
    after major edits or worktree switches.
  • Read full files only when editing, reviewing unsupported or generated content, or when SymDex cannot answer.
  • Optimize for lower-token retrieval, not broad context loading.
  • If a search tool returns
    roi
    or
    roi_summary
    , mention the approximate token savings briefly in your response.
  • If the repo uses workspace-local SymDex state (
    ./.symdex
    ), stay inside that workspace so the same index is auto-discovered.
  • 优先搜索。
  • 只要知道仓库ID,就传入
    repo
    参数。
  • 优先使用
    get_symbol
    get_file_outline
    而非读取整个文件。
  • 在手动追踪前先使用调用图和路由工具。
  • 进行重大编辑或切换工作树后,重新检查
    get_index_status
  • 仅在编辑、查看不支持或生成的内容,或SymDex无法回答时,才读取完整文件。
  • 以减少token获取量为优化目标,而非加载大范围上下文。
  • 如果搜索工具返回
    roi
    roi_summary
    ,请在回复中简要提及大致的token节省量。
  • 如果仓库使用工作区本地SymDex状态(
    ./.symdex
    ),请保持在该工作区内,以便自动发现同一索引。

Tool Selection

工具选择

NeedTool
Index the current worktree
index_folder
Register and index a repo explicitly
index_repo
Find a function, class, or method by name
search_symbols
Find code by intent or behavior
semantic_search
Find literal text or regex matches
search_text
Read exact source for one symbol
get_symbol
Get a file outline before reading
get_file_outline
Get a repo map or summary
get_repo_outline
or
get_file_tree
Trace who calls a symbol
get_callers
Trace what a symbol calls
get_callees
Find HTTP routes
search_routes
Check repo freshness
get_index_status
Get code metrics and language mix
get_repo_stats
List indexes
list_repos
Clean deleted-worktree indexes
gc_stale_indexes
需求工具
索引当前工作树
index_folder
显式注册并索引仓库
index_repo
按名称查找函数、类或方法
search_symbols
按意图或行为查找代码
semantic_search
查找文本字面量或正则匹配
search_text
读取单个符号的精确源代码
get_symbol
在读取前获取文件大纲
get_file_outline
获取仓库地图或摘要
get_repo_outline
get_file_tree
追踪谁调用了某个符号
get_callers
追踪某个符号调用了哪些内容
get_callees
查找HTTP路由
search_routes
检查仓库索引新鲜度
get_index_status
获取代码指标和语言占比
get_repo_stats
列出索引
list_repos
清理已删除工作树的索引
gc_stale_indexes

Typical Flow

典型流程

  1. Confirm the repo id and freshness.
  2. Index with
    index_folder
    if needed.
  3. Start with
    search_symbols
    ,
    semantic_search
    , or
    search_text
    .
  4. Narrow to
    get_symbol
    or
    get_file_outline
    .
  5. Use
    get_callers
    ,
    get_callees
    ,
    search_routes
    , or
    get_repo_stats
    for deeper analysis.
  6. Fall back to direct file reads only when SymDex cannot answer precisely enough.
  1. 确认仓库ID和索引新鲜度。
  2. 必要时使用
    index_folder
    进行索引。
  3. search_symbols
    semantic_search
    search_text
    开始。
  4. 缩小范围至
    get_symbol
    get_file_outline
  5. 使用
    get_callers
    get_callees
    search_routes
    get_repo_stats
    进行深度分析。
  6. 仅当SymDex无法给出足够精确的答案时,才回退到直接读取文件。

Decision Guide

决策指南

  • "Where is X defined?" ->
    search_symbols
  • "What does this do?" ->
    semantic_search
    , then
    get_symbol
  • "Who uses this?" ->
    get_callers
  • "What does this call?" ->
    get_callees
  • "Where is the endpoint?" ->
    search_routes
  • "Show me the file structure first" ->
    get_file_outline
  • "Give me a repo-level picture" ->
    get_repo_outline
    or
    get_repo_stats
  • "Is the index current?" ->
    get_index_status
  • “X的定义在哪里?” ->
    search_symbols
  • “这个功能是什么?” ->
    semantic_search
    ,然后
    get_symbol
  • “谁在使用这个?” ->
    get_callers
  • “这个调用了什么?” ->
    get_callees
  • “端点在哪里?” ->
    search_routes
  • “先给我展示文件结构” ->
    get_file_outline
  • “给我一个仓库级别的概览” ->
    get_repo_outline
    get_repo_stats
  • “索引是最新的吗?” ->
    get_index_status

Good Trigger Phrases

触发示例

  • "Find the function that validates JWTs"
  • "Who calls this route handler?"
  • "Show me the outline of this file"
  • "Search for the code that parses webhook payloads"
  • "Find the HTTP route for
    /api/checkout
    "
  • "Give me the repo summary before I edit anything"
  • “找到验证JWT的函数”
  • “谁调用了这个路由处理器?”
  • “给我展示这个文件的大纲”
  • “搜索解析Webhook负载的代码”
  • “找到
    /api/checkout
    对应的HTTP路由”
  • “在我编辑前给我仓库摘要”

Editing

编辑操作

When you need to edit code:
  1. Use SymDex to find the exact symbol or file location.
  2. Read only that file or symbol slice.
  3. Make the smallest change needed.
当你需要编辑代码时:
  1. 使用SymDex找到精确的符号或文件位置。
  2. 仅读取该文件或符号片段。
  3. 做出最小必要修改。

Use Normal Browsing Only When Needed

仅在必要时使用常规浏览

  • SymDex is unavailable.
  • The repo is not indexed and cannot be indexed in the current environment.
  • The target file type is unsupported or generated.
  • You need surrounding context that the symbol-level response does not provide.
  • SymDex不可用。
  • 仓库未被索引且无法在当前环境中索引。
  • 目标文件类型不被支持或为生成文件。
  • 你需要符号级响应未提供的上下文信息。

Output Checklist

输出检查清单

  • Repo id confirmed or derived
  • Index freshness checked
  • SymDex tool chosen before broad file reads
  • Exact symbol or file outline used before whole-file reads when possible
  • Direct file reads used only when SymDex could not answer cleanly
  • 已确认或推导仓库ID
  • 已检查索引新鲜度
  • 在大范围文件读取前已选择SymDex工具
  • 尽可能在读取整个文件前使用精确符号或文件大纲
  • 仅在SymDex无法清晰回答时才使用直接文件读取