Watch the cache work
A five-node recipe, run three times: cold, fully cached, and after one edit. Real output, replayed.
This is examples/02-pipeline from the repository. One recipe counts the words in every chapter, totals them, and writes a report. Three steps, five nodes.
recipe reportgather "chapters/*.txt"# fan-out: one count per chaptercook "build/counts/$<in.stem>.count" {wc -w < $<in> | tr -d ' ' > $<out>}# many-to-one: every count incook "build/total.txt" {cat $<in> | paste -sd+ - | bc > $<out>}# one step, two outputscook "build/report.txt" "build/report.csv" {...}
Cold, then cached, then one edit
The first run cooks all five nodes. The second run touches nothing: every key is already in the store. Then one chapter changes, and exactly the nodes downstream of it rebuild. The count for the other chapters, untouched, stays cached.
cook reportCooked report/build/counts/one.count in 1msCooked report/build/counts/three.count in 1msCooked report/build/counts/two.count in 1msCooked report/build/total.txt in 1msCooked report/build/report.txt in 2msFinished in 11ms (5 nodes, 0 cached)cook reportCached report (5 nodes)Finished in 1ms (5 nodes, all cached)sed -i 's/moon/sun and stars/' chapters/two.txtcook reportCached report/build/counts/one.countCached report/build/counts/three.countRebuilding report/build/counts/two.count — input changed: chapters/two.txtCooked report/build/counts/two.count in 1msRebuilding report/build/total.txt — input changed: build/counts/two.countCooked report/build/total.txt in 1msRebuilding report/build/report.txt — input changed: build/total.txtCooked report/build/report.txt in 2msFinished in 18ms (5 nodes, 2 cached)
one.count stayed cachedEach fan-out unit is keyed on its own input. Editing two.txt changes one key. The total depends on all three counts, so it rebuilds; so does the report, which depends on the total. That is the whole model: the key is built from what you declared, and nothing else.
See the key for yourself
cook why prints every determinant behind a unit’s key, with its hit or miss status. Ask it about the total:
cook why report/build/total.txtRead 9. Caching and cache trust for seal, the shared store, and cook cache verify.