CLI Reference
Installation
Both ctx and ctxme commands are available after installation — they are identical. Examples below use ctx.
Homebrew (recommended)
brew install ctxme/cli/ctxme
That one command adds the tap and installs the CLI. Upgrade later with brew upgrade ctxme.
Name the formula in full the first time. Homebrew requires formulae from third-party taps to be trusted before it will load them (HOMEBREW_REQUIRE_TAP_TRUST, on by default since Homebrew 6), and naming a formula explicitly grants that trust — after which plain brew install ctxme and brew upgrade ctxme work too.
Tapping first is equivalent, but takes an explicit trust step:
brew tap ctxme/cli
brew trust ctxme/cli
brew install ctxme
Without brew trust, the install fails with Refusing to load formula ctxme/cli/ctxme from untrusted tap ctxme/cli.
From PyPI
Requires Python 3.10+.
pip install ctxme # or: pipx install ctxme
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— Install shell completion for the current shell (see Shell Completion)ctx --show-completion— Print the completion script instead of installing it, to copy or customize
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>(-p) — 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.
Command Conventions
Two options recur across the command set and are called out below only where their behaviour is unusual:
--project <key>(-p) targets a project other than the default. Most commands that read or write project data accept it.--jsonswitches a command's successful output to machine-parseable JSON. Most commands accept it; see JSON Output for how it differs from the global--output json.
Pagination. ctx list, ctx folders, ctx usage llm, ctx wiki list, and ctx wiki runs accept --cursor <token>, where the token comes from a previous response. Because that token is only returned in JSON output, --cursor requires --json. Each of these commands also takes --limit; ctx list additionally offers --no-limit to walk every page in one invocation.
Commands
Authentication
ctx auth login— Device flow sign-in (opens browser, stores API key in keychain). The key is issued at your own permission ceiling —adminfor an admin-role user,writefor a standard-role user — and the browser shows that exact permission before you authorize. Pass--scopes read,write,adminto request a specific list instead; requests above your role's ceiling are denied at verification.--no-open-browserprints the verification URL rather than opening a browserctx 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.--folder/-ffilters by folder path and--recursive/-rincludes subfolders (requires--folder);--all/-alists across all projects;--limit/-lcaps results (1-200, default 50),--no-limitreturns everything by fetching all pages, and--cursorresumes from a previous response;--sort/-sand--order/-ocontrol ordering (defaultupdated_at, with date fields defaulting to descending and text fields to ascending)ctx get <item>— Download an item to the current directory.--destwrites to a given file or directory,--forceoverwrites an existing destination,--stdoutand--clipboard/-cprint or copy text items instead of saving, and--text/-treturns extracted text for file items where availablectx read <item>— Retrieve item text content for AI consumption (--stdoutprints content only,--clipboard/-ccopies it,--max-charslimits length)ctx create <item> --data "<text>"— Create or update an inline item (--title,--tag/-trepeatable,--folder,--mime-type,--forceto overwrite without prompting,--renameto save under a different key interactively)ctx create <item> --src <path>— Upload a file as a context item (--keyoverrides the item key derived from the filename)ctx upload <path>— Upload a file as an item (equivalent tocreate --src).--key/-koverrides the derived item key;--title,--tag/-t,--force, and--renamebehave as they do forcreatectx update <item>— Update item metadata:--title,--mime-type,--folder, and tags.--tag/-treplaces every tag and is mutually exclusive with the incremental options--add-tag,--remove-tag, and--clear-tagsctx delete <item>— Delete an item (--forceto skip confirmation)ctx folders— List folder paths and item counts (--parentlists only the direct children of a folder;--limit/-land--cursorpaginate)ctx mv <item> --folder <path>— Move an item to a folder (empty string""moves it to the root)
--mime-type applies to inline content only. For inline items (--data, or text entered at the prompt) ctx create --mime-type accepts plain, markdown, or json. On the file-upload paths it is ignored: both ctx create --src and ctx upload derive the MIME type from the file extension and print a note when a --mime-type is supplied anyway. ctx update --mime-type is unaffected — it sets the stored MIME type of an existing item.
Hidden backwards-compatibility aliases do not appear in --help; prefer the canonical names:
- Top level:
ctx ls(list),ctx rm(delete),ctx put(create),ctx up(upload), andctx use(set-project) - Under
ctx items:ctx items ls,ctx items rm, andctx items put. There is noctx items up—upis registered on the top level only - Elsewhere:
ctx projects ls(projects list) andctx wiki ls(wiki list)
Search
ctx search <query>— Search for items (see Search Modes).--tag/-tfilters by tag (repeatable, AND semantics),--all/-asearches every project,--limit/-lcaps results and applies only with--all, and--include-pendingincludes items still processing or failed
Projects
ctx projects list— List available projectsctx projects current— Show the current default project (local only)ctx projects create <name>— Create a new project (--key/-kfor an explicit project key,--description/-dfor a description)ctx projects delete <key>— Delete a project (--yes/-yskips the confirmation prompt when deleting the default project)ctx set-project <project>— Set the default project key
Skills
The ctx skills group publishes skill bundles to your account catalog and installs them for Claude Code and Codex on this computer.
Producing and publishing a bundle
ctx skills validate <path>— Validate a local skill directory, reporting every finding plus the name and targets declared bySKILL.md. Warnings exit 0; errors exit non-zero. It reads no credentials and contacts no backendctx skills pack <path>— Validate, then build a reproducible ZIP. The default output is<source-parent>/<skill-name>.zip— the source directory's own name has no catalog meaning.--archive <file>chooses another path and--overwritereplaces an existing archive; the output may not sit inside the source treectx skills publish <path>— Build the same ZIP in memory and publish it to your account catalog. The ordered plan is always printed before anything changes: interactive runs prompt once, and--yesis required in non-interactive or JSON mode. An identical published version is a no-op and an identical draft is reused; a different existing draft refuses unless you pass--replace-draft, which--yesnever implies.--dry-runshows the plan, performs only the catalog read, and writes nothing
Create, upload, and publish are separate server steps rather than one transaction, so a failure part-way can leave an empty catalog record or an uploaded draft behind. The command's output names whatever state remains.
Installing skills
ctx skills sync <name>[@<version>]... installs named skills from your account catalog. A version defaults to @latest; @<number> pins one.
Choose a destination one of two ways:
--agent claude|codex|bothtogether with--scope user|directory.user(the default scope) installs into~/.claude/skillsor~/.agents/skills;directoryinstalls into<path>/.claude/skillsor<path>/.agents/skillsand requires--path <dir>.--agentis required for both scopes, andbothinstalls one unit per agent--dest <dir>for a custom destination (<dir>/<name>), mutually exclusive with--agent,--scope, and--path.--variant standard|claudeselects the installed variant (defaultstandard) and is only valid with--dest
The remaining options are the decisions that matter:
--mode symlink|copy— Install mode, defaulting tosymlinkeverywhere except Windows, where it iscopy. A symlink install points at an immutable managed store under the data directory, so the installed tree is never edited in place--on-conflict overwrite|backup— The explicit conflict-resolution action for a destination holding unmanaged or drifted content. Without it, a conflicting install refuses.overwritemoves the existing entry aside and restores it if the install fails;backupretains it at a timestamped<name>.bak-<timestamp>sibling. Neither--yesnor the interactive prompt ever authorizes an overwrite--yes— Skip the confirmation. Required in non-interactive or JSON mode: an install is never implied by the output format--dry-run— Print the install plan and change nothing. It needs no--yes
Every install is verified against the catalog's published bundle and previews publisher, version, files, destination, mode, and conflicts before touching anything. An install that fails leaves the destination as it found it.
Run ctx skills sync with no names to apply this machine's profile instead — see "This computer's machine profile" below.
Managing installed skills
ctx skills list [<name>...]— Show the locally managed installs, never the account catalog: skill, installed version, variant, agent, scope, destination, mode, publisher, hold marker, and a drift status computed from the destination (ok,drifted,missing, orstore-missing). Narrow with--agent,--scope,--path, or--dest. Read-only and offline, unless--outdatedis passed, which additionally resolves each record's latest catalog versionctx skills update [<name>[@<version>]...] | --all— Update managed installs. Bare<name>or@latesttracks the newest version and clears any hold;@<number>pins a version (downgrades included) and holds the record there. Each record keeps its recorded agent, scope, destination, mode, and variant — changing those stayssync's job. Named invocations are all-or-refuse, while--allreports and continues per record. Accepts the same--agent/--scope/--path/--destfilters plus--yesand--dry-runctx skills rollback <name>[@<version>]— Roll an install back to an earlier version and hold it there. Bare<name>returns to the newest superseded version in that destination's history;@<number>targets any version. Same filters,--yes, and--dry-runctx skills prune [<name>...] | --all— The only surface that removes an installed skill. It removes the destination entry and its managed record, locally, without contacting the server; content the CLI does not manage is invisible to it under every flag combination. A drifted install refuses unless you pass--backup, which preserves the observed entry at a timestamped.bak-*sibling first. Accepts the same--agent/--scope/--path/--destfilters, plus--yesand--dry-runctx skills gc— Free space in the managed store only. It never touches an installed destination — removal isprune's job alone. It drops superseded versions past the retained depth and then collects store data no install still references.--keep <n>sets that depth for the invocation;--keep 0drops every superseded version, after which a later rollback re-downloads.--dry-runreports every tier without deleting
Consent. These operations ask before they act: skills publish, skills sync, skills update, skills rollback, skills prune, skills machine register --adopt, and skills machine unregister. Each of them requires --yes whenever the run is non-interactive or uses --json, and refuses without it — consent is never implied by the output format. A --dry-run never needs it, since it changes nothing, and publish reaches its consent check only once the plan it printed would actually mutate the catalog. The machine commands have no dry run, so there --yes is the only non-interactive route.
This computer's machine profile
A machine's profile is the selection set you save for it in the web UI; there is no separate profile entity. Server-side selections never carry absolute paths, so a directory or custom-destination selection carries a path-independent destination key that this computer maps locally.
ctx skills machine register— Bind this computer to a machine record.--namesets the display name (default: this host's name) and the platform is detected automatically. If a machine of that name already exists in the account, register refuses and names--adopt.--adoptbinds to that existing record after a confirmation warning that this computer will apply that machine's selections and that two computers sharing one record contend for a single selection set.--yesskips that confirmation and is required to adopt non-interactively or with--jsonctx skills machine status— Show this computer's registration: the local identity, mapping count and — when a credential is available and the origin matches — the live machine detail and selection count. A missing credential, an unreachable backend, or a deleted machine record degrades to local-only output with a warning rather than failingctx skills machine unregister— Forget the local binding only (--yesskips the confirmation, and is required to run it non-interactively or with--json). Mappings are retained, nothing is uninstalled, and the server-side machine record and its selections are untouched
A bare ctx skills sync applies the registered machine's profile. In that form only --yes, --dry-run, and --json are accepted — every other sync option is a usage error, because each selection carries its own agent, scope, destination key, variant, and mode. It refuses before touching anything if this computer is not registered, was registered against a different backend, or has had its machine record deleted server-side; an empty profile reports nothing to install and exits 0.
Application is per selection, report-and-continue: a selection that cannot be applied is refused with its reason and the exact remediation — a ctx skills mapping set for an unmapped destination key, or the precise named ctx skills sync ... --on-conflict ... re-invocation for a drifted or unmanaged destination — and the remaining selections still apply. The run exits non-zero whenever any selection refused or failed, --dry-run included, so a preview never reports a broken profile as healthy. A record held by ctx skills update <name>@<n> or ctx skills rollback is skipped rather than changed.
Applying a profile never removes anything: managed installs outside the profile, installs deselected since the last sync, and unmanaged content are all left alone. Removal remains ctx skills prune's alone.
Destination-key mapping
ctx skills mapping set <key> <path>— Map a destination key to an absolute path on this computer. A key is 1-64 characters of lowercase letters, digits,.,_, or-, starts with a letter or digit, and never contains... The path is~-expanded, must be absolute, and is stored canonically, so two spellings of one directory are recognised as one destination. A path that does not exist yet is stored with a warning, and re-pointing a key warns that content installed under the old path is neither moved nor removedctx skills mapping list— List this computer's destination-key mappingsctx skills mapping remove <key>— Remove a mapping. It uninstalls nothing
Mapping commands need neither registration nor authentication.
For the full detail behind these commands — transaction semantics, the managed store layout, and per-flag reference — see the CLI README.
LLM Usage
ctx usage llm— List recent LLM invocations for your account (requires an admin-scoped key). Filters:--project,--since/--until(ISO-8601),--status,--workload,--model.--limit/-lcaps results (1-100, default 50) and--cursorpaginates
Wiki
ctx wiki status— Show wiki generation state, staleness, and coveragectx wiki generate— Trigger wiki generation or refreshctx wiki list— List wiki pages (--page-type,--include-stale,--limit/-l,--cursor)ctx wiki get <slug>— Show a wiki page's content and metadatactx wiki search <query>— Search wiki pages (--page-type,--include-stale,--limit/-l)ctx wiki query "<question>"— Ask the wiki for a synthesized, cited answer (--limit/-lcaps the pages retrieved).--file-backfiles novel answers as new wiki pages — filed pages are visible to the whole accountctx wiki settings— Show or change wiki settings;--llm-opt-in/--no-llm-opt-inenables or disables external LLM processing for this project's wikictx wiki runs— Show wiki maintenance run history (--status,--trigger,--limit/-l,--cursor)ctx wiki schema get— Print the wiki schema page bodyctx wiki schema set [file]— Replace the wiki schema from a file or stdin (omit the file, or pass-, to read 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 (.csv,.docx,.htm,.html,.json,.markdown,.md,.pdf,.tsv,.txt)
# 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_DATA_DIR— Override the default data directory path. The managed skills store lives inside it, at<CTXME_DATA_DIR>/skills-storeCTXME_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. It is read from the process environment only (never from.envfiles), takes precedence over the keychain, and is visible in process listings — use it for local testing rather than as a standing credentialCLI__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 options. The CLI detects the shell it is running in — bash, zsh, fish, and PowerShell are supported — so neither flag takes a shell argument.
ctx --install-completion
Completion takes effect once you restart the terminal.
To read or customize the script instead of installing it, print it and redirect it wherever your shell expects:
ctx --show-completion
Usage
ctx <TAB> # Shows: auth, config, get, list, create, ...
ctx auth <TAB> # Shows: login, logout, status, set-key
ctx skills <TAB> # Shows: validate, pack, publish, sync, list, ...
ctx get --<TAB> # Shows: --project, --dest, --stdout, --force, ...