ctx-index

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Context Mode Index

Context Mode索引

Index local project content for later search.
为后续搜索索引本地项目内容。

Instructions

说明

  1. Prefer the
    ctx_index
    MCP tool when it is available.
  2. Ask for a path only if the user did not provide one and the current project root is ambiguous.
  3. Use
    path
    , not large inline
    content
    , so file bytes do not enter the conversation.
  4. For repository indexing, pass conservative bounds and a clear source label:
javascript
ctx_index({
  path: ".",
  source: "project:<name>",
  maxDepth: 5,
  maxFiles: 200
})
  1. If MCP tools are unavailable, fall back to the CLI:
bash
context-mode index . --source project:<name>
  1. Report the indexed source label, file count or section count, and the matching search command:
javascript
ctx_search({ source: "project:<name>", queries: ["..."] })
  1. ctx_index
    MCP工具可用,优先使用该工具。
  2. 仅当用户未提供路径且当前项目根目录不明确时,才询问路径。
  3. 使用
    path
    参数,而非大段内联
    content
    ,避免文件字节进入对话流程。
  4. 对于仓库索引,传入保守的限制范围和清晰的源标签:
javascript
ctx_index({
  path: ".",
  source: "project:<name>",
  maxDepth: 5,
  maxFiles: 200
})
  1. 若MCP工具不可用,退而使用CLI:
bash
context-mode index . --source project:<name>
  1. 报告已索引的源标签、文件数或章节数,以及对应的搜索命令:
javascript
ctx_search({ source: "project:<name>", queries: ["..."] })

Safety

安全注意事项

  • Do not index dependency directories, build outputs, secrets, or generated artifacts.
  • Prefer
    --exclude
    or
    exclude
    for project-specific noisy paths.
  • For broad repos, ask the user before raising
    maxFiles
    above 500.
  • 请勿索引依赖目录、构建输出、机密文件或生成的工件。
  • 优先使用
    --exclude
    exclude
    参数排除项目特定的干扰路径。
  • 对于大型仓库,在将
    maxFiles
    提升至500以上前需询问用户。