ctx-index
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContext Mode Index
Context Mode索引
Index local project content for later search.
为后续搜索索引本地项目内容。
Instructions
说明
- Prefer the MCP tool when it is available.
ctx_index - Ask for a path only if the user did not provide one and the current project root is ambiguous.
- Use , not large inline
path, so file bytes do not enter the conversation.content - For repository indexing, pass conservative bounds and a clear source label:
javascript
ctx_index({
path: ".",
source: "project:<name>",
maxDepth: 5,
maxFiles: 200
})- If MCP tools are unavailable, fall back to the CLI:
bash
context-mode index . --source project:<name>- Report the indexed source label, file count or section count, and the matching search command:
javascript
ctx_search({ source: "project:<name>", queries: ["..."] })- 若MCP工具可用,优先使用该工具。
ctx_index - 仅当用户未提供路径且当前项目根目录不明确时,才询问路径。
- 使用参数,而非大段内联
path,避免文件字节进入对话流程。content - 对于仓库索引,传入保守的限制范围和清晰的源标签:
javascript
ctx_index({
path: ".",
source: "project:<name>",
maxDepth: 5,
maxFiles: 200
})- 若MCP工具不可用,退而使用CLI:
bash
context-mode index . --source project:<name>- 报告已索引的源标签、文件数或章节数,以及对应的搜索命令:
javascript
ctx_search({ source: "project:<name>", queries: ["..."] })Safety
安全注意事项
- Do not index dependency directories, build outputs, secrets, or generated artifacts.
- Prefer or
--excludefor project-specific noisy paths.exclude - For broad repos, ask the user before raising above 500.
maxFiles
- 请勿索引依赖目录、构建输出、机密文件或生成的工件。
- 优先使用或
--exclude参数排除项目特定的干扰路径。exclude - 对于大型仓库,在将提升至500以上前需询问用户。
maxFiles