Skip to content
Logo

Cloudflare Artifacts remote

Cloudflare Artifacts is a git-compatible object storage remote. It's a good choice if you don't want to use GitHub — your vault data stays on Cloudflare's infrastructure and never touches GitHub.

Prerequisites

  • A Cloudflare account on the Workers Paid plan (required for Artifacts)
  • Either wrangler login (the CLI runs it for you and requests artifacts:write), or CLOUDFLARE_API_TOKEN set to an API token with Artifacts › Read and Artifacts › Edit
  • If your login can see more than one account, set CLOUDFLARE_ACCOUNT_ID (or pick it when prompted)
  • wrangler CLI — if not installed, the setup wizard falls back to npx wrangler automatically

Setup (automatic)

When you run npx claude-second-brain and select Cloudflare Artifacts as your remote, the CLI handles everything:

  1. Checks wrangler auth (logs you in and requests the artifacts:write scope if needed)
  2. Resolves your account ID and creates a new Artifacts repo via the Artifacts REST API (api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/artifacts/…)
  3. Runs git remote add origin <remote-url>
  4. Pushes the initial commit
  5. Mints a 90-day git token and saves it in the vault's .git/config, so git push / git pull just work

Manual setup

If you skipped Cloudflare Artifacts during setup, or setup failed, you can connect an existing brain by hand. These are the same REST API calls the CLI makes:

# 1. Credentials: a wrangler login token (or your own CLOUDFLARE_API_TOKEN) and your account ID
export CLOUDFLARE_API_TOKEN="${CLOUDFLARE_API_TOKEN:-$(npx wrangler auth token)}"
export CLOUDFLARE_ACCOUNT_ID=<your-account-id>   # shown by `npx wrangler whoami`
API=https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/artifacts
 
# 2. Create the namespace (skip if it already exists)
curl -s -X POST "$API/namespaces" \
  -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" -H "Content-Type: application/json" \
  -d '{"namespace":"default"}'
 
# 3. Create the repo. The response's result.remote is the git URL and result.token a 24-hour push token
curl -s -X POST "$API/namespaces/default/repos" \
  -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" -H "Content-Type: application/json" \
  -d '{"name":"my-brain","default_branch":"main"}'
 
# 4. From the vault root: add the remote and push with that token
git remote add origin <result.remote>   # https://<ACCOUNT_ID>.artifacts.cloudflare.net/git/default/my-brain.git
git -c http.extraHeader="Authorization: Bearer <result.token>" push -u origin main
 
# 5. Save a 90-day token so plain git push / git pull (and obsidian-git) work
csb git-token my-brain

To remove the repo later: curl -X DELETE "$API/namespaces/default/repos/my-brain" -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN".

Renewing the git token

Artifacts git tokens expire (csb mints them for 90 days; Cloudflare allows up to 1 year). When git push or git pull starts failing with an auth error, renew it:

csb git-token            # default brain
csb git-token my-brain   # a specific brain

This mints a new repo-scoped token with your wrangler login (or CLOUDFLARE_API_TOKEN) and stores it for the brain's remote as http.<remote>.extraHeader in the vault's .git/config — local only, never committed. Plain git push / git pull (and obsidian-git) work again until it expires.

Options: --ttl <duration> for a different lifetime (seconds, or 12h, 90d, 1y; max 1 year), --read for a read-only token, --print to print the token instead of saving it (e.g. for another machine: git -c http.extraHeader="Authorization: Bearer $(csb git-token --print)" pull).

Namespace

During setup, the CLI asks for an Artifacts namespace (default: default). Namespaces scope repos within your Cloudflare account — useful if you manage multiple projects. For personal use, the default is fine.

If setup fails

If the repo can't be created or the first push fails, the CLI still creates the brain locally but says so in a warning, lists the fix in Next steps, and exits non-zero. A 403 / Authentication error usually means Artifacts isn't enabled on the account (Workers Paid plan), the token is missing the Artifacts permission, or CLOUDFLARE_ACCOUNT_ID points at another account. A 404 / Namespace is not active means the namespace was deleted; the CLI recreates it and retries automatically, and if that still fails, wait a minute (deletion can take a moment to finish) or pick another namespace. Fix it, then csb rm <name> and re-run, or add any other git remote by hand.