CLI Reference
Installation
Install the CTX Me CLI from PyPI. Requires Python 3.10+.
pip install ctxme
Both ctx and ctxme commands are available after installation — they are identical. Examples below use ctx.
Global Options
ctx --version— Show the CLI version and exitctx --output json <command>(-o json) — Emit errors as a machine-parseable JSON envelope. Error output only; successful output stays in text format (see JSON Output)ctx --install-completion <shell>— Install shell completion (see Shell Completion)
Configuration
The CLI stores settings under the platform-specific config directory. Override the path with the CTXME_CONFIG_DIR environment variable.
Key commands:
ctx config --default-project <project>— Set the default project keyctx set-project <project>— Set the default project key (same effect)ctx current— Show the current default project (local only)ctx status— Show local config + auth status (no API call)
API keys are never written to disk; they are stored through the OS keyring only.
Commands
Authentication
ctx auth login— Device flow sign-in (opens browser, stores API key in keychain;--scopes read,write,adminrequests specific key scopes, defaultread,write)ctx auth status— Show stored API key prefix + backend metadatactx auth set-key <key>— Manually persist an API key using the OS keychainctx auth logout— Remove stored API key
Managing Items
Item commands are available at the top level and, identically, under the ctx items group (ctx list ≡ ctx items list).
ctx list— List items for the default or--projectproject (--folderto filter,--allfor all projects)ctx get <item>— Download an item to the current directory (--stdout/--clipboardfor text items)ctx read <item>— Retrieve item text content for AI consumption (--stdoutprints content only;--max-charslimits length)ctx create <item> --data "<text>"— Create or update an inline item (--title,--tagoptional)ctx create <item> --src <path>— Upload a file as a context itemctx upload <path>— Upload a file as an item (equivalent tocreate --src)ctx update <item>— Update item metadata: title, MIME type, folder, and tagsctx delete <item>— Delete an item (--forceto skip confirmation)ctx folders— List folder paths and item countsctx mv <item> --folder <path>— Move an item to a folder (empty string""moves it to the root)
ls and put are hidden backwards-compatibility aliases of list and create; prefer the canonical names.
Search
ctx search <query>— Search for items across projects (--tagto filter by tag)
Projects
ctx projects list— List available projectsctx projects current— Show the current default projectctx projects create <name>— Create a new project (--keyfor an explicit project key)ctx projects delete <key>— Delete a projectctx set-project <project>— Set the default project key
LLM Usage
ctx usage llm— List recent LLM invocations for your account (requires an admin-scoped key; filters:--project,--since,--until,--status,--workload,--model)
Wiki
ctx wiki status— Show wiki generation state, staleness, and coveragectx wiki generate— Trigger wiki generation or refreshctx wiki list— List wiki pagesctx wiki get <slug>— Show a wiki page's content and metadatactx wiki search <query>— Search wiki pagesctx wiki query "<question>"— Ask the wiki for a synthesized, cited answer (--file-backfiles novel answers as new wiki pages)ctx wiki settings— Show or change wiki settings (external LLM opt-in)ctx wiki runs— Show wiki maintenance run historyctx wiki schema get— Print the wiki schema page bodyctx wiki schema set [file]— Replace the wiki schema from a file or stdin
Maintenance
ctx update-check— Check for newer versions of the CLI
JSON Output
Two distinct mechanisms — they are independent and do not imply each other:
- Per-command
--json— Switches a command's successful output to machine-parseable JSON (e.g.ctx list --json,ctx read <item> --json --stdout). Supported by most commands. - Global
--output json(-o json) — Switches error output to a machine-parseable JSON envelope. It does not change successful command output; combine it with per-command--jsonwhen scripting.
Search Modes
The search command determines which projects to search based on your configuration:
Explicit project search (using --project):
ctx search "machine learning" --project my-research
Default project search (when default project is set):
ctx set-project my-main-project
ctx search "API documentation"
All-projects search (using --all or when no default is set):
ctx search "kubernetes config" --all --limit 20
The --project and --all flags are mutually exclusive.
Unified Context Items
The CLI uses a unified API that handles both inline text and file uploads:
- Inline content: Use
--datato provide text content directly - File uploads: Use
--srcorctx uploadto upload supported files (.txt,.md,.pdf,.docx,.csv,.tsv,.html)
# Create inline item
ctx create my-notes --data "Meeting notes from today"
# Upload a file
ctx create quarterly-report --src ./report.docx
# List items with processing status
ctx list
When uploading files, extraction and indexing happen asynchronously. Use ctx list to check when the status changes to ready.
Environment Variables
CTXME_DEBUG— Set to1to enable debug output (API URL, mode, full tracebacks)CTXME_CONFIG_DIR— Override the default config directory pathCTXME_CACHE_DIR— Override the default cache directory pathCTXME_UPDATE_CHECK— Set to0,false, ornoto disable automatic update checks at startupCTXME_UPDATE_CHECK_INTERVAL— Override the update check interval in seconds (default: 86400 / 24 hours)CLI__API_BASE_URL— Override the backend API URL (takes precedence over config file)CLI__API_KEY— Override the API key (process env only; takes precedence over keychain)CLI__DEFAULT_PROJECT— Override the default project (takes precedence over config file)CLI__USE_MOCK_CLIENT— Set totrueto use the mock client
Shell Completion
Enable tab completion for commands, subcommands, and flags.
Bash:
ctx --install-completion bash
Zsh:
ctx --install-completion zsh
Fish:
ctx --install-completion fish
PowerShell:
ctx --install-completion powershell
Usage
ctx <TAB> # Shows: auth, config, get, list, create, ...
ctx auth <TAB> # Shows: login, logout, status, set-key
ctx get --<TAB> # Shows: --project, --dest, --stdout, --force, ...