create-lathe 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +135 -2
  3. package/bin/create-lathe.js +80 -0
  4. package/dist/framework.lock +113 -0
  5. package/dist/package/crates/instrument/Cargo.lock +415 -0
  6. package/dist/package/crates/instrument/Cargo.toml +27 -0
  7. package/dist/package/crates/instrument/examples/instrument.rs +73 -0
  8. package/dist/package/crates/instrument/src/client.rs +128 -0
  9. package/dist/package/crates/instrument/src/lib.rs +32 -0
  10. package/dist/package/crates/instrument/src/logging.rs +109 -0
  11. package/dist/package/crates/instrument/src/protocol.rs +49 -0
  12. package/dist/package/crates/instrument/src/registry.rs +166 -0
  13. package/dist/package/crates/instrument/src/selftest.rs +314 -0
  14. package/dist/package/crates/instrument/src/server.rs +303 -0
  15. package/dist/package/crates/instrument/tests/command_log.rs +60 -0
  16. package/dist/package/crates/instrument/tests/round_trip.rs +134 -0
  17. package/dist/package/crates/instrument/tests/selftest_fail.rs +25 -0
  18. package/dist/package/crates/instrument/tests/selftest_pass.rs +24 -0
  19. package/dist/package/crates/instrument/tests/support/mod.rs +38 -0
  20. package/dist/package/pi/context/journal-de-lot.md +24 -0
  21. package/dist/package/pi/context/tech-skill.md +19 -0
  22. package/dist/package/pi/context/ticket-closed.md +18 -0
  23. package/dist/package/scripts/framework.py +1314 -0
  24. package/dist/package/scripts/gates.py +1134 -0
  25. package/dist/package/scripts/setup.py +195 -0
  26. package/dist/package/skills/bootstrap/SKILL.md +110 -0
  27. package/dist/package/skills/documentation/SKILL.md +110 -0
  28. package/dist/package/skills/documentation/references/agents-md.md +70 -0
  29. package/dist/package/skills/documentation/references/corpus.md +112 -0
  30. package/dist/package/skills/journal/SKILL.md +81 -0
  31. package/dist/package/skills/journal/references/entry.md +172 -0
  32. package/dist/package/skills/lathe/SKILL.md +168 -0
  33. package/dist/package/skills/lathe/evals/routing.md +196 -0
  34. package/dist/package/skills/lathe/references/install.md +128 -0
  35. package/dist/package/skills/lathe/references/invariants.md +31 -0
  36. package/dist/package/skills/mutants/SKILL.md +85 -0
  37. package/dist/package/skills/mutants/references/cargo-mutants.md +176 -0
  38. package/dist/package/skills/mutants/references/triage.md +88 -0
  39. package/dist/package/skills/optimize/SKILL.md +87 -0
  40. package/dist/package/skills/optimize/references/codspeed.md +126 -0
  41. package/dist/package/skills/probe/SKILL.md +82 -0
  42. package/dist/package/skills/probe/references/wait-and-read.md +53 -0
  43. package/dist/package/skills/replicate-ui/SKILL.md +64 -0
  44. package/dist/package/skills/rust/SKILL.md +147 -0
  45. package/dist/package/skills/rust/references/errors.md +63 -0
  46. package/dist/package/skills/rust/references/unsafe.md +65 -0
  47. package/dist/package/skills/scaffold/SKILL.md +78 -0
  48. package/dist/package/skills/scaffold/profiles/rust-cli/.cargo/config.toml +2 -0
  49. package/dist/package/skills/scaffold/profiles/rust-cli/AGENTS.md +22 -0
  50. package/dist/package/skills/scaffold/profiles/rust-cli/Cargo.lock +7 -0
  51. package/dist/package/skills/scaffold/profiles/rust-cli/Cargo.toml +17 -0
  52. package/dist/package/skills/scaffold/profiles/rust-cli/README.md +15 -0
  53. package/dist/package/skills/scaffold/profiles/rust-cli/deny.toml +14 -0
  54. package/dist/package/skills/scaffold/profiles/rust-cli/rustfmt.toml +2 -0
  55. package/dist/package/skills/scaffold/profiles/rust-cli/src/main.rs +38 -0
  56. package/dist/package/skills/scaffold/profiles/rust-cli/tests/cli.rs +27 -0
  57. package/dist/package/skills/scaffold/profiles/rust-library/.cargo/config.toml +2 -0
  58. package/dist/package/skills/scaffold/profiles/rust-library/AGENTS.md +21 -0
  59. package/dist/package/skills/scaffold/profiles/rust-library/Cargo.lock +7 -0
  60. package/dist/package/skills/scaffold/profiles/rust-library/Cargo.toml +18 -0
  61. package/dist/package/skills/scaffold/profiles/rust-library/README.md +15 -0
  62. package/dist/package/skills/scaffold/profiles/rust-library/deny.toml +14 -0
  63. package/dist/package/skills/scaffold/profiles/rust-library/rustfmt.toml +2 -0
  64. package/dist/package/skills/scaffold/profiles/rust-library/src/lib.rs +25 -0
  65. package/dist/package/skills/scaffold/profiles/rust-native-desktop/.cargo/config.toml +2 -0
  66. package/dist/package/skills/scaffold/profiles/rust-native-desktop/AGENTS.md +23 -0
  67. package/dist/package/skills/scaffold/profiles/rust-native-desktop/Cargo.lock +9252 -0
  68. package/dist/package/skills/scaffold/profiles/rust-native-desktop/Cargo.toml +24 -0
  69. package/dist/package/skills/scaffold/profiles/rust-native-desktop/README.md +15 -0
  70. package/dist/package/skills/scaffold/profiles/rust-native-desktop/deny.toml +35 -0
  71. package/dist/package/skills/scaffold/profiles/rust-native-desktop/rustfmt.toml +2 -0
  72. package/dist/package/skills/scaffold/profiles/rust-native-desktop/src/main.rs +74 -0
  73. package/dist/package/skills/scaffold/references/gates.md +29 -0
  74. package/dist/package/skills/scaffold/references/profiles.md +36 -0
  75. package/dist/package/skills/update/SKILL.md +115 -0
  76. package/dist/package/skills/verify-visual/SKILL.md +82 -0
  77. package/dist/package/skills/verify-visual/references/baseline.md +46 -0
  78. package/dist/package/skills/visual-loop/SKILL.md +72 -0
  79. package/dist/package/workflows/batch-to-review.md +41 -0
  80. package/dist/package/workflows/framework-improvement.md +38 -0
  81. package/dist/package/workflows/hard-bug.md +37 -0
  82. package/dist/package/workflows/new-rust-cli.md +33 -0
  83. package/dist/package/workflows/new-rust-desktop-app.md +41 -0
  84. package/dist/package/workflows/new-rust-library.md +34 -0
  85. package/dist/package/workflows/performance-work.md +41 -0
  86. package/dist/package/workflows/ui-change.md +40 -0
  87. package/package.json +33 -4
@@ -0,0 +1,24 @@
1
+ [package]
2
+ name = "rust-native-desktop"
3
+ version = "0.1.0"
4
+ edition = "2024"
5
+ rust-version = "1.97"
6
+ description = "Minimal GPUI Kit desktop application, ready for its gates."
7
+ license = "MIT OR Apache-2.0"
8
+
9
+ [dependencies]
10
+ gpui-kit = "0.11"
11
+
12
+ # `test-support` turns on GPUI's headless window harness for the unit test only.
13
+ [dev-dependencies]
14
+ gpui-kit = { version = "0.11", features = ["test-support"] }
15
+
16
+ [lints.rust]
17
+ unsafe_code = "forbid"
18
+ missing_docs = "warn"
19
+
20
+ [lints.clippy]
21
+ pedantic = { level = "warn", priority = -1 }
22
+ module_name_repetitions = "allow"
23
+ missing_errors_doc = "allow"
24
+ missing_panics_doc = "allow"
@@ -0,0 +1,15 @@
1
+ # rust-native-desktop
2
+
3
+ Fenêtre GPUI Kit 0.11 (`gpui-kit`, Apache-2.0 ; 853 paquets résolus par `Cargo.lock`), edition 2024 : `src/main.rs` ouvre une fenêtre, `#[gpui_kit::test]` la rend hors écran et vérifie un état.
4
+
5
+ ```bash
6
+ cargo fmt --check # sort 1 en cas de dérive de format
7
+ cargo clippy --all-targets # warnings refusés par .cargo/config.toml
8
+ cargo test # test headless : un clic incrémente le compteur
9
+ cargo run # fenêtre réelle : macOS (Metal) ou Linux (WGPU), jamais Windows
10
+ ```
11
+
12
+ Rendu pixel sur macOS et Linux seulement (`E-17`), aucune capture ici (`E-18`), aucune assertion sur le texte rendu (`E-19`).
13
+ Vérifié le 2026-11-28 sur macOS 27.0.1 arm64, cargo 1.98.1 : `cargo fmt --check`, `cargo check --all-targets`, `cargo clippy --all-targets` et `cargo test` sortent 0 (un test passe) ; `cargo run` a tenu 8 s sans sortie d'erreur, fenêtre non observée.
14
+ Non vérifié, et donc non affirmé : `cargo deny check` (outil absent ; la liste de licences de `deny.toml` vient de `cargo metadata`, pas d'un gate vert), une exécution Linux, une exécution Windows, une preuve visuelle.
15
+ N'installe rien de plus : pas de CLI de capture, pas de runtime asynchrone, pas de base locale, pas de `cargo-nextest`/`cargo-deny`, pas d'assets — GPUI Kit les fournit.
@@ -0,0 +1,35 @@
1
+ # `cargo deny check` exits with a bitmask: 1 advisories, 2 bans, 4 licenses, 8 sources.
2
+ # A gate tests `!= 0`, never `== 1`.
3
+ #
4
+ # The allow list below is measured, not guessed: it is the set of licenses that at
5
+ # least one of the 853 packages resolved by `cargo metadata` cannot avoid (the GPUI
6
+ # Kit tree pulls MPL-2.0, Unicode-3.0, 0BSD, Zlib, ISC, BSD-2-Clause, BSD-3-Clause,
7
+ # CC0-1.0 and NCSA). `cargo deny check` itself has never been run here: the tool is
8
+ # not installed.
9
+ [advisories]
10
+ yanked = "deny"
11
+
12
+ [licenses]
13
+ # `self_cell` is `Apache-2.0 OR GPL-2.0-only` and `r-efi` is
14
+ # `MIT OR Apache-2.0 OR LGPL-2.1-or-later`: both are satisfied by a permissive branch,
15
+ # which is why no copyleft identifier appears here.
16
+ allow = [
17
+ "MIT",
18
+ "Apache-2.0",
19
+ "Unicode-3.0",
20
+ "0BSD",
21
+ "Zlib",
22
+ "ISC",
23
+ "BSD-2-Clause",
24
+ "BSD-3-Clause",
25
+ "MPL-2.0",
26
+ "CC0-1.0",
27
+ "NCSA",
28
+ ]
29
+
30
+ [bans]
31
+ multiple-versions = "warn"
32
+
33
+ [sources]
34
+ unknown-registry = "deny"
35
+ unknown-git = "deny"
@@ -0,0 +1,2 @@
1
+ edition = "2024"
2
+ max_width = 100
@@ -0,0 +1,74 @@
1
+ //! Minimal GPUI Kit window: one button that counts its own clicks.
2
+
3
+ use gpui_kit::{
4
+ Context, Render, Window, WindowOptions, component::button::Button, div, prelude::*,
5
+ };
6
+
7
+ /// Application state: how many times the button was clicked.
8
+ struct Counter {
9
+ clicks: u32,
10
+ }
11
+
12
+ impl Render for Counter {
13
+ fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
14
+ div()
15
+ .size_full()
16
+ .flex()
17
+ .items_center()
18
+ .justify_center()
19
+ .child(
20
+ Button::new("count")
21
+ .label(format!("clicked {} times", self.clicks))
22
+ .on_click(cx.listener(|this, _, _, cx| {
23
+ this.clicks += 1;
24
+ cx.notify();
25
+ })),
26
+ )
27
+ }
28
+ }
29
+
30
+ fn main() {
31
+ gpui_kit::application().run(|cx| {
32
+ gpui_kit::init(cx);
33
+ gpui_kit::open_window(WindowOptions::default(), cx, |_, cx| {
34
+ cx.new(|_| Counter { clicks: 0 })
35
+ })
36
+ .expect("the main window opens");
37
+ });
38
+ }
39
+
40
+ #[cfg(test)]
41
+ mod tests {
42
+ use super::Counter;
43
+ use gpui_kit::{
44
+ AppContext as _, Bounds, Point, TestAppContext, WindowBounds, WindowOptions, px, size,
45
+ test::TestWindowExt as _,
46
+ };
47
+
48
+ #[gpui_kit::test]
49
+ fn a_click_increments_the_counter(cx: &mut TestAppContext) {
50
+ cx.update(gpui_kit::init);
51
+ let (window, counter) = cx.update(|cx| {
52
+ gpui_kit::open_window(
53
+ WindowOptions {
54
+ window_bounds: Some(WindowBounds::Windowed(Bounds {
55
+ origin: Point::default(),
56
+ size: size(px(480.), px(320.)),
57
+ })),
58
+ ..Default::default()
59
+ },
60
+ cx,
61
+ |_, cx| cx.new(|_| Counter { clicks: 0 }),
62
+ )
63
+ .expect("the headless window opens")
64
+ });
65
+
66
+ cx.update_window(window, |_, window, cx| {
67
+ window.render_frame(cx);
68
+ window.click("count", cx);
69
+ })
70
+ .expect("the click is dispatched");
71
+
72
+ assert_eq!(cx.update(|app| counter.read(app).clicks), 1);
73
+ }
74
+ }
@@ -0,0 +1,29 @@
1
+ # Gate commands and their exit codes
2
+
3
+ Measured on `cargo 1.98.1` / `rustc 1.98.1` on 2026-11-28. Each claim carries its marker.
4
+
5
+ ## `cargo fmt --check`
6
+
7
+ Exits 1 as soon as formatting drifts, printing the diff and touching nothing. The shape is set by `rustfmt.toml` (`edition = "2024"`, `max_width = 100`), not by the command line. `Fait vérifié` (local run)
8
+
9
+ ## Warnings are denied by configuration
10
+
11
+ `[build] warnings = "deny"` in `.cargo/config.toml`, or `CARGO_BUILD_WARNINGS=deny` in the environment, turns every rustc warning into an error for every target with the cache intact. `-- -D warnings` changes the rustc command line, so it invalidates the cache; it is not the path a profile takes. `Fait vérifié` (local run: `error: warnings are denied by build.warnings configuration`)
12
+
13
+ Consequence for the templates: the lint reaches integration-test targets too, and a file in `tests/` without a `//!` header fails the build with `missing documentation for the crate`. `Fait vérifié` (local run)
14
+
15
+ ## `cargo deny check` returns a bitmask
16
+
17
+ 1 advisories, 2 bans, 4 licenses, 8 sources. Two failing checks return 6. A gate compares `!= 0`; comparing `== 1` reads a license failure as a pass. `Fait vérifié` (cargo-deny documentation)
18
+
19
+ Configuration lives in `deny.toml` at the project root. `Fait vérifié` (cargo-deny documentation)
20
+
21
+ ## `unused_dependencies` is nightly-only
22
+
23
+ On 1.98.1, a `[lints.cargo]` table is not recognised: Cargo prints `unused manifest key` with the hint `switch to nightly channel you can pass -Zcargo-lints`, and the build still exits 0. `Fait vérifié` (local run, 2026-11-28)
24
+
25
+ So `cargo machete` stays the stable way to find unused dependencies, run on demand. It never enters the fast gate: the binary is absent from the reference machine, and a missing tool is a permanent red, not a signal.
26
+
27
+ ## `cargo semver-checks` needs a baseline
28
+
29
+ The check compares the working tree to a published version; a crate that was never published has no baseline to compare with, so the gate only starts being meaningful after the first release. `Hypothèse` (to confirm on the first published release)
@@ -0,0 +1,36 @@
1
+ # The profiles
2
+
3
+ A profile is a directory shipped with this skill, under `profiles/`. It owns the manifest, the lints, the gate configuration, the `Profile:` line and a README of at most fifteen lines. `scaffold` adds nothing to it and removes nothing from it.
4
+
5
+ ## `rust-library`
6
+
7
+ Files: `Cargo.toml`, `Cargo.lock`, `src/lib.rs`, `.cargo/config.toml`, `rustfmt.toml`, `deny.toml`, `AGENTS.md`, `README.md`.
8
+
9
+ - Edition 2024, `rust-version = "1.97"`, no dependency at all.
10
+ - Lints: `unsafe_code = "forbid"`, `missing_docs = "warn"`, `clippy::pedantic` at `warn` with four written waivers: `module_name_repetitions`, `must_use_candidate`, `missing_errors_doc`, `missing_panics_doc`.
11
+ - Tests: one unit test and one doctest in `src/lib.rs`.
12
+ - Extra gate: `cargo semver-checks`, once a reference version exists.
13
+
14
+ ## `rust-cli`
15
+
16
+ Files: the same set, plus `src/main.rs` and `tests/cli.rs`, and no `src/lib.rs`.
17
+
18
+ - One binary target and no library target — that absence is what Lathe reads as `rust-cli`.
19
+ - `main` returns `std::process::ExitCode`: success for a greeting, `ExitCode::from(2)` and a usage line on `stderr` without an argument.
20
+ - Tests: two unit tests in `main.rs`, two integration tests in `tests/cli.rs` that run `env!("CARGO_BIN_EXE_rust-cli")`.
21
+
22
+ ## `rust-native-desktop`
23
+
24
+ Files: `Cargo.toml`, `Cargo.lock`, `src/main.rs`, `.cargo/config.toml`, `rustfmt.toml`, `deny.toml`, `AGENTS.md`, `README.md`.
25
+
26
+ - `gpui-kit = "0.11"`, with `test-support` in `[dev-dependencies]` so the headless harness stays out of the shipped binary.
27
+ - One binary target and no library target: `src/main.rs` opens a single window showing a counter.
28
+ - Tests: one `#[gpui_kit::test]` that renders the window off screen, clicks the button and reads the counter back. An interaction, never a picture.
29
+ - `deny.toml` allows the licences GPUI Kit's tree brings — MPL-2.0, Unicode-3.0, 0BSD, Zlib, ISC, BSD-2-Clause, BSD-3-Clause, CC0-1.0, NCSA — none of which the tree can avoid.
30
+ - The `Cargo.lock` travels with the profile, so the copy resolves the same 853 packages byte for byte.
31
+
32
+ The profile is complete; the official skill is not. `gpui-kit-design-guides` is installed in no project here, so `gates.py deps` reports a project holding `gpui-kit` red until that skill lands in `.agents/skills/`. Naming that install is the gap, and the copy still builds.
33
+
34
+ ## Why the copy keeps the profile's name
35
+
36
+ `package.name` stays as the profile wrote it. Renaming is an ordinary edit, not a scaffold step, and each profile's `AGENTS.md` lists every place the name appears so the edit stays exhaustive. A copy that rewrites files would be a template engine, which this step is not.
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: update
3
+ description: Bring Lathe and the dependencies it declares to the version the source publishes.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Update
8
+
9
+ Move an installed project from the version it carries to the version its source publishes, writing
10
+ only the delta and stopping at the first local edit. `framework.py update` judges: three hashes — the
11
+ disk, `.framework/installed.json`, and a fresh lock — in that order (`docs/execution/BACKLOG-WAVE.md`,
12
+ contract table). This step reads that verdict, acts on it once, and reports it verbatim. It updates
13
+ this project from the source the lock records, and writes exactly the files the delta names. That
14
+ recorded git source is what the run reads, so every run starts from one argument: the project.
15
+
16
+ The script is not copied into the project: run it from the Lathe checkout you updated from, and read
17
+ its options with `--help` rather than from this page.
18
+
19
+ ## Non-negotiables
20
+
21
+ - **The delta is the unit.** A file whose hash still matches is left alone; the update writes the
22
+ files whose recorded hash differs from the new lock (`D-31`).
23
+ - **A local edit is a question, not an obstacle.** Disk differs from what `.framework/installed.json`
24
+ recorded means someone changed that file here: exit 1, the file named, the user decides. `--force`
25
+ overwrites their bytes and is the only way past; pass it on their word, never on yours.
26
+ - **`--check` first, every time.** It writes nothing and exits 1 the moment one divergence exists, so
27
+ the delta is read before anything moves.
28
+ - **A refusal is an answer.** Exit 1 is a result to report; exit 2 is a wrong invocation and produced
29
+ no verdict. Neither turns into "it worked".
30
+ - **Quote the command.** No sentence claims an update happened unless it carries the line the command
31
+ printed and its exit code.
32
+ - **Dependencies ride the same source.** The lock names them — `mattpocock/skills` at a commit,
33
+ `no-more-agents-dot-md` — and update reads them from the lock's git `source`, the source install
34
+ used, never from npm (`D-30`).
35
+
36
+ ## 1. Ask for the verdict before anything writes
37
+
38
+ ```bash
39
+ framework.py update --project . --check
40
+ ```
41
+
42
+ - `0` — up to date. Quote that line, stop here; no later step runs.
43
+ - `1` — a delta, a conflict, a file the source no longer ships, or an identity that moved while no file
44
+ did. Go to step 2.
45
+ - `2` — the invocation is wrong, so nothing was judged. Read `--help`, rerun, and say the first run
46
+ produced no verdict.
47
+
48
+ ## 2. Sort the four reports
49
+
50
+ | Disk against `.framework/installed.json` | Recorded against the fresh lock | What it is | Where it goes |
51
+ |---|---|---|---|
52
+ | equal | different | a file the source moved on | step 3: the delta, written |
53
+ | different | anything | a file edited in this project | step 4: a conflict, written only with `--force` |
54
+ | equal | absent from the fresh lock | `no longer shipped` | nowhere: the file stays, and the report names it |
55
+ | no record, different bytes on disk | new in the fresh lock | a file this project wrote where the source now ships one | step 4: a conflict, written only with `--force` |
56
+ | equal | the same files, the version or the commit moved | an identity change, nothing to copy | step 3: the recorded lock rewritten, no file written |
57
+
58
+ The first row is the normal case, and it is why an update is not a reinstall: unchanged files are
59
+ never rewritten. The second row can sit beside it — one run may carry both. The third row is the
60
+ source's decision, not the project's: a file the source dropped is reported `no longer shipped, left
61
+ in place` and deleted by nobody, so a project keeps the file it has until its user says otherwise.
62
+
63
+ The fourth row is the file this project wrote at a path the fresh lock now ships, which
64
+ `.framework/installed.json` never recorded. Those bytes are the project's, so it is a conflict like
65
+ an edit: reported `modified locally`, written only with `--force`.
66
+
67
+ The fifth row is what a corrected release produces: the source bumped its version or moved to another
68
+ commit over an unchanged tree, so no file differs and the project would otherwise stay recorded under
69
+ a version it no longer holds. `update` rewrites the recorded lock, copies nothing, exits `1` like any
70
+ other update, and prints `identity only: no file moved, the recorded lock was rewritten`. Quote that
71
+ line: zero files written is not nothing happened.
72
+
73
+ ## 3. Write the delta
74
+
75
+ ```bash
76
+ framework.py update --project .
77
+ ```
78
+
79
+ Only the delta moves. Then read the count the command printed, not the files you hoped for.
80
+
81
+ ## 4. Put a conflict to the user
82
+
83
+ Name the file, say that the bytes on disk are not the bytes Lathe recorded, and ask. Restoring the
84
+ recorded version is `--force`; keep the local version is no update for that file. Both answers are
85
+ the user's, and the rest of the delta may still apply — say which files it covers before they choose.
86
+
87
+ ## 5. Point at another source
88
+
89
+ `--source PATH` reads a checkout, `--source URL` clones it shallow into a temporary directory, reads
90
+ the lock of that copy and deletes the clone whatever happens. Use it when the user names a fork, a
91
+ branch or a tag; leave it out and the lock's recorded source is used.
92
+
93
+ ## 6. Prove what the project now holds
94
+
95
+ ```bash
96
+ framework.py doctor --project .
97
+ ```
98
+
99
+ Exit `0`, or the report says the update left drift. `doctor` prints lines this step quotes verbatim:
100
+ `installed <version> (<commit>, <digest8>)`, one `upstream … present N/N` per source, and `CLEAN`.
101
+ The first tells two installs of the same version apart; the others carry each dependency's commit and
102
+ its live count over the total that source names (`D-30`, `D-46`).
103
+
104
+ ## Done when
105
+
106
+ - `--check` ran before any write, and its exit code is in the report.
107
+ - Either "up to date" with exit `0`, or the number of files written and the list of conflicts, quoted
108
+ from the command that reported them.
109
+ - Every conflict was put to the user, and no `--force` was passed without their word.
110
+ - Every file reported `no longer shipped` is named in the report and still on disk.
111
+ - An identity-only update is reported as such: the report quotes `identity only: no file moved, the
112
+ recorded lock was rewritten` and the `0 file(s) written` count, and says the version moved while no
113
+ file did — never "nothing changed".
114
+ - `framework.py doctor --project .` exits `0` after a write, and the report quotes its
115
+ `installed <version> (<commit>, <digest8>)` line, its `upstream … present N/N` lines and `CLEAN`.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: verify-visual
3
+ description: Prove a desktop screen is correct with a versioned capture. Use when a ticket is fully checked but no capture of it exists, when a layout change needs proof, or when the user asks whether a screen still matches what was agreed.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Verify visual
8
+
9
+ Turn a finished screen into evidence: build it, launch it on temporary data, capture the variants
10
+ asked for, compare each against a baseline under version control, return a verdict carrying a number.
11
+ It fixes nothing and reviews nothing: a bug behind the difference is `diagnosing-bugs`, judging the
12
+ change is `code-review`.
13
+
14
+ Platform state, verified 2026-11-28 on macOS arm64: the `rust-native-desktop` profile ships and its
15
+ headless test passes. The capture path itself has never been executed here — no baseline exists in
16
+ this repository — so this step is written, not proven. It can never be declared cross-OS: GPUI Kit
17
+ paints on macOS (Metal) and Linux (WGPU) only, and upstream CI runs its pixel step on
18
+ `!= windows-latest` (`E-17`). Entries `E-17` to `E-24` are `EVIDENCE.md`; `Axiome` marks a rule this
19
+ project imposes on itself.
20
+
21
+ ## Non-negotiables
22
+
23
+ - **No pixels on Windows.** Say it in one sentence and stop: a Windows run is a missing capture, not a weaker one (`E-17`).
24
+ - **No companion CLI.** Captures come from a test built with `test-support`, or from the app's own
25
+ snapshot mode; there is no capture binary to call (`E-18`).
26
+ - **A new baseline requires an explicit, recorded acceptance** by a human: failure writes `.new`, review accepts (`E-23`).
27
+ - **A non-zero difference fails.** "Probably acceptable" is not a verdict; comparison is a hash plus
28
+ a bounded metric, never a look (`E-23`).
29
+ - **Never regenerate a baseline to make the gate pass**, and never let CI write one (`E-23`).
30
+ - **Never capture the user's data.** The app runs on a temporary store; real rows are a leak (`Axiome`).
31
+
32
+ ## 1. Check the platform, then build
33
+
34
+ ```bash
35
+ uname -s # Darwin or Linux: continue. Anything else: stop and say why (E-17)
36
+ cargo build -p <app> # must exit 0; quote the code
37
+ ```
38
+
39
+ A build failure is not a visual defect: report the exit code and stop. A missing window is not a
40
+ blank screen either — it is a failure with its own line in the verdict.
41
+
42
+ ## 2. Launch on temporary data
43
+
44
+ ```bash
45
+ store="$(mktemp -d)"; ./target/debug/<app> --store "$store" &
46
+ ```
47
+
48
+ Wait for the window; the wait rule and its failure shapes belong to `probe`
49
+ (`references/wait-and-read.md` there). Cleanup is registered before the launch.
50
+
51
+ ## 3. Capture the requested variants
52
+
53
+ The default set is `light` and `dark`; the ticket may name more. Name them, never pick them silently.
54
+ Each capture writes **two** files: the PNG and the layout dump. The baseline is
55
+ `docs/shots/<ticket>-<variant>.png`, the exact path Lathe reads as proof this step ran
56
+ (`skills/lathe/SKILL.md`, rung 7). A fresh capture lands beside it as `<ticket>-<variant>.new.png`.
57
+
58
+ ## 4. Compare against the versioned baseline
59
+
60
+ Hash first: identical bytes are a pass with a metric of 0, quoted as `sha256:<digest>`. Different
61
+ bytes go to the declared bounded metric — differing-pixel share above a per-channel tolerance, plus
62
+ the layout dump diff — and that number goes into the verdict. No baseline yet means this run produces
63
+ `.new` files awaiting acceptance; it never means "skip".
64
+
65
+ ## 5. On difference, stop and hand the decision over
66
+
67
+ Keep the baseline untouched, keep the `.new` file, print the metric. Acceptance is a human act
68
+ recorded on the ticket: who accepted, when, which file — that record is the acceptance, a newer file
69
+ on disk is not. `references/baseline.md` holds the lifecycle and the threshold rule.
70
+
71
+ ## 6. Return one line per variant
72
+
73
+ ```text
74
+ LIGHT match sha256:9f2c…
75
+ DARK differ 0.7 % > 0.1 % -> docs/shots/03-settings-dark.new.png
76
+ ```
77
+
78
+ ## Done when
79
+
80
+ - `docs/shots/` holds one PNG and one layout dump per requested variant, and the report lists them.
81
+ - Every variant carries a hash or a bounded metric; none is left "probably fine".
82
+ - A difference produced `.new` files and no baseline was overwritten by this run.
@@ -0,0 +1,46 @@
1
+ # Baseline lifecycle
2
+
3
+ The deep half of `verify-visual`: how a baseline is born, compared, accepted, and never silently
4
+ replaced.
5
+
6
+ ## States of one capture
7
+
8
+ | File on disk | Meaning | Who moves it |
9
+ |---|---|---|
10
+ | `<ticket>-<variant>.png` | accepted baseline, versioned | nobody, in a gate |
11
+ | `<ticket>-<variant>.new.png` | a capture that did not match, or had no baseline | the capture |
12
+ | `<ticket>-<variant>.layout.json` | the tree geometry that produced it | the capture |
13
+
14
+ Failure writes `.new`. Review reads it. Acceptance is the human step that moves `.new` onto the
15
+ baseline path and records the decision on the ticket — this is `insta`'s model, minus the tool
16
+ (`EVIDENCE.md` `E-23`). The CI never performs that move.
17
+
18
+ ## The metric
19
+
20
+ Two comparisons, in this order, both deterministic:
21
+
22
+ 1. **Hash.** Byte-identical PNG is a match. Report `sha256:<digest>`. A re-encode that changes bytes
23
+ without changing pixels still counts as a difference: the capture settings, not the diff, are
24
+ then wrong.
25
+ 2. **Bounded metric.** Differing-pixel share = pixels whose max channel delta exceeds the tolerance,
26
+ divided by total pixels, compared to a threshold **declared in the capture configuration** before
27
+ the diff is seen. The layout dump diff runs alongside it and names the moved node.
28
+
29
+ No maintained Rust equivalent of `pixelmatch` exists (`E-23`), so the metric is a small function we
30
+ write and test — not a perceptual judgement by eye. A threshold chosen after looking at the diff is
31
+ not a threshold (`Axiome`).
32
+
33
+ ## What a good baseline contains
34
+
35
+ - a deterministic surface: same window size, same scale factor, same scroll offset, same accent, so
36
+ the only variable is the change under review;
37
+ - a store with a known, small fixture — never the user's rows;
38
+ - the variant in the file name, because a light capture and a dark capture never compare to each
39
+ other;
40
+ - a layout dump, so a difference can be attributed to a node instead of to "somewhere".
41
+
42
+ ## What this file does not cover
43
+
44
+ Rendering does not exist on Windows (`E-17`): a baseline is only ever compared on macOS or Linux, and
45
+ a request to verify on Windows gets one sentence of refusal, not a degraded run. Text is never
46
+ asserted here — there is no rendered-text query (`E-19`); text belongs to the store and to `probe`.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: visual-loop
3
+ description: Work through several independent desktop tickets, proving each one visually before starting the next. Use when two or more ready tickets exist on a desktop profile, or when the user asks to keep fixing screens until the list is done.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Visual loop
8
+
9
+ Run a queue of independent tickets one at a time, with a capture-and-compare gate between each:
10
+ build by `implement`, prove by `verify-visual`, and stop the whole loop at the first failure nobody
11
+ has explained. The loop schedules and reports; it writes no code and takes no capture itself.
12
+
13
+ ## Non-negotiables
14
+
15
+ - **One ticket at a time.** No ticket starts before the previous one carries a verdict. Two writers
16
+ on one working tree end with a tree nobody can attribute.
17
+ - **Green before the next.** Green means every requested variant carries a hash or a bounded metric.
18
+ "Almost", "only a shadow", a `.new` file awaiting review: all red.
19
+ - **Hard stop at the first unexplained failure.** Build error, missing window, non-zero difference,
20
+ flaky second run: stop, keep the artifact, quote the number, and do not stack the next ticket on
21
+ top of it.
22
+ - **Never regenerate a baseline to keep looping.** Acceptance is a human act recorded on the ticket
23
+ (`E-23`); a loop that rewrites its own reference proves nothing about the next ticket.
24
+ - **Never touch the queue.** No splitting, reordering, re-scoping, or ticking a criterion mid-loop;
25
+ that belongs to `to-tickets` and `implement`.
26
+ - **Desktop only.** In `rust-library` and `rust-cli` this step does not exist: say it in one sentence
27
+ and let Lathe carry on (`E-17`, `E-18`).
28
+
29
+ ## 1. Confirm there is a queue
30
+
31
+ ```bash
32
+ head -5 AGENTS.md # Profile: rust-native-desktop
33
+ ls .scratch/<feature>/issues/*.md # tickets, one file each
34
+ ```
35
+
36
+ Two or more tickets with no `Blocked by`, and none of them checked, is a loop. One ticket, or a
37
+ blocked front, is `implement` — say so and stop.
38
+
39
+ ## 2. Freeze the order
40
+
41
+ Name the order once (ticket number, then blocking edges) and write it in the report before the first
42
+ ticket. The order does not change during the run: a loop that reorders hides a failure.
43
+
44
+ ## 3. Per ticket, two handoffs, nothing between them
45
+
46
+ ```text
47
+ /skill:implement # this ticket only
48
+ /skill:verify-visual # the gate: one line per variant, hash or metric
49
+ ```
50
+
51
+ `/skill:` is a user command in this runtime, so the loop hands off instead of executing: neither
52
+ step's work is restated here, and a run resumes once both lines have produced their artifact.
53
+ Nothing else runs between them — no second gate to see whether the first one turns green.
54
+
55
+ ## 4. Read the verdict
56
+
57
+ Green is a line per variant carrying `match sha256:<digest>` or a metric under the declared
58
+ threshold. Record it against the ticket and start the next one.
59
+
60
+ ## 5. On red, stop and hand the decision over
61
+
62
+ Quote the command, the exit code, the metric and the `.new` path. Name the decision — accept the new
63
+ baseline, or fix — and stop the loop. A second attempt belongs to a new run with that decision
64
+ recorded, never to this one.
65
+
66
+ ## Done when
67
+
68
+ - A table lists one row per ticket: ticket, gate verdict with its number, next action.
69
+ - Every row but the last is green; the last one is either green (the queue is done) or the first red
70
+ verdict that stopped the loop.
71
+ - No baseline was written by this run, no ticket file was edited, and `docs/shots/` holds the
72
+ captures the run produced.
@@ -0,0 +1,41 @@
1
+ # Batch to review
2
+
3
+ **Trigger:** a batch of tickets is written and the work is being carried to its end — "finish the
4
+ batch", "review the batch", "eight tickets, then we look".
5
+
6
+ **Preconditions:** tickets exist in `.scratch/<feature>/issues/` and the tree is committed. The
7
+ campaign's base must have been recorded before the first ticket (`gates.py mutants --start`); if it
8
+ was not, record the commit the batch started from with `--base`, once, and say so.
9
+
10
+ ## Steps
11
+
12
+ 1. `implement` — one ticket at a time, each criterion `- [ ]` to `- [x]`. Inside every ticket the loop
13
+ is `tdd`: red, then green, then the next ticket. The red run is quoted in the ticket; a criterion
14
+ ticked without a red run behind it is a claim, not a result.
15
+ 2. `gates.py verify` — after each ticket, so a green test means the suite agrees, not only the ticket.
16
+ 3. `mutants` — **once, after the last ticket**, before any review. `.lathe/mutants/verdict` must name
17
+ the current `HEAD`; survivors are killed by a new test or justified in writing. This is the step
18
+ that asks whether the tests could have failed at all.
19
+ 4. `code-review` — tree dirty, campaign certified. The review reads `.lathe/mutants/mutants.out/` as
20
+ evidence and cites it; a review that starts before the campaign reviews tests nobody has doubted.
21
+ 5. `documentation` / `journal` / `retro` — the tail rungs, unchanged.
22
+
23
+ ## Gates
24
+
25
+ - `python3 .agents/scripts/gates.py verify --project <dir>` — the whole suite per ticket.
26
+ - `python3 .agents/scripts/gates.py mutants --project <dir>` — exit `0`, `VERDICT: tout vert`, and
27
+ either an empty `missed.txt` or every line of it accounted for in `.lathe/justified.txt`.
28
+ - `python3 .agents/scripts/gates.py fast --project <dir>` — before handing the batch over, so the
29
+ review does not start with formatting noise.
30
+
31
+ ## Why the mutation step is not per ticket
32
+
33
+ A ticket's code is too small a unit: the campaign costs a full build and a suite run per mutant, and a
34
+ gate that fires on every ticket is a gate people disable. It sits at the end of a batch because that is
35
+ the first moment the batch's diff is complete and the last moment before someone reads it.
36
+
37
+ ## What a review is allowed to assume
38
+
39
+ Only what the gate certified: the commit range, the survivor list, and the justifications. A test that
40
+ went green has proved it runs; the campaign has proved it can fail. The review is where the second
41
+ question gets asked on purpose.
@@ -0,0 +1,38 @@
1
+ # Framework improvement
2
+
3
+ **Trigger:** a skill routes to the wrong step, a gate reports a verdict it should not, a workflow
4
+ needs a step that does not exist, or a document contradicts what is on disk.
5
+
6
+ **Preconditions:** a reproduction — a failing eval case, a non-zero gate, or a file and a line whose
7
+ text contradicts the repository. An opinion about how the framework should work is not a trigger.
8
+
9
+ **Steps**
10
+
11
+ 1. `grill-with-docs` — settle the decision; writes the ADR under `docs/adr/` and the term in
12
+ `docs/GLOSSARY.md`. A behaviour change with no ADR is not decided.
13
+ 2. `to-spec` — `.scratch/<feature>/spec.md`.
14
+ 3. `to-tickets` — `.scratch/<feature>/issues/*.md`, one file per skill, gate or document touched.
15
+ 4. `writing-for-agents` — before editing any `SKILL.md`, `AGENTS.md` or workflow page: the prose is
16
+ the product, and it is read under context pressure.
17
+ 5. `tdd` — a test in `scripts/tests/` that fails on the current script, when the change is code.
18
+ 6. `implement` — the change, one ticket. When a skill changes, its eval case in
19
+ `skills/lathe/evals/routing.md` is part of the ticket, not a follow-up (`SKILL-CONTRACT` §5).
20
+ 7. `mutants` — every ticket checked and `.lathe/mutants/verdict` does not name `HEAD` (rung 8)
21
+ 8. `code-review` — tree dirty, every ticket checked (rung 9).
22
+
23
+ **Gates**
24
+
25
+ - `python3 scripts/tests/test_*.py` — must stay green; they exercise the gate harness offline.
26
+ - `python3 .agents/scripts/framework.py build-lock --check` — a changed skill file with a stale lock makes
27
+ `install` copy a wrong record and `doctor` report DRIFT on a healthy install.
28
+ - `python3 .agents/scripts/framework.py install --project <scratch>` then `doctor --project <scratch>` —
29
+ a clean install of the changed tree, `CLEAN` and exit 0.
30
+ - `python3 scripts/eval_routing.py` — the whole lathe set, archived under `docs/evals/`; the bar is
31
+ 90 % of cases and zero disqualified. A single case: `--case <NN>`.
32
+ - `python3 .agents/scripts/gates.py verify --project <dir>` — when the change touches a Rust profile.
33
+
34
+ **Stop condition:** pytest green, `build-lock --check` up to date, `doctor` `CLEAN` on a scratch
35
+ install, and the eval run meets the bar — or the miss is written down in the report.
36
+
37
+ **Optional:** `retro` after a bad week; `improve-codebase-architecture` when a script has grown past
38
+ its seam; `prototype` when a gate design has to be tried before it is specified.