takt.yml
Takt needs no config: takt run -- <command> runs anything in the project’s .devcontainer/ or Dockerfile, sized from history, wherever there is room. takt.yml is optional. It names the jobs a project runs again and again, so agents type takt run test. takt init writes a commented one.
image: .devcontainer # optional; detected otherwise
prepare: bin/setup --skip-server
secrets:
RAILS_MASTER_KEY: { from_file: config/master.key }
OPENAI_API_KEY: $(pass show openai/api-key)
GITHUB_TOKEN: # bare: the submitter's GITHUB_TOKEN
jobs:
lint: bin/rubocop
test:
run: bin/rails test
mem: 6G
system:
run: bin/rails test:system
cores: 4
timeout: 30m
artifacts: tmp/screenshots/
ios:
run: xcodebuild test -scheme App -destination 'platform=iOS Simulator,name=iPhone 16'
runs-on: [darwin, xcode]
render:
run: script/render
runs-on: nvenc
gpu-mem: 8G
takt run test # a named job
takt run --mem 10G system # flags win over takt.yml
takt run --detach lint # returns the job id at once
takt run -- bin/rails test # any command, as always
Over MCP, run takes job instead of command: {"job": "test", "work_dir": "/path/to/repo"}.
Top-level keys
| Key | Description |
|---|---|
image |
The image Linux jobs run in: an image name, a Dockerfile path, or .devcontainer. Leave it out to detect .devcontainer/, then a root Dockerfile. A devcontainer’s compose services start beside the job as sidecars. A job’s output says in one line when a built image is ready (takt: image ready (all 9 steps cached, 0.4s)); a failed build prints its whole log. |
prepare |
A command run before each job, inside its image or macOS VM. A failure fails the job. |
secrets |
Secrets every job gets. See Secrets. |
windows |
What the project’s Windows jobs need. See Windows jobs. |
with |
Other local git repositories every job builds against, one or a list, relative to takt.yml’s folder or absolute. See Build against another local repository. |
local |
Commands the agents’ hook lets run in the agent’s session, one or a list. See Commands that stay local. |
hook |
What the agents’ hook does with heavy work started in an agent’s session: rewrite (the default) runs it as a Takt job in place, deny refuses it with the takt run line to use. TAKT_HOOK=deny in the environment does the same for every project. See the hook. |
jobs |
Named jobs: a command (lint: bin/rubocop) or the keys below. |
Job keys
| Key | Description |
|---|---|
run |
The command, run with sh -c. Required. |
runs-on |
What the job needs, one or a list: darwin, xcode, ios-simulator, windows, arm64, amd64, or a GPU capability (cuda, nvenc, vaapi, vulkan, opengl, rocm, metal). Never a machine. |
cores, mem |
Cores and memory (512M, 6G). Leave them out to size from history. |
gpu-mem |
GPU memory (8G). |
timeout |
Seconds or a duration (25m). Default one hour. |
priority |
P0 (landing) to P3 (idle). Default P1. |
here |
true runs it on the submitting machine, in the checkout as it is. Only for jobs that need that machine’s running services or attached devices. |
env |
Plain environment variables. Not for secrets. |
secrets |
This job’s own secrets, on top of the top-level ones. |
artifacts |
Paths, globs or folders copied back to the working directory after the job, passed or failed. |
with |
This job’s own local repositories to build against, on top of the top-level ones. |
Flags on the command line win over a job’s keys. --feature, --env, --artifact and --with add to them. Every job gets TAKT_JOB_ID, TAKT_CORES and TAKT_MEM_MB in its environment, so parallel suites can size themselves, and the well-known worker counts (PARALLEL_WORKERS, OMP_NUM_THREADS, CARGO_BUILD_JOBS, GOMAXPROCS, MAKEFLAGS=-jN, CMAKE_BUILD_PARALLEL_LEVEL, PYTEST_XDIST_AUTO_NUM_WORKERS) set to its cores unless env: or --env sets them (see visible cores).
Build against another local repository
An app often builds against a library you are changing in a checkout beside it, not pushed yet. --with <folder> (repeatable), or with: in takt.yml, ships that repository with the job the way Takt ships the job’s own: its HEAD plus uncommitted edits and untracked files that aren’t gitignored.
Each repository is checked out where it sits relative to the job’s own on your machine. With the app at src/app and the library at src/fastlib, the job’s root holds app/ and fastlib/ side by side, so the app’s ../fastlib resolves in a container, a macOS VM or a Windows VM alike.
cd ~/src/app
takt run --with ../fastlib -- cargo test
with: ../fastlib # every job; relative to this file's folder
jobs:
test:
run: cargo test
with: [../fastlib-ui] # this job too
Each job also gets TAKT_WITH_<NAME>, the absolute path of each repository in the job: ../fastlib sets TAKT_WITH_FASTLIB, ../fast-lib sets TAKT_WITH_FAST_LIB.
Point the dependency at the folder by a relative path:
- Cargo: a
[patch]in an untracked.cargo/config.tomlin the app (untracked files ship, gitignored ones don’t), for example[patch."https://github.com/example/fastlib"]withfastlib = { path = "../fastlib" }. The patch changesCargo.lock, so leave out--lockedfor these runs. - npm and pnpm:
"fastlib": "file:../fastlib", or a pnpm override tolink:../fastlib. - Go: an untracked
go.workwithuse ( . ../fastlib ), or areplaceingo.mod.
Takt refuses a folder that isn’t in a git repository, repositories that share no folder below the filesystem’s root, one repository inside another, and two with the same folder name. An identical job attaches to a running one only when every --with snapshot matches too. The image is built from the job’s own repository only, so a library change never rebuilds it. A --here job ships nothing and still gets TAKT_WITH_<NAME>.
Secrets
Each secret is an environment variable in the job, read on the submitting machine and sealed to the worker that runs it:
| Form | Value from |
|---|---|
NAME: |
the submitter’s NAME |
NAME: { from_env: OTHER } |
the submitter’s OTHER |
NAME: { from_file: config/master.key } |
a file in the repository |
NAME: $(pass show api/key) |
expanded like a double-quoted .env value |
How they travel and who can read them: Keep secrets.
Commands that stay local
The agents’ hook keeps a coding agent from starting a test runner, a build, a container, a browser, a server, a render or an eval in its own session: it moves the command into a Takt job (or, with hook: deny, refuses it with the takt run line to use). local lists what this project lets run in the session anyway:
local:
- go vet
- bin/rails test test/models/** test/helpers/**
- bundle exec rspec spec/models/**
A pattern is the command’s first words, then optionally globs. Without globs it allows the command with any arguments (go vet allows go vet ./...). With globs, every other argument the command is given must match one of them, and it must name at least one: bin/rails test test/models/user_test.rb:12 runs in the session, while bin/rails test, bin/rails test test/system/upload_test.rb, and a run that mixes the two still go to Takt. * stays within a folder, ** doesn’t; options (--verbose) are skipped, so an option’s value has to match too (-n=/name/ is one word). local covers the session only, never the same command over ssh.
Keep it to tests that start nothing else: no browser, app server, database or parallel workers.
Windows jobs
Declare what Windows jobs need once. Takt installs it into the project’s own Windows image, and every Windows job starts from a fresh copy of it.
windows:
setup: |
winget install --id RubyInstallerTeam.RubyWithDevKit.3.4 -e --silent --accept-package-agreements --accept-source-agreements
gem install bundler
env:
RUBYOPT: -W0
jobs:
test-windows:
run: bundle install && bundle exec rspec
runs-on: windows
setup is PowerShell, one step a line, run as the VM’s administrator. The first job builds the image and says how far it got; later jobs start from it at once. The image is keyed by a hash of setup, env and the base image, so every checkout with the same setup shares it. A failing setup fails the job with its log, and isn’t tried again until something changes or a day passes.
Errors and older files
A key Takt doesn’t know is named in one line and ignored, so a newer takt.yml still runs on an older Takt. A bad value is an error with the file, line and key:
takt: takt.yml:7: jobs.test.mem: "6Q" is not a size (use 512M or 6G)
Takt still reads a takt.toml from an earlier Takt, for now, and says so on every run that reads it. Next to a takt.yml it fills in only what takt.yml leaves out. takt config migrate writes the takt.yml for you.