# BareCI > BareCI takes a pull request from its first push to its merge: CI on fast machines, tests from an agent's worktree, previews, AI end-to-end Flows, every reviewer's findings in one list, and one answer to "is this ready to merge?". Agents use it over MCP, a CLI or the /v1 JSON API. Connect an agent: MCP over Streamable HTTP at https://api.bareci.com/mcp with `Authorization: Bearer ` (protocol 2026-07-28, and the initialize handshake of 2025-11-25 and earlier). Get a token with `bareci login`. Every tool result names the next action. Every docs page is also Markdown: add `.md` to its URL or send `Accept: text/markdown`. --- # BareCI docs > BareCI takes a pull request from its first push to its merge. Start here for setup, each module, the CLI, MCP for agents and the API reference. Source: https://bareci.com/docs BareCI takes a pull request from its first push to its merge. It runs CI on fast machines of our own, lets agents run any test from their worktree, tests a live preview of the change with AI end-to-end Flows, gathers every reviewer's findings into one list, and gives every pull request one explained answer to "is this ready to merge?", posted as a GitHub check the merge queue trusts. Agents use all of it through [MCP](https://bareci.com/docs/agents/mcp) and the [`bareci` CLI](https://bareci.com/docs/cli); people get a dashboard. Setup is one command per repository. ## Start here 1. [Getting started](https://bareci.com/docs/getting-started): `bareci init` sets a repository up, `bareci run` runs its tests on a BareCI machine. 2. [The pull request lifecycle](https://bareci.com/docs/concepts/lifecycle): how the modules fit together. 3. [MCP setup](https://bareci.com/docs/agents/mcp): connect an agent. ## Modules Each step of the lifecycle is a module. A repository can use any subset; the Gate counts only what is on. | Module | What it does | | -------------------------------------- | -------------------------------------------------------------------------------- | | [Runners](https://bareci.com/docs/modules/runners) | GitHub Actions jobs on fresh machines, hot, warm or cold, under a hard spend cap | | [Runs](https://bareci.com/docs/modules/runs) | Any command from a worktree, uncommitted changes included, on a fresh machine | | [Tests](https://bareci.com/docs/modules/tests) | JUnit results kept, flaky tests flagged, shards balanced by duration | | [Flows](https://bareci.com/docs/modules/flows) | End-to-end tests written as goals, recorded and replayed with no model in CI | | [Previews](https://bareci.com/docs/modules/previews) | The change running at its own URL until its TTL, the next push or the merge | | [Reviews](https://bareci.com/docs/modules/reviews) | Every reviewer's findings in one list, and the loop that answers each one | | [Gate](https://bareci.com/docs/modules/gate) | `BareCI: ready`, one check with every reason a pull request is not ready | | [Deploys](https://bareci.com/docs/modules/deploys) | Deploy jobs on isolated on-demand machines | | [API budget](https://bareci.com/docs/modules/api-budget) | Many agents on one repository without exhausting GitHub's API limits | ## Reading these docs as an agent Every page is also Markdown: add `.md` to its URL (this page is [/docs.md](https://bareci.com/docs.md)), or send `Accept: text/markdown`. [`/llms.txt`](https://bareci.com/llms.txt) indexes every page, and [`/llms-full.txt`](https://bareci.com/llms-full.txt) is all of them in one file. See [Docs for agents](https://bareci.com/docs/agents/llms). --- # Getting started > Set a repository up with bareci init, check it with bareci doctor, and run its tests on a BareCI machine with bareci run. Source: https://bareci.com/docs/getting-started This guide takes a repository from nothing to its first run on BareCI. You need the repository on GitHub, a local clone, and permission to install a GitHub App on its owner. ## 1. Install the CLI The `bareci` CLI is one static binary. Check it is on your path: ```sh bareci --version ``` ## 2. Set the repository up Run `init` in the repository's root: ```sh bareci init ``` `init` does every step of setup and shows you what it changed: 1. **Signs you in** with a one-time code in the browser, as `gh auth login` does. No token is pasted anywhere. The token goes to the operating system's keychain. 2. **Checks the GitHub App** on the repository's owner and links you to install it if it is missing. 3. **Opts the repository in**, so its jobs can run on BareCI. 4. **Writes `.bareci/config.yml` and `.bareci/image.sh`** from what it detects in the repository: Bun or Node, Playwright, Postgres, Docker. The image script is what the repository's machine image is baked from. 5. **Points `runs-on:` at BareCI** through a repository variable with a fallback, for example `${{ vars.BARECI_RUNNER_4 || 'ubuntu-latest' }}`, so any job can return to its previous runner by changing one variable. 6. **Opens a pull request** with all of it. Useful flags: | Flag | What it does | | ------------------- | -------------------------------------------------------------------- | | `--dry-run` | Show the diff and what would happen; change nothing | | `--no-pr` | Write the files into this checkout instead of opening a pull request | | `--label bareci-8` | The default pool size (default `bareci-4`) | | `--repo owner/name` | The repository, when it is not the `origin` remote | ## 3. Check the setup ```sh bareci doctor ``` `doctor` checks each step of `init` and prints the one fix for each failure. ## 4. Run the tests on BareCI ```sh bareci run -- bun test ``` `run` packs your worktree as it is, uncommitted changes included, runs the command on a fresh machine built from the repository's image, streams the output, and exits with the command's exit code. With no command, it runs the install and test commands from `.bareci/config.yml`. Bring files back with `--collect` and test reports with `--junit`: ```sh bareci run --junit junit.xml -- bun test --reporter=junit --reporter-outfile=junit.xml ``` ## 5. Push, and ask whether it is ready After you merge the `init` pull request, CI jobs run on BareCI. On any pull request: ```sh bareci ready --wait ``` `ready` gives the [Gate's](https://bareci.com/docs/modules/gate) verdict: ready, or every reason it is not yet with the command that fixes it. `--wait` holds until nothing is pending. ## Next - Connect your agent with [MCP setup](https://bareci.com/docs/agents/mcp). - Read the [CLI reference](https://bareci.com/docs/cli). - See how the modules fit in [the pull request lifecycle](https://bareci.com/docs/concepts/lifecycle). --- # The pull request lifecycle > How BareCI's modules fit together from the first push to the merge, and how the Gate turns them into one verdict. Source: https://bareci.com/docs/concepts/lifecycle BareCI follows a pull request from its first push to its merge. Each step is a module, and a repository can use any subset. ``` push ──► Runners: CI on our machines (hot pool, NVMe, baked images) ──► Tests: sharded by history, flaky tests flagged, results kept ──► Preview: the change running at its own URL ──► Flows: AI end-to-end tests against the preview, replayed without a model in CI ──► Reviews: every reviewer's findings merged; agents fix or rebut each one ──► Gate: one check, "BareCI: ready", with every reason it is not yet ──► merge queue ──► Deploys on our machines ``` ## Before the push Agents test before they push. `bareci run` (or the `run_create` tool) runs any command from the worktree on a fresh machine from the repository's image, so an agent learns in a minute what it would otherwise learn from CI. See [Runs](https://bareci.com/docs/modules/runs). ## After the push - [Runners](https://bareci.com/docs/modules/runners) run the repository's GitHub Actions jobs on fresh machines. - [Tests](https://bareci.com/docs/modules/tests) keeps the JUnit results, flags flaky tests and balances shards. - [Previews](https://bareci.com/docs/modules/previews) keeps a job's machine serving the change at its own address. - [Flows](https://bareci.com/docs/modules/flows) replay the repository's end-to-end flows against that preview. - [Reviews](https://bareci.com/docs/modules/reviews) collects every reviewer's findings into one list for the agent to work through. ## The verdict The [Gate](https://bareci.com/docs/modules/gate) posts one GitHub check, `BareCI: ready`, on each pull request head. It is green only when every enabled module agrees, and while it is not, it lists every reason with the command or MCP call that fixes it. Agents read the same verdict with `bareci ready` or the `ready` tool. ## After the merge [Deploys](https://bareci.com/docs/modules/deploys) run deploy jobs on isolated, on-demand machines, from the default branch or branches you list. ## One API, three clients Everything above is a route of the `/v1` JSON API. The MCP server and the CLI call the same routes, and the dashboard reads them for people. Every answer is structured and names the next action. --- # Organisations, tokens and spend > How BareCI organisations follow GitHub, how agent tokens and scopes work, and how usage, the free tier and the hard monthly cap are counted. Source: https://bareci.com/docs/concepts/accounts ## Organisations An organisation in BareCI is a GitHub account where the BareCI GitHub App is installed. Its members and owners follow GitHub membership, so there is no second user list to keep. GitHub organisation admins can read, run and operate; members can read and run. When someone leaves the GitHub organisation, their access ends at once. People sign in to the [dashboard](https://bareci.com/app) with GitHub. The CLI signs in with a device code: `bareci login`. ## Agent tokens and scopes Agents use **agent tokens**: `bci_…`, each scoped to one organisation with some of these scopes: | Scope | Allows | | --------- | --------------------------------------------------------------------------------------- | | `read` | Reading runs, logs, tests, previews, findings, the Gate's verdict, usage and settings | | `run` | Starting and cancelling runs, stopping previews, resolving findings, requesting reviews | | `operate` | Changing settings, caps and tokens; dismissing disputed findings | Only a token's hash is stored, and the token itself is shown once. A token acts only on its own organisation's repositories: another organisation's repositories, jobs and accounts answer as if they did not exist. Manage tokens with the `/v1/accounts/:account/tokens` routes, or let `bareci login` create one for this machine. ## Usage and the cap Usage is metered in micro-dollars from the same ledger entries that enforce the cap, so the bill and the cap can never disagree. Each usage event has a key and is recorded once. - **Free tier:** a small monthly allowance with no card. Work past it is refused until the next month or a card is added. - **Paid:** usage above the free allowance is billed. Every organisation has a hard monthly cap, with a default you can raise. - **At the cap:** new launches stop for that organisation only, and the job shows the reason and the next step. See [Pricing](https://bareci.com/pricing) for the meters. Check your organisation's usage with `account_usage`, or `GET /v1/accounts/:account/usage`. ## Forks and public repositories Jobs from public repositories are refused unless the organisation turns on `allowForks`, because a job event cannot tell whether a fork triggered it. --- # Runners > Run GitHub Actions jobs on fresh BareCI machines. Labels, sizes, hot, warm and cold tiers, images, the spend cap, fallback and repair. Source: https://bareci.com/docs/modules/runners Runners run a repository's GitHub Actions jobs on fresh machines that BareCI launches per job and destroys afterwards. A Cloudflare control plane keeps a pool per repository and label, reconciled toward a target. ## Labels Point a job at BareCI with its `runs-on:` label: ```yaml jobs: test: runs-on: bareci-4 ``` Labels are `bareci-[-arm][-][-]`: | Part | Values | | ---------- | ------------------------------------------------------- | | `vcpu` | `2`, `4`, `8`, `16` | | `-arm` | An Arm machine instead of x86 | | `-` | `deploy` selects a [deploy pool](https://bareci.com/docs/modules/deploys) | | `-` | A named image; without it, the repository's own image | `bareci init` writes the label through a repository variable with a fallback, so a job can return to its previous runner by changing one variable. ## Tiers | Tier | What waits | Job pickup | | ---- | ------------------------------------------------------ | -------------- | | Hot | A running machine with an idle runner already online | About 1 s | | Warm | A stopped machine that has booted once | About 15 s | | Cold | Nothing: a new machine, spot first, on-demand fallback | Under a minute | A hot machine still runs exactly one job and is then destroyed; the pool refills behind it. Hot targets follow a schedule per pool, for example a few machines in working hours and none at night, so idle cost stays small. ## Images Each repository's image is baked nightly from its own `.bareci/image.sh` on a shared base: Ubuntu, the Actions runner, Docker, Bun, Node and the machine agent. The bake always installs the latest runner release. Machine types with local NVMe put the work directory and Docker's data on it. ## Isolation - One fresh machine per job, destroyed after it. - No instance role, no SSH, no inbound network. - A single-use boot token, spent before the job starts. ## Spend cap and fallback Spend is counted per machine-second, by machine type and market. At the organisation's cap, launches stop and jobs fall back to the runner label you chose. If jobs wait more than five minutes, or cloud or GitHub calls keep failing, BareCI also switches the repository's runner variable to its fallback label and alerts. ## Repair | Problem | What happens | | -------------------------------------- | ----------------------------------------------------- | | A machine never boots within 4 minutes | Terminated; the pool launches another | | A job runs past GitHub's 6-hour limit | The machine is terminated | | A webhook was missed | A reconcile lists queued jobs every 2 minutes | | A spot machine is interrupted | Its failed jobs are re-run once on on-demand capacity | ## Asking why a job waits `job_explain` (MCP) answers one job's timeline: queued, launched, booted, picked up, finished, with each step's duration, its machine, tier, market and cost, and if it is still waiting, why. `insights` answers pickup and job times, tier mix and cost per pool, with suggestions. See the [Runners API](https://bareci.com/docs/api/runners). --- # Runs > Run any command from a worktree on a fresh BareCI machine with bareci run or the run_create tool. Upload, logs, artifacts, shards, limits and lifecycle. Source: https://bareci.com/docs/modules/runs A run executes a command from your worktree, uncommitted changes included, on a fresh machine built from the repository's image. Output streams back, and the CLI exits with the command's exit code. Runs use the same machines, cap and isolation as CI, and spend no Actions minutes and no local CPU. ## From the CLI ```sh bareci run -- bun test ``` | Flag | What it does | | ------------------------ | --------------------------------------------------------------------------------------------------- | | `--collect ` | Bring a file or directory back (repeatable) | | `--junit ` | Bring a JUnit report back and summarise it (repeatable); it also feeds [Tests](https://bareci.com/docs/modules/tests) | | `--shards ` | Run on n machines with `BARECI_SHARD_INDEX` and `BARECI_SHARD_TOTAL` set | | `--env NAME=value`, `-e` | Environment for the command (repeatable; never secrets) | | `--timeout ` | Stop the command after this long (default 1800) | | `--label