Skip to content

ctxo init ​

Bootstraps a project for ctxo. Runs three steps:

  1. Ensures .ctxo/index/ and .ctxo/config.yaml exist.
  2. Generates MCP usage rules for the AI tools you use (Claude Code, Cursor, Windsurf, etc.) and registers the ctxo MCP server in their config files.
  3. Offers to install missing language plugins and to install git hooks that re-index on commit and rebuild the SQLite cache on merge.

Requires a git repository (run git init first).

Synopsis ​

shell
npx @ctxo/init [options]

Flags ​

FlagShortDefaultDescription
--yes-yfalseNon-interactive. Install everything, skip prompts. Combine with --tools to pick tools
--tools <list>Comma-separated list of AI tool ids (for example claude-code,cursor). Implies non-interactive
--rulesfalseOnly regenerate AI tool rule files. Skips index dir, plugins, and git hooks
--no-installfalseSkip the language-plugin detection prompt (and the implicit install under --yes)
--dry-runfalsePrint the files that would be created or modified and exit

What it writes ​

PathNotes
.ctxo/index/Created if missing (holds per-file JSON indices)
.ctxo/config.yamlDefault config is dropped if absent. See config reference
.gitignore.ctxo/.cache/ appended if not already present
AI rule filesFor example .claude/claude.md, .cursor/rules/*.mdc, depending on what you select
AI MCP configsFor example .mcp.json, registering npx -y @ctxo/cli as a server
.git/hooks/post-commitIncremental re-index of changed files (idempotent block, marked # ctxo-start / # ctxo-end)
.git/hooks/post-mergeRuns ctxo sync after git pull

Hooks are safe to re-run

The hook installer detects the # ctxo-start marker and leaves existing hooks untouched. You can safely re-run ctxo init to pick up new AI tool rules.

Examples ​

shell
npx @ctxo/init
shell
# Pick tools explicitly and install everything without prompts.
npx @ctxo/init --tools claude-code,cursor --yes
shell
# Refresh AI tool rules after a ctxo upgrade. Don't touch plugins or hooks.
npx @ctxo/init --rules
shell
# Set everything up but defer plugin installation to a later step.
npx @ctxo/init --no-install --yes --tools claude-code
shell
npx @ctxo/init --dry-run

Exit codes ​

CodeMeaning
0Setup completed (or dry-run printed successfully)
1Not a git repository, or unknown tool id passed to --tools

See also ​

Released under the MIT License.