Skip to main content
Schema validation keeps page types consistent. You write a JSON Schema for each type, such as runbook or decision, and KiwiFS checks the frontmatter of every page of that type before the write lands. Agents and people get an immediate error instead of leaving half-filled pages behind.

How it works

  1. A page declares its type in a discriminator field, type by default.
  2. KiwiFS looks for .kiwi/schemas/{value}.json.
  3. If that schema exists, the page’s frontmatter is validated against it.
  4. Pages with no discriminator, or with a type that has no schema, are never checked.
Validation runs inside the write pipeline, so it covers REST, MCP, imports, and the filesystem protocols alike. Only frontmatter is validated, not the page body.

Turn on enforcement

.kiwi/config.toml
Start with enforce_level = "warn" on an existing knowledge base. Fix the pages the server log reports, then switch to reject.

Write a schema

Schemas are standard JSON Schema files, one per type. The filename without .json is the type value.
.kiwi
schemas
runbook.json
decision.json
Terminal
Saving through the API reloads the schemas immediately.
Type names may contain letters, digits, hyphens, and underscores. Schema files are configuration, not pages: saving one does not create a git commit. With that schema in place, this page is accepted:
runbooks/db-failover.md
The runbook, tasks, data, adr, and other kiwifs init templates ship with schemas in .kiwi/schemas/. Enforcement stays off until you turn it on.

Validation errors

With enforce_level = "reject", an invalid write returns 422 Unprocessable Entity and nothing is written. The message names the type and each violation:
422 Unprocessable Entity
MCP write tools return the same message as a tool error, so agents can fix the frontmatter and retry.

List and read schemas

Terminal

Schemas REST API

List, read, and save schemas.

Configuration

The [schema] section.

Templates

Init templates that include schemas.

Files as truth

Frontmatter as structured data.
Last modified on October 19, 2026