Command line

Your context, from any shell.

Search, read, and write your prompts, documents, and collections from a terminal, a script, or a CI job. Each of the 35 REST API operations is one command.

  • JSON on stdout
  • Node.js 20+
  • MIT license

Runs wherever a shell runs.

CI jobs, cron, git hooks, and coding agents already run commands. Now each of them can read and write your context.

Add one step after your release job. Set CONTEXTREPO_API_KEY from your CI secrets and the step runs without init or a prompt. The acknowledgement carries the new document's id and revision.

release job

$ contextrepo documents create --title "Release notes 2.4" --content-file CHANGELOG.md --tags releaseid: jn7d5g8j1m4p7s0v3y6b9e2h5k8n1q4trevision: 1contentHash: sha256:9f2c41d07be3a8c5noop: norevision 1 · etag "r1-9f2c41d0" · hash sha256:9f2c41d07be3a8c5

Made for scripts. Clean stdout. Clear exit codes.

zsh

$ contextrepo whoami > /dev/null; echo "exit $?"exit 0$ CONTEXTREPO_API_KEY="$REVOKED_KEY" contextrepo whoami; echo "exit $?"✖ 401 — Invalid authentication  hint: the API key was rejected; run `contextrepo auth login` or check CONTEXTREPO_API_KEYexit 3
0

Success

The command did what you asked.

1

API error

The API answered with an error, such as 404 not found or 409 conflict.

2

Usage error

A missing argument, a bad flag value, or an unreadable config file.

3

Auth error

The key was rejected (401) or lacks the scope for the command (403).

4

Network error

The API could not be reached, or the request timed out.

130

Cancelled

You cancelled the key prompt during setup.

Exact JSON

--json prints the exact API JSON, so jq and your own code read the same fields the API docs describe.

Clean stdout

Results go to stdout. Errors, hints, and generated idempotency keys go to stderr, and --quiet drops the hints.

Pipes both ways

Pipe content into prompts create or documents create, and documents get --raw prints the Markdown alone.

35 API operations. One command each.

Every group has --help with examples. For anything else, contextrepo api sends a raw request to any /v1 path.

  • prompts7

    • list
    • get
    • create
    • update
    • delete
    • versions
    • restore
  • documents13

    • list
    • get
    • create
    • update
    • delete
    • versions
    • restore
    • refresh
    • scrape
    • lease
    • coordination get
    • coordination enable
    • coordination disable
  • collections8

    • list
    • get
    • create
    • update
    • delete
    • items
    • add
    • remove
  • retrieval6

    • search
    • reason
    • pd search
    • pd expand
    • pd read
    • pd session
  • account1

    • whoami
  • tools

    • init
    • auth login
    • auth status
    • auth logout
    • doctor
    • config
    • log
    • completion
    • api

CLI or MCP? Same items. Pick by where the work runs.

Where it runs
MCP serverInside chat and coding clients: Claude, ChatGPT, Cursor, and other MCP clients.
CLIIn a shell: terminals, scripts, CI jobs, cron, git hooks, and agents that run commands.
Who picks the call
MCP serverThe model chooses tools from what you ask in plain language.
CLIYou or your script name the exact command and flags.
How it signs in
MCP serverOAuth sign-in, or an API key through the stdio bridge.
CLIAn API key, saved by init or read from CONTEXTREPO_API_KEY.
What comes back
MCP serverTool results that the model reads and summarizes for you.
CLITables for people, exact JSON for programs, and an exit code.
Surface
MCP server29 tools at one URL.
CLI35 API operations, one command each.

Four steps to your first command. From API key to a passing check.

Step 01

Create an API key

In Settings, under API Keys, create a key with Read or Write on prompts and on documents and collections. The full key is shown once, so copy it.

Step 02

Install the CLI

Install the package globally with npm. It adds one command, contextrepo, and needs Node.js 20 or newer.

Node.js 20+View on npm

Step 03

Connect this machine

Run init and paste the key. The CLI checks it with the API, then saves it to your config file. In CI, set CONTEXTREPO_API_KEY instead.

contextrepo init

Step 04

Check the setup

Run doctor. It checks Node.js, the config file, the API, and your key, one line per check.

contextrepo doctor

zsh

$ contextrepo init ██████╗ ██████╗ ███╗   ██╗████████╗███████╗██╗  ██╗████████╗██╔════╝██╔═══██╗████╗  ██║╚══██╔══╝██╔════╝╚██╗██╔╝╚══██╔══╝██║     ██║   ██║██╔██╗ ██║   ██║   █████╗   ╚███╔╝    ██║██║     ██║   ██║██║╚██╗██║   ██║   ██╔══╝   ██╔██╗    ██║╚██████╗╚██████╔╝██║ ╚████║   ██║   ███████╗██╔╝ ██╗   ██║ ╚═════╝ ╚═════╝ ╚═╝  ╚═══╝   ╚═╝   ╚══════╝╚═╝  ╚═╝   ╚═╝ ██████╗ ███████╗██████╗  ██████╗██╔══██╗██╔════╝██╔══██╗██╔═══██╗██████╔╝█████╗  ██████╔╝██║   ██║██╔══██╗██╔══╝  ██╔═══╝ ██║   ██║██║  ██║███████╗██║     ╚██████╔╝╚═╝  ╚═╝╚══════╝╚═╝      ╚═════╝ Context Repo CLI v0.1.0 Paste an API key to connect this machine. Create one in the dashboard under Settings → API Keys. │◇  Context Repo API key│  ▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪│◇✔ Connected as Ada Lovelace  kind: apiKey  Prompts: Write (includes Read) · Documents & Collections: Write (includes Read)  config: ~/.config/contextrepo/config.json Try:  contextrepo prompts list  contextrepo search "onboarding checklist"  contextrepo log enable

Your questions, answered.

  • An open-source command-line client for the Context Repo REST API. It installs one command, contextrepo, that searches, reads, creates, versions, and organizes your prompts, documents, and collections. It talks to the REST API directly and never opens an MCP session.

Open source, MIT

One install.

Every API operation in your shell.