@dtmd/temper 0.0.25 → 0.0.26

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 (70) hide show
  1. package/README.md +14 -12
  2. package/dist/src/assembly.d.ts +45 -11
  3. package/dist/src/assembly.js +115 -7
  4. package/dist/src/builtins.d.ts +433 -103
  5. package/dist/src/builtins.js +771 -167
  6. package/dist/src/claude-code.d.ts +6 -3
  7. package/dist/src/claude-code.js +2 -2
  8. package/dist/src/contract.d.ts +153 -44
  9. package/dist/src/contract.js +123 -34
  10. package/dist/src/counsel.d.ts +11 -0
  11. package/dist/src/counsel.js +68 -0
  12. package/dist/src/declarations.d.ts +108 -2
  13. package/dist/src/declarations.js +606 -100
  14. package/dist/src/dial.d.ts +3 -3
  15. package/dist/src/dial.js +21 -5
  16. package/dist/src/emit.d.ts +12 -14
  17. package/dist/src/emit.js +123 -47
  18. package/dist/src/generated/AbsenceGateRow.d.ts +16 -0
  19. package/dist/src/generated/AbsenceGateRow.js +2 -0
  20. package/dist/src/generated/AreaMode.d.ts +5 -0
  21. package/dist/src/generated/AreaMode.js +2 -0
  22. package/dist/src/generated/AreaRow.d.ts +20 -0
  23. package/dist/src/generated/AreaRow.js +1 -0
  24. package/dist/src/generated/AssemblyFactRow.d.ts +17 -4
  25. package/dist/src/generated/BoundRow.d.ts +9 -4
  26. package/dist/src/generated/CedeRow.d.ts +14 -0
  27. package/dist/src/generated/CedeRow.js +2 -0
  28. package/dist/src/generated/CharsetRow.d.ts +14 -3
  29. package/dist/src/generated/ClauseRow.d.ts +23 -21
  30. package/dist/src/generated/CollectionAddressRow.d.ts +1 -1
  31. package/dist/src/generated/Declarations.d.ts +24 -9
  32. package/dist/src/generated/FeatureValue.d.ts +3 -3
  33. package/dist/src/generated/Features.d.ts +3 -3
  34. package/dist/src/generated/KindFactRow.d.ts +41 -8
  35. package/dist/src/generated/Payload.d.ts +3 -5
  36. package/dist/src/generated/PayloadMember.d.ts +7 -0
  37. package/dist/src/generated/RunsRow.d.ts +17 -0
  38. package/dist/src/generated/RunsRow.js +2 -0
  39. package/dist/src/generated/Section.d.ts +2 -2
  40. package/dist/src/generated/SectionContainsRow.d.ts +1 -1
  41. package/dist/src/generated/TypecheckRow.d.ts +20 -0
  42. package/dist/src/generated/TypecheckRow.js +2 -0
  43. package/dist/src/generated/Verifier.d.ts +8 -2
  44. package/dist/src/generated/index.d.ts +6 -0
  45. package/dist/src/index.d.ts +20 -15
  46. package/dist/src/index.js +10 -9
  47. package/dist/src/kind.d.ts +382 -52
  48. package/dist/src/kind.js +461 -49
  49. package/dist/src/lockfile.d.ts +39 -0
  50. package/dist/src/lockfile.js +265 -0
  51. package/dist/src/member-address.d.ts +15 -3
  52. package/dist/src/member-address.js +23 -6
  53. package/dist/src/needs.d.ts +25 -15
  54. package/dist/src/needs.js +10 -11
  55. package/dist/src/patterns.d.ts +112 -0
  56. package/dist/src/patterns.js +90 -0
  57. package/dist/src/pipe.d.ts +16 -0
  58. package/dist/src/pipe.js +39 -0
  59. package/dist/src/playbook.d.ts +203 -0
  60. package/dist/src/playbook.js +239 -0
  61. package/dist/src/prose.d.ts +69 -12
  62. package/dist/src/prose.js +125 -13
  63. package/dist/src/reference.d.ts +70 -0
  64. package/dist/src/reference.js +368 -0
  65. package/package.json +13 -4
  66. package/schemas/agent.json +23 -0
  67. package/schemas/command.json +5 -0
  68. package/schemas/output-style.json +4 -0
  69. package/schemas/rule.json +33 -0
  70. package/schemas/skill.json +63 -0
@@ -2,12 +2,15 @@
2
2
  * The `@dtmd/temper/claude-code` subpath — the first-party Claude Code
3
3
  * provider face. A harness author who
4
4
  * targets Claude Code imports the built-in kinds from here, never the root:
5
- * the root carries only the six-noun core, and identity travels by import,
5
+ * the root carries only the core, and identity travels by import,
6
6
  * so a subpath specifier is a full module
7
7
  * specifier like any other. The built-in default contracts join the kinds here
8
8
  * too: adoption is `import { skill, skillDefaultContract } from "@dtmd/temper/claude-code"`.
9
9
  */
10
- export type { Agent, GateHookEvent, GateHookInit, Handler, Hook, InstalledPlugin, KnownMarketplace, Marketplace, MarketplacePlugin, MarketplaceSource, Mcp, McpServer, Memory, PluginManifest, Rule, Settings, SettingsLocal, Skill, SupportingDoc, } from "./builtins.js";
11
- export { agent, agentDefaultContract, command, commandDefaultContract, gateHook, handler, handlerDefaultContract, hook, hookDefaultContract, installedPlugin, installedPluginDefaultContract, knownMarketplace, knownMarketplaceDefaultContract, marketplace, marketplaceDefaultContract, mcp, mcpDefaultContract, mcpServer, mcpServerDefaultContract, memory, memoryAnthropicDefaultContract, pluginManifest, pluginManifestDefaultContract, rule, ruleDefaultContract, settings, settingsDefaultContract, settingsLocal, settingsLocalDefaultContract, skill, skillDefaultContract, supportingDoc, supportingDocDefaultContract, } from "./builtins.js";
10
+ export type { Agent, GateHookEvent, GateHookInit, Handler, Hook, HookInit, InstalledPlugin, KnownMarketplace, Marketplace, MarketplacePlugin, MarketplaceSource, Mcp, McpServer, Memory, MemoryLocal, OutputStyle, PluginManifest, Rule, Settings, SettingsLocal, Skill, SupportingDoc, Tool, ToolFields, ToolInit, } from "./builtins.js";
11
+ export { agent, agentDefaultContract, command, commandDefaultContract, gateHook, handler, handlerDefaultContract, hook, hookDefaultContract, installedPlugin, installedPluginDefaultContract, knownMarketplace, knownMarketplaceDefaultContract, marketplace, marketplaceDefaultContract, mcp, mcpDefaultContract, mcpServer, mcpServerDefaultContract, memory, memoryDefaultContract, memoryLocal, memoryLocalDefaultContract, outputStyle, outputStyleDefaultContract, pluginManifest, pluginManifestDefaultContract, rule, ruleDefaultContract, settings, settingsDefaultContract, settingsLocal, settingsLocalDefaultContract, skill, skillDefaultContract, supportingDoc, supportingDocDefaultContract, tool, toolDefaultContract, } from "./builtins.js";
12
+ import type { Remedy } from "./kind.js";
13
+ export declare const GUARD_COMMAND: Remedy<"GUARD_COMMAND is retired: declare the hook as `gateHook({ event, matcher })`">;
14
+ export declare const SESSION_START_COMMAND: Remedy<"SESSION_START_COMMAND is retired: declare the hook as `gateHook({ event: 'SessionStart' })`">;
12
15
  export type { Blocks, File, Prose, Text } from "./prose.js";
13
16
  export { blocks, file, text } from "./prose.js";
@@ -2,10 +2,10 @@
2
2
  * The `@dtmd/temper/claude-code` subpath — the first-party Claude Code
3
3
  * provider face. A harness author who
4
4
  * targets Claude Code imports the built-in kinds from here, never the root:
5
- * the root carries only the six-noun core, and identity travels by import,
5
+ * the root carries only the core, and identity travels by import,
6
6
  * so a subpath specifier is a full module
7
7
  * specifier like any other. The built-in default contracts join the kinds here
8
8
  * too: adoption is `import { skill, skillDefaultContract } from "@dtmd/temper/claude-code"`.
9
9
  */
10
- export { agent, agentDefaultContract, command, commandDefaultContract, gateHook, handler, handlerDefaultContract, hook, hookDefaultContract, installedPlugin, installedPluginDefaultContract, knownMarketplace, knownMarketplaceDefaultContract, marketplace, marketplaceDefaultContract, mcp, mcpDefaultContract, mcpServer, mcpServerDefaultContract, memory, memoryAnthropicDefaultContract, pluginManifest, pluginManifestDefaultContract, rule, ruleDefaultContract, settings, settingsDefaultContract, settingsLocal, settingsLocalDefaultContract, skill, skillDefaultContract, supportingDoc, supportingDocDefaultContract, } from "./builtins.js";
10
+ export { agent, agentDefaultContract, command, commandDefaultContract, gateHook, handler, handlerDefaultContract, hook, hookDefaultContract, installedPlugin, installedPluginDefaultContract, knownMarketplace, knownMarketplaceDefaultContract, marketplace, marketplaceDefaultContract, mcp, mcpDefaultContract, mcpServer, mcpServerDefaultContract, memory, memoryDefaultContract, memoryLocal, memoryLocalDefaultContract, outputStyle, outputStyleDefaultContract, pluginManifest, pluginManifestDefaultContract, rule, ruleDefaultContract, settings, settingsDefaultContract, settingsLocal, settingsLocalDefaultContract, skill, skillDefaultContract, supportingDoc, supportingDocDefaultContract, tool, toolDefaultContract, } from "./builtins.js";
11
11
  export { blocks, file, text } from "./prose.js";
@@ -7,7 +7,7 @@
7
7
  * outside it is a squiggle, not a runtime rejection.
8
8
  */
9
9
  import type { Shape, ValueType } from "./generated/index.js";
10
- import type { KindDefinition } from "./kind.js";
10
+ import type { KindDefinition, Member, Remedy } from "./kind.js";
11
11
  /** A clause's delivery posture: `required` gate-blocks, `advisory` reports. */
12
12
  export type Severity = "required" | "advisory";
13
13
  /**
@@ -19,7 +19,7 @@ export type Severity = "required" | "advisory";
19
19
  * identity+severity alone.
20
20
  */
21
21
  export interface Predicate {
22
- /** The predicate's clause key (`required`, `max_len`, `extent`, …). */
22
+ /** The predicate's clause key (`required`, `max-len`, `extent`, …). */
23
23
  readonly key: string;
24
24
  /**
25
25
  * The field (or marker) the predicate constrains, when it names one.
@@ -32,7 +32,7 @@ export interface Predicate {
32
32
  * subset is the whole surface on purpose: a clause names *where* a value lives, never
33
33
  * a pattern that matches it.
34
34
  *
35
- * `forbidden_keys` and `must_define` name a top-level **key**, not a path, and
35
+ * `forbidden-keys` and `must-define` name a top-level **key**, not a path, and
36
36
  * `closed-keys` names neither — it reads the key set its sibling clauses declare.
37
37
  */
38
38
  readonly field?: string;
@@ -47,9 +47,10 @@ export interface Predicate {
47
47
  */
48
48
  readonly target?: string;
49
49
  /**
50
- * `mention-reachable`'s **target-side gate field** — a separate slot from `field`
51
- * (which carries the source-side scope field) since it is the one predicate naming a
52
- * field on *both* ends. Spelled to match the lock's own `gate` column.
50
+ * `mention-reachable`'s and `trigger-agrees`'s **target-side gate field** — a separate
51
+ * slot from `field` (which carries the source-side scope field) since they name a
52
+ * field on *both* ends — and `listing`'s withholding field, the one that gates a member
53
+ * out of the listing. Spelled to match the lock's own `gate` column.
53
54
  */
54
55
  readonly gate?: string;
55
56
  /**
@@ -63,23 +64,26 @@ export interface Predicate {
63
64
  * own `shape` column.
64
65
  */
65
66
  readonly shape?: Shape;
66
- /** `allowed_chars`'s declared character class. */
67
+ /** `allowed-chars`'s declared character class. */
67
68
  readonly charset?: Charset;
68
- /** `forbidden_keys`'s forbidden key list. */
69
+ /** `forbidden-keys`'s forbidden key list. */
69
70
  readonly keys?: readonly string[];
70
- /** `enum`/`deny`'s permitted or forbidden value list. */
71
+ /**
72
+ * `enum`/`deny`'s permitted or forbidden value list, `listing`'s counted kinds, and
73
+ * `loads`'s one load moment.
74
+ */
71
75
  readonly values?: readonly string[];
72
76
  /** `range`'s inclusive numeric bound. */
73
77
  readonly range?: {
74
78
  readonly min: number;
75
79
  readonly max: number;
76
80
  };
77
- /** `section_contains`'s heading-text prefix and the marker each governed section must carry. */
81
+ /** `section-contains`'s heading-text prefix and the marker each governed section must carry. */
78
82
  readonly section?: {
79
83
  readonly heading: string;
80
84
  readonly marker: string;
81
85
  };
82
- /** `require_sections`'s required heading list. */
86
+ /** `require-sections`'s required heading list. */
83
87
  readonly sections?: readonly string[];
84
88
  /**
85
89
  * A by-incidence clause's **field set** — the fields whose edges the selection is
@@ -96,13 +100,17 @@ export interface Predicate {
96
100
  * updates is a gate that changes its mind with no diff. */
97
101
  export type ExtentUnit = "lines" | "characters";
98
102
  /**
99
- * The character class `allowed_chars` admits — inclusive ranges plus individual
103
+ * The character class `allowed-chars` admits — inclusive ranges plus individual
100
104
  * characters, e.g. `[a-z0-9-]`. Each range is a `"<lo>-<hi>"` two-character
101
- * span (`src/contract.rs` `parse_range`'s wire spelling).
105
+ * span. `negated` turns the class into the forbidden set (`[^:]`); `position:
106
+ * "leading"` governs only the first character (an empty value holds), where the
107
+ * default governs every character.
102
108
  */
103
109
  export interface Charset {
104
110
  readonly ranges?: readonly string[];
105
111
  readonly chars?: string;
112
+ readonly negated?: boolean;
113
+ readonly position?: "leading";
106
114
  }
107
115
  /**
108
116
  * A field or marker is present. Presence is asked of the path's trailing name segment,
@@ -120,7 +128,7 @@ export declare const type: (field: string, kinds: readonly ValueType[]) => Predi
120
128
  export declare const minLen: (field: string, n: number) => Predicate;
121
129
  /** The field's value is at most `n` characters. */
122
130
  export declare const maxLen: (field: string, n: number) => Predicate;
123
- /** The field's characters are drawn from a declared class (`allowed_chars`). */
131
+ /** The field's characters are drawn from a declared class (`allowed-chars`). */
124
132
  export declare const allowedChars: (field: string, charset: Charset) => Predicate;
125
133
  /**
126
134
  * The field's value holds one named `Shape` from the closed set the engine generates
@@ -128,8 +136,8 @@ export declare const allowedChars: (field: string, charset: Charset) => Predicat
128
136
  * spell nothing else. There is no escape to a hand-written pattern, which is the point.
129
137
  *
130
138
  * - `hyphen-placement` — a hyphen neither leads, trails, nor doubles (`pdf-processing`,
131
- * never `-pdf`, `pdf-`, or `pdf--processing`). Says nothing about the alphabet; pair it
132
- * with `allowedChars` where the character set matters.
139
+ * never `-pdf`, `pdf-`, or `pdf--processing`). Says nothing about the alphabet, which
140
+ * is `allowedChars`'s.
133
141
  * - `no-xml-tags` — the value carries no XML tag (`<br/>`, `</note>`, `<a href="x">`).
134
142
  * Prose spelling a comparison (`use when x < y`) is not a tag and does not fire.
135
143
  */
@@ -162,6 +170,8 @@ export declare const requireSections: (sections: readonly string[]) => Predicate
162
170
  export declare const nameMatchesDir: () => Predicate;
163
171
  /** Names are unique within the artifact kind (a scope-wide identity collision). */
164
172
  export declare const uniqueName: () => Predicate;
173
+ /** No member of the kind sits at a shallower placement under the same leaf name (`apps:web:terse` shadows `terse`). */
174
+ export declare const unshadowed: () => Predicate;
165
175
  /**
166
176
  * The named field may be present — always satisfied, recording the key as part of a
167
177
  * declared (closed) schema. `dependency-exists` has no constructor: the engine holds
@@ -188,13 +198,19 @@ export declare const globValid: (field: string) => Predicate;
188
198
  * in the target's gate, and on an unscoped source mentioning a gated target.
189
199
  *
190
200
  * Generic over both ends, hard-coding no kind: the trigger is the target's gate field
191
- * carrying a value, never its registration set. Containment is *literal* — every source
192
- * glob must appear verbatim in the gate — since true glob-set containment is
193
- * undecidable, so it false-fires on a semantically contained narrower glob
194
- * (`src/**\/*.ts` inside `src/**`). Declare it at advisory severity: a check that can be
195
- * wrong must not block.
201
+ * carrying a value, never its registration set. Containment is judged over sample paths
202
+ * each source glob matches, not decided, so a verdict can be wrong.
196
203
  */
197
204
  export declare const mentionReachable: (scopeField: string, gateField: string) => Predicate;
205
+ /**
206
+ * The converse of {@link mentionReachable}: where a scoped member mentions a gated one,
207
+ * the target's `gateField` globs must be contained in the source's `scopeField`, so the
208
+ * two triggers of one area cannot drift apart. A gate reaching paths the scope does not
209
+ * leaves the target invocable where the member naming it never loads. Silent on an
210
+ * unscoped source and an ungated target; containment is judged by the same sample paths,
211
+ * so a verdict can be wrong.
212
+ */
213
+ export declare const triggerAgrees: (scopeField: string, gateField: string) => Predicate;
198
214
  /**
199
215
  * Every selected member is reachable from the world — its own inbound registration edge
200
216
  * is live, or a reachable member imports it. A member whose every declared registration
@@ -263,6 +279,20 @@ export declare const locusDeclared: () => Predicate;
263
279
  * so both are silent.
264
280
  */
265
281
  export declare const engineMatches: () => Predicate;
282
+ /**
283
+ * Every declared reference and mention a member carries resolves to exactly one target —
284
+ * neither dangling nor a bare key several hosts share. Names no field, like
285
+ * {@link fresh}: the route walk is one pass over the whole forest, so it composes into a
286
+ * root `contract`.
287
+ */
288
+ export declare const resolves: () => Predicate;
289
+ /**
290
+ * Every `@path` import a member's format executes resolves to a member or a repository
291
+ * file. Names no field, and composes into a root `contract`, for the reason
292
+ * {@link resolves} does; kept apart from it because an import resolves by path against
293
+ * disk, never by identity.
294
+ */
295
+ export declare const importBacked: () => Predicate;
266
296
  /**
267
297
  * Every edge the member's kind declares is placed by the format that renders the member
268
298
  * — a format that omits one renders a contract the prose does not represent. Names no
@@ -278,11 +308,27 @@ export declare const count: (bounds: {
278
308
  }) => Predicate;
279
309
  /** The field's extracted value does not repeat across the selection. */
280
310
  export declare const unique: (field: string) => Predicate;
311
+ /**
312
+ * The text the selection lists sums to at most `budget` characters. One member's entry is
313
+ * its `fields` values joined in order, counted in characters and cut at `entry`; a member
314
+ * whose `withheldBy` field is boolean `true` is not listed and adds nothing. `kinds`
315
+ * narrows the count to members of those kinds (their subkinds included) — the root's
316
+ * selection spans every kind, and one runtime listing spans only some — and absent counts
317
+ * every selected member. The shape of a runtime listing that carries every member's
318
+ * trigger text into each request under one budget — Claude Code's skill listing, which
319
+ * spans skills and commands, is the shipped instance.
320
+ */
321
+ export declare const listing: (fields: readonly string[], bounds: {
322
+ readonly entry: number;
323
+ readonly budget: number;
324
+ readonly withheldBy?: string;
325
+ readonly kinds?: readonly KindDefinition<any>[];
326
+ }) => Predicate;
281
327
  /** Every selected member's `field` value is drawn from a feature over the selection `target` declares. */
282
328
  export declare const membership: (field: string, target: string) => Predicate;
283
329
  /**
284
- * The in/out edge-count bound every selected member must land in. At least one
285
- * direction must be given.
330
+ * The in/out edge-count bound every selected member must land in. A bound naming no
331
+ * direction constrains nothing and is refused at admissibility.
286
332
  *
287
333
  * `fields` filters the by-incidence selection both bounds range over — the clause's
288
334
  * own filter, not either direction's. Omit it and the bound ranges over every edge at
@@ -325,20 +371,32 @@ export declare const degree: (bounds: {
325
371
  * (`specs/decisions/0056-reached-from-joins-the-vocabulary.md`).
326
372
  */
327
373
  export declare const reachedFrom: (roots: string, via?: readonly string[]) => Predicate;
374
+ /** When a member loads into a session: at launch, or on demand. */
375
+ export type LoadMoment = "launch" | "on-demand";
328
376
  /**
329
- * A guarded clause — a predicate (restricted to `type` or `enum`) that acts as a
330
- * guard, with a body of ordinary clauses that fire only where the guard holds.
377
+ * A `when` guard over the member's **load moment** — at launch, or on demand — rather
378
+ * than a field. The engine derives the moment from where the member sits and which
379
+ * channel registers it (a subdirectory's `CLAUDE.md` loads on demand, the root's at
380
+ * launch; a rule declaring `paths` loads on demand), so the clause names the moment
381
+ * and never the placement. A guard form only: as a clause of its own it is refused.
382
+ */
383
+ export declare const loads: (moment: LoadMoment) => Predicate;
384
+ /**
385
+ * A guarded clause — a predicate (restricted to `type`, `enum` or `loads`) that acts
386
+ * as a guard, with a body of ordinary clauses that fire only where the guard holds.
331
387
  * The guard and body share the guard's address binding: the body's field paths
332
- * evaluate at the concrete element address the guard locates.
388
+ * evaluate at the concrete element address the guard locates, and a `loads` guard
389
+ * locates the member itself.
333
390
  *
334
- * The guard must be a `type` or `enumOf` predicate, named for the decidable
335
- * field it addresses. Neither is enforced here; emit validates admissibility.
391
+ * A guard other than a `type`, `enumOf` or `loads` predicate is refused — not here,
392
+ * but by emit's admissibility check.
336
393
  *
337
- * Options for `severity`, `guidance`, and `cite` are supported and follow the
338
- * same pattern as `clause()`. Default severity is `required`.
394
+ * Its options follow `clause()`: the author states the guarded clause's severity —
395
+ * there is no default, since the tool never decides error-versus-warning — with
396
+ * optional `guidance` and `cite`.
339
397
  */
340
- export declare function when(guard: Predicate, body: readonly Clause[], opts?: {
341
- severity?: Severity;
398
+ export declare function when(guard: Predicate, body: readonly Clause[], opts: {
399
+ severity: Severity;
342
400
  guidance?: string;
343
401
  cite?: string;
344
402
  }): Clause;
@@ -367,37 +425,84 @@ export declare function clause(predicate: Predicate, opts: {
367
425
  /**
368
426
  * A requirement's **typed verifier** — the declared delegate that judges the
369
427
  * behavioral remainder, a species-tagged union the gate resolves at admissibility
370
- * and never runs. Two species this slice: a `script` (path-resolved) and a
371
- * `telemetry` declaration (named documented harness events). A probe stays a
428
+ * and never runs. Three species: a `script` (path-resolved), a `telemetry`
429
+ * declaration (named documented harness events), and a `review` (the reader whose
430
+ * judgment holds it, named in prose). A probe stays a
372
431
  * documented pattern until a consumer types it — no `probe()` constructor is minted.
373
432
  */
374
433
  export type Verifier = {
375
434
  readonly species: "script";
376
435
  readonly path: string;
436
+ /** The tool that runs the script — absent where the program names none ({@link script}). */
437
+ readonly tool?: Member;
377
438
  } | {
378
439
  readonly species: "telemetry";
379
440
  readonly events: readonly string[];
441
+ /** The tool the declaration's tap hooks run — absent for the temper package's bin
442
+ * ({@link telemetry}). */
443
+ readonly tool?: Member;
444
+ } | {
445
+ readonly species: "review";
446
+ readonly prose: string;
380
447
  };
448
+ /** What a {@link telemetry} declaration states beyond its events. */
449
+ export interface TelemetryInit {
450
+ /**
451
+ * The `tool(...)` member its tap hooks run as temper — the same member each
452
+ * `gateHook(...)`'s `tool` reaches, where an author runs every hook on one tool. Omit it
453
+ * for the temper package's bin.
454
+ */
455
+ readonly tool?: Member;
456
+ readonly binary?: Remedy<"`binary` gave way to `tool`: write `telemetry(events, { tool: tool({ package, bin }) })`, or omit it for the temper package's bin">;
457
+ }
458
+ /** What a {@link script} verifier states beyond its path. */
459
+ export interface ScriptInit {
460
+ /**
461
+ * The `tool(...)` member that runs the script — the same member a `{ file }` tool
462
+ * homes the command at. Naming it makes the requirement the tool's runner, so the
463
+ * tool's `degree` counts it. Omit it where no composed tool runs the script.
464
+ */
465
+ readonly tool?: Member;
466
+ }
381
467
  /**
382
468
  * A script verifier — a path-resolved reference to the test or CI job that executes
383
- * the behavioral judgment. The gate checks the `path` resolves, never runs it.
469
+ * the behavioral judgment. The gate checks the `path` resolves, never runs it. The
470
+ * verifier may name the tool that runs it (`init.tool`); that reference is a `runs`
471
+ * edge from the requirement.
472
+ *
473
+ * # Throws
474
+ * If `init.tool` is not a `tool(...)` member.
384
475
  */
385
- export declare const script: (path: string) => Verifier;
476
+ export declare function script(path: string, init?: ScriptInit): Verifier;
386
477
  /**
387
478
  * A telemetry verifier — the named documented harness events the emitted tap records
388
479
  * to a local-locus log, judged by reading the field record. Each name must be a
389
480
  * documented harness lifecycle event — the gate checks each resolves, never records
390
481
  * into it. The vocabulary is the engine's own `TAP_HOOK_BINDINGS` table
391
482
  * (`src/builtin_kind.rs`), machine-written across the `generated/` seam and read by
392
- * `builtins.ts`'s `TELEMETRY_EVENT_HOOKS`.
483
+ * `builtins.ts`'s `TELEMETRY_EVENT_HOOKS`. The declaration also names the tool its taps
484
+ * run (`init.tool`, the temper package's bin unless declared); the engine renders each tap
485
+ * command from it, anchored at the project.
486
+ *
487
+ * # Throws
488
+ * If `init.tool` is not a `tool(...)` member.
393
489
  */
394
- export declare const telemetry: (events: readonly string[]) => Verifier;
490
+ export declare function telemetry(events: readonly string[], init?: TelemetryInit): Verifier;
491
+ /**
492
+ * A review verifier — the reader whose judgment holds the requirement, named in prose:
493
+ * the author as it writes, a reviewer at the diff. The gate carries the prose verbatim
494
+ * and never judges it.
495
+ *
496
+ * # Throws
497
+ * If `prose` is blank — a review naming no reader holds nothing.
498
+ */
499
+ export declare function review(prose: string): Verifier;
395
500
  /**
396
501
  * A requirement — a named obligation on the harness. `prose` is the authored
397
502
  * intent, carried never interpreted; `kind` constrains what may fill it —
398
- * either a bare kind-name string or the kind's `KindDefinition`, since the slot
399
- * carries only the kind's *identity* for coverage resolution, never its field
400
- * type: a kind whose fields carry required members (skill, hook) assigns here,
503
+ * the kind's `KindDefinition`, since a kind's identity travels by import, never by
504
+ * string, and the slot carries only that identity for coverage resolution, never its
505
+ * field type: a kind whose fields carry required members (skill, hook) assigns here,
401
506
  * where `KindDefinition<never>` would have rejected it. `required` is the
402
507
  * posture declaration; `clauses` bind to the requirement's **opt-in selection** —
403
508
  * ordinary [`Clause`] values, the same four-channel clause as everywhere, judged
@@ -406,7 +511,7 @@ export declare const telemetry: (events: readonly string[]) => Verifier;
406
511
  */
407
512
  export interface Requirement {
408
513
  readonly prose: string;
409
- readonly kind?: string | KindDefinition<any>;
514
+ readonly kind?: KindDefinition<any>;
410
515
  /**
411
516
  * Whether the requirement must be filled. Unset inherits the corpus's shipped
412
517
  * default — at least one satisfier, at error severity — so an unfilled
@@ -416,5 +521,9 @@ export interface Requirement {
416
521
  readonly clauses?: readonly Clause[];
417
522
  readonly verifier?: Verifier;
418
523
  }
419
- /** An identity helper — types a requirement literal at the keystroke. */
420
- export declare function requirement(init: Requirement): Requirement;
524
+ /**
525
+ * What a requirement map (`harness({ require })`, a member's `requires`) holds under each
526
+ * name: a {@link Requirement} literal, or a member of the shipped `requirement` kind or a
527
+ * subkind of it (`requirement(…)`, `builtins.ts`), whose identity the map's key supplies.
528
+ */
529
+ export type RequirementValue = Requirement | Member;
@@ -26,12 +26,12 @@ export const type = (field, kinds) => ({
26
26
  value_type: kinds,
27
27
  });
28
28
  /** The field's value is at least `n` characters. */
29
- export const minLen = (field, n) => ({ key: "min_len", field, args: { min: n } });
29
+ export const minLen = (field, n) => ({ key: "min-len", field, args: { min: n } });
30
30
  /** The field's value is at most `n` characters. */
31
- export const maxLen = (field, n) => ({ key: "max_len", field, args: { max: n } });
32
- /** The field's characters are drawn from a declared class (`allowed_chars`). */
31
+ export const maxLen = (field, n) => ({ key: "max-len", field, args: { max: n } });
32
+ /** The field's characters are drawn from a declared class (`allowed-chars`). */
33
33
  export const allowedChars = (field, charset) => ({
34
- key: "allowed_chars",
34
+ key: "allowed-chars",
35
35
  field,
36
36
  charset,
37
37
  });
@@ -41,8 +41,8 @@ export const allowedChars = (field, charset) => ({
41
41
  * spell nothing else. There is no escape to a hand-written pattern, which is the point.
42
42
  *
43
43
  * - `hyphen-placement` — a hyphen neither leads, trails, nor doubles (`pdf-processing`,
44
- * never `-pdf`, `pdf-`, or `pdf--processing`). Says nothing about the alphabet; pair it
45
- * with `allowedChars` where the character set matters.
44
+ * never `-pdf`, `pdf-`, or `pdf--processing`). Says nothing about the alphabet, which
45
+ * is `allowedChars`'s.
46
46
  * - `no-xml-tags` — the value carries no XML tag (`<br/>`, `</note>`, `<a href="x">`).
47
47
  * Prose spelling a comparison (`use when x < y`) is not a tag and does not fire.
48
48
  */
@@ -59,7 +59,7 @@ export const extent = (unit, bound) => ({
59
59
  args: { max: bound },
60
60
  });
61
61
  /** The forbidden keys (e.g. the Cursor `globs`/`alwaysApply` keys) are absent. */
62
- export const forbiddenKeys = (keys) => ({ key: "forbidden_keys", keys });
62
+ export const forbiddenKeys = (keys) => ({ key: "forbidden-keys", keys });
63
63
  /**
64
64
  * The kind's declared key set is exhaustive — a member carrying any other top-level key
65
65
  * is a finding. `forbiddenKeys`' complement: a deny-list names a finite set over an open
@@ -78,11 +78,13 @@ export const deny = (field, values) => ({
78
78
  values,
79
79
  });
80
80
  /** The named headings are present. */
81
- export const requireSections = (sections) => ({ key: "require_sections", sections });
81
+ export const requireSections = (sections) => ({ key: "require-sections", sections });
82
82
  /** The member's name matches its directory. */
83
83
  export const nameMatchesDir = () => ({ key: "name-matches-dir" });
84
84
  /** Names are unique within the artifact kind (a scope-wide identity collision). */
85
85
  export const uniqueName = () => ({ key: "unique-name" });
86
+ /** No member of the kind sits at a shallower placement under the same leaf name (`apps:web:terse` shadows `terse`). */
87
+ export const unshadowed = () => ({ key: "unshadowed" });
86
88
  /**
87
89
  * The named field may be present — always satisfied, recording the key as part of a
88
90
  * declared (closed) schema. `dependency-exists` has no constructor: the engine holds
@@ -103,10 +105,10 @@ export const enumOf = (field, values) => ({
103
105
  values,
104
106
  });
105
107
  /** The named body marker is defined (e.g. `disable-model-invocation`). */
106
- export const mustDefine = (marker) => ({ key: "must_define", field: marker });
108
+ export const mustDefine = (marker) => ({ key: "must-define", field: marker });
107
109
  /** Every body section whose heading *starts with* `heading` carries `marker` in its body. */
108
110
  export const sectionContains = (heading, marker) => ({
109
- key: "section_contains",
111
+ key: "section-contains",
110
112
  section: { heading, marker },
111
113
  });
112
114
  /** Every glob the field carries parses under globset (brace-expansion aware). */
@@ -120,17 +122,27 @@ export const globValid = (field) => ({ key: "glob-valid", field });
120
122
  * in the target's gate, and on an unscoped source mentioning a gated target.
121
123
  *
122
124
  * Generic over both ends, hard-coding no kind: the trigger is the target's gate field
123
- * carrying a value, never its registration set. Containment is *literal* — every source
124
- * glob must appear verbatim in the gate — since true glob-set containment is
125
- * undecidable, so it false-fires on a semantically contained narrower glob
126
- * (`src/**\/*.ts` inside `src/**`). Declare it at advisory severity: a check that can be
127
- * wrong must not block.
125
+ * carrying a value, never its registration set. Containment is judged over sample paths
126
+ * each source glob matches, not decided, so a verdict can be wrong.
128
127
  */
129
128
  export const mentionReachable = (scopeField, gateField) => ({
130
129
  key: "mention-reachable",
131
130
  field: scopeField,
132
131
  gate: gateField,
133
132
  });
133
+ /**
134
+ * The converse of {@link mentionReachable}: where a scoped member mentions a gated one,
135
+ * the target's `gateField` globs must be contained in the source's `scopeField`, so the
136
+ * two triggers of one area cannot drift apart. A gate reaching paths the scope does not
137
+ * leaves the target invocable where the member naming it never loads. Silent on an
138
+ * unscoped source and an ungated target; containment is judged by the same sample paths,
139
+ * so a verdict can be wrong.
140
+ */
141
+ export const triggerAgrees = (scopeField, gateField) => ({
142
+ key: "trigger-agrees",
143
+ field: scopeField,
144
+ gate: gateField,
145
+ });
134
146
  /**
135
147
  * Every selected member is reachable from the world — its own inbound registration edge
136
148
  * is live, or a reachable member imports it. A member whose every declared registration
@@ -199,6 +211,20 @@ export const locusDeclared = () => ({ key: "locus-declared" });
199
211
  * so both are silent.
200
212
  */
201
213
  export const engineMatches = () => ({ key: "engine-matches" });
214
+ /**
215
+ * Every declared reference and mention a member carries resolves to exactly one target —
216
+ * neither dangling nor a bare key several hosts share. Names no field, like
217
+ * {@link fresh}: the route walk is one pass over the whole forest, so it composes into a
218
+ * root `contract`.
219
+ */
220
+ export const resolves = () => ({ key: "resolves" });
221
+ /**
222
+ * Every `@path` import a member's format executes resolves to a member or a repository
223
+ * file. Names no field, and composes into a root `contract`, for the reason
224
+ * {@link resolves} does; kept apart from it because an import resolves by path against
225
+ * disk, never by identity.
226
+ */
227
+ export const importBacked = () => ({ key: "import-backed" });
202
228
  /**
203
229
  * Every edge the member's kind declares is placed by the format that renders the member
204
230
  * — a format that omits one renders a contract the prose does not represent. Names no
@@ -224,6 +250,23 @@ export const count = (bounds) => {
224
250
  };
225
251
  /** The field's extracted value does not repeat across the selection. */
226
252
  export const unique = (field) => ({ key: "unique", field });
253
+ /**
254
+ * The text the selection lists sums to at most `budget` characters. One member's entry is
255
+ * its `fields` values joined in order, counted in characters and cut at `entry`; a member
256
+ * whose `withheldBy` field is boolean `true` is not listed and adds nothing. `kinds`
257
+ * narrows the count to members of those kinds (their subkinds included) — the root's
258
+ * selection spans every kind, and one runtime listing spans only some — and absent counts
259
+ * every selected member. The shape of a runtime listing that carries every member's
260
+ * trigger text into each request under one budget — Claude Code's skill listing, which
261
+ * spans skills and commands, is the shipped instance.
262
+ */
263
+ export const listing = (fields, bounds) => ({
264
+ key: "listing",
265
+ fields,
266
+ gate: bounds.withheldBy,
267
+ ...(bounds.kinds === undefined ? {} : { values: bounds.kinds.map((kind) => kind.facts.name) }),
268
+ args: { entry: bounds.entry, max: bounds.budget },
269
+ });
227
270
  /** Every selected member's `field` value is drawn from a feature over the selection `target` declares. */
228
271
  export const membership = (field, target) => ({
229
272
  key: "membership",
@@ -231,8 +274,8 @@ export const membership = (field, target) => ({
231
274
  target,
232
275
  });
233
276
  /**
234
- * The in/out edge-count bound every selected member must land in. At least one
235
- * direction must be given.
277
+ * The in/out edge-count bound every selected member must land in. A bound naming no
278
+ * direction constrains nothing and is refused at admissibility.
236
279
  *
237
280
  * `fields` filters the by-incidence selection both bounds range over — the clause's
238
281
  * own filter, not either direction's. Omit it and the bound ranges over every edge at
@@ -281,23 +324,33 @@ export const reachedFrom = (roots, via) => via === undefined
281
324
  ? { key: "reached-from", target: roots }
282
325
  : { key: "reached-from", target: roots, fields: via };
283
326
  /**
284
- * A guarded clause — a predicate (restricted to `type` or `enum`) that acts as a
285
- * guard, with a body of ordinary clauses that fire only where the guard holds.
327
+ * A `when` guard over the member's **load moment** — at launch, or on demand — rather
328
+ * than a field. The engine derives the moment from where the member sits and which
329
+ * channel registers it (a subdirectory's `CLAUDE.md` loads on demand, the root's at
330
+ * launch; a rule declaring `paths` loads on demand), so the clause names the moment
331
+ * and never the placement. A guard form only: as a clause of its own it is refused.
332
+ */
333
+ export const loads = (moment) => ({ key: "loads", values: [moment] });
334
+ /**
335
+ * A guarded clause — a predicate (restricted to `type`, `enum` or `loads`) that acts
336
+ * as a guard, with a body of ordinary clauses that fire only where the guard holds.
286
337
  * The guard and body share the guard's address binding: the body's field paths
287
- * evaluate at the concrete element address the guard locates.
338
+ * evaluate at the concrete element address the guard locates, and a `loads` guard
339
+ * locates the member itself.
288
340
  *
289
- * The guard must be a `type` or `enumOf` predicate, named for the decidable
290
- * field it addresses. Neither is enforced here; emit validates admissibility.
341
+ * A guard other than a `type`, `enumOf` or `loads` predicate is refused — not here,
342
+ * but by emit's admissibility check.
291
343
  *
292
- * Options for `severity`, `guidance`, and `cite` are supported and follow the
293
- * same pattern as `clause()`. Default severity is `required`.
344
+ * Its options follow `clause()`: the author states the guarded clause's severity —
345
+ * there is no default, since the tool never decides error-versus-warning — with
346
+ * optional `guidance` and `cite`.
294
347
  */
295
348
  export function when(guard, body, opts) {
296
349
  return {
297
350
  predicate: { key: "when" },
298
- severity: opts?.severity ?? "required",
299
- guidance: opts?.guidance,
300
- cite: opts?.cite,
351
+ severity: opts.severity,
352
+ guidance: opts.guidance,
353
+ cite: opts.cite,
301
354
  when_guard: guard,
302
355
  when_body: body,
303
356
  };
@@ -308,19 +361,55 @@ export function clause(predicate, opts) {
308
361
  }
309
362
  /**
310
363
  * A script verifier — a path-resolved reference to the test or CI job that executes
311
- * the behavioral judgment. The gate checks the `path` resolves, never runs it.
364
+ * the behavioral judgment. The gate checks the `path` resolves, never runs it. The
365
+ * verifier may name the tool that runs it (`init.tool`); that reference is a `runs`
366
+ * edge from the requirement.
367
+ *
368
+ * # Throws
369
+ * If `init.tool` is not a `tool(...)` member.
312
370
  */
313
- export const script = (path) => ({ species: "script", path });
371
+ export function script(path, init = {}) {
372
+ if (init.tool !== undefined && init.tool.kind !== "tool") {
373
+ throw new Error("script: `tool` names what runs the script — pass a `tool(...)` member, or omit it.");
374
+ }
375
+ return init.tool === undefined
376
+ ? { species: "script", path }
377
+ : { species: "script", path, tool: init.tool };
378
+ }
314
379
  /**
315
380
  * A telemetry verifier — the named documented harness events the emitted tap records
316
381
  * to a local-locus log, judged by reading the field record. Each name must be a
317
382
  * documented harness lifecycle event — the gate checks each resolves, never records
318
383
  * into it. The vocabulary is the engine's own `TAP_HOOK_BINDINGS` table
319
384
  * (`src/builtin_kind.rs`), machine-written across the `generated/` seam and read by
320
- * `builtins.ts`'s `TELEMETRY_EVENT_HOOKS`.
385
+ * `builtins.ts`'s `TELEMETRY_EVENT_HOOKS`. The declaration also names the tool its taps
386
+ * run (`init.tool`, the temper package's bin unless declared); the engine renders each tap
387
+ * command from it, anchored at the project.
388
+ *
389
+ * # Throws
390
+ * If `init.tool` is not a `tool(...)` member.
391
+ */
392
+ export function telemetry(events, init = {}) {
393
+ if (init.tool !== undefined && init.tool.kind !== "tool") {
394
+ throw new Error("telemetry: `tool` names what the tap hooks run — pass a `tool(...)` member, or omit it " +
395
+ "for the temper package's bin.");
396
+ }
397
+ return init.tool === undefined
398
+ ? { species: "telemetry", events }
399
+ : { species: "telemetry", events, tool: init.tool };
400
+ }
401
+ /**
402
+ * A review verifier — the reader whose judgment holds the requirement, named in prose:
403
+ * the author as it writes, a reviewer at the diff. The gate carries the prose verbatim
404
+ * and never judges it.
405
+ *
406
+ * # Throws
407
+ * If `prose` is blank — a review naming no reader holds nothing.
321
408
  */
322
- export const telemetry = (events) => ({ species: "telemetry", events });
323
- /** An identity helper — types a requirement literal at the keystroke. */
324
- export function requirement(init) {
325
- return init;
409
+ export function review(prose) {
410
+ if (prose.trim() === "") {
411
+ throw new Error("review: `prose` is blank — name the reader whose judgment holds the requirement " +
412
+ "(the author as it writes, a reviewer at the diff).");
413
+ }
414
+ return { species: "review", prose };
326
415
  }