1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# magi competing on its own repository.
#
# **Only what is peculiar to this checkout lives here.** The roster, the seat
# assignment, the shape of a run and the update policy moved to the machine
# layer (`<config_dir>/magi/config.toml`), because none of them are facts about
# this repository: they are facts about which agent CLIs are installed and what
# the operator is willing to spend. Stating them once there is the point of
# having layers, and it keeps this file to the things a different machine would
# still need to be told.
#
# What that leaves, and why each one has to be here:
#
# - `[verify]` runs `cargo`. A repository that is not Rust cannot inherit it.
# - `[merge] base` names this repository's branch, and is required at all
# because of how this checkout is set up (see below).
# - `[prompts]` are this project's conventions.
#
# Note that an array may be declared in exactly one layer
# (`Config::refuse_split_arrays`), so `[verify]`'s arrays being here is also
# why the roster's arrays are *only* over there.
#
# Rendered by teravars. Tera braces are live everywhere in this file, but
# comments are stripped before Tera sees them (teravars >= 0.2.2), so a comment
# may quote `{{ ... }}` freely.
[]
# Shared build cache for the verification commands. Override per machine with
# MAGI_CACHE. Lives beside its only consumer: `[vars]` is rendered per file, so
# a value used by this file's templates is stated in this file.
= "{{ env.MAGI_CACHE | default(value='/tmp') }}"
[]
# Shared by default. Use --build-cache isolated for a task that needs its own
# worktree targets without changing these verification commands.
# `e2e` and `gate` together are exactly `cargo make check` (what CI runs), and
# each half runs once: the tests in `e2e`, everything else in `gate`.
#
# They used to overlap completely - `e2e` was `cargo test --all-targets` and
# `gate` was the whole of `cargo make check`, tests included - so every run paid
# for the suite at least twice on the same commit. Measured on this repository
# in November 2026 (59 runs): the suite ran 3.6 times per gated run on average,
# a passing `e2e` took 36 min (median) and the gate another 42 min, and with
# verification serialised on the shared build cache that is what the queue
# behind it waited on.
#
# Dropping the tests from the gate loses nothing, because magi already binds
# `e2e` to the commit that lands: `graph::verify_current_head` runs `e2e` again
# whenever HEAD is not the SHA it last passed on (after `pre_gate` commits, after
# a gate repair, after a base sync), before the gate and after it. A tree cannot
# reach the merge without the tests having passed on that exact SHA.
# `tests/verify_covers_check.rs` fails if the two halves stop adding up to
# `check`.
#
# The real-machine leg, run in the winner's worktree once a round has no
# blocking finding left. `cargo make test` runs lib, bin, and integration tests
# under cargo-nextest (`PJ_RUST_TEST_RUNNER = "nextest-unit"` in `Makefile.toml`
# `[env]`, matching `.github/workflows/ci.yml` and `.config/nextest.toml`), plus
# examples, benches, and doc tests via `cargo test`; without cargo-nextest on
# PATH it warns and falls back to `cargo test --locked --all-targets`.
#
# CARGO_TARGET_DIR is shared on purpose: each candidate worktree would otherwise
# compile this crate from scratch, which is by far the slowest thing in a run on
# a Rust repo (minutes, against ~90 s of agent latency per node). Only the
# winner's worktree runs these commands, and only one at a time, so nothing
# contends on cargo's lock.
= ["CARGO_TARGET_DIR={{ vars.cache }}/magi-target cargo make test"]
# The rest of `cargo make check`, cheapest first. Only clippy compiles.
= [
"cargo make editorconfig-check",
"cargo make fmt-check",
"CARGO_TARGET_DIR={{ vars.cache }}/magi-target cargo make clippy",
]
# Run just before the gate, on the winner only. Run 892b was blocked by nothing
# but a one-line rustfmt wrap; a formatter is deterministic, so run it rather
# than argue about it with an agent. Changes land as one commit.
= ["cargo fmt --all"]
[]
# `base` is set explicitly because this is a jj-colocated checkout: jj keeps
# git's HEAD detached at the working-copy commit, so the `git symbolic-ref
# HEAD` fallback in `git::current_branch` would fail here. Teaching magi to
# read the jj bookmark instead is a real feature, not a workaround — tracked
# as its own competition. That fallback only runs when `base` is unset,
# though: with `base` given, `config.merge.base` wins over the fallback no
# matter what `mode` is, so the inherited `mode = "pr"` never reads HEAD — the
# `Pr` arm in `land.rs` just pushes the winner's worktree and opens a PR
# against `state.base_branch`. The only mode that depends on HEAD is
# `mode = "local"`, which merges directly in the primary worktree and needs
# to confirm the checked-out branch matches `base` first. Run
# 20260903-134458-ec12 landed this repository's own PR with `--mode pr` as a
# CLI override, confirming this in practice.
= "main"
# This repository's own GitHub ruleset on `main` requires linear history
# ("must not contain merge commits"), so the manual-merge guidance `magi
# show` prints must not be `git merge --no-ff` — that push is rejected for
# anyone without bypass rights. `squash` matches what `[graph] land` already
# runs for `mode = "pr"` (see `land.rs`'s module doc).
= "squash"
[]
# The serial all-target command has outgrown the former 2400s budget. In
# run 20261103-175649-ed34, round 1 compiled in 579s and completed 39 test
# binaries (3076 passing tests) in another 1734s before reaching
# graph_review_only. The command was still passing tests when the overall
# deadline expired, with further integration binaries not yet started.
# Allow two hours for compilation plus the complete suite, retaining a finite
# deadline and every existing test. This also covers the gate's serial fallback
# when nextest is unavailable; the reviewer-seat budget stays independent.
# Repository layers come from the pinned base: this change takes effect for
# runs whose base includes it, not by rewriting an existing run's saved config.
= 7200
# The former `timeout_verify = 2400` fixed `verify.gate` / `verify.e2e`, but
# `timeout_review` (the field it was split off from, see its doc comment in
# `src/config.rs`) was left at its 1200s default. That field is the timeout
# for the reviewer seat itself — both the ordinary review job
# (`src/graph.rs:2506`, stem `review-{round}-{n}`) and the reconsider-review
# job (`src/graph.rs:2689`, stem `review-{round}-reconsider-{n}`) pass it to
# `Duration::from_secs` directly. `timeout_verify` only bounds the real-machine
# verification commands, so raising it did nothing for the reviewer's own
# budget: `review-1` kept timing out every round on this machine, e.g. runs
# 20260919-213057-71fd, 20260919-152903-01b7 and 20260919-072215-fa6e.
#
# Keep the reviewer-seat budget at 2400s independently of the full-suite
# verification budget above. `timeout_verify` does not follow `timeout_review`
# when set explicitly (see `src/config.rs`).
# 1200s was failing structurally every round, so the accepted cost here is the
# same one already paid above: up to 20 extra minutes to reclaim a reviewer
# that has actually hung, in exchange for one that hasn't finishing normally.
= 2400
# Project conventions appended to the node prompts, never merged into them.
# Repository-wide context lives in AGENTS.md, which every agent already reads
# from the checkout; these are the things a magi *node* needs to know.
[]
= """
This repository uses jj (Jujutsu) with a colocated git repo. `git commit` works \
in a candidate worktree and is what magi expects, but never run `jj` commands \
and never touch the main working copy.
Full verification is parent-owned: magi runs the whole test suite (`cargo make \
test`) itself once a round has no blocking findings left, and again whenever \
the commit changes before landing, then the lints (`cargo make clippy`, \
`fmt-check`, `editorconfig-check`) as the gate. Do not re-run the full suite or \
the full gate yourself — a focused `cargo check` or a targeted \
`cargo test <name>` for what you touched \
is enough. Whenever you do build or test locally, set \
`RUSTUP_TOOLCHAIN=stable`: the environment here pins an older toolchain than CI \
uses, so a lint that fails CI is invisible without it.
"""
= """
Formatting is not a finding: `cargo fmt` runs in the gate. Spend the round on \
correctness, on invariants the code claims and does not keep, and on tests that \
assert plumbing rather than behaviour.
"""
# Context-window sizes (tokens) the chat's usage meter divides by, keyed by the
# model name an agent passes to its CLI. Merged over a built-in table; an exact
# name wins, then the longest prefix. A model with no entry shows a raw token
# count and no percentage. Example:
#
# [context_windows]
# "claude-opus-4-1" = 200000
# "my-local-model" = 32768