Skip to content

ctxo init ​

Bootstraps a project for ctxo. Runs four steps:

  1. Ensures .ctxo/index/ and .ctxo/config.yaml exist.
  2. Generates MCP usage rules for the AI tools you use and registers the ctxo MCP server in their config files. Supported tool ids: claude-code, cursor, github-copilot, windsurf, antigravity, augment, amazonq, gemini-cli, continue.
  3. Installs the safe-edit guard hook and model-invoked skills (Claude Code and Cursor).
  4. 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
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 filesPer selected tool: CLAUDE.md, .cursor/rules/ctxo.mdc, .github/copilot-instructions.md, .windsurfrules, AGENTS.md, augment-guidelines.md, .amazonq/rules/ctxo.md, GEMINI.md, .continue/rules/ctxo.md
AI MCP configsPer selected tool: .mcp.json (Claude Code / Cursor / Windsurf / Antigravity / Augment), .vscode/mcp.json (Copilot), .amazonq/mcp.json, .gemini/settings.json, .continue/mcpServers/ctxo.json
.claude/settings.jsonRegisters the ctxo gate-hook PreToolUse hook (Claude Code only)
.claude/skills/ctxo-understand/SKILL.mdModel-invoked skill: orient at task start (Claude Code)
.claude/skills/ctxo-safe-edit/SKILL.mdModel-invoked skill: blast radius + why-context before edits (Claude Code)
.claude/skills/ctxo-review-pr/SKILL.mdModel-invoked skill: PR risk via get_pr_impact (Claude Code)
.cursor/rules/ctxo-understand.mdcSame skill for Cursor
.cursor/rules/ctxo-safe-edit.mdcSame skill for Cursor
.cursor/rules/ctxo-review-pr.mdcSame skill for Cursor
.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

Safe-edit guard prompt ​

When ctxo init detects Claude Code or Cursor, it asks whether to install the safe-edit guard. Answering yes writes the hook entry to .claude/settings.json and copies the three skills. The guard is enabled by default at balanced sensitivity; tune it via gate: in .ctxo/config.yaml:

yaml
gate:
  enabled: true
  sensitivity: balanced   # strict | balanced | lenient

Use ctxo gate --preview to see which symbols the current sensitivity level would flag before committing to it. See the Safe-Edit Guard guide for the full explanation.

Skills are passive instructions

Skills are markdown files the model reads - they do not execute code. The PreToolUse hook in .claude/settings.json is the only thing that actually blocks an edit. Skills guide the agent toward running get_blast_radius proactively.

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
ctxo init
shell
# Pick tools explicitly and install everything without prompts.
ctxo init --tools claude-code,cursor --yes
shell
# Refresh AI tool rules after a ctxo upgrade. Don't touch plugins or hooks.
ctxo init --rules
shell
# Set everything up but defer plugin installation to a later step.
ctxo init --no-install --yes --tools claude-code
shell
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.