symdex-code-search
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSymDex 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
入门指南
- If the SymDex CLI reports a newer release, prefer upgrading before long sessions.
- Confirm the repo id.
- If the repo id is already known, pass on every scoped tool call.
repo - If the repo id is unknown, call and match the current worktree.
list_repos - Check freshness with .
get_index_status(repo) - If the current worktree is not indexed, call .
index_folder(path=".") - If the workspace already has , treat it as the intended local SymDex state and reuse it.
.symdex - Reuse the returned id for the rest of the task.
repo
If SymDex is unavailable or indexing fails, say so clearly and fall back to normal file reads only as needed.
- 如果SymDex CLI提示有新版本,建议在长时间会话前先升级。
- 确认仓库ID。
- 如果已知仓库ID,在每次限定范围的工具调用中传入参数。
repo - 如果未知仓库ID,调用并匹配当前工作树。
list_repos - 使用检查索引新鲜度。
get_index_status(repo) - 如果当前工作树未被索引,调用。
index_folder(path=".") - 如果工作区已有,将其视为目标本地SymDex状态并复用。
.symdex - 在后续任务中复用返回的ID。
repo
如果SymDex不可用或索引失败,请明确说明,仅在必要时回退到常规文件读取方式。
Core Rules
核心规则
- Search first.
- Pass whenever you know it.
repo - Prefer or
get_symbolover full-file reads.get_file_outline - Use call graph and route tools before manual tracing.
- Re-check after major edits or worktree switches.
get_index_status - 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 or
roi, mention the approximate token savings briefly in your response.roi_summary - If the repo uses workspace-local SymDex state (), stay inside that workspace so the same index is auto-discovered.
./.symdex
- 优先搜索。
- 只要知道仓库ID,就传入参数。
repo - 优先使用或
get_symbol而非读取整个文件。get_file_outline - 在手动追踪前先使用调用图和路由工具。
- 进行重大编辑或切换工作树后,重新检查。
get_index_status - 仅在编辑、查看不支持或生成的内容,或SymDex无法回答时,才读取完整文件。
- 以减少token获取量为优化目标,而非加载大范围上下文。
- 如果搜索工具返回或
roi,请在回复中简要提及大致的token节省量。roi_summary - 如果仓库使用工作区本地SymDex状态(),请保持在该工作区内,以便自动发现同一索引。
./.symdex
Tool Selection
工具选择
| Need | Tool |
|---|---|
| Index the current worktree | |
| Register and index a repo explicitly | |
| Find a function, class, or method by name | |
| Find code by intent or behavior | |
| Find literal text or regex matches | |
| Read exact source for one symbol | |
| Get a file outline before reading | |
| Get a repo map or summary | |
| Trace who calls a symbol | |
| Trace what a symbol calls | |
| Find HTTP routes | |
| Check repo freshness | |
| Get code metrics and language mix | |
| List indexes | |
| Clean deleted-worktree indexes | |
| 需求 | 工具 |
|---|---|
| 索引当前工作树 | |
| 显式注册并索引仓库 | |
| 按名称查找函数、类或方法 | |
| 按意图或行为查找代码 | |
| 查找文本字面量或正则匹配 | |
| 读取单个符号的精确源代码 | |
| 在读取前获取文件大纲 | |
| 获取仓库地图或摘要 | |
| 追踪谁调用了某个符号 | |
| 追踪某个符号调用了哪些内容 | |
| 查找HTTP路由 | |
| 检查仓库索引新鲜度 | |
| 获取代码指标和语言占比 | |
| 列出索引 | |
| 清理已删除工作树的索引 | |
Typical Flow
典型流程
- Confirm the repo id and freshness.
- Index with if needed.
index_folder - Start with ,
search_symbols, orsemantic_search.search_text - Narrow to or
get_symbol.get_file_outline - Use ,
get_callers,get_callees, orsearch_routesfor deeper analysis.get_repo_stats - Fall back to direct file reads only when SymDex cannot answer precisely enough.
- 确认仓库ID和索引新鲜度。
- 必要时使用进行索引。
index_folder - 从、
search_symbols或semantic_search开始。search_text - 缩小范围至或
get_symbol。get_file_outline - 使用、
get_callers、get_callees或search_routes进行深度分析。get_repo_stats - 仅当SymDex无法给出足够精确的答案时,才回退到直接读取文件。
Decision Guide
决策指南
- "Where is X defined?" ->
search_symbols - "What does this do?" -> , then
semantic_searchget_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" -> or
get_repo_outlineget_repo_stats - "Is the index current?" ->
get_index_status
- “X的定义在哪里?” ->
search_symbols - “这个功能是什么?” -> ,然后
semantic_searchget_symbol - “谁在使用这个?” ->
get_callers - “这个调用了什么?” ->
get_callees - “端点在哪里?” ->
search_routes - “先给我展示文件结构” ->
get_file_outline - “给我一个仓库级别的概览” -> 或
get_repo_outlineget_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负载的代码”
- “找到对应的HTTP路由”
/api/checkout - “在我编辑前给我仓库摘要”
Editing
编辑操作
When you need to edit code:
- Use SymDex to find the exact symbol or file location.
- Read only that file or symbol slice.
- Make the smallest change needed.
当你需要编辑代码时:
- 使用SymDex找到精确的符号或文件位置。
- 仅读取该文件或符号片段。
- 做出最小必要修改。
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无法清晰回答时才使用直接文件读取