- All playbooks
- Give shared cache writes deliberate ownership
Give shared cache writes deliberate ownership
Control which runs save shared cache entries so parallel jobs and pull requests do not compete to publish the same cache.
Compare approaches
How companies used this technique
Read what each company changed and follow the original sources.
Save shared caches only from the default branch
Buffa's tools-image build cache now saves only on pushes to main. Pull request and merge-queue runs restore from it, so their writes stop evicting the main entries every pull request starts from.
- Use it when
- Pull request or merge-queue runs write cache entries that no later run can restore, while the repository is near its cache quota.
- Before applying it
- Every run still restores the cache and builds cold when it misses.
Give concurrent cache writers deliberate ownership
Codex test, clippy and release-verification jobs competed to reserve the same immutable Bazel repository-cache key. Each job now gets a logical namespace with a matching fallback, shares one computed key between restore and save, and skips the save on an exact hit.
Each job saves under its own namespace and skips saving on an exact hit Source
- Use it when
- Parallel jobs report cache reservation collisions or restore an incomplete first writer's archive.
- Before applying it
- Separate namespaces add storage and cold misses. A shared producer can be better when the contents are identical; measure both.
Company Playbooks
- Read Anthropic’s playbookRun only affected tests
- Read DoorDash’s playbookRun build and test in parallel, sharded across CI agents
- Read Linear’s playbookBenchmark the same job on faster hardware
- Read Mastra’s playbookStarSling runners for the slowest test workflow
- Read OpenAI’s playbookRank CI fixes by the minutes they save
- Read Ramp’s playbookMove a CPU-bound test suite to a faster CPU
- Read Shopify’s playbookLet an agent iterate against one CI metric
- Read Spotify’s playbookBuild arm64 on native arm64 runners
- Read Stripe’s playbookRun only the tests a change can reach
- Read Uber’s playbookBuild the merge-queue speculations most likely to be needed