Skip to content

D68b — A new pack starts from a working one, beside the packs kg ships

  • Status: Accepted — amends D65 (a project's packs/ adds to the shipped packs); amended by D68d (what kg schema test loads)
  • Date: 2026-11-15
  • Origin: planning how a person sets up a graph for a domain kg does not ship
  • Area: schema

Decision

  • kg schema new <pack> --type <name> [--about …] [--into DIR] writes <pack>@0.1/pack.yaml into this project's packs/ folder, or into $KG_PACKS, or into --into. The pack it writes:
  • imports _shared@0.1;
  • has one type with identity rules, name, aliases, country, registry_id and a status with transitions;
  • has an operator edge to organisation, and a discovery channel that any scope of the type gets, with or without an organisation to anchor it;
  • has two fixtures, one that must match and one that must not.

It loads as written, both its fixtures resolve as they say, and every block carries a comment on what to change. - It never writes over anything. It refuses: - a pack name already in the folder, at any version; - an ill-formed name; - the folder of packs kg ships with; - a $KG_PACKS folder without _shared@0.1: it is then the only folder kg reads, and the new pack's import would not load; - a type name _shared@0.1 already declares (organisation, person_base). - A project's own packs/ now adds to the shipped packs instead of replacing them (config.pack_roots). A pack of the same name in the project stands in for the shipped one, so a project's datacenter@0.2 hides the shipped datacenter@0.1. --packs and $KG_PACKS still name the one folder used. - A type name can be in two packs, but held entities keep their pack. Every entity records the pack that wrote it, and kg init --pack refuses a set in which another pack would supply that type, so a project's data_center never takes over the shipped pack's data centres. - A dataset is checked and rebuilt with the packs it pins, with what they import, not with every pack (amending D68): with a project's person beside the politics pack's, every pack no longer loads together. kg bundle verify, kg rebuild, kg dataset show and their MCP ops all do this. The MCP ops never open the server's own graph, whose packs may not load together. - What comes next is the person's, or their agent's (the kg skill): 1. fill in the pack from what they track; 2. run kg schema test; 3. run kg init --pack <pack>@0.1 (D68).

Why

  • A new pack meant copying every shipped pack. A project folder replaced the shipped one, so a new pack also had to carry a copy of _shared@0.1, and its author started from a blank YAML file and a guide.
  • A pack that already works can be changed one block at a time, checking each change with kg schema test.
  • kg makes no model calls. The drafting is done by the agent that interviews the person, so the scaffold only has to be a sound, commented starting point.

Rejected alternatives

  • Drafting the pack from a description inside kg: that would put a model call inside kg, which has none.
  • Taking a pack in both folders by ref instead of by name: two versions of one pack would both load in a graph that records nothing, and the later one would silently overwrite the other's types.

Consequences

  • A project that copied the shipped packs into its own packs/ keeps working. Its copies stand in for the shipped ones, by name.