Skip to content
refs
README.md

refs://

refs is a Git forge where people and coding agents work on the same repositories. Agents write the code. People read the decisions, steer the work and merge.

Use the hosted service at useref.dev, or deploy refs to your own Cloudflare account. The full docs are at useref.dev/docs. Their source is in apps/frontend/docs/.

Features

  • Git hosting: public and private repositories over HTTPS, with forks, imports and a code map.
  • Agents as actors: Claude Code, OpenCode, Codex and other MCP clients connect to a repository. Each agent holds one branch and pushes only to it.
  • Decision records: agents write a decision block in the commit message for each choice that a person must judge. refs checks each record on push.
  • Reasoning review: a pull request opens on its decisions. Steer a decision, or start a new branch from any step.
  • Hosted agents: mention @reviewer, @security or your own agent on a pull request. refs runs it.
  • CI: pipelines in .refs/ci.yml run in containers, with secrets, environments and approvals.
  • Tasks, organizations and the refs CLI.

The protocol that agents follow is in docs/ref-protocol.md.

Run refs locally

You need Node.js 22 or later, and a Cloudflare account with access to Artifacts. The local server uses the real Artifacts and Workers AI services of that account. All other data stays local.

  1. Clone the repository and install the dependencies:

    git clone https://useref.dev/refs/source.git refs
    cd refs
    npm install
    
  2. Sign in to Cloudflare:

    npx wrangler login
    
  3. Put your email in ADMIN_EMAILS in wrangler.jsonc.

  4. Start the dev server. It applies the local D1 migrations first.

    npm run dev
    
  5. Open http://localhost:5173 and sign up with the email from step 3. Admins see sign-ups at /admin.

CI jobs do not run locally, because containers are off in dev. To use CI secrets and model keys locally, put a CI_SECRETS_KEY in .dev.vars. Make it with openssl rand -base64 32.

Before you send a change, run:

npm test
npm run typecheck

Deploy to Cloudflare

You need a Workers Paid plan, because refs uses Containers, Queues and Durable Objects. You also need access to Artifacts, and a domain on Cloudflare.

  1. In wrangler.jsonc, change these values to your own:

    Key Value
    routes[0].pattern Your domain, for example git.example.com
    vars.PUBLIC_ORIGIN https://git.example.com
    vars.ADMIN_EMAILS The admin emails, separated by commas
    vars.EMAIL_FROM A sender on a domain that has Email Service set up
  2. Create the queues:

    for q in refs-pushes refs-pushes-dlq refs-agent-runs refs-agent-runs-dlq; do
      npx wrangler queues create "$q"
    done
    
  3. Set the key that seals CI secrets and model keys:

    openssl rand -base64 32 | npx wrangler secret put CI_SECRETS_KEY
    

    Keep a copy of this key. If you lose it, refs cannot open the saved secrets.

  4. Deploy:

    npm run deploy
    

    The command builds refs, applies the D1 migrations to the remote database and deploys the Worker. On the first deploy, Wrangler creates the D1 database and the KV namespace, and builds the CI container images.

  5. Open your domain and sign up with an admin email.

To connect agents to your server, run refs setup <your-domain>. Refer to The refs CLI.

Repository layout

Path Contents
workers/main.ts The Worker entry: Git requests, the MCP server, the CLI API and React Router
apps/backend/ Accounts, repositories, tasks, pull requests, agent sessions and the Git proxy
apps/frontend/ Routes, loaders, actions and the docs. Design rules are in DESIGN.md
apps/ci/ Pipelines, runs, trust, secrets and the job containers
apps/cli/refs.mjs The refs CLI and the daemon that connects local agents
packages/design-system/ The tokens, components and icons, built on Base UI
packages/protocol/ The protocol rules: branch access and decision records
migrations/ The D1 schema