For stale closure identity at startup or restore, see the closure identity runbook.
trellis is a formalization harness for guiding agents from a natural-language mathematical proof to a verified Lean development.
⚠️ Security. Trellis runs LLM agent CLIs fully autonomously with all approval prompts disabled (YOLO mode). Thebwrapsandbox limits filesystem reach but is not a hard security boundary — agents run as you, with network access and read access to your provider credentials. Only run Trellis on a dedicated machine with no private or valuable data. See SECURITY.md.
The core problem is not just generating Lean code. It is managing a long, error-prone, stateful process in which agents propose local proof steps, add intermediate claims, revise structure, and respond to verification feedback without losing semantic coherence. In this setting, failures are expensive: they are often discovered late, after multiple slow agent calls and several layers of context have already drifted.
- guide agents through a multi-cycle formalization process controlled by deterministic checks instead of treating formalization as one giant prompt
- maintain explicit state about what part of the proof graph exists, what has been checked, and what still needs work
- separate proof generation from verification and scheduling so that agent outputs are judged by stable rules rather than prompt drift
- make the protocol precise enough to model in TLA+, implement in Rust, and operationalize with a thin Python wrapper
- reduce expensive downstream failures by making acceptance gates deterministic and inspectable
Trellis works over a proof tablet: a DAG of formalization nodes, each with a Lean artifact and a natural-language counterpart. A node may be a theorem-like statement or a definition. Dependencies are explicit. Verification status is explicit. Active work is explicit.
The system runs in cycles with distinct roles:
- a worker proposes edits or new structure within an authorized scope
- paper-faithfulness, substantiveness, correspondence, and NL soundness are the four agent-verified checks, evaluated in that order against deterministic gates
- a reviewer decides how to advance based on current blockers and verification state
- the runtime persists the result and schedules the next action
This is intentionally stricter than a free-form agent workflow. The aim is not to maximize agent freedom. The aim is to make the formalization process reliable enough that a long-running proof effort does not accumulate hidden semantic drift.
The formalization workflow is treated as a protocol, not a pile of agent prompts. The authoritative rules for request issuance, blocker handling, allowed transitions, and accepted outcomes belong in the protocol model.
The TLA+ spec in spec/ defines the abstract contract. The Rust kernel in kernel/ implements that contract. Any semantic change is supposed to be reflected on both sides, then checked with TLC and Rust tests before it is trusted.
This is not documentation theater. The point is to keep the deployed semantics and the modeled semantics aligned closely enough that the model is useful for finding real bugs.
Python exists to do the parts that are operationally convenient outside the kernel:
- bridge/orchestration
- agent API integration
- prompt rendering from kernel-authored contracts
- launching external deterministic tools
- moving artifacts around the filesystem
Python should not be the place where protocol meaning is invented. The long-term direction of the repo is to keep semantic authority in Rust and mirror it in TLA+.
Agents are useful for proposing proof edits, proof structure, and review judgments. They are not treated as the authority on whether those proposals are acceptable. Acceptance should be driven by deterministic checks tied to explicit contracts, so that the same candidate state is judged the same way no matter which agent produced it.
Formalizing a paper is not a single burst. It is a long process with many partial results, reversions, repairs, and local retries. Trellis persists protocol state, verification state, and runtime artifacts so that the system can resume intelligently rather than starting over every cycle.
- kernel/: Rust kernel, runtime, and CLI entrypoints
- trellis/runtime/: Python runtime bridge and operational plumbing
- trellis/checking.py: stable Python-facing checking facade
- trellis/atomic_actions/: atomic local tool runners still exposed to the checker facade
- spec/: TLA+ protocol model and TLC harness
- scripts/: setup, runtime, viewer, and checker helper scripts
- tests/: carried regression and migration tests
- INSTALLATION.md: system requirements (32 GB RAM minimum, 48 GB recommended; SSD), which distros run the sandbox without root (recommended: Ubuntu 26.04 LTS — no root setup needed), host setup, dependencies, worker sandbox, and macOS/VM guidance
- FILESPEC.md: file-shape and structural constraints for tablet artifacts
- PV_GOAL_AUTHORING.md: writing prose program-verification goals, including setup, assumptions, intended behavior, and coverage
- PV_SEED_AUTHORING.md: PV seed contents and trust boundaries
- PV_PHASE0_RUNBOOK.md: uploading upstream source and launching a prose PV campaign
- spec/PV_REVISION.md: reviewing completed refutations, source repairs and requirement revisions, and starting a new verification generation
- REFERENCE_PAPERS.md: registering auxiliary papers as grounding authority for cited results (§11)
- ADD_TARGETS.md: adding further targets from the same paper to a Complete run
The supported operator surface is small. Use the existing scripts and keep repo state, runtime state, and the supervisor workspace in sync. Most painful failures in this project have come from partial resets.
To build a repo from a paper:
./scripts/setup_repo.sh --loogle on|off <repo_path> <paper_tex_path> [project_slug]Give <repo_path> its own directory outside the trellis source tree —
conventionally under the projects root the viewer reads (default ~/math),
e.g. ~/math/connectivity. Any location works; point the viewer at it with
TRELLIS_PROJECTS_ROOT.
For a clean rebuild in place:
./scripts/setup_repo.sh --reset --yes --loogle on|off <repo_path> <paper_tex_path> [project_slug]Useful flags:
--mathlib-build-tar <path>: seed the worker-sidemathlib/.lake/buildtree from a local tarball--main-result-labels <labels>: override the labels used to identify the main paper result
To formalize into Isabelle/HOL instead of Lean, point setup at the shipped
Isabelle templates (CONFIG_TEMPLATE=examples/trellis.isabelle.config.json);
see INSTALLATION.md §2g ("Isabelle/HOL backend") for the distribution
requirement (Isabelle2025-2 or newer) and the TRELLIS_ISABELLE_HOME
override.
This is the right tool for creating or reseeding a repo. Do not try to reconstruct a repo manually by mixing copied Tablet/, .lake/, and .trellis/ state.
The viewer's Lean parallelism field controls concurrent node checks and
Lean/Lake build threads for the run. It recommends one slot per 10 GiB of host
RAM, rounded down and capped by available CPUs, with a minimum of one. Container
memory/CPU limits are respected; this host-based recommendation is editable.
For example, a 64 GiB machine with at least six CPUs recommends 6. Reduce it
when sharing memory with other runs or working with unusually large proofs.
The choice is saved with the launch job and reused for retries and restarts.
The job CLI accepts scripts/trellis_create_run.sh start ... --lean-parallelism 6.
For a manual supervisor launch, set TRELLIS_LEAN_PARALLELISM=6 in both the
checker and supervisor environments. Worker bursts inherit that value unless
TRELLIS_BURST_LEAN_PARALLELISM explicitly overrides it.
Launch from a shell where every CLI resolves. The supervisor builds the
worker burst's PATH and the read-only CLI/elan binds from shutil.which on
its own PATH at burst time (trellis/host_runtime.py:
worker_provider_bin_dirs / worker_elan_home / worker_path_env). Whichever
shell launches restart_configured_run.sh (or trellis.sh run) must therefore
resolve every tool a burst needs — nvm sourced, elan on PATH. This is the
single most likely silent failure for a new host. Check first:
which codex claude gemini lake node # all must succeedThen run the provider preflight, which exercises the real worker sandbox and every configured provider end to end (CLI resolution inside the bwrap binds, repo write-protection, auth, and model availability) so problems surface now rather than mid-run:
python3 -m trellis.provider_check --config <repo>/trellis.config.jsonThe supported one-command launcher is:
./scripts/restart_configured_run.sh <config_path> <runtime_root><config_path> is the run's trellis.config.json (it carries repo_path);
<runtime_root> is where runtime state lives. The launcher performs a clean
restart end to end: it recreates the repo with setup_repo.sh --reset,
reinitializes the runtime with trellis.sh init, starts the viewer, starts the
unified-checker server in a sibling tmux session, waits for it to bind its UNIX
socket, exports TRELLIS_CHECKER_SOCKET, and launches trellis.sh run in tmux
with that socket in its environment. All acceptance lake checks route through
the checker server (there is no host-lake fallback), so this socket export is
mandatory — running the bare CLI sequence by hand without it fails at the first
acceptance check.
The launcher prints the tmux session names it created. Watch the run with:
tmux -L trellis attach -t trellis-run-<project_slug> # the supervisor
tmux -L trellis attach -t trellis-checker-<project_slug> # the checker server<project_slug> is the basename of the repo. Useful flags:
--no-run: set up the workspace but do not launch the supervisor.--no-current: skip refreshing the$HOME/math/currentsymlinks.--check-only: dry-run; print the planned tmux invocations and exit.
Runtime-root form. The checker server derives the repo from <runtime_root>
and only accepts two layouts: the inner form <repo>/.trellis/runtime/<name>,
or the outer (sibling) form <parent>/<repo_basename>-runtime. Pass a
<runtime_root> in one of these forms; an arbitrary path that trellis.sh init
would otherwise accept will be rejected by the checker server.
The underlying runtime CLI wrapper is scripts/trellis.sh:
./scripts/trellis.sh init <config_path> <runtime_root>
./scripts/trellis.sh show <runtime_root>
./scripts/trellis.sh preview <runtime_root>
./scripts/trellis.sh step <runtime_root>
./scripts/trellis.sh run <runtime_root> [max_steps]If you must drive these by hand instead of using the launcher, you have to
reproduce what the launcher does: start the checker server and export its socket
before run, otherwise acceptance checks fail. Launch both the checker
server and the supervisor from a shell where your toolchain resolves (the
launch-shell PATH note above): the supervisor derives the worker burst PATH from
its own, and the checker server runs lake for acceptance checks.
# 1. Initialize the runtime.
./scripts/trellis.sh init path/to/trellis.config.json path/to/<repo>-runtime
# 2. Start the unified-checker server (binds <runtime_root>/sockets/checker.sock).
./scripts/trellis_checker_server.sh path/to/<repo>-runtime # leave running
# 3. Run the supervisor with the socket exported into its environment.
export TRELLIS_CHECKER_SOCKET=path/to/<repo>-runtime/sockets/checker.sock
./scripts/trellis.sh run path/to/<repo>-runtimeFor bounded execution, append a step count to run (the socket must still be
exported):
./scripts/trellis.sh run path/to/<repo>-runtime 1or drive it manually with:
./scripts/trellis.sh preview path/to/<repo>-runtime
./scripts/trellis.sh step path/to/<repo>-runtimeThat is the closest thing the current repo has to a supported "pause" mechanism. There is no dedicated generic pause script.
To start over from a known-good state, re-run the same launcher (§2): it recreates repo, runtime, checker server, and supervisor together. Treat those as a single unit — most painful failures in this project have come from partial resets, which is exactly what recreating all of it at once avoids.
The web viewer is the primary way a human is expected to interact with the
formalization process — set it up for any real run (INSTALLATION §2e;
./scripts/start_viewer.sh, default http://127.0.0.1:3301/trellis/). This
matters most at the human gates: approval gates and NeedInput escalations
surface as banners in the viewer, with approve / send-input as the primary
actions — a run parked at a gate waits indefinitely for you, and the viewer is
where you find out. Beyond the gates it carries the live DAG and per-node
verification state, halt banners with their diagnostics, pause/resume controls
and the weekly-budget pause floor, usage, and a notice when a
newer Trellis release is available. The CLI surfaces below cover the same
state read-only and are fine for a terminal check-in; the gates and controls
live in the viewer.
Its root URL is a landing page: one card per run found under the projects root, with the run's lifecycle state read from disk (never started, live, paused, halted, finished, abandoned) plus host RAM/swap/disk against the documented requirements, supervisor/checker liveness, and provider budget. Each card links into that run's viewer.
To reach the viewer from another machine, forward its loopback port:
ssh -L 3301:127.0.0.1:3301 <host> # then browse http://127.0.0.1:3301/trellis/This is the supported way in: the viewer stays on loopback and SSH supplies
both encryption and authentication, so there is no TLS to set up (use plain
-L, never -L '*:3301' or -g, which republishes the viewer in cleartext on
your own LAN). SECURITY.md, "Deployment modes", covers the public-host
alternatives.
The viewer answers only to names this machine actually goes by (localhost,
loopback literals, its own short and fully-qualified hostnames, whatever it
bound), which is what stops a page you visit from re-pointing its own hostname
at the port and reading your runs. Nothing to configure — browsing by hostname
through nginx works as it always did — and TRELLIS_VIEWER_ALLOWED_HOSTS adds
a name if you reach it through an alias or a Host-rewriting proxy. Bound off
loopback, reads also require the token URL by default
(TRELLIS_VIEWER_READ_TOKEN).
Because the viewer can pause and relaunch runs, its controls live behind a
secret 8-character path segment. <base>/<token>/ is the same landing page
with pause/resume and feedback enabled, <base>/<token>/<project> the same run
viewer with them enabled, and every plain URL keeps working read-only.
start_viewer.sh prints the whole control URL on its viewer_control_url=
line, and it works through the tunnel unchanged; writes additionally carry a
custom X-Trellis-Control header, which is what makes them unforgeable from
another site. See SECURITY.md for the tradeoff of putting the token in the URL.
If you expose the viewer publicly (§7 below), set TRELLIS_VIEWER_CONTROL=0
first.
High-level runtime state:
./scripts/trellis.sh show <runtime_root>For a live split-panel TUI — cycle/phase/active node, live and committed node counts, coarse-DAG shallow-closed progress, last review/worker, kernel-contract counters, and a tail of the active burst's chat — run from the repo:
python -m trellis.cli_monitor # live; q to quit
python -m trellis.cli_monitor --once # one snapshot, no alt-screenIt reads the same on-disk JSON the web viewer reads (no Node/HTTP). Useful when
you want progress numbers in a terminal alongside the tmux session.
cli_monitor is the one part of the repo that needs a pip package — install it
with pip install rich (the supervisor and test suite are stdlib-only).
Known limitation — live chat tail. The live chat/activity panel (both
cli_monitor and the web viewer) currently tails codex output as it streams;
gemini and claude transcripts render only after a burst completes. The stat
panels (cycle/phase/node counts) are provider-agnostic.
If you launched the supervisor under tmux, attach to the session you created. When the tmux session is not enough, the next things to inspect are:
<runtime_root>/protocol_state.json<runtime_root>/event_log.jsonl- the repo-local staging directory under
.trellis/runtime/<runtime-name>/staging/
As a rule, prefer these durable state files over guessing from leftover worker processes.
For a deliberate pause, use the pause state machine:
./scripts/trellis_pause.sh arm <runtime_root> <repo_path> [--reason TEXT] [--by WHO]
./scripts/trellis_pause.sh status <runtime_root> <repo_path> # JSON: running | arming | paused | down
./scripts/trellis_pause.sh resume <runtime_root> <repo_path>arm writes a durable, reason-carrying <runtime_root>/pause_request.json
beside the stop sentinel; the run stops cleanly at its next checkpoint (or at
an open human gate) and the state sits on disk with the process down, so a
pause left overnight cannot decay with its environment. resume relaunches by
replaying <runtime_root>/launch_env.json — the exact environment the run was
launched with, captured at every start — rather than guessing one, refuses if
the source tree the run was launched from has moved, and clears the pause
record only once the relaunch confirms. The viewer shows a paused run on its
own attention tier with the recorded reason, and can arm/resume the same state
machine from the UI. Two automatic arms exist: a human gate left open past
gate_park_after_minutes (default 120) is parked into a pause rather than left
polling in a killable process, and the weekly budget bar's "pause run at" floor
(default 5% remaining) arms one server-side.
An agent that exhausts its provider usage allowance or credit balance also pauses the run. The viewer shows PAUSED — PROVIDER BUDGET EXHAUSTED, the provider's diagnostic (including a reset hint when supplied), and Resume run. Resume once the allowance resets or credits are replenished. The same pending request is retried without spending the supervisor's failure budget; completed work stays saved, while an interrupted worker attempt restarts from its saved baseline. Resuming too early simply records another budget pause. Temporary rate limits retain their normal retries; context-window exhaustion and attempt timeouts are separate failures.
Below the pause machinery, the primitives:
-
use
run <runtime_root> <max_steps>for bounded execution -
use
preview+stepfor manual stepping -
request a graceful reload stop by touching the repo-local sentinel:
touch "$(jq -r '.repo_path' <runtime_root>/runtime_metadata.json)/.trellis-stop-after-checkpoint"The long-running
runloop checks this file between persisted steps, removes it, printsstop-after-checkpoint sentinel detected, and exits without killing the in-flight worker/verifier/reviewer. After changing or rebuilding the kernel, resume with the same runtime root:export TRELLIS_CHECKER_SOCKET=<runtime_root>/sockets/checker.sock # if the checker server is no longer running, restart it first (see §2) ./scripts/trellis.sh run <runtime_root>
This reloads from
<runtime_root>/protocol_state.jsonand refreshes the in-flight request from current kernel code. The checker server and socket export are required here too. -
if the supervisor is running in tmux, stop it by ending that tmux session or killing the supervisor process tree
What is not a good operational pattern:
- deleting selected runtime files by hand
- restarting only the runtime while leaving the repo dirty
- keeping a stale supervisor workspace while reusing an older runtime root
- relaunching on top of half-finished worker edits and hoping the supervisor sorts it out
If a run is in a questionable state, prefer a clean restart over ad hoc surgery.
Footguns worth knowing:
- Commit config edits. The run loop does
git reset --hard/git clean -fdagainst the project repo (kernel/src/bin/runtime_cli.rs), so an uncommitted edit totrellis.config.json(e.g. a provider/model change) is silently reverted. Commit the change in the project repo before launching. - Re-applying config changes may need a fresh runtime root. The runtime
copies config at
init; to make a config change take effect cleanly you may need torm -rf <runtime_root>before re-runningtrellis.sh init(or just use the launcher, which recreates it). - A run killed mid-burst leaves stale state that
git clean -fddoes NOT clear.git reset --hard HEAD && git clean -fdrestores tracked files (and preserves the gitignored.lake/+ mathlib cache, so no rebuild) — but it leaves the rest of the gitignored.trellis/untouched, including leftover worker.donemarkers and result artifacts under<repo>/.trellis/runtime/<name>/staging/. The kernel consumes those, so a "fresh" launch can silently reuse or skip that burst (e.g. the worker "already finished" against an empty Tablet) instead of re-running it — and deleting only the sibling<runtime_root>doesn't help, because the repo-internal.trellis/runtime/is separate. For a genuinely clean start use the supported restart (restart_configured_run.sh, orsetup_repo.sh --reset), which recreates the repo, runtime, and supervisor workspace together (§3); a hand-rolledgit cleanis not equivalent. system_feedbackis logged by default; halting on it is opt-in. When an agent burst returns a non-emptysystem_feedback, the emission is appended to<runtime_root>/system_feedback_log.jsonl(full text, stable fingerprint, cycle/request provenance), a notice is printed to the run log, and the run continues.system_feedbacksignals a design gap or harness bug, so review the log periodically (the viewer serves it at/api/system-feedback.json). Operators who prefer the fail-loudly behavior — every emission freezes the run for review — can set top-level"system_feedback_halt": trueintrellis.config.json(or exportTRELLIS_SYSTEM_FEEDBACK_HALT=1; the env var beats the config in both directions). With halting enabled, the supervisor stops dispatching new bursts and writes<runtime_root>/system_feedback_halt.json; that is a review checkpoint, not a crash. Read the file (it carries the diagnostic andclear_instructions), fix the underlying cause, then resume by lifting the marker —./scripts/trellis_pause.sh resume <runtime_root> <repo_path> --clear-haltrenames it to a.lifted-<unix_ts>.jsonsibling and relaunches (§2), so the diagnostic outlives the resume. A marker already on disk always halts the run regardless of the knob. A lift settles that one instance; to stop a known-benign fingerprint halting on every recurrence, acknowledge it (ack_system_feedback) instead, which log-and-continues without disabling halts for novel feedback.
Upgrading Trellis mid-run. A long formalization does not need to be sacrificed to take an upgrade; the pause machinery above is the supported path. In order:
- Pause the run:
./scripts/trellis_pause.sh arm <runtime_root> <repo_path> --reason "upgrade". This writes the durable pause record and the stop sentinel; the supervisor stops cleanly at its next checkpoint (or straight from an open human gate) and exits. Wait untiltrellis_pause.sh statusreportspaused— at that point no supervisor process is left and all run state is on disk. - Upgrade in place:
git pull(or check out the release tag) in the Trellis source tree the run was launched from, rebuild the kernel binary (§Validation), and restart the viewer (./scripts/start_viewer.sh). Upgrading in place matters: resume verifies the run's recorded source tree and refuses one that has moved. - Restart the checker server against the same runtime root (§2) so it runs the upgraded code before the supervisor comes back.
- Resume:
./scripts/trellis_pause.sh resume <runtime_root> <repo_path>. This replays the exact launch environment recorded at the last start (launch_env.json) — no reconstructing env vars by hand — and clears the pause record only once the relaunch confirms. Resume refuses while a halt marker is on disk, naming it: add--clear-haltto lift a system-feedback marker and relaunch in one step, or--clear-halt-any-kindfor a checker-disagreement or unparseable marker, where soundness is the open question and the triage belongs at the marker first.
The plain sentinel (touch <repo>/.trellis-stop-after-checkpoint, above) is
the bare-hands version of step 1 and still works, but it records no reason and
leaves resume to you; prefer the pause script for anything that stays down
longer than the edit you are making.
- Treat repo state, runtime state, and supervisor workspace state as one unit.
- Assume a semantically dirty worktree is not safe to relaunch on unless you are intentionally resuming that exact in-progress attempt.
- Use
show,protocol_state.json, andevent_log.jsonlas the authoritative view of progress. - Use bounded
run ... <max_steps>orstepif you want explicit control points. - When in doubt, choose the path that recreates more state, not less.
For a finished tablet repo, build a static public viewer with:
./scripts/build_public_tablet_viewer.py \
<repo_path> \
/tmp/<viewer-name> \
--title "<Formalization Title>" \
--github-base https://github.com/<owner>/<repo>/blob/<branch>The wrapper builds Tablet, precomputes recursive Mathlib imports, computes
semantic closures, writes build information including top-level target
#print axioms output, and packages the result as /tmp/<viewer-name>.tar.gz.
By default, Lean/Lake work is throttled with one job/thread, nice -n 19,
idle I/O priority, and CPU affinity to core 0.
For a quick UI-only preview, use:
./scripts/build_public_tablet_viewer.py <repo_path> /tmp/<viewer-name> \
--semantic skip --no-build --no-cache-getDeploy the generated static files to any static web directory. Keep the trailing slash on the source path:
rsync -av --delete /tmp/<viewer-name>/ <host>:<public-web-dir>/<viewer-name>/Trellis can target benchmarks that prescribe the exact Lean form of the goal — e.g. the Lean AI formalization leaderboard, where each problem fixes supporting definitions and a theorem statement that a solution must prove verbatim. A run then carries challenge targets alongside (or instead of) paper targets: prescribed declarations that must be covered by nodes whose Lean text the kernel enforces byte-for-byte at acceptance, while proofs, decomposition, and the rest of the DAG remain worker-authored and pass through every verification lane as usual. One node may cover both a challenge target and a paper target.
The pipeline:
-
Download the problem's files and derive the spec deterministically — prescribed text is never hand-transcribed:
scripts/import_challenge_targets.py <problem-download-dir> --out challenge_targets.json
-
Create the run with the spec plus a reference TeX paper proving the result (the paper does not reference the challenge; it remains the grounding input for the faithfulness and correspondence lanes):
scripts/setup_repo.sh --challenge-targets challenge_targets.json <repo> <paper.tex>
The spec lands in
trellis.config.jsonasworkflow.challenge_targets_path, and the benchmark's toolchain pins recorded by the importer are applied automatically (an explicitly exportedMATHLIB_TOOLCHAIN/MATHLIB_REVthat disagrees with the spec is an error). Initialize and run as in sections 1–2; uncovered challenge targets block phase advance and completion exactly as uncovered paper targets do. -
After the run completes, export the submission artifact and validate it the way the benchmark's CI will:
scripts/export_submission.py <repo> challenge_targets.json <problem-download-dir> --out <out-dir>
A zero exit means
<out-dir>is a directly submittable repo (Submission.lean,Submission/,lakefile.toml), verified by replaying the benchmark's own comparator against a pristine copy of the problem workspace.
When a paper gets a new version that strengthens a result, adds theorems, or drops some exposition, Trellis can revise an existing tablet against the newer source instead of reformalizing from scratch. A revision run starts from an already-formalized basis — a closed tablet that passed every lane on the old paper — and reopens only the additive/improving delta, judged against the new paper.
The starting point is sound by construction. A closed tablet that passes correspondence and soundness on every node is genuinely formalizable, so nothing in it is false; a newer version cannot be correcting a result that was already proven. So the default at import is to inherit every prior approval and reopen only what a relevant tablet change reopens under the existing kernel rules. The verification surface collapses to the new and restated nodes.
Concretely, import carries the prior correspondence and soundness approvals
verbatim (both are tablet-side fingerprints — neither reads the paper — so a
paper-version swap does not perturb them); inherits paper-faithfulness per
target while force-invalidating every changed and added target; and re-baselines
substantiveness to Pass for every present node against the new paper, so a
pure version swap reopens no unchanged node while a restated or new node still
re-enters the lane.
Prepare the working repo with the operator script:
./scripts/setup_revision_repo.sh \
--base-repo <existing-tablet-repo> \
--old-paper <old-main-tex> \
--new-paper <new-main-tex> \
--out-repo <new-working-repo> \
[--target-map <target-map-json>] \
[--old-source-id arXiv:...v1] [--new-source-id arXiv:...v3]--base-repo must hold the prior full state at
.trellis-history/supervisor_state.json. The script copies the base working
tree to --out-repo (it fails rather than overwrite), copies both paper sources
to paper/revision/{old,new}.tex, points workflow.paper_tex_path at the new
source and records a workflow.revision block:
{
"workflow": {
"paper_tex_path": "paper/revision/new.tex",
"revision": {
"old_paper_tex_path": "paper/revision/old.tex",
"old_source_id": "arXiv:...v1",
"new_source_id": "arXiv:...v3"
}
}
}paper_tex_path (the new source) remains the current paper for every ordinary
verifier lane. The script then calls the import_revision_project runtime CLI
action, which diffs the two papers, classifies each target as unchanged /
changed / added / removed, computes the frozen and editable node sets, applies
the inheritance above, and writes the initial state — phase RevisionStating,
stage StuckMathAudit — so the next supervisor cycle dispatches the first
revision-planning audit.
The script does not run the planner. Point the normal launcher (§2) at the prepared repo and runtime root:
./scripts/restart_configured_run.sh <new-working-repo>/trellis.config.json <runtime-root>From there the run proceeds: the revision-planning StuckMathAudit reads both
papers and the current tablet and proposes a scoped update plan (which nodes to
restate, copy, freeze, or add); the reviewer and worker restate authorized
editable nodes and add new ones, with frozen nodes — preamble, axioms, and the
covering/closure nodes of unchanged carried targets — protected by validation;
changed targets and changed nodes re-enter the verifier lanes while unchanged
approvals inherit. A RevisionStating → HumanGate → ProofFormalization
transition gates the revised statement set: HumanGate approval advances the run
into ordinary proof formalization over the changed cone.
Earlier releases could run a pool of cheap body-only proof-search agents
("grunts") beside the main loop. That subsystem is retired: parallel dispatch
(docs/PARALLEL_DISPATCH.md) dispatches Lean-closure attempts as ordinary
worker assignments with the same kernel gates and checker, so the separate
daemon, its --grunts launch flags, the viewer's Grunts tab and the sidecar
config block are gone. A sidecar block left in an older trellis.config.json
is ignored. Historical closures a sidecar landed remain attributed as
closed_by: "sidecar" in closure_provenance and in the event log.
When the paper cites results proved elsewhere, register those sources so the verification lanes can read them. A registered document is grounding authority only — the primary paper stays the sole source of targets. Workers claim the documents a node relies on, and the substantiveness verifier reads the claimed file as the authority for the cited result.
At setup:
./scripts/setup_repo.sh ... --reference smith2020=path/to/smith.tex:"Smith, JCTB 2020"On an existing run, register the file and then admit it during a stop window (§5); ids are immutable for the life of the run:
./scripts/add_reference_paper.sh <repo> <tex> --id smith2020 --source-id "Smith, JCTB 2020"REFERENCE_PAPERS.md covers the kernel action that admits it, the quiescence
preconditions, composition with add-targets, and the deploy/rollback notes.
Build the kernel binary before running pytest — the Python suite invokes
it, so without it ~16 tests fail with cannot find cargo for trellis kernel invocation. The full suite also needs a Lean / lake install (see
INSTALLATION.md). There are no Python package dependencies, but the test
suite is not toolchain-free.
Build the debug profile — kernel/target/debug/trellis_runtime_cli, which
is what the plain cargo build below produces. Two independent resolvers both
land there by default, and they are not the same mechanism:
- the runtime (
trellis/runtime/kernel_cli.py) takes$TRELLIS_TRELLIS_KERNEL_CMDif set, else a vendoredbin/trellis_runtime_clibeside the source tree, elsekernel/target/debug/, else falls back tocargo run. It never looks at a release build;
TRELLIS_KERNEL_BIN is read only by that test; the runtime ignores it.
# Build the kernel binary first.
cargo build --bin trellis_runtime_cli --manifest-path kernel/Cargo.toml
CARGO_BUILD_JOBS=2 cargo test -q --manifest-path kernel/Cargo.toml
PYTHONDONTWRITEBYTECODE=1 python3 -m pytest tests/ -q
# Viewer (Node). Needs `npm ci` in viewer/ once; exits non-zero on any failure.
npm --prefix viewer testSome failures are environment-gated, not regressions: the Lean-dependent tests
(lean_semantic_*, print_axioms) need a working Lean/lake toolchain.
The local_closure_smoke kernel target is the regression harness for two
resolved local-closure soundness holes, so it fails loudly rather than passing
vacuously when its Lean fixture is unbuilt. Build the fixture once (fast — it
avoids Mathlib):
(cd kernel/tests/fixtures/local_closure_smoke && lake build)Trellis is source-available for academic and noncommercial use under the PolyForm Noncommercial License 1.0.0. See LICENSE.
Commercial use requires a separate written commercial license. See COMMERCIAL.md.
Contributions: external pull requests will not be reviewed without prior discussion. See CONTRIBUTING.md.
Third-party dependencies remain under their own licenses. See THIRD_PARTY_NOTICES.md.
Resume a published tablet on another host with the viewer’s Resume run flow. See Remote resume for supported checkpoints, host setup, and the single-writer handoff.