CLI Reference

contxt init

Initialize a Contxt project in the current directory. Creates a local SQLite database and config file to start capturing memory.

Usage

contxt init

Run this once at the root of each project you want to track. Contxt identifies projects by their directory path.

What it creates

  • ~/.contxt/Global directory containing the shared SQLite database and auth credentials
  • ~/.contxt/db.sqliteLocal database storing all memory entries across projects
  • .mcp.jsonMCP server config for Claude Code — added to the project root
  • .cursor/mcp.jsonMCP server config for Cursor — auto-detected and written

The project is registered by its absolute path. You can have multiple projects on one machine — each with its own entries, branches, and sync state.

Automatic setup

After creating the project, contxt init runs several setup steps automatically so you don't have to configure anything manually:

Watch daemon started

The background watcher launches immediately with autoSync: true — file changes are captured and pushed to the cloud automatically every 30 seconds.

Git hooks installed

post-commit and pre-push hooks are added to .git/hooks/ to sync context on every commit and before every push.

Claude Code hook registered

A UserPromptSubmit hook is written to ~/.claude/settings.json. Claude silently loads your project context at the start of every session without any prompting.

See the Watch Daemon page for more detail on passive capture and auto-sync behavior.

Interactive prompts

The init command asks for:

  • Project name — defaults to the current directory name
  • Description — optional short description for the web dashboard

After init

Start capturing memory right away:

contxt decision add # capture an architectural decision
contxt pattern add # capture a code pattern
contxt sync push # push to cloud