ctx-index

Index local files and directories into a persistent FTS5 knowledge base for later search.

20.3k|1.5k|Updated Feb 23, 2026
One-click install
npx skills add https://github.com/mksglu/context-mode --skill ctx-index
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ctx-index
Source: https://github.com/mksglu/context-mode/tree/main/skills/ctx-index
Command: npx skills add https://github.com/mksglu/context-mode --skill ctx-index

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Repeatedly rereading raw project files wastes context window space and slows down retrieval. This Skill indexes local files or directories into context-mode's persistent FTS5 knowledge base so future searches return focused snippets without loading entire files into the conversation.

Core Features & Use Cases

  • Path-Based Indexing: Indexes content by passing a file path rather than inline content, keeping file bytes out of the conversation context.
  • Bounded Repository Indexing: Supports conservative limits like maxDepth and maxFiles, plus source labels, for controlled indexing of large repositories.
  • MCP and CLI Fallback: Prefers the ctx_index MCP tool when available and falls back to the context-mode CLI otherwise.
  • Use Case: A developer starting work on a large codebase indexes the project root with a source label like project:myapp, then later runs ctx_search queries against that label to retrieve only the relevant snippets.

Quick Start

Ask the assistant to index the current project directory into context-mode with a source label so it can be searched later.

Frequently Asked Questions about ctx-index

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I index a local directory for full-text search?

Call the ctx_index MCP tool with a path, a source label, and conservative bounds such as maxDepth 5 and maxFiles 200. If MCP tools are unavailable, run the CLI command context-mode index with the same path and source flag.

How do I search files after indexing them with context-mode?

Use ctx_search with the same source label you assigned during indexing, plus one or more queries. It returns focused snippets from the FTS5 knowledge base without rereading the raw files.

What is FTS5 and why is it used for code search?

FTS5 is SQLite's full-text search extension that builds a persistent inverted index over text content. It enables fast keyword queries over indexed files without loading them into memory or the conversation.

Should I index node_modules or build output directories?

No. The Skill explicitly excludes dependency directories, build outputs, secrets, and generated artifacts. Use the exclude option for project-specific noisy paths to keep the index clean and relevant.

What are the limits when indexing a large repository?

Default bounds are maxDepth 5 and maxFiles 200 for repository indexing. For broad repositories, ask the user before raising maxFiles above 500 to avoid excessive indexing time and index size.