aspect) is a free, Apache-licensed task runner on top of Bazel. It replaces the shell scripts and CI YAML a Bazel monorepo accumulates (format pre-submits, lint enforcement, BUILD file generation, release delivery) with one tool that behaves the same on a laptop and in CI. Built-in tasks like aspect build and aspect test work out of the box, and custom tasks are Starlark functions you add to your repo and run as aspect <name>.
The CLI needs no account. Step 4 connects to Aspect Cloud, which needs a free account. Your existing bazel workflow keeps working alongside all of it.
1. Install the CLI
aspect-launcher binary as /usr/local/bin/aspect, using sudo, so it may prompt for your password. The launcher is a thin shim that downloads and runs the actual CLI, like bazelisk for Bazel, or nvm for Node.
See Install the Aspect CLI for other installation methods (Homebrew, GitHub Actions, bazel_env, manual download).
Verify the install:
2. Point aspect at a Bazel repo
- I already use Bazel
- I'm new to Bazel
aspect build, aspect test, and aspect run work in any existing Bazel workspace. cd into your repo and try them out:MODULE.bazel or WORKSPACE.bazel command, with the same flags and the same exit code, and adds:
- A status line summarizing the task and its phases (
🔨 Build,🧪 Test,🚀 Run) - Automatic retry on transient Bazel errors (
BLAZE_INTERNAL_ERROR,LOCAL_ENVIRONMENTAL_ERROR) - A consistent task lifecycle that CI integrations hook into (status checks, annotations, artifact upload)
3. Pin the CLI version
For reproducible builds across developers and CI, pin the CLI version in your repo. Connecting to Aspect Cloud in the next step needs v2026.41.24 or newer:.aspect/version.axl
aspect-cli binary the first time it’s needed, then caches it.
See Pin the Aspect CLI version for custom sources (local builds, internal mirrors, alternate registries).
4. Connect to Aspect Cloud
A remote cache means an action that has already run with the same inputs, platform and configuration comes back from the cache instead of running again. Sign up for an Aspect account. The Free tier needs no credit card to start; see pricing for its limits. Then log in:- With aspect
- With vanilla bazel
Add It connects the build to the remote cache and streams it to the Build Results UI. Off CI, a task builds locally unless you pass the flag, so you choose when to use the cache.
--remote to any task:remote cache hit. The CLI prints a link to the invocation in the Build Results UI, which shows the cache hit rate. aspect cache diff names any actions that missed.
Aspect Cloud local setup covers profiles, organizations, making the cache the default, and checking it all worked.
5. Share the cache with CI
Give CI jobs the same cache as your laptop.- Create an API token on the app’s API tokens settings page. Copy it when it’s displayed: it’s shown only once.
- Store it as a CI secret named
ASPECT_API_TOKEN. - Install the Aspect Workflows GitHub App (optional, for PR status checks and comments) on your GitHub org, and link it to your Aspect account. See GitHub App.
setup-aspect action:
.github/workflows/ci.yaml
bazel at the same cache, so bazel steps get it too. On CI, a task uses the cache without --remote.
Aspect Cloud CI setup covers Buildkite, CircleCI, GitLab CI and any other CI, and the setup step’s inputs. Running tasks in CI has complete pipeline examples for the Aspect CLI tasks.
Go further with the CLI
Discover what’s available
aspect <task> --help shows every flag for a specific task with its current default.
Customize tasks in config.axl
Built-in tasks accept configuration via .aspect/config.axl at the repo root. The file is evaluated once per invocation, locally and in CI.
This config activates a --config=ci group from your .bazelrc when the CI env var is set, and turns on test-log artifact upload for failures:
.aspect/config.axl
BazelTrait.extra_flags land in Bazel’s build rc section, so they reach every build-like invocation the CLI makes — build, test, run, coverage — but not bazel query, which keeps a build-only flag from breaking a task’s sidecar query. ArtifactUpload uploads test logs, BEP, Bazel profiles, and execution logs to your CI platform’s native artifact storage. Both are documented in aspect build & aspect test.
Write your first custom task
When the built-ins don’t cover what you need, write your own. Custom tasks are Starlark functions you register with thetask() built-in. Drop them in any .axl file inside .aspect/ and they’re auto-discovered as CLI commands (see How tasks are registered for the other registration paths):
.aspect/build-and-list.axl
aspect help and your new build-and-list task appears alongside the built-ins (the variable name’s underscores become dashes in the command):
Where to next
Speed up more of your builds- Aspect Cloud CI setup: the same cache for vanilla
bazelsteps on the CI runners you already have. - Aspect Workflows: remote execution and warm CI runners, and when you’d want Aspect Enterprise, an isolated deployment of your own.
- Tasks overview: every built-in task, with config options and CI examples.
- Run and define tasks: writing custom tasks, with arguments, processes, the filesystem, build queries, phases and cleanup.
- External AXL modules: extension libraries like
rules_lint, pulled in throughMODULE.aspect. - AXL reference: every type, function and module AXL exposes.

