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.
- package/LICENSE +21 -0
- package/README.md +135 -2
- package/bin/create-lathe.js +80 -0
- package/dist/framework.lock +113 -0
- package/dist/package/crates/instrument/Cargo.lock +415 -0
- package/dist/package/crates/instrument/Cargo.toml +27 -0
- package/dist/package/crates/instrument/examples/instrument.rs +73 -0
- package/dist/package/crates/instrument/src/client.rs +128 -0
- package/dist/package/crates/instrument/src/lib.rs +32 -0
- package/dist/package/crates/instrument/src/logging.rs +109 -0
- package/dist/package/crates/instrument/src/protocol.rs +49 -0
- package/dist/package/crates/instrument/src/registry.rs +166 -0
- package/dist/package/crates/instrument/src/selftest.rs +314 -0
- package/dist/package/crates/instrument/src/server.rs +303 -0
- package/dist/package/crates/instrument/tests/command_log.rs +60 -0
- package/dist/package/crates/instrument/tests/round_trip.rs +134 -0
- package/dist/package/crates/instrument/tests/selftest_fail.rs +25 -0
- package/dist/package/crates/instrument/tests/selftest_pass.rs +24 -0
- package/dist/package/crates/instrument/tests/support/mod.rs +38 -0
- package/dist/package/pi/context/journal-de-lot.md +24 -0
- package/dist/package/pi/context/tech-skill.md +19 -0
- package/dist/package/pi/context/ticket-closed.md +18 -0
- package/dist/package/scripts/framework.py +1314 -0
- package/dist/package/scripts/gates.py +1134 -0
- package/dist/package/scripts/setup.py +195 -0
- package/dist/package/skills/bootstrap/SKILL.md +110 -0
- package/dist/package/skills/documentation/SKILL.md +110 -0
- package/dist/package/skills/documentation/references/agents-md.md +70 -0
- package/dist/package/skills/documentation/references/corpus.md +112 -0
- package/dist/package/skills/journal/SKILL.md +81 -0
- package/dist/package/skills/journal/references/entry.md +172 -0
- package/dist/package/skills/lathe/SKILL.md +168 -0
- package/dist/package/skills/lathe/evals/routing.md +196 -0
- package/dist/package/skills/lathe/references/install.md +128 -0
- package/dist/package/skills/lathe/references/invariants.md +31 -0
- package/dist/package/skills/mutants/SKILL.md +85 -0
- package/dist/package/skills/mutants/references/cargo-mutants.md +176 -0
- package/dist/package/skills/mutants/references/triage.md +88 -0
- package/dist/package/skills/optimize/SKILL.md +87 -0
- package/dist/package/skills/optimize/references/codspeed.md +126 -0
- package/dist/package/skills/probe/SKILL.md +82 -0
- package/dist/package/skills/probe/references/wait-and-read.md +53 -0
- package/dist/package/skills/replicate-ui/SKILL.md +64 -0
- package/dist/package/skills/rust/SKILL.md +147 -0
- package/dist/package/skills/rust/references/errors.md +63 -0
- package/dist/package/skills/rust/references/unsafe.md +65 -0
- package/dist/package/skills/scaffold/SKILL.md +78 -0
- package/dist/package/skills/scaffold/profiles/rust-cli/.cargo/config.toml +2 -0
- package/dist/package/skills/scaffold/profiles/rust-cli/AGENTS.md +22 -0
- package/dist/package/skills/scaffold/profiles/rust-cli/Cargo.lock +7 -0
- package/dist/package/skills/scaffold/profiles/rust-cli/Cargo.toml +17 -0
- package/dist/package/skills/scaffold/profiles/rust-cli/README.md +15 -0
- package/dist/package/skills/scaffold/profiles/rust-cli/deny.toml +14 -0
- package/dist/package/skills/scaffold/profiles/rust-cli/rustfmt.toml +2 -0
- package/dist/package/skills/scaffold/profiles/rust-cli/src/main.rs +38 -0
- package/dist/package/skills/scaffold/profiles/rust-cli/tests/cli.rs +27 -0
- package/dist/package/skills/scaffold/profiles/rust-library/.cargo/config.toml +2 -0
- package/dist/package/skills/scaffold/profiles/rust-library/AGENTS.md +21 -0
- package/dist/package/skills/scaffold/profiles/rust-library/Cargo.lock +7 -0
- package/dist/package/skills/scaffold/profiles/rust-library/Cargo.toml +18 -0
- package/dist/package/skills/scaffold/profiles/rust-library/README.md +15 -0
- package/dist/package/skills/scaffold/profiles/rust-library/deny.toml +14 -0
- package/dist/package/skills/scaffold/profiles/rust-library/rustfmt.toml +2 -0
- package/dist/package/skills/scaffold/profiles/rust-library/src/lib.rs +25 -0
- package/dist/package/skills/scaffold/profiles/rust-native-desktop/.cargo/config.toml +2 -0
- package/dist/package/skills/scaffold/profiles/rust-native-desktop/AGENTS.md +23 -0
- package/dist/package/skills/scaffold/profiles/rust-native-desktop/Cargo.lock +9252 -0
- package/dist/package/skills/scaffold/profiles/rust-native-desktop/Cargo.toml +24 -0
- package/dist/package/skills/scaffold/profiles/rust-native-desktop/README.md +15 -0
- package/dist/package/skills/scaffold/profiles/rust-native-desktop/deny.toml +35 -0
- package/dist/package/skills/scaffold/profiles/rust-native-desktop/rustfmt.toml +2 -0
- package/dist/package/skills/scaffold/profiles/rust-native-desktop/src/main.rs +74 -0
- package/dist/package/skills/scaffold/references/gates.md +29 -0
- package/dist/package/skills/scaffold/references/profiles.md +36 -0
- package/dist/package/skills/update/SKILL.md +115 -0
- package/dist/package/skills/verify-visual/SKILL.md +82 -0
- package/dist/package/skills/verify-visual/references/baseline.md +46 -0
- package/dist/package/skills/visual-loop/SKILL.md +72 -0
- package/dist/package/workflows/batch-to-review.md +41 -0
- package/dist/package/workflows/framework-improvement.md +38 -0
- package/dist/package/workflows/hard-bug.md +37 -0
- package/dist/package/workflows/new-rust-cli.md +33 -0
- package/dist/package/workflows/new-rust-desktop-app.md +41 -0
- package/dist/package/workflows/new-rust-library.md +34 -0
- package/dist/package/workflows/performance-work.md +41 -0
- package/dist/package/workflows/ui-change.md +40 -0
- package/package.json +33 -4
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Install Lathe into one project, in one command.
|
|
3
|
+
|
|
4
|
+
This is the front door the npm package calls (`npx create-lathe`). It does not
|
|
5
|
+
reimplement anything: the two upstream installers install the upstreams,
|
|
6
|
+
`framework.py bootstrap` checks the preconditions and copies the trees,
|
|
7
|
+
`framework.py doctor` produces the verdict. This file only orders them, stops at
|
|
8
|
+
the first refusal, and prints what to do next.
|
|
9
|
+
|
|
10
|
+
setup.py --project DIR # install
|
|
11
|
+
setup.py --project DIR --offline # same, but refuse instead of using the network
|
|
12
|
+
|
|
13
|
+
Two rules it must not break. Nothing is installed globally (D-28): a skill in
|
|
14
|
+
`~/.agents/skills` makes every project read the wrong copy, and `bootstrap`
|
|
15
|
+
already refuses it. Nothing is updated silently (D-50): an upstream already
|
|
16
|
+
present is left alone, and a mismatch between what it holds and what this package
|
|
17
|
+
pins is printed, not corrected.
|
|
18
|
+
|
|
19
|
+
Exit codes: 0 installed and clean, 1 refused or dirty, 2 usage error.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import argparse
|
|
25
|
+
import os
|
|
26
|
+
import shlex
|
|
27
|
+
import shutil
|
|
28
|
+
import subprocess
|
|
29
|
+
import sys
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
|
|
32
|
+
import framework
|
|
33
|
+
|
|
34
|
+
UPSTREAM_TIMEOUT = 600
|
|
35
|
+
MINIMUM_PYTHON = (3, 9)
|
|
36
|
+
PI_PROMPT_HINT = "/skill:lathe"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def step(number: int, title: str) -> None:
|
|
40
|
+
print(f"\n[{number}] {title}")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def said(message: str) -> None:
|
|
44
|
+
print(f" {message}")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def refuse(message: str) -> int:
|
|
48
|
+
print(f"\nrefusing: {message}", file=sys.stderr)
|
|
49
|
+
return 1
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def preflight() -> str | None:
|
|
53
|
+
"""The one missing prerequisite that stops the install, or None.
|
|
54
|
+
|
|
55
|
+
A refusal that names the missing tool and nothing else is worth more than a
|
|
56
|
+
list of six things that are fine.
|
|
57
|
+
"""
|
|
58
|
+
if sys.version_info[:2] < MINIMUM_PYTHON:
|
|
59
|
+
floor = ".".join(str(part) for part in MINIMUM_PYTHON)
|
|
60
|
+
return f"python {floor} or newer is required, this is {sys.version.split()[0]}"
|
|
61
|
+
if shutil.which("npx") is None:
|
|
62
|
+
return "npx is required to install the upstream skills (node 18 or newer ships it)"
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def upstream_commands(project: Path) -> list[tuple[dict, str]]:
|
|
67
|
+
"""One command per source whose skills are missing, and nothing for the others."""
|
|
68
|
+
installed = project / ".agents" / "skills"
|
|
69
|
+
jobs = []
|
|
70
|
+
for source in framework.UPSTREAMS:
|
|
71
|
+
absent = [n for n in source["names"] if not (installed / n / "SKILL.md").is_file()]
|
|
72
|
+
if absent:
|
|
73
|
+
jobs.append((source, source["hint"]))
|
|
74
|
+
else:
|
|
75
|
+
said(f"{source['name']}: present {len(source['names'])}/{len(source['names'])}")
|
|
76
|
+
return jobs
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def held_but_different(project: Path) -> list[str]:
|
|
80
|
+
"""Sources whose held commit differs from the pin. Reported, never corrected (D-50)."""
|
|
81
|
+
held = framework.project_upstream_commits(project)
|
|
82
|
+
notes = []
|
|
83
|
+
for source in framework.UPSTREAMS:
|
|
84
|
+
commit = held.get(source["name"], "")
|
|
85
|
+
if commit and not commit.startswith(source["commit"]):
|
|
86
|
+
notes.append(
|
|
87
|
+
f"{source['name']}: holds {commit[:7]}, this package pins {source['commit']} — "
|
|
88
|
+
f"refresh it with: {source['hint']}"
|
|
89
|
+
)
|
|
90
|
+
return notes
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def child_env() -> dict[str, str]:
|
|
94
|
+
"""The environment an upstream installer gets: ours, minus npm's own variables.
|
|
95
|
+
|
|
96
|
+
Measured 2026-11-29: `npx create-lathe` runs this file under npx, and the nested
|
|
97
|
+
`npx skills add …` then receives the outer invocation's `npm_*` variables. It does
|
|
98
|
+
not install the CLI, falls through to a shell, and fails with
|
|
99
|
+
`sh: skills: command not found`. Dropping `npm_*` is what makes the nested call a
|
|
100
|
+
fresh one instead of a continuation of ours.
|
|
101
|
+
"""
|
|
102
|
+
return {key: value for key, value in os.environ.items() if not key.startswith("npm_")}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def install_upstream(source: dict, command: str, project: Path, offline: bool) -> int:
|
|
106
|
+
said(f"{source['name']}: {source['skills']} skills missing")
|
|
107
|
+
if offline:
|
|
108
|
+
return refuse(f"{source['name']} is missing and --offline was given; run: {command}")
|
|
109
|
+
said(f"running: {command}")
|
|
110
|
+
try:
|
|
111
|
+
done = subprocess.run(
|
|
112
|
+
shlex.split(command),
|
|
113
|
+
cwd=project,
|
|
114
|
+
env=child_env(),
|
|
115
|
+
timeout=UPSTREAM_TIMEOUT,
|
|
116
|
+
check=False,
|
|
117
|
+
)
|
|
118
|
+
except (OSError, subprocess.TimeoutExpired) as exc:
|
|
119
|
+
return refuse(f"{command} could not run: {exc}")
|
|
120
|
+
if done.returncode != 0:
|
|
121
|
+
return refuse(f"{command} exited {done.returncode}")
|
|
122
|
+
return 0
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def ensure_target_ignored(project: Path) -> None:
|
|
126
|
+
"""Put `target/` in .gitignore, because the crate this installs builds into one.
|
|
127
|
+
|
|
128
|
+
The delivery used to carry `package/crates/.gitignore`. npm strips every
|
|
129
|
+
`.gitignore` from a tarball (measured: 0 in the packed file), so the file reached
|
|
130
|
+
the repository and never reached a project installed from npm. One line, appended
|
|
131
|
+
only when absent, is what actually survives both paths.
|
|
132
|
+
"""
|
|
133
|
+
ignore = project / ".gitignore"
|
|
134
|
+
text = ignore.read_text(encoding="utf-8") if ignore.is_file() else ""
|
|
135
|
+
if any(line.strip() in {"target/", "/target/", "target"} for line in text.splitlines()):
|
|
136
|
+
return
|
|
137
|
+
addition = ("\n" if text and not text.endswith("\n") else "") + "\n# Rust build artifacts\ntarget/\n"
|
|
138
|
+
ignore.write_text(text + addition, encoding="utf-8")
|
|
139
|
+
print(f" added target/ to {ignore.name}")
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def main(argv: list[str]) -> int:
|
|
143
|
+
parser = argparse.ArgumentParser(prog="lathe", description="Install Lathe into one project.")
|
|
144
|
+
parser.add_argument("--project", type=Path, default=Path("."), help="the project root")
|
|
145
|
+
parser.add_argument(
|
|
146
|
+
"--offline",
|
|
147
|
+
action="store_true",
|
|
148
|
+
help="never reach the network: refuse if an upstream is missing instead of installing it",
|
|
149
|
+
)
|
|
150
|
+
parser.add_argument("--force", action="store_true", help="overwrite files that differ")
|
|
151
|
+
args = parser.parse_args(argv)
|
|
152
|
+
|
|
153
|
+
project = args.project.resolve()
|
|
154
|
+
if not project.is_dir():
|
|
155
|
+
print(f"error: {project} is not a directory", file=sys.stderr)
|
|
156
|
+
return 2
|
|
157
|
+
print(f"Lathe — installing into {project}")
|
|
158
|
+
|
|
159
|
+
step(1, "prerequisites")
|
|
160
|
+
missing = preflight()
|
|
161
|
+
if missing is not None:
|
|
162
|
+
return refuse(missing)
|
|
163
|
+
said(f"python {sys.version.split()[0]}")
|
|
164
|
+
said(f"npx {shutil.which('npx')}")
|
|
165
|
+
|
|
166
|
+
step(2, "upstream skills")
|
|
167
|
+
jobs = upstream_commands(project)
|
|
168
|
+
for source, command in jobs:
|
|
169
|
+
code = install_upstream(source, command, project, args.offline)
|
|
170
|
+
if code != 0:
|
|
171
|
+
return code
|
|
172
|
+
for note in held_but_different(project):
|
|
173
|
+
said(f"note: {note}")
|
|
174
|
+
|
|
175
|
+
step(3, "framework")
|
|
176
|
+
code = framework.cmd_bootstrap(["--project", str(project)] + (["--force"] if args.force else []))
|
|
177
|
+
if code != 0:
|
|
178
|
+
print("\nnot installed: bootstrap refused above, and nothing else was written.", file=sys.stderr)
|
|
179
|
+
return code
|
|
180
|
+
|
|
181
|
+
ensure_target_ignored(project)
|
|
182
|
+
|
|
183
|
+
step(4, "verdict")
|
|
184
|
+
code = framework.cmd_doctor(["--project", str(project)])
|
|
185
|
+
if code != 0:
|
|
186
|
+
print("\ninstalled, but doctor is red: fix what it named before using the framework.", file=sys.stderr)
|
|
187
|
+
return code
|
|
188
|
+
|
|
189
|
+
print(f"\nnext: in Pi, type {PI_PROMPT_HINT} — or just tell your agent \"use Lathe\"")
|
|
190
|
+
print(f"the same two ways in, and nothing else to remember")
|
|
191
|
+
return 0
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
if __name__ == "__main__":
|
|
195
|
+
sys.exit(main(sys.argv[1:]))
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bootstrap
|
|
3
|
+
description: Install Lathe inside one project, check the Matt Pocock skills and `no-more-agents-dot-md` it needs, and name the official skill the project lacks.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Bootstrap
|
|
8
|
+
|
|
9
|
+
Turn one project into a project Lathe manages: its skills, its workflows, its Pi rules and its
|
|
10
|
+
record, all inside that project and nowhere else. `framework.py bootstrap` refuses first, on the
|
|
11
|
+
preconditions it can see, and installs only once they hold; this step names those preconditions, reads
|
|
12
|
+
the refusal second, and proves the result third.
|
|
13
|
+
|
|
14
|
+
Local is the unit. A project carries its own `.agents/` and its own record, and nothing a local install
|
|
15
|
+
writes is visible from another project. The script is not copied into the project: run it from the
|
|
16
|
+
Lathe checkout, and read its options with `--help` rather than from this page.
|
|
17
|
+
|
|
18
|
+
Bootstrap installs Lathe and the skills this package ships. The Matt Pocock skills,
|
|
19
|
+
`no-more-agents-dot-md` and each technology's official skill come from their own source, and
|
|
20
|
+
bootstrap's part is to check them and name the one that is missing.
|
|
21
|
+
|
|
22
|
+
## Non-negotiables
|
|
23
|
+
|
|
24
|
+
- **Local is the unit.** One project, one install, inside its own tree.
|
|
25
|
+
- **A global install reaches projects that never asked for it, and that reach is the failure.**
|
|
26
|
+
`~/.agents/skills/` holding a Lathe skill means this project is the wrong place to bootstrap: exit 1,
|
|
27
|
+
named, no warning path (`D-32`).
|
|
28
|
+
- **Nothing is written outside the project.** No `~` path, no system directory, no global flag —
|
|
29
|
+
there is none, and the refusal above is the whole global story.
|
|
30
|
+
- **The declared dependencies come first.** The skills both upstream sources name — 39 from Matt
|
|
31
|
+
Pocock, 3 from CodSpeed — and `no-more-agents-dot-md` are declared, not optional (`D-28`, `D-46`).
|
|
32
|
+
Each lock holds its commit and `doctor` prints a live count per source, so no number is written
|
|
33
|
+
down here.
|
|
34
|
+
- **`--force` is the user's.** It overwrites files this project already holds, edits included. Ask;
|
|
35
|
+
the answer is theirs.
|
|
36
|
+
- **Quote the exit code.** Installed is what the command printed, never what appears to have landed.
|
|
37
|
+
|
|
38
|
+
## 1. Name the preconditions
|
|
39
|
+
|
|
40
|
+
| Precondition | Where it is proved |
|
|
41
|
+
|---|---|
|
|
42
|
+
| the skills both upstream sources name | `.agents/skills/` in the target project: `ls .agents/skills/` lists the names, and `doctor` counts them per source installs, one directory each holding a `SKILL.md` |
|
|
43
|
+
| `no-more-agents-dot-md` | the Pi extension registry; its `.pi/context/*.md` rules are this framework's injection mechanism (`D-28`) |
|
|
44
|
+
| no Lathe skill installed globally | `ls ~/.agents/skills/` — one entry there and step 2 refuses |
|
|
45
|
+
|
|
46
|
+
A missing upstream dependency is the honest reason bootstrap cannot proceed: the framework's stages
|
|
47
|
+
hand off to those skills by name, so a run without them routes into steps that are not installed.
|
|
48
|
+
|
|
49
|
+
Step 1 reads `.agents/skills/` directly, because `framework.py doctor --project .` prints its
|
|
50
|
+
`upstream … present N/N` counts, one line per source, only once the project is installed — before that it refuses with
|
|
51
|
+
`no .framework/installed.json … the framework is not installed here`. Step 4 is where that line is
|
|
52
|
+
quoted; here it has nothing to count.
|
|
53
|
+
|
|
54
|
+
## 2. Install into this project
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
framework.py bootstrap --project .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Exit `0` — ready. Exit `1` — a precondition in step 1 is unmet, and the tool names it. Exit `2` — the
|
|
61
|
+
invocation is wrong, so nothing was installed and nothing was judged.
|
|
62
|
+
|
|
63
|
+
Exit `1` also arrives from the copy, on a file the project already holds with different content, or on
|
|
64
|
+
a `package/` that no longer matches `framework.lock`. Neither is a precondition: the first is `--force`
|
|
65
|
+
on the user's word or the file moved aside, and the second is `build-lock` in the checkout. Read the
|
|
66
|
+
message before naming a precondition — the tool's own line names the cause.
|
|
67
|
+
|
|
68
|
+
## 3. Read the refusal
|
|
69
|
+
|
|
70
|
+
A refusal is the result. Name the precondition it named, and stop there:
|
|
71
|
+
|
|
72
|
+
- **a global install** — the fix is removing that global skill, which is the user's decision and their
|
|
73
|
+
command. Say what would have to go, and install nothing meanwhile.
|
|
74
|
+
- **a missing dependency** — install it by its own documented means, then rerun bootstrap. Never
|
|
75
|
+
reimplement a skipped dependency inside the project: a local copy of an upstream skill is a fork
|
|
76
|
+
the next update cannot reconcile.
|
|
77
|
+
|
|
78
|
+
## 4. Prove it, do not claim it
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
framework.py doctor --project . # 0 CLEAN, 1 DRIFT
|
|
82
|
+
framework.py agents --project . # writes the map block of AGENTS.md
|
|
83
|
+
framework.py agents --project . --check # 0 current, 1 stale or absent
|
|
84
|
+
gates.py deps --project . # 0 green, 1 red, 2 usage; SKIP without Cargo.toml
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`doctor` is the record against the tree. `gates.py deps` is the second half of the same install, and
|
|
88
|
+
the rule it applies is written once: `docs/execution/BACKLOG-WAVE.md`, the `gates.py deps` clause. The
|
|
89
|
+
technology-to-skill pair lives in `framework.py`, which the command reads, so neither is copied here.
|
|
90
|
+
A red `deps` is the next step, not a bootstrap failure — a local install puts Lathe in the project,
|
|
91
|
+
and `deps` names what that local install still owes it. Report both verdicts, including the red one.
|
|
92
|
+
|
|
93
|
+
`agents` writes one block of `AGENTS.md` between two markers and nothing else, so a project that
|
|
94
|
+
already has the file keeps it. The block is derived from the tree, which is why it cannot point at a
|
|
95
|
+
document that is gone. The form and the inclusion test live once, in the `documentation` skill,
|
|
96
|
+
`references/agents-md.md`; they are cited here, not restated.
|
|
97
|
+
|
|
98
|
+
## Done when
|
|
99
|
+
|
|
100
|
+
- `framework.py bootstrap --project .` ran, and its exit code is in the report.
|
|
101
|
+
- `ls ~/.agents/skills/` was read: it shows no Lathe skill, or the run refused and the entry is named.
|
|
102
|
+
- Both upstream sources and `no-more-agents-dot-md` were each checked, and the report quotes
|
|
103
|
+
`doctor`'s two `upstream … present N/N` lines, or names the precondition bootstrap refused on.
|
|
104
|
+
- `framework.py doctor --project .` exits `0` and printed `CLEAN`.
|
|
105
|
+
- `framework.py agents --project . --check` exits `0`, and the block names the corpus, the journal and
|
|
106
|
+
the tickets that exist in this project — not the ones that exist in Lathe's own repository.
|
|
107
|
+
- `gates.py deps --project .` was run, and its status is quoted — `OK`, `FAIL` with the technology
|
|
108
|
+
named, or `SKIP` because the project has no `Cargo.toml`.
|
|
109
|
+
- Every file the local install wrote landed inside the project directory; the report names no path
|
|
110
|
+
outside it.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation
|
|
3
|
+
description: Create and refresh the agent corpus under documentation/llm/. Use when code moved and a document's source is newer than its verifie_le, when a subject needs its own document, or when the user asks what the project's documentation says about a subsystem.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Documentation
|
|
8
|
+
|
|
9
|
+
Keep `documentation/llm/` a corpus rather than a pile: one subject per document, a header that dates
|
|
10
|
+
it and names what was read, an index that leads to one document, and a gate that says whether the
|
|
11
|
+
corpus still holds. A model reads this corpus instead of the source tree, so every line here is either a
|
|
12
|
+
checkable claim or a pointer.
|
|
13
|
+
|
|
14
|
+
The corpus speaks the project's language: read it from `AGENTS.md`, then `README.md`, and write English
|
|
15
|
+
when neither says (`D-35`). `D-23` fixes the language of Lathe's own skills, not of a project's corpus.
|
|
16
|
+
|
|
17
|
+
## Non-negotiables
|
|
18
|
+
|
|
19
|
+
- **One subject, one document.** A subject's truth lives in exactly one document and every other
|
|
20
|
+
document links to it. Two texts that can diverge are one text too many.
|
|
21
|
+
- **The header is the document.** `titre`, `type`, `public`, `verifie_le`, `sources`, and nothing else
|
|
22
|
+
— a document without them is prose in a directory the index points at. The eight `type` values, the
|
|
23
|
+
two `public` values and the form of `sources` are in `references/corpus.md`.
|
|
24
|
+
- **A claim is read, not remembered.** Each statement is checked in a file opened during this session,
|
|
25
|
+
and `sources` lists exactly those files. A source you did not open is invented, and an invented
|
|
26
|
+
source is the fault this corpus exists to prevent.
|
|
27
|
+
- **The index is the entry point.** Index, then one document, then the symbols it names: every index
|
|
28
|
+
line carries the document's name, its one-clause description and the condition for loading it.
|
|
29
|
+
- **A document stands alone.** Sections are read out of order, so a reference is a link to a file or
|
|
30
|
+
nothing — never "above", never "below".
|
|
31
|
+
- **`Non vérifié` closes every document.** Dated, naming what this session did not read, so the
|
|
32
|
+
unmeasured is visible instead of absent.
|
|
33
|
+
|
|
34
|
+
## 1. Enter by the index
|
|
35
|
+
|
|
36
|
+
Read `documentation/llm/README.md` first. No corpus yet: this step creates it, and the first document
|
|
37
|
+
to exist is the index.
|
|
38
|
+
|
|
39
|
+
## 2. Choose one document
|
|
40
|
+
|
|
41
|
+
One subject per document. If the subject already lives somewhere, edit that document or link to it —
|
|
42
|
+
a second document on the same subject is a fork, and the two forks will disagree within a month.
|
|
43
|
+
|
|
44
|
+
## 3. Write the header
|
|
45
|
+
|
|
46
|
+
Copy the header from a neighbouring document or from `references/corpus.md`, and set `verifie_le` to
|
|
47
|
+
today. `type` says what the document is for; `public` says who reads it; `sources` says what was read
|
|
48
|
+
to write it.
|
|
49
|
+
|
|
50
|
+
## 4. Write the body
|
|
51
|
+
|
|
52
|
+
State the fact, name the symbol and the file it lives in, and stop. A block of more than 15 lines
|
|
53
|
+
pastes the code into a document that will be wrong at the next refactor: cite `symbol` in `path`
|
|
54
|
+
instead (`docs/execution/BACKLOG-WAVE.md`, the `gates.py docs` clause). Numbers carry the date they
|
|
55
|
+
were measured.
|
|
56
|
+
|
|
57
|
+
## 5. Close with `Non vérifié`
|
|
58
|
+
|
|
59
|
+
List what this session did not open, and date the section. An empty section is allowed and still
|
|
60
|
+
written: the reader learns that the document looked, and what it did not look at.
|
|
61
|
+
|
|
62
|
+
## 6. Regenerate the index
|
|
63
|
+
|
|
64
|
+
Rebuild the line for every document touched, and compare the whole index against `ls
|
|
65
|
+
documentation/llm/` — the directory is the list, the index is the claim. `references/corpus.md` holds
|
|
66
|
+
the line format and the regeneration procedure.
|
|
67
|
+
|
|
68
|
+
`AGENTS.md` names the index in one line and restates nothing from it: the corpus reached through a
|
|
69
|
+
pointer stays a single source, and a fact copied into `AGENTS.md` is a second copy (`E-27`).
|
|
70
|
+
|
|
71
|
+
## 7. Prove the corpus holds
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
gates.py docs --project . # 0 the corpus holds, 1 stale or malformed, 2 usage
|
|
75
|
+
gates.py deps --project . # 0 green, 1 red, 2 usage; SKIP without Cargo.toml
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`docs` is the mechanical form of the truth rule, and `docs/execution/BACKLOG-WAVE.md` (the `gates.py
|
|
79
|
+
docs` clause) lists every check it makes — including a back-reference in either language: `ci-dessus`,
|
|
80
|
+
`ci-dessous`, "above" and "below" all fail it (`D-34`). A red `deps` is the next step, not a weaker
|
|
81
|
+
document: install the official skill the gate names, and quote its verdict as it came (same file, the
|
|
82
|
+
`gates.py deps` clause).
|
|
83
|
+
|
|
84
|
+
## 8. Regenerate the map
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
framework.py agents --project . --check # 0 current, 1 stale or absent
|
|
88
|
+
framework.py agents --project . # rewrite the block
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The block in `AGENTS.md` is derived from the tree, so it is stale whenever an entry point, a folder or
|
|
92
|
+
a workspace member changed. Regenerating is idempotent: run it when the tree moved, not on a schedule.
|
|
93
|
+
The inclusion test — what earns a line, and what never does — is in `references/agents-md.md`.
|
|
94
|
+
|
|
95
|
+
## Done when
|
|
96
|
+
|
|
97
|
+
- `gates.py docs --project .` exits `0` for every document this step touched, and that status is
|
|
98
|
+
quoted.
|
|
99
|
+
- `gates.py deps --project .` was run, and its status is quoted as it came — green, red, or `SKIP`
|
|
100
|
+
without a `Cargo.toml`.
|
|
101
|
+
- Every document touched carries the five keys, a `type` from the eight and a `public` from the two.
|
|
102
|
+
- Every path in `sources` exists on disk and was opened during this session.
|
|
103
|
+
- Every document touched ends with a dated `Non vérifié`.
|
|
104
|
+
- Every relative link in the corpus resolves, no document says "above" or "below", and no code block
|
|
105
|
+
exceeds 15 lines.
|
|
106
|
+
- The index has exactly one line per file in `documentation/llm/`, each carrying name, description and
|
|
107
|
+
the condition for loading it.
|
|
108
|
+
- `framework.py agents --project . --check` exits `0` when this step added, removed or renamed a
|
|
109
|
+
document or an entry point; a map still naming the old one is stale by definition.
|
|
110
|
+
- `AGENTS.md` points at the index in one line, and repeats no fact from it.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# AGENTS.md: the map, not the territory
|
|
2
|
+
|
|
3
|
+
A session lands in a project knowing nothing. `AGENTS.md` answers three questions and stops: where the
|
|
4
|
+
agent corpus starts, where the journal and the tickets live, and what a session owes before its first
|
|
5
|
+
write. It is the one file every agent reads, which makes every wasted line a tax paid on every turn.
|
|
6
|
+
|
|
7
|
+
## The inclusion test
|
|
8
|
+
|
|
9
|
+
A line earns its place only by passing one of two tests:
|
|
10
|
+
|
|
11
|
+
- **P1 — it names a path that listing the tree does not reveal.** The index of the corpus, the
|
|
12
|
+
append-only folder, the ticket root, the workspace members. `ls` shows folders; it does not say which
|
|
13
|
+
one an agent must read first, nor which one must never be rewritten.
|
|
14
|
+
- **P2 — it states an invariant whose violation is silent.** A tick that no command proved, an entry
|
|
15
|
+
someone rewrote, a gate skipped before a claim. Silent means nobody notices until much later.
|
|
16
|
+
|
|
17
|
+
A line that fails both is noise, however true it is. In particular: a line an agent would follow anyway
|
|
18
|
+
is noise, and a line that restates a skill is a **second source of truth** — the defect the corpus
|
|
19
|
+
rules exist to prevent.
|
|
20
|
+
|
|
21
|
+
## What never enters
|
|
22
|
+
|
|
23
|
+
Measured on a mature project's file (`handy-src`, 253 lines, 19,811 bytes): 82 lines describe
|
|
24
|
+
`src-tauri/src/` file by file, which `documentation/llm/architecture.md` and `carte-du-depot.md`
|
|
25
|
+
already own; 37 more copy the build commands from `construction-et-livraison.md`. Half the file is the
|
|
26
|
+
corpus said twice, and both copies drift.
|
|
27
|
+
|
|
28
|
+
| Never | Because |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| File-by-file architecture | the corpus owns it; two copies diverge and the file wins by being read first |
|
|
31
|
+
| Build and release commands | they rot fastest, and the corpus dates its claims |
|
|
32
|
+
| Code style | a skill owns it; a style rule with no failure mode is decoration |
|
|
33
|
+
| Domain vocabulary | `GLOSSARY.md` or the corpus owns the words |
|
|
34
|
+
| A rule already in a skill | cite the path in one line; never restate it |
|
|
35
|
+
| Anything discoverable with `ls` | the tree is the source; a copy of it is stale by construction |
|
|
36
|
+
|
|
37
|
+
## The block, not the file
|
|
38
|
+
|
|
39
|
+
A project already has an `AGENTS.md`, with history and owners. So Lathe writes a **block** between
|
|
40
|
+
markers and nothing else:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
<!-- lathe:begin … --> ← generated, never hand-edited
|
|
44
|
+
<!-- lathe:end -->
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Everything outside the markers belongs to the project and is never touched. Inside, the content is
|
|
48
|
+
derived from the tree rather than remembered, so a path that disappears stops being named instead of
|
|
49
|
+
being pointed at. One marker without the other is a refusal, not a guess: writing then could lose
|
|
50
|
+
whatever sat between them.
|
|
51
|
+
|
|
52
|
+
## When it is re-read
|
|
53
|
+
|
|
54
|
+
Not on a schedule, and not on every turn. Three triggers, all mechanical:
|
|
55
|
+
|
|
56
|
+
1. **The tree moved.** A document or a folder the block names is gone. The check turns red before an
|
|
57
|
+
agent follows a dead path, which is the only moment the rot is cheap to fix.
|
|
58
|
+
2. **The map is stale.** A regeneration changes a line: a new entry point, a new member, a renamed
|
|
59
|
+
folder.
|
|
60
|
+
3. **A ticket adds a workspace member.** The moment `Cargo.toml` changes, the member list in the block
|
|
61
|
+
is one line behind.
|
|
62
|
+
|
|
63
|
+
Regenerating is idempotent: running it twice writes the same bytes. That is what makes "sometimes" safe
|
|
64
|
+
— a refresh that always produced a diff would be run constantly, or never.
|
|
65
|
+
|
|
66
|
+
## Done when
|
|
67
|
+
|
|
68
|
+
- the block is present and the check exits `0`;
|
|
69
|
+
- every line passes P1 or P2, and a reader who sees only the block knows where to go next;
|
|
70
|
+
- nothing outside the markers changed.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# The corpus format
|
|
2
|
+
|
|
3
|
+
Everything `documentation/llm/` obeys, once. A document that fails one line here is not in the corpus:
|
|
4
|
+
it is prose in a directory the index points at.
|
|
5
|
+
|
|
6
|
+
## The header
|
|
7
|
+
|
|
8
|
+
```markdown
|
|
9
|
+
---
|
|
10
|
+
titre: <the exact title, without the leading #>
|
|
11
|
+
type: tutoriel | guide | reference | explication | index | etat | charte | journal
|
|
12
|
+
public: developpeur | agent
|
|
13
|
+
verifie_le: 2026-10-17
|
|
14
|
+
sources:
|
|
15
|
+
- src/store/claim.rs
|
|
16
|
+
- .scratch/claim/spec.md
|
|
17
|
+
---
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Five keys, no sixth. The header is read by `gates.py docs` before the body is read by anyone, so a
|
|
21
|
+
document with a missing key never reaches a reader.
|
|
22
|
+
|
|
23
|
+
## `type`, eight values
|
|
24
|
+
|
|
25
|
+
| Value | What the document is | What it must therefore contain |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `tutoriel` | a sequence, start to end, for someone who has not done it before | the steps in order, each with what it proves |
|
|
28
|
+
| `guide` | how to do one thing in this project | the decision points and the house answer at each |
|
|
29
|
+
| `reference` | the facts of one subject, consulted rather than read | flat, one fact per line, no narrative |
|
|
30
|
+
| `explication` | why the code is the way it is | the reasons, and the alternatives that were rejected |
|
|
31
|
+
| `index` | the entry point of the corpus | one line per document: name, description, when to load |
|
|
32
|
+
| `etat` | the measured state at a date | figures with the date, and what was not measured |
|
|
33
|
+
| `charte` | rules this project imposes on itself | numbered, each with where it is enforced |
|
|
34
|
+
| `journal` | one delivered lot | the three sections the `journal` skill owns, in `references/entry.md` of that skill |
|
|
35
|
+
|
|
36
|
+
`index` is a type because the index is a document like the others: it carries the same header, and
|
|
37
|
+
`gates.py docs` checks it the same way. A corpus holds exactly one `index`.
|
|
38
|
+
|
|
39
|
+
## `public`, two values
|
|
40
|
+
|
|
41
|
+
| Value | Who reads it | What that changes |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `developpeur` | the person maintaining the project | narrative and motivation are allowed; a stale fact is not |
|
|
44
|
+
| `agent` | a model that will act on it | every line is an instruction, a fact or a pointer; no motivation prose, because it competes with the facts for attention |
|
|
45
|
+
|
|
46
|
+
Mixed documents are the usual failure: a `developpeur` paragraph in an `agent` document is read as
|
|
47
|
+
guidance and acted on as if it were a rule. Two audiences, two documents, linked.
|
|
48
|
+
|
|
49
|
+
## `sources`, the form
|
|
50
|
+
|
|
51
|
+
- **Relative to the project root**, one path per line, no leading `/`, no `~`, no machine name.
|
|
52
|
+
- **Files, not directories.** A directory says nothing about what was read; the file says it.
|
|
53
|
+
- **Opened during the session that wrote `verifie_le`.** The header is a claim about reading, and this
|
|
54
|
+
is the key that carries the claim.
|
|
55
|
+
- **Exact.** A path that no longer exists fails `gates.py docs`. Renaming a file is a change to every
|
|
56
|
+
document that lists it, which is the point: the corpus is forced to notice.
|
|
57
|
+
- **No globs.** `src/*.rs` cannot be checked and cannot be reopened.
|
|
58
|
+
|
|
59
|
+
## What makes a document fail
|
|
60
|
+
|
|
61
|
+
Each of these fails, and each has one fix. The first table is what `gates.py docs` catches on its own;
|
|
62
|
+
the second is what a reader catches, which is why it is a review item rather than a gate.
|
|
63
|
+
|
|
64
|
+
### The gate fails
|
|
65
|
+
|
|
66
|
+
| Defect | Fix |
|
|
67
|
+
|---|---|
|
|
68
|
+
| a header key missing, or `verifie_le` not a date | write the five keys the header block shows, with `verifie_le` in `AAAA-MM-JJ` |
|
|
69
|
+
| a source's last commit is later than `verifie_le` | reopen the source, correct the body, move `verifie_le` to today |
|
|
70
|
+
| a path in `sources` does not exist | reopen the real file and rename the path, or drop the claim the source carried |
|
|
71
|
+
| a relative Markdown link does not resolve | point it at the file that holds the fact, or delete the link and state the fact |
|
|
72
|
+
| "above", "below", `ci-dessus`, `ci-dessous`, "as seen earlier" | link to the section, or restate the fact in one line |
|
|
73
|
+
| a code block over 15 lines | cite `symbol` in `path`; the block is a copy that expires at the next refactor |
|
|
74
|
+
|
|
75
|
+
### The reviewer fails
|
|
76
|
+
|
|
77
|
+
| Defect | Fix |
|
|
78
|
+
|---|---|
|
|
79
|
+
| a claim no source in `sources` covers | add the file that carries it, or move the claim into `Non vérifié` |
|
|
80
|
+
| no `Non vérifié` section | add it, dated, even when it lists nothing |
|
|
81
|
+
| the same subject in two documents | keep it in the document that owns the subject, and link from the other |
|
|
82
|
+
| a `public` or `type` value outside the two or the eight | pick the value that matches what the document does |
|
|
83
|
+
|
|
84
|
+
The date is a measurement, not a formality: a document dated before its oldest source is a record of
|
|
85
|
+
an older tree, and reading it is reading history as if it were news.
|
|
86
|
+
|
|
87
|
+
## Regenerating the index
|
|
88
|
+
|
|
89
|
+
No command writes the index. It is rebuilt by listing the corpus and giving every document its line:
|
|
90
|
+
|
|
91
|
+
```markdown
|
|
92
|
+
- [<titre>](<path, relative to documentation/llm/>) — <one clause: what this document is> · load when <condition>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- **One line per document, and every document has one.** `ls documentation/llm/` against the index is
|
|
96
|
+
the completeness check; `gates.py docs` checks that the links resolve, not that nothing is missing.
|
|
97
|
+
- **The line carries a name, a description and a condition.** A line without its loading condition
|
|
98
|
+
leaves the reader to guess, and the guess is what progressive disclosure exists to remove.
|
|
99
|
+
- **The line carries no body.** A fact pasted into the index is a second copy of it, in the one
|
|
100
|
+
document everything loads first.
|
|
101
|
+
- **Sorted by path**, so two regenerations of the same corpus produce the same bytes.
|
|
102
|
+
- **The index is the only document the reader is given for free.** Everything else is reached from it,
|
|
103
|
+
which makes a missing line the same defect as a missing file.
|
|
104
|
+
|
|
105
|
+
## Non vérifié
|
|
106
|
+
|
|
107
|
+
- No project has been measured on how much a stale `verifie_le` costs a reader; the rule is enforced
|
|
108
|
+
by the gate, not by a measurement.
|
|
109
|
+
- The 15-line limit on code blocks is a rule of this corpus, adopted from
|
|
110
|
+
`docs/execution/BACKLOG-WAVE.md`; no comparison of block sizes was run here.
|
|
111
|
+
- Two `public` values, eight `type` values: the list is inherited from the reference project read in
|
|
112
|
+
`EVIDENCE.md` E-27, and no other corpus was surveyed.
|