@dialecte/cli 0.5.0 → 0.7.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 (5) hide show
  1. package/README.md +424 -37
  2. package/dist/cli.js +56727 -46978
  3. package/dist/lookups.d.ts +369 -19
  4. package/dist/lookups.js +4552 -1579
  5. package/package.json +20 -1
package/README.md CHANGED
@@ -25,7 +25,7 @@ shape. Exit codes: 0 an answer or green, 1 nothing found or a failed check,
25
25
  2 usage or refused; a command's help says when it differs.
26
26
 
27
27
  ```
28
- Discover api members schema explain standard
28
+ Discover api members schema explain standard facts ask
29
29
  Use run fixture new
30
30
  Grow lot
31
31
  Plan plan
@@ -41,11 +41,14 @@ dialecte members <expr> # what an expression of the live types holds
41
41
  dialecte schema <Tag> # what an element may hold and where
42
42
  dialecte explain <code> # what an error or diagnostic code means, when it is raised, the usual fix
43
43
  dialecte standard index|find|show|eval # index and search the standards kept on this machine, outside every repository
44
+ dialecte facts list|show|forget # the facts recorded in your data folder: their state now, their history; forget one
45
+ dialecte ask "<question>" # answer from a fact, the definition, the catalogues and api indexes, else the standard's slices for readers
44
46
  dialecte run <script.ts> # run a script on an in-memory project of the installed dialecte: one structured outcome
45
47
  dialecte fixture <Tag> # the smallest valid XML document holding an element, built by the dialecte's engine
46
48
  dialecte new verb <namespace> <query|transaction> <name>
47
49
  dialecte lot start <brief.json> # a lot from its brief: the lot folder in the store, the numbered worktree, .dialecte/lot
48
- dialecte lot status <id> # its state derived from the records, the checks, the exact next command; reads only
50
+ dialecte lot status <id> # its state derived from the records, the checks, the next station and its exact command; reads only
51
+ dialecte lot risk <id|folder> [--effort <level> --by <who>] # the risk class derived now, the effort and its cap; --effort records a person's effort
49
52
  dialecte lot wait <id> [--timeout <seconds>] # until the lot needs someone: ready, a question, failed, a limit
50
53
  dialecte lot answer <id> <question> "<answer>" [--by <who>] # answer an open question of the lot, once
51
54
  dialecte lot result <id> # the hand-over (card, show and run lines) of a ready lot, or why it stopped; writes nothing
@@ -53,7 +56,7 @@ dialecte lot stop <id> --reason <text> # end the lot: its pending hand-over ab
53
56
  dialecte inbox # what waits on someone across every lot store: questions, ready hand-overs, failed lots
54
57
  dialecte plan next|check|mark <plan.md> # what can start now in a plan's lot block; the block checked; a person's mark
55
58
  dialecte lot exempt|accept|revised|gone|mutation # the lot declaration .dialecte/lot.json
56
- dialecte lot finding|decide|snapshot|choice|standard <id|folder> ... # a lot's review rounds, in its lot or hand-over folder
59
+ dialecte lot finding|decide|snapshot|choice|standard|verify <id|folder> ... # a lot's review rounds and late fixes, in its lot or hand-over folder
57
60
  dialecte lot delta <id|folder> --round <n> # the fix diff since round n-1; --worktree: the old code to run a test on
58
61
  dialecte lot recap <id|folder> # the pull request's expandable part, built from the hand-over's records only
59
62
  dialecte lot close <name|index> # a finished lot: node_modules to the pool, its worktree to the trash
@@ -150,10 +153,15 @@ Every Dialecte package ships the agent skills that describe it in `skills/<name>
150
153
  - **Session-start check, every agent**: when `dialecte-lot` is installed by the sync (whatever the targets),
151
154
  `skills sync` writes a section in the project's root `AGENTS.md`, between `<!-- dialecte-skills:session-check -->`
152
155
  and `<!-- /dialecte-skills:session-check -->`, telling the agent to run `npx --no-install @dialecte/cli doctor --brief`
153
- at a session start. It is created when there is no `AGENTS.md`, else appended after one blank line (every byte of
154
- your text stays, line ends included), replaced when an older release wrote another sentence, and removed (with the
155
- blank line it added, the file deleted when nothing else is left) by `--no-session-check`, `--no-contributing` or
156
- a sync without `dialecte-lot`. A marker without its pair, or a doubled one, leaves the file alone with a warning.
156
+ at a session start. It is written with a blank line inside each marker, the form a markdown formatter keeps, so a
157
+ formatted `AGENTS.md` stays formatted. An existing `AGENTS.md` gets it appended after one blank line; the body
158
+ between the markers is compared tolerantly (whitespace does not matter: line ends, blank lines, a wrapped
159
+ sentence), and only the marked block is replaced when an older release wrote another sentence: every byte outside
160
+ it stays, line ends included. A missing `AGENTS.md` is created only when you answer yes on a terminal or pass `--agents-file`; without
161
+ either, the sync says it was not created. The section and the file are never removed nor deleted by a sync:
162
+ `--no-session-check`, `--no-contributing` or a sync without `dialecte-lot` leave them in place (delete the section
163
+ by hand if you do not want it). `--no-agents-file` leaves `AGENTS.md` alone altogether (it excludes
164
+ `--agents-file`). A marker without its pair, or a doubled one, leaves the file alone with a warning.
157
165
  An `AGENTS.md` holding only the section is no evidence of a vendor.
158
166
  - **Session-start check (Claude Code)**: the same check as an adapter: `skills sync` adds a `SessionStart` hook running
159
167
  `npx --no-install @dialecte/cli doctor --brief` (the installed cli: no download at a session start) to
@@ -212,6 +220,20 @@ Exit codes: 0 an answer, 1 nothing found (or a warning for `doctor`), 2 a usage
212
220
  need the method's `@intent` tags hold, then its summary, then its name - one intent word beats any number
213
221
  of summary words; stop words dropped, word forms reduced to a light stem (`copied`, `copies`, `copying`
214
222
  → `copy`); ties put a dialecte's verb before core's, then sort by route.
223
+ - `dialecte api find --source "<need>"` also searches the exported functions of the package you are in (the
224
+ nearest `package.json` at or above the folder): every exported function declaration, arrow or function-expression
225
+ `const` of its tracked and untracked-not-ignored `src/**/*.ts` files, tests left out, read from the syntax alone
226
+ (a local `export { name }` counts, a re-export does not; an overload set is one function, at its first overload).
227
+ A source row prints `<file>#<name> source <file>:<line>`, then the intent that matched, its summary or
228
+ `(no summary)`. A function without `@intent` ranks on the words its summary and name hold together; at equal
229
+ hits an indexed method comes first, and a function the package's `api.json` already lists is shown once, by its
230
+ route. A file that does not parse is left out with a `note:` line. What each file holds is cached by its content
231
+ hash in `dialecte-source-index.json` in the worktree's git folder, shared by the packages of the repository and
232
+ rebuilt by another cli version (outside a git work tree, every file is read).
233
+ `dialecte api show <file>#<name>` (`src/lib/git.ts#readGit`) prints one source function's signature, summary,
234
+ intents and declaration, with or without `--source`; an unknown name in a file that was read names up to five of
235
+ that file's functions, the closest first; an unknown file names the closest source paths, or the
236
+ `api find --source` call that lists them.
215
237
  - `dialecte api show <path>` (`info.of`, `doc.query.info.of`, `tx.reference.applyUuidRemap`): signature as
216
238
  declared, summary, intents, other routes, where it is declared in its repository, and one call: the
217
239
  method's JSDoc `@example` when it is short and calls the method, else a call from the test next to it
@@ -329,10 +351,146 @@ characters, never split nor stemmed; its plural (the acronym and one lowercase `
329
351
  closest quote and why (`ranked <r>`, `not found by find`, `not in the text`, `unknown file <id>`). Items with
330
352
  no expected quote are counted apart. Exit 1 when no item has one; 2 for a gold file that cannot be read or a
331
353
  malformed line (its number named).
354
+ - `dialecte standard eval <gold.jsonl> --angles [...]`: the same recall, each question run through the `ask` ladder
355
+ instead of `find` alone (kind `semantic`, no fact read or written, no ask kept, no event): find's own list for
356
+ the whole question first and untouched, then at most 3 slices the angles found in clauses that list does not
357
+ cover, then the linked slices. A question the ladder refuses (an `about` no dialecte declares, a tag of several
358
+ dialectes without `--package`) scores find's own list. The answer adds `added +<n>` (`added` in `--json`): the
359
+ items whose quote only the added slices hold. Run from a package (exit 2 outside one).
332
360
 
333
361
  `show`, `find` and `eval` build the index first when it is missing. Every verb answers exit 2 with how to set
334
362
  `DIALECTE_STANDARD` when no standard is configured.
335
363
 
364
+ ## The facts ledger
365
+
366
+ `dialecte facts` reads the facts an agent recorded when it answered a question about a dialecte or a standard,
367
+ and retires the ones that no longer hold. A fact is a question (its words, its subject, its kind), its answer,
368
+ where the answer comes from (`schema`, `dialecte`, `standard`, `person` or `outside`), the effort it took, the
369
+ evidence and the sources it rests on. One question has one current fact; a better answer replaces it (an answer
370
+ checked against the documents always replaces an unchecked one, whatever the efforts), and the replaced fact is
371
+ kept, marked `superseded by F-<n>`.
372
+
373
+ **Where the ledger is.** In your data folder only: `$XDG_DATA_HOME/dialecte/facts/` (else
374
+ `$HOME/.local/share/dialecte/facts/`), one ledger per person, shared by every repository you work in. Each fact is a
375
+ file `F-<n>.json` and its history `F-<n>.history.jsonl`, one line per event (`created`, `reused`, `stale`,
376
+ `superseded`, `forgotten`, `rechecked`); `by-key/` holds one pointer per question to its current fact. Nothing is
377
+ ever deleted: a fact file is written once, afterwards only its state, its `supersededBy` and its sources change,
378
+ and its history only grows (a history line is at most 4,096 bytes: longer lists and strings in it are cut, and
379
+ a line still too long has each list replaced by its length, `fromCount` for `from`; the line marked `cut`, the
380
+ fact file always holding its sources whole). Every verb refuses (exit 2, nothing written) a ledger inside a git work tree, naming
381
+ the folder, the work tree and the fix: set `XDG_DATA_HOME` to a folder outside the repository. Only the data
382
+ folder counts, never the folder the command runs in.
383
+
384
+ **States.** A fact's state is the state now, checked on every read:
385
+
386
+ - `valid` - its sources still hold;
387
+ - `stale` - a source moved since it was recorded: the files of the standard it quotes (any file changed, added or
388
+ removed), or the definition of the dialecte it read. Written to the fact once, with a `stale` line holding why
389
+ (the source that failed and the fix), which every later read shows;
390
+ - `unverifiable` - a source cannot be compared now (no standard configured, its folder gone, the dialecte not
391
+ installed). Shown only, never written;
392
+ - `unchecked` - an answer from outside the documents; a person's answer given without them is `valid` and marked
393
+ `unchecked` on its line;
394
+ - `forgotten` - retired by `facts forget`.
395
+
396
+ A person's fact is never checked. A fact file no question points to (a record a crash stopped) is an `orphan`; a
397
+ file that is not readable JSON is `unreadable`. A read repairs what a crash or two writers at once left: the
398
+ previous fact of a question gets its `supersededBy`, with a `superseded` line marked `repaired`.
399
+
400
+ - `dialecte facts list [--about <Tag>] [--state <state>|all] [--json]`: one line per question, its current fact
401
+ whatever its state: `<id> <state> <effort> <source> <question>` (the question cut). A `stale` fact (found by
402
+ this read, or by an earlier one: the reason its `stale` line keeps) or one this read found `unverifiable` ends
403
+ its line with `- <why>`: the source that failed and the fix (for example: set `DIALECTE_STANDARD`, the expected
404
+ layout of a refused standard root, run from the package that installs the dialecte). `--state valid`, `stale`, `unverifiable`,
405
+ `unchecked` or `forgotten`: the current facts in that state now; `--state orphan`: the fact files no question
406
+ points to; `--state all`: every fact file, superseded, orphan and unreadable ones (with their path) included, a
407
+ superseded fact's line holding `superseded by F-<n>` before its question:
408
+ `<id> <state> <effort> <source> superseded by F-<n> <question>`. `--about <Tag>`: the facts whose subject
409
+ holds that tag. `--json` answers `{ facts: [{ id, path, fact?, state, current, reason? }] }` (no `fact` for an
410
+ unreadable file). An unknown state is
411
+ a usage error naming the states. The schema sources are compared with the dialectes installed in the folder the
412
+ command runs in; run from a folder with no `package.json`, they are `unverifiable`, never an error.
413
+ - `dialecte facts show <id> [--json]`: the fact's question, answer, source, effort, state now (with `- <why>` when
414
+ stale or unverifiable), sources and number of pieces of evidence, then its history in order; `--json` answers
415
+ `{ fact, state, current, reason?, history }`.
416
+ - `dialecte facts forget <id> --reason <text> [--json]`: marks the fact `forgotten` and appends a `forgotten` line
417
+ holding the reason (cut at 200 characters, the line then marked `cut`); the file is kept. Forgetting it again says so and writes nothing.
418
+ `--json` answers `{ id, state, already }`. No reason, or a blank one, is a usage error.
419
+
420
+ `show` and `forget` answer exit 1 for an id with no fact (the closest ids named) or a fact file that is not
421
+ readable JSON (its path named).
422
+
423
+ ## Ask
424
+
425
+ `dialecte ask "<question>" [--about [<Parent>/]<Tag>[@<attr>] | --code <code> | --method <path>] [--kind <kind>]
426
+ [--decision] [--package <name>] [--effort low|medium|high] [--lot <id|folder>] [--limit <n>] [--no-facts]
427
+ [--no-standard] [--person-only] [--json]` answers a question about the installed dialecte from the cheapest
428
+ source that holds the answer, and never answers from anything else: past the dialecte's own files it hands the
429
+ question on (to readers of the documents, or a person) instead of guessing.
430
+
431
+ The question's subject is read from the names of the installed dialectes it holds (tags, attributes, catalogue
432
+ codes, api methods: exact names, case kept; a name that is also an ordinary word counts only as `@name`, `name=`
433
+ or through `--about`). `--about`, `--code` and `--method` name the subject instead; `--kind` forces the kind
434
+ (`children`, `parents`, `required`, `values`, `default`, `fixed`, `type`, `variants`, `documentation`, `code`,
435
+ `method`, `semantic`). A tag of several installed dialectes needs `--package` unless the folder is one of them.
436
+
437
+ **The rungs**, in order; the first that answers ends the ask:
438
+
439
+ - 0, a fact: the current fact of the same question in the facts ledger, reused when it is valid at the asked
440
+ effort or above (a person's fact at any effort). A fact that does not answer (lower effort, stale,
441
+ unverifiable, unchecked) is listed as a candidate, never the answer. `--no-facts` reads and records none.
442
+ - 1, the definition: a structural question whose element resolves to one declaration (`--about <Parent>/<Tag>`
443
+ for a tag declared several ways), answered from the dialecte's definition. `--decision` skips it as an
444
+ answer and reads it as the boundary (below).
445
+ - 2, the dialecte's files: a code answered by the one catalogue entry that explains it, a method by the api
446
+ index entry whose intents hold every content word of the need (else the closest five listed).
447
+ - 3, the documents: the slices of the standard for the question (find's own list, then the slices its angles
448
+ add), handed to readers.
449
+
450
+ A rung 1 or 2 answer is recorded as a fact at the ask's effort. A fact recorded from the definition is checked
451
+ again when the definition changes: answering the same, it is kept with the new hash; else it is stale and a new
452
+ fact replaces it.
453
+
454
+ **The boundary (`--decision`).** The definition (the XSD) is what validates, so on a `--decision` ask it is the
455
+ hard limit of what is valid, never the answer: it is read live (`boundary` in `--json`, `boundary: <answer>
456
+ (definition)` in the text) when the question is structural and its element resolves to one declaration. A stored
457
+ fact recorded from the definition is a candidate only; the answer comes from the prose inside the boundary (a
458
+ standard or person fact, or the readers). The values of an attribute with no enumeration are open (any value of its
459
+ type is valid): the prose values stand, no conflict. Prose naming what the definition rejects (a list item it does
460
+ not hold, an enumeration value it does not list, another yes/no, another value) is answered within it: the list cut to the boundary's items, else the boundary's
461
+ own answer; `conflict` in `--json` names the fact and what it named outside (`{ kind: 'standard-vs-xsd', fact,
462
+ outside }`), the text adds `! conflict: the standard names <items> the XSD rejects; the XSD wins - fix the XSD and
463
+ ask again`, and the ask still exits 0. Without `--decision` neither is read (`boundary` and `conflict` null).
464
+
465
+ **The documents.** The `DIALECTE_STANDARD` folder whose id has the key of the dialecte's declared standard name
466
+ (both lowercased, letters and digits only); every folder when the dialecte declares none. With none, the ask
467
+ skips rung 3 and goes to outside readers (when the root holds other folders, a line on stderr names the
468
+ declared name, its key and those folders).
469
+ `--no-standard` is refused while documents are readable for the dialecte (outside readers run only when the
470
+ documents cannot answer), and is the outside route without them. `--person-only` sends the ask to a person after
471
+ rung 2. Once documents exist, each `unchecked` fact of the dialecte's standard is asked again, once: a new ask
472
+ holding its question and `reask: <fact id>` (never its answer), and a `rechecked` line on the fact.
473
+
474
+ **States and exit codes.** `answered` exit 0; `needs-person` exit 1 (next: `dialecte ask answer <id> ...`);
475
+ `needs-readers` exit 3 (next: `dialecte ask pack <id>`, with `--outside` without documents); exit 2 for usage and
476
+ refusals, nothing written: an unknown `--about` tag or attribute (the closest named), an attribute the element
477
+ lacks, several dialectes without `--package`, two standard folders of one key, `--no-standard` with documents,
478
+ an `--effort` other than the lot's, a `--lot` folder inside a repository.
479
+
480
+ **The ask folder.** Each ask is a folder `A-<n>` holding `ask.json` (the `--json` object, versioned by its `schema`
481
+ member, now `1`: the subject, kind, rung, state, answer, fact, source, boundary, conflict, candidates, methods,
482
+ angles, slices, effort, next and what was read of the documents). With `--lot <id|folder>` (a store lot by index, name or folder, or a hand-over folder outside every
483
+ repository) it is in `<lot folder>/asks/`; run in a lot's worktree, in that lot; else in
484
+ `$XDG_STATE_HOME/dialecte/asks/`. An ask of a lot that reaches the documents or the outside route rewrites the
485
+ lot's `standard.json` (`consulted`, a note listing every ask of the lot and its state). A lot's ask takes the
486
+ lot's effort; elsewhere `--effort`, else `medium`.
487
+
488
+ **Events.** `ask.parsed`, `ask.rung` (one per rung run, with its time), `ask.fact` and `ask.state` go to the
489
+ lot's `events.jsonl`, else `$XDG_STATE_HOME/dialecte/asks/events.jsonl`; they hold the question's length and key
490
+ hash, never its text, a quote or a slice's text; `ask.state` says `conflict: true|false`, never what
491
+ conflicts. An event that cannot be written prints one line on stderr and
492
+ never changes the exit code.
493
+
336
494
  ## MCP server
337
495
 
338
496
  The MCP server of the read-only lookups is its own package: [`@dialecte/mcp`](https://github.com/dialecte/mcp) (`npx @dialecte/mcp`). It builds on the pure answer functions this package exports at `@dialecte/cli/lookups`.
@@ -430,9 +588,53 @@ the answer.
430
588
  gate's selection (the files it checked); outside a gate, the files changed against HEAD and the new ones,
431
589
  that result recorded in the worktree's git folder (`dialecte-rules.json`: when, HEAD, the state hash, the
432
590
  files, the errors and warnings), which `dialecte lot recap` reads; a run on named files records nothing.
591
+ Quality rules, on implementation files (a test-shaped file is exempt):
592
+ - `argument-mutation` (error): a function changes what a parameter refers to (a mutating method such as
593
+ `.push` or `.add`, an assignment to a property, `delete`, `++`, `Object.assign` with it first); return the
594
+ new value instead. Rebinding the parameter, a copy, a write through `query` / `tx`, a `reduce` accumulator
595
+ are not flagged.
596
+ - `query-in-loop` (error): a query read (a method of the API indexes' `q` entries, `perf` and writes aside)
597
+ called on a query binding inside a loop or a loop callback (`map`, `forEach`, ...); read them in one query
598
+ before the loop. A call through a `perf` segment (`doc.query.perf.getRecord()`) is never a query read. Without an API index the rule does not run.
599
+ - `long-function` (warning): a function body over 60 lines that are neither blank nor comment-only; split it.
600
+
601
+ Test-shape rules, on test-shaped files (a test file, a name ending `-fixtures.ts`, `.test-fixtures.ts` or
602
+ `-cases.ts`, a file under the package's top-level `test/` folder):
603
+ - `table-branch` (error): an act or a per-case callback branches on a field of its case; one table per
604
+ behaviour.
605
+ - `without-export-xml` (error): a `.withoutExport(` act reads exported XML; use `withExport` with
606
+ `expectedQueries`.
607
+ - `export-without-queries` (error): a case of a `.withExport(` table with no (or empty) `expectedQueries`
608
+ and `unexpectedQueries`; give it one.
609
+ - `fixture-builder` (warning): a function returns XML built with a substitution (a value inside the XML, or
610
+ the element name itself: `` `<${tag} .../>` ``); write each fixture as inline XML.
611
+ - `plan-tag` (error): a title, a table key or the file name carries a plan or round tag; say what the case
612
+ checks.
613
+
614
+ An opt-out silences one of these eight rules: `// dialecte-allow <rule>[, <rule>]: <reason>`, the reason at
615
+ least 15 characters, on the finding's line or the line before it (for `argument-mutation` and
616
+ `long-function`, also anywhere in the comments right before the function, its doc comment included). A
617
+ malformed opt-out, a rule it cannot silence or a reason too short is an `invalid-allow` error; an opt-out
618
+ that covers no finding is an `unused-allow` warning (never for a rule that did not run). `--json` (and the
619
+ rules record) counts the findings the opt-outs silenced, per rule, in `allowed`. With the gate base (a
620
+ scoped gate step), an error of these rules on a line the change did not add is a warning ending
621
+ `(not added by this change)`; an empty-tree base (the release list, or no base branch found) knows no
622
+ change, so every error of these rules is such a warning. A plain `rules` run (no gate base) keeps them
623
+ errors. An API index that cannot be read (not JSON, a skill shipped twice) fails
624
+ nothing: `query-in-loop` does not run and one line names the file and why. Not judged: an alias of a
625
+ parameter (`const set = params.items; set.add(x)`), a read in a function the loop calls (`query-in-loop` is
626
+ syntactic: it sees the reads written inside the loop), a table imported from a sibling file. `plan-tag`
627
+ flags `round` or `step` followed by a number in a title (`step 2 of the import`): reword it, or opt out.
628
+ `fixture-builder` reads `<` followed by a letter as XML, so a returned text with a `<word>` placeholder and a
629
+ substitution (`` `usage: <name> ${value}` ``) is flagged too: opt out with the reason.
630
+
433
631
  - `dialecte gate [--fast | --full] [--base <ref>] [--no-reuse] [--declare <path>]... [--json]` runs the Definition of Done: `--fast` (default) `check`,
434
632
  `skills:check` and the tests of the changed files; `--full` adds `build` and the whole suite (the
435
- runner's defaults: every file in parallel), then the steps derived from the package's scripts after its
633
+ runner's defaults: every file in parallel); both default lists end with a scoped `rules` step
634
+ (`dialecte rules` on the changed files, judged against the gate base); a step whose command starts with the word
635
+ `dialecte` runs as the cli that runs the gate (its own node and entry file, never the package's
636
+ `node_modules/.bin/dialecte`, so a package without the cli installed runs it too), its line ending
637
+ `(dialecte <version>)`; then the steps derived from the package's scripts after its
436
638
  own (declared or default): `type-narrowing` (`npm run type-narrowing`, a check a publish workflow runs)
437
639
  when the package has that script and no step runs it; without the script, one line
438
640
  `skip type-narrowing no npm script "type-narrowing"` and no step of the record. The docs build and the type bench are contributor checks:
@@ -451,7 +653,13 @@ the answer.
451
653
  hand-over card shows `✗ <step> not wired (no npm script; or dialecte.gate.skip)` for a full or release record
452
654
  (`dialecte.contrib.skip` for a contrib one) and `! <step> not
453
655
  wired (no npm script)` for a fast one, and `! <step> opted out: <reason>` for an opt-out (a warning). The
454
- `type-narrowing` step is derived from the package's scripts and is never unwired. A gate record written
656
+ `type-narrowing` step is derived from the package's scripts and is never unwired. A repository without
657
+ package.json has no default list: the gate infers its steps from its files (`pyproject.toml` + `uv.lock` at
658
+ the root: a `tests` step `uv run pytest` for fast and full, counted from pytest's summary line), and a root
659
+ `dialecte.json` (`{ "schema": 1, "gate": { "fast": [...], "full": [...] } }`, the keys of package.json's
660
+ `dialecte.gate` without `skip`) overrides it list by list (its refusals name the lists as package.json's
661
+ `dialecte.gate.<list>`); with neither, the gate refuses naming both. A repository with a
662
+ package.json never reads `dialecte.json`. A gate record written
455
663
  before this check is not reused for a package with an unwired or opted-out step (the key changes). While a hand-over
456
664
  holds the repository (`dialecte handover <lots.json>` wrote its lock), the gate runs only under the
457
665
  hand-over written for this repository - the script the lock names exists and the `lots.json` beside it
@@ -553,8 +761,13 @@ the answer.
553
761
  stops (state `T`) and is reported as stalled.
554
762
  - `dialecte contrib [--no-reuse] [--json]` runs the contributor checks of a package whose profile is
555
763
  `contributor`, after `gate --full` and before `dialecte handover`, one line per row: `rules` on the files
556
- changed against HEAD (recorded as `dialecte rules` records it), the package's `dialecte.contrib.steps`
557
- (default: `docs`, `npm run doc:build` with the `generatedDocs` restored, and `type-bench`,
764
+ changed against HEAD (recorded as `dialecte rules` records it), judged against the gate base (the scoped
765
+ gate step's: the base branch's merge-base with HEAD; a rehearsal's run against the last merge lot's tip, else
766
+ the base the repository resolves at the lots file's HEAD): an error of a quality rule on a line the base already
767
+ holds is a warning ending `(not added by this change)`. No base branch found: the base is the empty tree, which
768
+ knows no change, so every quality error is that warning. No base, every error kept, only without a scoped gate
769
+ step or with a `dialecte.baseBranch` that names no branch. Then the package's
770
+ `dialecte.contrib.steps` (default: `docs`, `npm run doc:build` with the `generatedDocs` restored, and `type-bench`,
558
771
  `npm run type-bench:check`; `[]` keeps the built-in rows only) run as the gate runs its steps (a default
559
772
  step whose npm script is missing fails the run before any row, the built-in `rules` and `release` rows
560
773
  included, unless `dialecte.contrib.skip` opts it out with a reason; a declared one fails too), `type-narrowing` (`npm run type-narrowing`) when the package has that script and
@@ -582,7 +795,19 @@ the answer.
582
795
  test proves nothing yet"); a passing case with a receipt whose own test call changed; a passing case
583
796
  still waiting for its green whose test file, or test code it imports, changed since its red ("test
584
797
  code changed since its red and it passes"); a failure on a missing export, a type or syntax error, a
585
- timeout, a stub thrown at import or before the assertion; a file holding `.only` or `only: true`. A
798
+ timeout, a stub thrown at import or before the assertion; a file holding `.only` or `only: true`; a
799
+ file whose run reports no case, `red` and `green` alike, with why the package's vitest configs (every
800
+ `vitest*.config.*` and their `projects`, read as files) give: `ran no case: the file belongs to
801
+ <config>, which the default config does not list (projects)`, `ran no case of the file` (the default
802
+ config holds it: an empty describe, no test call; or a config cannot be fully read - an `include`,
803
+ `exclude` or `projects` entry that is no string literal or inline object, such as an imported constant,
804
+ a spread, a call or a glob of config files - and may hold it), `every case is skipped` (only `.skip` /
805
+ `.todo` / `.skipIf(true)` cases; the gate, which only collects, maps each case the run reports to its
806
+ test call, so a case a helper registers counts as run). A refused file is never frozen, and the gate's
807
+ tdd step fails on it with the same reason. A file
808
+ no vitest config includes (a Playwright spec, a type test) is no vitest test file: it leaves the
809
+ selection with `outside <file> not a vitest test file (no vitest config includes it)`, is never
810
+ refused nor frozen, and never fails the gate. A
586
811
  case the same as at the base is marked unchanged; a case the lot accepts is marked accepted, unless
587
812
  it is proven red then green at its current test call (an acceptance never overrides a proof: it goes
588
813
  the normal path, no accepted receipt, and the line adds `acceptance not needed (proven red → green): it
@@ -680,14 +905,30 @@ the answer.
680
905
  looks deleted) prints `deleted <file> a test call of the base is gone`; when a `gone` entry of
681
906
  `.dialecte/lot.json` names its file (a path or a glob), it prints
682
907
  `gone <file> a test call of the base is gone (<reason>)` instead, in the gate's details too. A titled
683
- test gone and a deleted test file stay `deleted`. A ledger that cannot be read is refused with its
684
- path.
908
+ test gone and a deleted test file stay `deleted`. A changed test file whose run reports no case prints
909
+ `refused <file> <reason>` (the reasons of `red` above), one no vitest config includes `outside <file>
910
+ not a vitest test file (no vitest config includes it)`. A ledger that cannot be read is refused with its
911
+ path. `--json` answers the state: `cases`, `duplicates`, `unfrozen`, `findings`, `unlisted`, and, only
912
+ when there are some, `zeroCases: [{ file, reason }]` (the refused files) and `notVitest: [<file>]` (the
913
+ files out of the selection).
685
914
  - `status --flags` prints only the cases whose receipts carry a flag, with their flags.
686
915
  - `status --legend` prints the tdd terms of the hand-over card, each in two lines: what it means, and
687
916
  whether to look. It needs no package: it works from any folder.
688
917
  - The lot is the uncommitted work: the change is measured from HEAD, so the cases of lots already
689
918
  committed on the branch are not asked again. `--base <ref>` (`tdd` and `gate`) gives the
690
- whole-branch view; `gate --full` measures from where the branch left its base branch.
919
+ whole-branch view; `gate --full` (and `--release`) measures the tdd step from the lot's base: the
920
+ branch the lot was started on (the store lot's base, else the branch `worktree add` recorded it was cut
921
+ from; a base given as a commit id stands for the resolved base branch), from where HEAD now leaves it,
922
+ so a lot that merged or rebased onto its base's new commits is not asked for them. When that base is
923
+ not found, is behind the cut, never held the cut (a stacked lot), was rewritten or has merged the lot's own commits, it measures from the
924
+ worktree's cut and says why; a worktree with no recorded base measures from its cut, one not made by
925
+ `worktree add` from where the branch left its base branch. The first details line of the gate's tdd step
926
+ (none when the step is skipped) reads `tdd base: <short sha> (<source>)`, the source one of `--base`,
927
+ `lot base <ref>`, `worktree from <ref>`, `base branch <b> (the lot's base is a commit)`, `worktree cut`,
928
+ `base branch <b>`, `HEAD`; a fallback reads `tdd base: the worktree's cut (<why>)`, the why one of `no
929
+ base branch recorded`, `<ref> not found`, `<ref> is behind the cut`, `<ref> does not hold the cut: a
930
+ stacked lot` (the ref's reflog never reached the cut), `<ref> was rewritten: the cut <sha>
931
+ is no ancestor of the merge-base <sha>`, `<ref> holds the lot's own commits`.
691
932
  - Test code is compared by the leaves of the parser's syntax tree, each file parsed by its extension
692
933
  (a `.ts` file is no TSX): whitespace, comments (except the ones a tool reads:
693
934
  `@vitest-environment`, `@jest-environment`, `@vite-ignore`), quote style, statement semicolons,
@@ -839,11 +1080,39 @@ the answer.
839
1080
  merge hand-over the tdd verdict is judged on the worktree's own lot tree (the tree its first merge lot
840
1081
  merged onto), current while the hook record of the merged tree stands, so no `gates ran on another tree`
841
1082
  for it), then, in a consumer, `mutation` when the package declares a mutation scope (below), then
842
- `review` from the hand-over folder's findings ledger and `round-<n>/` snapshots, then `standard`. `✓`
1083
+ `review` from the hand-over folder's findings ledger and `round-<n>/` snapshots (below), then `effort`
1084
+ (below; none on a release hand-over), then `late fixes` on a card still to run (below), then `standard`. `✓`
843
1085
  passed; `!` to look at (a step not run here, with its reason, or not run after a failure; no
844
1086
  findings ledger, or one holding no row yet: `no findings recorded`; only nits open); `✗` failed (a
845
- failed step, a blocking or should-fix finding open, `gate never run on this tree` when there is no
846
- record). The records read are the worktree's last runs and the store's records of the tree the
1087
+ failed step, a blocking or should-fix finding open, no independent review after the last round, `gate
1088
+ never run on this tree` when there is no record).
1089
+ - `review`: the review rounds are the `round-<n>/` snapshots only, against the cap of the folder's effort
1090
+ and risk class (the rounds of the higher of the two, below `lot risk`), then the independent
1091
+ review, then the open findings: `✓ review 2 review rounds of 2 · independent review approve · approved`.
1092
+ The independent review must come after the last snapshot: an `independent-reviewer` station end with a
1093
+ verdict strictly after the snapshot's time (`round-<n>.state`'s `at`, else `round-<n>.base`'s mtime; a
1094
+ tie is not after), shown `independent review <verdict>`; or, for a folder without step events (no
1095
+ `events.jsonl`, or events saying the worktree's cli writes none), a ledger row of a round above it,
1096
+ shown `independent review: round 3 in the ledger` (`rounds 3-4`). None: `✗ review no independent
1097
+ review after round <n>`, the card BLOCKED. Beyond the cap each round names its first go-ahead row
1098
+ (`3 review rounds (cap 1, round 2 by <who>, round 3 by <who>)`), a round without one gives `! review
1099
+ 3 review rounds, cap 2, no go-ahead recorded` (a warning); no effort recorded: `2 review rounds (no
1100
+ effort recorded)`. A folder with step events and no review round snapshot reads `✗ review no review
1101
+ round snapshot: dialecte lot snapshot <lot> --round 1` (the ledger never stands in there). A folder with
1102
+ no snapshot, no ledger row and no independent end, a folder without step events and with no snapshot
1103
+ (its ledger rows claim no independent review), and a release hand-over keep the ledger-only line
1104
+ (`<n> rounds · approved · findings ledger`).
1105
+ - `effort`: the effort against the risk class, from the folder's `risk.jsonl`: `✓ effort high · risk class
1106
+ high at handover write (src/cleanup.ts:2: rmSync) · 2 review rounds of 3` (`risk class unknown` with no
1107
+ derived line); an effort below the class `! effort medium below risk class high (by <who>: <reason>)`, or
1108
+ `(no go-ahead recorded)` when no reason is recorded (an effort line without one, or the lot's own effort), a
1109
+ warning that never changes the verdict; `no effort recorded` without one.
1110
+ - `late fixes`: a change of the tree after the last snapshot (the worktree's state hash against
1111
+ `round-<n>.state`'s) reads `! late fixes unverified since round <n> (<k> files): dialecte lot verify
1112
+ <lot> --by <who> --note <text>`, a `lot verify` of the current state `✓ late fixes verified by <who>:
1113
+ <note>`, a last snapshot without `.state` (an older cli) `! late fixes not checked (round <n> has no
1114
+ state)`; the last snapshot's tree, or no snapshot, prints no line. A warning only: `handover run`'s
1115
+ `verify` guard refuses. The records read are the worktree's last runs and the store's records of the tree the
847
1116
  hand-over commits - the worktree's tree, or for a hand-over holding a merge lot the tree its last lot
848
1117
  leaves (the trial merge with its resolutions) - the newest record of each step winning; a tdd step
849
1118
  another worktree recorded is left out (its verdict is that worktree's), and a stored record counts
@@ -942,12 +1211,23 @@ the answer.
942
1211
  whose command (or an ancestor's) is a known editor or the one `git config dialecte.editor` names, and one
943
1212
  named in `git config dialecte.personProcesses` (a comma list of command names, never committed) is one of the
944
1213
  person's tools; every other process is left behind.
945
- - `dialecte handover run <folder>` is what `commit.sh` runs. Two of its guards, `target` (the target branch's tip is held, as above) and
1214
+ - `dialecte handover run <folder>` is what `commit.sh` runs. Three of its guards, `target` (the target branch's tip is held, as above),
946
1215
  `processes` (read at run time, never from the card: a process left behind, or a list that cannot be read,
947
- refuses; tools only pass with `!`), come after the merges guard. Either refusal
1216
+ refuses; tools only pass with `!`) and `verify` (late fixes nobody verified: `✗ verify late fixes
1217
+ unverified since round <n>`; `! verify late fixes not checked (round <n> has no state)` never refuses;
1218
+ `✓ verify no late fixes`, or `verified by <who>: <note>`), come after the merges guard. Each refusal
948
1219
  exits 2 with nothing committed, where every other guard exits 1; `--rehearse` prints `!` for each and goes
949
1220
  on. The merges guard's note for a merge lot of the target that moved reads `lot <n>: merges main at <sha>; main
950
- is now <sha> (see target)`. Each guard prints one line with its result
1221
+ is now <sha> (see target)`. The install guard runs at each lot instead, once its files are staged (after the
1222
+ lock sync below): `node_modules` read against the lock the commit holds, the index's `package-lock.json`. A
1223
+ package at another version, missing or a link elsewhere, a lock that cannot be read or a check that cannot be
1224
+ made refuses the lot (`✗ lot <n> not committed: node_modules do not match package-lock.json: run npm ci in
1225
+ <worktree>`, the packages under it; when the working lock is a later lot's, `... the package-lock.json lot <n>
1226
+ commits (a later lot changes it): run npm ci with that lock, or commit the lock change first`) with exit 2, under `--rehearse` too: no `!` there, a rehearsal checks its
1227
+ clone's `node_modules`. No lock in the index: nothing checked. Each check replaces `install.json` in the
1228
+ hand-over folder (`{ at, lock, working, ok, mismatched }`, `laterLock: true` for a later-lot refusal); the card shows it as its `install` line (`✓ install
1229
+ node_modules match package-lock.json (<hash>)`, or `✗` with the count, which blocks a card still to run) while
1230
+ the worktree's `package-lock.json` is the one the check saw (`working`), else no line. Each guard prints one line with its result
951
1231
  and its time (`✓ snapshot 110 file(s) 0.4 s`): repository, the lots file as reviewed, hooks
952
1232
  folder, branch, HEAD, empty index, the files against the snapshot, deleted files, files outside the
953
1233
  lots, references (citations, declared patterns, and the tags of a contributor), `contrib` in a contributor
@@ -1023,7 +1303,10 @@ the answer.
1023
1303
  lot is reused and no contrib run is needed, no clone is made: the guards, a reused merge's `tree <sha>`,
1024
1304
  then `rehearsal skipped: every lot's tree has a green record` and the card. Otherwise the clone is made
1025
1305
  (`▶ rehearsal contrib` then runs `dialecte contrib` in it at the lots file's HEAD on the tree the lots
1026
- leave, before any commit, its record going to the repository's store as a rehearsal's; the clone is put
1306
+ leave, before any commit, its rules row judged against the last merge lot's tip (only the last one: the lines
1307
+ an earlier merge of another branch brought in count as added), so only the lines the lots add can fail it;
1308
+ without a merge lot against the base the repository resolves at the lots file's HEAD, as `dialecte contrib`
1309
+ there would, never the clone's own base branch; its record going to the repository's store as a rehearsal's; the clone is put
1027
1310
  back after it, the files the run left removed) and
1028
1311
  the reused lots are committed in it with `--no-verify` (their hook skipped, in the clone only), the
1029
1312
  others with their hook. A real run (no `--rehearse`) runs every commit's hook, whatever the store holds.
@@ -1085,8 +1368,9 @@ the answer.
1085
1368
  the note after the sync names each installed package of the staged lock that has one,
1086
1369
  `install scripts not run: <names>`: each package once by its name, a nested copy too, five named then
1087
1370
  `and <n> more`), the working copies put back byte for byte;
1088
- refused when the install changed the staged files or the versions still differ (dev, peer and optional
1089
- packages an install leaves out aside). A real run that leaves every lot committed then moves the worktree's `.dialecte/lot.json`
1371
+ refused when the install changed the staged files or the versions still differ (the sync leaves absent dev,
1372
+ peer and optional packages aside; the install guard right after it checks dev and peer ones, and refuses the
1373
+ lot when one is missing). A real run that leaves every lot committed then moves the worktree's `.dialecte/lot.json`
1090
1374
  into the hand-over folder as `lot.json`, after the card is built, and leaves an empty declaration
1091
1375
  (`{}`) in its place, saying so in one line (`lot file archived: <folder>/lot.json`): the next lot on
1092
1376
  the branch does not inherit its entries. No lot file, an empty one, a rehearsal, a stopped run, or a
@@ -1214,7 +1498,7 @@ the answer.
1214
1498
  (`lockfile`, `notChecked`, `problems`: `package`, `problem`; `command` when there are problems). The
1215
1499
  exit code stays 0 whatever the links and the lockfile say: the worktree exists, and its card says what
1216
1500
  to run.
1217
- - `dialecte lot start <brief.json> [--effort low|medium|high] [--dry-run] [--simulate <scenario>] [--json]` starts a lot from its brief
1501
+ - `dialecte lot start <brief.json> [--effort low|medium|high] [--by <who> --reason <text>] [--dry-run] [--simulate <scenario>] [--json]` starts a lot from its brief
1218
1502
  (`schema`, `feature`, `repository`, `branch`, `base`, `goal`, `plan`, `scope`, `steps`, `lots`, `effort`).
1219
1503
  Every check runs first and every refusal is printed at once (`<field>: <rule> - <detail>`, `{ refused }` with
1220
1504
  `--json`, exit 2), before anything is created: the fields, the repository's main checkout, a new valid branch,
@@ -1235,10 +1519,72 @@ the answer.
1235
1519
  `{ dryRun: true, lot, worktree, next }` dry run, `{ lot, folder, state, reason, next }` failed,
1236
1520
  `{ refused, next: null }` a refused brief, `{ error, usage, next: null }` a usage error (exit 2),
1237
1521
  `{ error, next: null }` any other exit before a lot exists.
1522
+ The effort: the risk class of the scope sets the default (high when a scope entry reaches the package's
1523
+ `dialecte.risk.high` list, or may reach it: `src/**` holds `src/lib/store/**`; `effort high (risk) · risk class
1524
+ high: ...`). On a terminal, without `--json` or `--dry-run`, the effort is asked with that default
1525
+ (`effort for risk class high [high]: `). An effort below the class, from `--effort`, the brief or the answer,
1526
+ is refused (exit 2, nothing written, also on `--dry-run`) unless `--by <who> --reason <text>` give the
1527
+ go-ahead (both or neither); given, they are recorded on an effort line in the lot's `risk.jsonl` and the start
1528
+ prints `! effort medium below risk class high (by <who>: <reason>)`.
1529
+ - `dialecte lot risk <id|folder> [--json]` reads the folder's `risk.jsonl` and derives the risk class now from
1530
+ the worktree's diff against the lot's base, writing nothing: `lot risk: class <c> · effort <e> · cap <n>`, a
1531
+ `! effort <e> below risk class <c> (by <who>: <reason>)` line when it is (`(no go-ahead recorded)` when no
1532
+ reason is recorded), then one line per reason (`<file>:<line>: <detail>`; a declared file reads `<file>:
1533
+ declared` when the list names it, else `<file>: declared <glob>`).
1534
+ High: a changed file in the package's `dialecte.risk.high` list (the base's and the worktree's together, so
1535
+ a change that drops a glob still counts it; the cli declares its store, events, cleanup, review rounds and
1536
+ hand-over commit paths), an added destructive call or git argument in a source file (a line
1537
+ that is a comment alone, starting with `//`, `/*` or `*`, is not read), or a runtime package (one with an
1538
+ `exports` map) whose API index changed, or whose export source changed against the base while its index did
1539
+ not or there is none; light: docs, a version bump, the lockfile, or at most 40 changed lines in at most 3
1540
+ files; medium otherwise. A derivation that cannot run (a repository with no commit yet) falls back to the
1541
+ last derived line, else `class unknown`, and the read ends with `! risk class not derived: <reason>`, exit 0.
1542
+ `--json` prints the read as one object `{ class, reasons, effort, below, cap }`, versioned by the JSON schema
1543
+ `src/commands/lot-risk.schema.json` (draft 2020-12, version 1). `dialecte lot risk <id|folder> --effort low|medium|high [--class
1544
+ high|medium|light] --by <who> [--reason <text>]` appends `{ schema: 1, kind: "effort", at, effort, class?, by,
1545
+ reason? }` to `risk.jsonl` (the last line wins; the same effort, class and reason again: `already`, nothing
1546
+ written, so a reason given after the class rose is a new line);
1547
+ an effort below the class needs `--reason`; when the derivation cannot run, the effort is compared to the last
1548
+ derived line, or to nothing, and recorded. Exit 0 read or recorded; 2 for a usage error, an unknown id, a
1549
+ damaged store lot (`lot risk: <name> damaged: <reason>`, read or write), no `--by`, below without `--reason`,
1550
+ a forbidden word or a committed, canceled or failed lot, nothing written; 1 when the line cannot be
1551
+ written. `lot snapshot` (only when it goes ahead) and `handover write` append a `{ kind: "derived", class,
1552
+ reasons, from }` line; a derivation that cannot run prints `! risk class not derived: <reason>` and appends
1553
+ nothing.
1238
1554
  - `dialecte lot status <id> [--json]` derives the lot's state from its records (`working`, `input-required`,
1239
1555
  `ready`, `committed`, `canceled`, `failed`), with the worktree and link checks and the exact next command (the
1240
1556
  text form adds an `also:` line when there is one, five lines at most); it
1241
- reads files only, runs no git and writes nothing. A damaged lot (a folder of the store whose name has a lot
1557
+ reads files only, runs no git and writes nothing. A real working lot's next station is walked from its
1558
+ records (`nextStation`: per step test-writer, `tdd red`, test-reviewer at medium or high effort,
1559
+ implementer, `tdd green` and `gate --fast`; per review round its snapshot, reviewer, fixer or adjudicator
1560
+ and `gate --fast`; then `gate --full` after the last edit station, `contrib` for a producer, the
1561
+ independent review, the hand-over to write; the first unmet one wins): the text form prints it after the
1562
+ state line, `station implementer step 2 of 3 · round -/2 · effort medium` (`<what>` may be `reviewer
1563
+ round 1`, `tdd green and gate --fast (implementer step 2 ended, claim unchecked)`, `implementer running
1564
+ since <at> (run <run>)`, `lot snapshot round 2`, `question to the person (round cap 2 reached)`, `handover write (no
1565
+ hand-over written)`, `unknown (<why>)`), the position line given up first, and `next` is that station's
1566
+ command (`dialecte lot station <name> start implementer --step 2`, `... end <station> --run <run>`, the
1567
+ check's command, `dialecte lot snapshot <name> --round <r>`, at the cap its `--beyond-cap` form), `also`
1568
+ keeping the manual line; a hand-over to write and an unknown position keep the manual line. A station
1569
+ is ended by an end with exit 0 or none and a verdict other than `failed` or `limit`; a start with no end
1570
+ is running until a later station start or end or a snapshot comes (a check never closes it: the
1571
+ station's own `tdd red`, `tdd green` and `gate --fast` run inside it), `no end` after; an end that names
1572
+ its run and gives no `--step`/`--round` takes its start's; an end of another name, or one with no start
1573
+ that places it, is `unplaced`. A claim is checked by a later `step.end` of its kind with exit 0 in
1574
+ the lot's own worktree (never `throwaway`, no later failed run of the kind, no newer failed gate
1575
+ record), or by one inside the station's run whose `stateHash` is the one its end recorded (the tree it
1576
+ handed over); when the events say the worktree's cli writes no step events, its tdd ledger and green gate
1577
+ records after the end stand in (a later green record of a gate mode covers every earlier claim of that
1578
+ mode), else `unknown (the worktree's cli records no steps)`. A reviewer or test-reviewer end approves only
1579
+ with `approve`: none or another word reads `unknown (<station> ended without a verdict)` or `unknown
1580
+ (<station> ended with <word>)`. `--json` adds `station` (`{ kind, station, check, step, round, why,
1581
+ unplaced, noEnd }`, `null` for a simulated lot) and `rounds` (`{ review, cap, effort, steps, beyondCap:
1582
+ [{ round, by, reason }], independent }`, `effort` the level the cap is taken from or `null`, `steps` the
1583
+ brief's count; the text form prints from them) and `effort` (`{ level, source, riskClass, below }`,
1584
+ `source` `risk-line` for an effort recorded by `lot risk`, `riskClass` the last derived line or `null`; the
1585
+ text form adds `! effort <e> below risk class <c> (by <who>: <reason>)` when it is below, `(no go-ahead
1586
+ recorded)` when no reason is recorded). Other states, a
1587
+ simulated lot and `lot start` keep their next. A damaged lot (a folder of the store whose name has a lot
1242
1588
  name's shape and whose records do not hold: no readable `identity.json`, one naming another folder, or a record
1243
1589
  that fails its check) answers `<name> damaged: <reason>` then `next: dialecte lot stop <name> --reason <text>`
1244
1590
  (`{ lot, state: "damaged", reason, next }` with `--json`), exit 6, never `no lot`; the reason is a fixed word
@@ -1333,8 +1679,13 @@ the answer.
1333
1679
  records are found; the block's `shared` files (the changelog, the README, the command map) never hold a lot back.
1334
1680
  An entry's state is read, never declared: done by a committed hand-over or store lot, open by a store lot, a
1335
1681
  pending hand-over or a worktree on its branch, else ready, waiting, parked, or unknown with the reason when its
1336
- repository cannot be read (files only: the stores, the registries, `worktrees/*/HEAD`; no git process). The text
1337
- says the counts, the open lots (and open work no entry accounts for: its repository's proposals are
1682
+ repository cannot be read (files only: the stores, the registries, `worktrees/*/HEAD`; no git process, except
1683
+ one probe per lot whose hand-over was committed outside its folder and not closed yet: once its branch is past
1684
+ the lot's base commit and on the base branch that lot reads `committed`, is no longer open nor holds anything,
1685
+ and is listed under `landed` as `lot <full name> committed: hand-over committed in <folder>, branch on
1686
+ <target>`; once `lot close` closes that hand-over every reader reads it `committed`, files only, with no
1687
+ `landed` line; a lot with a live run or a transition later than that hand-over reads from its own records). The
1688
+ text says the counts, the open lots (and open work no entry accounts for: its repository's proposals are
1338
1689
  `unverified`), the lots that can start in critical-path order (`unblocks 7 (chain 4)`, `after <id>`, `merge:
1339
1690
  <open lots>`, `next: dialecte lot start <brief>` or the brief to write), the ready lots held by an open one with
1340
1691
  each scope pair met, person entries without a mark, the spec work (a spec missing or `DRAFT`), what each entry
@@ -1342,7 +1693,8 @@ the answer.
1342
1693
  twice the cores, the free and inactive memory against 2 GB (`vm_stat` on macOS, `/proc/meminfo` on Linux); a
1343
1694
  proposal whose heavy steps would run beside a live one says `stacks:`, and on a short machine its heavy steps
1344
1695
  would wait (advice only). `--all` lists the done entries; `--json` answers `{ plan, repositories, counts,
1345
- entries, proposals, held, specWork, heavy, unknown }`. Exit 0 when a lot or fix can start, 1 when none can, 2
1696
+ entries, proposals, held, landed, specWork, heavy, unknown }`, `landed` always a list (`[{ repository, lot,
1697
+ folder, target }]`, `[]` when none). Exit 0 when a lot or fix can start, 1 when none can, 2
1346
1698
  for a usage error, no block or an invalid one (every fault listed), or a repository that is not a git checkout.
1347
1699
  `dialecte plan check <plan.md> [--json]` checks the block alone: one line when valid, else every fault (exit
1348
1700
  2). `dialecte plan mark <plan.md> <id> done --by <who> [--reason <text>]` records a person entry's mark once in
@@ -1363,7 +1715,7 @@ the answer.
1363
1715
  (`{ state, note, at }`, the note's words joined by single spaces) for the card's `standard` line; the line
1364
1716
  references of what was read stay in the findings ledger. Another state, or no note, is a usage error
1365
1717
  (exit 2); a folder inside a repository is refused as below.
1366
- - `dialecte lot finding`, `decide`, `snapshot`, `choice` and `delta` keep a lot's review rounds in its
1718
+ - `dialecte lot finding`, `decide`, `snapshot`, `choice`, `delta` and `verify` keep a lot's review rounds in its
1367
1719
  lot folder, or in a hand-over folder (`_commit-plan/<topic>-<date>/`) that stays outside every repository:
1368
1720
  each refuses any other folder inside a git work tree or a git folder (`.git/`, a bare repository). `--` ends the options: the
1369
1721
  words after it are taken as they are, so a finding or a reason may start with `--`. Each writes its file
@@ -1387,7 +1739,28 @@ the answer.
1387
1739
  `round-<n>.base`. An existing round, an untracked nested repository and a submodule (a gitlink in the
1388
1740
  index or at HEAD) are refused; a run that
1389
1741
  stops part-way leaves only `.partial` names, which the next run removes. `.dialecte/lot.json` is
1390
- never part of it.
1742
+ never part of it. `round-<n>.state` (`{ "schema": 1, "at", "stateHash" }`, the worktree's state hash)
1743
+ is written and renamed with the others. The risk class is derived again from the diff first, and appended
1744
+ to `risk.jsonl` only when the snapshot goes ahead (a refused snapshot writes nothing); the cap is the
1745
+ rounds of the higher of the effort's class and that class (low or light 1,
1746
+ medium 2, high 3; the effort is the last `lot risk --effort` line, else the lot's), and a class above the
1747
+ effort prints `! risk class now high (src/cleanup.ts:2: rmSync): cap 3`. With no effort recorded the cap
1748
+ is 1 and a later round is refused, exit 2, naming `dialecte lot risk <folder> --effort low|medium|high --by
1749
+ <who>`. A round above the cap of an effort is refused, exit 2, naming what set the cap (`(effort medium)`,
1750
+ or `(effort medium, risk class high)` when a class raised it) and `dialecte lot snapshot <folder>
1751
+ --round <n> --beyond-cap --by <who> --reason <text>`. With them the row `| round <n> beyond the cap of
1752
+ <cap>: <reason> | <who> | <day> |` goes to `decisions.md` first, then the snapshot (a retry finds the
1753
+ row of that round and adds none; once it stands, the plain `--round <n>` takes the round too). `--beyond-cap` within the cap, `--by` or `--reason` without it or
1754
+ blank, and a `--by` or `--reason` holding a forbidden word (`lot snapshot: --by holds a forbidden word:
1755
+ nothing written`, the word never printed) are refused, exit 2, nothing written; an existing round
1756
+ stays exit 1.
1757
+ - `lot verify <id|folder> --by <who> --note <text>`, run inside the lot's worktree, appends `{ schema: 1,
1758
+ at, by, note, state }` to `<folder>/verify.jsonl` in one write, `state` the worktree's state hash: the
1759
+ late fixes of that tree verified (the card's `late fixes` line, the `verify` guard). One later change
1760
+ needs a new verify. Exit 0 recorded; 2 for `--by` or `--note` missing, blank or not one line, a
1761
+ forbidden word in either, a run in another work tree than the lot identity's worktree (both named), or
1762
+ no snapshot yet (nothing is late), nothing written; 1 outside a git work tree, or a line over the event
1763
+ line limit.
1391
1764
  - `lot delta <id|folder> --round <n> [--worktree] [--json]` (n ≥ 2) prints, for each file of
1392
1765
  `round-<n-1>/`, of `round-<n-1>.deleted` or of the worktree's status, what changed since round n-1,
1393
1766
  in the form that fits where the file is: the snapshot copy against the worktree file (or
@@ -1425,7 +1798,17 @@ the answer.
1425
1798
  too, `head` its last lot commit or `null`. Kept,
1426
1799
  with why and nothing done for that hand-over: first, a worktree a lot of the repository's store names
1427
1800
  (by real path) while the lot is not `committed` nor `canceled`, reason `lot <full name> <state>` (the
1428
- store read once, no git process per lot); a hand-over still `pending`; its worktree is the main
1801
+ store read once, no git process per lot but the one probe below). A lot whose hand-over was committed
1802
+ outside its own folder (no registry entry for the lot folder, every entry naming its worktree and branch
1803
+ `committed`) reads `committed` once its branch is past the lot's base commit (the base an ancestor of the
1804
+ tip, the tip not the base) and on the base branch. Such a lot keeps nothing, and every outcome of its
1805
+ worktree carries the line `lot <full name> committed: hand-over committed in <folder>, branch on <target>`
1806
+ (under the outcome's line, indented; `landed` in `--json`); the other keep rules below still apply to it.
1807
+ Once `lot close` has closed that hand-over, every reader (`lot status`, `lot wait`, the overlap at `lot
1808
+ start`, `worktree prune`, `plan next` among them) reads the lot `committed`, files only and without the
1809
+ probe, so a branch deleted afterwards never reopens it. A lot with a live run, or a transition later than
1810
+ that hand-over (resumed after it), reads from its own records, never landed nor closed by it. A hand-over
1811
+ still `pending`; its worktree is the main
1429
1812
  checkout (never parked, moved or trashed); no registered worktree at that path (closed already, or one
1430
1813
  in the trash or the pool: never a target again); a worktree on another branch than the hand-over's
1431
1814
  (both branches named: it holds other work now); a `locked` worktree (`git worktree lock`); another
@@ -1453,7 +1836,7 @@ the answer.
1453
1836
  decided nor moved (an entry without it, a worktree removed by hand, is still kept: `nothing to close`).
1454
1837
  Exit 0 when every named hand-over closed (or was already closed), 1 when one was kept, 2 for a name or
1455
1838
  index the registry does not hold (then nothing is closed); `--json` prints
1456
- `[{ handover, closed: true, already?: true } | { handover, kept }]`.
1839
+ `[{ handover, closed: true, already?: true, landed? } | { handover, kept, landed? }]`.
1457
1840
  - Recording a lot. Every record below is appended to a file, never rewritten; a reader skips a half line and a line
1458
1841
  it cannot parse, and counts them.
1459
1842
  - `dialecte lot station <id> start <station> [flags]` and `lot station <id> end <station> [--run <run>] [flags]`
@@ -1463,10 +1846,12 @@ the answer.
1463
1846
  `--tokens-cache-read`, `--tokens-cache-write`, `--tokens-total`), `--money <amount> <currency>`,
1464
1847
  `--duration`, `--exit`, `--verdict` and `--suite <name>=<runs>` for suites the agent ran itself. Nothing but
1465
1848
  the station is required; a field nobody gave stays unknown. `start` answers a `run` and the `end` command to
1466
- run; `end` pairs with `--run`, else with the one open start of its station whose step, round and attempt match
1849
+ run; `end` pairs with `--run` (an end that gives no `--step`/`--round` then takes its start's), else with the one open start of its station whose step, round and attempt match
1467
1850
  the ones it gives (several: refused), else is recorded alone. `--event <id>` makes a retry safe: the same id
1468
1851
  with the same fields answers the first event (`already`) and writes nothing, other fields are refused.
1469
- `start` is refused on a committed, canceled or failed lot, `end` is accepted in every state. The station
1852
+ `start` is refused on a committed, canceled or failed lot, `end` is accepted in every state. An `end`
1853
+ records `stateHash`, the state hash of the lot's worktree (left out when it cannot be read; a retry does
1854
+ not compare it): a check the station ran on that tree inside its run counts for its claim. The station
1470
1855
  names `shared` and `outside` are the report's own labels and are refused. `lot station <id> --from
1471
1856
  <file.json>` takes the same fields as one JSON object, plus `phase` (`start` or `end`); an unknown key
1472
1857
  is refused, every fault at once. A line over 4,096 bytes is refused. Exit 1 when the event cannot be written, 2
@@ -1475,7 +1860,8 @@ the answer.
1475
1860
  `gate --fast`, `--full`, `--release` and `--hook`, `contrib`, `tdd red`, `tdd green`, `mutants run`,
1476
1861
  `handover run` (real and rehearsal), `lot delta --worktree` and `worktree add`: the step, whether it is heavy,
1477
1862
  its exit, its time, whether a gate reused records, and per gate step its status, counts, time and selection. A
1478
- step in a worktree that links no lot, or none matching, writes nothing. A write that fails prints one
1863
+ step in a worktree that links no lot, or none matching, writes nothing. The `step.end` of `tdd red` and
1864
+ `tdd green` carries `stateHash`, the worktree's state hash after the run (computed only in a lot). A write that fails prints one
1479
1865
  `events: not recorded: <reason>` line and never changes the step's exit; a step killed after its start writes
1480
1866
  its end as interrupted where it can. Long lists are cut, failing parts first. A step run in a worktree whose
1481
1867
  link names a lot that lives elsewhere (a copied or moved worktree) is written to that lot as `step.foreign`.
@@ -1773,7 +2159,8 @@ Every command that reads the base branch (the gate's base, `mutants`, `tdd`, `wo
1773
2159
  `lot close`, the hand-over's target) finds it the same way, the first rule that answers winning:
1774
2160
 
1775
2161
  1. `dialecte.baseBranch` when set (an optional override): the local branch, else origin's. Set to a branch that
1776
- exists nowhere, it is refused, never replaced by another: exit 2 for the gate's base, `mutants`, `handover write`
2162
+ exists nowhere, it is refused, never replaced by another (a package without a `dialecte.gate` config too: its
2163
+ default lists hold the scoped `rules` step): exit 2 for the gate's base, `mutants`, `handover write`
1777
2164
  and `handover run`, exit 1 for `worktree add` of a new branch without `--from`; the commit hook fails, and the
1778
2165
  tdd step of `gate --full` fails with the same text.
1779
2166
  2. The branch `origin/HEAD` names (recorded at clone), when that branch exists; the local one is preferred.