Does Earthly Remember Between Runs? A Layer Cache Carries Your Build Forward. The Next Run Still Starts Without the Last One's Conclusions.
Does Earthly Remember Between Runs? A Layer Cache Carries Your Build Forward. The Next Run Still Starts Without the Last One's Conclusions. Earthly remembers a build in the ways a reproducible build tool should. It caches the layers a target produced, so unchanged steps are skipped next time. It persists cache mount directories, so a compiler does not start from an empty cache on every run. What a new run does not inherit is what the previous run figured out: which test failure an AI step judge
Does Earthly Remember Between Runs? A Layer Cache Carries Your Build Forward. The Next Run Still Starts Without the Last One's Conclusions.
Earthly remembers a build in the ways a reproducible build tool should. It caches the layers a target produced, so unchanged steps are skipped next time. It persists cache mount directories, so a compiler does not start from an empty cache on every run. What a new run does not inherit is what the previous run figured out: which test failure an AI step judged to be flaky, or why a dependency upgrade was cleared as safe. The next run starts with the Earthfile, its arguments, and its secrets, and nothing the last run learned.
A build is a graph of targets, and each target starts fresh
Earthly combines Dockerfile syntax with Makefile-style targets in a single Earthfile. Each target runs in an isolated container, targets declare dependencies on each other, and the build graph executes in the right order, in parallel where dependencies allow. That isolation is what makes a build behave the same on a laptop and in CI.
Isolation also defines what can persist. When a target finishes, its container is gone. A file produced inside one target reaches the next one only when explicitly passed, with SAVE ARTIFACT in the producing target and a COPY from that artifact in the consuming one. Everything that survives a run survives through an explicit caching or output mechanism, and each was designed for build speed and outputs, not for knowledge.
Layer caching remembers unchanged work, keyed by its inputs
The first mechanism is layer-based caching, the heart of how Earthly works. Most commands create a cache layer as they execute. When a target runs again, Earthly walks the layers from the bottom up: if a command's inputs are unchanged, the cached layer is reused and the command is skipped. The inputs are concrete: the ARG values in effect, the files brought in by a COPY, and the command itself. Change any of them and that layer, plus every layer on top of it, re-executes.
This works like Dockerfile layer caching, widened to the whole build. It is also a memory with one question in it: has this exact step, on these exact inputs, already been done? A cache hit hands the new run the old output, faster, and nothing else. A step that reuses a cached layer does not learn what an AI review concluded about the code, because none of that was ever an input to the layer.
Cache mounts persist directories, and directories only
The second mechanism covers what layers cannot express well. A cache mount, declared with RUN --mount type=cache or the CACHE command, is a directory whose contents persist between runs. Its documented job is to hold the working files of tools that cache incrementally on their own: intermediate files for incremental compilers, or downloaded dependencies, so the next build finds them warm.
A cache mount is the widest road data can travel between two Earthly runs, and it still moves directories only. A later run can mount the directory and find files. It cannot find the reasoning that decided a flaky test could be ignored this week, because reasoning is not a file the build wrote into the mount, in a format the next target was taught to read. Anything carried forward as knowledge has to be placed there deliberately, in a format the team invents and maintains by hand.
Where the cache lives decides whether even the speed survives. On a developer machine, the local cache persists. On an ephemeral CI runner, discarded after one job, the local cache goes with the machine. Earthly's answers are remote caching through a registry, with the --remote-cache flag, and remote runners that keep the cache close to where builds execute.
Arguments and secrets configure a run; they do not learn from one
The third thing a run starts with is its standing configuration. Build arguments are declared with ARG, overridden per invocation, or supplied through a .arg file. Secrets are passed in with --secret at run time, so credentials reach the build without living in the Earthfile. Auto-skip, the third caching feature, can skip large parts of a build when nothing relevant changed, which is again a decision about work, not a transfer of knowledge.
Every one of these values is written by a person or by setup tooling, and only read by runs. No target can update an argument as a side effect of what it discovered and have the next run pick that discovery up as knowledge. Build logs sit in the same position: a record a person reads after the fact, never working state the next run begins with. Teams that need findings to survive build the bridge themselves: a report committed back, a database row, a note in an external system a later target is taught to fetch.
Where an AI step falls through
Add an AI step and the gap becomes concrete. Suppose a target asks an AI agent to triage failing tests, separate real regressions from flakes, and note which is which. Inside that run, the finding can travel: returned as output text, written into a saved artifact, stored in a cache mount. The next run starts from the Earthfile, the trigger, and the standing arguments. Unless someone wired that artifact into the next target's first steps as a briefing, the finding is effectively gone, so the agent triages the same failures from zero and the same investigation is paid for on every run. A dependency audit or release check follows the same pattern: Earthly offers its reasoning two exits, a file or a log, and neither leads into the next run's memory on its own.
Give the agent a memory that outlives the build
The missing piece is a memory layer outside the build, read at the start of every run. That is the job Vilix AI is built for. Vilix AI is cloud-hosted memory for AI tools and agents, connected over MCP, so there is no infrastructure to run, no database to maintain, and no state file to smuggle through a cache mount.
Because the memory lives outside any one tool, the same memory is available everywhere: the agent inside an Earthly target, the coding assistant on a laptop, and the chat tool used to plan the change all read and write one shared memory. Vilix AI keeps full conversation history, not just extracted facts, so a later run can recover what was decided and why a path was abandoned. A flaky-test finding from Monday's run is there when Wednesday's run starts, and the investigation happens once.
Getting started costs nothing to test: the free plan is free forever, and the Pro trial runs 7 days with no card required. Your memory stays yours, with export and delete anytime.
Earthly's caches are the right tools for build speed. Conclusions need a different home: one memory, kept outside the run, that every agent reads before it starts and writes to before it finishes. Give a scheduled agent that, and each run begins where the last ended.