# CLI (cf)

`cf` installs ContextFile into your agent host and moves a local folder into your
evidence supply.

The `cf` package is not on npm yet, so the commands below do not run from a fresh
machine today. Until it is published, add the MCP server by hand with the per-host
config on [/install](/install); it is the same entry `cf install` writes.

```text
cf install <host> [--dry-run] [--yes] [--dir <path>]
cf uninstall <host> [--dry-run] [--yes] [--dir <path>]
cf install <order-id> | --listing <listing-id> | <package>   install an artifact you bought
cf install --check
cf login                 sign in this device (prints a code to approve in your browser)
cf logout                forget this device's stored token
cf sync <path> [--watch] [--dry-run] [--token <value>]
cf context <init|push|pull|import|export>
```

- `cf install <host>` (hosts: `claude-code`, `cursor`, `codex`, `vscode`) adds the
  ContextFile MCP server to the host's config, a marked block to CLAUDE.md, AGENTS.md
  or the host's instructions file saying when to call it, and a skill or rule file. It
  prints every change as a diff and asks before writing; `--dry-run` writes nothing.
  It is safe to rerun. `cf uninstall <host>` (or `cf install --host <host> --remove`)
  removes only what install wrote. The files per host are on [/install](/install).
- `cf install <order-id>` (or `--listing <listing-id>` for your newest order on a
  listing) installs an artifact you bought: it checks the bytes against the artifact
  digest and the signed report, then writes section files under
  `.contextfile/<package>@<version>/`, an index block, and the host's rule or skill.
  `contextfile.lock` pins it, and `cf install --check` fails when the files drift.
  Install never buys: with no order it says so and points at `commerce_quote` and
  `commerce_buy`. It signs in with `CONTEXTFILE_TOKEN`, an agent token with the
  `purchase` scope, not the `cf login` device token, which can only sync.

- `cf login` runs the OAuth device grant. You approve the code at [/device](/device);
  the device then appears under Settings, Agents, where you can revoke it. The token
  is stored in your OS config directory, readable only by you.
- `cf sync` content-addresses every file, skips what the server already holds, and
  records a snapshot. The server scans each file for prompt injection. Symlinks are
  never followed, and files over the per-file cap are skipped and reported.
- `--watch` keeps running and syncs on change; `--dry-run` scans and reports without
  pushing.
- `cf context` reads and writes your team's shared context files (conventions,
  decisions, how to build and test) over the same sign-in. See
  [Shared context](/docs/shared-context) for `init`, `push`, `pull`, `import`,
  `export` and pins.

Creating, verifying and publishing from the command line are not shipped yet. Use the
MCP tools or the REST API for those.



Version 6, updated 2026-11-19.
