bazel-remote-cache
Tuist provides a managed Bazel remote cache that developers, CI runners, and coding agents share, so a build downloads action results another machine already produced instead of running them again. Connect a workspace with `tuist bazel setup` and Bazel talks to the cache over
Claude Code
$ npx -y skills add tuist/tuist --agent claude-code
Cursor
Cursor also loads subagents from .claude/agents, so copy this file there to use it in Cursor.
Agent definition
bazel-remote-cache.mdBazel remote cache: how it works, setup, and self-hosted or managed
Tuist provides a managed Bazel remote cache that developers, CI runners, and coding agents share, so a build downloads action results another machine already produced instead of running them again. Connect a workspace with `tuist bazel setup` and Bazel talks to the cache over its standard Remote Execution API, with short-lived credentials, compressed transfers, and a dashboard that shows the hit rate and what each invocation fetched. Keep your `BUILD` files and your usual `bazel build` and `bazel test` commands.
Improve the project first and the environment second. A remote cache only helps when the same action produces the same key on every machine, so measure hit rates and fix the inputs that differ before adding cache capacity, larger runners, or more parallelism.
How a Bazel remote cache works
Bazel breaks a build into actions, such as compiling a file or running a test. Each action has declared inputs, a command line, and environment variables, and Bazel hashes them into an action key. Bazel's [remote caching guide](https://bazel.build/remote/caching) describes two stores:
- The **action cache** maps action keys to action results: the output names and the hashes of their contents.
- The **content-addressable store (CAS)** holds the output files, keyed by the hash of their contents.
Before running an action, Bazel looks up its key. On a hit it downloads the result, or only the outputs it needs, and skips the action. On a miss it runs the action and, when allowed, uploads the result. Hits only happen when the inputs match exactly, so an absolute path, timestamp, or environment variable that differs between machines gives every machine its own keys.
Bazel speaks two protocols to a cache. The **HTTP protocol** stores action results under `/ac/` and files under `/cas/` with plain `GET` and `PUT` requests, so any HTTP server that supports both can serve as a basic cache. The **gRPC protocol** is the cache part of the [Remote Execution API](https://github.com/bazelbuild/remote-apis) (REAPI), which adds batched lookups, streamed uploads, and compressed transfers.
Three related ideas are often confused:
- **Disk cache versus remote cache.** `--disk_cache` keeps action results in a directory on one machine, which helps when switching branches or working in several checkouts. A remote cache shares results between machines. Bazel can use both together.
- **Remote cache versus remote execution.** A remote cache reuses results that already exist. Remote execution runs cache misses on other machines. Configuring a cache does not run anything remotely.
- **Remote cache versus saving Bazel directories in CI.** Restoring an output base or disk cache from a CI cache moves a whole archive in and out of each job. A remote cache transfers only the results of matching actions. [Bazel on GitHub Actions](/marketing-markdown/solutions/bazel-github-actions) compares the two on ephemeral runners.
How Tuist addresses it
- **A managed REAPI cache.** The [Tuist Bazel cache](/en/docs-markdown/guides/features/cache/bazel-cache) serves Bazel's remote cache over gRPC from the cache region closest to the machine that ran setup. Developers, CI, and agents in the same project read and write the same action results.
- **Authentication without stored passwords.** Setup configures a credential helper that exchanges the machine's Tuist session for short-lived, project-scoped cache tokens. On GitHub Actions, CircleCI, and Bitrise, the CLI can exchange the job's [OIDC token](/en/docs-markdown/guides/server/authentication) instead of a long-lived secret.
- **Smaller transfers.** Setup turns on `--remote_cache_compression`, so blobs travel zstd-compressed. It also routes dependency archive downloads through the cache's Remote Asset API with local fallback, so a fetched archive is served from the cache on later builds; `--no-remote-downloader` opts out.
- **Evidence for every invocation.** The project's **Bazel Cache** page shows transfer volume, read and write latency, throughput, and the action-cache hit rate. Each invocation separates action-cache lookups from CAS downloads, so a cold action cache looks different from a slow download. With [Bazel build insights](/en/docs-markdown/guides/features/build-insights/bazel), which setup also enables, the same invocation shows its critical path and the actions that dominated it. Pass `--no-build-insights` for a cache-only configuration.
- **One platform across build systems.** The same account serves the [Gradle](/en/docs-markdown/guides/features/cache/gradle-cache) and [Xcode](/en/docs-markdown/guides/features/cache/xcode-cache) caches, so organizations running several build systems manage one cache and one set of insights.
Set up a Bazel remote cache with Tuist
[Install the Tuist CLI](/en/docs-markdown/guides/install-tuist) on macOS or Linux, then run this from the root of the Bazel workspace:
tuist init # or: tuist auth login && tuist bazel setup
bazel build //...
Setup writes `.bazelrc.tuist` with the remote cache, credential helper, compression, and Build Event Service settings, and adds `try-import %workspace%/.bazelrc.tuist` to `.bazelrc`. Commit the `try-import` line and `tuist.toml`, and add `.bazelrc.tuist` to `.gitignore`: it holds a machine-local credential-helper path and the nearest cache region, so every developer machine and CI job runs `tuist bazel setup` itself. Setup leaves a `.bazelrc` alone when it already configures a remote cache. The [Bazel getting-started guide](/en/docs-markdown/guides/get-started/bazel-project) covers the full flow, and the [CI guide](/en/docs-markdown/guides/integrations/continuous-integration) covers authentication per provider.
These Bazel flags shape how any remote cache behaves, including Tuist's:
| Flag or tag | What it does | | --- | --- | | `--remote_cache=grpcs://…` or `https://…` | Points Bazel at the cache and selects gR
Read more
Bazel remote cache: how it works, setup, and self-hosted or managed
Tuist provides a managed Bazel remote cache that developers, CI runners, and coding agents share, so a build downloads action results another machine already produced instead of running them again. Connect a workspace with `tuist bazel setup` and Bazel talks to the cache over its standard Remote Execution API, with short-lived credentials, compressed transfers, and a dashboard that shows the hit rate and what each invocation fetched. Keep your `BUILD` files and your usual `bazel build` and `bazel test` commands.
Improve the project first and the environment second. A remote cache only helps when the same action produces the same key on every machine, so measure hit rates and fix the inputs that differ before adding cache capacity, larger runners, or more parallelism.
How a Bazel remote cache works
Bazel breaks a build into actions, such as compiling a file or running a test. Each action has declared inputs, a command line, and environment variables, and Bazel hashes them into an action key. Bazel's [remote caching guide](https://bazel.build/remote/caching) describes two stores:
- The **action cache** maps action keys to action results: the output names and the hashes of their contents.
- The **content-addressable store (CAS)** holds the output files, keyed by the hash of their contents.
Before running an action, Bazel looks up its key. On a hit it downloads the result, or only the outputs it needs, and skips the action. On a miss it runs the action and, when allowed, uploads the result. Hits only happen when the inputs match exactly, so an absolute path, timestamp, or environment variable that differs between machines gives every machine its own keys.
Bazel speaks two protocols to a cache. The **HTTP protocol** stores action results under `/ac/` and files under `/cas/` with plain `GET` and `PUT` requests, so any HTTP server that supports both can serve as a basic cache. The **gRPC protocol** is the cache part of the [Remote Execution API](https://github.com/bazelbuild/remote-apis) (REAPI), which adds batched lookups, streamed uploads, and compressed transfers.
Three related ideas are often confused:
- **Disk cache versus remote cache.** `--disk_cache` keeps action results in a directory on one machine, which helps when switching branches or working in several checkouts. A remote cache shares results between machines. Bazel can use both together.
- **Remote cache versus remote execution.** A remote cache reuses results that already exist. Remote execution runs cache misses on other machines. Configuring a cache does not run anything remotely.
- **Remote cache versus saving Bazel directories in CI.** Restoring an output base or disk cache from a CI cache moves a whole archive in and out of each job. A remote cache transfers only the results of matching actions. [Bazel on GitHub Actions](/marketing-markdown/solutions/bazel-github-actions) compares the two on ephemeral runners.
How Tuist addresses it
- **A managed REAPI cache.** The [Tuist Bazel cache](/en/docs-markdown/guides/features/cache/bazel-cache) serves Bazel's remote cache over gRPC from the cache region closest to the machine that ran setup. Developers, CI, and agents in the same project read and write the same action results.
- **Authentication without stored passwords.** Setup configures a credential helper that exchanges the machine's Tuist session for short-lived, project-scoped cache tokens. On GitHub Actions, CircleCI, and Bitrise, the CLI can exchange the job's [OIDC token](/en/docs-markdown/guides/server/authentication) instead of a long-lived secret.
- **Smaller transfers.** Setup turns on `--remote_cache_compression`, so blobs travel zstd-compressed. It also routes dependency archive downloads through the cache's Remote Asset API with local fallback, so a fetched archive is served from the cache on later builds; `--no-remote-downloader` opts out.
- **Evidence for every invocation.** The project's **Bazel Cache** page shows transfer volume, read and write latency, throughput, and the action-cache hit rate. Each invocation separates action-cache lookups from CAS downloads, so a cold action cache looks different from a slow download. With [Bazel build insights](/en/docs-markdown/guides/features/build-insights/bazel), which setup also enables, the same invocation shows its critical path and the actions that dominated it. Pass `--no-build-insights` for a cache-only configuration.
- **One platform across build systems.** The same account serves the [Gradle](/en/docs-markdown/guides/features/cache/gradle-cache) and [Xcode](/en/docs-markdown/guides/features/cache/xcode-cache) caches, so organizations running several build systems manage one cache and one set of insights.
Set up a Bazel remote cache with Tuist
[Install the Tuist CLI](/en/docs-markdown/guides/install-tuist) on macOS or Linux, then run this from the root of the Bazel workspace:
tuist init # or: tuist auth login && tuist bazel setup bazel build //...
Setup writes `.bazelrc.tuist` with the remote cache, credential helper, compression, and Build Event Service settings, and adds `try-import %workspace%/.bazelrc.tuist` to `.bazelrc`. Commit the `try-import` line and `tuist.toml`, and add `.bazelrc.tuist` to `.gitignore`: it holds a machine-local credential-helper path and the nearest cache region, so every developer machine and CI job runs `tuist bazel setup` itself. Setup leaves a `.bazelrc` alone when it already configures a remote cache. The [Bazel getting-started guide](/en/docs-markdown/guides/get-started/bazel-project) covers the full flow, and the [CI guide](/en/docs-markdown/guides/integrations/continuous-integration) covers authentication per provider.
These Bazel flags shape how any remote cache behaves, including Tuist's:
| Flag or tag | What it does | | --- | --- | | `--remote_cache=grpcs://…` or `https://…` | Points Bazel at the cache and selects gR
Tuist is a build platform for engineering teams and their coding agents. It works with Xcode, Gradle, Bazel, Elixir, and Rust builds. Features vary by toolchain: Rust compilation caching is experimental, and Once support is in canary.
Other agents on tuist.
More agents from other plugins.
cavecrew-builder
AgentSurgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…
Questions about bazel-remote-cache.
- Which coding agents can use bazel-remote-cache?
- bazel-remote-cache installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.

