Ctx Index

mksglu/context-mode/skills/ctx-index

作者 mksglua6c43765d26b无许可证25K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

Index a local file or directory into context-mode's persistent FTS5 knowledge base so future ctx_search calls can retrieve focused snippets without rereading raw files. Trigger: /context-mode:ctx-index

仅含说明AI & Agents
AI 生成的概览

将本地文件或目录索引到持久化 FTS5 知识库,以便后续搜索返回聚焦的片段。

功能
该技能将本地项目内容索引到 context-mode 的持久化 FTS5 知识库,使后续 ctx_search 调用无需重新读取原始文件即可检索聚焦的片段。它优先使用 ctx_index MCP 工具,不可用时回退到 context-mode CLI 命令,并报告已索引的来源标签、文件数或片段数以及对应的搜索命令。它建议传入路径而非大量内联内容,并在索引仓库时使用保守的边界与排除项。
适用场景
当你希望让本地文件或项目目录可供后续检索,而不是重新读取原始文件时使用。它适用于需要设置来源标签、深度和文件数量上限的仓库索引,以及需要排除噪声路径、依赖目录、构建产物或密钥的场景。
运行要求
需要 ctx_index MCP 工具,或作为回退的 context-mode CLI。它不附带脚本,仅为指令。

Context Mode Index

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: ["..."] })

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.

来源与署名

来源:mksglu/context-mode位于skills/ctx-index提交a6c4376

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架