@malloy-publisher/skills 0.1.62 → 0.1.64

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 (58) hide show
  1. package/package.json +1 -1
  2. package/skills/eval-answer/SKILL.md +1 -1
  3. package/skills/eval-answer/scripts/check_findable.py +3 -3
  4. package/skills/eval-answer/scripts/check_findable_test.py +4 -2
  5. package/skills/eval-diagnose/SKILL.md +1 -1
  6. package/skills/eval-import/SKILL.md +1 -1
  7. package/skills/eval-improve/SKILL.md +1 -1
  8. package/skills/eval-improve/scripts/improve.py +5 -4
  9. package/skills/eval-judge/SKILL.md +1 -1
  10. package/skills/eval-loop/SKILL.md +1 -1
  11. package/skills/eval-loop/reference/running-a-run.md +1 -1
  12. package/skills/eval-loop/reference/setting-up-a-set.md +1 -1
  13. package/skills/eval-loop/scripts/agent_harness_test.py +3 -3
  14. package/skills/eval-loop/scripts/build_run_package.py +1 -1
  15. package/skills/eval-loop/scripts/run_baseline.py +3 -3
  16. package/skills/eval-loop/templates/eval-run-package/README.md +2 -2
  17. package/skills/eval-report/SKILL.md +1 -1
  18. package/skills/malloy-analysis/SKILL.md +2 -2
  19. package/skills/malloy-analysis-report/SKILL.md +1 -1
  20. package/skills/malloy-charts/SKILL.md +1 -1
  21. package/skills/malloy-classify/SKILL.md +1 -1
  22. package/skills/malloy-compliance-review/SKILL.md +1 -1
  23. package/skills/malloy-dashboards/SKILL.md +1 -1
  24. package/skills/malloy-define/SKILL.md +1 -1
  25. package/skills/malloy-define-agent/SKILL.md +1 -1
  26. package/skills/malloy-discover/SKILL.md +1 -1
  27. package/skills/malloy-document/SKILL.md +1 -1
  28. package/skills/malloy-excel-review/SKILL.md +1 -1
  29. package/skills/malloy-excel-review/reference/cookbook-scenario.md +17 -16
  30. package/skills/malloy-excel-review/reference/parity.md +2 -2
  31. package/skills/malloy-excel-review/reference/translate-formulas.md +2 -2
  32. package/skills/malloy-getting-started/SKILL.md +4 -4
  33. package/skills/malloy-gotchas-modeling/SKILL.md +1 -1
  34. package/skills/malloy-html-data-apps/SKILL.md +4 -4
  35. package/skills/malloy-html-data-apps/reference/app-frame.md +6 -4
  36. package/skills/malloy-html-data-apps/reference/depth-patterns.md +1 -1
  37. package/skills/malloy-lookml-review/SKILL.md +1 -1
  38. package/skills/malloy-materialization/SKILL.md +108 -75
  39. package/skills/malloy-materialization/reference/access-filter.md +8 -9
  40. package/skills/malloy-materialization/reference/annotation.md +32 -30
  41. package/skills/malloy-materialization/reference/chaining.md +35 -19
  42. package/skills/malloy-materialization/reference/estimating.md +117 -0
  43. package/skills/malloy-materialization/reference/policy.md +3 -3
  44. package/skills/malloy-materialization/reference/refresh.md +8 -10
  45. package/skills/malloy-materialization/reference/storage.md +40 -19
  46. package/skills/malloy-materialization/reference/tuning.md +15 -13
  47. package/skills/malloy-model/SKILL.md +4 -3
  48. package/skills/malloy-model-as-you-go/SKILL.md +1 -1
  49. package/skills/malloy-modeling/SKILL.md +4 -1
  50. package/skills/malloy-notebooks/SKILL.md +1 -1
  51. package/skills/malloy-phrase-detection/SKILL.md +1 -1
  52. package/skills/malloy-powerbi-review/SKILL.md +1 -1
  53. package/skills/malloy-publish/SKILL.md +6 -5
  54. package/skills/malloy-queries/SKILL.md +24 -1
  55. package/skills/malloy-reports/SKILL.md +1 -1
  56. package/skills/malloy-review/SKILL.md +1 -1
  57. package/skills/malloy-run-agent/SKILL.md +1 -1
  58. package/skills/malloy-source-unreachable/SKILL.md +4 -1
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.62",
4
+ "version": "0.1.64",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -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.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  # Evaluate One Answer
@@ -277,9 +277,9 @@ def index_message(index: dict[str, Any] | None, wait: int) -> str | None:
277
277
  "an answer. Re-run once it has cleared"
278
278
  + (f" ({detail})" if detail else ""))
279
279
  if reason == "too-many-entities":
280
- return ("! this package is over the embedding entity cap, so it "
281
- "will never be indexed. Raise retrieval.indexing."
282
- "maxEntities, or split the package")
280
+ return ("! this package is over an older Publisher's embedding "
281
+ "entity cap, so it will never be indexed there. Upgrade "
282
+ "Publisher: current releases have no entity cap")
283
283
  return (f"! the embedding index is in error (reason: "
284
284
  f"{reason or 'unknown'}): {detail or 'no message given'}")
285
285
  return (f"! the embedding index reported an unknown status {status!r}; "
@@ -503,10 +503,12 @@ class IndexWait(unittest.TestCase):
503
503
  self.assertIn("Re-run", msg)
504
504
  self.assertIn("429 from provider", msg)
505
505
 
506
- def test_too_many_entities_names_the_setting_to_raise(self):
506
+ def test_too_many_entities_says_to_upgrade(self):
507
+ # Only an older server sends it; the setting it named is removed.
507
508
  msg = check_findable.index_message(
508
509
  {"status": "error", "reason": "too-many-entities"}, 300)
509
- self.assertIn("retrieval.indexing.maxEntities", msg)
510
+ self.assertIn("Upgrade Publisher", msg)
511
+ self.assertNotIn("maxEntities", msg)
510
512
  self.assertNotIn("Re-run", msg)
511
513
 
512
514
  def test_any_other_error_shows_the_reason_and_the_server_message(self):
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: eval-diagnose
3
3
  description: 'Diagnose why a scored answer failed and who owns the fix, then cluster the failures by shared root cause. Walk dataset, agent-call, get_context/model, get_context/retrieval, construction, then model-definition. Append issue events to the file ledger, linked by traceId, one per cluster. Use after eval-answer, when triaging a run, or before changing a model. Does not edit the model (eval-improve).'
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  # Diagnose One Answer
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: eval-import
3
3
  description: 'Turn a list of questions into an eval set, whatever shape it arrived in: a JSONL a customer sent, a CSV, a spreadsheet export, a markdown doc, an email thread, or a pull from production logs. Classify each item by what came WITH the question (a query, a number, prose criteria, or nothing), write cases.jsonl and set.json per reference/case-format.md, keep the file as it arrived, and seal each question so a later edit is detectable. Never marks a value-bearing golden verified and never invents a question. Use when questions arrive from outside and need to become a set, or before the first run against a set nobody here authored.'
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  # Import questions into an eval set
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: eval-improve
3
3
  description: 'Make the smallest safe edit that closes a diagnosed gap the model repo owns: a Malloy model edit, or a package skill under skills/. Every factual claim carries a probe receipt. Use after eval-diagnose, or when asked to fix a model so an agent can discover the right answer. Never accepts its own edit; the acceptance check belongs to eval-loop. Does not decide whether an answer was wrong (eval-answer) or why (eval-diagnose).'
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  # Improve the Model
@@ -46,7 +46,8 @@ quietly tests the old model. `--watch-mode` says Publisher was started with
46
46
  `--watch-env` (`eval.py serve model --set <set> --watch-env <env>`), which symlinks
47
47
  local-dir packages in place and makes edits live; then the helper is just a
48
48
  reload. Without it the helper syncs the edit onto the served copy first, which
49
- works only on a server with versioning off. Either way a package the server
49
+ works only on an older server with versioning off (current releases always
50
+ serve published versions, so use watch mode). Either way a package the server
50
51
  serves as a published version is refused before any agent starts (the server
51
52
  is asked, in both modes): nothing synced there is served, the sync would
52
53
  delete it, and a reload of it answers 200 without reading the edit. Either way
@@ -146,7 +147,7 @@ def served_as_versions(served: pathlib.Path) -> bool:
146
147
  """Whether Publisher serves this package folder as published versions.
147
148
 
148
149
  A version lives in `<pkg>/<version>/`, so the folder holds no
149
- publisher.json of its own. A copy (versioning off) does, and a watch
150
+ publisher.json of its own. A copy (an older server with versioning off) does, and a watch
150
151
  mount is a symlink to the source.
151
152
  """
152
153
  return (served.is_dir() and not served.is_symlink()
@@ -424,8 +425,8 @@ def main(argv: list[str] | None = None) -> int:
424
425
  help="Publisher SERVER_ROOT; only needed without watch "
425
426
  "mode. Each accepted edit is rsynced onto the copy "
426
427
  "this root serves and reloaded, which works only "
427
- "with versioning off: a root serving published "
428
- "versions is refused. Default: the one "
428
+ "on an older server with versioning off: a root "
429
+ "serving published versions is refused. Default: the one "
429
430
  "`serve.py --role model` uses, when it exists")
430
431
  ap.add_argument("--watch-mode", action="store_true",
431
432
  help="Publisher was started with --watch-env, so edits are "
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: eval-judge
3
3
  description: 'Decide whether ONE answer matches its golden, and say whether you believe the golden. Read this before emitting any verdict. Covers containment, column pairing, near_match, refusals, and the gold_status judgement. Use when scoring an attempt in an evaluation run; never to conduct a run (eval-loop), diagnose a failure (eval-diagnose) or edit a model (eval-improve).'
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  # The judge
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: eval-loop
3
3
  description: 'Conduct a local Publisher evaluation loop in five steps: scrape/run, eval, diagnose, improve, checkpoint. You are the conductor: import cases into the file ledger, spawn a blind answerer, then run eval-answer, eval-diagnose, and eval-improve. Persistence is plain files: the set in the model package''s evals/ directory, runs in the set''s workdir; checkpoints are git commits of the model repo. `eval.py` runs each step from the set''s eval.toml. Use to score a model, diagnose failures, improve behind an acceptance check, or roll back a bad direction.'
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  # The Evaluation Loop
@@ -52,7 +52,7 @@ eval.py check --set <set>
52
52
  # if it does not reach `ready`: while the index builds, get_context returns
53
53
  # `retrieval: "indexing"` with no sources, so without the wait the first
54
54
  # cases would record empty answers as retrieval misses.
55
- # Semantic retrieval needs EMBEDDING_API_KEY in the server's environment
55
+ # Semantic retrieval needs PUBLISHER_RETRIEVAL_EMBEDDING_API_KEY in the server's environment
56
56
  # (the Publisher does not read OPENAI_API_KEY). The script warns when it is
57
57
  # unset; without it the status is `lexical` and every ranking is lexical.
58
58
  # A key the provider rejects shows as status `error`; the warm-up prints
@@ -18,7 +18,7 @@ ready when it prints `ready: nothing blocks a run`.
18
18
  - A built Publisher clone (`bun install && bun run build`; Bun is needed only
19
19
  to build, the scripts run it with Node), Python 3.11+, and a Java runtime for
20
20
  the SDK build.
21
- - `EMBEDDING_API_KEY` exported, for semantic retrieval. Without it the model
21
+ - `PUBLISHER_RETRIEVAL_EMBEDDING_API_KEY` exported, for semantic retrieval. Without it the model
22
22
  server ranks lexically and says so on start.
23
23
 
24
24
  ## 1. Make the set directory
@@ -311,7 +311,7 @@ class RetrievalGate(unittest.TestCase):
311
311
  def test_an_error_result_is_refused_not_retried(self):
312
312
  # Each reason names itself and its remedy, and the second reply in the
313
313
  # script is never read: a retry would raise StopIteration.
314
- remedy = {"too-many-entities": "retrieval.indexing.maxEntities",
314
+ remedy = {"too-many-entities": "Upgrade Publisher",
315
315
  "cooldown": "Wait, then re-run",
316
316
  "provider-error": "provider settings",
317
317
  "unavailable": "Publisher log"}
@@ -326,7 +326,7 @@ class RetrievalGate(unittest.TestCase):
326
326
  ready, said = self.gate([("indexing", "1/10"),
327
327
  ("error", "too-many-entities")])
328
328
  self.assertFalse(ready)
329
- self.assertIn("maxEntities", said)
329
+ self.assertIn("Upgrade Publisher", said)
330
330
 
331
331
  def test_an_unknown_retrieval_value_is_refused(self):
332
332
  # An old server that still answered "lexical" with a provider
@@ -450,7 +450,7 @@ class TheRetrievalGateIsWired(unittest.TestCase):
450
450
  rb.run_retrieval_gate(self.ns(probe_payload={
451
451
  "retrieval": "error",
452
452
  "retrieval_reason": "too-many-entities"}))
453
- self.assertIn("retrieval.indexing.maxEntities", str(cm.exception))
453
+ self.assertIn("Upgrade Publisher", str(cm.exception))
454
454
 
455
455
 
456
456
  class RetrievalOf(unittest.TestCase):
@@ -630,7 +630,7 @@ def register(base: str, env: str, out: pathlib.Path) -> str | None:
630
630
 
631
631
  A POST publishes the build as the version stamp_version gave it, so a
632
632
  rebuilt report becomes the package's `latest` and replaces the one it
633
- served; no delete is needed first. (A server with versioning off
633
+ served; no delete is needed first. (An older server with versioning off
634
634
  re-copies the package instead, to the same effect.)
635
635
  """
636
636
  body = json.dumps({"name": out.name, "location": str(out.resolve())}).encode()
@@ -875,9 +875,9 @@ RETRY_MODE = "indexing"
875
875
 
876
876
  # What to do about each `retrieval_reason` an error result can carry.
877
877
  ERROR_ADVICE = {
878
- "too-many-entities": ("the package has more entities than the index will "
879
- "embed. Raise retrieval.indexing.maxEntities in the "
880
- "Publisher config and restart it"),
878
+ "too-many-entities": ("the package has more entities than an older "
879
+ "Publisher will embed. Upgrade Publisher: current "
880
+ "releases have no entity cap"),
881
881
  "cooldown": ("the embedding provider failed and the package is waiting "
882
882
  "out a cool-down (about 60 seconds). Wait, then re-run"),
883
883
  "provider-error": ("the embedding provider rejected the request (often a "
@@ -127,7 +127,7 @@ again later. The
127
127
  rest of this section is for serving it on a Publisher of its own.
128
128
 
129
129
  ```bash
130
- publisher --server_root <parent-of-package> --mcp_port 4049
130
+ publisher --root <parent-of-package> --mcp-port 4049
131
131
  # app http://localhost:4000/environments/evals/packages/eval-run/index.html
132
132
  # notebook http://localhost:4000/evals/eval-run/notebooks/eval_run
133
133
  ```
@@ -155,7 +155,7 @@ which is the fastest way to see a compile failure. Reports are listed by
155
155
  as a model, so `models/notebooks/eval_run.malloy` shows its compile errors. To verify
156
156
  every tile, run each named query through `execute_query`.
157
157
 
158
- Pass `--mcp_port` explicitly. It defaults to 4040 and any other local Publisher
158
+ Pass `--mcp-port` explicitly. It defaults to 4040 and any other local Publisher
159
159
  already holds it; the server logs `Port 4040 in use` and carries on without an MCP
160
160
  endpoint, so the failure is quiet and only shows up later as a tool that isn't
161
161
  there. `PORT` / `--port` was ignored in the version tested here -- it bound 4000
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: eval-report
3
3
  description: 'Write the summary a person reads after an evaluation run: what ran, what it scored, which failures were the MODEL and which were the EVAL itself (out of turns, contaminated, unestablished golden, unreadable judge), what was learned, and what to do next. Every claim links to the artifact behind it. Use at the end of any run, before quoting a number to anyone. Never scores an answer (eval-answer) or decides who owns a failure (eval-diagnose).'
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  # Report a Run
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-analysis
3
3
  description: "Read before your first get_context call on any business or data question. The required workflow, not background: which source, which rows, how to verify. Skipping it causes confident wrong answers."
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  <!-- Copyright (c) Credible Data Inc. SPDX-License-Identifier: MIT -->
@@ -119,6 +119,6 @@ Answer in plain language, lead with the number that was asked for, and show the
119
119
 
120
120
  **A table in your answer uses the result's own columns and values.** Show the rows that carry the finding, and add no column the query didn't return: a rank, a share or a difference you work out by hand is a number nothing checked. When a derived figure matters, compute it in the query and show that.
121
121
 
122
- **A list says whether it is complete.** When you list what exists (packages, sources, fields, values), list all of it or say it is a selection ("the 10 largest of 31"). When `get_context` reports N of M sources, never present the N as everything: pass a returned `next_offset` back as `offset` for the rest, or follow its warning (narrow the search, raise `limit`), or say how many more there are. Never estimate a count you can read off a result ("about 25"). Give counts in the unit the tool reported, and add no total it did not report unless asked; then count it from the list you give or compute it in a query.
122
+ **A list says whether it is complete.** When you list what exists (packages, sources, fields, values), list all of it or say it is a selection ("the 10 largest of 31"). When `get_context` reports N of M sources, never present the N as everything: follow its warning, which says how to reach the rest (pass back the offset it names, or narrow the search), or say how many more there are. Never estimate a count you can read off a result ("about 25"). Give counts in the unit the tool reported, and add no total it did not report unless asked; then count it from the list you give or compute it in a query.
123
123
 
124
124
  End with a short **Next steps**: one or two specific deeper analyses the data could support, concrete to what you just found. Keep it unless your host's instructions say it shows follow-up suggestions of its own, which then carry the next steps. If you can write package files, you can also offer to save the analysis as a report (`malloy-reports`, at the package root) so it can be re-run and shared: a grid for views read at a glance, linear for a story read top to bottom. If your host has a report tool of its own instead, offer that.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-analysis-report
3
3
  description: Combine validated Malloy queries into a report (a linear report, read top to bottom). Use when the user asks to "create a report", "combine these into a report", or wants a persistent multi-query artifact.
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  <!--
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-charts
3
3
  description: Read before choosing a chart or adding a chart annotation. Chart types, tag syntax and scale rules, KPI cards, dashboards, sparklines, and the renderer mistakes that fail silently.
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
  <!--
7
7
  Copyright (c) Credible Data Inc.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-classify
3
3
  description: 'Propose #(classification) annotations for a Malloy model from an access policy''s class scheme, backed by aggregate value evidence from the served data, and show them as a diff before writing anything. Use when the user asks to "classify the model", "tag PHI/PII", "label sensitive fields", or adds fields to a package that a policy governs, and before running malloy-compliance-review on a model nobody has classified.'
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  <!--
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-compliance-review
3
3
  description: 'Check a Malloy package and its controls against a written access policy: turn the policy''s prose into a control register, run compliance.py check against a served package (structure, access as each role, and the values themselves), judge what needs a person, and produce a report and a signable attestation. Use when the user asks whether a model "complies with", "satisfies" or "meets" a policy, HIPAA, SOC 2, PCI or the like, asks for a compliance review or attestation, or wants the review in CI.'
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  <!--
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-dashboards
3
3
  description: "Renamed to malloy-reports. A dashboard is now a report with layout=grid: a .malloy file with an ## artifact tag, written at the package root. Load malloy-reports instead when the user asks for a dashboard, a filterable view, or drill-through between views."
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  <!--
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-define
3
3
  description: Propose scope, a source plan and field definitions for a Malloy model. Which tables and questions, which sources at what grain, then renames, dimensions and measures, each backed by querying data.
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
  <!--
7
7
  Copyright (c) Credible Data Inc.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-define-agent
3
3
  description: Define a package agent - a named brief, with its own skills, optional schedules and a run budget, declared in a package's publisher.json. Use when the user asks to create, add, change or fix an agent in a package, or wants a recurring or unattended job. Not for adopting an agent that already exists (that is malloy-run-agent), and not for a one-off question, which you just answer.
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
  <!--
7
7
  Copyright (c) Credible Data Inc.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-discover
3
3
  description: Silent data discovery for Malloy modeling. Used at Step 1 of the modeling workflow. Scans tables, columns, distributions, and relationships without user interaction. The agent builds an internal picture before presenting anything.
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
  <!--
7
7
  Copyright (c) Credible Data Inc.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-document
3
3
  description: 'Add documentation with #(doc) tags to Malloy models so fields and sources are described in plain language. Use when user asks to "add documentation", "add doc tags", "document the model", or wants fields and sources described for natural-language search and discovery. For runtime filters, declare given: parameters (see the malloy-model skill); #(filter) is deprecated. Filters are a runtime/modeling construct (governance, latency, correctness), not a documentation tag.'
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
 
7
7
  <!--
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-excel-review
3
3
  description: Move an Excel workbook (.xlsx or .xlsm) onto Malloy - recover the model hiding in its cells, translate its formulas and pivots, and prove the numbers match against the values the file already stores. Use when a workbook is present, when a user wants to migrate or switch off a spreadsheet, and whenever a specific formula has to become Malloy - SUMIFS, COUNTIF, SUMPRODUCT, VLOOKUP, XLOOKUP, INDEX/MATCH, pivot tables, assumption cells, roll-forwards, circular references, Monte Carlo, or a Power Pivot model. Carries worked recipes, each labelled executed or semantics-cited in place, and states what each port costs. Works with or without a database connection.
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
  <!--
7
7
  Copyright (c) Credible Data Inc.
@@ -876,24 +876,25 @@ the given, which is what the `absolute` regions already list.
876
876
 
877
877
  ## Persistence
878
878
 
879
- `#@ persist` materializes a source so queries read a table. On a source that reads a given,
880
- **Publisher refuses it at planning**. Tested by adding `##! experimental.persistence` and
881
- `#@ persist name="compounding_tbl"` to
882
- `source: persisted_compounding is compounding -> { select: * }`, where `compounding` is the
883
- recursion in `translate-formulas.md` (it reads its givens through `%{ }`). The package's
884
- build plan listed it under `refusedSources` with `reason: reads_given` and the
885
- message that a given in a persisted query "is substituted at BUILD time, so the table
886
- would hold the default's rows and serve them to every caller". The same shape of
887
- recursion with its numbers written as literals was accepted into the build plan. Only
888
- planning was checked; no build was run.
879
+ `#(materialize)` materializes a source so queries read a table. On a source whose build
880
+ reads a given, **Publisher refuses it at planning** (`reads_given`). This was tested with
881
+ the legacy v1 spelling, `##! experimental.persistence` and `#@ persist name="compounding_tbl"`
882
+ on `source: persisted_compounding is compounding -> { select: * }`, where `compounding` is the
883
+ recursion in `translate-formulas.md` (it reads its givens through `%{ }`); `#(materialize)`
884
+ refuses a build that reads a given for the same reason. The package's build plan listed it
885
+ under `refusedSources` with `reason: reads_given` and the message that a given in a
886
+ persisted query "is substituted at BUILD time, so the table would hold the default's rows
887
+ and serve them to every caller". The same shape of recursion with its numbers written as
888
+ literals was accepted into the build plan. Only planning was checked; no build was run.
889
889
 
890
890
  So a scenario source is either **live** (reads givens; computed on every query; fine at
891
- forecast scale) or **persisted with fixed inputs** (a snapshot of one scenario, with the
892
- other inputs at their cell values). A grid ([SC8](#sc8)) can be persisted with every
893
- candidate row, and the row chosen at read time by an `extend { where: abs(growth -
894
- $SCENARIO_GROWTH) < 1e-9 }` on the persisted query, which `docs/materialization.md`
895
- describes as a read-time predicate; a literal-input grid with that `extend` was accepted
896
- into the build plan (not built).
891
+ forecast scale) or **materialized with fixed inputs** (a snapshot of one scenario, with the
892
+ other inputs at their cell values). A grid ([SC8](#sc8)) can be materialized with every
893
+ candidate row, and the row chosen at read time by a `where: abs(growth -
894
+ $SCENARIO_GROWTH) < 1e-9` on the materialized source itself, which `docs/materialization.md`
895
+ describes as a read-time predicate (a given-reading `where:` of the materialized source's
896
+ own is left out of the build and applied per caller); a literal-input grid with that
897
+ filter was accepted into the build plan (not built), tested with the v1 spelling.
897
898
 
898
899
  <a id="stays-in-excel"></a>
899
900
 
@@ -200,9 +200,9 @@ lookup regions: 40 of its 44 rows match and 4 do not, and the four are findings.
200
200
  ### Row cap and looping contexts
201
201
 
202
202
  Publisher caps a model query at 1000 rows unless the Malloy states its own `limit:`
203
- (`PUBLISHER_DEFAULT_QUERY_ROW_LIMIT`), and nothing reports the cut. A per-cell comparison
203
+ (`PUBLISHER_QUERY_DEFAULT_ROW_LIMIT`), and nothing reports the cut. A per-cell comparison
204
204
  over more rows silently truncates: put an explicit `limit:` in the query, above the row
205
- count you expect (the hard cap is `PUBLISHER_MAX_QUERY_ROWS`, 100000 by default; the REST
205
+ count you expect (the hard cap is `PUBLISHER_QUERY_MAX_ROWS`, 100000 by default; the REST
206
206
  body has no row-limit field), and compare the returned row count with the key's.
207
207
 
208
208
  To check one view at several criteria contexts, loop the values through `givens` and
@@ -156,8 +156,8 @@ run: compounding -> { select: *; order_by: period }
156
156
  Executed: with the defaults the five balances are 10500, 11025, 11576.25, 12155.0625
157
157
  and 12762.815625, the cached `Forecast!B6:F6`. With `givens: {"GROWTH_RATE": 0.02}` the
158
158
  fifth is 11040.808032, and with `0.08` it is 14693.280768, the cached What-If data
159
- table cells `Assumptions!E3` and `E6`. Label: `executed`. `#@ persist` on such a source
160
- is refused at planning (`reads_given`): a persisted build would bake in the
159
+ table cells `Assumptions!E3` and `E6`. Label: `executed`. `#(materialize)` on such a source
160
+ is refused at planning (`reads_given`): a materialized build would bake in the
161
161
  default givens. `cookbook-scenario.md#persistence` has what was tried.
162
162
 
163
163
  ## 3. Routes
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-getting-started
3
3
  description: First steps for using a Malloy Publisher deployment through its MCP tools. Use when connecting to Publisher for the first time, when you do not yet know the available environments, packages, or models, or when a user asks what data they can explore. Also use for "malloy help" or which Malloy skill to read. Covers verifying the server, discovering data with get_context, and running a first grounded query.
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
  <!--
7
7
  Copyright (c) Credible Data Inc.
@@ -20,7 +20,7 @@ At minimum you need `get_context`, `list_packages`, `execute_query`, and `search
20
20
 
21
21
  If none of the tools are there, either the server is not running or your client connected before it was. Start the server (`npx @malloy-publisher/server --port 4000`, or `bun run build && bun run start` from a clone) and wait until `curl -s http://localhost:4000/api/v0/status` reports `operationalState: serving`. If the point is to author models against a local package, add `--watch-env <env>`: without it Publisher copies local packages at boot and serves the copies, so saved edits are never read.
22
22
 
23
- If there is no Publisher workspace here at all, and the user wants to work with data of their own rather than the bundled examples, `npm create @malloy-publisher/malloy-package@latest <name>` scaffolds one: the package and a starter model, registered so the server actually serves it, plus the start script, the MCP config and these skills. Keep the `@latest` when you type it: `npm create` resolves through npm's npx cache and an unversioned name is satisfied by any copy already there, so on a machine that has scaffolded before npm never asks the registry and you get an old scaffolder pinning an old server, with nothing to say so. Run bare, it comes with a small sample dataset, so there is something to query straight away. In a fresh directory `npm start` then runs the pinned server against the package in watch mode; if the directory already had a `package.json` the scaffolder leaves it alone and adds no script, printing the equivalent `npx` command to use instead. Where you run it matters: only the package lands in `<name>/`, and the workspace files, the agent instructions and the MCP config among them, are written to the current directory. Run it here if this directory is empty or is meant to become the workspace. If it already holds other work, scaffold into a new directory instead (`mkdir my-data && cd my-data`), because agent config is discovered by walking up, so writing those files here changes what every session beneath this directory inherits. Seed the starter model from a local file with `npm create @malloy-publisher/malloy-package@latest <name> -- --data <path/to/their-file.csv>` (CSV, Parquet, or Excel `.xlsx`), keeping the `--`, which is how `npm create` passes options through. That path is relative to wherever you run the command, so if you scaffolded into a new directory it has to reach back out to their file; the scaffolder copies it into the package and leaves the original alone. A seeded package starts smaller than the sample one, since the scaffolder does not read their columns: expect a row count and an overview, and build the model from there. A package is just Malloy, so it can instead query a database connection the config defines. Because it writes a `.mcp.json` that did not exist when the client connected, the user has to restart or reconnect once before these tools appear, and their client will ask them to approve the new project-scoped server the first time. That only works when the workspace is at the session's own root, so if you scaffolded into a new directory below that root, the user has to open a session there instead: a `.mcp.json` further down is never discovered.
23
+ If there is no Publisher workspace here at all, and the user wants to work with data of their own rather than the bundled examples, `npm create @malloy-publisher/malloy-package@latest <name>` scaffolds one: the package and a starter model, registered so the server actually serves it, plus the start script, the MCP config and these skills. Keep the `@latest` when you type it: `npm create` resolves through npm's npx cache and an unversioned name is satisfied by any copy already there, so on a machine that has scaffolded before npm never asks the registry and you get an old scaffolder pinning an old server, with nothing to say so. Run bare, it comes with a small sample dataset, so there is something to query straight away. In a fresh directory `npm start` then runs the pinned server against the package in watch mode, with simulated materialization on (each materialized source is planned and its build simulated, rows are answered live, no table is written, and a materialization write answers 409 `SIMULATION_ACTIVE`; `npm start -- --no-materialize-simulate` turns it off); if the directory already had a `package.json` the scaffolder leaves it alone and adds no script, printing the equivalent `npx` command to use instead. Where you run it matters: only the package lands in `<name>/`, and the workspace files, the agent instructions and the MCP config among them, are written to the current directory. Run it here if this directory is empty or is meant to become the workspace. If it already holds other work, scaffold into a new directory instead (`mkdir my-data && cd my-data`), because agent config is discovered by walking up, so writing those files here changes what every session beneath this directory inherits. Seed the starter model from a local file with `npm create @malloy-publisher/malloy-package@latest <name> -- --data <path/to/their-file.csv>` (CSV, Parquet, or Excel `.xlsx`), keeping the `--`, which is how `npm create` passes options through. That path is relative to wherever you run the command, so if you scaffolded into a new directory it has to reach back out to their file; the scaffolder copies it into the package and leaves the original alone. A seeded package starts smaller than the sample one, since the scaffolder does not read their columns: expect a row count and an overview, and build the model from there. A package is just Malloy, so it can instead query a database connection the config defines. Because it writes a `.mcp.json` that did not exist when the client connected, the user has to restart or reconnect once before these tools appear, and their client will ask them to approve the new project-scoped server the first time. That only works when the workspace is at the session's own root, so if you scaffolded into a new directory below that root, the user has to open a session there instead: a `.mcp.json` further down is never discovered.
24
24
 
25
25
  If you started the server yourself in this session, the tools still will not appear: your tool list was fixed when you connected, and you cannot reconnect yourself. Tell the user the tools are missing for that reason and ask them to run `/mcp`, select `malloy`, and choose Reconnect. The panel offers `Authenticate` first and reports `Auth: not authenticated`; that is a red herring, the endpoint has no auth. Restarting Claude Code also works. Continue once the tools are there.
26
26
 
@@ -101,7 +101,7 @@ Two tools, in this order.
101
101
 
102
102
  **One call usually answers.** The response groups the fields that matched under the sources holding them, so there is no drill-down step: describe each field you need as its own target. A source in the results is not every field it holds, though. When a field you need is missing, a target is listed in `unresolved_targets`, or a warning says results were cut, call again with `source` in the scope and one target per missing concept. Two variations are worth knowing:
103
103
 
104
- - Omit a target's `search_text` to enumerate that type instead of ranking it. A lone `{"target_type": "source"}` is the catalog browse, which returns a thin card per source (a one-line summary rather than the full doc) and pages with `offset` and `next_offset`.
104
+ - Omit a target's `search_text` to enumerate that type instead of ranking it. A lone `{"target_type": "source"}` is the catalog browse, which returns a thin card per source (a one-line summary rather than the full doc) and pages with `offset` and `next_offset`. One source's field listing (field targets with no `search_text`, scoped to that source) pages with `entity_offset` and `next_entity_offset` instead; a field listing across the package does not page.
105
105
  - Add `source` to the scope to narrow to one source, which is also how to read that source's full doc after a browse.
106
106
 
107
107
  A search takes exactly one `scopes` entry, because retrieval is indexed per package. With no `search_targets`, `get_context` lists instead: no arguments lists the environments, `environment` lists that environment's packages, a package in `scopes` lists its sources, and a source lists its fields. A level with only one choice is entered, so on a server with one package a call with no arguments returns its sources.
@@ -121,7 +121,7 @@ The result is JSON. Charts and reports defined in the package render in the Publ
121
121
 
122
122
  Use `search_malloy_docs` for language questions (filters, aggregates, joins, nesting, renderers).
123
123
 
124
- If the data you want is in a connected database but not yet in any package, use `search_database_schema` instead of `get_context`: it walks a connection's schemas and tables and ranks them against a plain-English description, and hands back the `source:` line to start a model from. It returns names and types only, so to see what a column actually contains run `execute_query` against a model in a package that uses the same connection, with an ad-hoc query like `run: my_conn.table('sales.orders') -> { group_by: order_status }`. That tool needs an existing model to run against, so a table you have not modelled yet has none of its own.
124
+ If the data you want is in a connected database but not yet in any package, use `search_database_schema` instead of `get_context`: it walks a connection's schemas and tables and ranks them against a plain-English description, and hands back the `source:` line to start a model from. It returns metadata only, never a row value (names and types, plus, for one table named with `tableName`, native types, collations and stats such as the row count, never computed by counting rows), so to see what a column actually contains run `execute_query` against a model in a package that uses the same connection, with an ad-hoc query like `run: my_conn.table('sales.orders') -> { group_by: order_status }`. That tool needs an existing model to run against, so a table you have not modelled yet has none of its own.
125
125
 
126
126
  ## 4. What else you can do here
127
127
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-gotchas-modeling
3
3
  description: Malloy modeling mistakes and compile-error fixes. Read before writing sources, dimensions, measures or joins, and when a .malloy file will not compile. Reserved words, NULLs, dates, field access.
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
  <!--
7
7
  Copyright (c) Credible Data Inc.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-html-data-apps
3
3
  description: "Build or modify an in-package HTML data app for a Malloy Publisher package (a public/ directory the package serves): design it, write its Publisher.query code, embed it. Hand-authored, no build step."
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
  <!--
7
7
  Copyright (c) Credible Data Inc.
@@ -158,16 +158,16 @@ Authoring happens locally, then you publish. These are two stages.
158
158
  Run a local Publisher from the directory that holds your `publisher.config.json` and package folder(s):
159
159
 
160
160
  ```sh
161
- npx @malloy-publisher/server --server_root . --port 4000 --watch-env <env>
161
+ npx @malloy-publisher/server --root . --port 4000 --watch-env <env>
162
162
  ```
163
163
 
164
164
  **`--watch-env` is not optional if you are adding `public/` to a package that is already loaded.** Without it the server publishes each package at load time as an immutable version under `publisher_data/<env>/<pkg>/<version>/` and serves static files from that version, so a `public/` directory you create afterwards is never seen: every file in it 404s while the rest of the app serves normally. This is the most expensive mistake in this skill, because it looks like your page is broken rather than like the server is stale.
165
165
 
166
166
  If you did not start the server (someone handed you a running one), **probe before you build**: write a throwaway file into the package's `public/`, request it, and see whether you get 200 or 404. If it 404s, either restart with `--watch-env <env>`, or ship your files as a new version: bump the `version` in `publisher.json` and publish the package again. Never write into `publisher_data/`, which holds the published versions.
167
167
 
168
- `--watch-env <env>` (or `PUBLISHER_WATCH=<env>`) mounts that environment's local-dir packages in place (a symlink, not a copy) and watches them: editing a `.malloy` recompiles the package, and editing a `public/` file live-reloads any open page over an SSE stream. Nothing to wire in the page. The app is served at `http://localhost:4000/environments/<env>/packages/<pkg>/index.html`.
168
+ `--watch-env <env>` (or `PUBLISHER_WATCH_ENVIRONMENTS=<env>`) mounts that environment's local-dir packages in place (a symlink, not a copy) and watches them: editing a `.malloy` recompiles the package, and editing a `public/` file live-reloads any open page over an SSE stream. Nothing to wire in the page. The app is served at `http://localhost:4000/environments/<env>/packages/<pkg>/index.html`.
169
169
 
170
- `publisher.config.json` (at `--server_root`) declares the environment, its packages, and its connections:
170
+ `publisher.config.json` (at `--root`) declares the environment, its packages, and its connections:
171
171
 
172
172
  ```json
173
173
  {
@@ -65,10 +65,12 @@ Query the model once for each measure and dimension you plan to use, and look at
65
65
 
66
66
  ## Make it fast: store the source, roll up what it adds
67
67
 
68
- A data app over a warehouse table, or a file over about 100,000 rows, is materialized: its source stored as a table
69
- and the figures it adds up kept as rollups, so blocks answer from them. Read `skill:malloy-materialization` first:
70
- it says which spelling the server reads (`#(materialize)` and `#(rollup)`, or `#@ persist` and `#@ preaggregate`
71
- where the server's materialization switch is off and the newer tags would be ignored), and that a source with a row
68
+ A data app over a warehouse table, or a file over about 100,000 rows, is a candidate for materializing: its source stored as a table
69
+ and the figures it adds up kept as rollups, so blocks answer from them. Do not materialize by default: estimate first and get the
70
+ user's approval (`skill:malloy-materialization`, its `reference/estimating.md`). A new source for the app, like `sales` below, is a
71
+ shape choice: propose it to the user as one, separately from the annotations on it. Read `skill:malloy-materialization` first:
72
+ it says how to write `#(materialize)` and `#(rollup)`, how to check locally that they will build and serve
73
+ before publishing, and that a source with a row
72
74
  gate (`#(authorize)`, `#(access_filter)`) is built past its gate and must not be stored where every caller reads it.
73
75
  A small file in the package needs neither. What the kit adds to that skill:
74
76
 
@@ -63,7 +63,7 @@ The flag is per-file and required: without it the parameter list is a parse erro
63
63
 
64
64
  Two traps worth knowing before you build several of these:
65
65
 
66
- - **A persisted rollup is still read through a wrapper.** Extending or wrapping a persisted source keeps the persist annotation and still reads the built table, so a parameterised detail source over a rollup does not silently recompute it. The pattern is safe, and a slow drill is almost never the wrapper: look first at a missing filter or a grain that is not actually aggregated.
66
+ - **A materialized rollup is still read through a wrapper.** Extending or wrapping a `#(materialize)` source reads its built table through the served copy, so a parameterised detail source over a rollup does not silently recompute it. The pattern is safe, and a slow drill is almost never the wrapper: look first at a missing filter or a grain that is not actually aggregated.
67
67
  - **An inherited view can be meaningless under a parameter.** A source scoped to one entity inherits views that only make sense across many: a sentiment split on a single-sentiment theme collapses to 0% or 100%, a share-of-total becomes 100%. Declare purpose-built views on the detail source for those, and say in the source's doc comment which inherited views not to use.
68
68
 
69
69
  ### When you cannot change the model
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: malloy-lookml-review
3
3
  description: Analyze LookML files as prior art for Malloy modeling. Used during Step 1 (DISCOVER) when .lkml files are present. Coordinates reference files that extract business logic, relationships, and curation decisions. Works with or without a database connection.
4
- version: 0.1.62
4
+ version: 0.1.64
5
5
  ---
6
6
  <!--
7
7
  Copyright (c) Credible Data Inc.