Environments
Carrybrain works wherever your agent runs: a laptop, a dev container, a cloud workspace, CI, or a cloud agent. Set two variables and run one command. Re-running is safe.
export CARRYBRAIN_URL=https://memory.example.com # your server, reachable from this environment
export CARRYBRAIN_KEY=cb_your_key # a key made for this environment
npx carrybrain install --all --yes
npx carrybrain doctorinstall --all --yes is non-interactive and idempotent. It sets up Claude Code (MCP server, SessionStart and SessionEnd hooks), every other agent it finds (Codex, Cursor, Gemini CLI, when their config folder exists) and syncs skills. It never reads stdin and never fails the script around it: with the URL or key missing, or the server unreachable, it prints a warning and exits 0. In scripts that run often, npm i -g carrybrain once and call carrybrain, because hooks written from an npx cache path can disappear.
Two ways an agent reaches Carrybrain
| Where the agent runs | What it reads | Setup |
|---|---|---|
| Your machine, a dev container, a VM, CI with a checkout you control | User-level config (~/.claude, ~/.codex, ...) | carrybrain install --all --yes |
| Cloud agents (Claude Code on the web, Codex cloud, Cursor cloud agents) | Only files committed to the repo, plus the environment's variables | carrybrain init-repo, commit, set the two variables in the platform |
With both variables set no config.json is needed. install --all still saves one unless you pass --no-save. The hooks and the MCP header helper read the environment each time, so the variables must be set in every process that starts the agent.
Reach the server
The environment has to be able to open your server's address.
localhostonly works on the machine running the server.- Remote environments need a public HTTPS URL: a Cloudflare deployment, or a VPS running the Docker stack behind a TLS proxy.
- Or a private network such as Tailscale, with the server and environments on the same tailnet. Cloud agents that run in a vendor's network cannot join it and need the public URL.
- Many platforms limit outbound traffic. Allow the server's host.
carrybrain doctortells you when it is blocked. - Plain
http://to a non-local host sends your key unencrypted. Use HTTPS.
Keys
Create one key per environment, named after it (codespaces-api, ci-readonly) under Settings, API keys. A leaked or retired environment then costs one revoke. Use read-only keys for CI and anything that should consume memory without changing it: they can recall and list memories, fetch rules and skills and run the session hook, and any write is refused with 403 this key is read-only.
Laptop (macOS, Linux)
npm i -g carrybrain
carrybrain login --url https://memory.example.com --key cb_your_key
carrybrain install --all --yes
carrybrain autosync enable # optional: keeps skills fresh for agents without hooksWindows and WSL
On Windows run the same commands in PowerShell with Node 22 or newer. Claude Code's config is %USERPROFILE%\.claude, hooks are written with absolute paths so they do not depend on PATH, and autosync uses Task Scheduler. Windows has only been covered by unit tests of the path and quoting helpers. WSL is Linux with its own home folder: install and run inside the distribution, and set the variables on whichever side runs the agent.
Dev Containers and Codespaces
The Dev Container Feature installs the CLI at build time and connects each time the container starts, when the key is present:
// .devcontainer/devcontainer.json
{
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/anthropics/devcontainer-features/claude-code:1": {},
"ghcr.io/tanishq-khandelwal/carrybrain/carrybrain:1": { "url": "https://memory.example.com" }
},
"remoteEnv": { "CARRYBRAIN_KEY": "${localEnv:CARRYBRAIN_KEY}" }
}There is no key option: build-time features cannot see runtime secrets, so the key arrives as an environment variable. Without the Feature, put npm i -g carrybrain in onCreateCommand and carrybrain install --all --yes in postStartCommand.
GitHub Codespaces: add CARRYBRAIN_URL and CARRYBRAIN_KEY under Settings, Codespaces, Secrets and grant them to the repository, then use the Feature or a dotfiles repo. Changing a secret does not reach a running codespace; restart it.
DevPod, Coder, Ona: these run your dotfiles install.sh at start. Pass the variables with --workspace-env (DevPod), coder_env resources (Coder) or user environment variables (Ona), and use the script below.
#!/bin/sh
# dotfiles install.sh: connects Carrybrain when this environment has a key; harmless otherwise.
command -v npm >/dev/null 2>&1 || exit 0
npm i -g carrybrain >/dev/null 2>&1 || exit 0
carrybrain install --all --yes </dev/null || trueSSH VM or any server
export CARRYBRAIN_URL=https://memory.example.com CARRYBRAIN_KEY=cb_your_key
npm i -g carrybrain && carrybrain install --all --yesRun carrybrain login once so the config is saved, rather than exporting the key in a shell profile: a non-interactive SSH command does not load your profile.
CI
Use a read-only key in a CI secret and a committed .mcp.json from carrybrain init-repo.
# GitHub Actions
jobs:
review:
runs-on: ubuntu-latest
env:
CARRYBRAIN_URL: https://memory.example.com
CARRYBRAIN_KEY: ${{ secrets.CARRYBRAIN_READONLY_KEY }}
steps:
- uses: actions/checkout@v4
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_args: --allowedTools "mcp__carrybrain__*"# GitLab CI (CARRYBRAIN_KEY: a masked variable holding a read-only key)
claude-review:
image: node:22
variables:
CARRYBRAIN_URL: https://memory.example.com
script:
- npm i -g carrybrain @anthropic-ai/claude-code
- carrybrain install --all --yes
- claude -p "Review this merge request" --allowedTools "mcp__carrybrain__*"Cloud agents
Cloud agents do not read ~/.claude, ~/.codex or ~/.cursor. They read what is committed, plus the environment's settings. In the repo:
carrybrain init-repo # writes .mcp.json and .claude/settings.json, no secrets
carrybrain init-repo --commit-skills # optional: also commit repo skillsCommit the files, then in the platform:
- Claude Code on the web. Add
CARRYBRAIN_URLandCARRYBRAIN_KEYto the environment, and add your host to the allowed domains (the default network level is a limited allowlist). A setup script may install the CLI (npm i -g carrybrain) but should not runinstall --all, because it runs before the variables are set. - Codex cloud. Add the two variables as normal environment variables, not secrets (secrets are removed before the agent runs). Allow the host. Rules reach Codex through files, so in the setup script run
carrybrain sync codexandcarrybrain sync skills. - Cursor cloud agents. Commit
.mcp.json, runcarrybrain sync cursorand commit.cursor/rules/carrybrain.mdcif the agent cannot run the CLI, and set.cursor/environment.jsonto{ "install": "npm i -g carrybrain && carrybrain install --all --yes" }. Set the variables in the agent's environment. - E2B, Modal and similar sandboxes. Install the CLI in the image, pass the two variables when you start the sandbox, and run
carrybrain install --all --yes. Prefer short-lived or read-only keys.
Troubleshooting
Run carrybrain doctor first. It prints a check or a fix per line.
- No memory tools in a cloud environment. It does not read user config. Run
init-repo, commit, set the variables, allow the host. - It worked, then a container lost it. The secret changed after the container started; restart it. Variables set in one terminal are not seen by processes started elsewhere.
403 this key is read-only. A read-only key tried to write. Use a full key where agents should save memories.- Skills missing in the first session. They sync in the background and appear next session. The first session still lists them and can call
get_skill.