schemacanonicalOWNER-2026-07-10

Schema — library.json · schema-library-json

Owner directive (2026-07-10), canonical. "The knowledged library with every concep and highlevel search and visualization in a 5th page" — the library must compile to one machine-readable graph the app can search and visualize. [src: wiki/development/prompts-archive/by-topic/knowledge-management-and-concept-modeling.md:629]

Content

The compiled form of bp-002-knowledge-library: _meta tooling walks every card, validates the gates, and emits library.jsonnodes (one per card), edges (wikilink + composition relations), counts, and a content_hash so consumers (bp-001-spatial-site page 5, the neural-engine) can verify they hold the exact resolved layer. The shape mirrors the proven wiki concept graph (meta{generated,nodes,edges} + nodes[{id,label,definition,section,sources[{type,path,line}],…}] + edges[{from,to,rel}] — 823 nodes/1172 edges as of 2026-06-30) [src: wiki/graph/concepts.json:1], with library-specific fields from the card frontmatter (type, status, authority) per the template [src: HOS-Instance/library/_templates/TEMPLATE.md:1].

Hashing follows the Genome precedent: a strand-style content_hash (sha256: prefix, hex digest) as used by instance genomes [src: wiki/organizations/instances/royalorbit/genome.json:50].

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "hos://schemas/library.json",
  "title": "HOS Knowledge Library graph",
  "type": "object",
  "required": ["meta", "nodes", "edges"],
  "properties": {
    "meta": {
      "type": "object",
      "required": ["generated", "counts", "content_hash"],
      "properties": {
        "generated": { "type": "string", "format": "date" },
        "counts": {
          "type": "object",
          "description": "node/edge totals plus per-type card counts",
          "required": ["nodes", "edges"],
          "properties": {
            "nodes": { "type": "integer", "minimum": 0 },
            "edges": { "type": "integer", "minimum": 0 },
            "by_type": {
              "type": "object",
              "additionalProperties": { "type": "integer", "minimum": 0 }
            }
          }
        },
        "content_hash": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{16,64}$",
          "description": "digest over all card bodies in id order — Genome-style verify"
        }
      }
    },
    "nodes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "label", "type", "status", "definition", "sources"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
          "label": { "type": "string" },
          "type": {
            "enum": ["concept", "kernel", "cogni", "genome", "neuralware",
                     "playbook", "cookbook", "blueprint", "schematic", "schema",
                     "sop", "bpmn", "benchmark", "okr", "squad", "run",
                     "venture", "endeavor", "district", "source"]
          },
          "status": { "enum": ["canonical", "variant", "deprecated", "draft"] },
          "authority": { "type": "array", "items": { "type": "string" } },
          "definition": { "type": "string", "description": "first paragraph of ## Content" },
          "section": { "type": "string", "description": "library folder, e.g. cookbooks" },
          "sources": {
            "type": "array", "minItems": 1,
            "items": {
              "type": "object",
              "required": ["type", "path", "line"],
              "properties": {
                "type": { "enum": ["code", "doc", "prompt", "data"] },
                "path": { "type": "string" },
                "line": { "type": "integer", "minimum": 1 }
              }
            }
          },
          "tags": { "type": "array", "items": { "type": "string" } },
          "updated": { "type": "string", "format": "date" },
          "degree": { "type": "integer", "minimum": 0 },
          "has_variants": { "type": "boolean" },
          "open_question": { "type": "boolean" }
        }
      }
    },
    "edges": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["from", "to", "rel"],
        "properties": {
          "from": { "type": "string" },
          "to": { "type": "string" },
          "rel": { "enum": ["wikilink", "uses", "used-by", "supersedes", "see-also"] }
        }
      }
    }
  }
}

Invariants (checked at compile, beyond the JSON Schema): every edges[].from/to resolves to a nodes[].id (zero-orphans gate [src: HOS-Instance/library/_templates/TEMPLATE.md:50]); has_variants: trueauthority non-empty OR (status: "draft" AND open_question: true) [src: HOS-Instance/library/_templates/TEMPLATE.md:46]; id unique.

Composition

See also

Linked from — 7 cards