@malloy-publisher/skills 0.1.63 → 0.1.65

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 (124) hide show
  1. package/README.md +6 -4
  2. package/dist/index.d.ts +3 -13
  3. package/dist/index.js +3 -32
  4. package/dist/skill_frontmatter.d.ts +27 -0
  5. package/dist/skill_frontmatter.js +122 -0
  6. package/package.json +5 -1
  7. package/skills/eval-answer/SKILL.md +2 -2
  8. package/skills/eval-answer/reference/ledger-schema-events.md +239 -0
  9. package/skills/eval-answer/reference/ledger-schema.md +3 -241
  10. package/skills/eval-answer/scripts/check_findable.py +3 -3
  11. package/skills/eval-diagnose/SKILL.md +6 -6
  12. package/skills/eval-import/SKILL.md +1 -1
  13. package/skills/eval-improve/SKILL.md +9 -7
  14. package/skills/eval-improve/scripts/improve.py +7 -6
  15. package/skills/eval-judge/SKILL.md +1 -1
  16. package/skills/eval-judge/reference/retrieval-judge.md +1 -1
  17. package/skills/eval-loop/SKILL.md +4 -27
  18. package/skills/eval-loop/reference/running-a-run.md +1 -1
  19. package/skills/eval-loop/reference/scrape-minimally.md +26 -0
  20. package/skills/eval-loop/reference/setting-up-a-set.md +1 -1
  21. package/skills/eval-loop/scripts/agent_harness.py +66 -33
  22. package/skills/eval-loop/scripts/build_run_package.py +3 -3
  23. package/skills/eval-loop/scripts/run_baseline.py +99 -55
  24. package/skills/eval-loop/templates/eval-run-package/README.md +2 -2
  25. package/skills/eval-report/SKILL.md +1 -1
  26. package/skills/malloy-analysis/SKILL.md +3 -3
  27. package/skills/malloy-analysis-report/SKILL.md +1 -1
  28. package/skills/malloy-charts/SKILL.md +1 -1
  29. package/skills/malloy-classify/SKILL.md +1 -1
  30. package/skills/malloy-compliance-review/SKILL.md +1 -1
  31. package/skills/malloy-dashboards/SKILL.md +1 -1
  32. package/skills/malloy-define/SKILL.md +1 -1
  33. package/skills/malloy-define-workflow/SKILL.md +168 -0
  34. package/skills/malloy-discover/SKILL.md +1 -1
  35. package/skills/malloy-document/SKILL.md +1 -1
  36. package/skills/malloy-excel-review/NOTICE +2 -2
  37. package/skills/malloy-excel-review/SKILL.md +14 -10
  38. package/skills/malloy-excel-review/fixtures/README.md +2 -1
  39. package/skills/malloy-excel-review/reference/_concepts.md +2 -2
  40. package/skills/malloy-excel-review/reference/cookbook-lookup-aggregate-2.md +609 -0
  41. package/skills/malloy-excel-review/reference/cookbook-lookup-aggregate.md +2 -607
  42. package/skills/malloy-excel-review/reference/cookbook-pivot-2.md +340 -0
  43. package/skills/malloy-excel-review/reference/cookbook-pivot.md +12 -346
  44. package/skills/malloy-excel-review/reference/cookbook-scenario-2.md +431 -0
  45. package/skills/malloy-excel-review/reference/cookbook-scenario.md +9 -433
  46. package/skills/malloy-excel-review/reference/discover.md +4 -4
  47. package/skills/malloy-excel-review/reference/limitations.md +4 -4
  48. package/skills/malloy-excel-review/reference/parity.md +6 -6
  49. package/skills/malloy-excel-review/reference/power-pivot.md +1 -1
  50. package/skills/malloy-excel-review/reference/recover-sources.md +1 -1
  51. package/skills/malloy-excel-review/reference/review-coverage.md +1 -1
  52. package/skills/malloy-excel-review/reference/translate-formulas-2.md +162 -0
  53. package/skills/malloy-excel-review/reference/translate-formulas.md +8 -164
  54. package/skills/malloy-getting-started/SKILL.md +5 -5
  55. package/skills/malloy-gotchas-modeling/SKILL.md +3 -57
  56. package/skills/malloy-gotchas-modeling/reference/json-files.md +26 -0
  57. package/skills/malloy-gotchas-modeling/reference/relative-data-paths.md +44 -0
  58. package/skills/malloy-html-data-apps/SKILL.md +5 -5
  59. package/skills/malloy-html-data-apps/reference/app-frame.md +6 -4
  60. package/skills/malloy-html-data-apps/reference/depth-patterns.md +1 -1
  61. package/skills/malloy-lookml-review/SKILL.md +1 -1
  62. package/skills/malloy-materialization/SKILL.md +90 -71
  63. package/skills/malloy-materialization/reference/access-filter.md +8 -9
  64. package/skills/malloy-materialization/reference/annotation.md +32 -30
  65. package/skills/malloy-materialization/reference/chaining.md +35 -19
  66. package/skills/malloy-materialization/reference/estimating.md +117 -0
  67. package/skills/malloy-materialization/reference/policy.md +3 -3
  68. package/skills/malloy-materialization/reference/refresh.md +8 -10
  69. package/skills/malloy-materialization/reference/storage.md +40 -19
  70. package/skills/malloy-materialization/reference/tuning.md +14 -12
  71. package/skills/malloy-materialization/reference/why-live.md +31 -0
  72. package/skills/malloy-model/SKILL.md +8 -45
  73. package/skills/malloy-model/reference/joined-source-template.md +26 -0
  74. package/skills/malloy-model/reference/legacy-filter.md +28 -0
  75. package/skills/malloy-model-as-you-go/SKILL.md +1 -1
  76. package/skills/malloy-modeling/SKILL.md +4 -1
  77. package/skills/malloy-notebooks/SKILL.md +1 -1
  78. package/skills/malloy-phrase-detection/SKILL.md +1 -1
  79. package/skills/malloy-powerbi-review/SKILL.md +1 -1
  80. package/skills/malloy-powerbi-review/reference/limitations.md +2 -2
  81. package/skills/malloy-publish/SKILL.md +6 -5
  82. package/skills/malloy-queries/SKILL.md +25 -2
  83. package/skills/malloy-reports/SKILL.md +1 -1
  84. package/skills/malloy-review/SKILL.md +1 -1
  85. package/skills/malloy-run-workflow/SKILL.md +110 -0
  86. package/skills/malloy-source-unreachable/SKILL.md +3 -1
  87. package/skills/eval-answer/scripts/check_contamination_test.py +0 -128
  88. package/skills/eval-answer/scripts/check_coverage_test.py +0 -625
  89. package/skills/eval-answer/scripts/check_findable_test.py +0 -594
  90. package/skills/eval-answer/scripts/check_must_not_use_test.py +0 -201
  91. package/skills/eval-answer/scripts/config_test.py +0 -171
  92. package/skills/eval-answer/scripts/golden_rows_test.py +0 -178
  93. package/skills/eval-answer/scripts/init_truth_package_test.py +0 -129
  94. package/skills/eval-answer/scripts/ledger_test.py +0 -210
  95. package/skills/eval-answer/scripts/mcp_payload_test.py +0 -290
  96. package/skills/eval-answer/scripts/publisher_rest_test.py +0 -199
  97. package/skills/eval-answer/scripts/score_retrieval_test.py +0 -867
  98. package/skills/eval-answer/scripts/verify_definitions_test.py +0 -821
  99. package/skills/eval-answer/scripts/verify_goldens_test.py +0 -1403
  100. package/skills/eval-diagnose/scripts/cluster_failures_test.py +0 -127
  101. package/skills/eval-diagnose/scripts/diagnose_test.py +0 -695
  102. package/skills/eval-import/scripts/import_cases_test.py +0 -343
  103. package/skills/eval-improve/scripts/improve_test.py +0 -415
  104. package/skills/eval-loop/scripts/agent_harness_test.py +0 -583
  105. package/skills/eval-loop/scripts/build_run_package_test.py +0 -367
  106. package/skills/eval-loop/scripts/check_judge_test.py +0 -52
  107. package/skills/eval-loop/scripts/check_set_test.py +0 -121
  108. package/skills/eval-loop/scripts/eval_test.py +0 -84
  109. package/skills/eval-loop/scripts/flip_table_test.py +0 -349
  110. package/skills/eval-loop/scripts/package_skills_test.py +0 -263
  111. package/skills/eval-loop/scripts/platform_target_test.py +0 -286
  112. package/skills/eval-loop/scripts/run_baseline_test.py +0 -2408
  113. package/skills/eval-loop/scripts/serve_test.py +0 -532
  114. package/skills/malloy-compliance-review/scripts/compliance_test.py +0 -733
  115. package/skills/malloy-define-agent/SKILL.md +0 -109
  116. package/skills/malloy-excel-review/fixtures/build_fixture.py +0 -882
  117. package/skills/malloy-excel-review/fixtures/fixture.xlsx +0 -0
  118. package/skills/malloy-excel-review/fixtures/fixture_1904.xlsx +0 -0
  119. package/skills/malloy-excel-review/scripts/classify_workbook_connections_test.py +0 -1695
  120. package/skills/malloy-excel-review/scripts/classify_workbook_test.py +0 -5251
  121. package/skills/malloy-excel-review/scripts/fixture_test.py +0 -502
  122. package/skills/malloy-html-data-apps/scripts/themes_test.py +0 -51
  123. package/skills/malloy-powerbi-review/scripts/classify_measures_test.py +0 -1448
  124. package/skills/malloy-run-agent/SKILL.md +0 -69
package/README.md CHANGED
@@ -34,10 +34,12 @@ The agent skills that ship with [Malloy Publisher](https://github.com/malloydata
34
34
  files you can install. They are task-specific guides for writing Malloy, building and reviewing
35
35
  models, exploring data, and authoring HTML data apps.
36
36
 
37
- Publisher already serves these skills over MCP, as prompts, including each skill's `reference/`
38
- files. This package exists for the cases MCP does not cover: a host that reads skill files from disk
39
- (Claude Code and the Publisher plugin), a scaffolder that installs them into a new project, or any
40
- tool that wants the files themselves rather than prompt text.
37
+ Publisher already serves these skills over MCP: each `SKILL.md` as a prompt, and each Markdown
38
+ file of a skill by path through `get_skill` (a reply whose `skill.relative_filepath` is not the path asked for comes from a server too old to read files of a skill, and the file was not read). The other files of a skill (scripts, templates, data)
39
+ are not in the server's bundle: `get_skill` answers with the file's size and says to install this
40
+ package. This package exists for the cases MCP does not cover: a host that reads skill files from
41
+ disk (Claude Code and the Publisher plugin), a scaffolder that installs them into a new project, or
42
+ any tool that wants the files themselves rather than prompt text.
41
43
 
42
44
  ## Use the files from code
43
45
 
package/dist/index.d.ts CHANGED
@@ -1,16 +1,6 @@
1
- /** A skill's frontmatter, plus where its files live. */
2
- export interface Skill {
3
- name: string;
4
- description: string;
5
- /** Absolute path to the skill's directory: SKILL.md and any reference/. */
6
- dir: string;
7
- }
8
- /**
9
- * Read every skill's frontmatter from the shipped files.
10
- *
11
- * Parsed on demand rather than baked into a generated manifest, so there is no
12
- * second copy of this metadata to regenerate or to drift.
13
- */
1
+ import { type Skill } from "./skill_frontmatter.js";
2
+ export type { Skill };
3
+ /** Read every skill's frontmatter from the shipped files, in name order. */
14
4
  export declare function listSkills(): Skill[];
15
5
  /**
16
6
  * The installer is re-exported here so `@malloy-publisher/skills` has one entry
package/dist/index.js CHANGED
@@ -4,40 +4,11 @@
4
4
  * The skill files are this package's payload; these exports exist so a consumer
5
5
  * can find them without hardcoding a node_modules layout.
6
6
  */
7
- import * as fs from "node:fs";
8
- import * as path from "node:path";
9
7
  import { skillsDir } from "./payload.js";
10
- function unquote(value) {
11
- return value.trim().replace(/^["']|["']$/g, "");
12
- }
13
- /**
14
- * Read every skill's frontmatter from the shipped files.
15
- *
16
- * Parsed on demand rather than baked into a generated manifest, so there is no
17
- * second copy of this metadata to regenerate or to drift.
18
- */
8
+ import { readSkills } from "./skill_frontmatter.js";
9
+ /** Read every skill's frontmatter from the shipped files, in name order. */
19
10
  export function listSkills() {
20
- const skills = [];
21
- for (const entry of fs.readdirSync(skillsDir, { withFileTypes: true })) {
22
- if (!entry.isDirectory())
23
- continue;
24
- const dir = path.join(skillsDir, entry.name);
25
- const skillFile = path.join(dir, "SKILL.md");
26
- if (!fs.existsSync(skillFile))
27
- continue;
28
- const markdown = fs
29
- .readFileSync(skillFile, "utf8")
30
- .replace(/\r\n/g, "\n");
31
- const frontmatter = markdown.match(/^---\n([\s\S]*?)\n---/)?.[1] ?? "";
32
- skills.push({
33
- name: unquote(frontmatter.match(/^name:\s*(.+)$/m)?.[1] ?? entry.name),
34
- description: unquote(frontmatter.match(/^description:\s*(.+)$/m)?.[1] ?? ""),
35
- dir,
36
- });
37
- }
38
- // Codepoint order, not localeCompare: the result is compared across
39
- // platforms and must not depend on the runtime's locale.
40
- return skills.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
11
+ return readSkills(skillsDir);
41
12
  }
42
13
  /**
43
14
  * The installer is re-exported here so `@malloy-publisher/skills` has one entry
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A skill's `name` and `description` from its frontmatter: read the YAML, and
3
+ * on a parse failure or a name outside the spec fall back to a line read. A
4
+ * second reader beside the server's `parseFrontmatter`
5
+ * (packages/server/src/service/skills/frontmatter.ts), which a published
6
+ * runtime package cannot import; skill_frontmatter.spec.ts holds the two to
7
+ * the same answers. The fallback is silent here because a listing has no
8
+ * channel for the warning the server raises.
9
+ */
10
+ export declare function readFrontmatter(frontmatter: string, dirName: string): {
11
+ name: string;
12
+ description: string;
13
+ };
14
+ /** A skill's frontmatter, plus where its files live. */
15
+ export interface Skill {
16
+ name: string;
17
+ description: string;
18
+ /** Absolute path to the skill's directory: SKILL.md and any reference/. */
19
+ dir: string;
20
+ }
21
+ /**
22
+ * Every skill under `root`, parsed on demand rather than baked into a generated
23
+ * manifest, so there is no second copy of this metadata to drift. `listSkills`
24
+ * reads the shipped files; the parity spec points `root` at skills it wrote,
25
+ * which is why this is not on the package's entry point.
26
+ */
27
+ export declare function readSkills(root: string): Skill[];
@@ -0,0 +1,122 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+ import * as fs from "node:fs";
4
+ import * as path from "node:path";
5
+ import { parseDocument } from "yaml";
6
+ function unquote(value) {
7
+ return value.trim().replace(/^["']|["']$/g, "");
8
+ }
9
+ /** agentskills.io's name rule: 1-64 characters of lowercase letters, digits and single hyphens. */
10
+ const SKILL_NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
11
+ const SKILL_NAME_MAX_CHARS = 64;
12
+ /** Alias-free output stays under 5x its source; an alias, even of a scalar, can exceed it. */
13
+ const EMIT_FACTOR = 5;
14
+ const EMIT_SLACK = 10_000;
15
+ /** YAML's parse time grows faster than its input, so a longer frontmatter is line-read; kept equal to the server reader's cap. */
16
+ const FRONTMATTER_MAX_BYTES = 4 * 1024;
17
+ /** Values the parsed frontmatter may hold, aliases expanded; kept equal to the server reader's cap. */
18
+ const FRONTMATTER_MAX_NODES = 256;
19
+ /** The frontmatter as a JSON object, or undefined when YAML cannot be trusted to read it. */
20
+ function parseYaml(front) {
21
+ if (Buffer.byteLength(front) > FRONTMATTER_MAX_BYTES)
22
+ return undefined;
23
+ try {
24
+ const doc = parseDocument(front, { logLevel: "silent" });
25
+ if (doc.errors.length > 0)
26
+ return undefined;
27
+ let emitted = 0;
28
+ let nodes = 0;
29
+ const limit = EMIT_FACTOR * front.length + EMIT_SLACK;
30
+ const bounded = (_key, node) => {
31
+ emitted += 1;
32
+ if (++nodes > FRONTMATTER_MAX_NODES) {
33
+ throw new Error("more values than the cap");
34
+ }
35
+ if (typeof node === "string")
36
+ emitted += node.length;
37
+ else if (node === null || typeof node !== "object") {
38
+ emitted += JSON.stringify(node)?.length ?? 0;
39
+ }
40
+ else if (!Array.isArray(node)) {
41
+ for (const k of Object.keys(node))
42
+ emitted += k.length;
43
+ }
44
+ if (emitted > limit)
45
+ throw new Error("expands past its source size");
46
+ return node;
47
+ };
48
+ const value = JSON.parse(JSON.stringify(doc.toJS() ?? {}, bounded));
49
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
50
+ return undefined;
51
+ }
52
+ return value;
53
+ }
54
+ catch {
55
+ return undefined;
56
+ }
57
+ }
58
+ /**
59
+ * A skill's `name` and `description` from its frontmatter: read the YAML, and
60
+ * on a parse failure or a name outside the spec fall back to a line read. A
61
+ * second reader beside the server's `parseFrontmatter`
62
+ * (packages/server/src/service/skills/frontmatter.ts), which a published
63
+ * runtime package cannot import; skill_frontmatter.spec.ts holds the two to
64
+ * the same answers. The fallback is silent here because a listing has no
65
+ * channel for the warning the server raises.
66
+ */
67
+ export function readFrontmatter(frontmatter, dirName) {
68
+ const line = (key) => {
69
+ // Looks no further than the YAML cap, as the server reader does.
70
+ const value = frontmatter
71
+ .slice(0, FRONTMATTER_MAX_BYTES)
72
+ .match(new RegExp(`^${key}:[ \\t]*(\\S.*)$`, "m"))?.[1];
73
+ return value === undefined ? undefined : unquote(value);
74
+ };
75
+ const lineRead = {
76
+ name: line("name") ?? dirName,
77
+ description: line("description") ?? "",
78
+ };
79
+ const value = parseYaml(frontmatter);
80
+ if (value === undefined)
81
+ return lineRead;
82
+ const declared = value.name ?? undefined;
83
+ if (declared !== undefined &&
84
+ !(typeof declared === "string" &&
85
+ declared.length <= SKILL_NAME_MAX_CHARS &&
86
+ SKILL_NAME.test(declared))) {
87
+ return lineRead;
88
+ }
89
+ const description = value.description ?? "";
90
+ return {
91
+ name: typeof declared === "string" ? declared : dirName,
92
+ description: typeof description === "string"
93
+ ? description.trim()
94
+ : lineRead.description,
95
+ };
96
+ }
97
+ /**
98
+ * Every skill under `root`, parsed on demand rather than baked into a generated
99
+ * manifest, so there is no second copy of this metadata to drift. `listSkills`
100
+ * reads the shipped files; the parity spec points `root` at skills it wrote,
101
+ * which is why this is not on the package's entry point.
102
+ */
103
+ export function readSkills(root) {
104
+ const skills = [];
105
+ for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
106
+ if (!entry.isDirectory())
107
+ continue;
108
+ const dir = path.join(root, entry.name);
109
+ const skillFile = path.join(dir, "SKILL.md");
110
+ if (!fs.existsSync(skillFile))
111
+ continue;
112
+ const markdown = fs
113
+ .readFileSync(skillFile, "utf8")
114
+ .replace(/^\uFEFF/, "")
115
+ .replace(/\r\n/g, "\n");
116
+ const frontmatter = markdown.match(/^---\n([\s\S]*?)\n---/)?.[1] ?? "";
117
+ skills.push({ ...readFrontmatter(frontmatter, entry.name), dir });
118
+ }
119
+ // Codepoint order, not localeCompare: the result is compared across
120
+ // platforms and must not depend on the runtime's locale.
121
+ return skills.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
122
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/skills",
3
3
  "description": "Agent skills for Malloy and the Malloy Publisher",
4
- "version": "0.1.63",
4
+ "version": "0.1.65",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -46,6 +46,9 @@
46
46
  "format": "bunx prettier --write --parser typescript '{src,scripts}/**/*.ts'",
47
47
  "test": "bun run copy-skills && bun test ./src"
48
48
  },
49
+ "dependencies": {
50
+ "yaml": "^2.9.1"
51
+ },
49
52
  "devDependencies": {
50
53
  "@eslint/js": "^8.57.0",
51
54
  "@types/bun": "^1.2.21",
@@ -53,6 +56,7 @@
53
56
  "@typescript-eslint/eslint-plugin": "^8.16.0",
54
57
  "@typescript-eslint/parser": "^8.16.0",
55
58
  "eslint": "^8.50.0",
59
+ "ignore": "^7.0.16",
56
60
  "typescript": "^5.3.3"
57
61
  }
58
62
  }
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: eval-answer
3
3
  description: 'Score one analytical answer against a verified golden, and score which of the entities the golden depends on retrieval delivered to the answerer. Run the contamination checklist, re-execute the submitted query yourself, then spawn a judge subagent per skill:eval-judge. Append attempt, tool_call, score, and retrieval_score events to the file ledger (reference/ledger-schema.md). Never explain the failure (eval-diagnose) or edit the model (eval-improve). Use when asked whether an answer was correct, to score a run, or to baseline a model.'
4
- version: 0.1.63
4
+ version: 0.1.65
5
5
  ---
6
6
 
7
7
  # Evaluate One Answer
@@ -260,7 +260,7 @@ otherwise a modelling agent is dispatched to fix a model that is already right.
260
260
 
261
261
  Append to `<workdir>/runs/<runId>/events.jsonl` with `caseId` set (the run
262
262
  directory `eval.py run` printed; the workdir is the set's, from `eval.toml`). Shapes
263
- live in `reference/ledger-schema.md`.
263
+ live in `reference/ledger-schema-events.md`.
264
264
 
265
265
  1. `attempt`: qid, sample, phase, question_sha, submitted, final_query,
266
266
  served revision, call counts, contamination verdict, transcript path.
@@ -0,0 +1,239 @@
1
+ ## Events
2
+
3
+ Every line in `events.jsonl` is **flat**: `{ "kind": ..., <fields> }`, one
4
+ JSON object per line, with an optional `at` ISO timestamp. Case-scoped kinds
5
+ (`attempt`, `tool_call`, `score`) carry `qid`, `sample`, `phase` on the line;
6
+ run-level kinds do not. (An earlier draft of this document nested fields under
7
+ a `payload` with a `caseId`; no writer ever did that, and 23 run directories
8
+ exist in the flat shape, so the flat shape is the contract.) `kind` is one of:
9
+ `attempt`, `tool_call`, `score`, `retrieval_score`, `issue`, `issue_status`,
10
+ `candidate`, `acceptance_check`, `checkpoint`.
11
+
12
+ ### `attempt`
13
+
14
+ | Field | Type | Notes |
15
+ |---|---|---|
16
+ | `qid` | string | |
17
+ | `sample` | int or null | Which repeat. Required even when null. |
18
+ | `phase` | string | `baseline` / `loop` / `blind_gate` / `canary` / `final`. `phase` lives here, on the attempt, not in run config. |
19
+ | `question_sha` | string | Hash of the exact text the answerer saw, so two runs can be compared on whether they asked the same thing. A case may carry `questionSha`, the seal stamped at conversion, and that wins when present; the ecommerce set writes a 16-char prefix of it, and a set without one left this null. Neither form proves the question was not edited, since both follow the case as it now reads: that comparison is check 6 of `verify_goldens.py`. |
20
+ | `submitted` | bool | False when there was no final query. Not a wrong answer. |
21
+ | `final_query` | string or null | Required to replay. A named view is recorded as the Malloy it stands for, `run: <source> -> <view>`, so every consumer sees one shape and the query re-executes. |
22
+ | `final_query_source` | string or null | How `final_query` was chosen: `declared` (the answer printed it), `last_ok` (the last call the server answered) or `last`. `last` is a warning: a trailing sanity probe may be standing in for the answer's own query. |
23
+ | `final_givens` | object or null | The `givens` (Publisher runtime parameters, `{name: value}`) the call behind `final_query` was sent with. A query written against a given returns unfiltered rows when re-run without it. Null when the call passed none. |
24
+ | `servedRevision` | string or null | From the package actually queried. |
25
+ | `n_get_context` / `n_execute` / `n_execute_errors` | int | |
26
+ | `host_tool_uses` | int | EVERY tool use the host logged, MCP calls included. It counted only the non-MCP ones until 2026-09-03, which made the under-report check below true of almost every clean attempt. |
27
+ | `mcp_tool_uses` | int or null | The MCP subset: `get_context` plus `execute_query`. Null on a run written before the split. |
28
+ | `reported_calls` | int | MCP calls the answerer claimed. `reported_calls > host_tool_uses` is the under-report floor from `skill:eval-answer`: the answerer cannot have made more calls than the host logged. `validate_run` warns on it, and only for runs that carry `mcp_tool_uses`, because the field meant something narrower before. |
29
+ | `contaminated` | bool or `"unknown"` | `"unknown"` when no host log exists. Read it with `ledger.is_contaminated`, never for truthiness: runs written before 2026-09-03 carry the strings `"true"`/`"false"`, and `bool("false")` is True. `ledger.event` now rejects those strings on write; `validate_run` grandfathers them on read as a warning. |
30
+ | `contamination_reasons` | list | Empty when clean. |
31
+ | `input_tokens` / `output_tokens` / `cache_read_tokens` / `cache_write_tokens` | int or null | Answerer token usage, the four counts that reprice a run from its own ledger. Null when the host does not report it. `cost_usd` beside them comes from the CLI's `total_cost_usd`, which prices cache reads and writes at their rates, so it was always cache-inclusive; what was missing was the breakdown that reproduces it. `cache_write_tokens` (`cache_creation_input_tokens` upstream) was never captured before 2026-09-15, and on one analysed run cache writes were 44% of the agent's cost, the single largest line. **Read `input_tokens` with care:** it counts only the tokens after the last cache breakpoint. One run recorded 224 for 24 questions beside 2.4M cache reads; the 224 is not the context volume, and a token total that omits the cache columns is not a size. |
32
+ | `cost_usd` | float or null | Answerer cost for this attempt. |
33
+ | `num_turns` / `wall_seconds` | int, float or null | |
34
+ | `answer_text` | string or null | The answer the judge scored. Kept so a verdict can be re-read without the transcript. |
35
+ | `skills_invoked` | list of string | The skills the answerer invoked through the `Skill` tool, deduplicated and sorted, counted from its own transcript. Always a list on a run that recorded it, so an EMPTY list is the finding: the arm granted a manifest and the agent reached for none of it. Absent on runs written before 2026-09-15, which is why every reader takes `or []`. Only explicit `Skill` calls are counted, and only skills the arm granted -- one outside `--answerer-skills` is a contamination breach and lands in `contamination_reasons` instead. What it is for: a manifest names what an arm GRANTED, and comparing two arms' doctrine is meaningless if the doctrine never loaded. |
36
+ | `transcriptPath` | string | The answerer's transcript under `artifacts/`. |
37
+
38
+ Token counts sit here rather than being derived later because the claim a
39
+ semantic model makes is about cost as well as correctness -- that a documented
40
+ model reaches a good answer in fewer turns and tokens than working from raw
41
+ schema. A ledger that counts calls but not tokens can state half of that.
42
+
43
+ ### `tool_call`
44
+
45
+ One event per MCP `get_context` or `execute_query` the attempt made.
46
+
47
+ | Field | Type | Notes |
48
+ |---|---|---|
49
+ | `tool` | string | `get_context` or `execute_query`. |
50
+ | `traceId` | string or null | `get_context` only; look up in your host's trace store. |
51
+ | `targets` | string, list or null | **What the answerer asked for**: the search terms it sent to `get_context`. Null for `execute_query`. |
52
+ | `rankedSummary` | object | Copied at capture so evidence survives trace eviction: `entityIds` (identity, in response order), `hits` (one row per entity: `entity_id`, `source`, `relevance`, `matched_targets`, `position`, `position_in_source`), `resultCount`, `docTokens`. **There is no rank.** This field previously documented `ranks` and "per-target `targets` with within-target ranks"; no writer ever wrote either, and what `ranks` did hold was `range(1, n+1)` over a list already flattened source-card by source-card -- a position, not a rank, and not even a relevance order, since the response sorts globally and then buckets into cards. Ask relevance questions of `hits[].relevance`. |
53
+ | `rankedSummary.hits[].matched_targets` | list or null | Which of the caller's search targets matched this entity, each with the server's own relevance. **`null` means no attribution was published**, which is not the same as `[]`: the server attaches it to entities only (a source card's attribution is discarded before an entity object exists) and only on the semantic path, because a lexical score is relative to its own query and comparing two of them means nothing. A lexical run therefore cannot say which target found what, and a reader must report that as unavailable rather than as "never asked". |
54
+ | `retrieval_mode` | string or null | `get_context` only: the `retrieval` field of the response that answered, `semantic` or `lexical`. Null when the server named none, which means no embedding provider. Recorded per call because the semantic path can fall over partway through a run. |
55
+ | `query` | string or null | `execute_query` only: the Malloy the call sent, so the final query can be chosen by which call the server actually answered. |
56
+ | `modelPath` | string or null | `execute_query` only: the model file the call named. A source does not resolve outside the file that declares it, so re-execution needs this. |
57
+ | `givens` | object or null | `execute_query` only: the `{name: value}` runtime parameters the call was sent with. Part of the same fact as `query` and `modelPath`: the text alone, re-run without them, returns a different population. |
58
+ | `filterParams` | object or null | `execute_query` only: values for the model's legacy `#(filter)` source filters, a separate mechanism from `givens`. The harness captures `givens`; this stays allowed for records that carry it. |
59
+ | `error` | string or null | |
60
+
61
+ Never persist `execute_query` result rows or credentials. `givens` are recorded because they decide what the query means; they are filter values, not secrets, so do not put a credential in one.
62
+
63
+ `targets` records the request; `rankedSummary` records the response. Without
64
+ both, a low per-attempt recall has two readings that cannot be told apart: the
65
+ answerer searched for the wrong thing, or it searched well and retrieval ranked
66
+ the right entity too low. Those have opposite owners -- `agent-skill` and
67
+ `retrieval` -- so a ledger holding only the response cannot attribute the
68
+ failure, and any recall computed from it is a blend of answerer behaviour and
69
+ retrieval quality.
70
+
71
+ That blend is also why per-attempt recall is **not** comparable across arms: a
72
+ stronger answerer searches better and scores higher retrieval recall without
73
+ retrieval having changed. Use it for attribution within an arm. Comparing
74
+ retrieval itself between engine versions is `eval-retrieval`'s job, with fixed
75
+ terms, and is not something a customer run reports.
76
+
77
+ ### `score`
78
+
79
+ The answer judge's verdict for one attempt (protocol in
80
+ `skill:eval-judge`). Every attempt in a scored run gets exactly one.
81
+
82
+ | Field | Type | Notes |
83
+ |---|---|---|
84
+ | `verdict` | string or null | `match` / `near_match` / `no_match` / `needs_human`; null when the attempt is not scorable. Only `match` and `no_match` are decisions; see below. |
85
+ | `reason` | string | Why, from the judge; for a null verdict, why not scorable, and it is ALWAYS one of these: `not_submitted`, `answerer_truncated`, `contaminated`, `judge_unparseable`, `no_saved_verdict`, `judge_error: <text>`, or `golden_<status>` -- `golden_missing`, `golden_provisional`, `golden_invalid`, `golden_ambiguous`, `golden_verified_wrong`. A null verdict never arrives without one: a nulling that does not say which of these it was is indistinguishable from the field being dropped on the write path, and was read as exactly that from a real run. The `golden_*` reasons and `answerer_truncated` are decided before the judge is called, so neither an unestablished key nor a cut-off attempt costs a judge call. |
86
+ | `confidence` | int or null | 1 to 10. Confidence of 5 or lower forces `needs_human`. |
87
+ | `column_pairing` | object or null | The judge's named gold-to-prediction column correspondence. |
88
+ | `judge_version` / `rubric_sha` | string | Pins which rubric produced this verdict. |
89
+ | `golden_revision` | int | From the case at score time. |
90
+ | `contaminated` | bool or `"unknown"` | Copied from the attempt; true or unknown means `verdict: null`. |
91
+ | `must_not_use_hits` | list or null | Entries of `golden.mustNotUse` a script found in the final query. A hit forces `verdict: no_match`. Decided by `check_must_not_use.py`, never by the judge: it is a question about query text. Only a BARE name vetoes; an entry with a connective (`X as ...`, `X through ...`) objects to a use of X rather than to X, and goes to the judge with the prose entries and a path's bare leaf. |
92
+ | `judge_verdict` | string or null | What the judge said when a MECHANICAL override replaced it: a `must_not_use_hits` veto, or contamination voiding the verdict. Null otherwise, so the judge's own agreement rate stays measurable across both. When a case is vetoed AND contaminated this still holds the judge's read, not the veto's `no_match`. |
93
+ | `artifactPath` | string | The full judge output under `artifacts/`. |
94
+ | `gold_status` | string | `verified` / `verified_benign` / `suspect` / `verified_wrong`, and never anything else: the case file's `golden.status` is a DIFFERENT vocabulary that shares only `verified` and `verified_wrong`, and only those two fall back into this field. A `provisional` / `invalid` / `ambiguous` key is reported through the verdict's `reason` (`golden_<status>`) instead, so nothing downstream has to match on two vocabularies in one field. **From the judge**, which scored against the golden as written and reports separately whether it believes it; falls back to the case's standing `golden.status` when the judge does not say, written onto the verdict itself so the run summary and the aggregates see it too. `verified_wrong` excludes the case from run aggregates -- from the judge OR from the case file; assigning the fallback into a copy of the verdict meant a key the set had marked wrong stayed in the aggregates unless the judge independently agreed. `suspect` and `verified_wrong` route to the golden side door as `dataset` issues, never to improve. |
95
+ | `gold_note` | string or null | The judge's evidence for a non-`verified` status: the two values, or the model line against the rubric sentence. Null when `verified`. |
96
+
97
+ A `golden_*` reason means the ANSWER KEY is not something a verdict can be
98
+ issued against. A golden the set stamps `provisional`, `invalid` or `ambiguous`
99
+ is refused, as is a case with no golden at all and one the set marks
100
+ `verified_wrong`; a golden with NO `status` is unguarded rather than
101
+ unscorable, because sets that predate the field would otherwise score zero of
102
+ zero. A golden holding no value is not refused either: that is how a
103
+ `kind: unanswerable` case and a `kind: criteria` golden are written. This
104
+ matters most for an imported set, because `skill:eval-import` stamps
105
+ `provisional` on every golden it writes and enforces it -- so a set is
106
+ unscorable by construction until its keys are re-derived, and `run_baseline`
107
+ refuses to spend at all when every case in a set is in that state.
108
+
109
+ `not_submitted` means the attempt produced NOTHING to judge: no answer text and
110
+ no query. An attempt that wrote prose without querying **is judged**, and
111
+ against a golden that holds a value an answer containing none of it is
112
+ `no_match` (`skill:eval-judge`, `reference/refusal.md` rule 10). Excusing those
113
+ as unscorable dropped a confident refusal on an answerable case out of the pass
114
+ rate, which is the one thing the answerable-sounds-unanswerable cases exist to
115
+ measure. A refusal is exempt only where `golden.kind` is `unanswerable`, and
116
+ there naming the gap is the pass and a confident number is the fail.
117
+
118
+ `answerer_truncated` means the answerer hit the run's `maxTurns` cap and the
119
+ CLI returned whatever it had, which is usually a sentence stopping mid-thought.
120
+ It is refused BEFORE the golden gate and before a saved verdict is reused, so
121
+ `--rebuild` over a run made without this re-derives the right ledger from its
122
+ transcripts. A cap is a harness setting, so a case cut off by one says nothing
123
+ about whether the model could answer it: measured on one 29-case arm, four
124
+ attempts ended at exactly 31 turns and each was judged as a wrong answer, one
125
+ of them on the text "Let me build the correct monthly trend query."
126
+
127
+ `contaminated` means the attempt breached isolation (`contamination_reasons`
128
+ names how) and the verdict is withheld rather than lost. The judge's own read
129
+ moves to `judge_verdict`. Before this reason was written, a voided verdict kept
130
+ the judge's prose in `reason` beside `verdict: null`, and a run report
131
+ reasonably concluded the ledger was dropping the field -- it recovered nine
132
+ "lost" verdicts by re-parsing the stored judge replies, every one of which had
133
+ been voided on purpose.
134
+
135
+ Both are HARNESS-owned, not model-owned, and a run containing either reports
136
+ `status: incomplete` in `run.json` and **prints no pass rate**. `unscorable`
137
+ (no established golden) and `judge_unparseable` do not suppress the rate: the
138
+ first is a dataset state no arm can fix, and the second already has a retry.
139
+
140
+ Aggregates count decided verdicts only. `match` and `no_match` are the pass and
141
+ the fail; **`near_match`, `needs_human` and null are none of the above** and stay
142
+ out of acceptance arithmetic. `near_match` is excluded because it means "defensibly
143
+ different", and an arguable verdict that moves a pass rate is a measurement
144
+ artefact rather than a result (`skill:eval-judge` rule 7). Report its count:
145
+ it rising is how a set tells you its rubrics are going vague.
146
+
147
+ This applies to `score`. On `retrieval_score` below, `near_match` **is** counted
148
+ towards recall and precision, because an overlapping entity is a genuine
149
+ retrieval success. The two are different questions that share a word.
150
+
151
+ ### `retrieval_score` (written by `eval-retrieval`, not by a customer run)
152
+
153
+ One per term judged in a fixed-term replay (run-level; no `caseId`).
154
+
155
+ | Field | Type | Notes |
156
+ |---|---|---|
157
+ | `intentId` / `term` / `entityType` | string | From the term file. |
158
+ | `in_scope` | bool | Does THIS model version represent the concept? False is a coverage gap, not a retrieval failure. |
159
+ | `judgments` | list | Per returned entity: `entityId`, `rank`, `level` (`match` / `near_match` / `no_match`), `confidence`, `why`. Empty when nothing returned. |
160
+ | `judge_version` / `rubric_sha` | string | |
161
+ | `traceId` | string or null | The `get_context` call judged. |
162
+
163
+ Run-level metrics fall out by counting:
164
+
165
+ - `coverage` = in-scope terms / valid terms -- a property of the model and its
166
+ data, reported on its own, never as a retrieval number.
167
+ - `recall` (on in-scope terms) = fraction whose judgments contain a `match`.
168
+ - `precision@N` = `match` judgments / judged, with N stated.
169
+
170
+ ### `issue`
171
+
172
+ | Field | Type | Notes |
173
+ |---|---|---|
174
+ | `issue_id` | string | Stable across status events. |
175
+ | `qids` | list | Affected cases. |
176
+ | `primary_code` / `contributing_codes` | string / list | From `skill:eval-diagnose`, verbatim. An event written before the codes were renamed may carry a retired one: `COVERAGE` is now `MISSING`, `NO-DISAMBIG` is `AMBIGUOUS`, and `CONVENTION` is `RULE_UNWRITTEN`. Read those as the new name; nothing rewrites old events. |
177
+ | `component` | string | `dataset` / `agent-call` / `get_context/model` / `get_context/retrieval` / `construction` / `model-definition`. |
178
+ | `owner` | string | `model` / `retrieval` / `agent-skill` / `dataset`. Environment failures stop the run; they are never diagnosed, so there is no environment owner. |
179
+ | `severity` / `confidence` | string | |
180
+ | `sufficiency` | string | `sufficient` / `insufficient` / `unknown`. |
181
+ | `traceIds` | list | |
182
+ | `diagnosis` | string | Written before any edit exists. |
183
+
184
+ ### `issue_status`
185
+
186
+ `issue_id` plus `status`: `open` / `batched` / `fixed` / `rejected` /
187
+ `deferred`. Readers take the latest event for that `issue_id`. Do not invent
188
+ a status column.
189
+
190
+ ### `candidate`
191
+
192
+ Written by `eval-improve`, for every proposed edit, accepted or not. A
193
+ rejected direction keeps its record.
194
+
195
+ | Field | Notes |
196
+ |---|---|
197
+ | `issue_ids` | |
198
+ | `files` | Paths the edit touched. |
199
+ | `diffSummary` | One line per file. |
200
+ | `probes` | Query and result for each factual claim. May be empty for a `class: skill` candidate that asserts nothing about the data: a guide making no factual claim has nothing to probe. Empty is not a missing receipt there; a guide that DOES quote a number still needs one. |
201
+ | `meaningChanged` | Entities whose *meaning* the edit changed; `[]` for a docs-only edit. |
202
+ | `goldenSuspect` | Each `{qid, entity, stored, rederived}`: a golden this edit may have invalidated. Reported by the improver, never repaired by it. **Non-empty halts the acceptance check** until adjudicated through the golden side door. |
203
+ | `goldenAudit` | The set's `verify_goldens.py` run against the edited model: `{ran, clean, model, tail}`. Catches drift and rubric-vs-model contradictions only; a golden whose value silently moved is invisible to it, which is why `goldenSuspect` exists alongside. |
204
+
205
+ ### `acceptance_check`
206
+
207
+ Called `gate` before 2026-09-03. `ledger.py` reads the old kind as this one, so
208
+ run directories written earlier still validate and nothing rewrites them.
209
+
210
+ Written by `eval-loop`, one per acceptance check decision, BEFORE any checkpoint commit.
211
+
212
+ | Field | Notes |
213
+ |---|---|
214
+ | `issue_ids` | |
215
+ | `decision` | `accepted` / `rejected`. |
216
+ | `class` | `docs` / `definition` / `skill` / `retrieval` / `justified`. `skill` is an edit to a package skill in the package's `default` skill set; it never takes the documentation shortcut in the acceptance check. |
217
+ | `baselineRunId` / `finalRunIds` | Plural: acceptance needs two independent runs. |
218
+ | `regressions` | Case ids whose verdict got worse vs baseline. Must be empty to accept. |
219
+ | `holdoutDelta` | Confident-verdict delta on the holdout slice. |
220
+ | `reason` | Including independent deterministic justification when that is the basis. |
221
+
222
+ ### `checkpoint`
223
+
224
+ Written by `eval-loop` after an accepted acceptance check, or when a restore runs. The
225
+ model bytes live in git, not in this payload.
226
+
227
+ | Field | Notes |
228
+ |---|---|
229
+ | `action` | `created` / `restored`. |
230
+ | `label` | |
231
+ | `modelGitSha` | The commit this checkpoint names (create), or the commit restored to. |
232
+ | `issueIds` | Issues the accepted edit closed. Empty on restore. |
233
+
234
+ ## `judge-regressions.jsonl`
235
+
236
+ Append a line whenever a human overrules a judge verdict: the case or intent,
237
+ the judge's verdict, the human's, and why. Re-run this file against the judge
238
+ whenever `skill:eval-judge` or the judge model changes; a rubric change that
239
+ flips old human-settled verdicts is a judge regression, not new truth.