Files
chemenu/types/type-spec.md
T
torben 7f74303a00
CI / verify (push) Successful in 52s
Release / release (push) Successful in 36s
kb/concepts/ bekommt Areas: layout: fuer concept, Area-Titel aus jedem Type-Spec, Schwellen-Empfehlung im lint (schliesst #59)
Files changed:
- CHANGES.md
- README.md
- VERSION
- kb/concepts/Ambient Environment Dependency.md
- kb/concepts/Anti-Cramming Heuristic.md
- kb/concepts/Audit Trail.md
- kb/concepts/BM25.md
- kb/concepts/Bulk Operations.md
- kb/concepts/CI Integration.md
- kb/concepts/COLLECTION.md
- kb/concepts/CPPC.md
- kb/concepts/Checkpoint Audit.md
- kb/concepts/Claude Code Auto Mode.md
- kb/concepts/Command Round-Trip Integrity.md
- kb/concepts/Confidence Scoring.md
- kb/concepts/Consolidation Tiers.md
- kb/concepts/Content Quality Control.md
- kb/concepts/Context Isolation.md
- kb/concepts/Contradiction Resolution.md
- kb/concepts/Cross-platform Agent Skills.md
- kb/concepts/Crystallization.md
- kb/concepts/Delete Rather Than Anonymize.md
- kb/concepts/Denylist over Allowlist.md
- kb/concepts/Detect-Repair Asymmetry.md
- kb/concepts/Diff-Reviewable Agent Edits.md
- kb/concepts/Dual Licensing by File Plan.md
- kb/concepts/Entity Extraction.md
- kb/concepts/Episodic Memory.md
- kb/concepts/Event-Driven Automation.md
- kb/concepts/Filter on Ingest.md
- kb/concepts/Forgetting.md
- kb/concepts/Graph Traversal.md
- kb/concepts/Green Suite Blind Spot.md
- kb/concepts/Hooks.md
- kb/concepts/Hybrid Search.md
- kb/concepts/INDEX.md
- kb/concepts/Implementation Spectrum.md
- kb/concepts/Index Scaling.md
- kb/concepts/Issue Label Scheme.md
- kb/concepts/Iteration and Cost Limits.md
- kb/concepts/KB Migration.md
- kb/concepts/KB Stack Versioning.md
- kb/concepts/Knowledge Compounding.md
- kb/concepts/Knowledge Graph.md
- kb/concepts/LLM Wiki Pattern.md
- kb/concepts/Lint Workflow.md
- kb/concepts/MCP-Leseserver.md
- kb/concepts/Mass-Update Gate.md
- kb/concepts/Memory Lifecycle.md
- kb/concepts/Mesh Sync.md
- kb/concepts/Modbus.md
- kb/concepts/Multi-Agent Collaboration.md
- kb/concepts/Naming Convention Conflict.md
- kb/concepts/OKF Compatibility.md
- kb/concepts/Optional Instance Context File.md
- kb/concepts/Personalization Plane.md
- kb/concepts/Privacy and Governance.md
- kb/concepts/Procedural Memory.md
- kb/concepts/Publish-Remote Gate.md
- kb/concepts/Quality Scoring.md
- kb/concepts/Quality and Self-Correction.md
- kb/concepts/RAG.md
- kb/concepts/Reciprocal Rank Fusion.md
- kb/concepts/SSD TRIM.md
- kb/concepts/Scale Ceiling.md
- kb/concepts/Self-Healing.md
- kb/concepts/Semantic Lint Automation.md
- kb/concepts/Semantic Memory.md
- kb/concepts/Session Orientation.md
- kb/concepts/Shared vs Private.md
- kb/concepts/Split Merge Reclassify.md
- kb/concepts/Split Threshold.md
- kb/concepts/Structural Enforcement over Documented Rule.md
- kb/concepts/Stub Threshold.md
- kb/concepts/Supersession.md
- kb/concepts/Three-Layer Architecture.md
- kb/concepts/Token Economics.md
- kb/concepts/Typed Relationships.md
- kb/concepts/User Management.md
- kb/concepts/Vector Search.md
- kb/concepts/Work Coordination.md
- kb/concepts/Workflow Extraction.md
- kb/concepts/Workflow Orchestration.md
- kb/concepts/Working Memory.md
- kb/concepts/Write-Once Frontmatter Fields.md
- kb/concepts/architectures/Consolidation Tiers.md
- kb/concepts/architectures/Context Isolation.md
- kb/concepts/architectures/Cross-platform Agent Skills.md
- kb/concepts/architectures/Episodic Memory.md
- kb/concepts/architectures/Hybrid Search.md
- kb/concepts/architectures/Implementation Spectrum.md
- kb/concepts/architectures/Knowledge Graph.md
- kb/concepts/architectures/LLM Wiki Pattern.md
- kb/concepts/architectures/MCP-Leseserver.md
- kb/concepts/architectures/Memory Lifecycle.md
- kb/concepts/architectures/OKF Compatibility.md
- kb/concepts/architectures/Optional Instance Context File.md
- kb/concepts/architectures/Personalization Plane.md
- kb/concepts/architectures/Procedural Memory.md
- kb/concepts/architectures/RAG.md
- kb/concepts/architectures/Scale Ceiling.md
- kb/concepts/architectures/Semantic Memory.md
- kb/concepts/architectures/Three-Layer Architecture.md
- kb/concepts/architectures/Token Economics.md
- kb/concepts/architectures/Working Memory.md
- kb/concepts/decisions/Delete Rather Than Anonymize.md
- kb/concepts/decisions/Denylist over Allowlist.md
- kb/concepts/decisions/Diff-Reviewable Agent Edits.md
- kb/concepts/decisions/Dual Licensing by File Plan.md
- kb/concepts/decisions/Issue Label Scheme.md
- kb/concepts/decisions/KB Stack Versioning.md
- kb/concepts/decisions/Structural Enforcement over Documented Rule.md
- kb/concepts/patterns/Audit Trail.md
- kb/concepts/patterns/BM25.md
- kb/concepts/patterns/Command Round-Trip Integrity.md
- kb/concepts/patterns/Confidence Scoring.md
- kb/concepts/patterns/Contradiction Resolution.md
- kb/concepts/patterns/Entity Extraction.md
- kb/concepts/patterns/Filter on Ingest.md
- kb/concepts/patterns/Forgetting.md
- kb/concepts/patterns/Graph Traversal.md
- kb/concepts/patterns/Mesh Sync.md
- kb/concepts/patterns/Quality Scoring.md
- kb/concepts/patterns/Reciprocal Rank Fusion.md
- kb/concepts/patterns/Self-Healing.md
- kb/concepts/patterns/Shared vs Private.md
- kb/concepts/patterns/Typed Relationships.md
- kb/concepts/patterns/Vector Search.md
- kb/concepts/patterns/Work Coordination.md
- kb/concepts/problems/Ambient Environment Dependency.md
- kb/concepts/problems/Detect-Repair Asymmetry.md
- kb/concepts/problems/Green Suite Blind Spot.md
- kb/concepts/problems/Naming Convention Conflict.md
- kb/concepts/problems/Write-Once Frontmatter Fields.md
- kb/concepts/protocols/CPPC.md
- kb/concepts/protocols/Modbus.md
- kb/concepts/protocols/SSD TRIM.md
- kb/concepts/workflows/Anti-Cramming Heuristic.md
- kb/concepts/workflows/Bulk Operations.md
- kb/concepts/workflows/CI Integration.md
- kb/concepts/workflows/Checkpoint Audit.md
- kb/concepts/workflows/Claude Code Auto Mode.md
- kb/concepts/workflows/Content Quality Control.md
- kb/concepts/workflows/Crystallization.md
- kb/concepts/workflows/Event-Driven Automation.md
- kb/concepts/workflows/Hooks.md
- kb/concepts/workflows/Index Scaling.md
- kb/concepts/workflows/Iteration and Cost Limits.md
- kb/concepts/workflows/KB Migration.md
- kb/concepts/workflows/Knowledge Compounding.md
- kb/concepts/workflows/Lint Workflow.md
- kb/concepts/workflows/Mass-Update Gate.md
- kb/concepts/workflows/Multi-Agent Collaboration.md
- kb/concepts/workflows/Privacy and Governance.md
- kb/concepts/workflows/Publish-Remote Gate.md
- kb/concepts/workflows/Quality and Self-Correction.md
- kb/concepts/workflows/Semantic Lint Automation.md
- kb/concepts/workflows/Session Orientation.md
- kb/concepts/workflows/Split Merge Reclassify.md
- kb/concepts/workflows/Split Threshold.md
- kb/concepts/workflows/Stub Threshold.md
- kb/concepts/workflows/Supersession.md
- kb/concepts/workflows/User Management.md
- kb/concepts/workflows/Workflow Extraction.md
- kb/concepts/workflows/Workflow Orchestration.md
- kb/index.md
- kb/log.md
- tools/CONTRACT.md
- tools/README.md
- tools/chemenu/catalog.py
- tools/chemenu/commands/index_build.py
- tools/chemenu/lint_core.py
- tools/chemenu/tests/conftest.py
- tools/chemenu/tests/test_cite_cmd.py
- tools/chemenu/tests/test_git_publish.py
- tools/chemenu/tests/test_index_build.py
- tools/chemenu/tests/test_lint.py
- tools/chemenu/tests/test_new_page.py
- tools/chemenu/tests/test_provenance.py
- tools/chemenu/tests/test_type_resolver.py
- tools/chemenu/tests/test_xref.py
- types/concept.md
- types/type-spec.md
2026-09-08 10:07:46 +02:00

11 KiB

type, name, description, schema
type name description schema
types/type-spec.md type-spec Authoring and validation contract for path-valued Chemenu type specifications types/type-spec.schema.yaml

Type spec

A type-spec doc is the authoring and validation contract for one Chemenu artifact type. Artifact frontmatter stores the repo-relative path to this doc in type:, and this file serves several consumers differently: an author writing a new instance reads it for what to write, someone unfamiliar with the type reads it for what to expect from an instance before opening one, and the validator and the type-conformance reviewer read it to check conformance.

Required Frontmatter

  • type: types/type-spec.md. The root type spec is self-referential and uses the same value.
  • name: short human-facing type name. This is also the type's logical "kind" - tooling resolves an instance's type: path to this name instead of hardcoding a type-path-to-kind mapping.
  • description: retrieval description for the type contract.
  • schema: repo-relative path to the .schema.yaml file that validates artifacts of this type, or null when the type has no schema.
  • subtype_field (optional): the frontmatter field name on instances of this type that carries a subtype/category (e.g. entity_type), or omitted if this type has no such field.

Validation Contract

Two systems check conformance to a type:

  • The deterministic validator checks the symbolic half: frontmatter fields, enums, path patterns, and syntactic body shape (required headings, section counts, date formats) — whatever the named .schema.yaml can statically specify. It parses structure; it never judges meaning.
  • The type-conformance review gate checks the semantic half: everything about an instance that is not mechanically checkable — a description's routing quality, a title's claim-shape, whether the body's claims hold up — judged against this file's body, read as natural-language authoring instructions applied by an LLM reviewer.

Do not restate a schema rule in body text. The validator already enforces it, so the restatement adds no protection — it only spends the reviewer's judgment re-confirming something already guaranteed, instead of on the properties only a reviewer can check.

Writing Shape

  • Write the body as a content contract: checkable properties of a conforming instance, in a form the type-conformance gate can apply directly. Prefer "what a conforming instance contains or claims" over "how to produce one" — production process is invisible to the reviewer, so it belongs in a skill or instruction, linked rather than embedded.
  • State what the type is for and when an author should choose it over a neighboring type.
  • Document the frontmatter fields (required and optional) as a reference for authors; the schema is the sole source of truth for requiredness.
  • When schema is non-null and implies body structure beyond type/name/description, include a ## Template an authoring agent can copy.

The type layer

types/ is the repo's global type surface: one set of type-specs serving every collection under kb/. It is deliberately not a collection and carries no COLLECTION.md — there is no per-collection type surface, and tools/wikitool docs verify fails if a contract appears here.

Who owns a type-spec

types/ holds two kinds of file, and the line between them is root: — already in the frontmatter before anyone drew it:

Type-spec Describes Owned by Ships as
root: kb (entity, concept, source, comparison) A page this instance writes The instance types/<name>.md.template plus its .schema.yaml.template, adopted by a rename
root: repo (instruction), no base_dir (lint-report), and type-spec itself A stack artifact The stack Verbatim

A page type-spec's prose, its ## Template body and its language are therefore the instance's to rewrite — an instance writing its pages in another language simply translates the file, and an upgrade does not take that back. Improvements to a shipped default reach it as an offered migration (instructions/CONTRACT.md), never by overwriting.

What the stack still requires of the type layer is one line. There must be a type-spec declaring name: source whose schema requires raw_files: — the whole raw/kb/ provenance path (sources coverage, [^cite-id] resolution, kb/provenance.md) asks page.kind == "source", so without it nothing resolves. docs verify checks exactly that and nothing beyond it: not the directory, not the title prefix, not a word of the prose. Which collection is stack-required is derived from where that type writes rather than listed separately, so renaming it stays consistent instead of tripping a hardcoded name.

Quality goal: a type-spec is the single source of truth for its type. No structural fact about a page type may be restated anywhere else — not in AGENTS.md, not in a skill, not in Python. Adding a type must require no code change.

Anatomy of a type

Each type is two files:

File Owns
types/<name>.md The authoring contract: when to use the type, when not to, guidance, and the ## Template block used to scaffold new pages
types/<name>.schema.yaml The machine-checkable half: fields, types, enums, defaults, required-ness, additionalProperties: false

This file is the self-referential root contract that both are validated against.

Placement frontmatter

Beyond the required fields above, a type-spec declares where its instances are written. Never choose a directory by hand - root plus base_dir plus layout decide placement, and tools/wikitool new writes the file.

Field Required Use
base_dir Yes for instantiable types Directory where instances are written, e.g. entities. Relative to the root named by root:
root No Which root base_dir resolves against: kb (default, config.KB_DIR) or repo (config.ROOT)
layout No Maps each subtype to its dir and index title
title_prefix No Prepended to the page title, e.g. Source -
page_ref_fields No Fields whose entries are page titles, e.g. [related, sources]. lint checks they resolve; rename/rm rewrite them

root: kb is the default because it is what every knowledge type wants, and because keeping placement kb-relative is what lets a test point config.KB_DIR at a fixture and be certain nothing can write into the real kb/. root: repo is opt-in, for types whose artifacts are legitimately not knowledge: instruction is the worked example - an agent-directed procedure under instructions/, outside the raw/ -> kb/ provenance rules entirely.

layout is what turns a subtype field into areas, and it is optional in both directions on purpose. Declaring one makes every instance land in a directory named by its subtype and gives that directory its index title; leaving it off keeps the collection flat, however many subtypes the schema allows. The choice is whether the split helps - the catalog shards per area, so areas are how a large collection stays readable, but a subtype whose values are lopsided produces one big area and a handful of splinters and is better left flat (source is the worked example, concept the opposite one). wikitool lint will say which case a collection is in once it grows past the shard threshold; a dir: must be a single path segment, because an area is as deep as a page goes.

A type-spec without base_dir is a contract only and cannot be instantiated; wikitool new <name> refuses it. lint-report is the worked example: its artifacts are generated into reports/, so it describes a file format without owning a place anything writes to.

Adding a type

  1. Write types/<name>.md with the frontmatter above and a ## Template fenced block.
  2. Write types/<name>.schema.yaml declaring every field, with additionalProperties: false.
  3. Confirm it is discovered: tools/wikitool types list, then tools/wikitool types describe <name>.
  4. Scaffold with tools/wikitool new <name> --name "..." --set field=value.

No Python change is needed at any step; wikitool discovers types by scanning this directory.

Template variables

The ## Template block is filled from the page's own frontmatter, plus {name} and {today}. Filters render structured fields: {entities|bullets}, {tags|join}, {entity_type|capitalize}, {entities|table_header}, {entities|table_sep}, {entities|table_cells}. {field|literal text} falls back to the literal when the field is absent.

A template never contains a tool-owned region. The links and footnotes regions are generated between markers by xref and cite, rendered from frontmatter, and re-rendered on every write - so scaffolding them would create a section an author is forbidden to edit and the tool would replace anyway. See tools/chemenu/blocks.py.

Ownership boundary

Owned here Owned by kb/CONTRACT.md Owned by kb/CONVENTIONS.md and the collection contracts
Frontmatter fields, enums, defaults, required-ness Provenance and citation mechanics Quality goal and tone
Directory placement and title prefix The confidence machinery Naming conventions and the confidence rubric
Body skeleton (template) Linking mechanics and the orphan check Relationship vocabulary
When to use / not use this type The prose/identifier rule The KB language and its section-heading names

If a rule would be identical for every type and every instance, it belongs in kb/CONTRACT.md. If every instance would answer it differently, it belongs in kb/CONVENTIONS.md. If it is identical for every page in one collection, it belongs in that collection's COLLECTION.md.

What does not belong here

  • Page instances. Nothing under types/ is content.
  • A COLLECTION.md. types/ is a framework surface, not a collection.
  • Anything already enforced by a .schema.yaml restated in prose as if it were separately authoritative.

Template

---
type: types/type-spec.md
name: {type-name}
description: "{Retrieval description for this type contract}"
schema: {types/{type-name}.schema.yaml or null}
---

# {Type name}

{What this type is for, and when to choose it over a neighboring type.}

## Frontmatter

| Field | Required | Use |
|---|---:|---|
| `type` | Yes | `{this type spec's own repo path}` |
| `name` | Yes | {short human-facing type name} |
| `description` | Yes | {retrieval description for instances of this type} |
| `schema` | Yes | {repo-relative path to schema.yaml or null} |

## Template

```markdown
{a copyable frontmatter + body skeleton matching the schema}
```

Relevant Notes:

  • This is the root type-spec that all other type-specs reference
  • Type-specs form the structural backbone of the wiki's type system
  • All validation flows through type-spec definitions