lathe 2.4.1 lathe-example/lathe18.4k stars

Tasks that remember what they already did.

lathe is an open-source task runner for monorepos. It hashes every input, caches every output and runs the rest in parallel, so a repeat build of 312 tasks takes 1.9 seconds instead of 38.6.

curl -fsSL https://lathe.example/install.sh | sh
  • binary 7.8 MB, written in Rust, no runtime
  • license MIT or Apache-2.0
  • released
1shell ~/acme-monorepo
~/acme-monorepo on main $ lathe run build
lathe 2.4.1 acme-monorepo 48 packages 312 tasks
hashing 1,904 inputs [========================] 100% 0.21s
hit @acme/tokens:build replayed 0.01s
hit @acme/config:build replayed 0.01s
hit @acme/icons:build replayed 0.02s
+ 300 more hits, replayed from ~/.cache/lathe
ran @acme/ui:build 1.12s src/Button.tsx changed
ran @acme/forms:build 0.64s
ran @acme/web:build 1.31s
+ 6 more ran: typecheck x3, docs, admin, storybook
done 312 tasks 303 cached 9 ran 2.7s (cold: 38.6s)
~/acme-monorepo on main $ lathe why @acme/ui:build
miss because 1 input changed since 09:58
src/Button.tsx 3f1a09c -> 9c2e4b7
unchanged: command, 211 other inputs, env, node 22.11.0
type help, or pick a command below

A simulated shell. Type a command and press Enter. Tab completes, up and down arrows walk the history, Control L clears.

2features lathe/docs

Declare a task once. lathe works out the rest.

Pick a file. Arrow keys move through the tree.

docs/
  • cache/
preview

docs/lathe.toml

One small file per package

Each package says what a task runs, what it reads and what it writes. Dependencies point at other tasks, and ^build means "build whatever I depend on first". That is the whole configuration: no plugins, no scripts to keep in sync with package.json.

# packages/ui/lathe.toml
[tasks.build]
run     = "tsc -b && vite build"
inputs  = ["src/**", "tsconfig.json", "package.json"]
outputs = ["dist/**"]
deps    = ["^build"]   # my dependencies first

[tasks.test]
run     = "vitest run"
deps    = ["build"]
passEnv = ["TZ"]       # part of the cache key

docs/graph.md

The graph runs as wide as your machine

lathe reads every lathe.toml in the repo, builds one task graph and starts everything whose dependencies are done, up to one job per core. Nothing waits in a queue it does not need to. Print the graph to see why a task runs when it does.

$ lathe graph build --filter @acme/web
@acme/web:build
  needs @acme/ui:build
    needs @acme/tokens:build
    needs @acme/icons:build
  needs @acme/forms:build
    needs @acme/ui:build  (shared)
6 tasks, critical path 3, 12 cores

docs/cache/local.md

A cache keyed by what went in

The cache key is a BLAKE3 hash of the task's input files, its command, the env vars in passEnv and the toolchain versions. A hit restores the outputs and replays the logs, in 4 ms on average. The cache lives in ~/.cache/lathe and evicts the least recently used entries past 10 GB.

$ lathe cache stats
entries      18,226
size         6.4 GB of 10 GB
hit rate     97.1% over the last 7 days
saved        41 h 12 min of task time

docs/cache/remote.md

Build it once for the whole team

Point lathe at a remote cache and a task one person ran is a hit for everyone else and for CI. Use Lathe Cloud or any S3-compatible bucket you run yourself. Artifacts are signed with your team's ed25519 key and checked before anything is restored.

$ lathe login --team acme-eng
$ export LATHE_REMOTE=https://acme-eng.lathe.example
$ lathe run build
  hit @acme/web:build  remote, 41 MB in 0.8s

docs/watch.md

Watch mode that only reruns what changed

lathe dev watches the declared inputs, not the whole tree. A save is debounced for 40 ms, then only the affected tasks rerun, in graph order. It uses the native file events on each platform, so it stays quiet at 1,900 files and at 190,000.

$ lathe dev web
watching 1,904 inputs in 48 packages
10:42:07 src/Button.tsx changed
  ran @acme/ui:build    1.12s
  ran @acme/web:build   1.31s
  45 tasks untouched

docs/why.md

Every cache miss comes with a reason

When a task runs that you expected to be cached, ask. lathe why compares the last two keys and names the exact file, env var or version that changed, with the old and new hash.

$ lathe why @acme/ui:build
miss because 1 input changed since 09:58
  src/Button.tsx   3f1a09c -> 9c2e4b7
unchanged: command, 211 other inputs, env, node 22.11.0

docs/sandbox.md

Undeclared inputs get caught, not cached

A task that reads a file it never declared would make a cache hit wrong. On Linux lathe runs each task in a mount namespace that only shows its inputs. On macOS and Windows it records file access and warns after the run. Turn warnings into errors with strict = true.

$ lathe run test --strict
  err @acme/api:test
      read undeclared file ../../.env.local
      add it to inputs, or to passEnv if it is config
3bench acme-monorepo, 48 packages, 312 tasks

Same repo, three runners, three situations

Every task from scratch. lathe has nothing cached yet, so it wins on parallelism alone.

npm scripts, serial252.0 s
Makefile, -j871.4 s
lathe38.6 s

lathe is 6.5x faster than serial npm scripts and 1.8x faster than make -j8 here.

Median of 10 runs. a 12-core arm64 laptop with 36 GB, Node 22.11. The CI runs use a fresh 4-core Linux runner with lathe's remote cache warm from main. Reproduce with lathe bench --repo acme-monorepo.

4install

One binary. Pick how it gets there.

macOS 12 or later, Apple silicon and Intel

brew install lathe-example/tap/lathe
lathe init

lathe init reads your workspaces and writes a starter lathe.toml for each package. Nothing else on disk changes.

x86_64 and aarch64, glibc 2.28+ or musl

curl -fsSL https://lathe.example/install.sh | sh
lathe init

The script installs to ~/.local/bin and checks the sha256 against the release manifest before it moves anything there.

Windows 10 and 11, x64 and arm64

winget install LatheExample.Lathe
lathe init

Paths over 260 characters work since 2.4.1. Run from PowerShell, cmd or Git Bash.

Pins the version per repo. Pulls the right binary for each machine.

npm install --save-dev @lathe-example/cli
npx lathe init

The package is 9 KB. Its postinstall fetches one 7.8 MB binary for your platform, musl on Alpine.

Check it worked:

$ lathe --version
lathe 2.4.1 (a3f9c21 2026-11-18)
5log git log --graph v2.3.2..v2.4.1

What changed in the last three releases

* a3f9c21 (HEAD -> main, tag: v2.4.1) fix(watch): keep events when APFS renames a directory
* 6d02e8b fix(windows): paths over 260 characters in outputs
* 8e1d0b4 perf(hash): hash inputs in parallel, cold start 2.1x faster
*   51c7e9a Merge pull request #1184 from tw/s3-remote-cache
|\
| * 0b2d6f3 feat(cache): any S3-compatible bucket as a remote cache
| * c94a1e7 test(cache): eviction stays under the 10 GB cap
| * 2e88f10 feat(cache): sign artifacts with the team ed25519 key
|/
* 77f02aa (tag: v2.4.0) feat: lathe why <task> explains every cache miss
* 19b4c3d feat(graph): --format dot and --format json
*   e5a7d92 Merge pull request #1150 from pr/watch-debounce
|\
| * 4f61aa8 perf(watch): 40 ms debounce, batch reruns per package
|/
* d83c0e5 fix: env vars in passEnv are now part of the cache key
* 0a9f7b2 (tag: v2.3.2) fix(npm): postinstall picks musl on Alpine

61 releases since 2023. Each one is signed, with notes and checksums, on the releases page. Who reviews these

6pricing the CLI is free; Cloud is the shared cache

Free on your laptop. Pay when the cache is shared.

Plans compared. Prices in US dollars, per seat.
Featureopen sourceteambusiness
per seat $0 forever $12 / month $29 / month
for 8 seats $0 $96 / month $290 / monthbilled for the 10 seat minimum
seatsany2 to 5010 to 250
local cacheyesyesyes
remote cachebring your own bucket100 GB hosted1 TB hosted
retentionyour call14 days90 days
CI time reportnoweeklyper pipeline
sign-innone neededyour git hostSAML, SCIM
self-hosted cache nodenonoyes
audit lognonoyes, 1 year
supportforumemail, 1 business day4 hours, shared channel
Get started install start trial start trial

Both paid plans start with a 14-day trial and no card. Prices exclude VAT. Yearly is billed up front at ten times the monthly price. Open-source projects get Team free: ask in the forum.

7cloud lathe cloud init

Create a team workspace

14 days free, no card. Tab moves between fields, Enter submits.

.lathe.example

3 to 32 characters: lowercase letters, digits and hyphens.

plan

8 seats on team: $96 / month after the trial
or press Enter
8faq

Questions people ask in the forum

install/

Does lathe replace npm, pnpm or cargo?

No. It runs the scripts and commands you already have and keeps your package manager in charge of dependencies. lathe init reads your workspaces from package.json, pnpm-workspace.yaml or Cargo.toml.

Which platforms are supported?

macOS 12 or later on Apple silicon and Intel, Linux on x86_64 and aarch64 with glibc 2.28+ or musl, and Windows 10 and 11 on x64 and arm64. Every platform runs the same test suite on each release.

cache/

What goes into a cache key?

The contents of every declared input, the command string, the env vars listed in passEnv, the lathe version and the versions of the toolchains the task uses (node, rustc, go). Timestamps and absolute paths are left out, so keys match across machines.

Can a cache hit ever be wrong?

Only if a task reads something it did not declare. That is what the sandbox is for: on Linux the undeclared file is invisible, elsewhere lathe warns after the run, and with strict = true the task fails instead of being cached.

cloud/

Does the CLI phone home?

No. There is no telemetry in the CLI. Lathe Cloud only sees the artifacts you push to it and the request logs for your workspace, which you can read in the audit log on Business.

What happens if we stop paying?

The workspace turns read-only for 30 days so you can export it with lathe cache pull --all. The CLI keeps working against your local cache or any bucket you point it at.

project/

Who pays for lathe?

Cloud subscriptions pay the four maintainers listed below. The CLI is MIT or Apache-2.0 and stays that way; there is no paid CLI edition and no feature gate in the binary.

How do I contribute?

Pick an issue labelled good-first-task, comment that you are on it, and open a draft pull request early. A maintainer replies within two working days. 214 people have had a change merged so far.

MAINTAINERS

Four people review every change

handlenameareabased in
@inesokInes Okaforcore, task graphLisbon
@twTomasz Wronacache, CloudGdansk
@prPriya RamanWindows, watch modePune
@ezraEzra Lindqvistdocs, releasesUmea

214 contributors, 61 releases, 2,930 closed issues. Started in 2023 as a weekend Makefile replacement for one team's 9-package repo.

keyboard shortcuts
?
open this list
/
focus the shell
1-8
jump to a pane
j k
next and previous pane
t
cycle the theme
esc
leave the shell, close this
tab
complete a command
up down
walk the history
ctrl l
clear the screen
ctrl c
stop what is running
enter
run, or submit a form