05Cache results
Find why a task missed the cache
A task ran when you expected a skip. Ask vx why:
vx why @demo/ui#buildRead the verdict
Section titled “Read the verdict”You edited packages/ui/src/index.ts and built. vx why compares this run with the one before:
Why @demo/ui#build run 01a209cb-579f-71e1-b5ba-9a1a6018b8c4 this run 2026-11-23T19:04:10.943Z · success · executed · key da8bbb5e7693ba71 previous 2026-11-23T19:04:10.632Z · success · executed · key 323a4fbfdde6fd8e verdict cache key changed: file packages/ui/src/index.ts
What changed 1 of 4 change kind name before → after changed file packages/ui/src/index.ts d00491fd7e5bb6fa28c517a0bb32b8b506539d4d → 0cfbf08886fca9a91cb753ec8734c84fcbe52c9f
What to do file an edit re-runs by design; a file the task does not read belongs out of inputs.filesFour parts, top to bottom:
| Part | Tells you |
|---|---|
| Why | both runs, each with its result and key |
verdict |
the answer in one line: what moved |
| What changed | each moved part, before and after; 1 of 4 means 1 of the key’s 4 parts moved |
| What to do | whether this is expected, and how to fix it if not |
The keys differ and the verdict names the file. That run was expected: you edited an input.
You can now find the one file that made a task run.
Follow it to the root
Section titled “Follow it to the root”@demo/web uses @demo/ui, so its build depends on @demo/ui#build. The same edit ran both:
vx why @demo/web#build Why @demo/web#build run 01a209cb-579f-71e1-b5ba-9a1a6018b8c4 this run 2026-11-23T19:04:10.990Z · success · executed · key 4b39fc8fe6cb1046 previous 2026-11-23T19:04:10.690Z · success · executed · key 5dffef39d12efd08 verdict cache key changed: upstream @demo/ui#build
What changed 1 of 5 change kind name before → after changed upstream @demo/ui#build 323a4fbfdde6fd8e → da8bbb5e7693ba71
Root cause @demo/web#build ← @demo/ui#build ← file packages/ui/src/index.ts
What to do file an edit re-runs by design; a file the task does not read belongs out of inputs.filesThe verdict says upstream @demo/ui#build: a task it depends on got a new key. Root cause follows the tasks back to the file you touched.
You can now trace a re-run through any number of tasks to the edit that started it.
Spot each kind of change
Section titled “Spot each kind of change”The kind column says what moved. Step through the three you meet most:
file: an input changed
verdict cache key changed: file packages/ui/src/index.tsThe edit above. What to do says an edit runs by design. If the task does not read that file, take it out of inputs.files.
env: a variable changed
@demo/web#build lists MODE in inputs.env. The last two runs had MODE=staging, then MODE=production:
$ vx why @demo/web#build
Why @demo/web#build run 01a209c1-1e0f-76ba-8830-5c5ac8b5bb21 this run 2026-11-23T18:53:00.858Z · success · executed · key dacc0c92098b463a previous 2026-11-23T18:53:00.245Z · success · executed · key f019b0fdc69a5ac5 verdict cache key changed: env MODE
What changed 1 of 9 change kind name before → after changed env MODE bc7ff980bab9217c → 11bb989f56d9506d
What to do env the variable's value moved; one the task does not read belongs out of inputs.envvx shows a hash of each value, never the value itself.
config: the task itself changed
The command in vx.config.ts became vite build --minify false:
$ vx why @demo/ui#build
Why @demo/ui#build run 01a209c1-2257-776d-aec6-52a982c786aa this run 2026-11-23T18:53:01.941Z · success · executed · key 498a9bc9f7d6cf6d previous 2026-11-23T18:53:00.845Z · cache-hit · up-to-date · key 69575ae4d3029055 verdict cache key changed: config
What changed 1 of 7 change kind name before → after changed config config e47ffa458aad2c6b → b5cea63a07bf16fc
What to do config the task's evaluated config changed (its vx.config or a file it imports); `vx show @demo/ui#build` prints it as it is nowvx show @demo/ui#build prints the task’s current config.
Check yourself You add README.md to packages/ui and build. vx prints up-to-date. What does vx why say?
cache key unchanged — this run was served from cache, nothing re-ran. README.md is not in
inputs.files, so the key did not move.
You can now tell a file, a variable and a config change apart at a glance.
Try it
Section titled “Try it”Make an edit, press Run, and read the reason vx gives for each task:
Change something. Press a chip again to undo it.
Run 2: 4 tasks, 4 up to date.
First run: the cache is empty
- @demo/ui#build
b16c73d4cache miss · ranprevious: none, first recorded run of this task
Nothing stored for this key yet, so the task runs and vx stores its result.
- @demo/web#build
ad572154cache miss · ranprevious: none, first recorded run of this task
Nothing stored for this key yet, so the task runs and vx stores its result.
- @demo/admin#build
99bc8534cache miss · ranprevious: none, first recorded run of this task
Nothing stored for this key yet, so the task runs and vx stores its result.
- @demo/api#build
7d3064decache miss · ranprevious: none, first recorded run of this task
Nothing stored for this key yet, so the task runs and vx stores its result.
$ vx run build --all ┌─ @demo/ui#build > $ vite build ✓ built in 416ms └─ @demo/ui#build ── (640ms) success ┌─ @demo/web#build > $ vite build ✓ built in 533ms └─ @demo/web#build ── (820ms) success ┌─ @demo/admin#build > $ vite build ✓ built in 462ms └─ @demo/admin#build ── (710ms) success ┌─ @demo/api#build > $ vite build ✓ built in 267ms └─ @demo/api#build ── (410ms) success tasks 4 success 4 total cache 4 miss
Second run: nothing changed
- @demo/ui#build
b16c73d4up to datecache key unchanged — this run was served from cache, nothing re-ran
Same key, and dist/ is already in place. Nothing runs, nothing is copied.
- @demo/web#build
ad572154up to datecache key unchanged — this run was served from cache, nothing re-ran
Same key, and dist/ is already in place. Nothing runs, nothing is copied.
- @demo/admin#build
99bc8534up to datecache key unchanged — this run was served from cache, nothing re-ran
Same key, and dist/ is already in place. Nothing runs, nothing is copied.
- @demo/api#build
7d3064deup to datecache key unchanged — this run was served from cache, nothing re-ran
Same key, and dist/ is already in place. Nothing runs, nothing is copied.
$ vx run build --all ┌─ @demo/ui#build > up-to-date • b16c73d4 ✓ built in 416ms └─ @demo/ui#build ── (5ms) up-to-date ┌─ @demo/web#build > up-to-date • ad572154 ✓ built in 533ms └─ @demo/web#build ── (5ms) up-to-date ┌─ @demo/admin#build > up-to-date • 99bc8534 ✓ built in 462ms └─ @demo/admin#build ── (5ms) up-to-date ┌─ @demo/api#build > up-to-date • 7d3064de ✓ built in 267ms └─ @demo/api#build ── (5ms) up-to-date tasks 4 success 4 total cache 4 up-to-date
What each task reads
| task | inputs.files | inputs.env | dependsOn | outputs.files |
|---|---|---|---|---|
| @demo/ui#build | src/**, vite.config.ts | — | ^build (none) | dist/** |
| @demo/web#build | src/**, vite.config.ts | MODE | ^build (@demo/ui#build) | dist/** |
| @demo/admin#build | src/**, vite.config.ts | — | ^build (@demo/ui#build) | dist/** |
| @demo/api#build | src/**, vite.config.ts | — | ^build (none) | dist/** |
| @demo/ui#test | src/** | — | ^build (none) | — |
| @demo/web#test | src/** | — | ^build (@demo/ui#build) | — |
| @demo/admin#test | src/** | — | ^build (@demo/ui#build) | — |
| @demo/api#test | src/** | — | ^build (none) | — |
| @demo/ui#lint | src/** | — | — | — |
| @demo/web#lint | src/** | — | — | — |
| @demo/admin#lint | src/** | — | — | — |
| @demo/api#lint | src/** | — | — | — |
Every task has cache: true. Git ignores *.log.
You can now predict a hit or a miss before you run.
PatternsCommon cases
A task runs every time
Section titled “A task runs every time”The verdict starts never cached. The task, or one it depends on, has no inputs, so each run makes a new key. Add inputs to the task the verdict names.
A task skipped when it should have run
Section titled “A task skipped when it should have run”vx why says the key did not move, so the file you changed is not an input. Add it to inputs.files and run vx lock.
Ask about an older run
Section titled “Ask about an older run”vx last --list lists recent runs. Pass one’s id to compare that run with the one before it:
vx why @demo/ui#build --run 01a209c0-fc0b-7616-8c58-7e50479c4225Read it from a script or an agent
Section titled “Read it from a script or an agent”--format json prints the same answer as one object:
vx why @demo/web#build --format json{ "taskId": "@demo/web#build", "diff": { "entries": [ { "kind": "upstream", "name": "@demo/ui#build", "change": "changed", "before": "235118720ed1a79b", "after": "693d3b58e7193bca" } ], "unchangedCount": 7 }, "roots": [ { "entries": [{ "kind": "file", "name": "packages/ui/src/index.ts", "change": "changed" }] } ]}Trimmed: the full object also holds both runs’ keys, times and results, and each root’s path of tasks.
You can now fix a task that never caches or one that never runs, and script the answer.
DetailsEvery option and kind
vx why (TASK | PKG#TASK) [--run RUNID] [--format pretty|json] [--cache-dir <path>]| Option | Default | What it does |
|---|---|---|
TASK or PKG#TASK |
required | the task to explain; build alone means the project in the folder you are in |
--run <id> |
the latest run | explain that run instead |
--format |
pretty |
json for one object |
--cache-dir <path> |
the workspace’s | read the cache a run with the same flag used |
kind |
Moved because |
|---|---|
file |
a file in inputs.files or inputs.workspaceFiles changed, appeared or went |
linked |
a symlink among the inputs points somewhere else |
env |
a variable in inputs.env changed |
runtime |
a command in inputs.runtime printed something else |
ws-runtime |
a command in inputs.workspaceRuntime printed something else |
upstream |
a task it depends on got a new key |
config |
the task’s config changed, or a file the config imports |
forward |
the arguments after -- changed |
plugin |
a plugin’s part of the key moved, such as the package’s dependencies in the lockfile |
platform |
the task ran on another platform |
format |
vx itself changed: a new vx version keys every task anew once |
vx why reads the run history in .vx/cache. vx cache clean empties it, so vx why has nothing to compare until two more runs.
Every verdict line vx prints: Caching. The command in full: vx why.