Caching
Hod has two caches. The step cache skips work: a step whose inputs didn't change isn't run, and its results are restored. The dependency cache only makes a job faster: it keeps directories such as a package manager's downloads between runs.
The step cache
cache.inputs on a step lists the files and directories its result depends on. When nothing the step depends on changed (those files, its script, its variables, the job's image, and the files it got from the jobs it needs), the step is skipped and its files and outputs are restored.
Patterns use *, which stays within a directory, and **, which crosses them. A directory name covers everything under it, and ./src is the same as src. Use it on steps whose result depends only on those inputs.
The dependency cache
cache: on a job restores directories before the first step that runs, and saves them when the job succeeds. Each entry is a preset name or a map with paths (directories to keep) and key_files (files whose contents make the key, such as lock files).
The presets are npm, pip, go and rust (cargo's registry and git checkouts): cache: [npm]. hod plan --expand shows what a preset becomes. Paths are expanded in the job's environment, so $HOME is the container's, ~/ is $HOME/, and a relative path is inside the workspace. Without an entry for the key, the newest entry of the same paths, job and image is restored, and a new one is saved when the job succeeds.
What is never cached
Tag runs, and jobs that hold a secret, an identity or push:, use neither cache: they build from scratch, so nothing another job wrote reaches what they release. A step with push:, secrets: or identity: can't have cache:.
fresh: true does the same for a job that holds none of those but whose output ships, such as a build whose files a publishing job needs:. A fresh job restores and saves no cache, a component's included, and cache: on it, or on one of its steps, doesn't compile.