---
title: "Warm reusable caches while building the image"
description: "Prepare image-local caches before normal CI runs so repeated downloads or cold initialization leave the critical path."
url: https://starsling.dev/ci-playbooks/techniques/warm-image-caches
canonicalUrl: https://starsling.dev/ci-playbooks/techniques/warm-image-caches
---

# Warm reusable caches while building the image

Prepare image-local caches before normal CI runs so repeated downloads or cold initialization leave the critical path.

## How to choose an approach

This technique currently has one documented company example. Validate its prerequisites, tradeoffs and original CI environment against your repository before adapting it.

- **[Ramp](https://starsling.dev/ci-playbooks/ramp#warm-image-with-a-test-run)**: Use it when Jobs spend much of each run installing dependencies and building before any test runs, and they can start from a prebuilt image or a restored cache. Check before adopting: The warm caches are as current as the last image build, so rebuild the image on each push to the default branch and keep the job working from a cold start. Adapted for GitHub Actions; compare the original system with yours.

## Apply this technique

````text
Evaluate and apply this CI technique to my repository: Warm reusable caches while building the image.

Prepare image-local caches before normal CI runs so repeated downloads or cold initialization leave the critical path.

Read the technique and its source-backed company examples: https://starsling.dev/ci-playbooks/techniques/warm-image-caches.md

Inspect this repository’s CI workflows, build and test commands, dependencies, and recent run timings. Identify where this technique applies and explain the expected benefit using this repository’s evidence.
Measure a baseline from recent comparable runs: elapsed time, queue time, runner minutes and failures where available. If data is unavailable, say what cannot be measured.
Compare relevant company approaches, checking prerequisites, platform differences and tradeoffs. Rank applicable options by evidence, fit and measurable opportunity; do not present company results as predictions for this repo.
Recommend the smallest safe change, show what checks and fallback paths remain, and ASK ME WHICH CHANGE TO APPROVE BEFORE EDITING ANY FILES.
Only after approval, work on a new feature branch, make one reversible change, and open a reviewable pull request. Never merge or push to a default or protected branch.
Keep required checks, test coverage, deployment and release behavior intact. Validate the change and compare equivalent runs where possible; report limitations and what should be monitored after merge.
````

## How Ramp used this technique

Read what Ramp changed and follow the original sources.

### Ramp: Run the app and test suite once in the image build to warm its caches

**Translated to GitHub Actions**

- What Ramp built: Ramp builds the repository images its background agent's sandboxes start from, and runs the app and test suite once in that build so the cached files they write are already there.
- Your GitHub Actions version: A prebuilt runner or container image, or a cached setup step, that installs dependencies and runs the app and test suite once so their caches are warm when the job starts.

Ramp tells teams building a background coding agent to move as much as they can into the build step for the repository images its sandboxes start from, and to do everything a complete development environment needs beforehand. That includes running the app and the test suite once, because those runs may write cached files a second run will use. The image build can take as long as it needs, since every session starts from the last built image. The OPT72 recipe moves setup off the long pole; here the image build also warms the caches the app and test suite write.

Evidence: Company-reported result or observation

2026: Ramp's agent sessions start from the last built repository image, so the image build's time stays out of every session. ([Source](https://builders.ramp.com/post/why-we-built-our-background-agent))

Use it when: Jobs spend much of each run installing dependencies and building before any test runs, and they can start from a prebuilt image or a restored cache.

Before applying it: The warm caches are as current as the last image build, so rebuild the image on each push to the default branch and keep the job working from a cold start.

GitHub Actions adaptation: Compare the source system with your own workflow before applying this translation.

[Read more in the Ramp playbook](https://starsling.dev/ci-playbooks/ramp#warm-image-with-a-test-run)

[Primary source](https://builders.ramp.com/post/why-we-built-our-background-agent)

## CI optimization is continuous work.

Apply this technique yourself, or use StarSling Runners for faster GitHub Actions and optional agent-driven optimization PRs, which teams on eligible paid plans can turn on.

[Get self-improving CI](https://starsling.dev/products/runners)

## Related techniques

### [Keep prepared environments ready for agent work](https://starsling.dev/ci-playbooks/techniques/warm-agent-environments)

Move repeated provisioning and setup into prepared environments so agent sessions can start from a usable workspace.

2 implementations · 2 companies (DoorDash, Shopify)

## Company Playbooks

### [Anthropic](https://starsling.dev/ci-playbooks/anthropic)

Run only affected tests

### [DoorDash](https://starsling.dev/ci-playbooks/doordash)

Run build and test in parallel, sharded across CI agents

### [Linear](https://starsling.dev/ci-playbooks/linear)

Benchmark the same job on faster hardware

### [Mastra](https://starsling.dev/ci-playbooks/mastra)

StarSling runners for the slowest test workflow

### [OpenAI](https://starsling.dev/ci-playbooks/openai)

Rank CI fixes by the minutes they save

### [Ramp](https://starsling.dev/ci-playbooks/ramp)

Move a CPU-bound test suite to a faster CPU

### [Shopify](https://starsling.dev/ci-playbooks/shopify)

Let an agent iterate against one CI metric

### [Spotify](https://starsling.dev/ci-playbooks/spotify)

Build arm64 on native arm64 runners

### [Stripe](https://starsling.dev/ci-playbooks/stripe)

Run only the tests a change can reach

### [Uber](https://starsling.dev/ci-playbooks/uber)

Build the merge-queue speculations most likely to be needed
