@dtmd/temper 0.0.24 → 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 +116 -8
  4. package/dist/src/builtins.d.ts +436 -103
  5. package/dist/src/builtins.js +772 -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
@@ -0,0 +1,368 @@
1
+ /**
2
+ * The harness reference — temper's operate skill as a value a harness declares. Listed in
3
+ * `harness({ members })` it is an ordinary `skill` member named `temper`; at emit its
4
+ * description and body render from the program's own declarations: the product's
5
+ * mechanics, then one index line per kind in play and per contracted requirement, and a
6
+ * description naming those requirements so every session starts knowing which are taken.
7
+ * Each kind and requirement the index names gets its topic flat beside `SKILL.md`, a
8
+ * `supporting-doc`: `kind-<k>.md` carries the kind's counsel, locus, fields, edges in and
9
+ * out with their intent, the clauses bound over it and its requirements; `requirement-<r>.md` the
10
+ * requirement's prose, what holds it, and its owners. A kind topic names no member but
11
+ * the `tool` topic's commands, so it grows with declarations, never with documents.
12
+ *
13
+ * It renders only committed declarations: a kind at a `local` locus (the dial among
14
+ * them) and every member of one stay out of the index, since a committed projection
15
+ * cannot carry what one machine alone declared.
16
+ */
17
+ import { absenceGatesOf, locusPattern } from "./kind.js";
18
+ import { ROOT_HOSTED_KINDS, skill, supportingDoc } from "./builtins.js";
19
+ import { clauseField, compareStrings, contractedRequirements, kindEdges, kindLocusGlobs, kindsInPlay, targetList, } from "./declarations.js";
20
+ import { readLockfile } from "./lockfile.js";
21
+ import { memberAddress, nestedAddress } from "./member-address.js";
22
+ import { joined, linked, linkedText, span } from "./prose.js";
23
+ /** The reference's skill name — its member lands at `.claude/skills/temper/SKILL.md`. */
24
+ export const REFERENCE_NAME = "temper";
25
+ /** The declared references, awaiting their render from the harness that lists them. */
26
+ const DECLARED = new WeakSet();
27
+ /**
28
+ * The method an agent operating the gate needs, whatever the harness — run the gate,
29
+ * read a finding, fix the member or challenge the contract. No opinion about what a good
30
+ * harness is: that lives in the contracts.
31
+ */
32
+ const MECHANICS = `# Operating the temper gate
33
+
34
+ \`temper\` is one gate over a Claude Code harness, placed wherever the harness is
35
+ authored, changed, or used. This skill is how to *operate* that gate. It carries no
36
+ opinion about what a good harness is — that lives in the SDK program's contracts,
37
+ which you bind, extend, or fork.
38
+
39
+ ## Run the gate
40
+
41
+ - \`temper install\` — the one on-ramp: a discovery report, then one question
42
+ (represent this project as a temper program? — every answer flag-spelled, e.g.
43
+ \`--yes\`, no invisible state). Yes lifts the harness into an SDK program, runs the
44
+ first \`emit\`, and places the session-start hook, guard hook, schema modeline, and
45
+ managed-by notes; no wires the session-start hook alone. Re-running converges: an
46
+ unchanged harness is a no-op.
47
+ - \`temper emit\` — compile the program into its projections and lock. Change the
48
+ module or prose file that owns a member, then emit; never edit a projection, since a
49
+ direct edit is drift that \`check\` and \`guard\` report.
50
+ - \`temper check .\` — the gate, run at the harness root. It validates two greens: every built-in
51
+ contract is itself admissible, and every artifact conforms to the contract for its
52
+ kind. It exits non-zero on a \`required\`-severity violation; add \`--deny-advisories\`
53
+ to also fail on advisory ones.
54
+ - \`temper schema --kind <kind>\` — emit the active contract as an editor JSON Schema,
55
+ the same gate shifted to the keystroke.
56
+
57
+ ## Author a custom kind's layout
58
+
59
+ When a host document interleaves prose and typed members — a spec with its
60
+ invariants, a rule with its clauses — declare a **layout** on the kind and author
61
+ the document in place. A layout types the body's heading tree in three
62
+ primitives: **prose** (verbatim words), a **field section** (a heading whose span
63
+ fills a named field, intent among them), and a **member collection** (a heading
64
+ whose child headings are each one member of a named kind). A field section the
65
+ kind marks as an edge field declares the member's edges, \`satisfies\` among them.
66
+
67
+ A layout has one face — the reader: the document is the authored home, so \`check\`
68
+ reads its members off the file and \`emit\` never regenerates it. Author the prose
69
+ and the members directly; declaring the layout is what puts that content under
70
+ the gate.
71
+
72
+ ## Read a diagnostic
73
+
74
+ Each finding names its clause (the \`code\`, e.g. \`skill.forbidden-keys\`), the artifact
75
+ it is about, and what failed. A \`required\` finding blocks; an \`advisory\` one is a
76
+ recommendation. The clause id is the contract clause that fired — read it against the
77
+ contract for that kind to see exactly what was checked.
78
+
79
+ ## Fix the artifact, or challenge the contract
80
+
81
+ A finding is a true positive by construction — the clause is decidable, so it never
82
+ guesses. That leaves two honest responses, never a third:
83
+
84
+ - **Fix the artifact** when the finding is right — the artifact really does violate a
85
+ contract you stand behind.
86
+ - **Challenge the contract** when the clause is wrong for this harness — too strict,
87
+ mis-scoped, or checking something you do not want gated. The contract is data: tune
88
+ the clause's severity, change its parameters, or drop it — through the SDK
89
+ program's \`expect\` overrides, compiled into the lock at \`emit\`. Do not silence a
90
+ finding by contorting the artifact around a clause you disagree with — change the
91
+ clause.
92
+
93
+ Never paper over a gap. If the contract and the artifact disagree and you are unsure
94
+ which is wrong, surface it rather than guessing which way to bend.
95
+ `;
96
+ /** The trigger every reference description opens with, before its requirements. */
97
+ const TRIGGER = "Use when operating the temper gate on this harness — running `temper emit` or `temper check`, " +
98
+ "reading a temper finding, deciding whether to fix a member or challenge its contract — " +
99
+ "or before adding to or restructuring the harness.";
100
+ /**
101
+ * Declare the harness reference: a `skill` member named {@link REFERENCE_NAME} whose
102
+ * description and body `emit` renders from the harness listing it. `description`
103
+ * hydrates the description's trigger; `satisfies` lets it fill a requirement — and so list
104
+ * itself as that requirement's owner.
105
+ *
106
+ * # Throws
107
+ * If `description` is blank — a skill's description is how a session finds it.
108
+ */
109
+ export function reference(init = {}) {
110
+ const trigger = init.description ?? TRIGGER;
111
+ if (trigger.trim() === "") {
112
+ throw new Error("reference: `description` is the trigger a session loads the skill by — write one, " +
113
+ "or omit it for temper's own.");
114
+ }
115
+ const member = skill({
116
+ name: REFERENCE_NAME,
117
+ description: trigger,
118
+ prose: span(MECHANICS),
119
+ satisfies: [...(init.satisfies ?? [])],
120
+ });
121
+ DECLARED.add(member);
122
+ return member;
123
+ }
124
+ /** Whether a kind's documents are committed — every locus but an `at` locus marked `local`. */
125
+ function committed(facts) {
126
+ return !(facts.locus.kind === "at" && facts.locus.commitment === "local");
127
+ }
128
+ /** The program as the reference may render it: its committed members, and the kinds in play over them. */
129
+ function committedView(harness) {
130
+ return {
131
+ ...harness,
132
+ members: harness.members.filter((member) => committed(member.facts)),
133
+ expect: harness.expect.filter((binding) => committed(binding.kind.facts)),
134
+ admit: harness.admit.filter((admission) => committed(admission.host.facts)),
135
+ };
136
+ }
137
+ /**
138
+ * What holds a requirement's behavior, as its requirement topic states it — a declared
139
+ * verifier, or that it is unheld. The two read distinctly: a review names the reader
140
+ * whose judgment holds the requirement, while unheld names that nothing judges it.
141
+ */
142
+ function heldBy(verifier) {
143
+ switch (verifier?.species) {
144
+ case undefined:
145
+ return "It is unheld — no verifier is declared, so nothing judges its behavior.";
146
+ case "review":
147
+ return `It is held by review: ${verifier.prose}`;
148
+ case "script":
149
+ return `It is held by script: \`${verifier.path}\`.`;
150
+ case "telemetry":
151
+ return `It is held by telemetry over ${verifier.events.map((event) => `\`${event}\``).join(", ")}.`;
152
+ }
153
+ }
154
+ /** The body of a requirement's topic — its prose, what holds it, and the members that own it. */
155
+ function requirementTopic(requirement) {
156
+ const owners = requirement.satisfiers.length === 0
157
+ ? "No member fills it yet."
158
+ : requirement.satisfiers.map((owner) => `- \`${owner.address}\``).join("\n");
159
+ return [
160
+ `# The \`${requirement.name}\` requirement`,
161
+ requirement.prose,
162
+ `## Verifier\n\n${heldBy(requirement.verifier)}`,
163
+ `## Owners\n\n${owners}`,
164
+ ].join("\n\n");
165
+ }
166
+ /** The topic file name a requirement's index line links to — without its `.md`, the doc's identity. */
167
+ function requirementTopicName(name) {
168
+ return `requirement-${name}`;
169
+ }
170
+ /** The topic file name a kind's index line links to — without its `.md`, the doc's identity. */
171
+ function kindTopicName(name) {
172
+ return `kind-${name}`;
173
+ }
174
+ /** A list item whose text may span lines — continuation lines indent under the bullet. */
175
+ function item(head, text) {
176
+ const body = text?.trim();
177
+ return body === undefined || body === "" ? `- ${head}` : `- ${head}: ${body.split("\n").join("\n ")}`;
178
+ }
179
+ /** Where a kind's members live, as its topic states it — the locus and the globs it occupies. */
180
+ function locusSection(facts, globs) {
181
+ const { locus } = facts;
182
+ const gates = locus.kind === "at" ? absenceGatesOf(locus) : [];
183
+ const gateNote = (glob) => {
184
+ const gate = locus.kind === "at" ? gates.find((g) => locusPattern(locus.root, g.glob) === glob) : undefined;
185
+ if (gate === undefined)
186
+ return "";
187
+ const named = gate.absent.map((path) => `\`${path}\``).join(", ");
188
+ return ` — at launch, loaded only where none of ${named} sits in the working directory or above; in a subdirectory, on demand only where that subdirectory has none of its own; an import still reaches it`;
189
+ };
190
+ const listed = globs.map((glob) => `- \`${glob}\`${gateNote(glob)}`).join("\n");
191
+ switch (facts.locus.kind) {
192
+ case "at":
193
+ return `Each member is its own document, at:\n\n${listed}`;
194
+ case "nested-file":
195
+ return globs.length === 0
196
+ ? "Each member is a file nested in a host's unit, and no host in play templates it."
197
+ : `Each member is a file nested in a host's unit, at:\n\n${listed}`;
198
+ case "embedded":
199
+ if (ROOT_HOSTED_KINDS.has(facts.name))
200
+ return "Each member is embedded in the harness root and owns no file.";
201
+ return globs.length === 0
202
+ ? "Each member is embedded in a host's document, and no host in play templates or admits it."
203
+ : `Each member is embedded in a host's document, at:\n\n${listed}`;
204
+ }
205
+ }
206
+ /** The fields a kind's topic lists — its leaf set, then any counselled field beyond it, edge fields aside. */
207
+ function fieldLines(facts) {
208
+ const edges = new Set((facts.edgeFields ?? []).map((edge) => edge.field));
209
+ const counsel = (facts.fieldGuidance ?? {});
210
+ const names = [...new Set([...Object.keys(facts.leaves ?? {}), ...Object.keys(counsel)])];
211
+ return names.filter((name) => !edges.has(name)).map((name) => item(`\`${name}\``, counsel[name]));
212
+ }
213
+ /** One clause bound over a kind, as its topic states it: the predicate, its field, its severity, its guidance. */
214
+ function clauseLine(clause) {
215
+ const field = clauseField(clause.predicate);
216
+ const on = field === undefined ? "" : ` on \`${field}\``;
217
+ return item(`\`${clause.predicate.key}\`${on} (${clause.severity})`, clause.guidance);
218
+ }
219
+ /**
220
+ * The commands a `tool` topic lists — each composed tool, its command, and for a
221
+ * `{ package, bin }` tool the version its program's lockfile records. A tool is a
222
+ * declaration of what the harness runs, so its topic is where the version is read.
223
+ */
224
+ function commandLines(view) {
225
+ const tools = view.members.filter((member) => member.kind === "tool");
226
+ if (tools.length === 0)
227
+ return [];
228
+ const lockfile = tools.some((tool) => tool.fields.some(([key]) => key === "package"))
229
+ ? readLockfile(process.cwd())
230
+ : undefined;
231
+ return [...tools]
232
+ .sort((a, b) => compareStrings(a.name, b.name))
233
+ .map((tool) => {
234
+ const leaf = (name) => tool.fields.find(([key]) => key === name)?.[1];
235
+ const head = `\`${nestedAddress("root", tool.kind, tool.name)}\``;
236
+ const pkg = leaf("package");
237
+ if (pkg !== undefined) {
238
+ const version = lockfile?.version(pkg);
239
+ const locked = lockfile === undefined
240
+ ? "no lockfile records it"
241
+ : version === undefined
242
+ ? `not in \`${lockfile.name}\``
243
+ : `version ${version}, locked by \`${lockfile.name}\``;
244
+ return item(head, `the bin \`${leaf("bin") ?? ""}\` of \`${pkg}\` — ${locked}.`);
245
+ }
246
+ const file = leaf("file");
247
+ if (file !== undefined)
248
+ return item(head, `the committed file \`${file}\`.`);
249
+ return item(head, `the system tool \`${leaf("system") ?? ""}\` on the PATH, claiming no version.`);
250
+ });
251
+ }
252
+ /** The body of a kind's topic — every declaration over the kind, and no member of it but a tool's command. */
253
+ function kindTopic(facts, view, kinds, requirements, link) {
254
+ const counsel = facts.guidance?.trim();
255
+ const fields = fieldLines(facts);
256
+ const commands = facts.name === "tool" ? commandLines(view) : [];
257
+ const { outbound, inbound } = kindEdges(facts, kinds);
258
+ const edge = (head, intent) => item(head, intent ?? "no intent declared.");
259
+ const edges = [
260
+ ...(outbound.length === 0
261
+ ? []
262
+ : [`### Out\n\n${outbound.map((e) => edge(`\`${e.field}\` → ${targetList(e.to)}`, e.intent)).join("\n")}`]),
263
+ ...(inbound.length === 0
264
+ ? []
265
+ : [`### In\n\n${inbound.map((e) => edge(`\`${e.from}\`.\`${e.field}\` → here`, e.intent)).join("\n")}`]),
266
+ ];
267
+ const bindings = view.expect.filter((binding) => binding.kind.facts.name === facts.name);
268
+ const clauses = bindings.flatMap((binding) => binding.clauses);
269
+ const contract = bindings.length === 0
270
+ ? "The program binds no clauses over it — any default contract the kind ships is what holds it."
271
+ : clauses.length === 0
272
+ ? "The program binds it an empty contract — no clause holds its members."
273
+ : clauses.map(clauseLine).join("\n");
274
+ const owned = requirements.flatMap((requirement) => {
275
+ const declared = requirement.kind === facts.name;
276
+ const filled = requirement.satisfiers.some((satisfier) => satisfier.kind === facts.name);
277
+ if (!declared && !filled)
278
+ return [];
279
+ const how = [declared ? "declared over this kind" : "", filled ? "a member of this kind fills it" : ""]
280
+ .filter((part) => part !== "")
281
+ .join("; ");
282
+ const topic = requirementTopicName(requirement.name);
283
+ return [linked `- \`${requirement.name}\` (${how}) — read [${topic}.md](${link(topic)}).`];
284
+ });
285
+ return joined([
286
+ `# The \`${facts.name}\` kind`,
287
+ counsel === undefined || counsel === "" ? "The kind declares no counsel." : counsel,
288
+ `## Locus\n\n${locusSection(facts, kindLocusGlobs(facts, view))}`,
289
+ ...(fields.length === 0 ? [] : [`## Fields\n\n${fields.join("\n")}`]),
290
+ ...(edges.length === 0 ? [] : [`## Edges\n\n${edges.join("\n\n")}`]),
291
+ ...(commands.length === 0 ? [] : [`## Commands\n\n${commands.join("\n")}`]),
292
+ `## Clauses\n\n${contract}`,
293
+ ...(owned.length === 0 ? [] : [joined(["## Requirements\n", ...owned], "\n")]),
294
+ ]);
295
+ }
296
+ /**
297
+ * The rendered reference over `harness`: its description — `trigger`, then the contracted
298
+ * requirements — its body, and its topics, one per kind in play, then one per contracted requirement.
299
+ */
300
+ export function renderReference(harness, link, trigger = TRIGGER) {
301
+ const view = committedView(harness);
302
+ const inPlay = kindsInPlay(view);
303
+ const kinds = inPlay.filter(committed).sort((a, b) => compareStrings(a.name, b.name));
304
+ const requirements = contractedRequirements(view);
305
+ const names = requirements.map((requirement) => requirement.name);
306
+ const kindLines = kinds.map(({ name }) => linked `- When you add or change a \`${name}\` member, read [${kindTopicName(name)}.md](${link(kindTopicName(name))}).`);
307
+ const requirementLines = names.map((name) => linked `- When you fill, change, or move the \`${name}\` requirement, read [${requirementTopicName(name)}.md](${link(requirementTopicName(name))}).`);
308
+ const index = joined([
309
+ "## This harness",
310
+ "Read the topic file for what you are about to change before changing it: it carries " +
311
+ "what this harness declares there and why.",
312
+ ...(kindLines.length === 0 ? [] : [joined(["### Kinds\n", ...kindLines], "\n")]),
313
+ ...(requirementLines.length === 0 ? [] : [joined(["### Requirements\n", ...requirementLines], "\n")]),
314
+ ]);
315
+ const named = names.map((name) => `\`${name}\``).join(", ");
316
+ const description = names.length === 0 ? trigger : `${trigger} Its contracted requirements: ${named}.`;
317
+ return {
318
+ description,
319
+ body: linkedText(joined([MECHANICS, index, ""], "\n")),
320
+ topics: [
321
+ ...kinds.map((facts) => ({
322
+ name: kindTopicName(facts.name),
323
+ body: linkedText(joined([kindTopic(facts, view, inPlay, requirements, link), ""], "\n")),
324
+ })),
325
+ ...requirements.map((requirement) => ({
326
+ name: requirementTopicName(requirement.name),
327
+ body: linkedText(joined([requirementTopic(requirement), ""], "\n")),
328
+ })),
329
+ ],
330
+ };
331
+ }
332
+ /**
333
+ * `harness` with every declared reference rendered from it — the one view emit compiles,
334
+ * so the projection and the declaration rows agree. Each rendered reference brings its
335
+ * kind and requirement topics as `supporting-doc` members hosted by it. A harness carrying none comes
336
+ * back as is.
337
+ */
338
+ export function withReference(harness) {
339
+ if (!harness.members.some((member) => DECLARED.has(member)))
340
+ return harness;
341
+ return {
342
+ ...harness,
343
+ members: harness.members.flatMap((member) => {
344
+ if (!DECLARED.has(member))
345
+ return [member];
346
+ // The declared trigger is the member's own authored description.
347
+ const declared = member.fields.find(([key]) => key === "description")?.[1];
348
+ // Every topic sits beside `SKILL.md` under this member, so a link from the body or
349
+ // from a sibling topic is the same path-form mention of the doc's own address.
350
+ const host = memberAddress(member);
351
+ const link = (topic) => ({
352
+ address: nestedAddress(host, supportingDoc.key, topic),
353
+ display: topic,
354
+ form: "path",
355
+ });
356
+ const { description, body, topics } = renderReference(harness, link, typeof declared === "string" ? declared : TRIGGER);
357
+ const rendered = {
358
+ ...member,
359
+ prose: body,
360
+ fields: member.fields.map(([key, value]) => key === "description" ? ["description", description] : [key, value]),
361
+ };
362
+ return [
363
+ rendered,
364
+ ...topics.map((topic) => supportingDoc({ name: topic.name, host: rendered, prose: topic.body })),
365
+ ];
366
+ }),
367
+ };
368
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dtmd/temper",
3
- "version": "0.0.24",
4
- "description": "The temper authoring face — the six-noun model as typed modules: harness(), kind<T>(), clause values, needs, and file()/text/blocks(). Emit compiles to the declaration rows the engine reads, a byte-faithful projection, and the lock.",
3
+ "version": "0.0.26",
4
+ "description": "The temper authoring face — a harness as typed modules: harness(), kind<T>(), clause values, requirements, capabilities, and file()/text/span()/blocks(). Emit compiles to the declaration rows the engine reads, a byte-faithful projection, and the lock.",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "repository": {
7
7
  "type": "git",
@@ -28,10 +28,19 @@
28
28
  "./claude-code": {
29
29
  "types": "./dist/src/claude-code.d.ts",
30
30
  "default": "./dist/src/claude-code.js"
31
+ },
32
+ "./patterns": {
33
+ "types": "./dist/src/patterns.d.ts",
34
+ "default": "./dist/src/patterns.js"
35
+ },
36
+ "./pipe": {
37
+ "types": "./dist/src/pipe.d.ts",
38
+ "default": "./dist/src/pipe.js"
31
39
  }
32
40
  },
33
41
  "files": [
34
42
  "dist/src",
43
+ "schemas",
35
44
  "bin",
36
45
  "README.md"
37
46
  ],
@@ -52,7 +61,7 @@
52
61
  "temper": "bin/temper.js"
53
62
  },
54
63
  "optionalDependencies": {
55
- "@dtmd/temper-linux-x64": "0.0.24",
56
- "@dtmd/temper-win32-x64": "0.0.24"
64
+ "@dtmd/temper-linux-x64": "0.0.26",
65
+ "@dtmd/temper-win32-x64": "0.0.26"
57
66
  }
58
67
  }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "properties": {
4
+ "description": {
5
+ "description": "The description is how Claude decides when to delegate to this subagent — write it so the trigger is unambiguous."
6
+ },
7
+ "name": {
8
+ "allOf": [
9
+ {
10
+ "pattern": "^(?:[^\\-]|$)"
11
+ }
12
+ ],
13
+ "description": "Every subagent declares a `name` — its unique identifier. Claude Code binds identity to this field alone, never the filename, so a nameless subagent cannot be delegated to.\n\nA name longer than 256 characters is skipped at load — Claude Code writes an error to the debug log and the subagent never exists. Any case and digits are fine (`reviewer-v2`, `Explore` to override the built-in). Hooks receive this value as `agent_type`.\n\nA name containing `:` is skipped at load — the colon is reserved for plugin-scoped ids like `my-plugin:reviewer`, so the subagent never exists. Use a hyphen instead (`my-reviewer`).\n\nA name starting with `-` is skipped at load, so the subagent never exists. Start with a letter or digit; a hyphen anywhere after the first character is fine (`reviewer-v2`).",
14
+ "maxLength": 256,
15
+ "pattern": "^[^:]*$"
16
+ }
17
+ },
18
+ "required": [
19
+ "name",
20
+ "description"
21
+ ],
22
+ "type": "object"
23
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "description": "a command loads as a skill does: its `description` is listed from session start, and its body reaches context only when invoked — by `/` plus its path under `commands/` with each `/` a `:`, or by Claude matching the description. It is one file, so it bundles no supporting files; reach for `.claude/skills/<name>/SKILL.md` when the procedure needs reference material loaded on demand.",
4
+ "type": "object"
5
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object"
4
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "allOf": [
4
+ {
5
+ "not": {
6
+ "required": [
7
+ "description"
8
+ ]
9
+ }
10
+ },
11
+ {
12
+ "not": {
13
+ "required": [
14
+ "globs"
15
+ ]
16
+ }
17
+ },
18
+ {
19
+ "not": {
20
+ "required": [
21
+ "alwaysApply"
22
+ ]
23
+ }
24
+ }
25
+ ],
26
+ "description": "a rule reaches context on one of two schedules: with no `paths` frontmatter it loads at launch, beside `CLAUDE.md`; with `paths` it loads the first time Read, Write or Edit touches a matching file, once per session. A subdirectory's own `.claude/rules/` loads with that subdirectory's `CLAUDE.md`, the first time Claude reads a file beneath it. So keep a rule to facts Claude should hold whenever the rule is loaded — concrete enough to verify ('use 2-space indentation', not 'format code properly'). If an entry is a multi-step procedure or only matters occasionally, it belongs in a skill, whose body loads only when invoked, rather than a rule, which loads whole once its scope opens. Prefer path-scoped rules when one convention governs scattered paths; prefer per-directory CLAUDE.md when directory owners maintain their own. Treat rules like code: prune them when behavior drifts, and test a change by watching whether Claude's behavior actually shifts.",
27
+ "properties": {
28
+ "paths": {
29
+ "description": "`paths` is the one documented rules key: globs (brace expansion supported) that load the rule when a file tool (read, edit, write) touches a matching path. An unparseable pattern — an unclosed `[`, say — is invalid under globset and silently matches nothing, so the rule never loads where you meant it to, with no error surfaced. Fix the pattern or drop it."
30
+ }
31
+ },
32
+ "type": "object"
33
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "allOf": [
4
+ {
5
+ "not": {
6
+ "required": [
7
+ "globs"
8
+ ]
9
+ }
10
+ },
11
+ {
12
+ "not": {
13
+ "required": [
14
+ "alwaysApply"
15
+ ]
16
+ }
17
+ }
18
+ ],
19
+ "description": "a skill reaches context in two steps: its `description` is listed from session start, and its body loads only when the skill is invoked — by `/name`, or by Claude matching the description — so the description carries the trigger and the body the procedure. A `paths` list withholds even the listing until Read, Write or Edit touches a matching file, and supporting files load only when the body sends Claude to one. Set `disable-model-invocation: true` for side-effectful workflows you want to time yourself — it drops the description from context too, so only `/name` loads the skill; `user-invocable: false` for background knowledge that is not a command. Prefer gerund or noun-phrase names (`processing-pdfs`, `pdf-processing`) over vague ones (`helper`, `utils`); `metadata` is the sanctioned home for versioning — there is no top-level `version` field.",
20
+ "properties": {
21
+ "compatibility": {
22
+ "description": "Optional field; when present the spec caps it at 500 characters. Most skills do not need it.",
23
+ "maxLength": 500
24
+ },
25
+ "description": {
26
+ "allOf": [
27
+ {
28
+ "not": {
29
+ "pattern": "</?[A-Za-z_:][-A-Za-z0-9._:]*(\\s+[A-Za-z_:][-A-Za-z0-9._:]*\\s*=\\s*(\"[^\"]*\"|'[^']*'))*\\s*/?>"
30
+ }
31
+ }
32
+ ],
33
+ "description": "The description is how the model chooses this skill from potentially 100+ available — it is the skill's API. Claude Code would fall back to the body's first paragraph; the spec and upload validation require it declared.\n\nSay both what the skill does and when to use it, with the keywords a user would naturally say. Write in third person — the text is injected into the system prompt, and inconsistent point-of-view causes discovery problems.\n\nThe spec's cap. Claude Code additionally truncates the skill listing at 1,536 combined characters (description + when_to_use) — truncation, not rejection, but text past the fold cannot help the model choose.\n\nAnthropic's platform upload validation rejects a description carrying an XML tag — the description is injected into the system prompt, where a tag is markup rather than text. Neither the open spec nor Claude Code's runtime enforces it, so this is the clause that keeps a skill portable through the API and claude.ai. Prose spelling a comparison (`use when x < y`) is not a tag and does not fire.",
34
+ "maxLength": 1024,
35
+ "minLength": 1
36
+ },
37
+ "name": {
38
+ "allOf": [
39
+ {
40
+ "pattern": "^([^-]+(-[^-]+)*)?$"
41
+ }
42
+ ],
43
+ "description": "Every skill declares a `name` — the slug the harness binds to. Claude Code alone would default it from the directory name, but a nameless skill is not portable: the spec and Anthropic's upload validation both require it.\n\nA present-but-empty name fails the spec's 1-64 character bound.\n\nLowercase letters, digits, and hyphens only — `PDF-Processing` is the spec's own counter-example. The charset also keeps XML out of the name, which Anthropic's upload validation separately forbids.\n\nKeep the name short and slug-like; it becomes a directory and an id.\n\nA hyphen separates segments, so it may not lead, trail, or double — `-pdf`, `pdf-`, and `pdf--processing` are the spec's own counter-examples. The charset clause above admits the hyphen; this places it.\n\nReserved words, enforced by Anthropic's platform upload validation (not by the open spec, and not by Claude Code's runtime — which itself ships a `claude-api` skill). Keep them out if the skill will ever travel through the API or claude.ai.",
44
+ "maxLength": 64,
45
+ "minLength": 1,
46
+ "not": {
47
+ "enum": [
48
+ "anthropic",
49
+ "claude"
50
+ ]
51
+ },
52
+ "pattern": "^[a-z0-9\\-]*$"
53
+ },
54
+ "paths": {
55
+ "description": "The optional `paths` scope gates every invocation channel until a file tool (read, edit, write) touches a path its globs match; each entry is a glob (brace expansion supported). An unparseable pattern — an unclosed `[`, say — is invalid under globset and silently matches nothing, so the gate never opens and the skill never registers, with no error surfaced. Fix the pattern or drop the field."
56
+ }
57
+ },
58
+ "required": [
59
+ "name",
60
+ "description"
61
+ ],
62
+ "type": "object"
63
+ }