Skip to content

CLI reference ​

The carrybrain package on npm installs the MCP server and hooks for your agents, syncs skills and rules, and gives you small commands for memories. It needs Node 22 or newer and has no runtime dependencies.

sh
npx carrybrain --help      # try it without installing
npm i -g carrybrain        # or install it for a stable path

carrybrain --help (or -h) prints usage, carrybrain --version (or -v) the version.

Configuration ​

The CLI reads a URL and a key from ~/.config/carrybrain/config.json (written by login and install, mode 600). Environment variables win over the file, and when both are set no file is needed.

VariablePurpose
CARRYBRAIN_URLYour server's address, for example https://memory.example.com
CARRYBRAIN_KEYAn API key (cb_...)
CARRYBRAIN_HOMEKeep config and cache in one directory
CARRYBRAIN_CONFIG_DIR, CARRYBRAIN_CACHE_DIRMove just the config or just the cache
XDG_CONFIG_HOME, XDG_CACHE_HOMEStandard XDG locations, used when the variables above are not set
CLAUDE_CONFIG_DIRClaude Code's config directory (default ~/.claude): where settings.json and skills/ live

Plain http:// to a host other than localhost sends your key unencrypted. The CLI warns on stderr; pass --allow-http to login or install to silence it.

login ​

sh
carrybrain login --url <url> --key <key> [--allow-http]

Checks the key against the server and saves the config. --url and --key fall back to CARRYBRAIN_URL and CARRYBRAIN_KEY.

install ​

sh
carrybrain install claude|codex|cursor|gemini [--url <url> --key <key>] [--yes]
carrybrain install --all --yes [--no-save]

With --url and --key the login is saved first; without them the saved login is used.

TargetWhat it does
claudeRegisters the MCP server with Claude Code (claude mcp add-json --scope user), using a headersHelper so the key is never in Claude's config. Adds SessionStart and SessionEnd hooks to ~/.claude/settings.json. Without a claude binary the hooks are still written and the MCP registration completes on the first session.
codexAdds [mcp_servers.carrybrain] to ~/.codex/config.toml, then syncs skills.
cursorAdds the server to ~/.cursor/mcp.json, then syncs skills.
geminiAdds the server to ~/.gemini/settings.json (httpUrl), then syncs skills.
--allNon-interactive and idempotent. Claude Code, plus Codex, Cursor and Gemini when ~/.codex, ~/.cursor or ~/.gemini exists, then syncs skills. Never reads stdin and exits 0 with a warning when the URL or key is missing or the server is unreachable, so it is safe in setup scripts. A key the server rejects installs nothing.

Flags: --yes skips the "keep skills fresh in the background?" question for codex, cursor and gemini; --all never asks, and scripts pass --yes by convention. --no-save keeps the key out of config.json (use it with the environment variables). The Codex, Cursor and Gemini config files hold the key in plain text, created with mode 600.

init-repo ​

sh
carrybrain init-repo [--dir .] [--url <url>] [--repo <remote>] [--commit-skills]

For cloud agents that read only the repo. Writes files you can commit, with no secrets:

  • .mcp.json with the carrybrain server (${CARRYBRAIN_URL}/mcp, Bearer ${CARRYBRAIN_KEY}), merged into any existing file.
  • .claude/settings.json with enabledMcpjsonServers: ["carrybrain"] and a SessionStart command hook (npx -y carrybrain@latest hook claude-session-start).

--url only changes the printed next steps. --commit-skills also writes the repo-scoped skills to .claude/skills/carrybrain-* and .agents/skills/carrybrain-* (readable by everyone with repo access; personal, team and org skills are not included). --repo overrides the remote used to pick those skills. Safe to re-run. It prints the follow-up steps: commit, set the two variables in the platform, allow the host.

import ​

sh
carrybrain import [--only rules,skills,memories] [--from claude|codex|cursor|gemini|all] [--dry-run] [--yes] [--overwrite]

Copies rules, skills and Claude Code memories you already keep on this machine into your personal Carrybrain scopes. It prints a plan per source first (new, same, conflict), then asks before writing.

FlagMeaning
--onlyComma list of rules, skills, memories. Default: all three.
--fromOnly one source. Default all.
--dry-runShow the plan and write nothing.
--yesDo not ask. Required when there is no terminal.
--overwriteReplace items that conflict with different existing content. Without it conflicts are skipped.

Files read: ~/.claude/CLAUDE.md and ~/.claude/skills, ~/.codex/AGENTS.md and ~/.agents/skills, ~/.gemini/GEMINI.md, ~/.cursor/rules/*.md|mdc. Carrybrain's own blocks (<!-- carrybrain:start -->) and carrybrain-* skill folders are skipped. Only SKILL.md is imported from a skill folder; extra files produce a warning. The server splits markdown at ## headings (or # when there are none) into one rule per heading, keyed by the heading in kebab-case.

Memories come from ~/.claude/projects/*/memory/*.md (respecting CLAUDE_CONFIG_DIR); MEMORY.md index files are skipped. Each project folder is resolved back to its directory, and if that is a git repo the memories are linked to it; user and feedback memories stay global. All imported memories are private. Duplicates of memories you already have are reported as same and not written again.

doctor ​

sh
carrybrain doctor [--dir .]

Prints one check per line, with a fix for each failure, and exits 1 when a critical check fails. Checks: Node version, config source (environment or file), server reachable and TLS, key valid (and whether it is read-only), SessionStart hook, MCP registration, skills folders, repo id of the directory, autosync, and a nudge to import if you have not. Critical: Node, URL and key, reachability, key validity.

sync ​

sh
carrybrain sync [skills] [--quiet] [--dir <dir>]
carrybrain sync cursor|codex [--dir <dir>] [--repo <remote>]

sync (or sync skills) writes the skills that apply to you into the folders agents read: ~/.claude/skills/carrybrain-<name>/ and ~/.agents/skills/carrybrain-<name>/, plus the repo's .claude/skills and .agents/skills inside a git repo with a remote (git-excluded). Only carrybrain-* folders are ever touched. An unchanged state costs one conditional request. --quiet prints nothing and never fails, for hooks and timers. When shared skills (from teammates) change, the CLI tells you, because they run with your trust.

sync cursor writes the merged rules to .cursor/rules/carrybrain.mdc. sync codex writes AGENTS.override.md: the repo's own AGENTS.md followed by a Carrybrain block (Codex reads the override first). Both files are added to .git/info/exclude, and the repo is taken from the git remote of --dir unless you pass --repo.

autosync ​

sh
carrybrain autosync enable|disable|status

Runs carrybrain sync --quiet every 15 minutes, for agents without Claude Code hooks. macOS uses a launchd agent, Windows a Task Scheduler task carrybrain-sync, Linux a systemd user timer or else a cron line.

rules, remember, recall ​

sh
carrybrain rules [--repo <remote>]
carrybrain remember <text> [--team <name> | --org] [--repo <remote>]
carrybrain recall <query> [--repo <remote>] [--limit <n>]
  • rules prints the merged rules exactly as the session hook injects them.
  • remember saves a memory. It is private by default; --team <name> shares with one of your teams, --org with everyone (admin only). It prints created memory #id, or updated when it merged a near-duplicate.
  • recall searches by meaning and prints one line per memory with its score. --limit defaults to 5.

hook and mcp-headers ​

sh
carrybrain hook claude-session-start|claude-session-end
carrybrain mcp-headers

Used by Claude Code, not by you. hook claude-session-start reads the hook event from stdin, finds the repo from the git remote, prints rules, recent memories and a skills catalog as session context, and starts a background skills sync. It never fails a session: on any error it prints {}, and when the server is slow or down it falls back to the last good copy, labelled as cached. claude-session-end starts the same sync. mcp-headers prints {"Authorization":"Bearer <key>"} and is registered as Claude Code's headersHelper.

Carrybrain is open source under the MIT license.