Skip to content

D50b — A pack ships named questions; a graph may save its own

  • Status: Accepted
  • Date: 2026-09-23
  • Origin: slice 27 build
  • Area: schema

Decision

  • A pack may declare queries:: {name, description, sql, params?}.
  • The loader refuses one that is not a SELECT, and a name two packs declare.
  • kg schema test compiles each against the store's schema and the type views.
  • The datacenter pack ships unnamed_operator_sites, power_by_region, unverified_updates and sites_of(:org). The politician pack ships members_by_party and seatless_commons.
  • A graph may save its own: kg query save <name> --sql … into a local saved_queries table (schema 12). A saved query must run before it is kept. It stays in this graph, like its watchlists, and is never exported.
  • kg query run <name> [--param k=v], kg query list and kg query rm (MCP queries, query_run, query_save, query_rm). A local name hides a pack's query of the same name, with a warning each time it runs.
  • The round-trip proof runs every pack query on the rebuilt graph and expects the same answer.

Why

The questions a pack's users ask again and again are part of the pack, like its expectations (D48): which sites nobody runs, where the power is. Shipping them means each person does not write them again, and they are checked against the schema whenever the pack is. A person's own questions are theirs and may name things that are not for sharing.

Alternatives

  • Share saved queries through the dataset. A query can hold a private name in its text; if it is needed, it can be shared as a file later, as scopes were (D47l).
  • Local only. Every user of a pack would rewrite the same questions.